Skip to content

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

ci(cypress): add raw payment method details coverage for modular PM service (#13076)

likhinbopannade6b682e24d0
diff --git a/cypress-tests/cypress/e2e/spec/ModularPmService/0000-CoreFlows.cy.js b/cypress-tests/cypress/e2e/spec/ModularPmService/0000-CoreFlows.cy.js
index 0f41a0e84b..20505369ad 100644
--- a/cypress-tests/cypress/e2e/spec/ModularPmService/0000-CoreFlows.cy.js
+++ b/cypress-tests/cypress/e2e/spec/ModularPmService/0000-CoreFlows.cy.js
@@ -52,6 +52,10 @@ describe("Core flows", () => {
cy.paymentMethodCreateCall(globalState, fixtures.paymentMethodCreate);
});
+ it("Modular PM Service - Get Raw Payment Method Details call", () => {
+ cy.getRawPaymentMethodDetailsCall(globalState);
+ });
+
it("Modular PM Service - Payments call with pm_id", () => {
cy.paymentWithSavedPMCall(
globalState,
diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.js
index 19349581ce..d34279f34d 100644
--- a/cypress-tests/cypress/support/commands.js
+++ b/cypress-tests/cypress/support/commands.js
@@ -7644,6 +7644,43 @@ Cypress.Commands.add("paymentMethodCreateCall", (globalState, pmData) => {
});
});
+Cypress.Commands.add("getRawPaymentMethodDetailsCall", (globalState) => {
+ const apiKey = globalState.get("apiKey");
+ const profileId = globalState.get("profileId");
+ const paymentMethodId = globalState.get("paymentMethodId");
+
+ cy.request({
+ method: "GET",
+ url: `${globalState.get("pmServiceUrl")}/v1/payment-methods/${paymentMethodId}?fetch_raw_detail=true`,
+ headers: {
+ "Content-Type": "application/json",
+ Accept: "application/json",
+ "X-Profile-Id": profileId,
+ Authorization: `api-key=${apiKey}`,
+ },
+ failOnStatusCode: false,
+ }).then((response) => {
+ if (response.status === 200) {
+ expect(response.body).to.have.property("id");
+ expect(response.body.id).to.equal(paymentMethodId);
+ expect(response.body).to.have.property("payment_method_type");
+ expect(response.body).to.have.property("payment_method_subtype");
+ expect(response.body).to.have.property("payment_method_data");
+ const card = response.body.payment_method_data.card;
+ expect(card).to.have.property("last4_digits");
+ expect(card).to.have.property("expiry_month");
+ expect(card).to.have.property("expiry_year");
+ expect(card).to.have.property("card_holder_name");
+ expect(card).to.have.property("saved_to_locker");
+ expect(card.saved_to_locker).to.be.true;
+ } else {
+ throw new Error(
+ `Get raw payment method details failed with status ${response.status}: ${JSON.stringify(response.body)}`
+ );
+ }
+ });
+});
+
Cypress.Commands.add("updateSavedPMCall", (globalState, updateData) => {
const apiKey = globalState.get("apiKey");
const profileId = globalState.get("profileId");