コード例 #1
0
 /**
  * @covers \Magento\BraintreeTwo\Model\Ui\Adminhtml\TokenUiComponentProvider::getComponentForToken
  */
 public function testGetComponentForToken()
 {
     $nonceUrl = 'https://payment/adminhtml/nonce/url';
     $type = 'VI';
     $maskedCC = '1111';
     $expirationDate = '12/2015';
     $expected = ['nonceUrl' => $nonceUrl, 'details' => ['type' => $type, 'maskedCC' => $maskedCC, 'expirationDate' => $expirationDate], 'template' => 'vault.phtml'];
     $paymentToken = $this->getMock(PaymentTokenInterface::class);
     $paymentToken->expects(static::once())->method('getTokenDetails')->willReturn('{"type":"VI","maskedCC":"1111","expirationDate":"12\\/2015"}');
     $paymentToken->expects(static::once())->method('getPublicHash')->willReturn('37du7ir5ed');
     $this->urlBuilder->expects(static::once())->method('getUrl')->willReturn($nonceUrl);
     $tokenComponent = $this->getMock(TokenUiComponentInterface::class);
     $tokenComponent->expects(static::once())->method('getConfig')->willReturn($expected);
     $this->componentFactory->expects(static::once())->method('create')->willReturn($tokenComponent);
     $component = $this->tokenUiComponentProvider->getComponentForToken($paymentToken);
     static::assertEquals($tokenComponent, $component);
     static::assertEquals($expected, $component->getConfig());
 }
コード例 #2
0
 /**
  * Get UI component for token
  * @param PaymentTokenInterface $paymentToken
  * @return TokenUiComponentInterface
  */
 public function getComponentForToken(PaymentTokenInterface $paymentToken)
 {
     $jsonDetails = json_decode($paymentToken->getTokenDetails() ?: '{}', true);
     $component = $this->componentFactory->create(['config' => ['code' => ConfigProvider::CC_VAULT_CODE, 'nonceUrl' => $this->getNonceRetrieveUrl(), TokenUiComponentProviderInterface::COMPONENT_DETAILS => $jsonDetails, TokenUiComponentProviderInterface::COMPONENT_PUBLIC_HASH => $paymentToken->getPublicHash()], 'name' => 'Magento_Braintree/js/view/payment/method-renderer/vault']);
     return $component;
 }
コード例 #3
0
 /**
  * @inheritdoc
  */
 public function getComponentForToken(PaymentTokenInterface $paymentToken)
 {
     $data = json_decode($paymentToken->getTokenDetails() ?: '{}', true);
     $component = $this->componentFactory->create(['config' => [TokenUiComponentProviderInterface::COMPONENT_DETAILS => $data, TokenUiComponentProviderInterface::COMPONENT_PUBLIC_HASH => $paymentToken->getPublicHash(), 'template' => 'Magento_Paypal::payflowpro/vault.phtml'], 'name' => Template::class]);
     return $component;
 }
コード例 #4
0
 /**
  * @inheritdoc
  */
 public function getComponentForToken(PaymentTokenInterface $paymentToken)
 {
     $data = json_decode($paymentToken->getTokenDetails() ?: '{}', true);
     $component = $this->componentFactory->create(['config' => ['nonceUrl' => $this->getNonceRetrieveUrl(), TokenUiComponentProviderInterface::COMPONENT_DETAILS => $data, TokenUiComponentProviderInterface::COMPONENT_PUBLIC_HASH => $paymentToken->getPublicHash(), 'template' => 'Magento_BraintreeTwo::form/vault.phtml'], 'name' => Template::class]);
     return $component;
 }
コード例 #5
0
 /**
  * Get UI component for token
  * @param PaymentTokenInterface $paymentToken
  * @return TokenUiComponentInterface
  */
 public function getComponentForToken(PaymentTokenInterface $paymentToken)
 {
     $jsonDetails = json_decode($paymentToken->getTokenDetails() ?: '{}', true);
     $component = $this->componentFactory->create(['config' => [TokenUiComponentProviderInterface::COMPONENT_DETAILS => $jsonDetails, TokenUiComponentProviderInterface::COMPONENT_PUBLIC_HASH => $paymentToken->getPublicHash()], 'name' => 'Magento_Paypal/js/view/payment/method-renderer/payflowpro/vault']);
     return $component;
 }