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
fix(cypress): correct ilixium connector test fixtures and add offer_engine override mechanism (#14707)
HS-QUALIBOT6b33bc7bc48b
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Commons.js b/cypress-tests/cypress/e2e/configs/Payment/Commons.jsindex 996d445656..07850b11c0 100644--- a/cypress-tests/cypress/e2e/configs/Payment/Commons.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Commons.js@@ -5980,3 +5980,15 @@ export const connectorDetails = {}),},};++// Separate keys, not a reuse of ConfirmWithOfferApplied/+// AppliedOfferOnRetrieve in place, so that connectors which can't actually+// complete a saved-card confirm (e.g. ilixium, which doesn't implement+// repeat_payment) can override just these keys via getConnectorDetails()+// without disturbing the plain-card case, which still passes for them.+// Default to the exact same expectation as the plain-card case for every+// other connector.+connectorDetails.offer_engine.ConfirmWithOfferAppliedSavedCard =+ connectorDetails.offer_engine.ConfirmWithOfferApplied;+connectorDetails.offer_engine.AppliedOfferOnRetrieveSavedCard =+ connectorDetails.offer_engine.AppliedOfferOnRetrieve;diff --git a/cypress-tests/cypress/e2e/configs/Payment/Ilixium.js b/cypress-tests/cypress/e2e/configs/Payment/Ilixium.jsindex 241c106b92..15de844092 100644--- a/cypress-tests/cypress/e2e/configs/Payment/Ilixium.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Ilixium.js@@ -1,4 +1,8 @@import { getCustomExchange } from "./Modifiers";+import {+ connectorDetails as commonsConnectorDetails,+ OFFER_QUOTE_ID_PLACEHOLDER,+} from "./Commons";const verifiedCardDetails = {card_number: "9000100111111117",@@ -16,8 +20,14 @@ const threeDsCardDetails = {card_cvc: "111",};-const ilixiumMetadata = {- ilixium_date_of_birth: "01011990",+// Ilixium requires the customer's date of birth (schema-mandatory on+// accounts that enforce it; omitting it gets rejected with `VA8`). The+// connector reads it from the standard top-level `customer.date_of_birth`+// request field, NOT from connector-specific `metadata` -- it previously+// lived under `metadata.ilixium_date_of_birth`, which the connector never+// reads, so every request silently omitted the DOB and got rejected.+const ilixiumCustomer = {+ date_of_birth: "1990-01-01",};export const connectorDetails = {@@ -51,7 +61,7 @@ export const connectorDetails = {},currency: "USD",customer_acceptance: null,- metadata: ilixiumMetadata,+ customer: ilixiumCustomer,},Response: {status: 200,@@ -71,7 +81,7 @@ export const connectorDetails = {currency: "USD",customer_acceptance: null,authentication_type: "three_ds",- metadata: ilixiumMetadata,+ customer: ilixiumCustomer,},Response: {status: 200,@@ -91,7 +101,7 @@ export const connectorDetails = {currency: "USD",customer_acceptance: null,authentication_type: "three_ds",- metadata: ilixiumMetadata,+ customer: ilixiumCustomer,},Response: {status: 200,@@ -111,7 +121,7 @@ export const connectorDetails = {},currency: "USD",customer_acceptance: null,- metadata: ilixiumMetadata,+ customer: ilixiumCustomer,},// Creds we currently have only supports manual capture. Therefore mapped error code for auto capture.Response: {@@ -130,7 +140,7 @@ export const connectorDetails = {card: verifiedCardDetails,},customer_acceptance: null,- metadata: ilixiumMetadata,+ customer: ilixiumCustomer,},Response: {status: 200,@@ -186,7 +196,7 @@ export const connectorDetails = {},currency: "USD",customer_acceptance: null,- metadata: ilixiumMetadata,+ customer: ilixiumCustomer,},Response: {status: 200,@@ -205,7 +215,7 @@ export const connectorDetails = {},currency: "USD",setup_future_usage: "on_session",- metadata: ilixiumMetadata,+ customer: ilixiumCustomer,},Response: {status: 200,@@ -223,7 +233,7 @@ export const connectorDetails = {card: verifiedCardDetails,},setup_future_usage: "off_session",- metadata: ilixiumMetadata,+ customer: ilixiumCustomer,},Response: {status: 200,@@ -241,7 +251,7 @@ export const connectorDetails = {card: threeDsCardDetails,},setup_future_usage: "off_session",- metadata: ilixiumMetadata,+ customer: ilixiumCustomer,},Response: {status: 200,@@ -260,7 +270,7 @@ export const connectorDetails = {},currency: "USD",setup_future_usage: "on_session",- metadata: ilixiumMetadata,+ customer: ilixiumCustomer,},Response: {status: 200,@@ -283,7 +293,7 @@ export const connectorDetails = {},amount: 1000,setup_future_usage: "off_session",- metadata: ilixiumMetadata,+ customer: ilixiumCustomer,},Response: {status: 200,@@ -303,12 +313,13 @@ export const connectorDetails = {setup_future_usage: "off_session",},Response: {- status: 400,+ status: 501,body: {error: {message:- "No eligible connector was found for the current payment method configuration",+ "This feature is not implemented: repeat_payment flow for ilixium is not implemented",type: "invalid_request",+ code: "IR_00",},},},@@ -352,7 +363,7 @@ export const connectorDetails = {},currency: "USD",mandate_data: null,- metadata: ilixiumMetadata,+ customer: ilixiumCustomer,},Response: {status: 200,@@ -375,7 +386,7 @@ export const connectorDetails = {},currency: "USD",mandate_data: null,- metadata: ilixiumMetadata,+ customer: ilixiumCustomer,},}),PaymentMethodIdMandate3DSAutoCapture: getCustomExchange({@@ -387,7 +398,7 @@ export const connectorDetails = {},currency: "USD",mandate_data: null,- metadata: ilixiumMetadata,+ customer: ilixiumCustomer,},Response: {status: 200,@@ -410,7 +421,100 @@ export const connectorDetails = {},currency: "USD",mandate_data: null,- metadata: ilixiumMetadata,+ customer: ilixiumCustomer,+ },+ }),+ },+ // ilixium doesn't implement repeat_payment (see+ // SaveCardConfirmManualCaptureOffSession above), so a saved-card confirm+ // can never succeed here -- override just these two offer_engine keys+ // (merged in via getConnectorDetails()) so the Offer Engine suite's+ // saved-card scenario expects that failure instead of the generic+ // success shared by every other connector.+ offer_engine: {+ // Same as Commons.js's default, just with the DOB ilixium requires added+ // onto the Request.+ OfferEligibilityCheck: {+ ...commonsConnectorDetails.offer_engine.OfferEligibilityCheck,+ Request: {+ ...commonsConnectorDetails.offer_engine.OfferEligibilityCheck.Request,+ customer: ilixiumCustomer,+ },+ },+ // Same pre-existing limitation as card_pm.No3DSAutoCapture above: our+ // creds only support manual capture, so any auto-capture confirm --+ // offer-engine or not -- comes back 200 with this mapped error instead+ // of actually succeeding.+ ConfirmWithOfferApplied: {+ ...commonsConnectorDetails.offer_engine.ConfirmWithOfferApplied,+ Request: {+ ...commonsConnectorDetails.offer_engine.ConfirmWithOfferApplied.Request,+ customer: ilixiumCustomer,+ },+ Response: {+ status: 200,+ body: {+ status: "failed",+ error_message: "4",+ error_code: "4",+ },+ },+ },+ AppliedOfferOnRetrieve: getCustomExchange({+ Request: {},+ Response: {+ status: 200,+ body: {+ status: "failed",+ },+ },+ }),+ ConfirmWithoutOffer: {+ ...commonsConnectorDetails.offer_engine.ConfirmWithoutOffer,+ Request: {+ ...commonsConnectorDetails.offer_engine.ConfirmWithoutOffer.Request,+ customer: ilixiumCustomer,+ },+ Response: {+ status: 200,+ body: {+ status: "failed",+ error_message: "4",+ error_code: "4",+ },+ },+ },+ // The "save a card" step earlier in this scenario (card_pm.+ // SaveCardUseNo3DSAutoCapture) itself fails for ilixium (pre-existing+ // auto-capture limitation, see that fixture above) -- no payment_token+ // ever gets saved, so this confirm reaches hyperswitch core with no+ // saved payment method and no raw card data, and core itself (not the+ // connector) rejects it before ever reaching ilixium.+ ConfirmWithOfferAppliedSavedCard: getCustomExchange({+ Request: {+ offer_details: {+ offer_quote_ids: [OFFER_QUOTE_ID_PLACEHOLDER],+ },+ },+ Response: {+ status: 400,+ body: {+ error: {+ message: "Missing required param: payment_method_data",+ },+ },+ },+ }),+ AppliedOfferOnRetrieveSavedCard: getCustomExchange({+ Configs: {+ skipBillingAssertion: true,+ },+ Request: {},+ Response: {+ status: 200,+ body: {+ status: "requires_payment_method",+ },},}),},diff --git a/cypress-tests/cypress/e2e/spec/Payment/54-OfferEngine.cy.js b/cypress-tests/cypress/e2e/spec/Payment/54-OfferEngine.cy.jsindex 150f5d97f8..9f7d25d82f 100644--- a/cypress-tests/cypress/e2e/spec/Payment/54-OfferEngine.cy.js+++ b/cypress-tests/cypress/e2e/spec/Payment/54-OfferEngine.cy.js@@ -89,25 +89,33 @@ describe("Offer Engine", () => {globalState.set("offerQuoteId", undefined);cy.paymentsOfferEligibilityCheck(fixtures.eligibilityCheckBody,- connectorDetails.offer_engine.OfferEligibilityCheck,+ getConnectorDetails(globalState.get("connectorId")).offer_engine+ .OfferEligibilityCheck,globalState);});it("confirm call applies the selected offer", () => {+ const offerEngineDetails = getConnectorDetails(+ globalState.get("connectorId")+ ).offer_engine;cy.confirmCallTest(fixtures.confirmBody,- connectorDetails.offer_engine.ConfirmWithOfferApplied,+ offerEngineDetails.ConfirmWithOfferApplied,true,globalState);});it("applied_offer is reflected on payment retrieve", () => {+ const offerEngineDetails = getConnectorDetails(+ globalState.get("connectorId")+ ).offer_engine;cy.retrievePaymentCallTest({globalState,- data: connectorDetails.offer_engine.AppliedOfferOnRetrieve,- expectedIntentStatus: "succeeded",+ data: offerEngineDetails.AppliedOfferOnRetrieve,+ expectedIntentStatus:+ offerEngineDetails.AppliedOfferOnRetrieve.Response.body.status,});});});@@ -124,9 +132,12 @@ describe("Offer Engine", () => {});it("confirm call without offer_details leaves applied_offer null", () => {+ const offerEngineDetails = getConnectorDetails(+ globalState.get("connectorId")+ ).offer_engine;cy.confirmCallTest(fixtures.confirmBody,- connectorDetails.offer_engine.ConfirmWithoutOffer,+ offerEngineDetails.ConfirmWithoutOffer,true,globalState);@@ -206,25 +217,38 @@ describe("Offer Engine", () => {globalState.set("offerQuoteId", undefined);cy.paymentsOfferEligibilityCheck(fixtures.eligibilityCheckBody,- connectorDetails.offer_engine.OfferEligibilityCheck,+ getConnectorDetails(globalState.get("connectorId")).offer_engine+ .OfferEligibilityCheck,globalState);});it("saved-card confirm call applies the selected offer", () => {const saveCardBody = Cypress._.cloneDeep(fixtures.saveCardConfirmBody);+ // Routed through getConnectorDetails() merge (unlike the plain-card+ // flow above, which uses the shared Commons default directly) so+ // connectors that can't complete a saved-card confirm at all (e.g.+ // ilixium -- no repeat_payment support) can override just this key.+ const offerEngineDetails = getConnectorDetails(+ globalState.get("connectorId")+ ).offer_engine;cy.saveCardConfirmCallTest(saveCardBody,- connectorDetails.offer_engine.ConfirmWithOfferApplied,+ offerEngineDetails.ConfirmWithOfferAppliedSavedCard,globalState);});it("applied_offer is reflected on payment retrieve", () => {+ const offerEngineDetails = getConnectorDetails(+ globalState.get("connectorId")+ ).offer_engine;+ const savedCardRetrieve =+ offerEngineDetails.AppliedOfferOnRetrieveSavedCard;cy.retrievePaymentCallTest({globalState,- data: connectorDetails.offer_engine.AppliedOfferOnRetrieve,- expectedIntentStatus: "succeeded",+ data: savedCardRetrieve,+ expectedIntentStatus: savedCardRetrieve.Response.body.status,});});});diff --git a/cypress-tests/cypress/utils/specSelection/config.js b/cypress-tests/cypress/utils/specSelection/config.jsindex 2e3d139a8f..bf5f2b5a04 100644--- a/cypress-tests/cypress/utils/specSelection/config.js+++ b/cypress-tests/cypress/utils/specSelection/config.js@@ -50,6 +50,7 @@ export const CONNECTOR_PAYMENT_METHODS = Object.freeze({givepayments: ["card"],globepay: ["wallet"],iatapay: ["bank_redirect", "real_time_payment", "upi"],+ ilixium: ["card"],inespay: ["bank_debit"],itaubank: ["bank_transfer"],klarna: ["pay_later"],