Skip to content

Commit

Permalink
fix issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivascu Madalin committed Nov 2, 2023
1 parent 51cc114 commit efce4ee
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 45 deletions.
24 changes: 12 additions & 12 deletions view/frontend/templates/component/payment/after.phtml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

<div class="bk-modal-wrap" x-data="{
showModal: false,
title: '<?= $escaper->escapeHtml(__('Success')); ?>',
Expand Down Expand Up @@ -65,7 +64,7 @@
</p>
</div>
<!-- Modal footer -->

<div class="flex items-center p-2 space-x-2 border-t border-gray-200 rounded-b dark:border-gray-600">
<template x-if="Array.isArray(buttons)">
<template x-for="(button, index) in buttons" :key="index">
Expand All @@ -89,18 +88,19 @@
</div>
<script>
function buckarooStart() {
let buckarooTask;
window.addEventListener("buckaroo-add-task", (event) => {
if (event.detail.buckarooTask) {
buckarooTask = event.detail.buckarooTask;
}
const addTask = function() {
hyvaCheckout.navigation.addTask(async () => {
if (window.buckarooTask) {
await window.buckarooTask();
}
})
}
addTask();
window.addEventListener('checkout:navigation:success', (event) => {
if (event.detail.route === 'payment')
addTask();
});

hyvaCheckout.navigation.addTask(async () => {
if (buckarooTask) {
await buckarooTask();
}
})

function buckaroo_load_sdk() {
return new Promise(resolve => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,10 @@ use Magento\Framework\Escaper;
this.config = this.$wire.get('config');
this.loadSdk().then(async () => {
this.canDisplay = await BuckarooApplePay.checkPaySupport();
const v = async () => {
window.buckarooTask = async () => {
if(this.canDisplay)
await this.beginPayment();
};
window.dispatchEvent(new CustomEvent('buckaroo-add-task', {
detail: {
buckarooTask: v
}
}));
});
}
}" x-init="register()" novalidate>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ use Magento\Framework\Escaper;
}
return true;
}
const v = async () => {
window.buckarooTask = async () => {
const isValid = await formValid();
if (this.cseHasLoaded && isValid) {
const encryptedCardData = await this.saveEncryptedData();
Expand All @@ -60,11 +60,6 @@ use Magento\Framework\Escaper;
);
}
};
window.dispatchEvent(new CustomEvent('buckaroo-add-task', {
detail: {
buckarooTask: v
}
}));

},
getIssuerImage: function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,11 @@ if (!$magewire->isRedirect()) {
},
register() {
this.listenToSubmit();
const v = async () => {
window.buckarooTask = async () => {
if(!this.canSubmit) {
await this.submit();
}
};
window.dispatchEvent(new CustomEvent('buckaroo-add-task', {
detail: {
buckarooTask: v
}
}));

},

})" x-init="register()" novalidate>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,13 @@ use Magento\Framework\Escaper;
}
return true;
}
const v = async () => {
window.buckarooTask = async () => {
const isValid = await formValid();
if (this.cseHasLoaded && isValid) {
const encryptedCardData = await this.saveEncryptedData();
await this.$wire.updatedEncryptedData(encryptedCardData);
}
};
window.dispatchEvent(new CustomEvent('buckaroo-add-task', {
detail: {
buckarooTask: v
}
}));

}
})" x-init="register()" novalidate>
<div class="flex flex-col gap-y-2 field field-reserved">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,11 @@ use Magento\Framework\Escaper;
}));
},
register() {
const v = async () => {
window.buckarooTask = async () => {
if(!this.canSubmit) {
await this.submit();
}
};
window.dispatchEvent(new CustomEvent('buckaroo-add-task', {
detail: {
buckarooTask: v
}
}));

},

})" x-init="register()" novalidate>
Expand Down

0 comments on commit efce4ee

Please sign in to comment.