Nits on redirect flow
This commit is contained in:
parent
6ab6932fc5
commit
516ba215b8
1 changed files with 16 additions and 2 deletions
|
|
@ -21,7 +21,7 @@ export async function adyenReturnBeforeEnter(to, from) {
|
|||
result = await finalizeAdyenPayment(sessionId, redirectResult);
|
||||
} catch (unexpectedResult) {
|
||||
// If user cancelled payment, handle without error message
|
||||
if (unexpectedResult.code === "Cancelled") {
|
||||
if (unexpectedResult.code === "Cancelled" || unexpectedResult.code === "CANCEL") {
|
||||
return {
|
||||
name: routeData.PAYMENT_ADYEN.name,
|
||||
replace: true,
|
||||
|
|
@ -119,6 +119,13 @@ function finalizeAdyenPayment(sessionId, redirectResult) {
|
|||
onPaymentFailed: (result, component) => {
|
||||
console.log(`Payment failed`);
|
||||
console.log(result);
|
||||
|
||||
if (result?.resultCode !== "Cancelled") {
|
||||
const stringToLog = `ADYEN PAYMENT NOT AUTHORIZED. Code = ${result?.resultCode}. Id = ${sessionId}`;
|
||||
|
||||
global.$logger.logError(stringToLog);
|
||||
}
|
||||
|
||||
reject({
|
||||
code: result?.resultCode,
|
||||
message: "Payment failed from Adyen",
|
||||
|
|
@ -127,8 +134,15 @@ function finalizeAdyenPayment(sessionId, redirectResult) {
|
|||
onError: (error, component) => {
|
||||
console.log(`Error occured`);
|
||||
console.log(error);
|
||||
|
||||
if (error?.name !== "CANCEL") {
|
||||
const stringToLog = `ADYEN ERROR. Name = ${error?.name}. Details = ${error?.message}.`;
|
||||
|
||||
global.$logger.logError(stringToLog);
|
||||
}
|
||||
|
||||
reject({
|
||||
code: "Error",
|
||||
code: error?.name,
|
||||
message: "Error from Adyen",
|
||||
});
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue