123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- <?php
- /**
- * Copyright © Magento, Inc. All rights reserved.
- * See COPYING.txt for license details.
- */
- namespace Magento\Braintree\Block\Customer;
- use Magento\Braintree\Model\Ui\ConfigProvider;
- use Magento\Framework\View\Element\Template;
- use Magento\Vault\Api\Data\PaymentTokenInterface;
- use Magento\Vault\Block\AbstractCardRenderer;
- /**
- * @api
- * @since 100.1.0
- */
- class CardRenderer extends AbstractCardRenderer
- {
- /**
- * Can render specified token
- *
- * @param PaymentTokenInterface $token
- * @return boolean
- * @since 100.1.0
- */
- public function canRender(PaymentTokenInterface $token)
- {
- return $token->getPaymentMethodCode() === ConfigProvider::CODE;
- }
- /**
- * @return string
- * @since 100.1.0
- */
- public function getNumberLast4Digits()
- {
- return $this->getTokenDetails()['maskedCC'];
- }
- /**
- * @return string
- * @since 100.1.0
- */
- public function getExpDate()
- {
- return $this->getTokenDetails()['expirationDate'];
- }
- /**
- * @return string
- * @since 100.1.0
- */
- public function getIconUrl()
- {
- return $this->getIconForType($this->getTokenDetails()['type'])['url'];
- }
- /**
- * @return int
- * @since 100.1.0
- */
- public function getIconHeight()
- {
- return $this->getIconForType($this->getTokenDetails()['type'])['height'];
- }
- /**
- * @return int
- * @since 100.1.0
- */
- public function getIconWidth()
- {
- return $this->getIconForType($this->getTokenDetails()['type'])['width'];
- }
- }
|