本文整理匯總了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());
}
示例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());
}
示例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;
}
示例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);
}
}