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

Add Back button for QR methods #905

Merged
merged 3 commits into from
Apr 20, 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
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,9 @@ const actionHandler = async (action) => {
const checkout = await AdyenCheckout(store.checkoutConfiguration);
checkout.createFromAction(action).mount('#action-container');
$('#action-modal').modal({ backdrop: 'static', keyboard: false });
if (action.type === constants.ACTIONTYPE.QRCODE){
document.getElementById('cancelQrMethodsButton').classList.remove('invisible');
};
};

function handleOnAdditionalDetails(state) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ module.exports = {
NOTENOUGHBALANCE: 'NotEnoughBalance',
SUCCESS: 'Success',
GIFTCARD: 'giftcard',
ACTIONTYPE: {
QRCODE: 'qrCode',
},
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
<div class="modal fade" id="action-modal" role="dialog">
<div class="modal-dialog" id="adyenModalDialog">
<div id="action-container"></div>
<div id="action-container">
<div class='invisible' id="cancelQrMethodsButton">
<button id='cancelQrMethodsButtonStyling' onclick="location.href='${URLUtils.https('Checkout-Begin')}';">
<img src="${URLUtils.staticURL('images/cancel.svg')}" alt="Cancel" />
</button>
</div>
</div>
<div id="amazon-container"></div>
<div id="giftcard-container"></div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@
<div id="giftCardContainer"></div>
</div>
<div id="cancelGiftCardButton" class="invisible">
<input type="image" src="${URLUtils.staticURL('images/cancel.svg')}"/>
<button id='cancelGiftCardButtonStyling'>
<img src="${URLUtils.staticURL('images/cancel.svg')}" alt="Cancel" />
</button>
</div>
</div>
<div id="giftCardsList" class="gift-cards-container"></div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,12 +434,19 @@ input:checked + .slider:before {
font-size: 13px;
}

#cancelGiftCardButton {
#cancelGiftCardButton, #cancelQrMethodsButton {
position: absolute;
top : 0;
right : 0;
}

#cancelGiftCardButtonStyling, #cancelQrMethodsButtonStyling {
background: none;
border: none;
padding: 0;
cursor: pointer;
}

.expressComponent {
margin: 10px 0;
}
Expand Down
7 changes: 7 additions & 0 deletions tests/playwright/fixtures/countriesEUR/BE.spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,12 @@ for (const environment of environments) {
if (environment.name != 'SG') await checkoutPage.completeCheckout();
await checkoutPage.expectQRcode();
});
test('bcmc mobile cancellation flow', async ({ page }) => {
pendingPayments = new PendingPayments(page);
if (environment.name === 'SG') await checkoutPage.setEmail();
await pendingPayments.doQRCodePayment('bcmc_mobile', environment.name);
if (environment.name != 'SG') await checkoutPage.completeCheckout();
await pendingPayments.cancelQRCodePayment();
});
});
}
5 changes: 5 additions & 0 deletions tests/playwright/pages/PaymentMethodsPage.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,11 @@ export default class PaymentMethodsPage {
}
};

cancelQRCode = async () => {
await this.page.click('#cancelQrMethodsButton');
await expect(this.page).toHaveURL(/stage=shipping#shipping/);
};

initiateBoletoPayment = async () => {
const socialSecurityInput = this.page.locator(
'#component_boletobancario input[name="socialSecurityNumber"]',
Expand Down
4 changes: 4 additions & 0 deletions tests/playwright/paymentFlows/pending.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ export class PendingPayments {
await this.paymentMethodsPage.initiateQRCode(paymentMethod, envName);
};

cancelQRCodePayment = async () => {
await this.paymentMethodsPage.cancelQRCode();
};

doGooglePayPayment = async () => {
await this.paymentMethodsPage.initiateGooglePayPayment();
};
Expand Down