Parity for adyen failures in redirect flow
This commit is contained in:
parent
6534b06238
commit
6aa8d3434c
2 changed files with 29 additions and 3 deletions
|
|
@ -105,9 +105,15 @@ export default {
|
||||||
|
|
||||||
const resultMap = await settleAllPromises(promiseResultMap);
|
const resultMap = await settleAllPromises(promiseResultMap);
|
||||||
|
|
||||||
|
const hasExistingPiaError = to.query?.piaFailure;
|
||||||
|
|
||||||
// Hydrate page with results
|
// Hydrate page with results
|
||||||
next(async (vm) => {
|
next(async (vm) => {
|
||||||
vm.setCmsContent(resultMap.cmsContent);
|
vm.setCmsContent(resultMap.cmsContent);
|
||||||
|
|
||||||
|
if(hasExistingPiaError) {
|
||||||
|
vm.hasPaymentFailureError = true;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,21 @@ export async function adyenReturnBeforeEnter(to, from) {
|
||||||
const redirectResult = to?.query?.redirectResult;
|
const redirectResult = to?.query?.redirectResult;
|
||||||
|
|
||||||
if (sessionId && redirectResult) {
|
if (sessionId && redirectResult) {
|
||||||
const result = await finalizeAdyenPayment(sessionId, redirectResult);
|
let result = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
result = await finalizeAdyenPayment(sessionId, redirectResult);
|
||||||
|
} catch (error) {
|
||||||
|
// Payment fails, so return user to payment-adyen screen to try again or pay later.
|
||||||
|
return {
|
||||||
|
name: routeData.PAYMENT_ADYEN.name,
|
||||||
|
query: {
|
||||||
|
piaFailure: true,
|
||||||
|
},
|
||||||
|
replace: true,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
console.log(`Out of promise`);
|
console.log(`Out of promise`);
|
||||||
console.log(result);
|
console.log(result);
|
||||||
|
|
||||||
|
|
@ -93,12 +107,18 @@ function finalizeAdyenPayment(sessionId, redirectResult) {
|
||||||
onPaymentFailed: (result, component) => {
|
onPaymentFailed: (result, component) => {
|
||||||
console.log(`Payment failed`);
|
console.log(`Payment failed`);
|
||||||
console.log(result);
|
console.log(result);
|
||||||
reject("Payment failed from Adyen");
|
reject({
|
||||||
|
paymentFailure: true,
|
||||||
|
message: "Payment failed from Adyen",
|
||||||
|
});
|
||||||
},
|
},
|
||||||
onError: (error, component) => {
|
onError: (error, component) => {
|
||||||
console.log(`Error occured`);
|
console.log(`Error occured`);
|
||||||
console.log(error);
|
console.log(error);
|
||||||
reject("Error from Adyen");
|
reject({
|
||||||
|
paymentFailure: false,
|
||||||
|
message: "Error from Adyen",
|
||||||
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
options: {},
|
options: {},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue