mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 09:07:09 +08:00
ci(cypress): Add routing testcases (#5571)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -10,27 +10,18 @@ export const connectorDetails = {
|
||||
pm_list: {
|
||||
PaymentIntent: {
|
||||
RequestCurrencyUSD: {
|
||||
payment_method_data: {
|
||||
card: successfulNo3DSCardDetails,
|
||||
},
|
||||
currency: "USD",
|
||||
customer_acceptance: null,
|
||||
setup_future_usage: "off_session",
|
||||
authentication_type: "no_three_ds",
|
||||
},
|
||||
RequestCurrencyEUR: {
|
||||
payment_method_data: {
|
||||
card: successfulNo3DSCardDetails,
|
||||
},
|
||||
currency: "EUR",
|
||||
customer_acceptance: null,
|
||||
setup_future_usage: "off_session",
|
||||
authentication_type: "no_three_ds",
|
||||
},
|
||||
RequestCurrencyINR: {
|
||||
payment_method_data: {
|
||||
card: successfulNo3DSCardDetails,
|
||||
},
|
||||
currency: "INR",
|
||||
customer_acceptance: null,
|
||||
setup_future_usage: "off_session",
|
||||
|
||||
@ -54,10 +54,6 @@ export const connectorDetails = {
|
||||
card_pm: {
|
||||
PaymentIntent: {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
card: successfulNo3DSCardDetails,
|
||||
},
|
||||
currency: "USD",
|
||||
customer_acceptance: null,
|
||||
setup_future_usage: "on_session",
|
||||
|
||||
@ -52,10 +52,6 @@ export const connectorDetails = {
|
||||
card_pm: {
|
||||
PaymentIntent: {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
card: successfulNo3DSCardDetails,
|
||||
},
|
||||
currency: "USD",
|
||||
customer_acceptance: null,
|
||||
setup_future_usage: "on_session",
|
||||
|
||||
@ -18,10 +18,6 @@ export const connectorDetails = {
|
||||
card_pm: {
|
||||
PaymentIntent: {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
card: successfulNo3DSCardDetails,
|
||||
},
|
||||
currency: "USD",
|
||||
customer_acceptance: null,
|
||||
setup_future_usage: "on_session",
|
||||
|
||||
@ -52,10 +52,6 @@ export const connectorDetails = {
|
||||
card_pm: {
|
||||
PaymentIntent: {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
card: successfulNo3DSCardDetails,
|
||||
},
|
||||
currency: "USD",
|
||||
customer_acceptance: null,
|
||||
setup_future_usage: "on_session",
|
||||
|
||||
@ -10,10 +10,6 @@ export const connectorDetails = {
|
||||
card_pm: {
|
||||
PaymentIntent: {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
card: successfulNo3DSCardDetails,
|
||||
},
|
||||
currency: "USD",
|
||||
customer_acceptance: null,
|
||||
setup_future_usage: "on_session",
|
||||
|
||||
@ -18,10 +18,6 @@ export const connectorDetails = {
|
||||
card_pm: {
|
||||
PaymentIntent: {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
card: successfulNo3DSCardDetails,
|
||||
},
|
||||
currency: "USD",
|
||||
customer_acceptance: null,
|
||||
setup_future_usage: "on_session",
|
||||
|
||||
@ -20,10 +20,6 @@ export const connectorDetails = {
|
||||
card_pm: {
|
||||
PaymentIntent: {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
card: successfulNo3DSCardDetails,
|
||||
},
|
||||
currency: "USD",
|
||||
customer_acceptance: null,
|
||||
setup_future_usage: "on_session",
|
||||
|
||||
@ -54,10 +54,6 @@ export const connectorDetails = {
|
||||
card_pm: {
|
||||
PaymentIntent: {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
card: successfulNo3DSCardDetails,
|
||||
},
|
||||
currency: "USD",
|
||||
customer_acceptance: null,
|
||||
setup_future_usage: "on_session",
|
||||
|
||||
@ -37,10 +37,6 @@ export const connectorDetails = {
|
||||
card_pm: {
|
||||
PaymentIntent: getCustomExchange({
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
card: successfulNo3DSCardDetails,
|
||||
},
|
||||
currency: "USD",
|
||||
customer_acceptance: null,
|
||||
setup_future_usage: "on_session",
|
||||
|
||||
@ -1,114 +0,0 @@
|
||||
import * as fixtures from "../../fixtures/imports";
|
||||
import State from "../../utils/State";
|
||||
import * as utils from "../RoutingUtils/Utils";
|
||||
|
||||
let globalState;
|
||||
|
||||
describe("Routing Test", () => {
|
||||
let should_continue = true; // variable that will be used to skip tests if a previous test fails
|
||||
|
||||
beforeEach(function () {
|
||||
if (!should_continue) {
|
||||
this.skip();
|
||||
}
|
||||
});
|
||||
|
||||
before("seed global state", () => {
|
||||
cy.task("getGlobalState").then((state) => {
|
||||
globalState = new State(state);
|
||||
});
|
||||
});
|
||||
|
||||
afterEach("flush global state", () => {
|
||||
cy.task("setGlobalState", globalState.data);
|
||||
});
|
||||
|
||||
context("Routing with Stripe as top priority", () => {
|
||||
it("create-jwt-token", () => {
|
||||
let data = utils.getConnectorDetails("common")["jwt"];
|
||||
let req_data = data["Request"];
|
||||
let res_data = data["Response"];
|
||||
|
||||
cy.createJWTToken(req_data, res_data, globalState);
|
||||
if (should_continue)
|
||||
should_continue = utils.should_continue_further(res_data);
|
||||
});
|
||||
|
||||
it("retrieve-mca", () => {
|
||||
cy.ListMCAbyMID(globalState);
|
||||
});
|
||||
|
||||
it("api-key-create-call-test", () => {
|
||||
cy.apiKeyCreateTest(fixtures.apiKeyCreateBody, globalState);
|
||||
});
|
||||
|
||||
it("customer-create-call-test", () => {
|
||||
cy.createCustomerCallTest(fixtures.customerCreateBody, globalState);
|
||||
});
|
||||
|
||||
it("add-routing-config", () => {
|
||||
let data = utils.getConnectorDetails("common")["routing"];
|
||||
let req_data = data["Request"];
|
||||
let res_data = data["Response"];
|
||||
|
||||
let routing_data = [
|
||||
{
|
||||
connector: "stripe",
|
||||
merchant_connector_id: globalState.get("stripeMcaId"),
|
||||
},
|
||||
{
|
||||
connector: "adyen",
|
||||
merchant_connector_id: globalState.get("adyenMcaId"),
|
||||
},
|
||||
];
|
||||
cy.addRoutingConfig(
|
||||
fixtures.routingConfigBody,
|
||||
req_data,
|
||||
res_data,
|
||||
"priority",
|
||||
routing_data,
|
||||
globalState
|
||||
);
|
||||
if (should_continue)
|
||||
should_continue = utils.should_continue_further(res_data);
|
||||
});
|
||||
|
||||
it("retrieve-routing-call-test", () => {
|
||||
let data = utils.getConnectorDetails("common")["routing"];
|
||||
let req_data = data["Request"];
|
||||
let res_data = data["Response"];
|
||||
cy.retrieveRoutingConfig(req_data, res_data, globalState);
|
||||
if (should_continue)
|
||||
should_continue = utils.should_continue_further(res_data);
|
||||
});
|
||||
|
||||
it("activate-routing-call-test", () => {
|
||||
let data = utils.getConnectorDetails("common")["routing"];
|
||||
let req_data = data["Request"];
|
||||
let res_data = data["Response"];
|
||||
cy.activateRoutingConfig(req_data, res_data, globalState);
|
||||
if (should_continue)
|
||||
should_continue = utils.should_continue_further(res_data);
|
||||
});
|
||||
|
||||
it("payment-routing-test", () => {
|
||||
let data = utils.getConnectorDetails("common")["card_pm"]["Confirm"];
|
||||
let req_data = data["Request"];
|
||||
let res_data = data["Response"];
|
||||
cy.createConfirmPaymentTest(
|
||||
fixtures.createConfirmPaymentBody,
|
||||
req_data,
|
||||
res_data,
|
||||
"no_three_ds",
|
||||
"automatic",
|
||||
globalState
|
||||
);
|
||||
if (should_continue)
|
||||
should_continue = utils.should_continue_further(res_data);
|
||||
});
|
||||
|
||||
it("retrieve-payment-call-test", () => {
|
||||
cy.retrievePaymentCallTest(globalState);
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,211 @@
|
||||
import * as fixtures from "../../fixtures/imports";
|
||||
import State from "../../utils/State";
|
||||
import * as utils from "../RoutingUtils/utils";
|
||||
|
||||
let globalState;
|
||||
|
||||
describe("Priority Based Routing Test", () => {
|
||||
let should_continue = true;
|
||||
context("Create Jwt Token", () => {
|
||||
before("seed global state", () => {
|
||||
cy.task("getGlobalState").then((state) => {
|
||||
globalState = new State(state);
|
||||
});
|
||||
});
|
||||
|
||||
after("flush global state", () => {
|
||||
cy.task("setGlobalState", globalState.data);
|
||||
});
|
||||
it("create-jwt-token", () => {
|
||||
let data = utils.getConnectorDetails("common")["jwt"];
|
||||
let req_data = data["Request"];
|
||||
let res_data = data["Response"];
|
||||
|
||||
cy.createJWTToken(req_data, res_data, globalState);
|
||||
if (should_continue)
|
||||
should_continue = utils.should_continue_further(res_data);
|
||||
});
|
||||
|
||||
it("merchant retrieve call", () => {
|
||||
cy.merchantRetrieveCall(globalState);
|
||||
});
|
||||
});
|
||||
|
||||
context("Routing with Stripe as top priority", () => {
|
||||
before("seed global state", () => {
|
||||
cy.task("getGlobalState").then((state) => {
|
||||
globalState = new State(state);
|
||||
});
|
||||
});
|
||||
|
||||
after("flush global state", () => {
|
||||
cy.task("setGlobalState", globalState.data);
|
||||
});
|
||||
it("list-mca-by-mid", () => {
|
||||
cy.ListMcaByMid(globalState);
|
||||
});
|
||||
|
||||
it("api-key-create-call-test", () => {
|
||||
cy.apiKeyCreateTest(fixtures.apiKeyCreateBody, globalState);
|
||||
});
|
||||
|
||||
it("customer-create-call-test", () => {
|
||||
cy.createCustomerCallTest(fixtures.customerCreateBody, globalState);
|
||||
});
|
||||
|
||||
it("add-routing-config", () => {
|
||||
let data = utils.getConnectorDetails("common")["priorityRouting"];
|
||||
let req_data = data["Request"];
|
||||
let res_data = data["Response"];
|
||||
|
||||
let routing_data = [
|
||||
{
|
||||
connector: "stripe",
|
||||
merchant_connector_id: globalState.get("stripeMcaId"),
|
||||
},
|
||||
{
|
||||
connector: "adyen",
|
||||
merchant_connector_id: globalState.get("adyenMcaId"),
|
||||
},
|
||||
];
|
||||
cy.addRoutingConfig(
|
||||
fixtures.routingConfigBody,
|
||||
req_data,
|
||||
res_data,
|
||||
"priority",
|
||||
routing_data,
|
||||
globalState
|
||||
);
|
||||
if (should_continue)
|
||||
should_continue = utils.should_continue_further(res_data);
|
||||
});
|
||||
|
||||
it("retrieve-routing-call-test", () => {
|
||||
let data = utils.getConnectorDetails("common")["priorityRouting"];
|
||||
let req_data = data["Request"];
|
||||
let res_data = data["Response"];
|
||||
cy.retrieveRoutingConfig(req_data, res_data, globalState);
|
||||
if (should_continue)
|
||||
should_continue = utils.should_continue_further(res_data);
|
||||
});
|
||||
|
||||
it("activate-routing-call-test", () => {
|
||||
let data = utils.getConnectorDetails("common")["priorityRouting"];
|
||||
let req_data = data["Request"];
|
||||
let res_data = data["Response"];
|
||||
cy.activateRoutingConfig(req_data, res_data, globalState);
|
||||
if (should_continue)
|
||||
should_continue = utils.should_continue_further(res_data);
|
||||
});
|
||||
|
||||
it("payment-routing-test", () => {
|
||||
let data =
|
||||
utils.getConnectorDetails("stripe")["card_pm"]["No3DSAutoCapture"];
|
||||
let req_data = data["Request"];
|
||||
let res_data = data["Response"];
|
||||
cy.createConfirmPaymentTest(
|
||||
fixtures.createConfirmPaymentBody,
|
||||
req_data,
|
||||
res_data,
|
||||
"no_three_ds",
|
||||
"automatic",
|
||||
globalState
|
||||
);
|
||||
if (should_continue)
|
||||
should_continue = utils.should_continue_further(res_data);
|
||||
});
|
||||
|
||||
it("retrieve-payment-call-test", () => {
|
||||
cy.retrievePaymentCallTest(globalState);
|
||||
});
|
||||
});
|
||||
|
||||
context("Routing with adyen as top priority", () => {
|
||||
before("seed global state", () => {
|
||||
cy.task("getGlobalState").then((state) => {
|
||||
globalState = new State(state);
|
||||
});
|
||||
});
|
||||
|
||||
after("flush global state", () => {
|
||||
cy.task("setGlobalState", globalState.data);
|
||||
});
|
||||
it("list-mca-by-mid", () => {
|
||||
cy.ListMcaByMid(globalState);
|
||||
});
|
||||
|
||||
it("api-key-create-call-test", () => {
|
||||
cy.apiKeyCreateTest(fixtures.apiKeyCreateBody, globalState);
|
||||
});
|
||||
|
||||
it("customer-create-call-test", () => {
|
||||
cy.createCustomerCallTest(fixtures.customerCreateBody, globalState);
|
||||
});
|
||||
|
||||
it("add-routing-config", () => {
|
||||
let data = utils.getConnectorDetails("common")["priorityRouting"];
|
||||
let req_data = data["Request"];
|
||||
let res_data = data["Response"];
|
||||
|
||||
let routing_data = [
|
||||
{
|
||||
connector: "adyen",
|
||||
merchant_connector_id: globalState.get("adyenMcaId"),
|
||||
},
|
||||
{
|
||||
connector: "stripe",
|
||||
merchant_connector_id: globalState.get("stripeMcaId"),
|
||||
},
|
||||
];
|
||||
cy.addRoutingConfig(
|
||||
fixtures.routingConfigBody,
|
||||
req_data,
|
||||
res_data,
|
||||
"priority",
|
||||
routing_data,
|
||||
globalState
|
||||
);
|
||||
if (should_continue)
|
||||
should_continue = utils.should_continue_further(res_data);
|
||||
});
|
||||
|
||||
it("retrieve-routing-call-test", () => {
|
||||
let data = utils.getConnectorDetails("common")["priorityRouting"];
|
||||
let req_data = data["Request"];
|
||||
let res_data = data["Response"];
|
||||
cy.retrieveRoutingConfig(req_data, res_data, globalState);
|
||||
if (should_continue)
|
||||
should_continue = utils.should_continue_further(res_data);
|
||||
});
|
||||
|
||||
it("activate-routing-call-test", () => {
|
||||
let data = utils.getConnectorDetails("common")["priorityRouting"];
|
||||
let req_data = data["Request"];
|
||||
let res_data = data["Response"];
|
||||
cy.activateRoutingConfig(req_data, res_data, globalState);
|
||||
if (should_continue)
|
||||
should_continue = utils.should_continue_further(res_data);
|
||||
});
|
||||
|
||||
it("payment-routing-test", () => {
|
||||
let data =
|
||||
utils.getConnectorDetails("adyen")["card_pm"]["No3DSAutoCapture"];
|
||||
let req_data = data["Request"];
|
||||
let res_data = data["Response"];
|
||||
cy.createConfirmPaymentTest(
|
||||
fixtures.createConfirmPaymentBody,
|
||||
req_data,
|
||||
res_data,
|
||||
"no_three_ds",
|
||||
"automatic",
|
||||
globalState
|
||||
);
|
||||
if (should_continue)
|
||||
should_continue = utils.should_continue_further(res_data);
|
||||
});
|
||||
|
||||
it("retrieve-payment-call-test", () => {
|
||||
cy.retrievePaymentCallTest(globalState);
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,285 @@
|
||||
import * as fixtures from "../../fixtures/imports";
|
||||
import State from "../../utils/State";
|
||||
import * as utils from "../RoutingUtils/utils";
|
||||
|
||||
let globalState;
|
||||
|
||||
describe("Volume Based Routing Test", () => {
|
||||
let should_continue = true;
|
||||
|
||||
context("Create Jwt Token", () => {
|
||||
before("seed global state", () => {
|
||||
cy.task("getGlobalState").then((state) => {
|
||||
globalState = new State(state);
|
||||
});
|
||||
});
|
||||
|
||||
after("flush global state", () => {
|
||||
cy.task("setGlobalState", globalState.data);
|
||||
});
|
||||
it("create-jwt-token", () => {
|
||||
let data = utils.getConnectorDetails("common")["jwt"];
|
||||
let req_data = data["Request"];
|
||||
let res_data = data["Response"];
|
||||
|
||||
cy.createJWTToken(req_data, res_data, globalState);
|
||||
if (should_continue)
|
||||
should_continue = utils.should_continue_further(res_data);
|
||||
});
|
||||
|
||||
it("merchant retrieve call", () => {
|
||||
cy.merchantRetrieveCall(globalState);
|
||||
});
|
||||
});
|
||||
|
||||
context("Volume based routing with 100% of stripe", () => {
|
||||
before("seed global state", () => {
|
||||
cy.task("getGlobalState").then((state) => {
|
||||
globalState = new State(state);
|
||||
});
|
||||
});
|
||||
|
||||
afterEach("flush global state", () => {
|
||||
cy.task("setGlobalState", globalState.data);
|
||||
});
|
||||
|
||||
it("list-mca-by-mid", () => {
|
||||
cy.ListMcaByMid(globalState);
|
||||
});
|
||||
|
||||
it("api-key-create-call-test", () => {
|
||||
cy.apiKeyCreateTest(fixtures.apiKeyCreateBody, globalState);
|
||||
});
|
||||
|
||||
it("customer-create-call-test", () => {
|
||||
cy.createCustomerCallTest(fixtures.customerCreateBody, globalState);
|
||||
});
|
||||
|
||||
it("add-routing-config", () => {
|
||||
let data = utils.getConnectorDetails("common")["volumeBasedRouting"];
|
||||
let req_data = data["Request"];
|
||||
let res_data = data["Response"];
|
||||
|
||||
let routing_data = [
|
||||
{
|
||||
connector: {
|
||||
connector: "stripe",
|
||||
merchant_connector_id: globalState.get("stripeMcaId"),
|
||||
},
|
||||
split: 100,
|
||||
},
|
||||
];
|
||||
|
||||
cy.addRoutingConfig(
|
||||
fixtures.routingConfigBody,
|
||||
req_data,
|
||||
res_data,
|
||||
"volume_split",
|
||||
routing_data,
|
||||
globalState
|
||||
);
|
||||
});
|
||||
|
||||
it("retrieve-routing-call-test", () => {
|
||||
let data = utils.getConnectorDetails("common")["volumeBasedRouting"];
|
||||
let req_data = data["Request"];
|
||||
let res_data = data["Response"];
|
||||
cy.retrieveRoutingConfig(req_data, res_data, globalState);
|
||||
});
|
||||
|
||||
it("activate-routing-call-test", () => {
|
||||
let data = utils.getConnectorDetails("common")["volumeBasedRouting"];
|
||||
let req_data = data["Request"];
|
||||
let res_data = data["Response"];
|
||||
cy.activateRoutingConfig(req_data, res_data, globalState);
|
||||
});
|
||||
|
||||
it("payment-routing-test", () => {
|
||||
let data =
|
||||
utils.getConnectorDetails("stripe")["card_pm"]["No3DSAutoCapture"];
|
||||
let req_data = data["Request"];
|
||||
let res_data = data["Response"];
|
||||
cy.createConfirmPaymentTest(
|
||||
fixtures.createConfirmPaymentBody,
|
||||
req_data,
|
||||
res_data,
|
||||
"no_three_ds",
|
||||
"automatic",
|
||||
globalState
|
||||
);
|
||||
});
|
||||
|
||||
it("retrieve-payment-call-test", () => {
|
||||
cy.retrievePaymentCallTest(globalState);
|
||||
});
|
||||
|
||||
it("create-payment-call-test-for-eps", () => {
|
||||
let data =
|
||||
utils.getConnectorDetails("stripe")["bank_redirect_pm"][
|
||||
"PaymentIntent"
|
||||
];
|
||||
let req_data = data["Request"];
|
||||
let res_data = data["Response"];
|
||||
cy.createPaymentIntentTest(
|
||||
fixtures.createPaymentBody,
|
||||
req_data,
|
||||
res_data,
|
||||
"three_ds",
|
||||
"automatic",
|
||||
globalState
|
||||
);
|
||||
});
|
||||
|
||||
it("payment_methods-call-test", () => {
|
||||
cy.paymentMethodsCallTest(globalState);
|
||||
});
|
||||
|
||||
it("Confirm bank redirect", () => {
|
||||
let data = utils.getConnectorDetails("stripe")["bank_redirect_pm"]["eps"];
|
||||
let req_data = data["Request"];
|
||||
let res_data = data["Response"];
|
||||
cy.confirmBankRedirectCallTest(
|
||||
fixtures.confirmBody,
|
||||
req_data,
|
||||
res_data,
|
||||
true,
|
||||
globalState
|
||||
);
|
||||
});
|
||||
|
||||
it("Handle bank redirect redirection", () => {
|
||||
// return_url is a static url (https://hyperswitch.io) taken from confirm-body fixture and is not updated
|
||||
let expected_redirection = fixtures.confirmBody["return_url"];
|
||||
let payment_method_type = globalState.get("paymentMethodType");
|
||||
cy.handleBankRedirectRedirection(
|
||||
globalState,
|
||||
payment_method_type,
|
||||
expected_redirection
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
context("Volume based routing with 100% of adyen", () => {
|
||||
before("seed global state", () => {
|
||||
cy.task("getGlobalState").then((state) => {
|
||||
globalState = new State(state);
|
||||
});
|
||||
});
|
||||
|
||||
afterEach("flush global state", () => {
|
||||
cy.task("setGlobalState", globalState.data);
|
||||
});
|
||||
it("list-mca-by-mid", () => {
|
||||
cy.ListMcaByMid(globalState);
|
||||
});
|
||||
|
||||
it("api-key-create-call-test", () => {
|
||||
cy.apiKeyCreateTest(fixtures.apiKeyCreateBody, globalState);
|
||||
});
|
||||
|
||||
it("customer-create-call-test", () => {
|
||||
cy.createCustomerCallTest(fixtures.customerCreateBody, globalState);
|
||||
});
|
||||
|
||||
it("add-routing-config", () => {
|
||||
let data = utils.getConnectorDetails("common")["volumeBasedRouting"];
|
||||
let req_data = data["Request"];
|
||||
let res_data = data["Response"];
|
||||
|
||||
let routing_data = [
|
||||
{
|
||||
connector: {
|
||||
connector: "adyen",
|
||||
merchant_connector_id: globalState.get("adyenMcaId"),
|
||||
},
|
||||
split: 100,
|
||||
},
|
||||
];
|
||||
|
||||
cy.addRoutingConfig(
|
||||
fixtures.routingConfigBody,
|
||||
req_data,
|
||||
res_data,
|
||||
"volume_split",
|
||||
routing_data,
|
||||
globalState
|
||||
);
|
||||
});
|
||||
|
||||
it("retrieve-routing-call-test", () => {
|
||||
let data = utils.getConnectorDetails("common")["volumeBasedRouting"];
|
||||
let req_data = data["Request"];
|
||||
let res_data = data["Response"];
|
||||
cy.retrieveRoutingConfig(req_data, res_data, globalState);
|
||||
});
|
||||
|
||||
it("activate-routing-call-test", () => {
|
||||
let data = utils.getConnectorDetails("common")["volumeBasedRouting"];
|
||||
let req_data = data["Request"];
|
||||
let res_data = data["Response"];
|
||||
cy.activateRoutingConfig(req_data, res_data, globalState);
|
||||
});
|
||||
|
||||
it("payment-routing-test-for-card", () => {
|
||||
let data =
|
||||
utils.getConnectorDetails("adyen")["card_pm"]["No3DSAutoCapture"];
|
||||
let req_data = data["Request"];
|
||||
let res_data = data["Response"];
|
||||
cy.createConfirmPaymentTest(
|
||||
fixtures.createConfirmPaymentBody,
|
||||
req_data,
|
||||
res_data,
|
||||
"no_three_ds",
|
||||
"automatic",
|
||||
globalState
|
||||
);
|
||||
});
|
||||
|
||||
it("retrieve-payment-call-test", () => {
|
||||
cy.retrievePaymentCallTest(globalState);
|
||||
});
|
||||
|
||||
it("create-payment-call-test-for-eps", () => {
|
||||
let data =
|
||||
utils.getConnectorDetails("adyen")["bank_redirect_pm"]["PaymentIntent"];
|
||||
let req_data = data["Request"];
|
||||
let res_data = data["Response"];
|
||||
cy.createPaymentIntentTest(
|
||||
fixtures.createPaymentBody,
|
||||
req_data,
|
||||
res_data,
|
||||
"three_ds",
|
||||
"automatic",
|
||||
globalState
|
||||
);
|
||||
});
|
||||
|
||||
it("payment_methods-call-test", () => {
|
||||
cy.paymentMethodsCallTest(globalState);
|
||||
});
|
||||
|
||||
it("Confirm bank redirect", () => {
|
||||
let data = utils.getConnectorDetails("adyen")["bank_redirect_pm"]["eps"];
|
||||
let req_data = data["Request"];
|
||||
let res_data = data["Response"];
|
||||
cy.confirmBankRedirectCallTest(
|
||||
fixtures.confirmBody,
|
||||
req_data,
|
||||
res_data,
|
||||
true,
|
||||
globalState
|
||||
);
|
||||
});
|
||||
|
||||
it("Handle bank redirect redirection", () => {
|
||||
// return_url is a static url (https://hyperswitch.io) taken from confirm-body fixture and is not updated
|
||||
let expected_redirection = fixtures.confirmBody["return_url"];
|
||||
let payment_method_type = globalState.get("paymentMethodType");
|
||||
cy.handleBankRedirectRedirection(
|
||||
globalState,
|
||||
payment_method_type,
|
||||
expected_redirection
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,548 @@
|
||||
import * as fixtures from "../../fixtures/imports";
|
||||
import State from "../../utils/State";
|
||||
import * as utils from "../RoutingUtils/utils";
|
||||
|
||||
let globalState;
|
||||
|
||||
describe("Rule Based Routing Test", () => {
|
||||
context("Create Jwt Token", () => {
|
||||
before("seed global state", () => {
|
||||
cy.task("getGlobalState").then((state) => {
|
||||
globalState = new State(state);
|
||||
});
|
||||
});
|
||||
|
||||
after("flush global state", () => {
|
||||
cy.task("setGlobalState", globalState.data);
|
||||
});
|
||||
it("create-jwt-token", () => {
|
||||
let data = utils.getConnectorDetails("common")["jwt"];
|
||||
let req_data = data["Request"];
|
||||
let res_data = data["Response"];
|
||||
|
||||
cy.createJWTToken(req_data, res_data, globalState);
|
||||
if (should_continue)
|
||||
should_continue = utils.should_continue_further(res_data);
|
||||
});
|
||||
|
||||
it("merchant retrieve call", () => {
|
||||
cy.merchantRetrieveCall(globalState);
|
||||
});
|
||||
});
|
||||
|
||||
context("Rule based routing,Card->Stripe,Bank_redirect->adyen", () => {
|
||||
before("seed global state", () => {
|
||||
cy.task("getGlobalState").then((state) => {
|
||||
globalState = new State(state);
|
||||
});
|
||||
});
|
||||
|
||||
after("flush global state", () => {
|
||||
cy.task("setGlobalState", globalState.data);
|
||||
});
|
||||
|
||||
it("retrieve-mca", () => {
|
||||
cy.ListMcaByMid(globalState);
|
||||
});
|
||||
|
||||
it("api-key-create-call-test", () => {
|
||||
cy.apiKeyCreateTest(fixtures.apiKeyCreateBody, globalState);
|
||||
});
|
||||
|
||||
it("customer-create-call-test", () => {
|
||||
cy.createCustomerCallTest(fixtures.customerCreateBody, globalState);
|
||||
});
|
||||
|
||||
it("add-routing-config", () => {
|
||||
let data = utils.getConnectorDetails("common")["ruleBasedRouting"];
|
||||
let req_data = data["Request"];
|
||||
let res_data = data["Response"];
|
||||
|
||||
let routing_data = {
|
||||
defaultSelection: {
|
||||
type: "priority",
|
||||
data: [],
|
||||
},
|
||||
metadata: {},
|
||||
rules: [
|
||||
{
|
||||
name: "rule_1",
|
||||
connectorSelection: {
|
||||
type: "priority",
|
||||
data: [
|
||||
{
|
||||
connector: "stripe",
|
||||
merchant_connector_id: globalState.get("stripeMcaId"),
|
||||
},
|
||||
],
|
||||
},
|
||||
statements: [
|
||||
{
|
||||
condition: [
|
||||
{
|
||||
lhs: "payment_method",
|
||||
comparison: "equal",
|
||||
value: {
|
||||
type: "enum_variant",
|
||||
value: "card",
|
||||
},
|
||||
metadata: {},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "rule_2",
|
||||
connectorSelection: {
|
||||
type: "priority",
|
||||
data: [
|
||||
{
|
||||
connector: "adyen",
|
||||
merchant_connector_id: globalState.get("adyenMcaId"),
|
||||
},
|
||||
],
|
||||
},
|
||||
statements: [
|
||||
{
|
||||
condition: [
|
||||
{
|
||||
lhs: "payment_method",
|
||||
comparison: "equal",
|
||||
value: {
|
||||
type: "enum_variant",
|
||||
value: "bank_redirect",
|
||||
},
|
||||
metadata: {},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
cy.addRoutingConfig(
|
||||
fixtures.routingConfigBody,
|
||||
req_data,
|
||||
res_data,
|
||||
"advanced",
|
||||
routing_data,
|
||||
globalState
|
||||
);
|
||||
});
|
||||
|
||||
it("retrieve-routing-call-test", () => {
|
||||
let data = utils.getConnectorDetails("common")["volumeBasedRouting"];
|
||||
let req_data = data["Request"];
|
||||
let res_data = data["Response"];
|
||||
cy.retrieveRoutingConfig(req_data, res_data, globalState);
|
||||
});
|
||||
|
||||
it("activate-routing-call-test", () => {
|
||||
let data = utils.getConnectorDetails("common")["ruleBasedRouting"];
|
||||
let req_data = data["Request"];
|
||||
let res_data = data["Response"];
|
||||
cy.activateRoutingConfig(req_data, res_data, globalState);
|
||||
});
|
||||
|
||||
it("payment-routing-test for card", () => {
|
||||
let data =
|
||||
utils.getConnectorDetails("stripe")["card_pm"]["No3DSAutoCapture"];
|
||||
let req_data = data["Request"];
|
||||
let res_data = data["Response"];
|
||||
cy.createConfirmPaymentTest(
|
||||
fixtures.createConfirmPaymentBody,
|
||||
req_data,
|
||||
res_data,
|
||||
"no_three_ds",
|
||||
"automatic",
|
||||
globalState
|
||||
);
|
||||
});
|
||||
|
||||
it("retrieve-payment-call-test", () => {
|
||||
cy.retrievePaymentCallTest(globalState);
|
||||
});
|
||||
|
||||
it("create-payment-routing-test for bank redirect", () => {
|
||||
let data =
|
||||
utils.getConnectorDetails("adyen")["bank_redirect_pm"]["PaymentIntent"];
|
||||
let req_data = data["Request"];
|
||||
let res_data = data["Response"];
|
||||
cy.createPaymentIntentTest(
|
||||
fixtures.createPaymentBody,
|
||||
req_data,
|
||||
res_data,
|
||||
"three_ds",
|
||||
"automatic",
|
||||
globalState
|
||||
);
|
||||
});
|
||||
|
||||
it("Confirm bank redirect", () => {
|
||||
let data =
|
||||
utils.getConnectorDetails("adyen")["bank_redirect_pm"]["ideal"];
|
||||
let req_data = data["Request"];
|
||||
let res_data = data["Response"];
|
||||
cy.confirmBankRedirectCallTest(
|
||||
fixtures.confirmBody,
|
||||
req_data,
|
||||
res_data,
|
||||
true,
|
||||
globalState
|
||||
);
|
||||
});
|
||||
|
||||
it("Handle bank redirect redirection", () => {
|
||||
// return_url is a static url (https://hyperswitch.io) taken from confirm-body fixture and is not updated
|
||||
let expected_redirection = fixtures.confirmBody["return_url"];
|
||||
let payment_method_type = globalState.get("paymentMethodType");
|
||||
cy.handleBankRedirectRedirection(
|
||||
globalState,
|
||||
payment_method_type,
|
||||
expected_redirection
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
context("Rule based routing,Currency->is->USD->Stripe->else->adyen", () => {
|
||||
before("seed global state", () => {
|
||||
cy.task("getGlobalState").then((state) => {
|
||||
globalState = new State(state);
|
||||
});
|
||||
});
|
||||
|
||||
after("flush global state", () => {
|
||||
cy.task("setGlobalState", globalState.data);
|
||||
});
|
||||
|
||||
it("retrieve-mca", () => {
|
||||
cy.ListMcaByMid(globalState);
|
||||
});
|
||||
|
||||
it("api-key-create-call-test", () => {
|
||||
cy.apiKeyCreateTest(fixtures.apiKeyCreateBody, globalState);
|
||||
});
|
||||
|
||||
it("customer-create-call-test", () => {
|
||||
cy.createCustomerCallTest(fixtures.customerCreateBody, globalState);
|
||||
});
|
||||
|
||||
it("add-routing-config", () => {
|
||||
let data = utils.getConnectorDetails("common")["ruleBasedRouting"];
|
||||
let req_data = data["Request"];
|
||||
let res_data = data["Response"];
|
||||
|
||||
let routing_data = {
|
||||
defaultSelection: {
|
||||
type: "priority",
|
||||
data: [
|
||||
{
|
||||
connector: "adyen",
|
||||
merchant_connector_id: globalState.get("adyenMcaId"),
|
||||
},
|
||||
],
|
||||
},
|
||||
metadata: {},
|
||||
rules: [
|
||||
{
|
||||
name: "rule_1",
|
||||
connectorSelection: {
|
||||
type: "priority",
|
||||
data: [
|
||||
{
|
||||
connector: "stripe",
|
||||
merchant_connector_id: globalState.get("stripeMcaId"),
|
||||
},
|
||||
],
|
||||
},
|
||||
statements: [
|
||||
{
|
||||
condition: [
|
||||
{
|
||||
lhs: "currency",
|
||||
comparison: "equal",
|
||||
value: {
|
||||
type: "enum_variant",
|
||||
value: "USD",
|
||||
},
|
||||
metadata: {},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
cy.addRoutingConfig(
|
||||
fixtures.routingConfigBody,
|
||||
req_data,
|
||||
res_data,
|
||||
"advanced",
|
||||
routing_data,
|
||||
globalState
|
||||
);
|
||||
});
|
||||
|
||||
it("retrieve-routing-call-test", () => {
|
||||
let data = utils.getConnectorDetails("common")["volumeBasedRouting"];
|
||||
let req_data = data["Request"];
|
||||
let res_data = data["Response"];
|
||||
cy.retrieveRoutingConfig(req_data, res_data, globalState);
|
||||
});
|
||||
|
||||
it("activate-routing-call-test", () => {
|
||||
let data = utils.getConnectorDetails("common")["ruleBasedRouting"];
|
||||
let req_data = data["Request"];
|
||||
let res_data = data["Response"];
|
||||
cy.activateRoutingConfig(req_data, res_data, globalState);
|
||||
});
|
||||
|
||||
it("create-payment-call-test-with-USD", () => {
|
||||
let data =
|
||||
utils.getConnectorDetails("stripe")["card_pm"]["PaymentIntent"];
|
||||
let req_data = data["Request"];
|
||||
let res_data = data["Response"];
|
||||
cy.createPaymentIntentTest(
|
||||
fixtures.createPaymentBody,
|
||||
req_data,
|
||||
res_data,
|
||||
"no_three_ds",
|
||||
"automatic",
|
||||
globalState
|
||||
);
|
||||
});
|
||||
|
||||
it("Confirm No 3DS", () => {
|
||||
let data =
|
||||
utils.getConnectorDetails("stripe")["card_pm"]["No3DSAutoCapture"];
|
||||
let req_data = data["Request"];
|
||||
let res_data = data["Response"];
|
||||
cy.confirmCallTest(
|
||||
fixtures.confirmBody,
|
||||
req_data,
|
||||
res_data,
|
||||
true,
|
||||
globalState
|
||||
);
|
||||
});
|
||||
|
||||
it("retrieve-payment-call-test", () => {
|
||||
cy.retrievePaymentCallTest(globalState);
|
||||
});
|
||||
|
||||
it("create-payment-call-test-with-EUR", () => {
|
||||
let data = utils.getConnectorDetails("adyen")["card_pm"]["PaymentIntent"];
|
||||
let req_data = data["Request"];
|
||||
let res_data = data["Response"];
|
||||
cy.createPaymentIntentTest(
|
||||
fixtures.createPaymentBody,
|
||||
req_data,
|
||||
res_data,
|
||||
"no_three_ds",
|
||||
"automatic",
|
||||
globalState
|
||||
);
|
||||
});
|
||||
|
||||
it("Confirm No 3DS", () => {
|
||||
let data =
|
||||
utils.getConnectorDetails("adyen")["card_pm"]["No3DSAutoCapture"];
|
||||
let req_data = data["Request"];
|
||||
let res_data = data["Response"];
|
||||
cy.confirmCallTest(
|
||||
fixtures.confirmBody,
|
||||
req_data,
|
||||
res_data,
|
||||
true,
|
||||
globalState
|
||||
);
|
||||
});
|
||||
|
||||
it("retrieve-payment-call-test", () => {
|
||||
cy.retrievePaymentCallTest(globalState);
|
||||
});
|
||||
});
|
||||
|
||||
context(
|
||||
"Rule based routing,amount->isGreaterThan->100->adyen->else->stripe",
|
||||
() => {
|
||||
before("seed global state", () => {
|
||||
cy.task("getGlobalState").then((state) => {
|
||||
globalState = new State(state);
|
||||
});
|
||||
});
|
||||
|
||||
after("flush global state", () => {
|
||||
cy.task("setGlobalState", globalState.data);
|
||||
});
|
||||
|
||||
it("retrieve-mca", () => {
|
||||
cy.ListMcaByMid(globalState);
|
||||
});
|
||||
|
||||
it("api-key-create-call-test", () => {
|
||||
cy.apiKeyCreateTest(fixtures.apiKeyCreateBody, globalState);
|
||||
});
|
||||
|
||||
it("customer-create-call-test", () => {
|
||||
cy.createCustomerCallTest(fixtures.customerCreateBody, globalState);
|
||||
});
|
||||
|
||||
it("add-routing-config", () => {
|
||||
let data = utils.getConnectorDetails("common")["ruleBasedRouting"];
|
||||
let req_data = data["Request"];
|
||||
let res_data = data["Response"];
|
||||
|
||||
let routing_data = {
|
||||
defaultSelection: {
|
||||
type: "priority",
|
||||
data: [],
|
||||
},
|
||||
metadata: {},
|
||||
rules: [
|
||||
{
|
||||
name: "rule_1",
|
||||
connectorSelection: {
|
||||
type: "priority",
|
||||
data: [
|
||||
{
|
||||
connector: "stripe",
|
||||
merchant_connector_id: globalState.get("stripeMcaId"),
|
||||
},
|
||||
],
|
||||
},
|
||||
statements: [
|
||||
{
|
||||
condition: [
|
||||
{
|
||||
lhs: "amount",
|
||||
comparison: "greater_than",
|
||||
value: { type: "number", value: 1000 },
|
||||
metadata: {},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "rule_2",
|
||||
connectorSelection: {
|
||||
type: "priority",
|
||||
data: [
|
||||
{
|
||||
connector: "adyen",
|
||||
merchant_connector_id: globalState.get("adyenMcaId"),
|
||||
},
|
||||
],
|
||||
},
|
||||
statements: [
|
||||
{
|
||||
condition: [
|
||||
{
|
||||
lhs: "amount",
|
||||
comparison: "less_than",
|
||||
value: { type: "number", value: 1000 },
|
||||
metadata: {},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
cy.addRoutingConfig(
|
||||
fixtures.routingConfigBody,
|
||||
req_data,
|
||||
res_data,
|
||||
"advanced",
|
||||
routing_data,
|
||||
globalState
|
||||
);
|
||||
});
|
||||
|
||||
it("retrieve-routing-call-test", () => {
|
||||
let data = utils.getConnectorDetails("common")["volumeBasedRouting"];
|
||||
let req_data = data["Request"];
|
||||
let res_data = data["Response"];
|
||||
cy.retrieveRoutingConfig(req_data, res_data, globalState);
|
||||
});
|
||||
|
||||
it("activate-routing-call-test", () => {
|
||||
let data = utils.getConnectorDetails("common")["ruleBasedRouting"];
|
||||
let req_data = data["Request"];
|
||||
let res_data = data["Response"];
|
||||
cy.activateRoutingConfig(req_data, res_data, globalState);
|
||||
});
|
||||
|
||||
it("create-payment-call-test-with-amount-10", () => {
|
||||
let data =
|
||||
utils.getConnectorDetails("stripe")["card_pm"]["PaymentIntent"];
|
||||
let req_data = data["Request"];
|
||||
let res_data = data["Response"];
|
||||
cy.createPaymentIntentTest(
|
||||
fixtures.createPaymentBody,
|
||||
req_data,
|
||||
res_data,
|
||||
"no_three_ds",
|
||||
"automatic",
|
||||
globalState
|
||||
);
|
||||
});
|
||||
|
||||
it("Confirm No 3DS", () => {
|
||||
let data =
|
||||
utils.getConnectorDetails("stripe")["card_pm"]["No3DSAutoCapture"];
|
||||
let req_data = data["Request"];
|
||||
let res_data = data["Response"];
|
||||
cy.confirmCallTest(
|
||||
fixtures.confirmBody,
|
||||
req_data,
|
||||
res_data,
|
||||
true,
|
||||
globalState
|
||||
);
|
||||
});
|
||||
|
||||
it("retrieve-payment-call-test", () => {
|
||||
cy.retrievePaymentCallTest(globalState);
|
||||
});
|
||||
|
||||
it("create-payment-call-test-with-amount-9", () => {
|
||||
let data =
|
||||
utils.getConnectorDetails("adyen")["card_pm"]["PaymentIntent"];
|
||||
let req_data = data["Request"];
|
||||
let res_data = data["Response"];
|
||||
cy.createPaymentIntentTest(
|
||||
fixtures.createPaymentBody,
|
||||
req_data,
|
||||
res_data,
|
||||
"no_three_ds",
|
||||
"automatic",
|
||||
globalState
|
||||
);
|
||||
});
|
||||
|
||||
it("Confirm No 3DS", () => {
|
||||
let data =
|
||||
utils.getConnectorDetails("adyen")["card_pm"]["No3DSAutoCapture"];
|
||||
let req_data = data["Request"];
|
||||
let res_data = data["Response"];
|
||||
cy.confirmCallTest(
|
||||
fixtures.confirmBody,
|
||||
req_data,
|
||||
res_data,
|
||||
true,
|
||||
globalState
|
||||
);
|
||||
|
||||
it("retrieve-payment-call-test", () => {
|
||||
cy.retrievePaymentCallTest(globalState);
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
});
|
||||
673
cypress-tests/cypress/e2e/RoutingUtils/Adyen.js
Normal file
673
cypress-tests/cypress/e2e/RoutingUtils/Adyen.js
Normal file
@ -0,0 +1,673 @@
|
||||
const successfulNo3DSCardDetails = {
|
||||
card_number: "4111111111111111",
|
||||
card_exp_month: "03",
|
||||
card_exp_year: "30",
|
||||
card_holder_name: "John Doe",
|
||||
card_cvc: "737",
|
||||
};
|
||||
|
||||
const successfulThreeDSTestCardDetails = {
|
||||
card_number: "4917610000000000",
|
||||
card_exp_month: "03",
|
||||
card_exp_year: "30",
|
||||
card_holder_name: "Joseph Doe",
|
||||
card_cvc: "737",
|
||||
};
|
||||
|
||||
const singleUseMandateData = {
|
||||
customer_acceptance: {
|
||||
acceptance_type: "offline",
|
||||
accepted_at: "1963-05-03T04:07:52.723Z",
|
||||
online: {
|
||||
ip_address: "125.0.0.1",
|
||||
user_agent: "amet irure esse",
|
||||
},
|
||||
},
|
||||
mandate_type: {
|
||||
single_use: {
|
||||
amount: 8000,
|
||||
currency: "USD",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const multiUseMandateData = {
|
||||
customer_acceptance: {
|
||||
acceptance_type: "offline",
|
||||
accepted_at: "1963-05-03T04:07:52.723Z",
|
||||
online: {
|
||||
ip_address: "125.0.0.1",
|
||||
user_agent: "amet irure esse",
|
||||
},
|
||||
},
|
||||
mandate_type: {
|
||||
multi_use: {
|
||||
amount: 8000,
|
||||
currency: "USD",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const connectorDetails = {
|
||||
card_pm: {
|
||||
PaymentIntent: {
|
||||
Request: {
|
||||
currency: "EUR",
|
||||
amount: 900,
|
||||
customer_acceptance: null,
|
||||
setup_future_usage: "on_session",
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_payment_method",
|
||||
},
|
||||
},
|
||||
},
|
||||
"3DSManualCapture": {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
card: successfulThreeDSTestCardDetails,
|
||||
},
|
||||
currency: "USD",
|
||||
customer_acceptance: null,
|
||||
setup_future_usage: "on_session",
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "processing",
|
||||
},
|
||||
},
|
||||
},
|
||||
"3DSAutoCapture": {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
card: successfulThreeDSTestCardDetails,
|
||||
},
|
||||
currency: "USD",
|
||||
customer_acceptance: null,
|
||||
setup_future_usage: "on_session",
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_customer_action",
|
||||
},
|
||||
},
|
||||
},
|
||||
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",
|
||||
},
|
||||
},
|
||||
},
|
||||
No3DSAutoCapture: {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_type: "credit",
|
||||
payment_method_data: {
|
||||
card: successfulNo3DSCardDetails,
|
||||
},
|
||||
currency: "USD",
|
||||
amount: 900,
|
||||
customer_acceptance: null,
|
||||
setup_future_usage: "on_session",
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "succeeded",
|
||||
connector: "adyen",
|
||||
},
|
||||
},
|
||||
},
|
||||
Capture: {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
card: successfulNo3DSCardDetails,
|
||||
},
|
||||
currency: "USD",
|
||||
customer_acceptance: null,
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "processing",
|
||||
amount: 6500,
|
||||
amount_capturable: 6500,
|
||||
amount_received: 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
PartialCapture: {
|
||||
Request: {},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "processing",
|
||||
amount: 6500,
|
||||
amount_capturable: 6500,
|
||||
amount_received: 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
Void: {
|
||||
Request: {},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "processing",
|
||||
},
|
||||
},
|
||||
},
|
||||
MandateSingleUse3DSAutoCapture: {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
card: successfulThreeDSTestCardDetails,
|
||||
},
|
||||
currency: "USD",
|
||||
mandate_data: singleUseMandateData,
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "succeeded",
|
||||
},
|
||||
},
|
||||
},
|
||||
MandateSingleUse3DSManualCapture: {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
card: successfulThreeDSTestCardDetails,
|
||||
},
|
||||
currency: "USD",
|
||||
mandate_data: singleUseMandateData,
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_customer_action",
|
||||
},
|
||||
},
|
||||
},
|
||||
MandateSingleUseNo3DSAutoCapture: {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
card: successfulNo3DSCardDetails,
|
||||
},
|
||||
currency: "USD",
|
||||
mandate_data: singleUseMandateData,
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "succeeded",
|
||||
},
|
||||
},
|
||||
},
|
||||
MandateSingleUseNo3DSManualCapture: {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
card: successfulNo3DSCardDetails,
|
||||
},
|
||||
currency: "USD",
|
||||
mandate_data: singleUseMandateData,
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_capture",
|
||||
},
|
||||
},
|
||||
},
|
||||
MandateMultiUseNo3DSAutoCapture: {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
card: successfulNo3DSCardDetails,
|
||||
},
|
||||
currency: "USD",
|
||||
mandate_data: multiUseMandateData,
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "succeeded",
|
||||
},
|
||||
},
|
||||
},
|
||||
MandateMultiUseNo3DSManualCapture: {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
card: successfulNo3DSCardDetails,
|
||||
},
|
||||
currency: "USD",
|
||||
mandate_data: multiUseMandateData,
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_capture",
|
||||
},
|
||||
},
|
||||
},
|
||||
MandateMultiUse3DSAutoCapture: {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
card: successfulThreeDSTestCardDetails,
|
||||
},
|
||||
currency: "USD",
|
||||
mandate_data: multiUseMandateData,
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_capture",
|
||||
},
|
||||
},
|
||||
},
|
||||
MandateMultiUse3DSManualCapture: {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
card: successfulThreeDSTestCardDetails,
|
||||
},
|
||||
currency: "USD",
|
||||
mandate_data: multiUseMandateData,
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_capture",
|
||||
},
|
||||
},
|
||||
},
|
||||
ZeroAuthMandate: {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
card: successfulNo3DSCardDetails,
|
||||
},
|
||||
currency: "USD",
|
||||
mandate_data: singleUseMandateData,
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "succeeded",
|
||||
},
|
||||
},
|
||||
},
|
||||
SaveCardUseNo3DSAutoCapture: {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
card: successfulNo3DSCardDetails,
|
||||
},
|
||||
currency: "USD",
|
||||
setup_future_usage: "on_session",
|
||||
customer_acceptance: {
|
||||
acceptance_type: "offline",
|
||||
accepted_at: "1963-05-03T04:07:52.723Z",
|
||||
online: {
|
||||
ip_address: "127.0.0.1",
|
||||
user_agent: "amet irure esse",
|
||||
},
|
||||
},
|
||||
},
|
||||
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: {
|
||||
acceptance_type: "offline",
|
||||
accepted_at: "1963-05-03T04:07:52.723Z",
|
||||
online: {
|
||||
ip_address: "127.0.0.1",
|
||||
user_agent: "amet irure esse",
|
||||
},
|
||||
},
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_capture",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
bank_transfer_pm: {
|
||||
PaymentIntent: {
|
||||
Request: {
|
||||
currency: "BRL",
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_payment_method",
|
||||
},
|
||||
},
|
||||
},
|
||||
Pix: {
|
||||
Request: {
|
||||
payment_method: "bank_transfer",
|
||||
payment_method_type: "pix",
|
||||
payment_method_data: {
|
||||
bank_transfer: {
|
||||
pix: {},
|
||||
},
|
||||
},
|
||||
billing: {
|
||||
address: {
|
||||
line1: "1467",
|
||||
line2: "Harrison Street",
|
||||
line3: "Harrison Street",
|
||||
city: "San Fransico",
|
||||
state: "California",
|
||||
zip: "94122",
|
||||
country: "BR",
|
||||
first_name: "joseph",
|
||||
last_name: "Doe",
|
||||
},
|
||||
phone: {
|
||||
number: "9123456789",
|
||||
country_code: "+91",
|
||||
},
|
||||
},
|
||||
currency: "BRL",
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_customer_action",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
bank_redirect_pm: {
|
||||
PaymentIntent: {
|
||||
Request: {
|
||||
currency: "EUR",
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_payment_method",
|
||||
},
|
||||
},
|
||||
},
|
||||
ideal: {
|
||||
Request: {
|
||||
payment_method: "bank_redirect",
|
||||
payment_method_type: "ideal",
|
||||
payment_method_data: {
|
||||
bank_redirect: {
|
||||
ideal: {
|
||||
bank_name: "ing",
|
||||
},
|
||||
},
|
||||
},
|
||||
billing: {
|
||||
address: {
|
||||
line1: "1467",
|
||||
line2: "Harrison Street",
|
||||
line3: "Harrison Street",
|
||||
city: "San Fransico",
|
||||
state: "California",
|
||||
zip: "94122",
|
||||
country: "NL",
|
||||
first_name: "joseph",
|
||||
last_name: "Doe",
|
||||
},
|
||||
phone: {
|
||||
number: "9123456789",
|
||||
country_code: "+91",
|
||||
},
|
||||
},
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_customer_action",
|
||||
connector: "adyen",
|
||||
},
|
||||
},
|
||||
},
|
||||
giropay: {
|
||||
Request: {
|
||||
payment_method: "bank_redirect",
|
||||
payment_method_type: "giropay",
|
||||
payment_method_data: {
|
||||
bank_redirect: {
|
||||
giropay: {
|
||||
bank_name: "",
|
||||
bank_account_bic: "",
|
||||
bank_account_iban: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
billing: {
|
||||
address: {
|
||||
line1: "1467",
|
||||
line2: "Harrison Street",
|
||||
line3: "Harrison Street",
|
||||
city: "San Fransico",
|
||||
state: "California",
|
||||
zip: "94122",
|
||||
country: "DE",
|
||||
first_name: "joseph",
|
||||
last_name: "Doe",
|
||||
},
|
||||
phone: {
|
||||
number: "9123456789",
|
||||
country_code: "+91",
|
||||
},
|
||||
},
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_customer_action",
|
||||
},
|
||||
},
|
||||
},
|
||||
sofort: {
|
||||
Request: {
|
||||
payment_method: "bank_redirect",
|
||||
payment_method_type: "sofort",
|
||||
payment_method_data: {
|
||||
bank_redirect: {
|
||||
sofort: {
|
||||
preferred_language: "en",
|
||||
},
|
||||
},
|
||||
},
|
||||
billing: {
|
||||
address: {
|
||||
line1: "1467",
|
||||
line2: "Harrison Street",
|
||||
line3: "Harrison Street",
|
||||
city: "San Fransico",
|
||||
state: "California",
|
||||
zip: "94122",
|
||||
country: "DE",
|
||||
first_name: "joseph",
|
||||
last_name: "Doe",
|
||||
},
|
||||
phone: {
|
||||
number: "9123456789",
|
||||
country_code: "+91",
|
||||
},
|
||||
},
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_customer_action",
|
||||
},
|
||||
},
|
||||
},
|
||||
eps: {
|
||||
Request: {
|
||||
payment_method: "bank_redirect",
|
||||
payment_method_type: "eps",
|
||||
payment_method_data: {
|
||||
bank_redirect: {
|
||||
eps: {
|
||||
bank_name: "ing",
|
||||
},
|
||||
},
|
||||
},
|
||||
billing: {
|
||||
address: {
|
||||
line1: "1467",
|
||||
line2: "Harrison Street",
|
||||
line3: "Harrison Street",
|
||||
city: "San Fransico",
|
||||
state: "California",
|
||||
zip: "94122",
|
||||
country: "AT",
|
||||
first_name: "joseph",
|
||||
last_name: "Doe",
|
||||
},
|
||||
phone: {
|
||||
number: "9123456789",
|
||||
country_code: "+91",
|
||||
},
|
||||
},
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_customer_action",
|
||||
connector: "adyen",
|
||||
},
|
||||
},
|
||||
},
|
||||
blik: {
|
||||
Request: {
|
||||
payment_method: "bank_redirect",
|
||||
payment_method_type: "blik",
|
||||
payment_method_data: {
|
||||
bank_redirect: {
|
||||
blik: {
|
||||
name: "John Doe",
|
||||
email: "example@email.com",
|
||||
blik_code: "777987",
|
||||
},
|
||||
},
|
||||
},
|
||||
billing: {
|
||||
address: {
|
||||
line1: "1467",
|
||||
line2: "Harrison Street",
|
||||
line3: "Harrison Street",
|
||||
city: "San Fransico",
|
||||
state: "California",
|
||||
zip: "94122",
|
||||
country: "PL",
|
||||
first_name: "john",
|
||||
last_name: "doe",
|
||||
},
|
||||
},
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "processing",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
upi_pm: {
|
||||
PaymentIntent: {
|
||||
Request: {
|
||||
currency: "INR",
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_payment_method",
|
||||
},
|
||||
},
|
||||
},
|
||||
UpiCollect: {
|
||||
Request: {
|
||||
payment_method: "upi",
|
||||
payment_method_type: "upi_collect",
|
||||
payment_method_data: {
|
||||
upi: {
|
||||
upi_collect: {
|
||||
vpa_id: "successtest@iata",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Response: {
|
||||
status: 400,
|
||||
body: {
|
||||
error: {
|
||||
type: "invalid_request",
|
||||
message: "Payment method type not supported",
|
||||
code: "HE_03",
|
||||
reason: "automatic for upi_collect is not supported by adyen",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
UpiIntent: {
|
||||
Request: {
|
||||
payment_method: "upi",
|
||||
payment_method_type: "upi_intent",
|
||||
payment_method_data: {
|
||||
upi: {
|
||||
upi_intent: {},
|
||||
},
|
||||
},
|
||||
},
|
||||
Response: {
|
||||
status: 400,
|
||||
body: {
|
||||
error: {
|
||||
type: "invalid_request",
|
||||
message: "Payment method type not supported",
|
||||
code: "HE_03",
|
||||
reason: "automatic for upi_intent is not supported by adyen",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
@ -1,15 +1,7 @@
|
||||
const card_data = {
|
||||
card_number: "4242424242424242",
|
||||
card_exp_month: "03",
|
||||
card_exp_year: "30",
|
||||
card_holder_name: "morino",
|
||||
card_cvc: "737",
|
||||
};
|
||||
|
||||
export const connectorDetails = {
|
||||
routing: {
|
||||
priorityRouting: {
|
||||
Request: {
|
||||
name: "stripe config",
|
||||
name: "priority routing",
|
||||
description: "some desc",
|
||||
algorithm: {
|
||||
type: "priority",
|
||||
@ -29,23 +21,41 @@ export const connectorDetails = {
|
||||
body: {},
|
||||
},
|
||||
},
|
||||
card_pm: {
|
||||
Confirm: {
|
||||
Request: {
|
||||
payment_method_data: {
|
||||
card: card_data,
|
||||
},
|
||||
currency: "USD",
|
||||
customer_acceptance: null,
|
||||
setup_future_usage: "on_session",
|
||||
volumeBasedRouting: {
|
||||
Request: {
|
||||
name: "volume routing",
|
||||
description: "some desc",
|
||||
algorithm: {
|
||||
type: "volume_split",
|
||||
data: [],
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "succeeded",
|
||||
connector: "stripe",
|
||||
},
|
||||
profile_id: "{{profile_id}}",
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {},
|
||||
},
|
||||
},
|
||||
ruleBasedRouting: {
|
||||
Request: {
|
||||
name: "Rule Based routing",
|
||||
description: "Rule Based routing",
|
||||
algorithm: {
|
||||
type: "advanced",
|
||||
data: [],
|
||||
},
|
||||
profile_id: "{{profile_id}}",
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {},
|
||||
},
|
||||
},
|
||||
jwt: {
|
||||
Request: {},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
572
cypress-tests/cypress/e2e/RoutingUtils/Stripe.js
Normal file
572
cypress-tests/cypress/e2e/RoutingUtils/Stripe.js
Normal file
@ -0,0 +1,572 @@
|
||||
import {} from "./Commons";
|
||||
|
||||
const successfulNo3DSCardDetails = {
|
||||
card_number: "4242424242424242",
|
||||
card_exp_month: "10",
|
||||
card_exp_year: "25",
|
||||
card_holder_name: "morino",
|
||||
card_cvc: "737",
|
||||
};
|
||||
|
||||
const successfulThreeDSTestCardDetails = {
|
||||
card_number: "4000002500003155",
|
||||
card_exp_month: "10",
|
||||
card_exp_year: "25",
|
||||
card_holder_name: "morino",
|
||||
card_cvc: "737",
|
||||
};
|
||||
|
||||
const singleUseMandateData = {
|
||||
customer_acceptance: {
|
||||
acceptance_type: "offline",
|
||||
accepted_at: "1963-05-03T04:07:52.723Z",
|
||||
online: {
|
||||
ip_address: "125.0.0.1",
|
||||
user_agent: "amet irure esse",
|
||||
},
|
||||
},
|
||||
mandate_type: {
|
||||
single_use: {
|
||||
amount: 8000,
|
||||
currency: "USD",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const multiUseMandateData = {
|
||||
customer_acceptance: {
|
||||
acceptance_type: "offline",
|
||||
accepted_at: "1963-05-03T04:07:52.723Z",
|
||||
online: {
|
||||
ip_address: "125.0.0.1",
|
||||
user_agent: "amet irure esse",
|
||||
},
|
||||
},
|
||||
mandate_type: {
|
||||
multi_use: {
|
||||
amount: 8000,
|
||||
currency: "USD",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const connectorDetails = {
|
||||
card_pm: {
|
||||
PaymentIntent: {
|
||||
Request: {
|
||||
currency: "USD",
|
||||
amount: 1100,
|
||||
customer_acceptance: null,
|
||||
setup_future_usage: "on_session",
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_payment_method",
|
||||
},
|
||||
},
|
||||
},
|
||||
"3DSManualCapture": {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
card: successfulThreeDSTestCardDetails,
|
||||
},
|
||||
currency: "USD",
|
||||
customer_acceptance: null,
|
||||
setup_future_usage: "on_session",
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_capture",
|
||||
},
|
||||
},
|
||||
},
|
||||
"3DSAutoCapture": {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
card: successfulThreeDSTestCardDetails,
|
||||
},
|
||||
currency: "USD",
|
||||
customer_acceptance: null,
|
||||
setup_future_usage: "on_session",
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_customer_action",
|
||||
},
|
||||
},
|
||||
},
|
||||
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",
|
||||
},
|
||||
},
|
||||
},
|
||||
No3DSAutoCapture: {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_type: "credit",
|
||||
payment_method_data: {
|
||||
card: successfulNo3DSCardDetails,
|
||||
},
|
||||
currency: "USD",
|
||||
amount: 1100,
|
||||
customer_acceptance: null,
|
||||
setup_future_usage: "on_session",
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "succeeded",
|
||||
connector: "stripe",
|
||||
},
|
||||
},
|
||||
},
|
||||
Capture: {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
card: successfulNo3DSCardDetails,
|
||||
},
|
||||
currency: "USD",
|
||||
customer_acceptance: null,
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "succeeded",
|
||||
amount: 6500,
|
||||
amount_capturable: 0,
|
||||
amount_received: 6500,
|
||||
},
|
||||
},
|
||||
},
|
||||
PartialCapture: {
|
||||
Request: {},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "partially_captured",
|
||||
amount: 6500,
|
||||
amount_capturable: 0,
|
||||
amount_received: 100,
|
||||
},
|
||||
},
|
||||
},
|
||||
Void: {
|
||||
Request: {},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "cancelled",
|
||||
},
|
||||
},
|
||||
},
|
||||
MandateSingleUse3DSAutoCapture: {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
card: successfulThreeDSTestCardDetails,
|
||||
},
|
||||
currency: "USD",
|
||||
mandate_data: singleUseMandateData,
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "succeeded",
|
||||
},
|
||||
},
|
||||
},
|
||||
MandateSingleUse3DSManualCapture: {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
card: successfulThreeDSTestCardDetails,
|
||||
},
|
||||
currency: "USD",
|
||||
mandate_data: singleUseMandateData,
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_customer_action",
|
||||
},
|
||||
},
|
||||
},
|
||||
MandateSingleUseNo3DSAutoCapture: {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
card: successfulNo3DSCardDetails,
|
||||
},
|
||||
currency: "USD",
|
||||
mandate_data: singleUseMandateData,
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "succeeded",
|
||||
},
|
||||
},
|
||||
},
|
||||
MandateSingleUseNo3DSManualCapture: {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
card: successfulNo3DSCardDetails,
|
||||
},
|
||||
currency: "USD",
|
||||
mandate_data: singleUseMandateData,
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_capture",
|
||||
},
|
||||
},
|
||||
},
|
||||
MandateMultiUseNo3DSAutoCapture: {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
card: successfulNo3DSCardDetails,
|
||||
},
|
||||
currency: "USD",
|
||||
mandate_data: multiUseMandateData,
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "succeeded",
|
||||
},
|
||||
},
|
||||
},
|
||||
MandateMultiUseNo3DSManualCapture: {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
card: successfulNo3DSCardDetails,
|
||||
},
|
||||
currency: "USD",
|
||||
mandate_data: multiUseMandateData,
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_capture",
|
||||
},
|
||||
},
|
||||
},
|
||||
MandateMultiUse3DSAutoCapture: {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
card: successfulThreeDSTestCardDetails,
|
||||
},
|
||||
currency: "USD",
|
||||
mandate_data: multiUseMandateData,
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_capture",
|
||||
},
|
||||
},
|
||||
},
|
||||
MandateMultiUse3DSManualCapture: {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
card: successfulThreeDSTestCardDetails,
|
||||
},
|
||||
currency: "USD",
|
||||
mandate_data: multiUseMandateData,
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_capture",
|
||||
},
|
||||
},
|
||||
},
|
||||
ZeroAuthMandate: {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
card: successfulNo3DSCardDetails,
|
||||
},
|
||||
currency: "USD",
|
||||
mandate_data: singleUseMandateData,
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "succeeded",
|
||||
},
|
||||
},
|
||||
},
|
||||
SaveCardUseNo3DSAutoCapture: {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
card: successfulNo3DSCardDetails,
|
||||
},
|
||||
currency: "USD",
|
||||
setup_future_usage: "on_session",
|
||||
customer_acceptance: {
|
||||
acceptance_type: "offline",
|
||||
accepted_at: "1963-05-03T04:07:52.723Z",
|
||||
online: {
|
||||
ip_address: "127.0.0.1",
|
||||
user_agent: "amet irure esse",
|
||||
},
|
||||
},
|
||||
},
|
||||
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: {
|
||||
acceptance_type: "offline",
|
||||
accepted_at: "1963-05-03T04:07:52.723Z",
|
||||
online: {
|
||||
ip_address: "127.0.0.1",
|
||||
user_agent: "amet irure esse",
|
||||
},
|
||||
},
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_capture",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
bank_redirect_pm: {
|
||||
PaymentIntent: {
|
||||
Request: {
|
||||
currency: "EUR",
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_payment_method",
|
||||
},
|
||||
},
|
||||
},
|
||||
ideal: {
|
||||
Request: {
|
||||
payment_method: "bank_redirect",
|
||||
payment_method_type: "ideal",
|
||||
payment_method_data: {
|
||||
bank_redirect: {
|
||||
ideal: {
|
||||
bank_name: "ing",
|
||||
},
|
||||
},
|
||||
},
|
||||
billing: {
|
||||
address: {
|
||||
line1: "1467",
|
||||
line2: "Harrison Street",
|
||||
line3: "Harrison Street",
|
||||
city: "San Fransico",
|
||||
state: "California",
|
||||
zip: "94122",
|
||||
country: "NL",
|
||||
first_name: "joseph",
|
||||
last_name: "Doe",
|
||||
},
|
||||
phone: {
|
||||
number: "9123456789",
|
||||
country_code: "+91",
|
||||
},
|
||||
},
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_customer_action",
|
||||
},
|
||||
},
|
||||
},
|
||||
giropay: {
|
||||
Request: {
|
||||
payment_method: "bank_redirect",
|
||||
payment_method_type: "giropay",
|
||||
payment_method_data: {
|
||||
bank_redirect: {
|
||||
giropay: {},
|
||||
},
|
||||
},
|
||||
billing: {
|
||||
address: {
|
||||
line1: "1467",
|
||||
line2: "Harrison Street",
|
||||
line3: "Harrison Street",
|
||||
city: "San Fransico",
|
||||
state: "California",
|
||||
zip: "94122",
|
||||
country: "DE",
|
||||
first_name: "joseph",
|
||||
last_name: "Doe",
|
||||
},
|
||||
phone: {
|
||||
number: "9123456789",
|
||||
country_code: "+91",
|
||||
},
|
||||
},
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "failed",
|
||||
error_code: "payment_method_not_available",
|
||||
error_message:
|
||||
"Giropay is deprecated and can no longer be used for payment acceptance. Please refer to https://docs.stripe.com/payments/giropay",
|
||||
},
|
||||
},
|
||||
},
|
||||
sofort: {
|
||||
Request: {
|
||||
payment_method: "bank_redirect",
|
||||
payment_method_type: "sofort",
|
||||
payment_method_data: {
|
||||
bank_redirect: {
|
||||
sofort: {},
|
||||
},
|
||||
},
|
||||
billing: {
|
||||
address: {
|
||||
line1: "1467",
|
||||
line2: "Harrison Street",
|
||||
line3: "Harrison Street",
|
||||
city: "San Fransico",
|
||||
state: "California",
|
||||
zip: "94122",
|
||||
country: "DE",
|
||||
first_name: "joseph",
|
||||
last_name: "Doe",
|
||||
},
|
||||
phone: {
|
||||
number: "9123456789",
|
||||
country_code: "+91",
|
||||
},
|
||||
},
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_customer_action",
|
||||
},
|
||||
},
|
||||
},
|
||||
eps: {
|
||||
Request: {
|
||||
payment_method: "bank_redirect",
|
||||
payment_method_type: "eps",
|
||||
payment_method_data: {
|
||||
bank_redirect: {
|
||||
eps: {
|
||||
bank_name: "bank_austria",
|
||||
},
|
||||
},
|
||||
},
|
||||
billing: {
|
||||
address: {
|
||||
line1: "1467",
|
||||
line2: "Harrison Street",
|
||||
line3: "Harrison Street",
|
||||
city: "San Fransico",
|
||||
state: "California",
|
||||
zip: "94122",
|
||||
country: "AT",
|
||||
first_name: "joseph",
|
||||
last_name: "Doe",
|
||||
},
|
||||
phone: {
|
||||
number: "9123456789",
|
||||
country_code: "+91",
|
||||
},
|
||||
},
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_customer_action",
|
||||
connector: "stripe",
|
||||
},
|
||||
},
|
||||
},
|
||||
blik: {
|
||||
Request: {
|
||||
payment_method: "bank_redirect",
|
||||
payment_method_type: "blik",
|
||||
payment_method_data: {
|
||||
bank_redirect: {
|
||||
blik: {
|
||||
blik_code: "777987",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "failed",
|
||||
error_code: "payment_intent_invalid_parameter",
|
||||
},
|
||||
},
|
||||
},
|
||||
przelewy24: {
|
||||
Request: {
|
||||
payment_method: "bank_redirect",
|
||||
payment_method_type: "przelewy24",
|
||||
payment_method_data: {
|
||||
bank_redirect: {
|
||||
przelewy24: {
|
||||
bank_name: "citi",
|
||||
billing_details: {
|
||||
email: "guest@juspay.in",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_customer_action",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
@ -1,7 +1,11 @@
|
||||
import { connectorDetails as adyenConnectorDetails } from "./Adyen.js";
|
||||
import { connectorDetails as commonConnectorDetails } from "./Commons.js";
|
||||
import { connectorDetails as stripeConnectorDetails } from "./Stripe.js";
|
||||
|
||||
const connectorDetails = {
|
||||
adyen: adyenConnectorDetails,
|
||||
common: commonConnectorDetails,
|
||||
stripe: stripeConnectorDetails,
|
||||
};
|
||||
|
||||
export const getConnectorDetails = (connectorId) => {
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
"confirm": true,
|
||||
"capture_method": "automatic",
|
||||
"capture_on": "2022-09-10T10:11:12Z",
|
||||
"amount_to_capture": 6500,
|
||||
"customer_id": "john123",
|
||||
"email": "guest@example.com",
|
||||
"name": "John Doe",
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
"authentication_type": "three_ds",
|
||||
"description": "Joseph First Crypto",
|
||||
"email": "hyperswitch_sdk_demo_id@gmail.com",
|
||||
"setup_future_usage": "",
|
||||
"setup_future_usage": null,
|
||||
"connector_metadata": {
|
||||
"noon": {
|
||||
"order_category": "applepay"
|
||||
@ -15,7 +15,5 @@
|
||||
"udf1": "value1",
|
||||
"new_customer": "true",
|
||||
"login_date": "2019-09-10T10:11:12Z"
|
||||
},
|
||||
"business_country": "US",
|
||||
"business_label": "default"
|
||||
}
|
||||
}
|
||||
|
||||
@ -84,6 +84,7 @@ Cypress.Commands.add("merchantRetrieveCall", (globalState) => {
|
||||
expect(response.body.default_profile).to.not.be.empty;
|
||||
expect(response.body.organization_id).to.not.be.empty;
|
||||
globalState.set("organizationId", response.body.organization_id);
|
||||
globalState.set("publishableKey", response.body.publishable_key);
|
||||
});
|
||||
});
|
||||
|
||||
@ -771,7 +772,7 @@ Cypress.Commands.add(
|
||||
Cypress.Commands.add(
|
||||
"createPaymentIntentTest",
|
||||
(
|
||||
request,
|
||||
createPaymentBody,
|
||||
req_data,
|
||||
res_data,
|
||||
authentication_type,
|
||||
@ -779,22 +780,23 @@ Cypress.Commands.add(
|
||||
globalState
|
||||
) => {
|
||||
if (
|
||||
!request ||
|
||||
typeof request !== "object" ||
|
||||
!req_data.currency ||
|
||||
!authentication_type
|
||||
!createPaymentBody ||
|
||||
typeof createPaymentBody !== "object" ||
|
||||
!req_data.currency
|
||||
) {
|
||||
throw new Error(
|
||||
"Invalid parameters provided to createPaymentIntentTest command"
|
||||
);
|
||||
}
|
||||
request.currency = req_data.currency;
|
||||
request.authentication_type = authentication_type;
|
||||
request.capture_method = capture_method;
|
||||
request.setup_future_usage = req_data.setup_future_usage;
|
||||
request.customer_acceptance = req_data.customer_acceptance;
|
||||
request.customer_id = globalState.get("customerId");
|
||||
globalState.set("paymentAmount", request.amount);
|
||||
|
||||
for (const key in req_data) {
|
||||
createPaymentBody[key] = req_data[key];
|
||||
}
|
||||
createPaymentBody.authentication_type = authentication_type;
|
||||
|
||||
createPaymentBody.capture_method = capture_method;
|
||||
createPaymentBody.customer_id = globalState.get("customerId");
|
||||
globalState.set("paymentAmount", createPaymentBody.amount);
|
||||
cy.request({
|
||||
method: "POST",
|
||||
url: `${globalState.get("baseUrl")}/payments`,
|
||||
@ -804,7 +806,7 @@ Cypress.Commands.add(
|
||||
"api-key": globalState.get("apiKey"),
|
||||
},
|
||||
failOnStatusCode: false,
|
||||
body: request,
|
||||
body: createPaymentBody,
|
||||
}).then((response) => {
|
||||
logRequestId(response.headers["x-request-id"]);
|
||||
|
||||
@ -819,9 +821,11 @@ Cypress.Commands.add(
|
||||
for (const key in res_data.body) {
|
||||
expect(res_data.body[key]).to.equal(response.body[key]);
|
||||
}
|
||||
expect(request.amount).to.equal(response.body.amount);
|
||||
expect(createPaymentBody.amount).to.equal(response.body.amount);
|
||||
expect(null).to.equal(response.body.amount_received);
|
||||
expect(request.amount).to.equal(response.body.amount_capturable);
|
||||
expect(createPaymentBody.amount).to.equal(
|
||||
response.body.amount_capturable
|
||||
);
|
||||
} else {
|
||||
defaultErrorHandler(response, res_data);
|
||||
}
|
||||
@ -903,6 +907,7 @@ Cypress.Commands.add(
|
||||
expect(response.headers["content-type"]).to.include("application/json");
|
||||
if (response.status === 200) {
|
||||
globalState.set("paymentID", paymentIntentID);
|
||||
globalState.set("connectorId", response.body.connector);
|
||||
if (response.body.capture_method === "automatic") {
|
||||
if (response.body.authentication_type === "three_ds") {
|
||||
expect(response.body)
|
||||
@ -959,6 +964,7 @@ Cypress.Commands.add(
|
||||
(confirmBody, req_data, res_data, confirm, globalState) => {
|
||||
const paymentIntentId = globalState.get("paymentID");
|
||||
const connectorId = globalState.get("connectorId");
|
||||
console.log("connectorId", connectorId);
|
||||
for (const key in req_data) {
|
||||
confirmBody[key] = req_data[key];
|
||||
}
|
||||
@ -979,6 +985,8 @@ Cypress.Commands.add(
|
||||
if (response.status === 200) {
|
||||
expect(response.headers["content-type"]).to.include("application/json");
|
||||
globalState.set("paymentID", paymentIntentId);
|
||||
globalState.set("connectorId", response.body.connector);
|
||||
console.log("connectorId", response.body.connector);
|
||||
globalState.set("paymentMethodType", confirmBody.payment_method_type);
|
||||
|
||||
switch (response.body.authentication_type) {
|
||||
@ -2044,6 +2052,9 @@ Cypress.Commands.add("createJWTToken", (req_data, res_data, globalState) => {
|
||||
//set jwt_token
|
||||
globalState.set("jwtToken", response.body.token);
|
||||
|
||||
//setting merchantId for manual create merchant
|
||||
globalState.set("merchantId", response.body.merchant_id);
|
||||
|
||||
// set session cookie
|
||||
const sessionCookie = response.headers["set-cookie"][0];
|
||||
const sessionValue = sessionCookie.split(";")[0];
|
||||
@ -2063,7 +2074,7 @@ Cypress.Commands.add("createJWTToken", (req_data, res_data, globalState) => {
|
||||
});
|
||||
|
||||
// Specific to routing tests
|
||||
Cypress.Commands.add("ListMCAbyMID", (globalState) => {
|
||||
Cypress.Commands.add("ListMcaByMid", (globalState) => {
|
||||
const merchantId = globalState.get("merchantId");
|
||||
cy.request({
|
||||
method: "GET",
|
||||
|
||||
9
cypress-tests/package-lock.json
generated
9
cypress-tests/package-lock.json
generated
@ -12,7 +12,7 @@
|
||||
"prettier": "^3.3.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"cypress": "^13.13.0",
|
||||
"cypress": "^13.13.3",
|
||||
"cypress-mochawesome-reporter": "^3.8.2",
|
||||
"jsqr": "^1.4.0"
|
||||
}
|
||||
@ -722,12 +722,11 @@
|
||||
}
|
||||
},
|
||||
"node_modules/cypress": {
|
||||
"version": "13.13.2",
|
||||
"resolved": "https://registry.npmjs.org/cypress/-/cypress-13.13.2.tgz",
|
||||
"integrity": "sha512-PvJQU33933NvS1StfzEb8/mu2kMy4dABwCF+yd5Bi7Qly1HOVf+Bufrygee/tlmty/6j5lX+KIi8j9Q3JUMbhA==",
|
||||
"version": "13.13.3",
|
||||
"resolved": "https://registry.npmjs.org/cypress/-/cypress-13.13.3.tgz",
|
||||
"integrity": "sha512-hUxPrdbJXhUOTzuML+y9Av7CKoYznbD83pt8g3klgpioEha0emfx4WNIuVRx0C76r0xV2MIwAW9WYiXfVJYFQw==",
|
||||
"dev": true,
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@cypress/request": "^3.0.1",
|
||||
"@cypress/xvfb": "^1.2.4",
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"cypress": "^13.13.0",
|
||||
"cypress": "^13.13.3",
|
||||
"cypress-mochawesome-reporter": "^3.8.2",
|
||||
"jsqr": "^1.4.0"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user