ci(cypress): Added 3DS Refund flow (#4635)

Co-authored-by: preetam revankar <preetam.revankar@preetam.revankar-MacBookPro>
This commit is contained in:
preetamrevankar
2024-05-15 16:44:04 +05:30
committed by GitHub
parent 3cf840e486
commit e79524b295
6 changed files with 320 additions and 4 deletions

View File

@ -342,3 +342,318 @@ describe("Card - Refund flow test", () => {
});
});
context("Card - Full Refund flow test for 3DS", () => {
it("create-payment-call-test", () => {
let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
cy.createPaymentIntentTest(createPaymentBody, det, "three_ds", "automatic", globalState);
});
it("payment_methods-call-test", () => {
cy.paymentMethodsCallTest(globalState);
});
it("Confirm 3DS", () => {
let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
cy.task('cli_log', "GLOBAL STATE -> " + JSON.stringify(globalState.data));
cy.confirmCallTest(confirmBody, det, true, globalState);
});
it("Handle redirection", () => {
let expected_redirection = confirmBody["return_url"];
cy.handleRedirection(globalState, expected_redirection);
})
it("retrieve-payment-call-test", () => {
cy.retrievePaymentCallTest(globalState);
});
it("refund-call-test", () => {
let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
cy.refundCallTest(refundBody, 6500, det, globalState);
});
});
context("Card - Partial Refund flow test for 3DS", () => {
it("create-payment-call-test", () => {
let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
cy.createPaymentIntentTest(createPaymentBody, det, "three_ds", "automatic", globalState);
});
it("payment_methods-call-test", () => {
cy.paymentMethodsCallTest(globalState);
});
it("Confirm 3DS", () => {
let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
cy.task('cli_log', "GLOBAL STATE -> " + JSON.stringify(globalState.data));
cy.confirmCallTest(confirmBody, det, true, globalState);
});
it("Handle redirection", () => {
let expected_redirection = confirmBody["return_url"];
cy.handleRedirection(globalState, expected_redirection);
})
it("retrieve-payment-call-test", () => {
cy.retrievePaymentCallTest(globalState);
});
it("refund-call-test", () => {
let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
cy.refundCallTest(refundBody, 1200, det, globalState);
});
it("refund-call-test", () => {
let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
cy.refundCallTest(refundBody, 1200, det, globalState);
});
});
context("Fully Refund Card-ThreeDS payment flow test Create+Confirm", () => {
it("create+confirm-payment-call-test", () => {
console.log("confirm -> " + globalState.get("connectorId"));
let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
cy.createConfirmPaymentTest( createConfirmPaymentBody, det,"three_ds", "automatic", globalState);
});
it("Handle redirection", () => {
let expected_redirection = confirmBody["return_url"];
cy.handleRedirection(globalState, expected_redirection);
})
it("retrieve-payment-call-test", () => {
cy.retrievePaymentCallTest(globalState);
});
it("refund-call-test", () => {
let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
cy.refundCallTest(refundBody, 6540, det, globalState);
});
});
context("Partially Refund Card-ThreeDS payment flow test Create+Confirm", () => {
it("create+confirm-payment-call-test", () => {
let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
cy.createConfirmPaymentTest( createConfirmPaymentBody, det,"three_ds", "automatic", globalState);
});
it("Handle redirection", () => {
let expected_redirection = confirmBody["return_url"];
cy.handleRedirection(globalState, expected_redirection);
})
it("retrieve-payment-call-test", () => {
cy.retrievePaymentCallTest(globalState);
});
it("refund-call-test", () => {
let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
cy.refundCallTest(refundBody, 3000, det, globalState);
});
it("refund-call-test", () => {
let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
cy.refundCallTest(refundBody, 3000, det, globalState);
});
it("sync-refund-call-test", () => {
let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
cy.syncRefundCallTest(det, globalState);
});
});
context("Card - Full Refund for fully captured 3DS payment", () => {
it("create-payment-call-test", () => {
let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
cy.createPaymentIntentTest(createPaymentBody, det, "three_ds", "manual", globalState);
});
it("payment_methods-call-test", () => {
cy.paymentMethodsCallTest(globalState);
});
it("confirm-call-test", () => {
let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
cy.confirmCallTest(confirmBody, det, true, globalState);
});
it("Handle redirection", () => {
let expected_redirection = confirmBody["return_url"];
cy.handleRedirection(globalState, expected_redirection);
})
it("retrieve-payment-call-test", () => {
cy.retrievePaymentCallTest(globalState);
});
it("capture-call-test", () => {
let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
cy.captureCallTest(captureBody, 6500, det.paymentSuccessfulStatus, globalState);
});
it("retrieve-payment-call-test", () => {
cy.retrievePaymentCallTest(globalState);
});
it("refund-call-test", () => {
let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
cy.refundCallTest(refundBody, 6500, det, globalState);
});
it("sync-refund-call-test", () => {
let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
cy.syncRefundCallTest(det, globalState);
});
});
context("Card - Partial Refund for fully captured 3DS payment", () => {
it("create-payment-call-test", () => {
let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
cy.createPaymentIntentTest(createPaymentBody, det, "three_ds", "manual", globalState);
});
it("payment_methods-call-test", () => {
cy.paymentMethodsCallTest(globalState);
});
it("confirm-call-test", () => {
let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
cy.confirmCallTest(confirmBody, det, true, globalState);
});
it("Handle redirection", () => {
let expected_redirection = confirmBody["return_url"];
cy.handleRedirection(globalState, expected_redirection);
})
it("retrieve-payment-call-test", () => {
cy.retrievePaymentCallTest(globalState);
});
it("capture-call-test", () => {
let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
cy.captureCallTest(captureBody, 6500, det.paymentSuccessfulStatus, globalState);
});
it("retrieve-payment-call-test", () => {
cy.retrievePaymentCallTest(globalState);
});
it("refund-call-test", () => {
let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
cy.refundCallTest(refundBody, 5000, det, globalState);
});
it("refund-call-test", () => {
let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
cy.refundCallTest(refundBody, 500, det, globalState);
});
it("sync-refund-call-test", () => {
let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
cy.syncRefundCallTest(det, globalState);
});
});
context("Card - Full Refund for partially captured 3DS payment", () => {
it("create-payment-call-test", () => {
let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
cy.createPaymentIntentTest(createPaymentBody, det, "three_ds", "manual", globalState);
});
it("payment_methods-call-test", () => {
cy.paymentMethodsCallTest(globalState);
});
it("confirm-call-test", () => {
let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
cy.confirmCallTest(confirmBody, det, true, globalState);
});
it("Handle redirection", () => {
let expected_redirection = confirmBody["return_url"];
cy.handleRedirection(globalState, expected_redirection);
})
it("retrieve-payment-call-test", () => {
cy.retrievePaymentCallTest(globalState);
});
it("capture-call-test", () => {
let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
cy.captureCallTest(captureBody, 4000, det.paymentSuccessfulStatus, globalState);
});
it("retrieve-payment-call-test", () => {
cy.retrievePaymentCallTest(globalState);
});
it("refund-call-test", () => {
let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
cy.refundCallTest(refundBody, 4000, det, globalState);
});
it("sync-refund-call-test", () => {
let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
cy.syncRefundCallTest(det, globalState);
});
});
context("Card - partial Refund for partially captured 3DS payment", () => {
it("create-payment-call-test", () => {
let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
cy.createPaymentIntentTest(createPaymentBody, det, "three_ds", "manual", globalState);
});
it("payment_methods-call-test", () => {
cy.paymentMethodsCallTest(globalState);
});
it("confirm-call-test", () => {
let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
cy.confirmCallTest(confirmBody, det, true, globalState);
});
it("Handle redirection", () => {
let expected_redirection = confirmBody["return_url"];
cy.handleRedirection(globalState, expected_redirection);
})
it("retrieve-payment-call-test", () => {
cy.retrievePaymentCallTest(globalState);
});
it("capture-call-test", () => {
let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
cy.captureCallTest(captureBody, 4000, det.paymentSuccessfulStatus, globalState);
});
it("retrieve-payment-call-test", () => {
cy.retrievePaymentCallTest(globalState);
});
it("refund-call-test", () => {
let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
cy.refundCallTest(refundBody, 3000, det, globalState);
});
it("sync-refund-call-test", () => {
let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];
cy.syncRefundCallTest(det, globalState);
});
});

