Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BP-3191 Module loads too fast (Unexpected identifier) #9

Merged
merged 2 commits into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
586 changes: 489 additions & 97 deletions view/frontend/templates/component/payment/after.phtml

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions view/frontend/templates/component/payment/method/afterpay.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use Magento\Framework\Escaper;
<div class="flex flex-col gap-y-2 field field-reserved">
<label for="buckaroo_afterpay_dob">
<?= $escaper->escapeHtml(__('Date of Birth:')); ?>
<span class="text-red">*</span>
<span class="text-red-600">*</span>
</label>
<input
type="date"
Expand All @@ -29,7 +29,7 @@ use Magento\Framework\Escaper;
id="buckaroo_afterpay_dob"
>
<?php if ($magewire->hasError('dateOfBirth')) : ?>
<div class="text-red"><?= $escaper->escapeHtmlAttr($magewire->getError('dateOfBirth')) ?></div>
<div class="text-red-600"><?= $escaper->escapeHtmlAttr($magewire->getError('dateOfBirth')) ?></div>
<?php endif; ?>
</div>
<?php
Expand All @@ -40,11 +40,11 @@ use Magento\Framework\Escaper;
<div class="flex flex-col gap-y-2 field field-reserved">
<label for="buckaroo_afterpay_phone">
<?= $escaper->escapeHtml(__('Telephone:')); ?>
<span class="text-red">*</span>
<span class="text-red-600">*</span>
</label>
<input type="text" wire:model.lazy="phone" id="buckaroo_afterpay_phone">
<?php if ($magewire->hasError('phone')) : ?>
<div class="text-red"><?= $escaper->escapeHtmlAttr($magewire->getError('phone')) ?></div>
<div class="text-red-600"><?= $escaper->escapeHtmlAttr($magewire->getError('phone')) ?></div>
<?php endif; ?>
</div>
<?php
Expand Down Expand Up @@ -73,11 +73,11 @@ use Magento\Framework\Escaper;
<div class="flex flex-col gap-y-2 field field-reserved">
<label for="buckaroo_afterpay_iban">
<?= $escaper->escapeHtml(__('Bank Account Number:')); ?>
<span class="text-red">*</span>
<span class="text-red-600">*</span>
</label>
<input type="text" wire:model.lazy="iban" id="buckaroo_afterpay_iban">
<?php if ($magewire->hasError('iban')) : ?>
<div class="text-red"><?= $escaper->escapeHtmlAttr($magewire->getError('iban')) ?></div>
<div class="text-red-600"><?= $escaper->escapeHtmlAttr($magewire->getError('iban')) ?></div>
<?php endif; ?>
</div>
<?php
Expand All @@ -87,22 +87,22 @@ use Magento\Framework\Escaper;
<div class="flex flex-col gap-y-2 field field-reserved">
<label for="buckaroo_afterpay_coc">
<?= $escaper->escapeHtml(__('COC Number:')); ?>
<span class="text-red">*</span>
<span class="text-red-600">*</span>
</label>
<input type="text" wire:model.lazy="coc" id="buckaroo_afterpay_coc">
<?php if ($magewire->hasError('coc')) : ?>
<div class="text-red"><?= $escaper->escapeHtmlAttr($magewire->getError('coc')) ?></div>
<div class="text-red-600"><?= $escaper->escapeHtmlAttr($magewire->getError('coc')) ?></div>
<?php endif; ?>
</div>

