mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-03 13:30:39 +08:00
ci(cypress): Added Config Testcases (#6622)
Co-authored-by: Pa1NarK <69745008+pixincreate@users.noreply.github.com>
This commit is contained in:
@ -26,7 +26,7 @@ describe("Connector Agnostic Tests", () => {
|
|||||||
|
|
||||||
it("Create Business Profile", () => {
|
it("Create Business Profile", () => {
|
||||||
cy.createBusinessProfileTest(
|
cy.createBusinessProfileTest(
|
||||||
fixtures.createBusinessProfile,
|
fixtures.businessProfile.bpCreate,
|
||||||
globalState
|
globalState
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@ -85,7 +85,7 @@ describe("Connector Agnostic Tests", () => {
|
|||||||
|
|
||||||
it("Create Business Profile", () => {
|
it("Create Business Profile", () => {
|
||||||
cy.createBusinessProfileTest(
|
cy.createBusinessProfileTest(
|
||||||
fixtures.createBusinessProfile,
|
fixtures.businessProfile.bpCreate,
|
||||||
globalState
|
globalState
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@ -101,8 +101,12 @@ describe("Connector Agnostic Tests", () => {
|
|||||||
|
|
||||||
it("Enable Connector Agnostic for Business Profile", () => {
|
it("Enable Connector Agnostic for Business Profile", () => {
|
||||||
cy.UpdateBusinessProfileTest(
|
cy.UpdateBusinessProfileTest(
|
||||||
fixtures.updateBusinessProfile,
|
fixtures.businessProfile.bpUpdate,
|
||||||
true,
|
true, // is_connector_agnostic_enabled
|
||||||
|
false, // collect_billing_address_from_wallet_connector
|
||||||
|
false, // collect_shipping_address_from_wallet_connector
|
||||||
|
false, // always_collect_billing_address_from_wallet_connector
|
||||||
|
false, // always_collect_shipping_address_from_wallet_connector
|
||||||
globalState
|
globalState
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@ -141,7 +145,10 @@ describe("Connector Agnostic Tests", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("Create Business Profile", () => {
|
it("Create Business Profile", () => {
|
||||||
cy.createBusinessProfileTest(fixtures.createBusinessProfile, globalState);
|
cy.createBusinessProfileTest(
|
||||||
|
fixtures.businessProfile.bpCreate,
|
||||||
|
globalState
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("connector-create-call-test", () => {
|
it("connector-create-call-test", () => {
|
||||||
@ -159,8 +166,12 @@ describe("Connector Agnostic Tests", () => {
|
|||||||
|
|
||||||
it("Enable Connector Agnostic for Business Profile", () => {
|
it("Enable Connector Agnostic for Business Profile", () => {
|
||||||
cy.UpdateBusinessProfileTest(
|
cy.UpdateBusinessProfileTest(
|
||||||
fixtures.updateBusinessProfile,
|
fixtures.businessProfile.bpUpdate,
|
||||||
true,
|
true, // is_connector_agnostic_enabled
|
||||||
|
false, // collect_billing_address_from_wallet_connector
|
||||||
|
false, // collect_shipping_address_from_wallet_connector
|
||||||
|
false, // always_collect_billing_address_from_wallet_connector
|
||||||
|
false, // always_collect_shipping_address_from_wallet_connector
|
||||||
globalState
|
globalState
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@ -205,7 +216,10 @@ describe("Connector Agnostic Tests", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("Create Business Profile", () => {
|
it("Create Business Profile", () => {
|
||||||
cy.createBusinessProfileTest(fixtures.createBusinessProfile, globalState);
|
cy.createBusinessProfileTest(
|
||||||
|
fixtures.businessProfile.bpCreate,
|
||||||
|
globalState
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("connector-create-call-test", () => {
|
it("connector-create-call-test", () => {
|
||||||
@ -219,8 +233,12 @@ describe("Connector Agnostic Tests", () => {
|
|||||||
|
|
||||||
it("Enable Connector Agnostic for Business Profile", () => {
|
it("Enable Connector Agnostic for Business Profile", () => {
|
||||||
cy.UpdateBusinessProfileTest(
|
cy.UpdateBusinessProfileTest(
|
||||||
fixtures.updateBusinessProfile,
|
fixtures.businessProfile.bpUpdate,
|
||||||
true,
|
true, // is_connector_agnostic_enabled
|
||||||
|
false, // collect_billing_address_from_wallet_connector
|
||||||
|
false, // collect_shipping_address_from_wallet_connector
|
||||||
|
false, // always_collect_billing_address_from_wallet_connector
|
||||||
|
false, // always_collect_shipping_address_from_wallet_connector
|
||||||
globalState
|
globalState
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
407
cypress-tests/cypress/e2e/PaymentTest/00025-ConfigTest.cy.js
Normal file
407
cypress-tests/cypress/e2e/PaymentTest/00025-ConfigTest.cy.js
Normal file
@ -0,0 +1,407 @@
|
|||||||
|
import * as fixtures from "../../fixtures/imports";
|
||||||
|
import State from "../../utils/State";
|
||||||
|
import { payment_methods_enabled } from "../PaymentUtils/Commons";
|
||||||
|
import getConnectorDetails, * as utils from "../PaymentUtils/Utils";
|
||||||
|
|
||||||
|
let globalState;
|
||||||
|
|
||||||
|
describe("Config Tests", () => {
|
||||||
|
before("seed global state", () => {
|
||||||
|
cy.task("getGlobalState").then((state) => {
|
||||||
|
globalState = new State(state);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
after("flush global state", () => {
|
||||||
|
cy.task("setGlobalState", globalState.data);
|
||||||
|
});
|
||||||
|
|
||||||
|
context(
|
||||||
|
"Update collect_billing_details_from_wallet_connector to true and verifying in payment method list, this config should be true",
|
||||||
|
() => {
|
||||||
|
let should_continue = true;
|
||||||
|
|
||||||
|
beforeEach(function () {
|
||||||
|
if (!should_continue) {
|
||||||
|
this.skip();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Create Business Profile", () => {
|
||||||
|
cy.createBusinessProfileTest(
|
||||||
|
fixtures.businessProfile.bpCreate,
|
||||||
|
globalState
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("connector-create-call-test", () => {
|
||||||
|
cy.createConnectorCallTest(
|
||||||
|
"payment_processor",
|
||||||
|
fixtures.createConnectorBody,
|
||||||
|
payment_methods_enabled,
|
||||||
|
globalState
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Create Customer", () => {
|
||||||
|
cy.createCustomerCallTest(fixtures.customerCreateBody, globalState);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Update collect_billing_details_from_wallet_connector to true", () => {
|
||||||
|
cy.UpdateBusinessProfileTest(
|
||||||
|
fixtures.businessProfile.bpUpdate,
|
||||||
|
true, // is_connector_agnostic_enabled
|
||||||
|
true, // collect_billing_address_from_wallet_connector
|
||||||
|
false, // collect_shipping_address_from_wallet_connector
|
||||||
|
false, // always_collect_billing_address_from_wallet_connector
|
||||||
|
false, // always_collect_shipping_address_from_wallet_connector
|
||||||
|
globalState
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Create Payment Intent", () => {
|
||||||
|
let data = getConnectorDetails(globalState.get("connectorId"))[
|
||||||
|
"card_pm"
|
||||||
|
]["PaymentIntentOffSession"];
|
||||||
|
|
||||||
|
let req_data = data["Request"];
|
||||||
|
let res_data = data["Response"];
|
||||||
|
|
||||||
|
cy.createPaymentIntentTest(
|
||||||
|
fixtures.createPaymentBody,
|
||||||
|
req_data,
|
||||||
|
res_data,
|
||||||
|
"no_three_ds",
|
||||||
|
"automatic",
|
||||||
|
globalState
|
||||||
|
);
|
||||||
|
|
||||||
|
if (should_continue)
|
||||||
|
should_continue = utils.should_continue_further(res_data);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("payment_methods-call-test", () => {
|
||||||
|
cy.paymentMethodsCallTest(globalState);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
context(
|
||||||
|
"Update collect_shipping_details_from_wallet_connector to true and verifying in payment method list, this config should be true",
|
||||||
|
() => {
|
||||||
|
let should_continue = true;
|
||||||
|
|
||||||
|
beforeEach(function () {
|
||||||
|
if (!should_continue) {
|
||||||
|
this.skip();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Update collect_shipping_details_from_wallet_connector to true", () => {
|
||||||
|
cy.UpdateBusinessProfileTest(
|
||||||
|
fixtures.businessProfile.bpUpdate,
|
||||||
|
true, // is_connector_agnostic_enabled
|
||||||
|
false, // collect_billing_address_from_wallet_connector
|
||||||
|
false, // collect_shipping_address_from_wallet_connector
|
||||||
|
false, // always_collect_billing_address_from_wallet_connector
|
||||||
|
false, // always_collect_shipping_address_from_wallet_connector
|
||||||
|
globalState
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Create Payment Intent", () => {
|
||||||
|
let data = getConnectorDetails(globalState.get("connectorId"))[
|
||||||
|
"card_pm"
|
||||||
|
]["PaymentIntentOffSession"];
|
||||||
|
|
||||||
|
let req_data = data["Request"];
|
||||||
|
let res_data = data["Response"];
|
||||||
|
|
||||||
|
cy.createPaymentIntentTest(
|
||||||
|
fixtures.createPaymentBody,
|
||||||
|
req_data,
|
||||||
|
res_data,
|
||||||
|
"no_three_ds",
|
||||||
|
"automatic",
|
||||||
|
globalState
|
||||||
|
);
|
||||||
|
|
||||||
|
if (should_continue)
|
||||||
|
should_continue = utils.should_continue_further(res_data);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("payment_methods-call-test", () => {
|
||||||
|
cy.paymentMethodsCallTest(globalState);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
context(
|
||||||
|
"Update always_collect_billing_details_from_wallet_connector to true and verifying in payment method list, this config should be true",
|
||||||
|
() => {
|
||||||
|
let should_continue = true;
|
||||||
|
|
||||||
|
beforeEach(function () {
|
||||||
|
if (!should_continue) {
|
||||||
|
this.skip();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Update always_collect_billing_details_from_wallet_connector to true", () => {
|
||||||
|
cy.UpdateBusinessProfileTest(
|
||||||
|
fixtures.businessProfile.bpUpdate,
|
||||||
|
true, // is_connector_agnostic_enabled
|
||||||
|
false, // collect_billing_address_from_wallet_connector
|
||||||
|
false, // collect_shipping_address_from_wallet_connector
|
||||||
|
true, // always_collect_billing_address_from_wallet_connector
|
||||||
|
false, // always_collect_shipping_address_from_wallet_connector
|
||||||
|
globalState
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Create Payment Intent", () => {
|
||||||
|
let data = getConnectorDetails(globalState.get("connectorId"))[
|
||||||
|
"card_pm"
|
||||||
|
]["PaymentIntentOffSession"];
|
||||||
|
|
||||||
|
let req_data = data["Request"];
|
||||||
|
let res_data = data["Response"];
|
||||||
|
|
||||||
|
cy.createPaymentIntentTest(
|
||||||
|
fixtures.createPaymentBody,
|
||||||
|
req_data,
|
||||||
|
res_data,
|
||||||
|
"no_three_ds",
|
||||||
|
"automatic",
|
||||||
|
globalState
|
||||||
|
);
|
||||||
|
|
||||||
|
if (should_continue)
|
||||||
|
should_continue = utils.should_continue_further(res_data);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("payment_methods-call-test", () => {
|
||||||
|
cy.paymentMethodsCallTest(globalState);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
context(
|
||||||
|
"Update always_collect_shipping_details_from_wallet_connector to true and verifying in payment method list, this config should be true",
|
||||||
|
() => {
|
||||||
|
let should_continue = true;
|
||||||
|
|
||||||
|
beforeEach(function () {
|
||||||
|
if (!should_continue) {
|
||||||
|
this.skip();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Update always_collect_shipping_details_from_wallet_connector to true", () => {
|
||||||
|
cy.UpdateBusinessProfileTest(
|
||||||
|
fixtures.businessProfile.bpUpdate,
|
||||||
|
true, // is_connector_agnostic_enabled
|
||||||
|
false, // collect_billing_address_from_wallet_connector
|
||||||
|
false, // collect_shipping_address_from_wallet_connector
|
||||||
|
false, // always_collect_billing_address_from_wallet_connector
|
||||||
|
true, // always_collect_shipping_address_from_wallet_connector
|
||||||
|
globalState
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Create Payment Intent", () => {
|
||||||
|
let data = getConnectorDetails(globalState.get("connectorId"))[
|
||||||
|
"card_pm"
|
||||||
|
]["PaymentIntentOffSession"];
|
||||||
|
|
||||||
|
let req_data = data["Request"];
|
||||||
|
let res_data = data["Response"];
|
||||||
|
|
||||||
|
cy.createPaymentIntentTest(
|
||||||
|
fixtures.createPaymentBody,
|
||||||
|
req_data,
|
||||||
|
res_data,
|
||||||
|
"no_three_ds",
|
||||||
|
"automatic",
|
||||||
|
globalState
|
||||||
|
);
|
||||||
|
|
||||||
|
if (should_continue)
|
||||||
|
should_continue = utils.should_continue_further(res_data);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("payment_methods-call-test", () => {
|
||||||
|
cy.paymentMethodsCallTest(globalState);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
context(
|
||||||
|
"Update always_collect_shipping_details_from_wallet_connector & collect_shipping_details_from_wallet_connector to true and verifying in payment method list, this config should be true",
|
||||||
|
() => {
|
||||||
|
let should_continue = true;
|
||||||
|
|
||||||
|
beforeEach(function () {
|
||||||
|
if (!should_continue) {
|
||||||
|
this.skip();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Update both always & collect_shipping_details_from_wallet_connector to true", () => {
|
||||||
|
cy.UpdateBusinessProfileTest(
|
||||||
|
fixtures.businessProfile.bpUpdate,
|
||||||
|
true, // is_connector_agnostic_enabled
|
||||||
|
false, // collect_billing_address_from_wallet_connector
|
||||||
|
true, // collect_shipping_address_from_wallet_connector
|
||||||
|
false, // always_collect_billing_address_from_wallet_connector
|
||||||
|
true, // always_collect_shipping_address_from_wallet_connector
|
||||||
|
globalState
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Create Payment Intent", () => {
|
||||||
|
let data = getConnectorDetails(globalState.get("connectorId"))[
|
||||||
|
"card_pm"
|
||||||
|
]["PaymentIntentOffSession"];
|
||||||
|
|
||||||
|
let req_data = data["Request"];
|
||||||
|
let res_data = data["Response"];
|
||||||
|
|
||||||
|
cy.createPaymentIntentTest(
|
||||||
|
fixtures.createPaymentBody,
|
||||||
|
req_data,
|
||||||
|
res_data,
|
||||||
|
"no_three_ds",
|
||||||
|
"automatic",
|
||||||
|
globalState
|
||||||
|
);
|
||||||
|
|
||||||
|
if (should_continue)
|
||||||
|
should_continue = utils.should_continue_further(res_data);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("payment_methods-call-test", () => {
|
||||||
|
cy.paymentMethodsCallTest(globalState);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
context(
|
||||||
|
"Update always_collect_billing_details_from_wallet_connector & to collect_billing_details_from_wallet_connector to true and verifying in payment method list, this config should be true",
|
||||||
|
() => {
|
||||||
|
let should_continue = true;
|
||||||
|
|
||||||
|
beforeEach(function () {
|
||||||
|
if (!should_continue) {
|
||||||
|
this.skip();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Update both always & collect_billing_details_from_wallet_connector to true", () => {
|
||||||
|
cy.UpdateBusinessProfileTest(
|
||||||
|
fixtures.businessProfile.bpUpdate,
|
||||||
|
true, // is_connector_agnostic_enabled
|
||||||
|
true, // collect_billing_address_from_wallet_connector
|
||||||
|
false, // collect_shipping_address_from_wallet_connector
|
||||||
|
true, // always_collect_billing_address_from_wallet_connector
|
||||||
|
false, // always_collect_shipping_address_from_wallet_connector
|
||||||
|
globalState
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Create Payment Intent", () => {
|
||||||
|
let data = getConnectorDetails(globalState.get("connectorId"))[
|
||||||
|
"card_pm"
|
||||||
|
]["PaymentIntentOffSession"];
|
||||||
|
|
||||||
|
let req_data = data["Request"];
|
||||||
|
let res_data = data["Response"];
|
||||||
|
|
||||||
|
cy.createPaymentIntentTest(
|
||||||
|
fixtures.createPaymentBody,
|
||||||
|
req_data,
|
||||||
|
res_data,
|
||||||
|
"no_three_ds",
|
||||||
|
"automatic",
|
||||||
|
globalState
|
||||||
|
);
|
||||||
|
|
||||||
|
if (should_continue)
|
||||||
|
should_continue = utils.should_continue_further(res_data);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("payment_methods-call-test", () => {
|
||||||
|
cy.paymentMethodsCallTest(globalState);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
context(
|
||||||
|
"Update all config(Collect address config) to false and verifying in payment method list, both config should be false",
|
||||||
|
() => {
|
||||||
|
let should_continue = true;
|
||||||
|
|
||||||
|
beforeEach(function () {
|
||||||
|
if (!should_continue) {
|
||||||
|
this.skip();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Create Business Profile", () => {
|
||||||
|
cy.createBusinessProfileTest(
|
||||||
|
fixtures.businessProfile.bpCreate,
|
||||||
|
globalState
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("connector-create-call-test", () => {
|
||||||
|
cy.createConnectorCallTest(
|
||||||
|
"payment_processor",
|
||||||
|
fixtures.createConnectorBody,
|
||||||
|
payment_methods_enabled,
|
||||||
|
globalState
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Create Customer", () => {
|
||||||
|
cy.createCustomerCallTest(fixtures.customerCreateBody, globalState);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Update all config to false", () => {
|
||||||
|
cy.UpdateBusinessProfileTest(
|
||||||
|
fixtures.businessProfile.bpUpdate,
|
||||||
|
true, // is_connector_agnostic_enabled
|
||||||
|
false, // collect_billing_address_from_wallet_connector
|
||||||
|
false, // collect_shipping_address_from_wallet_connector
|
||||||
|
false, // always_collect_billing_address_from_wallet_connector
|
||||||
|
false, // always_collect_shipping_address_from_wallet_connector
|
||||||
|
globalState
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Create Payment Intent", () => {
|
||||||
|
let data = getConnectorDetails(globalState.get("connectorId"))[
|
||||||
|
"card_pm"
|
||||||
|
]["PaymentIntentOffSession"];
|
||||||
|
|
||||||
|
let req_data = data["Request"];
|
||||||
|
let res_data = data["Response"];
|
||||||
|
|
||||||
|
cy.createPaymentIntentTest(
|
||||||
|
fixtures.createPaymentBody,
|
||||||
|
req_data,
|
||||||
|
res_data,
|
||||||
|
"no_three_ds",
|
||||||
|
"automatic",
|
||||||
|
globalState
|
||||||
|
);
|
||||||
|
|
||||||
|
if (should_continue)
|
||||||
|
should_continue = utils.should_continue_further(res_data);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("payment_methods-call-test", () => {
|
||||||
|
cy.paymentMethodsCallTest(globalState);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
13
cypress-tests/cypress/fixtures/business-profile.json
Normal file
13
cypress-tests/cypress/fixtures/business-profile.json
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"bpCreate": {
|
||||||
|
"profile_name": "default"
|
||||||
|
},
|
||||||
|
|
||||||
|
"bpUpdate": {
|
||||||
|
"is_connector_agnostic_mit_enabled": true,
|
||||||
|
"collect_shipping_details_from_wallet_connector": true,
|
||||||
|
"collect_billing_details_from_wallet_connector": true,
|
||||||
|
"always_collect_billing_details_from_wallet_connector": true,
|
||||||
|
"always_collect_shipping_details_from_wallet_connector": true
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"profile_name": "default"
|
|
||||||
}
|
|
||||||
@ -1,8 +1,8 @@
|
|||||||
|
import businessProfile from "./business-profile.json";
|
||||||
import captureBody from "./capture-flow-body.json";
|
import captureBody from "./capture-flow-body.json";
|
||||||
import configs from "./configs.json";
|
import configs from "./configs.json";
|
||||||
import confirmBody from "./confirm-body.json";
|
import confirmBody from "./confirm-body.json";
|
||||||
import apiKeyCreateBody from "./create-api-key-body.json";
|
import apiKeyCreateBody from "./create-api-key-body.json";
|
||||||
import createBusinessProfile from "./create-business-profile.json";
|
|
||||||
import createConfirmPaymentBody from "./create-confirm-body.json";
|
import createConfirmPaymentBody from "./create-confirm-body.json";
|
||||||
import createConnectorBody from "./create-connector-body.json";
|
import createConnectorBody from "./create-connector-body.json";
|
||||||
import customerCreateBody from "./create-customer-body.json";
|
import customerCreateBody from "./create-customer-body.json";
|
||||||
@ -20,7 +20,6 @@ import routingConfigBody from "./routing-config-body.json";
|
|||||||
import saveCardConfirmBody from "./save-card-confirm-body.json";
|
import saveCardConfirmBody from "./save-card-confirm-body.json";
|
||||||
import sessionTokenBody from "./session-token.json";
|
import sessionTokenBody from "./session-token.json";
|
||||||
import apiKeyUpdateBody from "./update-api-key-body.json";
|
import apiKeyUpdateBody from "./update-api-key-body.json";
|
||||||
import updateBusinessProfile from "./update-business-profile.json";
|
|
||||||
import updateConnectorBody from "./update-connector-body.json";
|
import updateConnectorBody from "./update-connector-body.json";
|
||||||
import customerUpdateBody from "./update-customer-body.json";
|
import customerUpdateBody from "./update-customer-body.json";
|
||||||
import voidBody from "./void-payment-body.json";
|
import voidBody from "./void-payment-body.json";
|
||||||
@ -29,11 +28,11 @@ import ntidConfirmBody from "./create-ntid-mit.json";
|
|||||||
export {
|
export {
|
||||||
apiKeyCreateBody,
|
apiKeyCreateBody,
|
||||||
apiKeyUpdateBody,
|
apiKeyUpdateBody,
|
||||||
|
businessProfile,
|
||||||
captureBody,
|
captureBody,
|
||||||
citConfirmBody,
|
citConfirmBody,
|
||||||
configs,
|
configs,
|
||||||
confirmBody,
|
confirmBody,
|
||||||
createBusinessProfile,
|
|
||||||
createConfirmPaymentBody,
|
createConfirmPaymentBody,
|
||||||
createConnectorBody,
|
createConnectorBody,
|
||||||
createPaymentBody,
|
createPaymentBody,
|
||||||
@ -51,7 +50,6 @@ export {
|
|||||||
routingConfigBody,
|
routingConfigBody,
|
||||||
saveCardConfirmBody,
|
saveCardConfirmBody,
|
||||||
sessionTokenBody,
|
sessionTokenBody,
|
||||||
updateBusinessProfile,
|
|
||||||
updateConnectorBody,
|
updateConnectorBody,
|
||||||
voidBody,
|
voidBody,
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"is_connector_agnostic_mit_enabled": true
|
|
||||||
}
|
|
||||||
@ -196,9 +196,25 @@ Cypress.Commands.add(
|
|||||||
|
|
||||||
Cypress.Commands.add(
|
Cypress.Commands.add(
|
||||||
"UpdateBusinessProfileTest",
|
"UpdateBusinessProfileTest",
|
||||||
(updateBusinessProfile, is_connector_agnostic_mit_enabled, globalState) => {
|
(
|
||||||
|
updateBusinessProfile,
|
||||||
|
is_connector_agnostic_mit_enabled,
|
||||||
|
collect_billing_details_from_wallet_connector,
|
||||||
|
collect_shipping_details_from_wallet_connector,
|
||||||
|
always_collect_billing_details_from_wallet_connector,
|
||||||
|
always_collect_shipping_details_from_wallet_connector,
|
||||||
|
globalState
|
||||||
|
) => {
|
||||||
updateBusinessProfile.is_connector_agnostic_mit_enabled =
|
updateBusinessProfile.is_connector_agnostic_mit_enabled =
|
||||||
is_connector_agnostic_mit_enabled;
|
is_connector_agnostic_mit_enabled;
|
||||||
|
updateBusinessProfile.collect_shipping_details_from_wallet_connector =
|
||||||
|
collect_shipping_details_from_wallet_connector;
|
||||||
|
updateBusinessProfile.collect_billing_details_from_wallet_connector =
|
||||||
|
collect_billing_details_from_wallet_connector;
|
||||||
|
updateBusinessProfile.always_collect_billing_details_from_wallet_connector =
|
||||||
|
always_collect_billing_details_from_wallet_connector;
|
||||||
|
updateBusinessProfile.always_collect_shipping_details_from_wallet_connector =
|
||||||
|
always_collect_shipping_details_from_wallet_connector;
|
||||||
const merchant_id = globalState.get("merchantId");
|
const merchant_id = globalState.get("merchantId");
|
||||||
const profile_id = globalState.get("profileId");
|
const profile_id = globalState.get("profileId");
|
||||||
cy.request({
|
cy.request({
|
||||||
@ -213,6 +229,24 @@ Cypress.Commands.add(
|
|||||||
failOnStatusCode: false,
|
failOnStatusCode: false,
|
||||||
}).then((response) => {
|
}).then((response) => {
|
||||||
logRequestId(response.headers["x-request-id"]);
|
logRequestId(response.headers["x-request-id"]);
|
||||||
|
if (response.status === 200) {
|
||||||
|
globalState.set(
|
||||||
|
"collectBillingDetails",
|
||||||
|
response.body.collect_billing_details_from_wallet_connector
|
||||||
|
);
|
||||||
|
globalState.set(
|
||||||
|
"collectShippingDetails",
|
||||||
|
response.body.collect_shipping_details_from_wallet_connector
|
||||||
|
);
|
||||||
|
globalState.set(
|
||||||
|
"alwaysCollectBillingDetails",
|
||||||
|
response.body.always_collect_billing_details_from_wallet_connector
|
||||||
|
);
|
||||||
|
globalState.set(
|
||||||
|
"alwaysCollectShippingDetails",
|
||||||
|
response.body.always_collect_shipping_details_from_wallet_connector
|
||||||
|
);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -1001,6 +1035,33 @@ Cypress.Commands.add("paymentMethodsCallTest", (globalState) => {
|
|||||||
expect(response.headers["content-type"]).to.include("application/json");
|
expect(response.headers["content-type"]).to.include("application/json");
|
||||||
expect(response.body).to.have.property("redirect_url");
|
expect(response.body).to.have.property("redirect_url");
|
||||||
expect(response.body).to.have.property("payment_methods");
|
expect(response.body).to.have.property("payment_methods");
|
||||||
|
if (
|
||||||
|
globalState.get("collectBillingDetails") === true ||
|
||||||
|
globalState.get("alwaysCollectBillingDetails") === true
|
||||||
|
) {
|
||||||
|
expect(
|
||||||
|
response.body.collect_billing_details_from_wallets,
|
||||||
|
"collectBillingDetailsFromWallets"
|
||||||
|
).to.be.true;
|
||||||
|
} else
|
||||||
|
expect(
|
||||||
|
response.body.collect_billing_details_from_wallets,
|
||||||
|
"collectBillingDetailsFromWallets"
|
||||||
|
).to.be.false;
|
||||||
|
|
||||||
|
if (
|
||||||
|
globalState.get("collectShippingDetails") === true ||
|
||||||
|
globalState.get("alwaysCollectShippingDetails") === true
|
||||||
|
) {
|
||||||
|
expect(
|
||||||
|
response.body.collect_shipping_details_from_wallets,
|
||||||
|
"collectShippingDetailsFromWallets"
|
||||||
|
).to.be.true;
|
||||||
|
} else
|
||||||
|
expect(
|
||||||
|
response.body.collect_shipping_details_from_wallets,
|
||||||
|
"collectShippingDetailsFromWallets"
|
||||||
|
).to.be.false;
|
||||||
globalState.set("paymentID", paymentIntentID);
|
globalState.set("paymentID", paymentIntentID);
|
||||||
cy.log(response);
|
cy.log(response);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user