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

test(cypress): add Adyen gift card (Givex) balance check tests (#11874)

HS-QUALIBOT96b457e3b28b
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Adyen.js b/cypress-tests/cypress/e2e/configs/Payment/Adyen.js
index 9e72e34802..fad8baea00 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Adyen.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Adyen.js
@@ -1173,6 +1173,80 @@ export const connectorDetails = {
}),
},
+ gift_card_pm: {
+ GivexGiftCard: getCustomExchange({
+ Request: {
+ payment_method: "gift_card",
+ payment_method_type: "givex",
+ payment_method_data: {
+ gift_card: {
+ givex: {
+ number: "6006490000000000",
+ cvc: "737",
+ },
+ },
+ },
+ amount: 1100,
+ currency: "EUR",
+ customer_acceptance: null,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "succeeded",
+ },
+ },
+ }),
+ GivexGiftCardInsufficientBalance: getCustomExchange({
+ Request: {
+ payment_method: "gift_card",
+ payment_method_type: "givex",
+ payment_method_data: {
+ gift_card: {
+ givex: {
+ number: "6006490000000000",
+ cvc: "737",
+ },
+ },
+ },
+ amount: 14100,
+ currency: "EUR",
+ customer_acceptance: null,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "failed",
+ error_message: "Insufficient balance in the payment method",
+ },
+ },
+ }),
+ GivexGiftCardCurrencyMismatch: getCustomExchange({
+ Request: {
+ payment_method: "gift_card",
+ payment_method_type: "givex",
+ payment_method_data: {
+ gift_card: {
+ givex: {
+ number: "6006490000000000",
+ cvc: "737",
+ },
+ },
+ },
+ currency: "USD",
+ customer_acceptance: null,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "failed",
+ error_message:
+ "Payment Method currency does not match the payment currency",
+ },
+ },
+ }),
+ },
+
pm_list: {
PmListResponse: {
PmListNull: {
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Commons.js b/cypress-tests/cypress/e2e/configs/Payment/Commons.js
index 2c5967d62f..61ba067069 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Commons.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Commons.js
@@ -538,6 +538,22 @@ export const payment_methods_enabled = [
},
],
},
+ {
+ payment_method: "gift_card",
+ payment_method_types: [
+ {
+ payment_method_type: "givex",
+ payment_experience: null,
+ card_networks: null,
+ accepted_currencies: null,
+ accepted_countries: null,
+ minimum_amount: 1,
+ maximum_amount: 68607706,
+ recurring_enabled: false,
+ installment_payment_enabled: false,
+ },
+ ],
+ },
{
payment_method: "crypto",
payment_method_types: [
@@ -2784,4 +2800,54 @@ export const connectorDetails = {
Response: blockedPaymentErrorBodyForBinUnavailable,
}),
},
+ gift_card_pm: {
+ GivexGiftCard: getCustomExchange({
+ Request: {
+ payment_method: "gift_card",
+ payment_method_type: "givex",
+ payment_method_data: {
+ gift_card: {
+ givex: {
+ number: "6036280000000000000",
+ cvc: "122222",
+ },
+ },
+ },
+ currency: "EUR",
+ customer_acceptance: null,
+ },
+ }),
+ GivexGiftCardInsufficientBalance: getCustomExchange({
+ Request: {
+ payment_method: "gift_card",
+ payment_method_type: "givex",
+ payment_method_data: {
+ gift_card: {
+ givex: {
+ number: "6036280000000000000",
+ cvc: "122222",
+ },
+ },
+ },
+ currency: "EUR",
+ customer_acceptance: null,
+ },
+ }),
+ GivexGiftCardCurrencyMismatch: getCustomExchange({
+ Request: {
+ payment_method: "gift_card",
+ payment_method_type: "givex",
+ payment_method_data: {
+ gift_card: {
+ givex: {
+ number: "6036280000000000000",
+ cvc: "122222",
+ },
+ },
+ },
+ currency: "USD",
+ customer_acceptance: null,
+ },
+ }),
+ },
};
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Utils.js b/cypress-tests/cypress/e2e/configs/Payment/Utils.js
index 5fc3e4bc3b..6751de1b85 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Utils.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Utils.js
@@ -542,6 +542,7 @@ export const CONNECTOR_LISTS = {
EXTERNAL_THREE_DS: ["stripe"],
BANK_DEBIT: ["novalnet"],
PARTNER_MERCHANT_IDENTIFIER: ["adyen", "checkout"],
+ GIFT_CARD: ["adyen"],
// Add more inclusion lists
},
};
diff --git a/cypress-tests/cypress/e2e/spec/Payment/42-GiftCardPayment.cy.js b/cypress-tests/cypress/e2e/spec/Payment/42-GiftCardPayment.cy.js
new file mode 100644
index 0000000000..cbc7fcd3a2
--- /dev/null
+++ b/cypress-tests/cypress/e2e/spec/Payment/42-GiftCardPayment.cy.js
@@ -0,0 +1,161 @@
+import * as fixtures from "../../../fixtures/imports";
+import State from "../../../utils/State";
+import getConnectorDetails, {
+ CONNECTOR_LISTS,
+ shouldIncludeConnector,
+} from "../../configs/Payment/Utils";
+
+let globalState;
+let connector;
+
+describe("Gift Card Payment - Adyen Givex", () => {
+ before("seed global state", function () {
+ let skip = false;
+
+ cy.task("getGlobalState")
+ .then((state) => {
+ globalState = new State(state);
+ connector = globalState.get("connectorId");
+
+ if (
+ shouldIncludeConnector(connector, CONNECTOR_LISTS.INCLUDE.GIFT_CARD)
+ ) {
+ skip = true;
+ return;
+ }
+ })
+ .then(() => {
+ if (skip) {
+ cy.log(
+ `Skipping gift card tests for connector: ${connector} — not in GIFT_CARD inclusion list`
+ );
+ this.skip();
+ }
+ });
+ });
+
+ after("flush global state", () => {
+ cy.task("setGlobalState", globalState.data);
+ });
+
+ afterEach("flush global state", () => {
+ cy.task("setGlobalState", globalState.data);
+ });
+
+ context("Givex gift card - successful balance check", () => {
+ it("Create and Confirm Givex Gift Card Payment -> Retrieve Payment", () => {
+ let shouldContinue = true;
+
+ cy.step("Create and Confirm Givex Gift Card Payment", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "gift_card_pm"
+ ]["GivexGiftCard"];
+
+ cy.createConfirmPaymentTest(
+ fixtures.createConfirmPaymentBody,
+ data,
+ "no_three_ds",
+ "automatic",
+ globalState
+ );
+
+ if (!shouldContinue) return;
+ if (data && data.Response && data.Response.status === 501) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Retrieve Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Retrieve Payment");
+ return;
+ }
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "gift_card_pm"
+ ]["GivexGiftCard"];
+
+ cy.retrievePaymentCallTest({ globalState, data });
+ });
+ });
+ });
+
+ context("Givex gift card - insufficient balance", () => {
+ it("Create and Confirm Givex Gift Card Payment with insufficient balance -> Retrieve Payment", () => {
+ let shouldContinue = true;
+
+ cy.step(
+ "Create and Confirm Givex Gift Card Payment (Insufficient Balance)",
+ () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "gift_card_pm"
+ ]["GivexGiftCardInsufficientBalance"];
+
+ cy.createConfirmPaymentTest(
+ fixtures.createConfirmPaymentBody,
+ data,
+ "no_three_ds",
+ "automatic",
+ globalState
+ );
+
+ if (!shouldContinue) return;
+ if (data && data.Response && data.Response.status === 501) {
+ shouldContinue = false;
+ }
+ }
+ );
+
+ cy.step("Retrieve Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Retrieve Payment");
+ return;
+ }
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "gift_card_pm"
+ ]["GivexGiftCardInsufficientBalance"];
+
+ cy.retrievePaymentCallTest({ globalState, data });
+ });
+ });
+ });
+
+ context("Givex gift card - currency mismatch", () => {
+ it("Create and Confirm Givex Gift Card Payment with currency mismatch -> Retrieve Payment", () => {
+ let shouldContinue = true;
+
+ cy.step(
+ "Create and Confirm Givex Gift Card Payment (Currency Mismatch)",
+ () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "gift_card_pm"
+ ]["GivexGiftCardCurrencyMismatch"];
+
+ cy.createConfirmPaymentTest(
+ fixtures.createConfirmPaymentBody,
+ data,
+ "no_three_ds",
+ "automatic",
+ globalState
+ );
+
+ if (!shouldContinue) return;
+ if (data && data.Response && data.Response.status === 501) {
+ shouldContinue = false;
+ }
+ }
+ );
+
+ cy.step("Retrieve Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Retrieve Payment");
+ return;
+ }
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "gift_card_pm"
+ ]["GivexGiftCardCurrencyMismatch"];
+
+ cy.retrievePaymentCallTest({ globalState, data });
+ });
+ });
+ });
+});