Skip to content

Commit

Permalink
ci(cypress): Add shipping cost test case (#6779)
Browse files Browse the repository at this point in the history
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
  • Loading branch information
likhinbopanna and hyperswitch-bot[bot] authored Dec 10, 2024
1 parent 9f0d8ef commit 08ab3ad
Show file tree
Hide file tree
Showing 13 changed files with 419 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,52 @@ describe("Card - NoThreeDS payment flow test", () => {
cy.retrievePaymentCallTest(globalState, data);
});
});

context("Card-NoThreeDS payment with shipping cost", () => {
let shouldContinue = true; // variable that will be used to skip tests if a previous test fails

beforeEach(function () {
if (!shouldContinue) {
this.skip();
}
});

it("create-payment-call-test", () => {
const data = getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
]["PaymentIntentWithShippingCost"];

cy.createPaymentIntentTest(
fixtures.createPaymentBody,
data,
"no_three_ds",
"automatic",
globalState
);

if (shouldContinue) shouldContinue = utils.should_continue_further(data);
});

it("payment_methods-call-test", () => {
cy.paymentMethodsCallTest(globalState);
});

it("Confirm No 3DS", () => {
const data = getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
]["PaymentConfirmWithShippingCost"];

cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);

if (shouldContinue) shouldContinue = utils.should_continue_further(data);
});