View File

@ -40,7 +40,7 @@ card_pm:{
"MandateSingleUse3DS": {
"card": successfulThreeDSTestCardDetails,
"currency": "USD",
"paymentSuccessfulStatus": "requires_customer_action",
"paymentSuccessfulStatus": "succeeded",
"paymentSyncStatus": "succeeded",
"refundStatus": "pending",
"refundSyncStatus": "pending",

View File

@ -39,7 +39,7 @@ card_pm:{
"MandateSingleUse3DS": {
"card": successfulThreeDSTestCardDetails,
"currency": "USD",
"paymentSuccessfulStatus": "requires_customer_action",
"paymentSuccessfulStatus": "succeeded",
"paymentSyncStatus": "succeeded",
"refundStatus": "succeeded",
"refundSyncStatus": "succeeded",

View File

@ -39,7 +39,7 @@ card_pm:{
"MandateSingleUse3DS": {
"card": successfulThreeDSTestCardDetails,
"currency": "USD",
"paymentSuccessfulStatus": "requires_customer_action",
"paymentSuccessfulStatus": "succeeded",
"paymentSyncStatus": "succeeded",
"refundStatus": "pending",
"refundSyncStatus": "pending",

View File

@ -11,7 +11,7 @@
"phone_country_code": "+65",
"description": "Its my first payment request",
"authentication_type": "no_three_ds",
"return_url": "https://duck.com",
"return_url": "https://hyperswitch.io",
"payment_method": "card",
"payment_method_type": "debit",
"payment_method_data": {

View File

@ -498,6 +498,7 @@ Cypress.Commands.add("citForMandatesCallTest", (requestBody, amount, details, co
expect(response.body).to.have.property("next_action")
.to.have.property("redirect_to_url");
const nextActionUrl = response.body.next_action.redirect_to_url;
globalState.set("nextActionUrl", response.body.next_action.redirect_to_url);
cy.log(response.body);
cy.log(nextActionUrl);
} else if (response.body.authentication_type === "no_three_ds") {