mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-27 19:46:48 +08:00
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:
@ -1,3 +1,5 @@
|
||||
import { customerAcceptance } from "./Commons";
|
||||
|
||||
const successful3DSCardDetails = {
|
||||
card_number: "4761739090000088",
|
||||
card_exp_month: "12",
|
||||
@ -6,6 +8,24 @@ const successful3DSCardDetails = {
|
||||
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 = {
|
||||
card_pm: {
|
||||
PaymentIntent: {
|
||||
@ -34,6 +54,7 @@ export const connectorDetails = {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_customer_action",
|
||||
payment_method_data: paymentMethodData3DSResponse,
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -52,6 +73,7 @@ export const connectorDetails = {
|
||||
status: 200,
|
||||
body: {
|
||||
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",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@ -360,13 +360,14 @@ export const CONNECTOR_LISTS = {
|
||||
"billwerk",
|
||||
"braintree",
|
||||
"facilitapay",
|
||||
"fiuu",
|
||||
"fiserv",
|
||||
"fiuu",
|
||||
"jpmorgan",
|
||||
"nexinets",
|
||||
"paypal",
|
||||
"stax",
|
||||
"wellsfargo",
|
||||
"worldpayxml",
|
||||
],
|
||||
// Add more exclusion lists
|
||||
},
|
||||
|
||||
@ -1,20 +1,21 @@
|
||||
import { customerAcceptance } from "./Commons";
|
||||
import {
|
||||
customerAcceptance,
|
||||
singleUseMandateData,
|
||||
multiUseMandateData,
|
||||
} from "./Commons";
|
||||
import { getCustomExchange } from "./Modifiers";
|
||||
|
||||
const successfulNo3DSCardDetails = {
|
||||
card_number: "4444333322221111",
|
||||
card_exp_month: "01",
|
||||
card_exp_year: "27",
|
||||
card_holder_name: "AUTHORISED",
|
||||
card_holder_name: "Juspay Hyperswitch",
|
||||
card_cvc: "123",
|
||||
};
|
||||
|
||||
const successfulThreeDSTestCardDetails = {
|
||||
const successful3DSTestCardDetails = {
|
||||
...successfulNo3DSCardDetails,
|
||||
card_number: "4242424242424242",
|
||||
card_exp_month: "01",
|
||||
card_exp_year: "27",
|
||||
card_holder_name: "Joseph",
|
||||
card_cvc: "123",
|
||||
};
|
||||
|
||||
export const connectorDetails = {
|
||||
@ -22,7 +23,7 @@ export const connectorDetails = {
|
||||
PaymentIntent: {
|
||||
Request: {
|
||||
currency: "USD",
|
||||
amount: 5000,
|
||||
amount: 6000,
|
||||
customer_acceptance: null,
|
||||
},
|
||||
Response: {
|
||||
@ -35,14 +36,14 @@ export const connectorDetails = {
|
||||
PaymentIntentWithShippingCost: {
|
||||
Request: {
|
||||
currency: "USD",
|
||||
amount: 5000,
|
||||
amount: 6000,
|
||||
shipping_cost: 50,
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_payment_method",
|
||||
amount: 5000,
|
||||
amount: 6000,
|
||||
shipping_cost: 50,
|
||||
},
|
||||
},
|
||||
@ -62,17 +63,17 @@ export const connectorDetails = {
|
||||
status: "processing",
|
||||
shipping_cost: 50,
|
||||
amount_received: null,
|
||||
amount: 5000,
|
||||
net_amount: 5050,
|
||||
amount: 6000,
|
||||
net_amount: 6050,
|
||||
},
|
||||
},
|
||||
},
|
||||
"3DSManualCapture": getCustomExchange({
|
||||
Request: {
|
||||
amount: 5000,
|
||||
amount: 6000,
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
card: successfulThreeDSTestCardDetails,
|
||||
card: successful3DSTestCardDetails,
|
||||
},
|
||||
currency: "USD",
|
||||
customer_acceptance: null,
|
||||
@ -82,9 +83,9 @@ export const connectorDetails = {
|
||||
"3DSAutoCapture": getCustomExchange({
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
amount: 5000,
|
||||
amount: 6000,
|
||||
payment_method_data: {
|
||||
card: successfulThreeDSTestCardDetails,
|
||||
card: successful3DSTestCardDetails,
|
||||
},
|
||||
currency: "USD",
|
||||
customer_acceptance: null,
|
||||
@ -95,7 +96,7 @@ export const connectorDetails = {
|
||||
Request: {
|
||||
description: "Test description",
|
||||
payment_method: "card",
|
||||
amount: 5000,
|
||||
amount: 6000,
|
||||
payment_method_data: {
|
||||
card: successfulNo3DSCardDetails,
|
||||
},
|
||||
@ -112,7 +113,7 @@ export const connectorDetails = {
|
||||
No3DSAutoCapture: {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
amount: 5000,
|
||||
amount: 6000,
|
||||
payment_method_data: {
|
||||
card: successfulNo3DSCardDetails,
|
||||
},
|
||||
@ -130,13 +131,13 @@ export const connectorDetails = {
|
||||
},
|
||||
Capture: {
|
||||
Request: {
|
||||
amount_to_capture: 5000,
|
||||
amount_to_capture: 6000,
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "processing",
|
||||
amount: 5000,
|
||||
amount: 6000,
|
||||
amount_received: null,
|
||||
},
|
||||
},
|
||||
@ -149,19 +150,68 @@ export const connectorDetails = {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "processing",
|
||||
amount: 5000,
|
||||
amount: 6000,
|
||||
amount_received: null,
|
||||
},
|
||||
},
|
||||
},
|
||||
Void: {
|
||||
Request: {},
|
||||
CaptureCapturedAmount: {
|
||||
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: {
|
||||
status: 200,
|
||||
body: {
|
||||
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: {
|
||||
Response: {
|
||||
@ -210,9 +260,12 @@ export const connectorDetails = {
|
||||
},
|
||||
},
|
||||
SaveCardUseNo3DSAutoCapture: {
|
||||
Configs: {
|
||||
TRIGGER_SKIP: true,
|
||||
},
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
amount: 5000,
|
||||
amount: 6000,
|
||||
payment_method_data: {
|
||||
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: {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
amount: 5000,
|
||||
amount: 6000,
|
||||
payment_method_data: {
|
||||
card: successfulNo3DSCardDetails,
|
||||
},
|
||||
@ -246,18 +313,17 @@ export const connectorDetails = {
|
||||
},
|
||||
},
|
||||
VoidAfterConfirm: {
|
||||
Request: {},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "processing",
|
||||
amount: 5000,
|
||||
amount: 6000,
|
||||
},
|
||||
},
|
||||
},
|
||||
manualPaymentPartialRefund: {
|
||||
Request: {
|
||||
amount: 5000,
|
||||
amount: 6000,
|
||||
},
|
||||
Response: {
|
||||
status: 400,
|
||||
@ -273,7 +339,7 @@ export const connectorDetails = {
|
||||
},
|
||||
manualPaymentRefund: {
|
||||
Request: {
|
||||
amount: 5000,
|
||||
amount: 6000,
|
||||
},
|
||||
Response: {
|
||||
status: 400,
|
||||
@ -287,20 +353,25 @@ export const connectorDetails = {
|
||||
},
|
||||
},
|
||||
},
|
||||
MandateMultiUseNo3DSAutoCapture: getCustomExchange({
|
||||
MandateMultiUseNo3DSAutoCapture: {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
card: successfulNo3DSCardDetails,
|
||||
},
|
||||
currency: "USD",
|
||||
customer_acceptance: customerAcceptance,
|
||||
setup_future_usage: "off_session",
|
||||
mandate_data: multiUseMandateData,
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "processing",
|
||||
},
|
||||
},
|
||||
},
|
||||
}),
|
||||
Refund: {
|
||||
Request: {
|
||||
amount: 5000,
|
||||
amount: 6000,
|
||||
},
|
||||
Response: {
|
||||
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",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@ -164,6 +164,7 @@ describe("Card - Mandates using Payment Method Id flow test", () => {
|
||||
|
||||
cy.retrievePaymentCallTest(globalState, data);
|
||||
});
|
||||
|
||||
it("Confirm No 3DS MIT", () => {
|
||||
const data = getConnectorDetails(globalState.get("connectorId"))[
|
||||
"card_pm"
|
||||
|
||||
@ -2442,6 +2442,9 @@ Cypress.Commands.add(
|
||||
"payment_method_id"
|
||||
).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 = [
|
||||
"succeeded",
|
||||
"requires_capture",
|
||||
|
||||
@ -719,12 +719,20 @@ function threeDsRedirection(redirectionUrl, expectedUrl, connectorId) {
|
||||
});
|
||||
break;
|
||||
|
||||
case "deutschebank":
|
||||
cy.get('button[id="submit"]', { timeout: constants.TIMEOUT })
|
||||
.should("exist")
|
||||
.should("be.visible")
|
||||
.click();
|
||||
break;
|
||||
|
||||
case "nexinets":
|
||||
cy.wait(constants.TIMEOUT / 10); // Wait for the page to load
|
||||
// Nexinets iDEAL specific selector - click the Success link
|
||||
cy.get("a.btn.btn-primary.btn-block").contains("Success").click();
|
||||
|
||||
break;
|
||||
|
||||
case "nmi":
|
||||
case "noon":
|
||||
case "xendit":
|
||||
|
||||
Reference in New Issue
Block a user