diff --git a/Block/Payment/Pix.php b/Block/Payment/Pix.php index 313de03f..66eea890 100644 --- a/Block/Payment/Pix.php +++ b/Block/Payment/Pix.php @@ -16,6 +16,7 @@ use Magento\Framework\View\Element\Template; use Magento\Framework\View\Element\Template\Context; use Magento\Checkout\Model\Session as CheckoutSession; +use Magento\Framework\View\Asset\Repository; use Magento\Sales\Api\Data\OrderInterface as Order; use Magento\Sales\Api\Data\OrderPaymentInterface as Payment; use Pagarme\Pagarme\Helper\Payment\Pix as PixHelper; @@ -38,14 +39,27 @@ class Pix extends Template private $pixHelper; /** - * Link constructor. + * @var Repository + */ + private $assetRepository; + + /** + * Pix constructor + * * @param Context $context * @param CheckoutSession $checkoutSession + * @param PixHelper $pixHelper + * @param Repository $assetRepository */ - public function __construct(Context $context, CheckoutSession $checkoutSession, PixHelper $pixHelper) - { + public function __construct( + Context $context, + CheckoutSession $checkoutSession, + PixHelper $pixHelper, + Repository $assetRepository + ) { $this->checkoutSession = $checkoutSession; $this->pixHelper = $pixHelper; + $this->assetRepository = $assetRepository; parent::__construct($context, []); } @@ -87,6 +101,14 @@ public function showPixInformation() return !empty($this->getPixInfo()); } + /** + * @return string + */ + public function getLogoSrc() + { + return $this->assetRepository->getUrl(PixHelper::LOGO_URL); + } + /** * @return string */ diff --git a/Helper/Payment/Pix.php b/Helper/Payment/Pix.php index a73abece..83f9e761 100644 --- a/Helper/Payment/Pix.php +++ b/Helper/Payment/Pix.php @@ -9,6 +9,8 @@ class Pix { + const LOGO_URL = "Pagarme_Pagarme::images/logo-pix.svg"; + private $qrCodeUrl; private $qrCode; diff --git a/Model/Ui/Pix/ConfigProvider.php b/Model/Ui/Pix/ConfigProvider.php index 655e6f41..799c1646 100644 --- a/Model/Ui/Pix/ConfigProvider.php +++ b/Model/Ui/Pix/ConfigProvider.php @@ -3,8 +3,10 @@ namespace Pagarme\Pagarme\Model\Ui\Pix; use Magento\Checkout\Model\ConfigProviderInterface; +use Magento\Framework\View\Asset\Repository; use Pagarme\Core\Kernel\ValueObjects\Configuration\PixConfig; use Pagarme\Pagarme\Concrete\Magento2CoreSetup as MPSetup; +use Pagarme\Pagarme\Helper\Payment\Pix as PixHelper; final class ConfigProvider implements ConfigProviderInterface { @@ -15,10 +17,16 @@ final class ConfigProvider implements ConfigProviderInterface */ private $pixConfig; - public function __construct() + /** + * @var Repository + */ + private $assetRepository; + + public function __construct(Repository $assetRepository) { MPSetup::bootstrap(); $moduleConfig = MPSetup::getModuleConfiguration(); + $this->assetRepository = $assetRepository; if (!empty($moduleConfig->getPixConfig())) { $this->pixConfig = $moduleConfig->getPixConfig(); } @@ -31,6 +39,7 @@ public function getConfig() self::CODE => [ 'active' => $this->pixConfig->isEnabled(), 'title' => $this->pixConfig->getTitle(), + 'logo' => $this->assetRepository->getUrl(PixHelper::LOGO_URL) ] ] ]; diff --git a/view/base/web/images/logo-pix.svg b/view/base/web/images/logo-pix.svg new file mode 100644 index 00000000..fd11eba6 --- /dev/null +++ b/view/base/web/images/logo-pix.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/view/frontend/templates/payment/pix.phtml b/view/frontend/templates/payment/pix.phtml index b5ed2f6e..0f0bcc49 100644 --- a/view/frontend/templates/payment/pix.phtml +++ b/view/frontend/templates/payment/pix.phtml @@ -8,8 +8,8 @@ if ($block->showPixInformation()):
diff --git a/view/frontend/web/css/pagarme_style.css b/view/frontend/web/css/pagarme_style.css index 64340703..41e3ddb2 100644 --- a/view/frontend/web/css/pagarme_style.css +++ b/view/frontend/web/css/pagarme_style.css @@ -36,3 +36,7 @@ .field .control .cc_owner { width: 225px; } + +.pagarme-pix-logo { + width: 120px; +} \ No newline at end of file diff --git a/view/frontend/web/css/pagarme_success_page.css b/view/frontend/web/css/pagarme_success_page.css index 5a44a7ad..8a5cdcb4 100644 --- a/view/frontend/web/css/pagarme_success_page.css +++ b/view/frontend/web/css/pagarme_success_page.css @@ -63,3 +63,7 @@ padding: 10px 15px; margin-top: 10px; } + +.pagarme-pix-logo { + width: 120px; +} \ No newline at end of file diff --git a/view/frontend/web/js/view/payment/pix.js b/view/frontend/web/js/view/payment/pix.js index 4229a85a..d0604c37 100644 --- a/view/frontend/web/js/view/payment/pix.js +++ b/view/frontend/web/js/view/payment/pix.js @@ -37,6 +37,9 @@ define( getModel: function () { return 'pix'; }, + getLogoSrc: function() { + return window.checkoutConfig.payment.pagarme_pix.logo; + }, getData: function () { var paymentMethod = PagarmeCore.paymentMethod[this.getModel()]; diff --git a/view/frontend/web/template/payment/pix-form.html b/view/frontend/web/template/payment/pix-form.html index ea16b1eb..baf63485 100644 --- a/view/frontend/web/template/payment/pix-form.html +++ b/view/frontend/web/template/payment/pix-form.html @@ -12,7 +12,7 @@
- +