<div class="flex flex-col gap-y-2 field field-reserved">
<label for="buckaroo_afterpay_company_name">
<?= $escaper->escapeHtml(__('Company Name:')); ?>
<span class="text-red">*</span>
<span class="text-red-600">*</span>
</label>
<input type="text" wire:model.lazy="companyName" id="buckaroo_afterpay_company_name">
<?php if ($magewire->hasError('companyName')) : ?>
<div class="text-red"><?= $escaper->escapeHtmlAttr($magewire->getError('companyName')) ?></div>
<div class="text-red-600"><?= $escaper->escapeHtmlAttr($magewire->getError('companyName')) ?></div>
<?php endif; ?>
</div>
<?php
Expand All @@ -119,7 +119,7 @@ use Magento\Framework\Escaper;
</a>
</div>
<?php if ($magewire->hasError('tos')) : ?>
<div class="text-red"><?= $escaper->escapeHtmlAttr($magewire->getError('tos')) ?></div>
<div class="text-red-600"><?= $escaper->escapeHtmlAttr($magewire->getError('tos')) ?></div>
<?php endif; ?>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use Magento\Framework\Escaper;
<div class="flex flex-col gap-y-2 field field-reserved">
<label for="buckaroo_afterpay20_dob">
<?= $escaper->escapeHtml(__('Date of Birth:')); ?>
<span class="text-red">*</span>
<span class="text-red-600">*</span>
</label>
<input type="date"
x-data
Expand All @@ -33,7 +33,7 @@ use Magento\Framework\Escaper;
id="buckaroo_afterpay20_dob"
>
<?php if ($magewire->hasError('dateOfBirth')): ?>
<div class="text-red"><?= $escaper->escapeHtmlAttr($magewire->getError('dateOfBirth')) ?></div>
<div class="text-red-600"><?= $escaper->escapeHtmlAttr($magewire->getError('dateOfBirth')) ?></div>
<?php endif; ?>
</div>
<?php
Expand All @@ -44,11 +44,11 @@ use Magento\Framework\Escaper;
<div class="flex flex-col gap-y-2 field field-reserved">
<label for="buckaroo_afterpay20_identification">
<?= $escaper->escapeHtml(__('Identification number:')); ?>
<span class="text-red">*</span>
<span class="text-red-600">*</span>
</label>
<input type="text" wire:model.lazy="identificationNumber" id="buckaroo_afterpay20_identification">
<?php if ($magewire->hasError('identificationNumber')): ?>
<div class="text-red"><?= $escaper->escapeHtmlAttr($magewire->getError('identificationNumber')) ?></div>
<div class="text-red-600"><?= $escaper->escapeHtmlAttr($magewire->getError('identificationNumber')) ?></div>
<?php endif; ?>
</div>
<?php
Expand All @@ -59,11 +59,11 @@ use Magento\Framework\Escaper;
<div class="flex flex-col gap-y-2 field field-reserved">
<label for="buckaroo_afterpay20_phone">
<?= $escaper->escapeHtml(__('Telephone:')); ?>
<span class="text-red">*</span>
<span class="text-red-600">*</span>
</label>
<input type="text" wire:model.lazy="phone" id="buckaroo_afterpay20_phone">
<?php if ($magewire->hasError('phone')): ?>
<div class="text-red"><?= $escaper->escapeHtmlAttr($magewire->getError('phone')) ?></div>
<div class="text-red-600"><?= $escaper->escapeHtmlAttr($magewire->getError('phone')) ?></div>
<?php endif; ?>
</div>
<?php
Expand All @@ -74,11 +74,11 @@ use Magento\Framework\Escaper;
<div class="flex flex-col gap-y-2 field field-reserved">
<label for="buckaroo_afterpay20_coc">
<?= $escaper->escapeHtml(__('COC Number:')); ?>
<span class="text-red">*</span>
<span class="text-red-600">*</span>
</label>
<input type="text" wire:model.lazy="coc" id="buckaroo_afterpay20_coc">
<?php if ($magewire->hasError('coc')): ?>
<div class="text-red"><?= $escaper->escapeHtmlAttr($magewire->getError('coc')) ?></div>
<div class="text-red-600"><?= $escaper->escapeHtmlAttr($magewire->getError('coc')) ?></div>
<?php endif; ?>
</div>
<?php
Expand All @@ -97,7 +97,7 @@ use Magento\Framework\Escaper;
</a>
</div>
<?php if ($magewire->hasError('tos')): ?>
<div class="text-red"><?= $escaper->escapeHtmlAttr($magewire->getError('tos')) ?></div>
<div class="text-red-600"><?= $escaper->escapeHtmlAttr($magewire->getError('tos')) ?></div>
<?php endif; ?>
</div>
</div>
88 changes: 1 addition & 87 deletions view/frontend/templates/component/payment/method/applepay.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -6,93 +6,7 @@ declare(strict_types=1);

use Magento\Framework\Escaper;
?>
<form x-data="{
config: {},
canDisplay: false,
loadSdk() {
return new Promise(resolve => {
const script = document.createElement('script');
script.type = 'text/javascript';
script.src = '<?= $magewire->getJsSdkUrl() ?>';
script.async = true;
script.onload = resolve;
document.head.appendChild(script);
})
},

formatTransactionResponse(response) {
if (response === null || response === 'undefined') {
return null;
}

const paymentData = response.token.paymentData;

return JSON.stringify({
paymentData: {
version: paymentData.version,
data: paymentData.data,
signature: paymentData.signature,
header: {
ephemeralPublicKey: paymentData.header.ephemeralPublicKey,
publicKeyHash: paymentData.header.publicKeyHash,
transactionId: paymentData.header.transactionId,
},
},
});
},

async captureFunds(payment) {
const billingContact = payment && payment.billingContact ? JSON.stringify(payment.billingContact) : ''
await this.$wire.updateData(this.formatTransactionResponse(payment),billingContact);
this.resolve();
return {
status: window.ApplePaySession.STATUS_SUCCESS,
errors: [],
};
},

async beginPayment() {
const promise = new Promise((resolve) => {
this.resolve = resolve;

const config = new BuckarooApplePay.PayOptions(
this.config.storeName,
this.config.country,
this.config.currency,
this.config.cultureCode,
this.config.guid,
this.$wire.get('totals'),
this.$wire.get('grandTotal'),
'shipping',
[],
(payment) => this.captureFunds(payment),
null,
null,
['email', 'postalAddress'],
['email']
);
new BuckarooApplePay.PayPayment(config).beginPayment()
})
await promise;
},

