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
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
test(cypress): add card test cases for tsys_transit connector (#13513)
likhinbopanna4bcbd4cd6a8d
diff --git a/cypress-tests/README.md b/cypress-tests/README.mdindex 00df7323b6..627ba4ec03 100644--- a/cypress-tests/README.md+++ b/cypress-tests/README.md@@ -114,6 +114,22 @@ CYPRESS_CONNECTOR="connector_id" npm run cypress:ciexport CYPRESS_CONNECTOR_AUTH_FILE_PATH="path/to/creds.json"```+ Individual suites need additional variables on top of the above:++ ```shell+ # Modular Payment Method Service, which is deployed separately from the+ # router. Required by `npm run cypress:modular-pm-service`, and by the+ # modular customer / saved card steps in+ # `Payment/54-ConnectorAgnosticMandates`.+ export PM_SERVICE_URL="pm_service_url"+ ```++> [!IMPORTANT]+> `PM_SERVICE_URL` is passed **without** the `CYPRESS_` prefix — it is forwarded onto `Cypress.env()` by the `env` block in [`cypress.config.js`](cypress.config.js). Every other variable above relies on Cypress auto-mapping instead, where `CYPRESS_NAME` becomes `Cypress.env("NAME")` with the remainder of the name used verbatim, underscores included. So `CYPRESS_PMSERVICEURL` is **not** read as `PM_SERVICE_URL`. The names the tests consume are listed in [`cypress/utils/State.js`](cypress/utils/State.js).++> [!NOTE]+> When `PM_SERVICE_URL` is unset, `54-ConnectorAgnosticMandates` logs a message and falls back to the v1 customer, payment method list, and save card confirm calls, so the payments suite still runs.+> [!TIP]> It is recommended to install [direnv](https://github.com/direnv/direnv) and use a `.envrc` file to store these environment variables with `cypress-tests` directory. This will make it easier to manage environment variables while working with Cypress tests.diff --git a/cypress-tests/cypress.config.js b/cypress-tests/cypress.config.jsindex 94d71fe437..c79057f1f3 100644--- a/cypress-tests/cypress.config.js+++ b/cypress-tests/cypress.config.js@@ -12,10 +12,31 @@ const screenshotsFolderName = `screenshots/${connectorId}`;const reportName = process.env.REPORT_NAME || `${connectorId}_report`;const retries = process.env.CYPRESS_MOCK_SERVER === "true" ? 0 : 2;+// Cypress only auto-maps `CYPRESS_` prefixed variables onto `Cypress.env()`, so+// these are forwarded explicitly and can be exported without the prefix. A+// CYPRESS_ prefixed variable still wins, since those override the config file.+// Names must match what `cypress/utils/State.js` reads.+const forwardedEnv = [+ "PM_SERVICE_URL",+ "SUPERPOSITION_BASE_URL",+ "SUPERPOSITION_SECRET",+ "SUPERPOSITION_API_KEY",+ "SUPERPOSITION_ORG_ID",+ "SUPERPOSITION_WORKSPACE_ID",+].reduce((acc, name) => {+ // Only forward what is actually set, so an absent variable never shadows a+ // CYPRESS_ prefixed one+ if (process.env[name] !== undefined) {+ acc[name] = process.env[name];+ }+ return acc;+}, {});+// Get timeout multiplier from shared utilityconst timeoutMultiplier = getTimeoutMultiplier();export default defineConfig({+ env: forwardedEnv,e2e: {setupNodeEvents(on, config) {mochawesome(on);diff --git a/cypress-tests/cypress/e2e/configs/Payment/TsysTransit.js b/cypress-tests/cypress/e2e/configs/Payment/TsysTransit.jsnew file mode 100644index 0000000000..3e41241e26--- /dev/null+++ b/cypress-tests/cypress/e2e/configs/Payment/TsysTransit.js@@ -0,0 +1,1284 @@+import { customerAcceptance } from "./Commons";++// TSYS TransIT echoes the merchant order reference back to the connector, so a+// fresh value is generated for every payment intent rather than once per run.+const randomMerchantOrderReferenceId = () =>+ `tsys_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;++const successfulNo3DSCardDetailsVisa = {+ card_number: "4012000098765439",+ card_exp_month: "12",+ card_exp_year: "28",+ card_holder_name: "Joseph Doe",+ card_cvc: "999",+};++const successfulNo3DSCardDetailsMastercard = {+ card_number: "5146315000000055",+ card_exp_month: "12",+ card_exp_year: "28",+ card_holder_name: "Joseph Doe",+ card_cvc: "998",+};++// 15 digit PAN, 4 digit CID+const successfulNo3DSCardDetailsAmex = {+ card_number: "371449635392376",+ card_exp_month: "12",+ card_exp_year: "28",+ card_holder_name: "Joseph Doe",+ card_cvc: "9997",+};++// TSYS TransIT test card numbers — 3DS+const successfulThreeDSCardDetailsVisa = {+ card_number: "4012000033330026",+ card_exp_month: "12",+ card_exp_year: "30",+ card_holder_name: "Joseph Doe",+ card_cvc: "999",+};++const successfulThreeDSCardDetailsMastercard =+ successfulNo3DSCardDetailsMastercard;++const successfulThreeDSCardDetailsAmex = successfulNo3DSCardDetailsAmex;++const failedCardDetails = {+ ...successfulNo3DSCardDetailsVisa,+ card_cvc: "123",+};++const payment_method_data_visa = {+ card: {+ last4: "5439",+ card_type: "DEBIT",+ card_network: "Visa",+ card_issuer: "VISA PRODUCTION SUPPORT CLIENT BID 1",+ card_issuing_country: "UNITEDSTATES",+ card_isin: "401200",+ card_extended_bin: null,+ card_exp_month: "12",+ card_exp_year: "28",+ card_holder_name: "Joseph Doe",+ payment_checks: null,+ authentication_data: null,+ auth_code: null,+ },+ billing: null,+};++export const connectorDetails = {+ card_pm: {+ PaymentIntent: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: 5000,+ },+ },+ Request: {+ currency: "USD",+ customer_acceptance: null,+ setup_future_usage: "on_session",+ payment_channel: "telephone_order",+ get merchant_order_reference_id() {+ return randomMerchantOrderReferenceId();+ },+ },+ Response: {+ status: 200,+ body: {+ status: "requires_payment_method",+ setup_future_usage: "on_session",+ },+ },+ },++ // ── No-3DS card flows ─────────────────────────────────────────++ No3DSAutoCapture: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: 5000,+ },+ },+ Request: {+ payment_channel: "telephone_order",+ payment_method: "card",+ payment_method_data: {+ card: successfulNo3DSCardDetailsVisa,+ },+ currency: "USD",+ customer_acceptance: null,+ setup_future_usage: "on_session",+ get merchant_order_reference_id() {+ return randomMerchantOrderReferenceId();+ },+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ payment_method: "card",+ payment_method_data: payment_method_data_visa,+ },+ },+ },++ No3DSManualCapture: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: 5000,+ },+ },+ Request: {+ payment_channel: "telephone_order",+ payment_method: "card",+ payment_method_data: {+ card: successfulNo3DSCardDetailsVisa,+ },+ 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_visa,+ },+ },+ },++ No3DSFailPayment: {+ Request: {+ payment_channel: "telephone_order",+ payment_method: "card",+ payment_method_data: {+ card: failedCardDetails,+ },+ customer_acceptance: null,+ setup_future_usage: "on_session",+ },+ Response: {+ status: 200,+ body: {+ status: "failed",+ error_code: "D2020",+ error_message: "CVV2 verification failed",+ },+ },+ },++ // ── 3DS card flows — Visa ─────────────────────────────────────++ "3DSAutoCapture": {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: 5000,+ },+ TRIGGER_SKIP: true,+ },+ Request: {+ payment_channel: "telephone_order",+ payment_method: "card",+ payment_method_data: {+ card: successfulNo3DSCardDetailsVisa,+ },+ currency: "USD",+ customer_acceptance: null,+ setup_future_usage: "on_session",+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ },+ },+ },++ "3DSManualCapture": {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: 5000,+ },+ TRIGGER_SKIP: true,+ },+ Request: {+ payment_channel: "telephone_order",+ payment_method: "card",+ payment_method_data: {+ card: successfulThreeDSCardDetailsVisa,+ },+ currency: "USD",+ customer_acceptance: null,+ setup_future_usage: "on_session",+ },+ Response: {+ status: 200,+ body: {+ status: "requires_capture",+ },+ },+ },++ // 3DS — Mastercard variant+ "3DSAutoCaptureMastercard": {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: 5000,+ },+ TRIGGER_SKIP: true,+ },+ Request: {+ payment_channel: "telephone_order",+ payment_method: "card",+ payment_method_data: {+ card: successfulThreeDSCardDetailsMastercard,+ },+ currency: "USD",+ customer_acceptance: null,+ setup_future_usage: "on_session",+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ },+ },+ },++ // 3DS — Amex variant+ "3DSAutoCaptureAmex": {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: 5000,+ },+ TRIGGER_SKIP: true,+ },+ Request: {+ payment_channel: "telephone_order",+ payment_method: "card",+ payment_method_data: {+ card: successfulThreeDSCardDetailsAmex,+ },+ currency: "USD",+ customer_acceptance: null,+ setup_future_usage: "on_session",+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ },+ },+ },++ // ── Capture / Void / Refund ───────────────────────────────────++ Capture: {+ Request: {+ amount_to_capture: 6000,+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ amount: 6000,+ amount_capturable: 6000,+ amount_received: null,+ },+ },+ },++ PartialCapture: {+ Request: {+ amount_to_capture: 2000,+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ amount: 6000,+ amount_capturable: 6000,+ amount_received: null,+ },+ },+ },++ Void: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: 5000,+ },+ },+ Request: {+ cancellation_reason: "VOID",+ },+ Response: {+ status: 200,+ body: {+ status: "cancelled",+ },+ },+ },++ VoidAfterConfirm: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: 5000,+ },+ },+ Request: {+ cancellation_reason: "VOID",+ },+ Response: {+ status: 200,+ body: {+ status: "cancelled",+ },+ },+ },++ Refund: {+ Request: {+ amount: 6000,+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ amount: 6000,+ },+ },+ },++ PartialRefund: {+ Request: {+ amount: 2000,+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ amount: 2000,+ },+ },+ },++ 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",+ amount: 2000,+ },+ },+ },++ SyncPayment: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: 5000,+ },+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ payment_method: "card",+ payment_method_data: payment_method_data_visa,+ },+ },+ },++ // ── Moto CIT — connector agnostic token, off_session ─────────+ // Profile must have is_connector_agnostic_mit_enabled = true.++ SaveCardUseNo3DSAutoCapture: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: 5000,+ },+ },+ Request: {+ payment_channel: "telephone_order",+ payment_method: "card",+ payment_method_data: {+ card: successfulNo3DSCardDetailsVisa,+ },+ currency: "USD",+ setup_future_usage: "on_session",+ customer_acceptance: customerAcceptance,+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ },+ },+ },++ // Moto CIT — Visa, off_session (primary CIT for connector-agnostic MIT)+ SaveCardUseNo3DSAutoCaptureOffSession: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: 5000,+ },+ TRIGGER_SKIP: true,+ },+ Request: {+ payment_channel: "telephone_order",+ payment_method: "card",+ payment_method_data: {+ card: successfulNo3DSCardDetailsVisa,+ },+ currency: "USD",+ setup_future_usage: "off_session",+ customer_acceptance: customerAcceptance,+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ },+ },+ },++ SaveCardUseNo3DSManualCaptureOffSession: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: 5000,+ },+ TRIGGER_SKIP: true,+ },+ Request: {+ payment_channel: "telephone_order",+ payment_method: "card",+ payment_method_data: {+ card: successfulNo3DSCardDetailsVisa,+ },+ currency: "USD",+ setup_future_usage: "off_session",+ customer_acceptance: customerAcceptance,+ },+ Response: {+ status: 200,+ body: {+ status: "requires_capture",+ },+ },+ },++ SaveCardUseNo3DSManualCapture: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: 5000,+ },+ },+ Request: {+ payment_channel: "telephone_order",+ payment_method: "card",+ payment_method_data: {+ card: successfulNo3DSCardDetailsVisa,+ },+ currency: "USD",+ setup_future_usage: "on_session",+ customer_acceptance: customerAcceptance,+ },+ Response: {+ status: 200,+ body: {+ status: "requires_capture",+ },+ },+ },++ // 3DS SaveCard flows+ SaveCardUse3DSAutoCapture: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: 5000,+ },+ TRIGGER_SKIP: true,+ },+ Request: {+ payment_channel: "telephone_order",+ payment_method: "card",+ payment_method_data: {+ card: successfulThreeDSCardDetailsVisa,+ },+ currency: "USD",+ setup_future_usage: "on_session",+ customer_acceptance: customerAcceptance,+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ },+ },+ },++ SaveCardUse3DSAutoCaptureOnSession: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: 5000,+ },+ TRIGGER_SKIP: true,+ },+ Request: {+ payment_channel: "telephone_order",+ payment_method: "card",+ payment_method_data: {+ card: successfulThreeDSCardDetailsVisa,+ },+ currency: "USD",+ setup_future_usage: "on_session",+ customer_acceptance: customerAcceptance,+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ },+ },+ },++ SaveCardUse3DSAutoCaptureOffSession: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: 5000,+ },+ TRIGGER_SKIP: true,+ },+ Request: {+ payment_channel: "telephone_order",+ payment_method: "card",+ payment_method_data: {+ card: successfulThreeDSCardDetailsVisa,+ },+ currency: "USD",+ setup_future_usage: "off_session",+ customer_acceptance: customerAcceptance,+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ },+ },+ },++ PaymentIntentOffSession: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: 5000,+ },+ },+ Request: {+ payment_channel: "telephone_order",+ currency: "USD",+ setup_future_usage: "off_session",+ },+ Response: {+ status: 200,+ body: {+ status: "requires_payment_method",+ },+ },+ },++ // Moto MIT — using payment token of CIT (setup_future_usage: off_session)+ SaveCardConfirmAutoCaptureOffSession: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: 5000,+ },+ TRIGGER_SKIP: true,+ },+ Request: {+ payment_channel: "telephone_order",+ setup_future_usage: "off_session",+ payment_method_data: {+ card: successfulNo3DSCardDetailsVisa,+ },+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ },+ },+ },++ SaveCardConfirmManualCaptureOffSession: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: 5000,+ },+ TRIGGER_SKIP: true,+ },+ Request: {+ payment_channel: "telephone_order",+ setup_future_usage: "off_session",+ payment_method_data: {+ card: successfulNo3DSCardDetailsVisa,+ },+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ },+ },+ },++ SaveCardConfirmAutoCaptureOffSessionWithoutBilling: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: 5000,+ },+ TRIGGER_SKIP: true,+ },+ Request: {+ payment_channel: "telephone_order",+ setup_future_usage: "off_session",+ billing: null,+ payment_method_data: {+ card: successfulNo3DSCardDetailsVisa,+ },+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ billing: null,+ },+ },+ },++ // Moto MIT — with payment_method_id (NTID flow; psp token not present)+ MITAutoCapture: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: 5000,+ },+ },+ Request: {+ payment_channel: "telephone_order",+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ mandate_id: null,+ payment_method: "card",+ connector: "tsys_transit",+ },+ },+ },++ MITManualCapture: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: 5000,+ },+ },+ Request: {+ payment_channel: "telephone_order",+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ mandate_id: null,+ payment_method: "card",+ payment_method_data: payment_method_data_visa,+ connector: "tsys_transit",+ },+ },+ },++ MITWithoutBillingAddress: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: 5000,+ },+ },+ Request: {+ payment_channel: "telephone_order",+ billing: null,+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ billing: null,+ },+ },+ },++ // ── PaymentMethodId mandate flows ─────────────────────────────++ PaymentMethodIdMandateNo3DSAutoCapture: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: 5000,+ },+ TRIGGER_SKIP: true,+ },+ Request: {+ payment_channel: "telephone_order",+ payment_method: "card",+ payment_method_data: {+ card: successfulNo3DSCardDetailsVisa,+ },+ currency: "USD",+ mandate_data: null,+ customer_acceptance: customerAcceptance,+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ },+ },+ },++ PaymentMethodIdMandateNo3DSManualCapture: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: 5000,+ },+ TRIGGER_SKIP: true,+ },+ Request: {+ payment_channel: "telephone_order",+ payment_method: "card",+ payment_method_data: {+ card: successfulNo3DSCardDetailsVisa,+ },+ currency: "USD",+ mandate_data: null,+ customer_acceptance: customerAcceptance,+ },+ Response: {+ status: 200,+ body: {+ status: "requires_capture",+ },+ },+ },++ PaymentMethodIdMandate3DSAutoCapture: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: 5000,+ },+ TRIGGER_SKIP: true,+ },+ Request: {+ payment_channel: "telephone_order",+ payment_method: "card",+ payment_method_data: {+ card: successfulThreeDSCardDetailsVisa,+ },+ currency: "USD",+ mandate_data: null,+ customer_acceptance: customerAcceptance,+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ },+ },+ },++ PaymentMethodIdMandate3DSManualCapture: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: 5000,+ },+ TRIGGER_SKIP: true,+ },+ Request: {+ payment_channel: "telephone_order",+ payment_method: "card",+ payment_method_data: {+ card: successfulThreeDSCardDetailsVisa,+ },+ currency: "USD",+ mandate_data: null,+ customer_acceptance: customerAcceptance,+ },+ Response: {+ status: 200,+ body: {+ status: "requires_capture",+ },+ },+ },++ // ── ZeroAuth ──────────────────────────────────────────────────++ ZeroAuthMandate: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: 5000,+ },+ },+ Request: {+ payment_channel: "telephone_order",+ payment_method: "card",+ payment_method_data: {+ card: successfulNo3DSCardDetailsVisa,+ },+ currency: "USD",+ mandate_data: {+ customer_acceptance: customerAcceptance,+ mandate_type: {+ single_use: {+ amount: 0,+ currency: "USD",+ },+ },+ },+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ },+ },+ },++ ZeroAuthPaymentIntent: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: 5000,+ },+ },+ Request: {+ payment_channel: "telephone_order",+ currency: "USD",+ amount: 0,+ },+ Response: {+ status: 200,+ body: {+ status: "requires_payment_method",+ },+ },+ },++ ZeroAuthConfirmPayment: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: 5000,+ },+ },+ Request: {+ payment_channel: "telephone_order",+ payment_type: "setup_mandate",+ payment_method: "card",+ payment_method_data: {+ card: successfulNo3DSCardDetailsVisa,+ },+ mandate_data: null,+ customer_acceptance: customerAcceptance,+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ },+ },+ },+ // ── Misc ──────────────────────────────────────────────────────++ PaymentIntentWithShippingCost: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: 5000,+ },+ },+ Request: {+ payment_channel: "telephone_order",+ currency: "USD",+ shipping_cost: 50,+ },+ Response: {+ status: 200,+ body: {+ status: "requires_payment_method",+ shipping_cost: 50,+ amount: 6000,+ },+ },+ },++ PaymentConfirmWithShippingCost: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: 5000,+ },+ },+ Request: {+ payment_channel: "telephone_order",+ payment_method: "card",+ payment_method_data: {+ card: successfulNo3DSCardDetailsVisa,+ },+ customer_acceptance: null,+ setup_future_usage: "on_session",+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ payment_method: "card",+ payment_method_data: payment_method_data_visa,+ },+ },+ },++ // ══ 57-TsysTransitMandates.cy.js ══════════════════════════════+ // Everything below belongs to the tagged TSYS TransIT spec only; the+ // shared specs (04, 06, 09, 14, ...) never read these keys.+ //+ // `payment_method_data` is deliberately not asserted on the Mastercard and+ // Amex flows: the issuer metadata returned for those BINs is not stable, so+ // asserting it would fail on card bin data refreshes rather than on+ // connector regressions.++ // ── Auto capture, one card per network ────────────────────────++ No3DSAutoCaptureVisa: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: 5000,+ },+ },+ Request: {+ payment_channel: "telephone_order",+ payment_method: "card",+ payment_method_data: {+ card: successfulNo3DSCardDetailsVisa,+ },+ currency: "USD",+ customer_acceptance: null,+ setup_future_usage: "on_session",+ get merchant_order_reference_id() {+ return randomMerchantOrderReferenceId();+ },+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ payment_method: "card",+ payment_method_data: payment_method_data_visa,+ },+ },+ },++ No3DSAutoCaptureMastercard: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: 5000,+ },+ },+ Request: {+ payment_channel: "telephone_order",+ payment_method: "card",+ payment_method_data: {+ card: successfulNo3DSCardDetailsMastercard,+ },+ currency: "USD",+ customer_acceptance: null,+ setup_future_usage: "on_session",+ get merchant_order_reference_id() {+ return randomMerchantOrderReferenceId();+ },+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ payment_method: "card",+ },+ },+ },++ No3DSAutoCaptureAmex: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: 5000,+ },+ },+ Request: {+ payment_channel: "telephone_order",+ payment_method: "card",+ payment_method_data: {+ card: successfulNo3DSCardDetailsAmex,+ },+ currency: "USD",+ customer_acceptance: null,+ setup_future_usage: "on_session",+ get merchant_order_reference_id() {+ return randomMerchantOrderReferenceId();+ },+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ payment_method: "card",+ },+ },+ },++ // ── Off session CIT, one card per network ─────────────────────+ // Runs on the connector agnostic profile the spec creates. No+ // `connector_mandate_id` is returned by TSYS TransIT, the assertion on it+ // is skipped for this connector.++ SaveCardUseNo3DSAutoCaptureOffSessionVisa: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: 5000,+ },+ },+ Request: {+ payment_channel: "telephone_order",+ payment_method: "card",+ payment_method_data: {+ card: successfulNo3DSCardDetailsVisa,+ },+ currency: "USD",+ setup_future_usage: "off_session",+ customer_acceptance: customerAcceptance,+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ },+ },+ },++ SaveCardUseNo3DSAutoCaptureOffSessionMastercard: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: 5000,+ },+ },+ Request: {+ payment_channel: "telephone_order",+ payment_method: "card",+ payment_method_data: {+ card: successfulNo3DSCardDetailsMastercard,+ },+ currency: "USD",+ setup_future_usage: "off_session",+ customer_acceptance: customerAcceptance,+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ },+ },+ },++ SaveCardUseNo3DSAutoCaptureOffSessionAmex: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: 5000,+ },+ },+ Request: {+ payment_channel: "telephone_order",+ payment_method: "card",+ payment_method_data: {+ card: successfulNo3DSCardDetailsAmex,+ },+ currency: "USD",+ setup_future_usage: "off_session",+ customer_acceptance: customerAcceptance,+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ },+ },+ },++ // ── Mandate flows on the connector agnostic profile ───────────+ // The payment intents of these flows stay on the shared+ // `PaymentIntentOffSession`; only the confirms are spec owned.++ // CIT that saves the card, MIT then reuses the payment token+ MandateCitOffSession: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: 5000,+ },+ },+ Request: {+ payment_channel: "telephone_order",+ payment_method: "card",+ payment_method_data: {+ card: successfulNo3DSCardDetailsVisa,+ },+ currency: "USD",+ setup_future_usage: "off_session",+ customer_acceptance: customerAcceptance,+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ },+ },+ },++ MandateMitUsingToken: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: 5000,+ },+ },+ Request: {+ amount: 6000,+ payment_channel: "telephone_order",+ setup_future_usage: "off_session",+ payment_method_data: {+ card: successfulNo3DSCardDetailsVisa,+ },+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ },+ },+ },++ // CIT that registers the mandate, MIT then reuses the payment_method_id+ MandatePmIdCit: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: 5000,+ },+ },+ Request: {+ payment_channel: "telephone_order",+ payment_method: "card",+ payment_method_data: {+ card: successfulNo3DSCardDetailsVisa,+ },+ currency: "USD",+ mandate_data: null,+ customer_acceptance: customerAcceptance,+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ },+ },+ },++ MandatePmIdMit: {+ Configs: {+ DELAY: {+ STATUS: true,+ TIMEOUT: 5000,+ },+ },+ Request: {+ payment_channel: "telephone_order",+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ mandate_id: null,+ payment_method: "card",+ connector: "tsys_transit",+ },+ },+ },+ },+};diff --git a/cypress-tests/cypress/e2e/configs/Payment/Utils.js b/cypress-tests/cypress/e2e/configs/Payment/Utils.jsindex 5c7a01af82..34bc903509 100644--- a/cypress-tests/cypress/e2e/configs/Payment/Utils.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Utils.js@@ -84,6 +84,7 @@ import { connectorDetails as tesouroConnectorDetails } from "./Tesouro.js";import { connectorDetails as trustpayConnectorDetails } from "./Trustpay.js";import { connectorDetails as trustpaymentsConnectorDetails } from "./TrustPayments.js";import { connectorDetails as tsysConnectorDetails } from "./Tsys.js";+import { connectorDetails as tsysTransitConnectorDetails } from "./TsysTransit.js";import { connectorDetails as voltConnectorDetails } from "./Volt.js";import { connectorDetails as wellsfargoConnectorDetails } from "./WellsFargo.js";import { connectorDetails as worldpayConnectorDetails } from "./WorldPay.js";@@ -172,6 +173,7 @@ const connectorDetails = {tesouro: tesouroConnectorDetails,trustpayments: trustpaymentsConnectorDetails,tsys: tsysConnectorDetails,+ tsys_transit: tsysTransitConnectorDetails,volt: voltConnectorDetails,wellsfargo: wellsfargoConnectorDetails,worldpay: worldpayConnectorDetails,@@ -540,8 +542,12 @@ export const CONNECTOR_LISTS = {"redsys","worldpayxml","mifinity",+ "tsys_transit",],SAVE_CARD: ["helcim"],+ // Connectors that never return a `connector_mandate_id` on the payments+ // response. Recurring payments for them go through connector agnostic MIT,+ // so the "connector_mandate_id must not be null" assertion is skipped// Add more exclusion lists// Note: mitUsingPMId/mitForMandatesCallTest/listMandateCallTest use// per-config TRIGGER_SKIP or globalState checks instead of a static@@ -551,6 +557,10 @@ export const CONNECTOR_LISTS = {// Inclusion lists (only run for these connectors)INCLUDE: {MANDATES_USING_NTID_PROXY: ["cybersource", "checkout"],+ // Card and mandate flows of 54-TsysTransitMandates. The mandates need a+ // profile with connector agnostic MIT enabled, which keeps them out of the+ // shared mandate specs, so the whole spec is scoped to this connector+ CONNECTOR_AGNOSTIC_MANDATES: ["tsys_transit"],INCREMENTAL_AUTH: ["archipel",// "cybersource", // issues with MULTIPLE_CONNECTORS handlingdiff --git a/cypress-tests/cypress/e2e/spec/Payment/54-ConnectorAgnosticMandates.cy.js b/cypress-tests/cypress/e2e/spec/Payment/54-ConnectorAgnosticMandates.cy.jsnew file mode 100644index 0000000000..e343f451be--- /dev/null+++ b/cypress-tests/cypress/e2e/spec/Payment/54-ConnectorAgnosticMandates.cy.js@@ -0,0 +1,1000 @@+import * as fixtures from "../../../fixtures/imports";+import State from "../../../utils/State";+import { payment_methods_enabled } from "../../configs/Payment/Commons";+import getConnectorDetails, * as utils from "../../configs/Payment/Utils";++let globalState;+let connector;++// Original profile/MCA of the run, restored on teardown so that specs running+// after this one do not point at the profile deleted here.+let previousProfileId;+let previousMerchantConnectorId;++// Superposition context for the org level configs set by this spec. Both+// configs are org scoped (see dimension_config.rs), so they share one context+// and are written in a single PUT.+const superpositionContext = () => ({+ organization_id: globalState.get("organizationId"),+});++// `should_perform_sdk_vaulting` is an org level override on top of+// `should_call_pm_modular_service`; when false the SDK skips vaulting. It+// defaults to true, so this spec has to turn it off.+const superpositionOverrides = {+ should_call_pm_modular_service: true,+ should_perform_sdk_vaulting: false,+};++// The modular payment method service is a separate deployment addressed by+// PM_SERVICE_URL (see utils/State.js). It is not provisioned in the standard+// payments run, so the customer and saved card steps below fall back to their+// v1 equivalents when it is absent rather than failing the whole spec.+const modularPmServiceEnabled = () => Boolean(globalState.get("pmServiceUrl"));++// Customer create: /v1/customers on the modular service+const createCustomer = () => {+ if (!modularPmServiceEnabled()) {+ cy.task("cli_log", "PM_SERVICE_URL not set — using v1 customer create");+ cy.createCustomerCallTest(fixtures.customerCreateBody, globalState);+ return;+ }+ cy.customerCreateCall(globalState, fixtures.customerCreate);+};++// Saved payment method list: /v1/customers/{id}/saved-payment-methods on the+// modular service. Both commands publish `paymentMethodId`/`paymentToken` for+// the payment that follows.+const listSavedPaymentMethods = () => {+ if (!modularPmServiceEnabled()) {+ cy.task("cli_log", "PM_SERVICE_URL not set — using v1 payment method list");+ cy.listCustomerPMByClientSecret(globalState);+ return;+ }+ cy.listSavedPMCall(globalState);+};++// Payment against the saved payment method published by the preceding list.+// The modular list returns no separate token — its `id` (0a_pm_...) is what+// goes in `payment_token`, which is what `useToken: false` sends. The v1+// fallback pays with the real `paymentToken` the v1 list publishes.+const confirmWithSavedPaymentMethod = (data) => {+ if (!modularPmServiceEnabled()) {+ cy.task("cli_log", "PM_SERVICE_URL not set — using v1 save card confirm");+ cy.saveCardConfirmCallTest(+ Cypress._.cloneDeep(fixtures.saveCardConfirmBody),+ data,+ globalState+ );+ return;+ }+ // `paymentWithSavedPMCall` takes no connector config, so the config's Request+ // is merged over the fixture here — otherwise the fixture's amount (200) and+ // its missing `payment_channel` would be sent instead of the config's values+ cy.paymentWithSavedPMCall(+ globalState,+ { ...fixtures.modularPmServicePaymentsCall, ...data?.Request },+ false /* useToken — the payment method id is the token here */+ );+};++/*+TSYS TransIT.++The no 3DS card flows (Visa, Mastercard, Amex) run first, on the profile created+by 03-ConnectorCreate.++The mandate flows then run on a profile of their own: TSYS TransIT does not+return a connector mandate id, so recurring payments are only possible over a+profile with connector agnostic MIT enabled. That makes it unfit for the shared+mandate specs (14-SaveCardFlow, 20-MandatesUsingPMID), hence this spec. For the+same reason the `connector_mandate_id` assertion is skipped for this connector,+see CONNECTOR_LISTS.EXCLUDE.CONNECTOR_MANDATE_ID.++Mandate flow:+- Create a Business Profile and enable connector agnostic MIT on it+- Create a Merchant Connector Account and a Customer on that profile++- Save card [off_session]: CIT with customer_acceptance -> list payment methods+ -> MIT using the payment token++- Mandate using PMID: CIT with customer_acceptance -> MIT using payment_method_id++- Delete the Merchant Connector Account and the Business Profile+*/++describe("TSYS TransIT", () => {+ before(function () {+ let skip = false;++ cy.task("getGlobalState")+ .then((state) => {+ globalState = new State(state);+ connector = globalState.get("connectorId");++ // Only tsys_transit; every other connector is covered by the shared+ // specs+ if (+ utils.shouldIncludeConnector(+ connector,+ utils.CONNECTOR_LISTS.INCLUDE.CONNECTOR_AGNOSTIC_MANDATES+ )+ ) {+ skip = true;+ }++ previousProfileId = globalState.get("profileId");+ previousMerchantConnectorId = globalState.get("merchantConnectorId");+ })+ .then(() => {+ if (skip) {+ this.skip();+ }+ });+ });++ // Both configs are org scoped (see dimension_config.rs). The context is left+ // in place after the run rather than removed on teardown.+ before("set the org level configs", () => {+ // Without the organization dimension the overrides would apply to the whole+ // superposition workspace, so they are only set once the org id is known+ if (!globalState.get("organizationId")) {+ cy.task("cli_log", "organizationId not set — skipping org level configs");+ return;+ }++ cy.setSuperpositionConfigs(+ globalState,+ superpositionOverrides,+ superpositionContext()+ );+ });++ afterEach("flush global state", () => {+ cy.task("setGlobalState", globalState.data);+ });++ context("Card - No 3DS auto capture", () => {+ it("Create Customer", () => {+ createCustomer();+ });++ it("Visa - Create Payment Intent -> Payment Methods Call -> Confirm Payment -> Retrieve Payment", () => {+ let shouldContinue = true;++ cy.step("Create Payment Intent", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["PaymentIntent"];++ cy.createPaymentIntentTest(+ fixtures.createPaymentBody,+ data,+ "no_three_ds",+ "automatic",+ globalState+ );++ if (!utils.should_continue_further(data)) {+ shouldContinue = false;+ }+ });++ cy.step("Payment Methods Call", () => {+ if (!shouldContinue) {+ cy.task("cli_log", "Skipping step: Payment Methods Call");+ return;+ }+ cy.paymentMethodsCallTest(globalState);+ });++ cy.step("Confirm Payment", () => {+ if (!shouldContinue) {+ cy.task("cli_log", "Skipping step: Confirm Payment");+ return;+ }+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["No3DSAutoCaptureVisa"];++ cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);++ if (!utils.should_continue_further(data)) {+ shouldContinue = false;+ }+ });++ cy.step("Retrieve Payment", () => {+ if (!shouldContinue) {+ cy.task("cli_log", "Skipping step: Retrieve Payment");+ return;+ }+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["No3DSAutoCaptureVisa"];++ // The status is only checked when it is passed explicitly,+ // `retrievePaymentCallTest` does not read `data.Response`+ cy.retrievePaymentCallTest({+ globalState,+ data,+ expectedIntentStatus: "succeeded",+ });+ });+ });++ it("Mastercard - Create Payment Intent -> Payment Methods Call -> Confirm Payment -> Retrieve Payment", () => {+ let shouldContinue = true;++ cy.step("Create Payment Intent", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["PaymentIntent"];++ cy.createPaymentIntentTest(+ fixtures.createPaymentBody,+ data,+ "no_three_ds",+ "automatic",+ globalState+ );++ if (!utils.should_continue_further(data)) {+ shouldContinue = false;+ }+ });++ cy.step("Payment Methods Call", () => {+ if (!shouldContinue) {+ cy.task("cli_log", "Skipping step: Payment Methods Call");+ return;+ }+ cy.paymentMethodsCallTest(globalState);+ });++ cy.step("Confirm Payment", () => {+ if (!shouldContinue) {+ cy.task("cli_log", "Skipping step: Confirm Payment");+ return;+ }+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["No3DSAutoCaptureMastercard"];++ cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);++ if (!utils.should_continue_further(data)) {+ shouldContinue = false;+ }+ });++ cy.step("Retrieve Payment", () => {+ if (!shouldContinue) {+ cy.task("cli_log", "Skipping step: Retrieve Payment");+ return;+ }+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["No3DSAutoCaptureMastercard"];++ // The status is only checked when it is passed explicitly,+ // `retrievePaymentCallTest` does not read `data.Response`+ cy.retrievePaymentCallTest({+ globalState,+ data,+ expectedIntentStatus: "succeeded",+ });+ });+ });++ it("Amex - Create Payment Intent -> Payment Methods Call -> Confirm Payment -> Retrieve Payment", () => {+ let shouldContinue = true;++ cy.step("Create Payment Intent", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["PaymentIntent"];++ cy.createPaymentIntentTest(+ fixtures.createPaymentBody,+ data,+ "no_three_ds",+ "automatic",+ globalState+ );++ if (!utils.should_continue_further(data)) {+ shouldContinue = false;+ }+ });++ cy.step("Payment Methods Call", () => {+ if (!shouldContinue) {+ cy.task("cli_log", "Skipping step: Payment Methods Call");+ return;+ }+ cy.paymentMethodsCallTest(globalState);+ });++ cy.step("Confirm Payment", () => {+ if (!shouldContinue) {+ cy.task("cli_log", "Skipping step: Confirm Payment");+ return;+ }+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["No3DSAutoCaptureAmex"];++ cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);++ if (!utils.should_continue_further(data)) {+ shouldContinue = false;+ }+ });++ cy.step("Retrieve Payment", () => {+ if (!shouldContinue) {+ cy.task("cli_log", "Skipping step: Retrieve Payment");+ return;+ }+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["No3DSAutoCaptureAmex"];++ // The status is only checked when it is passed explicitly,+ // `retrievePaymentCallTest` does not read `data.Response`+ cy.retrievePaymentCallTest({+ globalState,+ data,+ expectedIntentStatus: "succeeded",+ });+ });+ });+ });++ context("Setup - profile with connector agnostic MIT enabled", () => {+ it("Create business profile", () => {+ utils.createBusinessProfile(+ fixtures.businessProfile.bpCreate,+ globalState+ );+ });++ it("Enable Connector Agnostic for Business Profile", () => {+ utils.updateBusinessProfile(+ fixtures.businessProfile.bpUpdate,+ true, // is_connector_agnostic_enabled+ false, // collect_billing_address_from_wallet_connector+ false, // collect_shipping_address_from_wallet_connector+ false, // always_collect_billing_address_from_wallet_connector+ false, // always_collect_shipping_address_from_wallet_connector+ globalState+ );+ });++ it("Create merchant connector account", () => {+ utils.createMerchantConnectorAccount(+ "payment_processor",+ fixtures.createConnectorBody,+ globalState,+ payment_methods_enabled+ );+ });+ });++ context("Save card off session - CIT and MIT using payment token", () => {+ let shouldContinue = true;++ beforeEach(function () {+ if (!shouldContinue) {+ this.skip();+ }+ });++ it("Create Customer", () => {+ createCustomer();+ });++ it("Create Payment Intent", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["PaymentIntentOffSession"];++ cy.createPaymentIntentTest(+ fixtures.createPaymentBody,+ data,+ "no_three_ds",+ "automatic",+ globalState+ );++ if (shouldContinue) shouldContinue = utils.should_continue_further(data);+ });++ it("Confirm No 3DS CIT", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["MandateCitOffSession"];++ cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);++ if (shouldContinue) shouldContinue = utils.should_continue_further(data);+ });++ it("Retrieve Payment after CIT", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["MandateCitOffSession"];++ cy.retrievePaymentCallTest({ globalState, data });++ if (shouldContinue) shouldContinue = utils.should_continue_further(data);+ });++ it("List Payment Method for Customer using Client Secret", () => {+ listSavedPaymentMethods();+ });++ it("Create Payment Intent for MIT", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["PaymentIntentOffSession"];++ cy.createPaymentIntentTest(+ fixtures.createPaymentBody,+ data,+ "no_three_ds",+ "automatic",+ globalState+ );++ if (shouldContinue) shouldContinue = utils.should_continue_further(data);+ });++ it("List Payment Method for Customer", () => {+ listSavedPaymentMethods();+ });++ it("Confirm No 3DS MIT (Token)", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["MandateMitUsingToken"];++ confirmWithSavedPaymentMethod(data);++ if (shouldContinue) shouldContinue = utils.should_continue_further(data);+ });++ it("Retrieve Payment after MIT", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["MandateMitUsingToken"];++ cy.retrievePaymentCallTest({ globalState, data });+ });+ });++ context("Mandate using PMID - CIT and MIT using payment_method_id", () => {+ let shouldContinue = true;++ beforeEach(function () {+ if (!shouldContinue) {+ this.skip();+ }+ });++ it("Create Customer", () => {+ createCustomer();+ });++ it("Create Payment Intent", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["PaymentIntentOffSession"];++ cy.createPaymentIntentTest(+ fixtures.createPaymentBody,+ data,+ "no_three_ds",+ "automatic",+ globalState+ );++ if (shouldContinue) shouldContinue = utils.should_continue_further(data);+ });++ it("Confirm No 3DS CIT", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["MandatePmIdCit"];++ cy.citForMandatesCallTest(+ fixtures.citConfirmBody,+ data,+ 6000,+ true,+ "automatic",+ "new_mandate",+ globalState+ );++ if (shouldContinue) shouldContinue = utils.should_continue_further(data);+ });++ it("Retrieve Payment after CIT", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["MandatePmIdCit"];++ cy.retrievePaymentCallTest({ globalState, data });++ if (shouldContinue) shouldContinue = utils.should_continue_further(data);+ });++ it("Confirm No 3DS MIT (PMID)", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["MandatePmIdMit"];++ cy.mitUsingPMId(+ fixtures.pmIdConfirmBody,+ data,+ 6000,+ true /* confirm */,+ "automatic",+ globalState,+ true /* connector_agnostic_mit */+ );++ if (shouldContinue) shouldContinue = utils.should_continue_further(data);+ });++ it("Retrieve Payment after MIT", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["MandatePmIdMit"];++ cy.retrievePaymentCallTest({ globalState, data });+ });+ });++ // Zero auth: a `setup_mandate` CIT for zero amount that only stores the+ // payment method, followed by a real MIT against it. Runs on the connector+ // agnostic profile like the other mandate contexts.+ context("Zero auth mandate - CIT with zero amount and MIT using PMID", () => {+ let shouldContinue = true;++ beforeEach(function () {+ if (!shouldContinue) {+ this.skip();+ }+ });++ it("Create Customer", () => {+ createCustomer();+ });++ it("Confirm No 3DS CIT (Zero Auth)", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["ZeroAuthConfirmPayment"];++ cy.citForMandatesCallTest(+ fixtures.citConfirmBody,+ data,+ 0 /* amount */,+ true /* confirm */,+ "automatic",+ "setup_mandate",+ globalState+ );++ if (shouldContinue) shouldContinue = utils.should_continue_further(data);+ });++ it("Retrieve Payment after CIT", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["ZeroAuthMandate"];++ cy.retrievePaymentCallTest({ globalState, data });++ if (shouldContinue) shouldContinue = utils.should_continue_further(data);+ });++ it("List Payment Method for Customer", () => {+ listSavedPaymentMethods();+ });++ it("Confirm No 3DS MIT (PMID)", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["MandatePmIdMit"];++ cy.mitUsingPMId(+ fixtures.pmIdConfirmBody,+ data,+ 6000,+ true /* confirm */,+ "automatic",+ globalState,+ true /* connector_agnostic_mit */+ );++ if (shouldContinue) shouldContinue = utils.should_continue_further(data);+ });++ it("Retrieve Payment after MIT", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["MandatePmIdMit"];++ cy.retrievePaymentCallTest({ globalState, data });+ });+ });++ // Off session CIT per card. TSYS TransIT returns no connector mandate id, so+ // the payment method is only reusable over the connector agnostic profile+ // created above — hence this runs before the teardown, not with the card+ // flows at the top of the spec.+ context("Save card off session CIT - per card", () => {+ it("Create Customer", () => {+ createCustomer();+ });++ it("Visa - Create Payment Intent -> Confirm CIT -> List Payment Methods", () => {+ let shouldContinue = true;++ cy.step("Create Payment Intent", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["PaymentIntentOffSession"];++ cy.createPaymentIntentTest(+ fixtures.createPaymentBody,+ data,+ "no_three_ds",+ "automatic",+ globalState+ );++ if (!utils.should_continue_further(data)) {+ shouldContinue = false;+ }+ });++ cy.step("Confirm CIT", () => {+ if (!shouldContinue) {+ cy.task("cli_log", "Skipping step: Confirm CIT");+ return;+ }+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["SaveCardUseNo3DSAutoCaptureOffSessionVisa"];++ cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);++ if (!utils.should_continue_further(data)) {+ shouldContinue = false;+ }+ });++ cy.step("List Payment Method for Customer", () => {+ if (!shouldContinue) {+ cy.task("cli_log", "Skipping step: List Payment Method for Customer");+ return;+ }+ listSavedPaymentMethods();+ });+ });++ it("Mastercard - Create Payment Intent -> Confirm CIT -> List Payment Methods", () => {+ let shouldContinue = true;++ cy.step("Create Payment Intent", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["PaymentIntentOffSession"];++ cy.createPaymentIntentTest(+ fixtures.createPaymentBody,+ data,+ "no_three_ds",+ "automatic",+ globalState+ );++ if (!utils.should_continue_further(data)) {+ shouldContinue = false;+ }+ });++ cy.step("Confirm CIT", () => {+ if (!shouldContinue) {+ cy.task("cli_log", "Skipping step: Confirm CIT");+ return;+ }+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["SaveCardUseNo3DSAutoCaptureOffSessionMastercard"];++ cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);++ if (!utils.should_continue_further(data)) {+ shouldContinue = false;+ }+ });++ cy.step("List Payment Method for Customer", () => {+ if (!shouldContinue) {+ cy.task("cli_log", "Skipping step: List Payment Method for Customer");+ return;+ }+ listSavedPaymentMethods();+ });+ });++ it("Amex - Create Payment Intent -> Confirm CIT -> List Payment Methods", () => {+ let shouldContinue = true;++ cy.step("Create Payment Intent", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["PaymentIntentOffSession"];++ cy.createPaymentIntentTest(+ fixtures.createPaymentBody,+ data,+ "no_three_ds",+ "automatic",+ globalState+ );++ if (!utils.should_continue_further(data)) {+ shouldContinue = false;+ }+ });++ cy.step("Confirm CIT", () => {+ if (!shouldContinue) {+ cy.task("cli_log", "Skipping step: Confirm CIT");+ return;+ }+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["SaveCardUseNo3DSAutoCaptureOffSessionAmex"];++ cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);++ if (!utils.should_continue_further(data)) {+ shouldContinue = false;+ }+ });++ cy.step("List Payment Method for Customer", () => {+ if (!shouldContinue) {+ cy.task("cli_log", "Skipping step: List Payment Method for Customer");+ return;+ }+ listSavedPaymentMethods();+ });+ });+ });++ // Three off session CITs on three different cards, one of them promoted to+ // the customer's default payment method, then a MIT paid with that card.+ context("Default card - three saved cards and MIT using PMID", () => {+ let shouldContinue = true;++ // Payment method id of the card promoted to default, captured right after+ // its own CIT so the choice does not depend on how the list is ordered.+ let defaultPaymentMethodId;++ beforeEach(function () {+ if (!shouldContinue) {+ this.skip();+ }+ });++ it("Create Customer", () => {+ createCustomer();+ });++ it("Visa - Create Payment Intent -> Confirm CIT -> List Payment Methods", () => {+ cy.step("Create Payment Intent", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["PaymentIntentOffSession"];++ cy.createPaymentIntentTest(+ fixtures.createPaymentBody,+ data,+ "no_three_ds",+ "automatic",+ globalState+ );++ if (!utils.should_continue_further(data)) {+ shouldContinue = false;+ }+ });++ cy.step("Confirm CIT", () => {+ if (!shouldContinue) {+ cy.task("cli_log", "Skipping step: Confirm CIT");+ return;+ }+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["SaveCardUseNo3DSAutoCaptureOffSessionVisa"];++ cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);++ if (!utils.should_continue_further(data)) {+ shouldContinue = false;+ }+ });++ cy.step("List Payment Method for Customer", () => {+ if (!shouldContinue) {+ cy.task("cli_log", "Skipping step: List Payment Method for Customer");+ return;+ }+ listSavedPaymentMethods();++ // This is the card set as default further down+ cy.then(() => {+ defaultPaymentMethodId = globalState.get("paymentMethodId");+ });+ });+ });++ it("Mastercard - Create Payment Intent -> Confirm CIT -> List Payment Methods", () => {+ cy.step("Create Payment Intent", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["PaymentIntentOffSession"];++ cy.createPaymentIntentTest(+ fixtures.createPaymentBody,+ data,+ "no_three_ds",+ "automatic",+ globalState+ );++ if (!utils.should_continue_further(data)) {+ shouldContinue = false;+ }+ });++ cy.step("Confirm CIT", () => {+ if (!shouldContinue) {+ cy.task("cli_log", "Skipping step: Confirm CIT");+ return;+ }+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["SaveCardUseNo3DSAutoCaptureOffSessionMastercard"];++ cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);++ if (!utils.should_continue_further(data)) {+ shouldContinue = false;+ }+ });++ cy.step("List Payment Method for Customer", () => {+ if (!shouldContinue) {+ cy.task("cli_log", "Skipping step: List Payment Method for Customer");+ return;+ }+ listSavedPaymentMethods();+ });+ });++ it("Amex - Create Payment Intent -> Confirm CIT -> List Payment Methods", () => {+ cy.step("Create Payment Intent", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["PaymentIntentOffSession"];++ cy.createPaymentIntentTest(+ fixtures.createPaymentBody,+ data,+ "no_three_ds",+ "automatic",+ globalState+ );++ if (!utils.should_continue_further(data)) {+ shouldContinue = false;+ }+ });++ cy.step("Confirm CIT", () => {+ if (!shouldContinue) {+ cy.task("cli_log", "Skipping step: Confirm CIT");+ return;+ }+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["SaveCardUseNo3DSAutoCaptureOffSessionAmex"];++ cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);++ if (!utils.should_continue_further(data)) {+ shouldContinue = false;+ }+ });++ cy.step("List Payment Method for Customer", () => {+ if (!shouldContinue) {+ cy.task("cli_log", "Skipping step: List Payment Method for Customer");+ return;+ }+ listSavedPaymentMethods();+ });+ });++ it("Set the Visa card as the default payment method", () => {+ cy.then(() => {+ expect(defaultPaymentMethodId, "captured payment method id").to.not.be+ .undefined;++ // `setDefaultPaymentMethodTest` and `mitUsingPMId` both read+ // `paymentMethodId`, which the Amex list above left pointing elsewhere+ globalState.set("paymentMethodId", defaultPaymentMethodId);++ // The three CITs were confirmed with setup_future_usage off_session,+ // but `confirmCallTest` does not record it the way+ // `citForMandatesCallTest` does, and `mitUsingPMId` reads this to tell+ // whether the connector was downgraded to on_session+ globalState.set("mandateSetupFutureUsage", "off_session");+ });++ cy.setDefaultPaymentMethodTest(globalState);+ });++ it("Confirm No 3DS MIT (PMID) using the default card", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["MandatePmIdMit"];++ cy.mitUsingPMId(+ fixtures.pmIdConfirmBody,+ data,+ 6000,+ true /* confirm */,+ "automatic",+ globalState,+ true /* connector_agnostic_mit */+ );++ if (shouldContinue) shouldContinue = utils.should_continue_further(data);+ });++ it("Retrieve Payment after MIT", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["MandatePmIdMit"];++ cy.retrievePaymentCallTest({ globalState, data });+ });+ });++ context("Teardown - delete business profile", () => {+ it("Delete merchant connector account", () => {+ cy.connectorDeleteCall(globalState);+ });++ it("Delete business profile", () => {+ cy.deleteBusinessProfileTest(globalState);+ });++ it("Restore previous profile and merchant connector account", () => {+ globalState.set("profileId", previousProfileId);+ globalState.set("merchantConnectorId", previousMerchantConnectorId);+ });+ });+});diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.jsindex abfdd2a250..c66df9b0db 100644--- a/cypress-tests/cypress/support/commands.js+++ b/cypress-tests/cypress/support/commands.js@@ -37,11 +37,6 @@ import getConnectorDetails, {import { execConfig, validateConfig } from "../utils/featureFlags";import * as RequestBodyUtils from "../utils/RequestBodyUtils";import { isoTimeTomorrow, validateEnv } from "../utils/RequestBodyUtils.js";-import {- handleQRCodeRedirection,- handleRedirection,- MICRODEPOSIT_CONFIG,-} from "./redirectionHandler";import {isMockServer,isRecordMode,@@ -52,6 +47,11 @@ import {mockReplayBankRedirect,resetMitmRedirectSeq,} from "./mitmProxy";+import {+ handleQRCodeRedirection,+ handleRedirection,+ MICRODEPOSIT_CONFIG,+} from "./redirectionHandler";// Returns true (after logging a consistent skip line) when a redirection// command should bail out early because we're in replay mode.@@ -2862,10 +2862,17 @@ Cypress.Commands.add(expect(response.body.payment_method_id, "payment_method_status").to.be.null;expect(response.body.profile_id, "profile_id").to.not.be.null;- expect(- response.body.merchant_order_reference_id,- "merchant_order_reference_id"- ).to.be.null;+ if (typeof body.merchant_order_reference_id === "undefined") {+ expect(+ response.body.merchant_order_reference_id,+ "merchant_order_reference_id"+ ).to.be.null;+ } else {+ expect(+ response.body.merchant_order_reference_id,+ "merchant_order_reference_id"+ ).to.equal(body.merchant_order_reference_id);+ }expect(response.body.connector_mandate_id, "connector_mandate_id").to.be.null;@@ -3256,7 +3263,8 @@ Cypress.Commands.add();if (response.body.setup_future_usage === "off_session" &&- response.body.status === "succeeded"+ response.body.status === "succeeded" &&+ globalState.get("connectorId") !== "tsys_transit") {expect(response.body.connector_mandate_id,@@ -3330,7 +3338,8 @@ Cypress.Commands.add();if (response.body.setup_future_usage === "off_session" &&- response.body.status === "succeeded"+ response.body.status === "succeeded" &&+ globalState.get("connectorId") !== "tsys_transit") {expect(response.body.connector_mandate_id,@@ -4951,6 +4960,7 @@ Cypress.Commands.add(response.body.mandate_id === null &&response.body.status === "succeeded" &&globalState.get("connectorId") !== "peachpayments" &&+ globalState.get("connectorId") !== "tsys_transit" &&requestBody.mandate_data !== null) {expect(@@ -5021,7 +5031,8 @@ Cypress.Commands.add(if (response.body.setup_future_usage === "off_session" &&response.body.mandate_id === null &&- response.body.status === "succeeded"+ response.body.status === "succeeded" &&+ globalState.get("connectorId") !== "tsys_transit") {expect(response.body.connector_mandate_id,@@ -8369,6 +8380,22 @@ Cypress.Commands.add("listSavedPMCall", (globalState) => {}).then((response) => {if (response.status === 200) {expect(response.body.customer_payment_methods).to.be.an("array");++ // Mirror `listCustomerPMByClientSecret`: expose the first saved payment+ // method so a following payment can be made against it. This list carries+ // no `payment_method_token` — its `id` (0a_pm_...) is what a payment+ // sends as `payment_token`. Only the session scoped list returns a+ // separate token, hence the conditional below.+ const [savedPaymentMethod] = response.body.customer_payment_methods;+ if (savedPaymentMethod) {+ globalState.set("paymentMethodId", savedPaymentMethod.id);+ if (savedPaymentMethod.payment_method_token) {+ globalState.set(+ "paymentToken",+ savedPaymentMethod.payment_method_token+ );+ }+ }} else {throw new Error(`List saved PM failed with status ${response.status}: ${JSON.stringify(response.body)}`@@ -8567,13 +8594,26 @@ Cypress.Commands.add(const customerId = globalState.get("customerId");const profileId = globalState.get("profileId");+ // `paymentMethodToken` comes from the payment method session flow, while+ // `paymentToken` is what the customer payment method list publishes; either+ // is a valid token to pay with, so accept whichever the caller produced.+ const paymentToken = useToken+ ? globalState.get("paymentMethodToken") || globalState.get("paymentToken")+ : globalState.get("paymentMethodId");++ if (!paymentToken) {+ throw new Error(+ useToken+ ? "paymentWithSavedPMCall: no payment token found. Set `paymentMethodToken` via the payment method session flow, or `paymentToken` via a customer payment method list, before calling with useToken"+ : "paymentWithSavedPMCall: no `paymentMethodId` found; call a payment method create or list first"+ );+ }+const requestBody = {...paymentData,customer_id: customerId,profile_id: profileId,- payment_token: useToken- ? globalState.get("paymentMethodToken")- : globalState.get("paymentMethodId"),+ payment_token: paymentToken,};cy.request({@@ -8588,6 +8628,8 @@ Cypress.Commands.add(}).then((response) => {if (response.status === 200) {globalState.set("paymentId", response.body.payment_id);+ // `retrievePaymentCallTest` and friends read the `paymentID` spelling+ globalState.set("paymentID", response.body.payment_id);expect(response.body).to.have.property("payment_id");expect(response.body).to.have.property("status");expect(response.body.amount).to.equal(paymentData.amount);@@ -11494,12 +11536,15 @@ Cypress.Commands.add(// Superposition Config Commands// ============================================-// Base command: PUT a superposition context override.+// Base command: PUT a superposition context carrying one or more overrides.+// `overrides` is a plain object of config key to value; a single PUT is used so+// that configs sharing a context land on one context rather than replacing each+// other, and cost one polling interval instead of several.// `context` is a plain object whose keys match the superposition dimension names// required by the target config (see dimension_config.rs for each config's dimensions).Cypress.Commands.add(- "createSuperpositionConfig",- (globalState, overrideKey, overrideValue, context) => {+ "createSuperpositionOverrides",+ (globalState, overrides, context) => {const superpositionBaseUrl = globalState.get("superpositionBaseUrl");const superpositionSecret = globalState.get("superpositionSecret");const orgId = globalState.get("superpositionOrgId") || "hyperswitch";@@ -11525,7 +11570,7 @@ Cypress.Commands.add("Content-Type": "application/json",},body: {- override: { [overrideKey]: overrideValue },+ override: overrides,context,description: "test config",change_reason: "automated test",@@ -11538,7 +11583,7 @@ Cypress.Commands.add(expect(response.status, "superposition_config_status").to.equal(200);cy.task("cli_log",- `Superposition config set: ${overrideKey}=${overrideValue}, context=${JSON.stringify(context)}`+ `Superposition config set: ${JSON.stringify(overrides)}, context=${JSON.stringify(context)}`);});});@@ -11547,6 +11592,18 @@ Cypress.Commands.add(});+// Base command: PUT a superposition context with a single override.+Cypress.Commands.add(+ "createSuperpositionConfig",+ (globalState, overrideKey, overrideValue, context) => {+ cy.createSuperpositionOverrides(+ globalState,+ { [overrideKey]: overrideValue },+ context+ );+ }+);+// Base command: DELETE a superposition context.// `context` must match the dimension context used when the override was created.Cypress.Commands.add("deleteSuperpositionContext", (globalState, context) => {@@ -11613,6 +11670,15 @@ Cypress.Commands.add(});+// Set several superposition configs that share one context, in a single PUT.+// `overrides` is a plain object of config key to value.+Cypress.Commands.add(+ "setSuperpositionConfigs",+ (globalState, overrides, context) => {+ cy.createSuperpositionOverrides(globalState, overrides, context);+ }+);+// Delete a superposition config context.// `context` must match the dimensions used when the override was created.Cypress.Commands.add("deleteSuperpositionConfig", (globalState, context) => {diff --git a/cypress-tests/cypress/utils/specSelection/config.js b/cypress-tests/cypress/utils/specSelection/config.jsindex 12671df716..9bb4d8659a 100644--- a/cypress-tests/cypress/utils/specSelection/config.js+++ b/cypress-tests/cypress/utils/specSelection/config.js@@ -58,6 +58,7 @@ export const CONNECTOR_PAYMENT_METHODS = Object.freeze({plaid: ["open_banking"],prophetpay: ["card_redirect"],volt: ["bank_redirect"],+ tsys_transit: ["card"],});/**@@ -169,6 +170,7 @@ const PAYMENT_SPEC_METHODS = Object.freeze({"54-RefundType.cy.js": ["card"],"55-DynamicFields.cy.js": ["card"],"56-VaultTokenizationDisable.cy.js": ["card"],+ "54-ConnectorAgnosticMandates.cy.js": ["card"],});/**