Skip to content

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

ci(cypress): add Braintree connector configs for cypress test flows (#7266)

Arindam Sahoo0bdbeb3be2f8
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Braintree.js b/cypress-tests/cypress/e2e/configs/Payment/Braintree.js
new file mode 100644
index 0000000000..c9200fb2bc
--- /dev/null
+++ b/cypress-tests/cypress/e2e/configs/Payment/Braintree.js
@@ -0,0 +1,564 @@
+import { customerAcceptance } from "./Commons";
+
+const successfulNo3DSCardDetails = {
+ card_number: "4009348888881881",
+ card_exp_month: "10",
+ card_exp_year: "30",
+ card_holder_name: "Juspay Hyperswitch",
+ card_cvc: "737",
+};
+
+const successful3DSCardDetails = {
+ ...successfulNo3DSCardDetails,
+ card_number: "4012000077777777",
+};
+
+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 paymentMethodDataNo3DSResponse = {
+ card: {
+ last4: "1881",
+ card_type: "CREDIT",
+ card_network: "Visa",
+ card_issuer: "PT BANK HSBC INDONESIA",
+ card_issuing_country: "INDONESIA",
+ card_isin: "400934",
+ card_extended_bin: null,
+ card_exp_month: "10",
+ card_exp_year: "30",
+ card_holder_name: "Juspay Hyperswitch",
+ payment_checks: null,
+ authentication_data: null,
+ },
+ billing: null,
+};
+
+const paymentMethodData3DSResponse = {
+ card: {
+ last4: "7777",
+ 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: "10",
+ card_exp_year: "30",
+ card_holder_name: "Juspay Hyperswitch",
+ payment_checks: null,
+ authentication_data: null,
+ },
+ billing: null,
+};
+
+const unsettledTransactionRefundResponse = {
+ status: 200,
+ body: {
+ status: "failed",
+ error_message:
+ "Cannot refund or reverse unless the transaction status is SETTLING or SETTLED.",
+ },
+};
+
+export const connectorDetails = {
+ card_pm: {
+ PaymentIntent: {
+ Request: {
+ currency: "USD",
+ customer_acceptance: null,
+ setup_future_usage: "on_session",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_payment_method",
+ },
+ },
+ },
+ No3DSAutoCapture: {
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ currency: "USD",
+ customer_acceptance: null,
+ setup_future_usage: "on_session",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "succeeded",
+ payment_method_data: paymentMethodDataNo3DSResponse,
+ },
+ },
+ },
+ PaymentIntentWithShippingCost: {
+ Request: {
+ currency: "USD",
+ shipping_cost: 50,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_payment_method",
+ shipping_cost: 50,
+ },
+ },
+ },
+ PaymentConfirmWithShippingCost: {
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ customer_acceptance: null,
+ setup_future_usage: "on_session",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "succeeded",
+ shipping_cost: 50,
+ payment_method_data: paymentMethodDataNo3DSResponse,
+ },
+ },
+ },
+ "3DSAutoCapture": {
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successful3DSCardDetails,
+ },
+ currency: "USD",
+ customer_acceptance: null,
+ setup_future_usage: "on_session",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_customer_action",
+ payment_method_data: paymentMethodData3DSResponse,
+ },
+ },
+ },
+ No3DSManualCapture: {
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ currency: "USD",
+ customer_acceptance: null,
+ setup_future_usage: "on_session",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_capture",
+ payment_method_data: paymentMethodDataNo3DSResponse,
+ },
+ },
+ },
+ Capture: {
+ Request: {
+ amount_to_capture: 6000,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "succeeded",
+ amount: 6000,
+ amount_capturable: 0,
+ amount_received: 6000,
+ },
+ },
+ },
+ PartialCapture: {
+ Request: {
+ amount_to_capture: 2000,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "partially_captured",
+ amount: 6000,
+ amount_capturable: 0,
+ amount_received: 2000,
+ },
+ },
+ },
+ Refund: {
+ Request: {
+ amount: 6000,
+ },
+ Response: unsettledTransactionRefundResponse,
+ },
+ PartialRefund: {
+ Request: {
+ amount: 2000,
+ },
+ Response: unsettledTransactionRefundResponse,
+ },
+ manualPaymentRefund: {
+ Request: {
+ amount: 6000,
+ },
+ Response: unsettledTransactionRefundResponse,
+ },
+ manualPaymentPartialRefund: {
+ Request: {
+ amount: 2000,
+ },
+ Response: unsettledTransactionRefundResponse,
+ },
+ MandateMultiUseNo3DSAutoCapture: {
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ currency: "USD",
+ mandate_data: multiUseMandateData,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "succeeded",
+ payment_method_data: paymentMethodDataNo3DSResponse,
+ },
+ },
+ },
+ "3DSManualCapture": {
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successful3DSCardDetails,
+ },
+ currency: "USD",
+ customer_acceptance: null,
+ setup_future_usage: "on_session",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_customer_action",
+ payment_method_data: paymentMethodData3DSResponse,
+ },
+ },
+ },
+ MandateSingleUseNo3DSAutoCapture: {
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ currency: "USD",
+ mandate_data: singleUseMandateData,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "succeeded",
+ payment_method_data: paymentMethodDataNo3DSResponse,
+ },
+ },
+ },
+ MandateSingleUseNo3DSManualCapture: {
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ currency: "USD",
+ mandate_data: singleUseMandateData,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_capture",
+ payment_method_data: paymentMethodDataNo3DSResponse,
+ },
+ },
+ },
+ MITManualCapture: {
+ Request: {},
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_capture",
+ },
+ },
+ },
+ MandateMultiUseNo3DSManualCapture: {
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ currency: "USD",
+ mandate_data: multiUseMandateData,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_capture",
+ payment_method_data: paymentMethodDataNo3DSResponse,
+ },
+ },
+ },
+ ZeroAuthMandate: {
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ currency: "USD",
+ mandate_data: singleUseMandateData,
+ },
+ Response: {
+ status: 501,
+ body: {
+ error: {
+ code: "IR_00",
+ message: "Setup Mandate flow for Braintree is not implemented",
+ },
+ },
+ },
+ },
+ SaveCardUseNo3DSAutoCapture: {
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ currency: "USD",
+ setup_future_usage: "on_session",
+ customer_acceptance: customerAcceptance,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "succeeded",
+ },
+ },
+ },
+ SaveCardUseNo3DSManualCapture: {
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ currency: "USD",
+ setup_future_usage: "on_session",
+ customer_acceptance: customerAcceptance,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_capture",
+ payment_method_data: paymentMethodDataNo3DSResponse,
+ },
+ },
+ },
+ SaveCardUseNo3DSAutoCaptureOffSession: {
+ Request: {
+ payment_method: "card",
+ payment_method_type: "debit",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ setup_future_usage: "off_session",
+ customer_acceptance: customerAcceptance,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "succeeded",
+ payment_method_data: paymentMethodDataNo3DSResponse,
+ },
+ },
+ },
+ SaveCardConfirmAutoCaptureOffSession: {
+ Request: {
+ setup_future_usage: "off_session",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "succeeded",
+ },
+ },
+ },
+ SaveCardUseNo3DSManualCaptureOffSession: {
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ setup_future_usage: "off_session",
+ customer_acceptance: customerAcceptance,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_capture",
+ payment_method_data: paymentMethodDataNo3DSResponse,
+ },
+ },
+ },
+ SaveCardConfirmManualCaptureOffSession: {
+ Request: {
+ setup_future_usage: "off_session",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_capture",
+ },
+ },
+ },
+ ZeroAuthPaymentIntent: {
+ Request: {
+ amount: 0,
+ setup_future_usage: "off_session",
+ currency: "USD",
+ },
+ 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: {
+ code: "IR_00",
+ message: "Setup Mandate flow for Braintree is not implemented",
+ },
+ },
+ },
+ },
+ PaymentMethodIdMandate3DSManualCapture: {
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successful3DSCardDetails,
+ },
+ mandate_data: null,
+ authentication_type: "three_ds",
+ customer_acceptance: customerAcceptance,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_customer_action",
+ payment_method_data: paymentMethodData3DSResponse,
+ },
+ },
+ },
+ SaveCardUse3DSAutoCaptureOffSession: {
+ Request: {
+ payment_method: "card",
+ payment_method_type: "debit",
+ payment_method_data: {
+ card: successful3DSCardDetails,
+ },
+ setup_future_usage: "off_session",
+ customer_acceptance: customerAcceptance,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_customer_action",
+ payment_method_data: paymentMethodData3DSResponse,
+ },
+ },
+ },
+ PaymentMethodIdMandateNo3DSAutoCapture: {
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ currency: "USD",
+ mandate_data: null,
+ customer_acceptance: customerAcceptance,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "succeeded",
+ payment_method_data: paymentMethodDataNo3DSResponse,
+ },
+ },
+ },
+ PaymentMethodIdMandateNo3DSManualCapture: {
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ currency: "USD",
+ mandate_data: null,
+ customer_acceptance: customerAcceptance,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_capture",
+ payment_method_data: paymentMethodDataNo3DSResponse,
+ },
+ },
+ },
+ PaymentMethodIdMandate3DSAutoCapture: {
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: successful3DSCardDetails,
+ },
+ currency: "USD",
+ mandate_data: null,
+ authentication_type: "three_ds",
+ customer_acceptance: customerAcceptance,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_customer_action",
+ payment_method_data: paymentMethodData3DSResponse,
+ },
+ },
+ },
+ },
+};
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Utils.js b/cypress-tests/cypress/e2e/configs/Payment/Utils.js
index 8861fb3dd4..0ccf8e3a79 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Utils.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Utils.js
@@ -5,6 +5,7 @@ import { updateDefaultStatusCode } from "./Modifiers.js";
import { connectorDetails as adyenConnectorDetails } from "./Adyen.js";
import { connectorDetails as bankOfAmericaConnectorDetails } from "./BankOfAmerica.js";
import { connectorDetails as bluesnapConnectorDetails } from "./Bluesnap.js";
+import { connectorDetails as braintreeConnectorDetails } from "./Braintree.js";
import { connectorDetails as checkoutConnectorDetails } from "./Checkout.js";
import { connectorDetails as commonConnectorDetails } from "./Commons.js";
import { connectorDetails as cybersourceConnectorDetails } from "./Cybersource.js";
@@ -37,6 +38,7 @@ const connectorDetails = {
adyen: adyenConnectorDetails,
bankofamerica: bankOfAmericaConnectorDetails,
bluesnap: bluesnapConnectorDetails,
+ braintree: braintreeConnectorDetails,
checkout: checkoutConnectorDetails,
commons: commonConnectorDetails,
cybersource: cybersourceConnectorDetails,
@@ -322,7 +324,7 @@ export function updateBusinessProfile(
export const CONNECTOR_LISTS = {
// Exclusion lists (skip these connectors)
EXCLUDE: {
- CONNECTOR_AGNOSTIC_NTID: ["bankofamerica", "fiuu", "paypal"],
+ CONNECTOR_AGNOSTIC_NTID: ["bankofamerica", "braintree", "fiuu", "paypal"],
// Add more exclusion lists
},
diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.js
index 048fe78c44..5cbccb3dc4 100644
--- a/cypress-tests/cypress/support/commands.js
+++ b/cypress-tests/cypress/support/commands.js
@@ -2167,7 +2167,9 @@ Cypress.Commands.add(
}
} else if (response.body.authentication_type === "no_three_ds") {
for (const key in resData.body) {
- expect(resData.body[key]).to.equal(response.body[key]);
+ expect(resData.body[key], [key]).to.deep.equal(
+ response.body[key]
+ );
}
expect(response.body.customer_id).to.equal(
globalState.get("customerId")
@@ -2211,7 +2213,9 @@ Cypress.Commands.add(
);
} else if (response.body.authentication_type === "no_three_ds") {
for (const key in resData.body) {
- expect(resData.body[key]).to.equal(response.body[key]);
+ expect(resData.body[key], [key]).to.deep.equal(
+ response.body[key]
+ );
}
expect(response.body.customer_id).to.equal(
globalState.get("customerId")
@@ -2601,11 +2605,15 @@ Cypress.Commands.add(
);
cy.log(nextActionUrl);
for (const key in resData.body) {
- expect(resData.body[key]).to.equal(response.body[key]);
+ expect(resData.body[key], [key]).to.deep.equal(
+ response.body[key]
+ );
}
} else if (response.body.authentication_type === "no_three_ds") {
for (const key in resData.body) {
- expect(resData.body[key]).to.equal(response.body[key]);
+ expect(resData.body[key], [key]).to.deep.equal(
+ response.body[key]
+ );
if (setupFutureUsage === "off_session") {
expect(
response.body.connector_mandate_id,
@@ -2630,11 +2638,15 @@ Cypress.Commands.add(
);
cy.log(nextActionUrl);
for (const key in resData.body) {
- expect(resData.body[key]).to.equal(response.body[key]);
+ expect(resData.body[key], [key]).to.deep.equal(
+ response.body[key]
+ );
}
} else if (response.body.authentication_type === "no_three_ds") {
for (const key in resData.body) {
- expect(resData.body[key]).to.equal(response.body[key]);
+ expect(resData.body[key], [key]).to.deep.equal(
+ response.body[key]
+ );
if (setupFutureUsage === "off_session") {
expect(
response.body.connector_mandate_id,