async submit() {
await hyvaCheckout.order.place();
},
getButtonClass() {
return `pay-with-apple ${BuckarooApplePay.getButtonClass(this.config.buttonStyle, 'buy')}`;
},
async register() {
this.config = this.$wire.get('config');
this.loadSdk().then(async () => {
this.canDisplay = await BuckarooApplePay.checkPaySupport();
window.buckarooTask = async () => {
if(this.canDisplay)
await this.beginPayment();
};
});
}
}" x-init="register()" novalidate>
<form x-data="buckaroo.applePay('<?= $magewire->getJsSdkUrl() ?>')" x-init="register()" novalidate>
<template x-if="canDisplay">
<button type="button" :class="getButtonClass()" @click="submit()">
<?= $escaper->escapeHtml(__('Place Order')) ?>
Expand Down
18 changes: 9 additions & 9 deletions view/frontend/templates/component/payment/method/billink.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ use Magento\Framework\Escaper;
?>
</select>
<?php if ($magewire->hasError('gender')) : ?>
<div class="text-red"><?= $escaper->escapeHtmlAttr($magewire->getError('gender')) ?></div>
<div class="text-red-600"><?= $escaper->escapeHtmlAttr($magewire->getError('gender')) ?></div>
<?php endif; ?>
</div>

<div class="flex flex-col gap-y-2 field field-reserved">
<label for="buckaroo_billink_dob">
<?= $escaper->escapeHtml(__('Date of Birth:')); ?>
<span class="text-red">*</span>
<span class="text-red-600">*</span>
</label>
<input
type="date"
Expand All @@ -45,7 +45,7 @@ use Magento\Framework\Escaper;
id="buckaroo_billink_dob"
>
<?php if ($magewire->hasError('dateOfBirth')) : ?>
<div class="text-red"><?= $escaper->escapeHtmlAttr($magewire->getError('dateOfBirth')) ?></div>
<div class="text-red-600"><?= $escaper->escapeHtmlAttr($magewire->getError('dateOfBirth')) ?></div>
<?php endif; ?>
</div>

Expand All @@ -55,11 +55,11 @@ use Magento\Framework\Escaper;
<div class="flex flex-col gap-y-2 field field-reserved">
<label for="buckaroo_billink_phone">
<?= $escaper->escapeHtml(__('Telephone:')); ?>
<span class="text-red">*</span>
<span class="text-red-600">*</span>
</label>
<input type="text" wire:model.lazy="phone" id="buckaroo_billink_phone">
<?php if ($magewire->hasError('phone')) : ?>
<div class="text-red"><?= $escaper->escapeHtmlAttr($magewire->getError('phone')) ?></div>
<div class="text-red-600"><?= $escaper->escapeHtmlAttr($magewire->getError('phone')) ?></div>
<?php endif; ?>
</div>
<?php
Expand All @@ -70,11 +70,11 @@ use Magento\Framework\Escaper;
<div class="flex flex-col gap-y-2 field field-reserved">
<label for="buckaroo_billink_coc">
<?= $escaper->escapeHtml(__('COC Number:')); ?>
<span class="text-red">*</span>
<span class="text-red-600">*</span>
</label>
<input type="text" wire:model.lazy="coc" id="buckaroo_billink_coc">
<?php if ($magewire->hasError('coc')) : ?>
<div class="text-red"><?= $escaper->escapeHtmlAttr($magewire->getError('coc')) ?></div>
<div class="text-red-600"><?= $escaper->escapeHtmlAttr($magewire->getError('coc')) ?></div>
<?php endif; ?>
</div>

Expand All @@ -84,7 +84,7 @@ use Magento\Framework\Escaper;
</label>
<input type="text" wire:model.lazy="vatNumber" id="buckaroo_billink_vat_number">
<?php if ($magewire->hasError('vatNumber')) : ?>
<div class="text-red"><?= $escaper->escapeHtmlAttr($magewire->getError('vatNumber')) ?></div>
<div class="text-red-600"><?= $escaper->escapeHtmlAttr($magewire->getError('vatNumber')) ?></div>
<?php endif; ?>
</div>
<?php
Expand All @@ -102,7 +102,7 @@ use Magento\Framework\Escaper;
</a>
</div>
<?php if ($magewire->hasError('tos')) : ?>
<div class="text-red"><?= $escaper->escapeHtmlAttr($magewire->getError('tos')) ?></div>
<div class="text-red-600"><?= $escaper->escapeHtmlAttr($magewire->getError('tos')) ?></div>
<?php endif; ?>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ $issuers = $magewire->getIssuers();
<?php
foreach ($issuers as $issuer) {
?>
<div class="flex flex-row grow gap-x-2 items-center">
<div class="flex flex-row flex-grow gap-x-2 items-center">
<input
type="radio"
name="issuer"
Expand All @@ -40,7 +40,7 @@ $issuers = $magewire->getIssuers();
/>
<label
for="bk_credicard_issuer_<?= $escaper->escapeHtmlAttr($issuer["code"]) ?>"
class="flex flex-row grow gap-x-2 items-center">
class="flex flex-row flex-grow gap-x-2 items-center">
<img src="<?= $escaper->escapeUrl($issuer["img"]) ?>"
alt="<?= $issuer["name"] ?>"
style="max-height:25px;"
Expand Down
Loading
Loading