ci(cypress): fix worldpayxml, and deutschebank cypress test cases (#8193)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Arindam Sahoo
2025-07-04 19:44:36 +05:30
committed by GitHub
parent 41291e5cde
commit b937cb73f9
6 changed files with 360 additions and 35 deletions

View File

@ -1,3 +1,5 @@
import { customerAcceptance } from "./Commons";
const successful3DSCardDetails = { const successful3DSCardDetails = {
card_number: "4761739090000088", card_number: "4761739090000088",
card_exp_month: "12", card_exp_month: "12",
@ -6,6 +8,24 @@ const successful3DSCardDetails = {
card_cvc: "123", card_cvc: "123",
}; };
const paymentMethodData3DSResponse = {
card: {
last4: "0088",
card_type: "DEBIT",
card_network: "Visa",
card_issuer: "INTL HDQTRS-CENTER OWNED",
card_issuing_country: "UNITEDSTATES",
card_isin: "476173",
card_extended_bin: null,
card_exp_month: "12",
card_exp_year: "2034",
card_holder_name: "John Doe",
payment_checks: null,
authentication_data: null,
},
billing: null,
};
export const connectorDetails = { export const connectorDetails = {
card_pm: { card_pm: {
PaymentIntent: { PaymentIntent: {
@ -34,6 +54,7 @@ export const connectorDetails = {
status: 200, status: 200,
body: { body: {
status: "requires_customer_action", status: "requires_customer_action",
payment_method_data: paymentMethodData3DSResponse,
}, },
}, },
}, },
@ -52,6 +73,7 @@ export const connectorDetails = {
status: 200, status: 200,
body: { body: {
status: "requires_customer_action", status: "requires_customer_action",
payment_method_data: paymentMethodData3DSResponse,
}, },
}, },
}, },
@ -192,5 +214,77 @@ export const connectorDetails = {
}, },
}, },
}, },
ZeroAuthMandate: {
Configs: {
TRIGGER_SKIP: true,
},
Response: {
status: 200,
body: {
amount: 0,
status: "processing",
},
},
},
PaymentMethodIdMandate3DSAutoCapture: {
Configs: {
TRIGGER_SKIP: true,
},
Request: {
payment_method: "card",
payment_method_data: {
card: successful3DSCardDetails,
},
currency: "USD",
mandate_data: null,
authentication_type: "three_ds",
customer_acceptance: customerAcceptance,
},
Response: {
status: 200,
body: {
status: "requires_customer_action",
payment_method_data: paymentMethodData3DSResponse,
},
},
},
PaymentMethodIdMandate3DSManualCapture: {
Configs: {
TRIGGER_SKIP: true,
},
Request: {
payment_method: "card",
payment_method_data: {
card: successful3DSCardDetails,
},
mandate_data: null,
authentication_type: "three_ds",
customer_acceptance: customerAcceptance,
},
Response: {
status: 200,
body: {
status: "requires_customer_action",
payment_method_data: paymentMethodData3DSResponse,
},
},
},
ZeroAuthPaymentIntent: {
Configs: {
TRIGGER_SKIP: true,
},
Request: {
amount: 0,
setup_future_usage: "off_session",
currency: "USD",
},
Response: {
status: 200,
body: {
status: "requires_payment_method",
setup_future_usage: "off_session",
},
},
},
}, },
}; };

View File

@ -360,13 +360,14 @@ export const CONNECTOR_LISTS = {
"billwerk", "billwerk",
"braintree", "braintree",
"facilitapay", "facilitapay",
"fiuu",
"fiserv", "fiserv",
"fiuu",
"jpmorgan", "jpmorgan",
"nexinets", "nexinets",
"paypal", "paypal",
"stax", "stax",
"wellsfargo", "wellsfargo",
"worldpayxml",
], ],
// Add more exclusion lists // Add more exclusion lists
}, },

View File

