Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ci(Cypress): Enhance Cybersource Testcases #6285

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -488,4 +488,235 @@ describe("Card - SaveCard payment flow test", () => {
});
}
);

context(
"Save card for NoThreeDS automatic capture payment - create and confirm [off_session]",
() => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails

beforeEach(function () {
saveCardBody = Cypress._.cloneDeep(fixtures.saveCardConfirmBody);
if (!should_continue) {
this.skip();
}
});

it("customer-create-call-test", () => {
cy.createCustomerCallTest(fixtures.customerCreateBody, globalState);
});

it("create-payment-call-test", () => {
let data = getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
]["PaymentIntentOffSession"];
let req_data = data["Request"];
let res_data = data["Response"];
cy.createPaymentIntentTest(
fixtures.createPaymentBody,
req_data,
res_data,
"no_three_ds",
"automatic",
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
});

it("confirm-payment-call-test", () => {
let data = getConnectorDetails(globalState.get("connectorId"))[
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we send setup_future_usage: "off_session", in the confirm call, it is expected to be passed in the create call only right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We haven't passed in confirm call off_session that is only the name we kept like that. All the setup_future_usage is passed in the intent call only. If it is passed in confirm calll then it will be create+confirm(single) call.

"card_pm"
]["SaveCardUseNo3DSAutoCaptureOffSession"];
let req_data = data["Request"];
let res_data = data["Response"];
cy.confirmCallTest(
fixtures.confirmBody,
req_data,
res_data,
true,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
});

it("retrieve-payment-call-test", () => {
cy.retrievePaymentCallTest(globalState);
});

it("retrieve-customerPM-call-test", () => {
cy.listCustomerPMCallTest(globalState);
});

it("create-payment-call-test", () => {
let data = getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
]["PaymentIntentOffSession"];
let req_data = data["Request"];
let res_data = data["Response"];
cy.createPaymentIntentTest(
fixtures.createPaymentBody,
req_data,
res_data,
"no_three_ds",
"automatic",
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
});

it("confirm-save-card-payment-call-test", () => {
let data = getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
]["SaveCardConfirmAutoCaptureOffSession"];
let req_data = data["Request"];
let res_data = data["Response"];

cy.saveCardConfirmCallTest(
saveCardBody,
req_data,
res_data,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
});
}
);
context("Save card payment using existing customer[off_session]", () => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails

beforeEach(function () {
saveCardBody = Cypress._.cloneDeep(fixtures.saveCardConfirmBody);
if (!should_continue) {
this.skip();
}
});

it("retrieve-customerPM-call-test", () => {
cy.listCustomerPMCallTest(globalState);
});

it("create-payment-call-test", () => {
let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
"PaymentIntentOffSession"
];
let req_data = data["Request"];
let res_data = data["Response"];
cy.createPaymentIntentTest(
fixtures.createPaymentBody,
req_data,
res_data,
"no_three_ds",
"automatic",
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
});

it("confirm-save-card-payment-call-test", () => {
let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
"SaveCardConfirmAutoCaptureOffSession"
];
let req_data = data["Request"];
let res_data = data["Response"];

cy.saveCardConfirmCallTest(saveCardBody, req_data, res_data, globalState);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
});
});
context(
"Use billing address from payment method during subsequent payment[off_session]",
() => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails

beforeEach(function () {
saveCardBody = Cypress._.cloneDeep(fixtures.saveCardConfirmBody);
if (!should_continue) {
this.skip();
}
});

it("customer-create-call-test", () => {
cy.createCustomerCallTest(fixtures.customerCreateBody, globalState);
});

it("create-payment-call-test", () => {
let data = getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
]["PaymentIntentOffSession"];
let req_data = data["Request"];
let res_data = data["Response"];
cy.createPaymentIntentTest(
fixtures.createPaymentBody,
req_data,
res_data,
"no_three_ds",
"automatic",
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
});

it("confirm-payment-call-test", () => {
let data = getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
]["SaveCardUseNo3DSAutoCaptureOffSession"];
let req_data = data["Request"];
let res_data = data["Response"];
cy.confirmCallTest(
fixtures.confirmBody,
req_data,
res_data,
true,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
});

it("retrieve-customerPM-call-test", () => {
cy.listCustomerPMCallTest(globalState);
});

it("create-payment-call-test", () => {
let data = getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
]["PaymentIntentOffSession"];
let req_data = data["Request"];
let res_data = data["Response"];
cy.createPaymentIntentTest(
fixtures.createPaymentBody,
req_data,
res_data,
"no_three_ds",
"automatic",
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
});

it("confirm-save-card-payment-call-test-without-billing", () => {
let data = getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
]["SaveCardConfirmAutoCaptureOffSessionWithoutBilling"];
let req_data = data["Request"];
let res_data = data["Response"];

cy.saveCardConfirmCallTest(
saveCardBody,
req_data,
res_data,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
});
}
);
});
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,92 @@ describe("Card - SingleUse Mandates flow test", () => {
});
}
);

context("Card - Zero Auth Payment", () => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails

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

it("Create No 3DS Payment Intent", () => {
let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
"ZeroAuthPaymentIntent"
];
let req_data = data["Request"];
let res_data = data["Response"];
cy.createPaymentIntentTest(
fixtures.createPaymentBody,
req_data,
res_data,
"no_three_ds",
"automatic",
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
});

it("Confirm No 3DS payment", () => {
let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
"ZeroAuthConfirmPayment"
];
let req_data = data["Request"];
let res_data = data["Response"];
cy.confirmCallTest(
fixtures.confirmBody,
req_data,
res_data,
true,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
});

it("Retrieve Payment Call Test", () => {
cy.retrievePaymentCallTest(globalState);
});

it("Retrieve CustomerPM Call Test", () => {
cy.listCustomerPMCallTest(globalState);
});

it("Create Recurring Payment Intent", () => {
let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
"PaymentIntentOffSession"
];
let req_data = data["Request"];
let res_data = data["Response"];
cy.createPaymentIntentTest(
fixtures.createPaymentBody,
req_data,
res_data,
"no_three_ds",
"automatic",
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
});

it("Confirm Recurring Payment", () => {
let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
"SaveCardConfirmAutoCaptureOffSession"
];
let req_data = data["Request"];
let res_data = data["Response"];

cy.saveCardConfirmCallTest(
fixtures.saveCardConfirmBody,
req_data,
res_data,
globalState
);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
});
});
});
Loading
Loading