Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

ci(cypress): Add Stax connector test in cypress (#8404)

Gnanasundari240269ce3b27de
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Modifiers.js b/cypress-tests/cypress/e2e/configs/Payment/Modifiers.js
index 751800f613..62d942a9fb 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Modifiers.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Modifiers.js
@@ -11,15 +11,16 @@ const connectorName = normalize(globalState.get("connectorId"));
function normalize(input) {
const exceptions = {
+ archipel: "Archipel",
bankofamerica: "Bank of America",
cybersource: "Cybersource",
datatrans: "Datatrans",
facilitapay: "Facilitapay",
+ noon: "Noon",
paybox: "Paybox",
paypal: "Paypal",
+ stax: "Stax",
wellsfargo: "Wellsfargo",
- noon: "Noon",
- archipel: "Archipel",
// Add more known exceptions here
};
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Stax.js b/cypress-tests/cypress/e2e/configs/Payment/Stax.js
new file mode 100644
index 0000000000..7dcd8f2736
--- /dev/null
+++ b/cypress-tests/cypress/e2e/configs/Payment/Stax.js
@@ -0,0 +1,899 @@
+import {
+ cardRequiredField,
+ customerAcceptance,
+ multiUseMandateData,
+ singleUseMandateData,
+} from "./Commons";
+
+// Test card details for stax SnapPay
+const successfulNo3DSCardDetails = {
+ card_number: "4111111111111111", // Visa test card from stax documentation
+ card_exp_month: "12",
+ card_exp_year: "30",
+ card_holder_name: "Joseph Doe",
+ card_cvc: "123",
+};
+
+const successfulThreeDSCardDetails = {
+ ...successfulNo3DSCardDetails,
+ card_number: "5555555555554444", // Visa test card from stax documentation
+};
+
+const failedCardDetails = {
+ ...successfulNo3DSCardDetails,
+ card_number: "4012888888881881", // Standard decline test card for stax - "Do Not Honor" response
+};
+
+export const fullNameRequiredField = {
+ "billing.address.last_name": {
+ required_field: "payment_method_data.billing.address.last_name",
+ display_name: "card_holder_name",
+ field_type: "user_full_name",
+ value: "Doe",
+ },
+ "billing.address.first_name": {
+ required_field: "payment_method_data.billing.address.first_name",
+ display_name: "card_holder_name",
+ field_type: "user_full_name",
+ value: "joseph",
+ },
+};
+
+export const billingRequiredField = {};
+
+const requiredFields = {
+ payment_methods: [
+ {
+ payment_method: "card",
+ payment_method_types: [
+ {
+ payment_method_type: "credit",
+ card_networks: [
+ {
+ eligible_connectors: ["stax"],
+ },
+ ],
+ required_fields: cardRequiredField,
+ },
+ ],
+ },
+ ],
+};
+
+const payment_method_data_no3ds = {
+ card: {
+ last4: "1111",
+ card_type: "CREDIT",
+ card_network: "Visa",
+ card_issuer: "JP Morgan",
+ card_issuing_country: "INDIA",
+ card_isin: "411111",
+ card_extended_bin: null,
+ card_exp_month: "12",
+ card_exp_year: "30",
+ card_holder_name: "Joseph Doe",
+ payment_checks: null,
+ authentication_data: null,
+ },
+ billing: null,
+};
+
+export const connectorDetails = {
+ card_pm: {
+ PaymentIntent: {
+ Request: {
+ currency: "USD",
+ customer_acceptance: null,
+ setup_future_usage: "on_session",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_payment_method",
+ setup_future_usage: "on_session",
+ },
+ },
+ },
+ "3DSManualCapture": {
+ Configs: {
+ TRIGGER_SKIP: true,
+ },
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulThreeDSCardDetails,
+ },
+ currency: "USD",
+ customer_acceptance: null,
+ setup_future_usage: "on_session",
+ },
+ Response: {
+ status: 400,
+ body: {
+ error: {
+ type: "invalid_request",
+ message: "3DS not supported for Stax",
+ code: "IR_00",
+ },
+ },
+ },
+ },
+ "3DSAutoCapture": {
+ Configs: {
+ TRIGGER_SKIP: true,
+ },
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulThreeDSCardDetails,
+ },
+ currency: "USD",
+ customer_acceptance: null,
+ setup_future_usage: "on_session",
+ },
+ Response: {
+ status: 400,
+ body: {
+ error: {
+ type: "invalid_request",
+ message: "3DS not supported for Stax",
+ code: "IR_00",
+ },
+ },
+ },
+ },
+ No3DSManualCapture: {
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ currency: "USD",
+ customer_acceptance: null,
+ setup_future_usage: "on_session",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_capture",
+ payment_method: "card",
+ payment_method_data: payment_method_data_no3ds,
+ },
+ },
+ },
+ No3DSAutoCapture: {
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ currency: "USD",
+ customer_acceptance: null,
+ setup_future_usage: "on_session",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "succeeded",
+ payment_method: "card",
+ payment_method_data: payment_method_data_no3ds,
+ },
+ },
+ },
+ PaymentIntentWithShippingCost: {
+ Request: {
+ currency: "USD",
+ shipping_cost: 50,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_payment_method",
+ shipping_cost: 50,
+ amount: 6000,
+ },
+ },
+ },
+ PaymentConfirmWithShippingCost: {
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ customer_acceptance: null,
+ setup_future_usage: "on_session",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "succeeded",
+ payment_method: "card",
+ payment_method_data: payment_method_data_no3ds,
+ },
+ },
+ },
+ No3DSFailPayment: {
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: failedCardDetails,
+ },
+ customer_acceptance: null,
+ setup_future_usage: "on_session",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "failed",
+ unified_code: "UE_9000",
+ unified_message: "Something went wrong",
+ },
+ },
+ },
+ Capture: {
+ Request: {
+ amount_to_capture: 6000,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "succeeded",
+ amount: 6000,
+ amount_capturable: 0,
+ amount_received: 6000,
+ },
+ },
+ },
+ PartialCapture: {
+ Request: {
+ amount_to_capture: 2000,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "partially_captured",
+ amount: 6000,
+ amount_capturable: 0,
+ amount_received: 2000,
+ },
+ },
+ },
+ Void: {
+ Request: {
+ cancellation_reason: "VOID",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "cancelled",
+ },
+ },
+ },
+ VoidAfterConfirm: {
+ Request: {
+ cancellation_reason: "VOID",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "cancelled",
+ },
+ },
+ },
+ Refund: {
+ Request: {
+ amount: 6000,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "succeeded",
+ },
+ },
+ },
+ PartialRefund: {
+ Request: {
+ amount: 2000,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "succeeded",
+ },
+ },
+ },
+ SyncRefund: {
+ Response: {
+ status: 200,
+ body: {
+ status: "succeeded",
+ },
+ },
+ },
+ manualPaymentRefund: {
+ Request: {
+ amount: 6000,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "succeeded",
+ },
+ },
+ },
+ manualPaymentPartialRefund: {
+ Request: {
+ amount: 2000,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "succeeded",
+ },
+ },
+ },
+ SyncPayment: {
+ Response: {
+ status: 200,
+ body: {
+ status: "succeeded",
+ payment_method: "card",
+ payment_method_data: payment_method_data_no3ds,
+ },
+ },
+ },
+ MandateSingleUse3DSAutoCapture: {
+ Configs: {
+ TRIGGER_SKIP: true,
+ },
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulThreeDSCardDetails,
+ },
+ currency: "USD",
+ mandate_data: singleUseMandateData,
+ },
+ Response: {
+ status: 400,
+ body: {
+ error: {
+ type: "invalid_request",
+ message: "3DS not supported for Stax",
+ code: "IR_00",
+ },
+ },
+ },
+ },
+ MandateSingleUseNo3DSAutoCapture: {
+ Configs: {
+ TRIGGER_SKIP: true,
+ },
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ currency: "USD",
+ mandate_data: singleUseMandateData,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "succeeded",
+ mandate_id: null,
+ payment_method_data: payment_method_data_no3ds,
+ payment_method: "card",
+ connector: "stax",
+ },
+ },
+ },
+ 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",
+ mandate_id: null,
+ payment_method_data: payment_method_data_no3ds,
+ payment_method: "card",
+ connector: "stax",
+ },
+ },
+ },
+ MandateMultiUseNo3DSAutoCapture: {
+ Configs: {
+ TRIGGER_SKIP: true,
+ },
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ currency: "USD",
+ mandate_data: multiUseMandateData,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "succeeded",
+ payment_method_data: payment_method_data_no3ds,
+ payment_method: "card",
+ connector: "stax",
+ },
+ },
+ },
+ MandateMultiUseNo3DSManualCapture: {
+ Configs: {
+ TRIGGER_SKIP: true,
+ },
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ currency: "USD",
+ mandate_data: multiUseMandateData,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_capture",
+ payment_method_data: payment_method_data_no3ds,
+ payment_method: "card",
+ connector: "stax",
+ },
+ },
+ },
+ SaveCardUseNo3DSAutoCapture: {
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ currency: "USD",
+ setup_future_usage: "on_session",
+ customer_acceptance: customerAcceptance,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "succeeded",
+ },
+ },
+ },
+ SaveCardUse3DSAutoCaptureOnSession: {
+ Configs: {
+ TRIGGER_SKIP: true,
+ },
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulThreeDSCardDetails,
+ },
+ currency: "USD",
+ setup_future_usage: "on_session",
+ customer_acceptance: customerAcceptance,
+ },
+ Response: {
+ status: 400,
+ body: {
+ error: {
+ type: "invalid_request",
+ message: "3DS not supported for Stax",
+ code: "IR_00",
+ },
+ },
+ },
+ },
+ SaveCardUseNo3DSAutoCaptureOffSession: {
+ Configs: {
+ TRIGGER_SKIP: true,
+ },
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ currency: "USD",
+ setup_future_usage: "off_session",
+ customer_acceptance: customerAcceptance,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "succeeded",
+ },
+ },
+ },
+ SaveCardUse3DSAutoCaptureOffSession: {
+ Configs: {
+ TRIGGER_SKIP: true,
+ },
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulThreeDSCardDetails,
+ },
+ currency: "USD",
+ setup_future_usage: "off_session",
+ customer_acceptance: customerAcceptance,
+ },
+ Response: {
+ status: 400,
+ body: {
+ error: {
+ type: "invalid_request",
+ message: "3DS not supported for Stax",
+ code: "IR_00",
+ },
+ },
+ },
+ },
+ SaveCardUseNo3DSManualCaptureOffSession: {
+ Configs: {
+ TRIGGER_SKIP: true,
+ },
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ currency: "USD",
+ setup_future_usage: "off_session",
+ customer_acceptance: customerAcceptance,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_capture",
+ },
+ },
+ },
+ PaymentIntentOffSession: {
+ Request: {
+ currency: "USD",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_payment_method",
+ },
+ },
+ },
+ SaveCardConfirmAutoCaptureOffSession: {
+ Configs: {
+ TRIGGER_SKIP: true,
+ },
+ Request: {
+ setup_future_usage: "off_session",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "succeeded",
+ },
+ },
+ },
+ SaveCardConfirmManualCaptureOffSession: {
+ Configs: {
+ TRIGGER_SKIP: true,
+ },
+ Request: {
+ setup_future_usage: "off_session",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_capture",
+ },
+ },
+ },
+ SaveCardConfirmAutoCaptureOffSessionWithoutBilling: {
+ Configs: {
+ TRIGGER_SKIP: true,
+ },
+ Request: {
+ setup_future_usage: "off_session",
+ billing: null,
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "succeeded",
+ billing: null,
+ },
+ },
+ },
+ SaveCardUseNo3DSManualCapture: {
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ currency: "USD",
+ setup_future_usage: "on_session",
+ customer_acceptance: customerAcceptance,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_capture",
+ },
+ },
+ },
+ SaveCardUse3DSAutoCapture: {
+ Configs: {
+ TRIGGER_SKIP: true,
+ },
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulThreeDSCardDetails,
+ },
+ currency: "USD",
+ setup_future_usage: "on_session",
+ customer_acceptance: customerAcceptance,
+ },
+ Response: {
+ status: 400,
+ body: {
+ error: {
+ type: "invalid_request",
+ message: "3DS not supported for Stax",
+ code: "IR_00",
+ },
+ },
+ },
+ },
+ PaymentMethodIdMandateNo3DSAutoCapture: {
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ currency: "USD",
+ mandate_data: null,
+ customer_acceptance: customerAcceptance,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "succeeded",
+ },
+ },
+ Configs: {
+ TRIGGER_SKIP: true,
+ },
+ },
+ PaymentMethodIdMandateNo3DSManualCapture: {
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ currency: "USD",
+ mandate_data: null,
+ customer_acceptance: customerAcceptance,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_capture",
+ },
+ },
+ Configs: {
+ TRIGGER_SKIP: true,
+ },
+ },
+ PaymentMethodIdMandate3DSAutoCapture: {
+ Configs: {
+ TRIGGER_SKIP: true,
+ },
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulThreeDSCardDetails,
+ },
+ currency: "USD",
+ mandate_data: null,
+ customer_acceptance: customerAcceptance,
+ },
+ Response: {
+ status: 400,
+ body: {
+ error: {
+ type: "invalid_request",
+ message: "3DS not supported for Stax",
+ code: "IR_00",
+ },
+ },
+ },
+ },
+ PaymentMethodIdMandate3DSManualCapture: {
+ Configs: {
+ TRIGGER_SKIP: true,
+ },
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulThreeDSCardDetails,
+ },
+ currency: "USD",
+ mandate_data: null,
+ customer_acceptance: customerAcceptance,
+ },
+ Response: {
+ status: 400,
+ body: {
+ error: {
+ type: "invalid_request",
+ message: "3DS not supported for Stax",
+ code: "IR_00",
+ },
+ },
+ },
+ },
+ MITWithoutBillingAddress: {
+ Request: {
+ billing: null,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "succeeded",
+ billing: null,
+ },
+ },
+ Configs: {
+ TRIGGER_SKIP: true,
+ },
+ },
+ ZeroAuthMandate: {
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ currency: "USD",
+ mandate_data: singleUseMandateData,
+ },
+ Response: {
+ status: 400,
+ body: {
+ error: {
+ type: "invalid_request",
+ message: "Setup Mandate flow for Stax is not implemented",
+ code: "IR_00",
+ },
+ },
+ },
+ },
+ ZeroAuthPaymentIntent: {
+ Request: {
+ currency: "USD",
+ amount: 0,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_payment_method",
+ },
+ },
+ },
+ ZeroAuthConfirmPayment: {
+ Request: {
+ payment_type: "setup_mandate",
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ },
+ Response: {
+ status: 400,
+ body: {
+ error: {
+ type: "invalid_request",
+ message: "Setup Mandate flow for Stax is not implemented",
+ code: "IR_00",
+ },
+ },
+ },
+ },
+ MITAutoCapture: {
+ // stax does not support MIT payments with mandate_id
+ Configs: {
+ TRIGGER_SKIP: true,
+ },
+ Request: {},
+ Response: {
+ status: 200,
+ body: {
+ status: "succeeded",
+ mandate_id: null,
+ payment_method: "card",
+ payment_method_data: payment_method_data_no3ds,
+ connector: "stax",
+ },
+ },
+ },
+ MITManualCapture: {
+ // stax does not support MIT payments with mandate_id
+ Configs: {
+ TRIGGER_SKIP: true,
+ },
+ Request: {},
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_capture",
+ mandate_id: null,
+ payment_method: "card",
+ payment_method_data: payment_method_data_no3ds,
+ connector: "stax",
+ },
+ },
+ },
+ PaymentWithBilling: {
+ Request: {
+ currency: "USD",
+ setup_future_usage: "on_session",
+ billing: {
+ address: {
+ line1: "1467",
+ line2: "1461",
+ line3: "Harrison Street",
+ city: "San Fransico",
+ state: "NY",
+ zip: "94122",
+ country: "US",
+ first_name: "joseph",
+ last_name: "Doe",
+ },
+ phone: {
+ number: "9111222333",
+ country_code: "+1",
+ },
+ },
+ email: "[email protected]",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_payment_method",
+ },
+ },
+ },
+ },
+
+ pm_list: {
+ PmListResponse: {
+ PmListNull: {
+ payment_methods: [],
+ },
+ pmListDynamicFieldWithoutBilling: requiredFields,
+ pmListDynamicFieldWithBilling: requiredFields,
+ pmListDynamicFieldWithNames: requiredFields,
+ pmListDynamicFieldWithEmail: requiredFields,
+ },
+ },
+};
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Utils.js b/cypress-tests/cypress/e2e/configs/Payment/Utils.js
index 9f2f50f593..9f359364f2 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Utils.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Utils.js
@@ -36,6 +36,7 @@ import { connectorDetails as payboxConnectorDetails } from "./Paybox.js";
import { connectorDetails as paypalConnectorDetails } from "./Paypal.js";
import { connectorDetails as powertranzConnectorDetails } from "./PowerTranz.js";
import { connectorDetails as redsysConnectorDetails } from "./Redsys.js";
+import { connectorDetails as staxConnectorDetails } from "./Stax.js";
import { connectorDetails as shift4ConnectorDetails } from "./Shift4.js";
import { connectorDetails as stripeConnectorDetails } from "./Stripe.js";
import { connectorDetails as trustpayConnectorDetails } from "./Trustpay.js";
@@ -79,6 +80,7 @@ const connectorDetails = {
paypal: paypalConnectorDetails,
powertranz: powertranzConnectorDetails,
redsys: redsysConnectorDetails,
+ stax: staxConnectorDetails,
stripe: stripeConnectorDetails,
shift4: shift4ConnectorDetails,
trustpay: trustpayConnectorDetails,
@@ -345,6 +347,7 @@ export const CONNECTOR_LISTS = {
// Exclusion lists (skip these connectors)
EXCLUDE: {
CONNECTOR_AGNOSTIC_NTID: [
+ "bamboraapac",
"bankofamerica",
"billwerk",
"braintree",
@@ -353,7 +356,7 @@ export const CONNECTOR_LISTS = {
"fiserv",
"jpmorgan",
"paypal",
- "bamboraapac",
+ "stax",
],
// Add more exclusion lists
},