mirror of
https://github.com/bdnugget/magento2.git
synced 2026-11-07 17:27:36 +00:00
40 lines
1.1 KiB
PHP
40 lines
1.1 KiB
PHP
<?php
|
|
/**
|
|
* Copyright © Magento, Inc. All rights reserved.
|
|
* See COPYING.txt for license details.
|
|
*/
|
|
namespace Magento\InstantPurchase\PaymentMethodIntegration;
|
|
|
|
use Magento\Vault\Api\Data\PaymentTokenInterface;
|
|
|
|
/**
|
|
* Payment token formatter that uses payment method title as token string representation.
|
|
*/
|
|
class SimplePaymentTokenFormatter implements PaymentTokenFormatterInterface
|
|
{
|
|
/**
|
|
* @var IntegrationsManager
|
|
*/
|
|
private $integrationsManager;
|
|
|
|
/**
|
|
* SimplePaymentTokenFormatter constructor.
|
|
* @param IntegrationsManager $integrationsManager
|
|
*/
|
|
public function __construct(IntegrationsManager $integrationsManager)
|
|
{
|
|
$this->integrationsManager = $integrationsManager;
|
|
}
|
|
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
public function formatPaymentToken(PaymentTokenInterface $paymentToken): string
|
|
{
|
|
$integration = $this->integrationsManager->getByTokenForCurrentStore($paymentToken);
|
|
$paymentMethod = $integration->getPaymentMethod();
|
|
$paymentMethodTitle = $paymentMethod->getTitle();
|
|
return (string)$paymentMethodTitle;
|
|
}
|
|
}
|