Skip to content

Commit

Permalink
add pml tests for novalnet
Browse files Browse the repository at this point in the history
  • Loading branch information
cookieg13 committed Nov 12, 2024
1 parent 20a3a1c commit e9a3720
Show file tree
Hide file tree
Showing 2 changed files with 103 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
card_credit_enabled,
card_credit_enabled_in_US,
card_credit_enabled_in_USD,
card_credit_enabled_in_EUR,
create_payment_body_with_currency,
create_payment_body_with_currency_country,
} from "../PaymentMethodListUtils/Commons";
Expand Down Expand Up @@ -577,4 +578,85 @@ describe("Payment Method list using Constraint Graph flow tests", () => {
});
}
);
});


context(
`
MCA1 -> Stripe configured with credit = { currency = "USD" }\n
MCA2 -> Novalnet configured with credit = { currency = "EUR" }\n
Payment is done with currency as as USD and no billing address\n
The resultant Payment Method list should only have credit with stripe\n
`,
() => {
before("seed global state", () => {
cy.task("getGlobalState").then((state) => {
globalState = new State(state);
});
});

after("flush global state", () => {
cy.task("setGlobalState", globalState.data);
});

it("merchant-create-call-test", () => {
cy.merchantCreateCallTest(merchantCreateBody, globalState);
});

it("api-key-create-call-test", () => {
cy.apiKeyCreateTest(apiKeyCreateBody, globalState);
});

// stripe connector create with card credit enabled in USD
it("connector-create-call-test", () => {
cy.createNamedConnectorCallTest(
"payment_processor",
createConnectorBody,
card_credit_enabled_in_USD,
globalState,
"stripe",
"stripe_US_default"
);
});

// novalnet connector create with card credit enabled in EUR
it("connector-create-call-test", () => {
cy.createNamedConnectorCallTest(
"payment_processor",
createConnectorBody,
card_credit_enabled_in_EUR,
globalState,
"novalnet",
"novalnet_DE_default"
);
});

// creating payment with currency as USD and no billing address
it("create-payment-call-test", () => {
let data = getConnectorDetails("stripe")["pm_list"]["PaymentIntent"];
let req_data = data["RequestCurrencyUSD"];
let res_data = data["Response"];

cy.createPaymentIntentTest(
create_payment_body_with_currency("USD","US","US"),
req_data,
res_data,
"no_three_ds",
"automatic",
globalState
);
});

// payment method list should only have credit with stripe
it("payment-method-list-call-test", () => {
let data =
getConnectorDetails("stripe")["pm_list"]["PmListResponse"][
"PmListWithCreditOneConnector"
];
cy.paymentMethodListTestLessThanEqualToOnePaymentMethod(
data,
globalState
);
});
}
);
});
20 changes: 20 additions & 0 deletions cypress-tests/cypress/e2e/PaymentMethodListUtils/Commons.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,26 @@ export const card_credit_enabled_in_US = [
},
];

export const card_credit_enabled_in_EUR = [
{
payment_method: "card",
payment_method_types: [
{
payment_method_type: "credit",
card_networks: ["Visa"],
minimum_amount: 0,
accepted_currencies: {
type: "enable_only",
list: ["EUR"],
},
maximum_amount: 68607706,
recurring_enabled: false,
installment_payment_enabled: true,
},
],
},
];

export const bank_redirect_ideal_enabled = [
{
payment_method: "bank_redirect",
Expand Down

0 comments on commit e9a3720

Please sign in to comment.