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

feat(payment): Add Noon connector details and update payment methods … (#10111)

Ayush Anand8267d9fda521
diff --git a/cypress-tests-v2/cypress/e2e/configs/Payment/Commons.js b/cypress-tests-v2/cypress/e2e/configs/Payment/Commons.js
index 7090f5a140..db333cbb54 100644
--- a/cypress-tests-v2/cypress/e2e/configs/Payment/Commons.js
+++ b/cypress-tests-v2/cypress/e2e/configs/Payment/Commons.js
@@ -536,7 +536,7 @@ export const connectorDetails = {
},
},
}),
-
+
PaymentIntentOffSession: getCustomExchange({
Request: {
currency: "USD",
@@ -578,7 +578,6 @@ export const connectorDetails = {
payment_method_type: "card",
payment_method_subtype: "credit",
customer_acceptance: null,
-
},
Response: {
status: 200,
diff --git a/cypress-tests-v2/cypress/e2e/configs/Payment/Noon.js b/cypress-tests-v2/cypress/e2e/configs/Payment/Noon.js
new file mode 100644
index 0000000000..b93922dc0e
--- /dev/null
+++ b/cypress-tests-v2/cypress/e2e/configs/Payment/Noon.js
@@ -0,0 +1,769 @@
+import { getCustomExchange } from "./_Reusable.js";
+
+const customerAcceptance = {
+ acceptance_type: "offline",
+ accepted_at: "1963-05-03T04:07:52.723Z",
+ online: {
+ ip_address: "127.0.0.1",
+ user_agent:
+ "Mozilla/5.0 (iPhone; CPU iPhone OS 18_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/22F76 [FBAN/FBIOS;FBAV/520.0.0.38.101;FBBV/756351453;FBDV/iPhone14,7;FBMD/iPhone;FBSN/iOS;FBSV/18.5;FBSS/3;FBID/phone;FBLC/fr_FR;FBOP/5;FBRV/760683563;IABMV/1]",
+ },
+};
+
+const successfulNo3DSCardDetails = {
+ card_number: "4000000000002701",
+ card_exp_month: "01",
+ card_exp_year: "30",
+ card_holder_name: "joseph Doe",
+ card_cvc: "123",
+};
+
+const successfulThreeDSTestCardDetails = {
+ card_number: "4000000000001091",
+ card_exp_month: "01",
+ card_exp_year: "30",
+ card_holder_name: "joseph Doe",
+ card_cvc: "123",
+};
+
+const connectorMetadata = {
+ noon: {
+ order_category: "pay",
+ },
+};
+
+const singleUseMandateData = {
+ customer_acceptance: customerAcceptance,
+ mandate_type: {
+ single_use: {
+ amount: 8000,
+ currency: "USD",
+ },
+ },
+};
+
+const multiUseMandateData = {
+ customer_acceptance: customerAcceptance,
+ mandate_type: {
+ multi_use: {
+ amount: 8000,
+ currency: "USD",
+ },
+ },
+};
+
+const payment_method_data_3ds = {
+ card: {
+ last4: "1091",
+ card_type: "CREDIT",
+ card_network: "Visa",
+ card_issuer: "INTL HDQTRS-CENTER OWNED",
+ card_issuing_country: "UNITEDSTATES",
+ card_isin: "400000",
+ card_extended_bin: null,
+ card_exp_month: "01",
+ card_exp_year: "30",
+ card_holder_name: "joseph Doe",
+ payment_checks: null,
+ authentication_data: null,
+ },
+ billing: null,
+};
+
+export const connectorDetails = {
+ card_pm: {
+ PaymentIntent: getCustomExchange({
+ Request: {
+ amount_details: {
+ order_amount: 6540,
+ currency: "AED",
+ },
+ setup_future_usage: "on_session",
+ description: "CIT payment with multi-use mandate for Noon",
+ connector_metadata: connectorMetadata,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_payment_method",
+ setup_future_usage: "on_session",
+ },
+ },
+ }),
+ PaymentIntentOffSession: {
+ Request: {
+ currency: "AED",
+ amount: 9000,
+ authentication_type: "no_three_ds",
+ customer_acceptance: null,
+ setup_future_usage: "off_session",
+ connector_metadata: connectorMetadata,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_payment_method",
+ setup_future_usage: "off_session",
+ },
+ },
+ },
+ PaymentIntentWithShippingCost: {
+ Request: {
+ currency: "AED",
+ shipping_cost: 50,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_payment_method",
+ shipping_cost: 50,
+ amount: 9000,
+ },
+ },
+ },
+ PaymentConfirmWithShippingCost: {
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ customer_acceptance: null,
+ setup_future_usage: "on_session",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_customer_action",
+ shipping_cost: 50,
+ amount: 9000,
+ },
+ },
+ },
+ "3DSManualCapture": {
+ Request: {
+ amount: 9000,
+ payment_method: "card",
+ currency: "AED",
+ payment_method_data: {
+ card: successfulThreeDSTestCardDetails,
+ },
+ customer_acceptance: null,
+ setup_future_usage: "on_session",
+ connector_metadata: connectorMetadata,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_customer_action",
+ setup_future_usage: "on_session",
+ payment_method_data: payment_method_data_3ds,
+ },
+ },
+ },
+ "3DSAutoCapture": {
+ Request: {
+ amount: 9000,
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulThreeDSTestCardDetails,
+ },
+ currency: "AED",
+ customer_acceptance: null,
+ connector_metadata: connectorMetadata,
+ setup_future_usage: "on_session",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_customer_action",
+ setup_future_usage: "on_session",
+ payment_method_data: payment_method_data_3ds,
+ },
+ },
+ },
+ No3DSManualCapture: getCustomExchange({
+ Request: {
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ payment_method_type: "card",
+ payment_method_subtype: "credit",
+ customer_acceptance: null,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_capture",
+ },
+ },
+ }),
+ No3DSAutoCapture: getCustomExchange({
+ Request: {
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ payment_method_type: "card",
+ payment_method_subtype: "credit",
+ customer_acceptance: null,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "succeeded",
+ },
+ },
+ }),
+ Capture: {
+ Request: {
+ amount_to_capture: 9000,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "succeeded",
+ amount: 9000,
+ amount_capturable: 0,
+ amount_received: 9000,
+ },
+ },
+ },
+ PartialCapture: {
+ Request: {
+ amount_to_capture: 6500,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "partially_captured",
+ amount: 9000,
+ amount_received: 6500,
+ amount_capturable: 0,
+ },
+ },
+ },
+ Void: getCustomExchange({
+ Request: {},
+ Response: {
+ status: 200,
+ body: {
+ status: "cancelled",
+ },
+ },
+ ResponseCustom: {
+ status: 400,
+ body: {
+ error: {
+ type: "invalid_request",
+ message:
+ "This Payment could not be PaymentsCancel because it has a status of requires_payment_method. The expected state is requires_capture, partially_captured_and_capturable, partially_authorized_and_requires_capture",
+ code: "IR_14",
+ },
+ },
+ },
+ }),
+ VoidAfterConfirm: getCustomExchange({
+ Request: {},
+ Response: {
+ status: 200,
+ body: {
+ status: "cancelled",
+ },
+ },
+ ResponseCustom: {
+ status: 400,
+ body: {
+ error: {
+ type: "invalid_request",
+ message:
+ "This Payment could not be PaymentsCancel because it has a status of succeeded. The expected state is requires_capture, partially_captured_and_capturable, partially_authorized_and_requires_capture",
+ code: "IR_14",
+ },
+ },
+ },
+ }),
+ Refund: {
+ Request: {
+ amount: 9000,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "succeeded",
+ },
+ },
+ },
+ manualPaymentRefund: {
+ Configs: {
+ TRIGGER_SKIP: true,
+ },
+ Request: {
+ amount: 9000,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "failed",
+ },
+ },
+ },
+ manualPaymentPartialRefund: {
+ Configs: {
+ TRIGGER_SKIP: true,
+ },
+ Request: {
+ amount: 6500,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "failed",
+ },
+ },
+ },
+ PartialRefund: {
+ Request: {
+ amount: 4500,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "succeeded",
+ },
+ },
+ },
+ SyncRefund: {
+ Response: {
+ status: 200,
+ body: {
+ status: "succeeded",
+ },
+ },
+ },
+ MandateSingleUse3DSAutoCapture: {
+ Configs: {
+ TRIGGER_SKIP: true,
+ },
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulThreeDSTestCardDetails,
+ },
+ connector_metadata: connectorMetadata,
+ mandate_data: singleUseMandateData,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_customer_action",
+ },
+ },
+ },
+ MandateSingleUse3DSManualCapture: {
+ Configs: {
+ TRIGGER_SKIP: true,
+ },
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulThreeDSTestCardDetails,
+ },
+ mandate_data: singleUseMandateData,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_customer_action",
+ },
+ },
+ },
+ MandateSingleUseNo3DSAutoCapture: {
+ Configs: {
+ TRIGGER_SKIP: true,
+ },
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ currency: "AED",
+ mandate_data: singleUseMandateData,
+ connector_metadata: connectorMetadata,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_customer_action",
+ },
+ },
+ },
+ MandateSingleUseNo3DSManualCapture: {
+ Configs: {
+ TRIGGER_SKIP: true,
+ },
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ currency: "AED",
+ mandate_data: singleUseMandateData,
+ connector_metadata: connectorMetadata,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_customer_action",
+ },
+ },
+ },
+ MandateMultiUseNo3DSAutoCapture: {
+ Configs: {
+ TRIGGER_SKIP: true,
+ },
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ currency: "AED",
+ mandate_data: multiUseMandateData,
+ connector_metadata: connectorMetadata,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_customer_action",
+ },
+ },
+ },
+ MandateMultiUseNo3DSManualCapture: {
+ Configs: {
+ TRIGGER_SKIP: true,
+ },
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ currency: "AED",
+ mandate_data: multiUseMandateData,
+ connector_metadata: connectorMetadata,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_customer_action",
+ },
+ },
+ },
+ MandateMultiUse3DSAutoCapture: {
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulThreeDSTestCardDetails,
+ },
+ mandate_data: multiUseMandateData,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_capture",
+ },
+ },
+ },
+ MandateMultiUse3DSManualCapture: {
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulThreeDSTestCardDetails,
+ },
+ mandate_data: multiUseMandateData,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_capture",
+ },
+ },
+ },
+ MITAutoCapture: {
+ Request: {},
+ Response: {
+ status: 200,
+ body: {
+ status: "succeeded",
+ },
+ },
+ },
+ MITManualCapture: {
+ Request: {},
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_capture",
+ },
+ },
+ },
+ ZeroAuthMandate: {
+ Response: {
+ status: 501,
+ body: {
+ error: {
+ type: "invalid_request",
+ message: "Setup Mandate flow for Noon is not implemented",
+ code: "IR_00",
+ },
+ },
+ },
+ },
+ ZeroAuthPaymentIntent: {
+ Request: {
+ amount: 0,
+ setup_future_usage: "off_session",
+ currency: "AED",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_payment_method",
+ setup_future_usage: "off_session",
+ },
+ },
+ },
+ ZeroAuthConfirmPayment: {
+ Request: {
+ payment_type: "setup_mandate",
+ payment_method: "card",
+ payment_method_type: "credit",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ },
+ Response: {
+ status: 501,
+ body: {
+ error: {
+ type: "invalid_request",
+ message: "Setup Mandate flow for Noon is not implemented",
+ code: "IR_00",
+ },
+ },
+ },
+ },
+ SaveCardUseNo3DSAutoCapture: {
+ Configs: {
+ TRIGGER_SKIP: true,
+ },
+ Request: {
+ payment_method: "card",
+ payment_method_type: "debit",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ currency: "AED",
+ setup_future_usage: "on_session",
+ customer_acceptance: customerAcceptance,
+ connector_metadata: connectorMetadata,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_customer_action",
+ },
+ },
+ },
+ SaveCardUseNo3DSAutoCaptureOffSession: {
+ Configs: {
+ TRIGGER_SKIP: true,
+ },
+ Request: {
+ payment_method: "card",
+ payment_method_type: "debit",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ currency: "AED",
+ connector_metadata: connectorMetadata,
+ setup_future_usage: "off_session",
+ customer_acceptance: customerAcceptance,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_customer_action",
+ },
+ },
+ },
+ SaveCardUse3DSAutoCaptureOffSession: {
+ Configs: {
+ TRIGGER_SKIP: true,
+ },
+ Request: {
+ payment_method: "card",
+ payment_method_type: "debit",
+ payment_method_data: {
+ card: successfulThreeDSTestCardDetails,
+ },
+ setup_future_usage: "off_session",
+ customer_acceptance: customerAcceptance,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_customer_action",
+ },
+ },
+ },
+ SaveCardUseNo3DSManualCaptureOffSession: {
+ Configs: {
+ TRIGGER_SKIP: true,
+ },
+ Request: {
+ payment_method: "card",
+ payment_method_type: "debit",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ setup_future_usage: "off_session",
+ customer_acceptance: customerAcceptance,
+ connector_metadata: connectorMetadata,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_customer_action",
+ },
+ },
+ },
+ SaveCardConfirmAutoCaptureOffSession: {
+ Configs: {
+ TRIGGER_SKIP: true,
+ },
+ Request: {
+ setup_future_usage: "off_session",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_customer_action",
+ },
+ },
+ },
+ SaveCardConfirmManualCaptureOffSession: {
+ Request: {
+ setup_future_usage: "off_session",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_customer_action",
+ },
+ },
+ },
+ SaveCardUseNo3DSManualCapture: {
+ Configs: {
+ TRIGGER_SKIP: true,
+ },
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ setup_future_usage: "on_session",
+ customer_acceptance: customerAcceptance,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_customer_action",
+ },
+ },
+ },
+ PaymentMethodIdMandateNo3DSAutoCapture: {
+ Configs: {
+ TRIGGER_SKIP: true,
+ },
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ currency: "AED",
+ mandate_data: null,
+ customer_acceptance: customerAcceptance,
+ connector_metadata: connectorMetadata,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_customer_action",
+ },
+ },
+ },
+ PaymentMethodIdMandateNo3DSManualCapture: {
+ Configs: {
+ TRIGGER_SKIP: true,
+ },
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ currency: "AED",
+ mandate_data: null,
+ customer_acceptance: customerAcceptance,
+ connector_metadata: connectorMetadata,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_customer_action",
+ },
+ },
+ },
+ PaymentMethodIdMandate3DSAutoCapture: {
+ Configs: {
+ TRIGGER_SKIP: true,
+ },
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulThreeDSTestCardDetails,
+ },
+ currency: "AED",
+ mandate_data: null,
+ authentication_type: "three_ds",
+ customer_acceptance: customerAcceptance,
+ connector_metadata: connectorMetadata,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_customer_action",
+ },
+ },
+ },
+ PaymentMethodIdMandate3DSManualCapture: {
+ Configs: {
+ TRIGGER_SKIP: true,
+ },
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulThreeDSTestCardDetails,
+ },
+ currency: "AED",
+ mandate_data: null,
+ authentication_type: "three_ds",
+ customer_acceptance: customerAcceptance,
+ connector_metadata: connectorMetadata,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_customer_action",
+ },
+ },
+ },
+ },
+};
diff --git a/cypress-tests-v2/cypress/e2e/configs/Payment/Utils.js b/cypress-tests-v2/cypress/e2e/configs/Payment/Utils.js
index c21a3c6a65..a8dafd1afb 100644
--- a/cypress-tests-v2/cypress/e2e/configs/Payment/Utils.js
+++ b/cypress-tests-v2/cypress/e2e/configs/Payment/Utils.js
@@ -1,7 +1,9 @@
import { connectorDetails as CommonConnectorDetails } from "./Commons.js";
+import { connectorDetails as noonConnectorDetails } from "./Noon.js";
const connectorDetails = {
commons: CommonConnectorDetails,
+ noon: noonConnectorDetails,
};
export default function getConnectorDetails(connectorId) {
@@ -49,7 +51,29 @@ export function getValueByKey(jsonObject, key) {
typeof jsonObject === "string" ? JSON.parse(jsonObject) : jsonObject;
if (data && typeof data === "object" && key in data) {
- return data[key];
+ const value = data[key];
+
+ // Check if the value has connector_account_details
+ if (value && typeof value === "object" && value.connector_account_details) {
+ return value;
+ }
+
+ // Check if it has nested structure like connector_1, connector_2
+ if (value && typeof value === "object") {
+ // Default to connector_1 if it exists
+ if (value.connector_1 && value.connector_1.connector_account_details) {
+ return value.connector_1;
+ }
+ // Fallback to first key that has connector_account_details
+ const keys = Object.keys(value);
+ for (const nestedKey of keys) {
+ if (value[nestedKey] && value[nestedKey].connector_account_details) {
+ return value[nestedKey];
+ }
+ }
+ }
+
+ return value;
} else {
return null;
}
diff --git a/cypress-tests-v2/cypress/e2e/configs/Payment/_Reusable.js b/cypress-tests-v2/cypress/e2e/configs/Payment/_Reusable.js
index d24e96cfdf..4096831b0b 100644
--- a/cypress-tests-v2/cypress/e2e/configs/Payment/_Reusable.js
+++ b/cypress-tests-v2/cypress/e2e/configs/Payment/_Reusable.js
@@ -12,6 +12,7 @@ function normalise(input) {
const exceptions = {
bankofamerica: "Bank of America",
cybersource: "Cybersource",
+ noon: "Noon",
paybox: "Paybox",
paypal: "Paypal",
wellsfargo: "Wellsfargo",
diff --git a/cypress-tests-v2/cypress/e2e/configs/Routing/Utils.js b/cypress-tests-v2/cypress/e2e/configs/Routing/Utils.js
index 49725e8498..72c30076b6 100644
--- a/cypress-tests-v2/cypress/e2e/configs/Routing/Utils.js
+++ b/cypress-tests-v2/cypress/e2e/configs/Routing/Utils.js
@@ -16,7 +16,29 @@ function getValueByKey(jsonObject, key) {
typeof jsonObject === "string" ? JSON.parse(jsonObject) : jsonObject;
if (data && typeof data === "object" && key in data) {
- return data[key];
+ const value = data[key];
+
+ // Check if the value has connector_account_details
+ if (value && typeof value === "object" && value.connector_account_details) {
+ return value;
+ }
+
+ // Check if it has nested structure like connector_1, connector_2
+ if (value && typeof value === "object") {
+ // Default to connector_1 if it exists
+ if (value.connector_1 && value.connector_1.connector_account_details) {
+ return value.connector_1;
+ }
+ // Fallback to first key that has connector_account_details
+ const keys = Object.keys(value);
+ for (const nestedKey of keys) {
+ if (value[nestedKey] && value[nestedKey].connector_account_details) {
+ return value[nestedKey];
+ }
+ }
+ }
+
+ return value;
} else {
return null;
}
diff --git a/cypress-tests-v2/cypress/e2e/spec/Payment/0001-[No3DS]Payments.cy.js b/cypress-tests-v2/cypress/e2e/spec/Payment/0001-[No3DS]Payments.cy.js
index 06afc506bc..27128c58d9 100644
--- a/cypress-tests-v2/cypress/e2e/spec/Payment/0001-[No3DS]Payments.cy.js
+++ b/cypress-tests-v2/cypress/e2e/spec/Payment/0001-[No3DS]Payments.cy.js
@@ -1,21 +1,18 @@
/*
-No 3DS Auto capture with Confirm True
-No 3DS Auto capture with Confirm False
-No 3DS Manual capture with Confirm True
-No 3DS Manual capture with Confirm False
-No 3DS Manual multiple capture with Confirm True
-No 3DS Manual multiple capture with Confirm False
+V2 No 3DS Payment Tests
+Test scenarios:
+1. No 3DS Auto capture payment flow
*/
-import * as fixtures from "../../../fixtures/imports";
import State from "../../../utils/State";
-import getConnectorDetails from "../../configs/Payment/Utils";
+import getConnectorDetails, {
+ should_continue_further,
+} from "../../configs/Payment/Utils";
let globalState;
-// Below is an example of a test that is skipped just because it is not implemented yet
describe("[Payment] [No 3DS] [Payment Method: Card]", () => {
- context("[Payment] [No 3DS] [Capture: Automatic] [Confirm: True]", () => {
+ context("[Payment] [No 3DS] [Capture: Automatic]", () => {
let should_continue = true;
before("seed global state", () => {
@@ -23,62 +20,7 @@ describe("[Payment] [No 3DS] [Payment Method: Card]", () => {
globalState = new State(state);
});
});
- beforeEach(function () {
- if (!should_continue) {
- this.skip();
- }
- });
- after("flush global state", () => {
- cy.task("setGlobalState", globalState.data);
- });
-
- it.skip("Create payment intent", () => {
- let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
- "PaymentIntent"
- ];
- let req_data = data["Request"];
- let res_data = data["Response"];
- cy.paymentIntentCreateCall(
- globalState,
- fixtures.createPaymentBody,
- res_data,
- "no_three_ds",
- "automatic"
- );
- });
-
- it.skip("List payment methods", () => {
- cy.paymentMethodsListCall(globalState);
- });
-
- it.skip("Confirm payment intent", () => {
- let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
- "No3DSAutoCapture"
- ];
- let req_data = data["Request"];
- let res_data = data["Response"];
- cy.paymentConfirmCall(
- fixtures.confirmBody,
- req_data,
- res_data,
- true,
- globalState
- );
- });
-
- it.skip("Retrieve payment intent", () => {
- cy.paymentIntentRetrieveCall(globalState);
- });
- });
- context("[Payment] [No 3DS] [Capture: Automatic] [Confirm: False]", () => {
- let should_continue = true;
-
- before("seed global state", () => {
- cy.task("getGlobalState").then((state) => {
- globalState = new State(state);
- });
- });
beforeEach(function () {
if (!should_continue) {
this.skip();
@@ -89,42 +31,33 @@ describe("[Payment] [No 3DS] [Payment Method: Card]", () => {
cy.task("setGlobalState", globalState.data);
});
- it.skip("Create Payment Intent", () => {
- let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
- "PaymentIntent"
- ];
- let req_data = data["Request"];
- let res_data = data["Response"];
+ it("Create payment intent", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["PaymentIntent"];
+ const req_data = data["Request"];
+ const res_data = data["Response"];
+
cy.paymentIntentCreateCall(
globalState,
- fixtures.createPaymentBody,
+ req_data,
res_data,
"no_three_ds",
"automatic"
);
- });
- it.skip("Payment Methods", () => {
- cy.paymentMethodsCallTest(globalState);
+ if (should_continue) should_continue = should_continue_further(data);
});
- it.skip("Confirm No 3DS", () => {
- let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
- "No3DSAutoCapture"
- ];
- let req_data = data["Request"];
- let res_data = data["Response"];
- cy.paymentConfirmCall(
- fixtures.confirmBody,
- req_data,
- res_data,
- true,
- globalState
- );
- });
+ it("Confirm payment intent", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["No3DSAutoCapture"];
+ const req_data = data["Request"];
+
+ cy.paymentConfirmCall(globalState, req_data, data);
- it.skip("Retrieve payment intent", () => {
- cy.paymentIntentRetrieveCall(globalState);
+ if (should_continue) should_continue = should_continue_further(data);
});
});
});
diff --git a/cypress-tests-v2/cypress/e2e/spec/Payment/0003-VoidPayments.cy.js b/cypress-tests-v2/cypress/e2e/spec/Payment/0003-VoidPayments.cy.js
index 76fb97d964..9ddad93568 100644
--- a/cypress-tests-v2/cypress/e2e/spec/Payment/0003-VoidPayments.cy.js
+++ b/cypress-tests-v2/cypress/e2e/spec/Payment/0003-VoidPayments.cy.js
@@ -124,11 +124,7 @@ describe("[Payment] [Void/Cancel] [Payment Method: Card]", () => {
Response: data.ResponseCustom,
};
- cy.paymentVoidCall(
- globalState,
- fixtures.void_payment_body,
- void_data
- );
+ cy.paymentVoidCall(globalState, fixtures.void_payment_body, void_data);
if (should_continue) should_continue = should_continue_further(data);
});
@@ -195,11 +191,7 @@ describe("[Payment] [Void/Cancel] [Payment Method: Card]", () => {
Response: data.ResponseCustom,
};
- cy.paymentVoidCall(
- globalState,
- fixtures.void_payment_body,
- void_data
- );
+ cy.paymentVoidCall(globalState, fixtures.void_payment_body, void_data);
if (should_continue) should_continue = should_continue_further(data);
});
diff --git a/cypress-tests-v2/cypress/support/commands.js b/cypress-tests-v2/cypress/support/commands.js
index 7afa35152c..55c7a41679 100644
--- a/cypress-tests-v2/cypress/support/commands.js
+++ b/cypress-tests-v2/cypress/support/commands.js
@@ -609,42 +609,61 @@ Cypress.Commands.add(
mcaUpdateBody.connector_type = connectorType;
mcaUpdateBody.payment_methods_enabled = paymentMethodsEnabled;
- cy.request({
- method: "PUT",
- url: url,
- headers: {
- "Content-Type": "application/json",
- Authorization: `admin-api-key=${api_key}`,
- ...customHeaders,
- },
- body: mcaUpdateBody,
- failOnStatusCode: false,
- }).then((response) => {
- logRequestId(response.headers["x-request-id"]);
+ // Read connector auth file and merge metadata
+ cy.readFile(globalState.get("connectorAuthFilePath")).then(
+ (jsonContent) => {
+ const jsonString = JSON.stringify(jsonContent);
+ const key =
+ connectorType === "payment_processor"
+ ? connectorName
+ : `${connectorName}_payout`;
+ const authDetails = getValueByKey(jsonString, key);
- if (response.status === 200) {
- expect(response.body.connector_name).to.equal(connectorName);
- expect(response.body.id).to.include("mca_").and.to.not.be.empty;
- expect(response.body.status).to.equal("active");
- expect(response.body.profile_id).to.equal(profile_id);
- expect(
- response.body.connector_webhook_details.merchant_secret
- ).to.equal(mcaUpdateBody.connector_webhook_details.merchant_secret);
-
- if (
- merchant_connector_id === undefined ||
- merchant_connector_id === null
- ) {
- globalState.set("merchantConnectorId", response.body.id);
- cy.task("setGlobalState", globalState.data);
+ if (authDetails && authDetails.metadata) {
+ mcaUpdateBody.metadata = {
+ ...mcaUpdateBody.metadata,
+ ...authDetails.metadata,
+ };
}
- } else {
- // to be updated
- throw new Error(
- `Merchant connector account update call failed with status ${response.status} and message: "${response.body.error.message}"`
- );
+
+ cy.request({
+ method: "PUT",
+ url: url,
+ headers: {
+ "Content-Type": "application/json",
+ Authorization: `admin-api-key=${api_key}`,
+ ...customHeaders,
+ },
+ body: mcaUpdateBody,
+ failOnStatusCode: false,
+ }).then((response) => {
+ logRequestId(response.headers["x-request-id"]);
+
+ if (response.status === 200) {
+ expect(response.body.connector_name).to.equal(connectorName);
+ expect(response.body.id).to.include("mca_").and.to.not.be.empty;
+ expect(response.body.status).to.equal("active");
+ expect(response.body.profile_id).to.equal(profile_id);
+ expect(
+ response.body.connector_webhook_details.merchant_secret
+ ).to.equal(mcaUpdateBody.connector_webhook_details.merchant_secret);
+
+ if (
+ merchant_connector_id === undefined ||
+ merchant_connector_id === null
+ ) {
+ globalState.set("merchantConnectorId", response.body.id);
+ cy.task("setGlobalState", globalState.data);
+ }
+ } else {
+ // to be updated
+ throw new Error(
+ `Merchant connector account update call failed with status ${response.status} and message: "${response.body.error.message}"`
+ );
+ }
+ });
}
- });
+ );
}
);