mirror of
https://github.com/juspay/hyperswitch.git
synced 2026-03-13 09:02:06 +08:00
chore(cypress): run formatter and address lints
This commit is contained in:
@@ -184,8 +184,14 @@ describe("Platform Setup & Connected Merchant Onboarding", () => {
|
||||
"merchant_account_type",
|
||||
"standard"
|
||||
);
|
||||
globalState.set("standardMerchantId_PlatformKey", response.body.merchant_id);
|
||||
globalState.set("profileId_SM_PlatformKey", response.body.default_profile);
|
||||
globalState.set(
|
||||
"standardMerchantId_PlatformKey",
|
||||
response.body.merchant_id
|
||||
);
|
||||
globalState.set(
|
||||
"profileId_SM_PlatformKey",
|
||||
response.body.default_profile
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -198,7 +204,10 @@ describe("Platform Setup & Connected Merchant Onboarding", () => {
|
||||
const savedMerchantId = globalState.get("merchantId");
|
||||
const savedApiKey = globalState.get("apiKey");
|
||||
const savedAdminApiKey = globalState.get("adminApiKey");
|
||||
globalState.set("merchantId", globalState.get("standardMerchantId_PlatformKey"));
|
||||
globalState.set(
|
||||
"merchantId",
|
||||
globalState.get("standardMerchantId_PlatformKey")
|
||||
);
|
||||
globalState.set("adminApiKey", savedApiKey);
|
||||
|
||||
cy.apiKeyCreateTest(fixtures.apiKeyCreateBody, globalState);
|
||||
@@ -244,7 +253,8 @@ describe("Platform Setup & Connected Merchant Onboarding", () => {
|
||||
expect(sm.merchant_account_type).to.equal("standard");
|
||||
|
||||
const smPlatformKey = response.body.find(
|
||||
(m) => m.merchant_id === globalState.get("standardMerchantId_PlatformKey")
|
||||
(m) =>
|
||||
m.merchant_id === globalState.get("standardMerchantId_PlatformKey")
|
||||
);
|
||||
expect(smPlatformKey).to.exist;
|
||||
expect(smPlatformKey.merchant_account_type).to.equal("standard");
|
||||
|
||||
@@ -42,7 +42,10 @@ describe("Profile Setup for Merchants", () => {
|
||||
globalState.set("merchantId", globalState.get("connectedMerchantId_1"));
|
||||
globalState.set("apiKey", globalState.get("apiKey_CM1"));
|
||||
|
||||
cy.createBusinessProfileTest(fixtures.businessProfile.bpCreate, globalState);
|
||||
cy.createBusinessProfileTest(
|
||||
fixtures.businessProfile.bpCreate,
|
||||
globalState
|
||||
);
|
||||
|
||||
cy.then(() => {
|
||||
globalState.set("profileId_CM1_New", globalState.get("profileId"));
|
||||
@@ -102,7 +105,10 @@ describe("Profile Setup for Merchants", () => {
|
||||
globalState.set("merchantId", globalState.get("standardMerchantId"));
|
||||
globalState.set("apiKey", globalState.get("apiKey_SM"));
|
||||
|
||||
cy.createBusinessProfileTest(fixtures.businessProfile.bpCreate, globalState);
|
||||
cy.createBusinessProfileTest(
|
||||
fixtures.businessProfile.bpCreate,
|
||||
globalState
|
||||
);
|
||||
|
||||
cy.then(() => {
|
||||
globalState.set("profileId_SM_New", globalState.get("profileId"));
|
||||
|
||||
@@ -166,10 +166,7 @@ describe("Connector Setup for Connected Merchants", () => {
|
||||
|
||||
globalState.set("merchantId", globalState.get("standardMerchantId"));
|
||||
globalState.set("apiKey", globalState.get("apiKey_SM"));
|
||||
globalState.set(
|
||||
"merchantConnectorId",
|
||||
globalState.get("connectorId_SM")
|
||||
);
|
||||
globalState.set("merchantConnectorId", globalState.get("connectorId_SM"));
|
||||
globalState.set("connectorId", "stripe");
|
||||
|
||||
cy.connectorRetrieveCall(globalState);
|
||||
@@ -190,7 +187,6 @@ describe("Connector Setup for Connected Merchants", () => {
|
||||
|
||||
expect(connectorIdCM1).to.not.equal(connectorIdCM2);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
context("Platform Merchant Cannot Create Connector", () => {
|
||||
|
||||
@@ -114,108 +114,111 @@ describe("Platform Customer Flows", () => {
|
||||
});
|
||||
});
|
||||
|
||||
context("Standard Merchant Creates Customer - Only Accessible by Standard", () => {
|
||||
it("standard-merchant-creates-customer", () => {
|
||||
const savedApiKey = globalState.get("apiKey");
|
||||
const savedMerchantId = globalState.get("merchantId");
|
||||
globalState.set("apiKey", globalState.get("apiKey_SM"));
|
||||
globalState.set("merchantId", globalState.get("standardMerchantId"));
|
||||
context(
|
||||
"Standard Merchant Creates Customer - Only Accessible by Standard",
|
||||
() => {
|
||||
it("standard-merchant-creates-customer", () => {
|
||||
const savedApiKey = globalState.get("apiKey");
|
||||
const savedMerchantId = globalState.get("merchantId");
|
||||
globalState.set("apiKey", globalState.get("apiKey_SM"));
|
||||
globalState.set("merchantId", globalState.get("standardMerchantId"));
|
||||
|
||||
cy.createCustomerCallTest(fixtures.customerCreateBody, globalState);
|
||||
cy.createCustomerCallTest(fixtures.customerCreateBody, globalState);
|
||||
|
||||
cy.then(() => {
|
||||
globalState.set(
|
||||
"customerId_SM_Created",
|
||||
globalState.get("customerId")
|
||||
);
|
||||
globalState.set("apiKey", savedApiKey);
|
||||
globalState.set("merchantId", savedMerchantId);
|
||||
});
|
||||
});
|
||||
|
||||
it("verify-platform-merchant-cannot-access-standard-customer", () => {
|
||||
const savedApiKey = globalState.get("apiKey");
|
||||
const savedCustomerId = globalState.get("customerId");
|
||||
globalState.set("customerId", globalState.get("customerId_SM_Created"));
|
||||
|
||||
cy.request({
|
||||
method: "GET",
|
||||
url: `${globalState.get("baseUrl")}/customers/${globalState.get("customerId")}`,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"api-key": globalState.get("apiKey"),
|
||||
},
|
||||
failOnStatusCode: false,
|
||||
}).then((response) => {
|
||||
expect(response.status).to.equal(404);
|
||||
cy.then(() => {
|
||||
globalState.set(
|
||||
"customerId_SM_Created",
|
||||
globalState.get("customerId")
|
||||
);
|
||||
globalState.set("apiKey", savedApiKey);
|
||||
globalState.set("merchantId", savedMerchantId);
|
||||
});
|
||||
});
|
||||
|
||||
cy.then(() => {
|
||||
globalState.set("apiKey", savedApiKey);
|
||||
globalState.set("customerId", savedCustomerId);
|
||||
});
|
||||
});
|
||||
it("verify-platform-merchant-cannot-access-standard-customer", () => {
|
||||
const savedApiKey = globalState.get("apiKey");
|
||||
const savedCustomerId = globalState.get("customerId");
|
||||
globalState.set("customerId", globalState.get("customerId_SM_Created"));
|
||||
|
||||
it("verify-connected-merchant-1-cannot-access-standard-customer", () => {
|
||||
const savedApiKey = globalState.get("apiKey");
|
||||
const savedCustomerId = globalState.get("customerId");
|
||||
globalState.set("apiKey", globalState.get("apiKey_CM1"));
|
||||
globalState.set("customerId", globalState.get("customerId_SM_Created"));
|
||||
cy.request({
|
||||
method: "GET",
|
||||
url: `${globalState.get("baseUrl")}/customers/${globalState.get("customerId")}`,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"api-key": globalState.get("apiKey"),
|
||||
},
|
||||
failOnStatusCode: false,
|
||||
}).then((response) => {
|
||||
expect(response.status).to.equal(404);
|
||||
});
|
||||
|
||||
cy.request({
|
||||
method: "GET",
|
||||
url: `${globalState.get("baseUrl")}/customers/${globalState.get("customerId")}`,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"api-key": globalState.get("apiKey"),
|
||||
},
|
||||
failOnStatusCode: false,
|
||||
}).then((response) => {
|
||||
expect(response.status).to.equal(404);
|
||||
cy.then(() => {
|
||||
globalState.set("apiKey", savedApiKey);
|
||||
globalState.set("customerId", savedCustomerId);
|
||||
});
|
||||
});
|
||||
|
||||
cy.then(() => {
|
||||
globalState.set("apiKey", savedApiKey);
|
||||
globalState.set("customerId", savedCustomerId);
|
||||
});
|
||||
});
|
||||
it("verify-connected-merchant-1-cannot-access-standard-customer", () => {
|
||||
const savedApiKey = globalState.get("apiKey");
|
||||
const savedCustomerId = globalState.get("customerId");
|
||||
globalState.set("apiKey", globalState.get("apiKey_CM1"));
|
||||
globalState.set("customerId", globalState.get("customerId_SM_Created"));
|
||||
|
||||
it("verify-connected-merchant-2-cannot-access-standard-customer", () => {
|
||||
const savedApiKey = globalState.get("apiKey");
|
||||
const savedCustomerId = globalState.get("customerId");
|
||||
globalState.set("apiKey", globalState.get("apiKey_CM2"));
|
||||
globalState.set("customerId", globalState.get("customerId_SM_Created"));
|
||||
cy.request({
|
||||
method: "GET",
|
||||
url: `${globalState.get("baseUrl")}/customers/${globalState.get("customerId")}`,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"api-key": globalState.get("apiKey"),
|
||||
},
|
||||
failOnStatusCode: false,
|
||||
}).then((response) => {
|
||||
expect(response.status).to.equal(404);
|
||||
});
|
||||
|
||||
cy.request({
|
||||
method: "GET",
|
||||
url: `${globalState.get("baseUrl")}/customers/${globalState.get("customerId")}`,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"api-key": globalState.get("apiKey"),
|
||||
},
|
||||
failOnStatusCode: false,
|
||||
}).then((response) => {
|
||||
expect(response.status).to.equal(404);
|
||||
cy.then(() => {
|
||||
globalState.set("apiKey", savedApiKey);
|
||||
globalState.set("customerId", savedCustomerId);
|
||||
});
|
||||
});
|
||||
|
||||
cy.then(() => {
|
||||
globalState.set("apiKey", savedApiKey);
|
||||
globalState.set("customerId", savedCustomerId);
|
||||
it("verify-connected-merchant-2-cannot-access-standard-customer", () => {
|
||||
const savedApiKey = globalState.get("apiKey");
|
||||
const savedCustomerId = globalState.get("customerId");
|
||||
globalState.set("apiKey", globalState.get("apiKey_CM2"));
|
||||
globalState.set("customerId", globalState.get("customerId_SM_Created"));
|
||||
|
||||
cy.request({
|
||||
method: "GET",
|
||||
url: `${globalState.get("baseUrl")}/customers/${globalState.get("customerId")}`,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"api-key": globalState.get("apiKey"),
|
||||
},
|
||||
failOnStatusCode: false,
|
||||
}).then((response) => {
|
||||
expect(response.status).to.equal(404);
|
||||
});
|
||||
|
||||
cy.then(() => {
|
||||
globalState.set("apiKey", savedApiKey);
|
||||
globalState.set("customerId", savedCustomerId);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it("verify-standard-merchant-can-access-its-own-customer", () => {
|
||||
const savedApiKey = globalState.get("apiKey");
|
||||
const savedCustomerId = globalState.get("customerId");
|
||||
globalState.set("apiKey", globalState.get("apiKey_SM"));
|
||||
globalState.set("customerId", globalState.get("customerId_SM_Created"));
|
||||
it("verify-standard-merchant-can-access-its-own-customer", () => {
|
||||
const savedApiKey = globalState.get("apiKey");
|
||||
const savedCustomerId = globalState.get("customerId");
|
||||
globalState.set("apiKey", globalState.get("apiKey_SM"));
|
||||
globalState.set("customerId", globalState.get("customerId_SM_Created"));
|
||||
|
||||
cy.customerRetrieveCall(globalState);
|
||||
cy.customerRetrieveCall(globalState);
|
||||
|
||||
cy.then(() => {
|
||||
globalState.set("apiKey", savedApiKey);
|
||||
globalState.set("customerId", savedCustomerId);
|
||||
cy.then(() => {
|
||||
globalState.set("apiKey", savedApiKey);
|
||||
globalState.set("customerId", savedCustomerId);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user