當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Payment::authorize方法代碼示例

本文整理匯總了PHP中Magento\Sales\Model\Order\Payment::authorize方法的典型用法代碼示例。如果您正苦於以下問題:PHP Payment::authorize方法的具體用法?PHP Payment::authorize怎麽用?PHP Payment::authorize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Magento\Sales\Model\Order\Payment的用法示例。


在下文中一共展示了Payment::authorize方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testAuthorizeTransactionPending

 public function testAuthorizeTransactionPending()
 {
     $storeID = 1;
     $amount = 10;
     $baseCurrencyMock = $this->getMockBuilder('Magento\\Directory\\Model\\Currency')->disableOriginalConstructor()->setMethods(['formatTxt'])->getMock();
     $baseCurrencyMock->expects($this->once())->method('formatTxt')->willReturnCallback(function ($value) {
         return $value;
     });
     $this->orderMock->expects($this->once())->method('getStoreId')->willReturn($storeID);
     $this->orderMock->expects($this->once())->method('getBaseGrandTotal')->willReturn($amount);
     $this->orderMock->expects($this->once())->method('getBaseCurrency')->willReturn($baseCurrencyMock);
     $this->orderMock->expects($this->once())->method('setState')->with(\Magento\Sales\Model\Order::STATE_PAYMENT_REVIEW, true, "We will authorize {$amount} after the payment is approved at the payment gateway.");
     $this->paymentMethodMock->expects($this->once())->method('authorize')->with($this->payment)->willReturnSelf();
     $this->payment->setIsTransactionPending(true);
     $paymentResult = $this->payment->authorize(true, $amount);
     $this->assertInstanceOf('Magento\\Sales\\Model\\Order\\Payment', $paymentResult);
     $this->assertEquals($amount, $paymentResult->getBaseAmountAuthorized());
     $this->assertTrue($paymentResult->getIsTransactionPending());
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:19,代碼來源:PaymentTest.php

示例2: authorize

 /**
  * {@inheritdoc}
  */
 public function authorize($isOnline, $amount)
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'authorize');
     if (!$pluginInfo) {
         return parent::authorize($isOnline, $amount);
     } else {
         return $this->___callPlugins('authorize', func_get_args(), $pluginInfo);
     }
 }
開發者ID:CSYE6225,項目名稱:UnixSysProgramming,代碼行數:12,代碼來源:Interceptor.php

示例3: testAuthorize

 /**
  * @param bool $isOnline
  * @param float $amount
  * @dataProvider authorizeDataProvider
  */
 public function testAuthorize($isOnline, $amount)
 {
     $this->paymentProcessor->expects($this->once())->method('authorize')->with($this->payment, $isOnline, $amount)->willReturn($this->payment);
     $this->assertEquals($this->payment, $this->payment->authorize($isOnline, $amount));
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:10,代碼來源:PaymentTest.php


注:本文中的Magento\Sales\Model\Order\Payment::authorize方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。