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

[SFI-525] Apple pay donations are enabled #1026

Merged
merged 2 commits into from
Dec 14, 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 @@ -81,6 +81,8 @@ function handleAuthorised(response, resolveApplePay) {
paymentMethod: response.fullResponse?.paymentMethod
? response.fullResponse.paymentMethod
: response.fullResponse?.additionalData?.paymentMethod,
donationToken: response.fullResponse?.donationToken,
amount: response.fullResponse?.amount,
});
document.querySelector('#showConfirmationForm').submit();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,18 @@ function donate(donationReference, donationAmount, orderToken) {
const donationToken = paymentInstrument.paymentTransaction.custom.Adyen_donationToken;
const originalReference = paymentInstrument.paymentTransaction.custom.Adyen_pspReference;
const paymentData = JSON.parse(paymentInstrument.paymentTransaction.custom.Adyen_log);
const paymentCurrency = paymentData.amount.currency;
const paymentCurrency = paymentData.amount.currency || paymentData.fullResponse?.amount?.currency;
const availableDonationAmounts = AdyenHelper.getDonationAmounts();
paymentMethodVariant = paymentInstrument.custom.Adyen_Payment_Method_Variant;
paymentMethodVariant = paymentData.paymentMethod?.type || paymentData.fullResponse?.paymentMethod?.type;

// for iDeal donations, the payment method variant needs to be set to sepadirectdebit
if (paymentMethodVariant === 'ideal') {
paymentMethodVariant = 'sepadirectdebit';
shanikantsingh marked this conversation as resolved.
Show resolved Hide resolved
}
// for Apple Pay donations, the payment method variant needs to be the brand
if (paymentMethodVariant === 'applepay'){
shanikantsingh marked this conversation as resolved.
Show resolved Hide resolved
paymentMethodVariant = paymentData.paymentMethod?.brand || paymentData.fullResponse?.paymentMethod?.brand;
}
const requestObject = {
merchantAccount: AdyenConfigs.getAdyenMerchantAccount(),
donationAccount: AdyenConfigs.getAdyenGivingCharityAccount(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -683,8 +683,8 @@ var adyenHelperObj = {
? result.resultCode
: '';
order.custom.Adyen_value = '0';
if (result.donationToken){
paymentInstrument.paymentTransaction.custom.Adyen_donationToken = result.donationToken;
if (result.donationToken || result.fullResponse?.donationToken){
paymentInstrument.paymentTransaction.custom.Adyen_donationToken = result.donationToken || result.fullResponse.donationToken;
}
// Save full response to transaction custom attribute
paymentInstrument.paymentTransaction.custom.Adyen_log = JSON.stringify(
Expand Down
2 changes: 1 addition & 1 deletion tests/playwright/fixtures/USD.spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ for (const environment of environments) {
await checkoutPage.expectRefusal();
});

test('Card payment no 3DS with adyen giving donation success', async () => {
test('Card payment no 3DS with adyen giving donation success @quick', async () => {
await cards.doCardPayment(cardData.noThreeDs);
await checkoutPage.completeCheckout();
await checkoutPage.makeSuccessfulDonation();
Expand Down
Loading