@ -1,20 +1,21 @@
import { customerAcceptance } from "./Commons"; import {
customerAcceptance,
singleUseMandateData,
multiUseMandateData,
} from "./Commons";
import { getCustomExchange } from "./Modifiers"; import { getCustomExchange } from "./Modifiers";
const successfulNo3DSCardDetails = { const successfulNo3DSCardDetails = {
card_number: "4444333322221111", card_number: "4444333322221111",
card_exp_month: "01", card_exp_month: "01",
card_exp_year: "27", card_exp_year: "27",
card_holder_name: "AUTHORISED", card_holder_name: "Juspay Hyperswitch",
card_cvc: "123", card_cvc: "123",
}; };
const successfulThreeDSTestCardDetails = { const successful3DSTestCardDetails = {
...successfulNo3DSCardDetails,
card_number: "4242424242424242", card_number: "4242424242424242",
card_exp_month: "01",
card_exp_year: "27",
card_holder_name: "Joseph",
card_cvc: "123",
}; };
export const connectorDetails = { export const connectorDetails = {
@ -22,7 +23,7 @@ export const connectorDetails = {
PaymentIntent: { PaymentIntent: {
Request: { Request: {
currency: "USD", currency: "USD",
amount: 5000, amount: 6000,
customer_acceptance: null, customer_acceptance: null,
}, },
Response: { Response: {
@ -35,14 +36,14 @@ export const connectorDetails = {
PaymentIntentWithShippingCost: { PaymentIntentWithShippingCost: {
Request: { Request: {
currency: "USD", currency: "USD",
amount: 5000, amount: 6000,
shipping_cost: 50, shipping_cost: 50,
}, },
Response: { Response: {
status: 200, status: 200,
body: { body: {
status: "requires_payment_method", status: "requires_payment_method",
amount: 5000, amount: 6000,
shipping_cost: 50, shipping_cost: 50,
}, },
}, },
@ -62,17 +63,17 @@ export const connectorDetails = {
status: "processing", status: "processing",
shipping_cost: 50, shipping_cost: 50,
amount_received: null, amount_received: null,
amount: 5000, amount: 6000,
net_amount: 5050, net_amount: 6050,
}, },
}, },
}, },
"3DSManualCapture": getCustomExchange({ "3DSManualCapture": getCustomExchange({
Request: { Request: {
amount: 5000, amount: 6000,
payment_method: "card", payment_method: "card",
payment_method_data: { payment_method_data: {
card: successfulThreeDSTestCardDetails, card: successful3DSTestCardDetails,
}, },
currency: "USD", currency: "USD",
customer_acceptance: null, customer_acceptance: null,
@ -82,9 +83,9 @@ export const connectorDetails = {
"3DSAutoCapture": getCustomExchange({ "3DSAutoCapture": getCustomExchange({
Request: { Request: {
payment_method: "card", payment_method: "card",
amount: 5000, amount: 6000,
payment_method_data: { payment_method_data: {
card: successfulThreeDSTestCardDetails, card: successful3DSTestCardDetails,
}, },
currency: "USD", currency: "USD",
customer_acceptance: null, customer_acceptance: null,
@ -95,7 +96,7 @@ export const connectorDetails = {
Request: { Request: {
description: "Test description", description: "Test description",
payment_method: "card", payment_method: "card",
amount: 5000, amount: 6000,
payment_method_data: { payment_method_data: {
card: successfulNo3DSCardDetails, card: successfulNo3DSCardDetails,
}, },
@ -112,7 +113,7 @@ export const connectorDetails = {
No3DSAutoCapture: { No3DSAutoCapture: {
Request: { Request: {
payment_method: "card", payment_method: "card",
amount: 5000, amount: 6000,
payment_method_data: { payment_method_data: {
card: successfulNo3DSCardDetails, card: successfulNo3DSCardDetails,
}, },
@ -130,13 +131,13 @@ export const connectorDetails = {
}, },
Capture: { Capture: {
Request: { Request: {
amount_to_capture: 5000, amount_to_capture: 6000,
}, },
Response: { Response: {
status: 200, status: 200,
body: { body: {
status: "processing", status: "processing",
amount: 5000, amount: 6000,
amount_received: null, amount_received: null,
}, },
}, },
@ -149,19 +150,68 @@ export const connectorDetails = {
status: 200, status: 200,
body: { body: {
status: "processing", status: "processing",
amount: 5000, amount: 6000,
amount_received: null, amount_received: null,
}, },
}, },
}, },
Void: { CaptureCapturedAmount: {
Request: {}, Response: {
status: 400,
body: {
error: {
type: "invalid_request",
message:
"This Payment could not be captured because it has a capture_method of automatic. The expected state is manual_multiple",
code: "IR_14",
},
},
},
},
ConfirmSuccessfulPayment: {
Response: {
status: 400,
body: {
error: {
type: "invalid_request",
message:
"You cannot confirm this payment because it has status processing",
code: "IR_16",
},
},
},
},
Void: getCustomExchange({
Response: { Response: {
status: 200, status: 200,
body: { body: {
status: "cancelled", status: "cancelled",
}, },
}, },
ResponseCustom: {
body: {
type: "invalid_request",
message:
"You cannot cancel this payment because it has status processing",
code: "IR_16",
},
},
}),
RefundGreaterAmount: {
Request: {
amount: 6000000,
},
Response: {
status: 400,
body: {
error: {
type: "invalid_request",
message:
"This Payment could not be refund because it has a status of processing. The expected state is succeeded, partially_captured",
code: "IR_14",
},
},
},
}, },
ZeroAuthMandate: { ZeroAuthMandate: {
Response: { Response: {
@ -210,9 +260,12 @@ export const connectorDetails = {
}, },
}, },
SaveCardUseNo3DSAutoCapture: { SaveCardUseNo3DSAutoCapture: {
Configs: {
TRIGGER_SKIP: true,
},
Request: { Request: {
payment_method: "card", payment_method: "card",
amount: 5000, amount: 6000,
payment_method_data: { payment_method_data: {
card: successfulNo3DSCardDetails, card: successfulNo3DSCardDetails,
}, },
@ -227,10 +280,24 @@ export const connectorDetails = {
}, },
}, },
}, },
SaveCardConfirmAutoCaptureOffSession: {
Configs: {
TRIGGER_SKIP: true,
},
Request: {
setup_future_usage: "off_session",
},
Response: {
status: 200,
body: {
status: "processing",
},
},
},
SaveCardUseNo3DSManualCapture: { SaveCardUseNo3DSManualCapture: {
Request: { Request: {
payment_method: "card", payment_method: "card",
amount: 5000, amount: 6000,
payment_method_data: { payment_method_data: {
card: successfulNo3DSCardDetails, card: successfulNo3DSCardDetails,
}, },
@ -246,18 +313,17 @@ export const connectorDetails = {
}, },
}, },
VoidAfterConfirm: { VoidAfterConfirm: {
Request: {},
Response: { Response: {
status: 200, status: 200,
body: { body: {
status: "processing", status: "processing",
amount: 5000, amount: 6000,
}, },
}, },
}, },
manualPaymentPartialRefund: { manualPaymentPartialRefund: {
Request: { Request: {
amount: 5000, amount: 6000,
}, },
Response: { Response: {
status: 400, status: 400,
@ -273,7 +339,7 @@ export const connectorDetails = {
}, },
manualPaymentRefund: { manualPaymentRefund: {
Request: { Request: {
amount: 5000, amount: 6000,
}, },
Response: { Response: {
status: 400, status: 400,
@ -287,20 +353,25 @@ export const connectorDetails = {
}, },
}, },
}, },
MandateMultiUseNo3DSAutoCapture: getCustomExchange({ MandateMultiUseNo3DSAutoCapture: {
Request: { Request: {
payment_method: "card", payment_method: "card",
payment_method_data: { payment_method_data: {
card: successfulNo3DSCardDetails, card: successfulNo3DSCardDetails,
}, },
currency: "USD", currency: "USD",
customer_acceptance: customerAcceptance, mandate_data: multiUseMandateData,
setup_future_usage: "off_session",
}, },
}), Response: {
status: 200,
body: {
status: "processing",
},
},
},
Refund: { Refund: {
Request: { Request: {
amount: 5000, amount: 6000,
}, },
Response: { Response: {
status: 400, status: 400,
@ -330,5 +401,152 @@ export const connectorDetails = {
}, },
}, },
}, },
MandateSingleUseNo3DSAutoCapture: {
Configs: {
TRIGGER_SKIP: true,
},
Request: {
payment_method: "card",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
currency: "USD",
mandate_data: singleUseMandateData,
},
Response: {
status: 200,
body: {
status: "processing",
},
},
},
MandateSingleUseNo3DSManualCapture: {
Configs: {
TRIGGER_SKIP: true,
},
Request: {
payment_method: "card",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
currency: "USD",
mandate_data: singleUseMandateData,
},
Response: {
status: 200,
body: {
status: "requires_capture",
},
},
},
MandateMultiUseNo3DSManualCapture: {
Request: {
payment_method: "card",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
currency: "USD",
mandate_data: multiUseMandateData,
},
Response: {
status: 200,
body: {
status: "requires_capture",
},
},
},
SaveCardUseNo3DSManualCaptureOffSession: {
Configs: {
TRIGGER_SKIP: true,
},
Request: {
payment_method: "card",
payment_method_data: {
card: successful3DSTestCardDetails,
},
setup_future_usage: "off_session",
customer_acceptance: customerAcceptance,
},
Response: {
status: 200,
body: {
status: "requires_capture",
},
},
},
SaveCardConfirmManualCaptureOffSession: {
Configs: {
TRIGGER_SKIP: true,
},
Request: {
setup_future_usage: "off_session",
},
Response: {
status: 200,
body: {
status: "requires_capture",
},
},
},
PaymentMethodIdMandateNo3DSAutoCapture: {
Configs: {
TRIGGER_SKIP: true,
},
Request: {
payment_method: "card",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
currency: "USD",
mandate_data: null,
customer_acceptance: customerAcceptance,
},
Response: {
status: 200,
body: {
status: "processing",
},
},
},
PaymentMethodIdMandateNo3DSManualCapture: {
Configs: {
TRIGGER_SKIP: true,
},
Request: {
payment_method: "card",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
currency: "USD",
mandate_data: null,
customer_acceptance: customerAcceptance,
},
Response: {
status: 200,
body: {
status: "requires_capture",
},
},
},
SaveCardUseNo3DSAutoCaptureOffSession: {
Configs: {
TRIGGER_SKIP: true,
},
Request: {
payment_method: "card",
payment_method_type: "debit",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
setup_future_usage: "off_session",
customer_acceptance: customerAcceptance,
},
Response: {
status: 200,
body: {
status: "processing",
},
},
},
}, },
}; };

View File

@ -164,6 +164,7 @@ describe("Card - Mandates using Payment Method Id flow test", () => {
cy.retrievePaymentCallTest(globalState, data); cy.retrievePaymentCallTest(globalState, data);
}); });
it("Confirm No 3DS MIT", () => { it("Confirm No 3DS MIT", () => {
const data = getConnectorDetails(globalState.get("connectorId"))[ const data = getConnectorDetails(globalState.get("connectorId"))[
"card_pm" "card_pm"

View File

@ -2442,6 +2442,9 @@ Cypress.Commands.add(
"payment_method_id" "payment_method_id"
).to.include("pm_").and.to.not.be.null; ).to.include("pm_").and.to.not.be.null;
// Whenever, CIT Confirmations gets a payment status of `processing`, it does not yield the `payment_method_id` and hence the `paymentMethodId` in the `globalState` gets the value of `null`. And hence while confirming MIT, it yields an `error.message` of `"Json deserialize error: invalid type: null, expected a string at line 1 column 182"` which is basically because of the `null` value in `recurring_details.data` with `recurring_details.type` as `payment_method_id`. However, we get the `payment_method_id` while PSync, so we can assign it to the `globalState` here.
globalState.set("paymentMethodId", response.body.payment_method_id);
const allowedActiveStatuses = [ const allowedActiveStatuses = [
"succeeded", "succeeded",
"requires_capture", "requires_capture",

View File

@ -719,12 +719,20 @@ function threeDsRedirection(redirectionUrl, expectedUrl, connectorId) {
}); });
break; break;
case "deutschebank":
cy.get('button[id="submit"]', { timeout: constants.TIMEOUT })
.should("exist")
.should("be.visible")
.click();
break;
case "nexinets": case "nexinets":
cy.wait(constants.TIMEOUT / 10); // Wait for the page to load cy.wait(constants.TIMEOUT / 10); // Wait for the page to load
// Nexinets iDEAL specific selector - click the Success link // Nexinets iDEAL specific selector - click the Success link
cy.get("a.btn.btn-primary.btn-block").contains("Success").click(); cy.get("a.btn.btn-primary.btn-block").contains("Success").click();
break; break;
case "nmi": case "nmi":
case "noon": case "noon":
case "xendit": case "xendit":