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


PHP Payment::getExtensionAttributes方法代碼示例

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


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

示例1: testHandle

 /**
  * @covers \Magento\BraintreeTwo\Gateway\Response\VaultDetailsHandler::handle
  */
 public function testHandle()
 {
     $this->paymentExtension->expects(self::once())->method('setVaultPaymentToken')->with($this->paymentToken);
     $this->paymentExtension->expects(self::once())->method('getVaultPaymentToken')->willReturn($this->paymentToken);
     $paymentData = $this->getPaymentDataObjectMock();
     $transaction = $this->getBraintreeTransaction();
     $subject = ['payment' => $paymentData];
     $response = ['object' => $transaction];
     $this->subjectReader->expects(self::once())->method('readPayment')->with($subject)->willReturn($paymentData);
     $this->subjectReader->expects(self::once())->method('readTransaction')->with($response)->willReturn($transaction);
     $this->paymentToken->expects(static::once())->method('setGatewayToken')->with('rh3gd4');
     $this->paymentToken->expects(static::once())->method('setExpiresAt')->with('2022-01-01 00:00:00');
     $this->paymentHandler->handle($subject, $response);
     $this->assertSame($this->paymentToken, $this->payment->getExtensionAttributes()->getVaultPaymentToken());
 }
開發者ID:BlackIkeEagle,項目名稱:magento2-continuousphp,代碼行數:18,代碼來源:VaultDetailsHandlerTest.php

示例2: testHandle

 /**
  * @covers \Magento\BraintreeTwo\Gateway\Response\VaultDetailsHandler::handle
  */
 public function testHandle()
 {
     $this->vaultPaymentMock->expects(self::once())->method('isActiveForPayment')->willReturn(true);
     $this->paymentExtension->expects(self::once())->method('setVaultPaymentToken')->with($this->paymentTokenMock);
     $this->paymentExtension->expects(self::once())->method('getVaultPaymentToken')->willReturn($this->paymentTokenMock);
     $paymentData = $this->getPaymentDataObjectMock();
     $transaction = $this->getBraintreeTransaction();
     $subject = ['payment' => $paymentData];
     $response = ['object' => $transaction];
     $this->subjectReaderMock->expects(self::once())->method('readPayment')->with($subject)->willReturn($paymentData);
     $this->subjectReaderMock->expects(self::once())->method('readTransaction')->with($response)->willReturn($transaction);
     $this->salesOrderMock->setCustomerId(10);
     $this->paymentHandler->handle($subject, $response);
     $this->assertEquals('rh3gd4', $this->paymentTokenMock->getGatewayToken());
     $this->assertEquals('10', $this->paymentTokenMock->getCustomerId());
     $this->assertSame($this->paymentTokenMock, $this->payment->getExtensionAttributes()->getVaultPaymentToken());
 }
開發者ID:hientruong90,項目名稱:magento2_installer,代碼行數:20,代碼來源:VaultDetailsHandlerTest.php

示例3: getPaymentExtensionAttributes

 /**
  * @param Payment $payment
  * @return \Magento\Sales\Api\Data\OrderPaymentExtensionInterface
  */
 private function getPaymentExtensionAttributes(Payment $payment)
 {
     $extensionAttributes = $payment->getExtensionAttributes();
     if ($extensionAttributes === null) {
         $extensionAttributes = $this->paymentExtensionFactory->create();
         $payment->setExtensionAttributes($extensionAttributes);
     }
     return $extensionAttributes;
 }
開發者ID:rafaelstz,項目名稱:magento2,代碼行數:13,代碼來源:Transparent.php

示例4: getExtensionAttributes

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


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