it("retrieve-payment-call-test", () => {
const data = getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
]["PaymentConfirmWithShippingCost"];

cy.retrievePaymentCallTest(globalState, data);
});
});
});
34 changes: 34 additions & 0 deletions cypress-tests/cypress/e2e/PaymentUtils/Adyen.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,40 @@ export const connectorDetails = {
},
},
},
PaymentIntentWithShippingCost: {
Request: {
currency: "USD",
shipping_cost: 50,
},
Response: {
status: 200,
body: {
status: "requires_payment_method",
shipping_cost: 50,
amount: 6500,
},
},
},
PaymentConfirmWithShippingCost: {
Request: {
payment_method: "card",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
customer_acceptance: null,
setup_future_usage: "on_session",
},
Response: {
status: 200,
body: {
status: "succeeded",
shipping_cost: 50,
amount_received: 6550,
amount: 6500,
net_amount: 6550,
},
},
},
"3DSManualCapture": {
Request: {
payment_method: "card",
Expand Down
34 changes: 34 additions & 0 deletions cypress-tests/cypress/e2e/PaymentUtils/BankOfAmerica.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,40 @@ export const connectorDetails = {
},
},
},
PaymentIntentWithShippingCost: {
Request: {
currency: "USD",
shipping_cost: 50,
},
Response: {
status: 200,
body: {
status: "requires_payment_method",
amount: 6500,
shipping_cost: 50,
},
},
},
PaymentConfirmWithShippingCost: {
Request: {
payment_method: "card",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
customer_acceptance: null,
setup_future_usage: "on_session",
},
Response: {
status: 200,
body: {
status: "succeeded",
shipping_cost: 50,
amount_received: 6550,
amount: 6500,
net_amount: 6550,
},
},
},
"3DSManualCapture": {
Request: {
payment_method: "card",
Expand Down
35 changes: 35 additions & 0 deletions cypress-tests/cypress/e2e/PaymentUtils/Bluesnap.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,41 @@ export const connectorDetails = {
},
},
},
PaymentIntentWithShippingCost: {
Request: {
currency: "USD",
amount: 6500,
shipping_cost: 50,
},
Response: {
status: 200,
body: {
status: "requires_payment_method",
amount: 6500,
shipping_cost: 50,
},
},
},
PaymentConfirmWithShippingCost: {
Request: {
payment_method: "card",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
customer_acceptance: null,
setup_future_usage: "on_session",
},
Response: {
status: 200,
body: {
status: "succeeded",
shipping_cost: 50,
amount_received: 6550,
amount: 6500,
net_amount: 6550,
},
},
},
"3DSManualCapture": {
Configs: {
TRIGGER_SKIP: true,
Expand Down
32 changes: 32 additions & 0 deletions cypress-tests/cypress/e2e/PaymentUtils/Checkout.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,38 @@ export const connectorDetails = {
},
},
},
PaymentIntentWithShippingCost: {
Request: {
currency: "USD",
shipping_cost: 50,
},
Response: {
status: 200,
body: {
status: "requires_payment_method",
shipping_cost: 50,
amount: 6500,
},
},
},
PaymentConfirmWithShippingCost: {
Request: {
payment_method: "card",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
customer_acceptance: null,
setup_future_usage: "on_session",
},
Response: {
status: 200,
body: {
status: "processing",
shipping_cost: 50,
amount: 6500,
},
},
},
"3DSManualCapture": {
Request: {
payment_method: "card",
Expand Down
26 changes: 26 additions & 0 deletions cypress-tests/cypress/e2e/PaymentUtils/Commons.js
Original file line number Diff line number Diff line change
Expand Up @@ -637,9 +637,35 @@ export const connectorDetails = {
status: 200,
body: {
status: "requires_payment_method",
shipping_cost: 50,
amount: 6500,
},
},
}),
PaymentIntentWithShippingCost: getCustomExchange({
Request: {
currency: "USD",
shipping_cost: 50,
},
Response: {
status: 200,
body: {
status: "requires_payment_method",
shipping_cost: 50,
amount: 6500,
},
},
}),
PaymentConfirmWithShippingCost: getCustomExchange({
Request: {
payment_method: "card",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
customer_acceptance: null,
setup_future_usage: "on_session",
},
}),
"3DSManualCapture": getCustomExchange({
Request: {
payment_method: "card",
Expand Down
34 changes: 34 additions & 0 deletions cypress-tests/cypress/e2e/PaymentUtils/Cybersource.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,40 @@ export const connectorDetails = {
},
},
},
PaymentIntentWithShippingCost: {
Request: {
currency: "USD",
shipping_cost: 50,
},
Response: {
status: 200,
body: {
status: "requires_payment_method",
shipping_cost: 50,
amount: 6500,
},
},
},
PaymentConfirmWithShippingCost: {
Request: {
payment_method: "card",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
customer_acceptance: null,
setup_future_usage: "on_session",
},
Response: {
status: 200,
body: {
status: "succeeded",
shipping_cost: 50,
amount_received: 6550,
amount: 6500,
net_amount: 6550,
},
},
},
"3DSManualCapture": {
Configs: {
CONNECTOR_CREDENTIAL: {
Expand Down
32 changes: 32 additions & 0 deletions cypress-tests/cypress/e2e/PaymentUtils/Nmi.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,38 @@ export const connectorDetails = {
},
},
},
PaymentIntentWithShippingCost: {
Request: {
currency: "USD",
shipping_cost: 50,
},
Response: {
status: 200,
body: {
status: "requires_payment_method",
shipping_cost: 50,
amount: 6500,
},
},
},
PaymentConfirmWithShippingCost: {
Request: {
payment_method: "card",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
customer_acceptance: null,
setup_future_usage: "on_session",
},
Response: {
status: 200,
body: {
status: "processing",
shipping_cost: 50,
amount: 6500,
},
},
},
"3DSManualCapture": {
Request: {
payment_method: "card",
Expand Down
32 changes: 32 additions & 0 deletions cypress-tests/cypress/e2e/PaymentUtils/Noon.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,38 @@ export const connectorDetails = {
},
},
},
PaymentIntentWithShippingCost: {
Request: {
currency: "AED",
shipping_cost: 50,
},
Response: {
status: 200,
body: {
status: "requires_payment_method",
shipping_cost: 50,
amount: 6500,
},
},
},
PaymentConfirmWithShippingCost: {
Request: {
payment_method: "card",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
customer_acceptance: null,
setup_future_usage: "on_session",
},
Response: {
status: 200,
body: {
status: "requires_customer_action",
shipping_cost: 50,
amount: 6500,
},
},
},
"3DSManualCapture": {
Request: {
payment_method: "card",
Expand Down
Loading

0 comments on commit 08ab3ad

Please sign in to comment.