Skip to content

Commit

Permalink
PagBank 😍 Magento
Browse files Browse the repository at this point in the history
  • Loading branch information
elisei committed May 24, 2024
1 parent de53a76 commit 22b3350
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 10 deletions.
10 changes: 7 additions & 3 deletions Gateway/Response/TxnDataDeepLinkHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ class TxnDataDeepLinkHandler implements HandlerInterface
*/
public const RESPONSE_QR_CODES = 'qr_codes';

/**
* Response Pay Qr Code Links - Block name.
*/
public const RESPONSE_QR_CODE_LINKS = 'links';

/**
* Response Pay Deep Link - Block name.
*/
Expand Down Expand Up @@ -156,9 +161,8 @@ public function setAdditionalInfo(
$qrCodes = $response[self::RESPONSE_QR_CODES][0];
$deepLink = $response[self::RESPONSE_DEEP_LINK][0];

if (isset($deepLink[self::RESPONSE_DEEP_LINK_URL])) {
$linkToImage = 'https://chart.googleapis.com/chart?chs=300x300&cht=qr&chl='.
urlencode($deepLink[self::RESPONSE_DEEP_LINK_URL]);
if (isset($qrCodes[self::RESPONSE_QR_CODE_LINKS][0])) {
$linkToImage = $qrCodes[self::RESPONSE_QR_CODE_LINKS][0]['href'];

$qrCodeImage = $this->configBase->copyFile('deep_link', $linkToImage, $pagbankPayId);
$payment->setAdditionalInformation(
Expand Down
4 changes: 4 additions & 0 deletions i18n/en_US.csv
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ Copied,Copied
"Pay in PagBank","Pay in PagBank"
"You must <strong/>click the link indicated by the camera</strong>.","You must <strong/>click the link indicated by the camera</strong>."
"To pay, read the Qr Code","To pay, read the Qr Code"
"Open the <strong>PagBank app</strong> on your phone;","Open the <strong>PagBank app</strong> on your phone;"
"Go to the <strong>Pix/Qr Code</strong> option;","Go to the <strong>Pix/Qr Code</strong> option;"
"Select the option <strong>"Pay with Qr Code"</strong>;","Select the option <strong>"Pay with Qr Code"</strong>;"
"Scan the Qr Code:","Scan the Qr Code:"
"Or if you prefer, copy and paste the code","Or if you prefer, copy and paste the code"
"Boleto Information","Boleto Information"
Waiting...,Waiting...
Expand Down
4 changes: 4 additions & 0 deletions i18n/pt_BR.csv
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ Copied,Copiado
"Pay in PagBank","Pagar com PagBank"
"You must <strong/>click the link indicated by the camera</strong>.","Você deve <strong>clicar no link indicado pela câmera</strong> para concluir o pagamento diretamente sua conta PagBank."
"To pay, read the Qr Code","Para o pagamento, faço a leitura do Qr Code"
"Open the <strong>PagBank app</strong> on your phone;","Abra no seu celular o <strong>aplicativo PagBank</strong>;"
"Go to the <strong>Pix/Qr Code</strong> option;","Vá em na opção <strong>Pix/Qr Code</strong>;"
"Select the option <strong>"Pay with Qr Code"</strong>;","Escolha a opção <strong>"Pagar com Qr Code"</strong>; e"
"Scan the Qr Code:","Faça a leitura do Qr Code:"
"Or if you prefer, copy and paste the code","Ou se preferir, copie e cole o código"
"Boleto Information","Informações do Boleto"
Waiting...,Aguardando...
Expand Down
33 changes: 26 additions & 7 deletions view/frontend/templates/sales/order/success/deep-link.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,31 @@ $qrCodeImage = $block->getInfo('qr_code_url_image');
</p>
</div>
<div class="pagbank-payment-deep-link-image">
<p>
<?= $block->escapeHtml(
__('Use the <strong>camera on your mobile device</strong> to scan the QR Code:'),
['strong']
) ?>
</p>
<ol class="pagbank-items">
<li class="item">
<?= $block->escapeHtml(
__('Open the <strong>PagBank app</strong> on your phone;'),
['strong']
) ?>
</li>
<li class="item">
<?= $block->escapeHtml(
__('Go to the <strong>Pix/Qr Code</strong> option;'),
['strong']
) ?>
</li>
<li class="item">
<?= $block->escapeHtml(
__('Select the option <strong>"Pay with Qr Code"</strong>;'),
['strong']
) ?>
</li>
<li class="item">
<?= $block->escapeHtml(
__('Scan the Qr Code:')
) ?>
</li>
</ol>
<div class="qrcode-image">
<img src="<?= $block->escapeUrl($block->getMediaUrl($qrCodeImage)); ?>"
class="deep-link-qrcode"
Expand All @@ -55,7 +74,7 @@ $qrCodeImage = $block->getInfo('qr_code_url_image');
</div>
<p>
<?= $block->escapeHtml(
__('You must <strong/>click the link indicated by the camera</strong>.'),
__('Atenção o Qr Code gerado <strong>só é válido para uso no aplicatico do PagBank.</strong>'),
['strong']
) ?>
</p>
Expand Down
4 changes: 4 additions & 0 deletions view/frontend/web/css/source/_module.less
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,10 @@
.lib-visually-hidden()
}
}

.pagbank-items {
text-align: left;
}
}

.full-checkout .checkout-payment-method .payment-method-content .fieldset.pagbank-payer-data:not(:last-child) {
Expand Down

0 comments on commit 22b3350

Please sign in to comment.