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


PHP Transaction::getDescription方法代码示例

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


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

示例1: testGetterSetter

 public function testGetterSetter()
 {
     $this->assertEquals(AmountTest::$currency, $this->transaction->getAmount()->getCurrency());
     $this->assertEquals(self::$description, $this->transaction->getDescription());
     $this->assertEquals(self::$invoiceNumber, $this->transaction->getInvoiceNumber());
     $this->assertEquals(self::$custom, $this->transaction->getCustom());
     $this->assertEquals(self::$softDescriptor, $this->transaction->getSoftDescriptor());
     $items = $this->transaction->getItemList()->getItems();
     $this->assertEquals(ItemTest::$quantity, $items[0]->getQuantity());
     $this->assertEquals(PayeeTest::$email, $this->transaction->getPayee()->getEmail());
     $resources = $this->transaction->getRelatedResources();
     $this->assertEquals(AuthorizationTest::$create_time, $resources[0]->getAuthorization()->getCreateTime());
 }
开发者ID:johnmicahmiguel,项目名称:yodaphp,代码行数:13,代码来源:TransactionTest.php

示例2: getLinkCheckOut

 public function getLinkCheckOut($params = null)
 {
     if (!$params) {
         return false;
     }
     /*Payer
     	 A resource representing a Payer that funds a payment
     	 For paypal account payments, set payment method
     	 to 'paypal'.
     	 */
     $payer = new Payer();
     $payer->setPaymentMethod("paypal");
     $itemList = new ItemList();
     // Item must be a array and has one or more item.
     if (!$params['items']) {
         return false;
     }
     $arrItem = [];
     foreach ($params['items'] as $key => $item) {
         $it = new Item();
         $it->setName($item['name'])->setCurrency($params['currency'])->setQuantity($item['quantity'])->setPrice($item['price']);
         $arrItem[] = $it;
     }
     $itemList->setItems($arrItem);
     $amount = new Amount();
     $amount->setCurrency($params['currency'])->setTotal($params['total_price']);
     $transaction = new Transaction();
     $transaction->setAmount($amount)->setItemList($itemList)->setDescription($params['description']);
     // ### Redirect urls
     // Set the urls that the buyer must be redirected to after
     // payment approval/ cancellation.
     $redirectUrls = new RedirectUrls();
     $baseUrl = $this->getBaseUrl();
     $redirectUrls->setReturnUrl($baseUrl . $this->successUrl)->setCancelUrl($baseUrl . $this->cancelUrl);
     // ### Payment
     // A Payment Resource; create one using
     // the above types and intent set to 'sale'
     $payment = new Payment();
     $payment->setIntent("sale")->setPayer($payer)->setRedirectUrls($redirectUrls)->setTransactions([$transaction]);
     // ### Create Payment
     // Create a payment by calling the 'create' method
     // passing it a valid apiContext.
     try {
         $payment->create($this->config);
     } catch (PayPal\Exception\PPConnectionException $ex) {
         throw new \DataErrorException($ex->getData(), $ex->getMessage());
     }
     // ### Get redirect url
     $redirectUrl = $payment->getApprovalLink();
     return ['payment_id' => $payment->getId(), 'status' => $payment->getState(), 'redirect_url' => $redirectUrl, 'description' => $transaction->getDescription()];
 }
开发者ID:betsuno,项目名称:yii2-paypal,代码行数:51,代码来源:RestAPI.php


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