当前位置: 首页>>代码示例>>PHP>>正文


PHP Details::getShipping方法代码示例

本文整理汇总了PHP中PayPal\Api\Details::getShipping方法的典型用法代码示例。如果您正苦于以下问题:PHP Details::getShipping方法的具体用法?PHP Details::getShipping怎么用?PHP Details::getShipping使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PayPal\Api\Details的用法示例。


在下文中一共展示了Details::getShipping方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testGetters

 /**
  * @depends testSerializationDeserialization
  * @param Details $obj
  */
 public function testGetters($obj)
 {
     $this->assertEquals($obj->getSubtotal(), "12.34");
     $this->assertEquals($obj->getShipping(), "12.34");
     $this->assertEquals($obj->getTax(), "12.34");
     $this->assertEquals($obj->getHandlingFee(), "12.34");
     $this->assertEquals($obj->getShippingDiscount(), "12.34");
     $this->assertEquals($obj->getInsurance(), "12.34");
     $this->assertEquals($obj->getGiftWrap(), "12.34");
     $this->assertEquals($obj->getFee(), "12.34");
 }
开发者ID:fengyeno,项目名称:fille,代码行数:15,代码来源:DetailsTest.php

示例2: Payer

use PayPal\Api\Payment;
use PayPal\Api\Transaction;
use PayPal\Api\RedirectUrls;
use PayPal\Exception\PayPalConnectionException;
require '../src/start.php';
$payer = new Payer();
$amount = new Amount();
$details = new Details();
$payment = new Payment();
$transaction = new Transaction();
$redirectUrls = new RedirectUrls();
// Payer
$payer->setPaymentMethod('paypal');
// Details
$details->setShipping('2.00')->setTax('0.00')->setSubtotal('20.00');
$total = number_format($details->getSubtotal() + $details->getShipping() + $details->getTax(), 2);
// Amount
$amount->setCurrency('GBP')->setTotal($total)->setDetails($details);
// Transaction
$transaction->setAmount($amount)->setDescription('Membership');
// Payment
$payment->setIntent('sale')->setPayer($payer)->setTransactions([$transaction]);
// Redirect Urls
$redirectUrls->setReturnUrl('http://localhost/pp/paypal/pay.php?approved=true')->setCancelUrl('http://localhost/pp/paypal/pay.php?approved=false');
$payment->setRedirectUrls($redirectUrls);
try {
    $payment->create($api);
    $hash = md5($payment->getId());
    $_SESSION['paypal_hash'] = $hash;
    $store = $db->prepare("\n\t\tINSERT INTO transactions_paypal (user_id, payment_id, hash, complete)\n\t\tVALUES (:user_id, :payment_id, :hash, 0)\n\t");
    $store->execute(['user_id' => $_SESSION['user_id'], 'payment_id' => $payment->getId(), 'hash' => $hash]);
开发者ID:Nayami,项目名称:ppal_training,代码行数:31,代码来源:payment.php


注:本文中的PayPal\Api\Details::getShipping方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。