mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-27 19:46:48 +08:00
feat(cypress): add trustpay, adyen bank redirects and corresponding refactor (#4766)
This commit is contained in:
@ -26,6 +26,7 @@
|
||||
|
||||
// commands.js or your custom support file
|
||||
import * as RequestBodyUtils from "../utils/RequestBodyUtils";
|
||||
import { handleRedirection } from "./redirectionHandler";
|
||||
|
||||
function logRequestId(xRequestId) {
|
||||
if (xRequestId) {
|
||||
@ -35,6 +36,13 @@ function logRequestId(xRequestId) {
|
||||
}
|
||||
}
|
||||
|
||||
function defaultErrorHandler(response, response_data) {
|
||||
expect(response.body).to.have.property("error");
|
||||
for (const key in response_data.body.error) {
|
||||
expect(response_data.body.error[key]).to.equal(response.body.error[key]);
|
||||
}
|
||||
}
|
||||
|
||||
Cypress.Commands.add("merchantCreateCallTest", (merchantCreateBody, globalState) => {
|
||||
const randomMerchantId = RequestBodyUtils.generateRandomString();
|
||||
RequestBodyUtils.setMerchantId(merchantCreateBody, randomMerchantId);
|
||||
@ -171,10 +179,7 @@ Cypress.Commands.add("createPaymentIntentTest", (request, req_data, res_data, au
|
||||
expect(request.amount).to.equal(response.body.amount_capturable);
|
||||
}
|
||||
else {
|
||||
expect(response.body).to.have.property("error");
|
||||
for(const key in res_data.body.error) {
|
||||
expect(res_data.body.error[key]).to.equal(response.body.error[key]);
|
||||
}
|
||||
defaultErrorHandler(response, res_data);
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -219,7 +224,6 @@ Cypress.Commands.add("confirmCallTest", (confirmBody, req_data, res_data, confir
|
||||
body: confirmBody,
|
||||
}).then((response) => {
|
||||
logRequestId(response.headers['x-request-id']);
|
||||
|
||||
expect(res_data.status).to.equal(response.status);
|
||||
expect(response.headers["content-type"]).to.include("application/json");
|
||||
if(response.status === 200){
|
||||
@ -227,15 +231,14 @@ Cypress.Commands.add("confirmCallTest", (confirmBody, req_data, res_data, confir
|
||||
if (response.body.capture_method === "automatic") {
|
||||
if (response.body.authentication_type === "three_ds") {
|
||||
expect(response.body).to.have.property("next_action")
|
||||
.to.have.property("redirect_to_url");
|
||||
.to.have.property("redirect_to_url");
|
||||
globalState.set("nextActionUrl", response.body.next_action.redirect_to_url);
|
||||
} else if (response.body.authentication_type === "no_three_ds") {
|
||||
for(const key in res_data.body) {
|
||||
expect(res_data.body[key]).to.equal(response.body[key]);
|
||||
}
|
||||
} else {
|
||||
// Handle other authentication types as needed
|
||||
throw new Error(`Unsupported authentication type: ${authentication_type}`);
|
||||
defaultErrorHandler(response, res_data);
|
||||
}
|
||||
} else if (response.body.capture_method === "manual") {
|
||||
if (response.body.authentication_type === "three_ds") {
|
||||
@ -244,24 +247,158 @@ Cypress.Commands.add("confirmCallTest", (confirmBody, req_data, res_data, confir
|
||||
globalState.set("nextActionUrl", response.body.next_action.redirect_to_url);
|
||||
}
|
||||
else if (response.body.authentication_type === "no_three_ds") {
|
||||
for(const key in res_data.body) {
|
||||
for (const key in res_data.body) {
|
||||
expect(res_data.body[key]).to.equal(response.body[key]);
|
||||
} } else {
|
||||
// Handle other authentication types as needed
|
||||
throw new Error(`Unsupported authentication type: ${authentication_type}`);
|
||||
}
|
||||
} else {
|
||||
defaultErrorHandler(response, res_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
expect(response.body).to.have.property("error");
|
||||
for(const key in res_data.body.error) {
|
||||
expect(res_data.body.error[key]).to.equal(response.body.error[key]);
|
||||
}
|
||||
defaultErrorHandler(response, res_data);
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add(
|
||||
"confirmBankRedirectCallTest",
|
||||
(confirmBody, req_data, res_data, confirm, globalState) => {
|
||||
const paymentIntentId = globalState.get("paymentID");
|
||||
const connectorId = globalState.get("connectorId");
|
||||
for (const key in req_data) {
|
||||
confirmBody[key] = req_data[key];
|
||||
}
|
||||
confirmBody.confirm = confirm;
|
||||
confirmBody.client_secret = globalState.get("clientSecret");
|
||||
|
||||
cy.request({
|
||||
method: "POST",
|
||||
url: `${globalState.get("baseUrl")}/payments/${paymentIntentId}/confirm`,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"api-key": globalState.get("publishableKey"),
|
||||
},
|
||||
failOnStatusCode: false,
|
||||
body: confirmBody,
|
||||
}).then((response) => {
|
||||
logRequestId(response.headers["x-request-id"]);
|
||||
expect(res_data.status).to.equal(response.status);
|
||||
expect(response.headers["content-type"]).to.include("application/json");
|
||||
globalState.set("paymentID", paymentIntentId);
|
||||
globalState.set("paymentMethodType", confirmBody.payment_method_type);
|
||||
|
||||
switch (response.body.authentication_type) {
|
||||
case "three_ds":
|
||||
if (
|
||||
response.body.capture_method === "automatic" ||
|
||||
response.body.capture_method === "manual"
|
||||
) {
|
||||
if (response.body.status !== "failed") { // we get many statuses here, hence this verification
|
||||
if (connectorId === "adyen" && response.body.payment_method_type === "blik") {
|
||||
expect(response.body)
|
||||
.to.have.property("next_action")
|
||||
.to.have.property("type")
|
||||
.to.equal("wait_screen_information");
|
||||
} else {
|
||||
expect(response.body)
|
||||
.to.have.property("next_action")
|
||||
.to.have.property("redirect_to_url");
|
||||
globalState.set(
|
||||
"nextActionUrl",
|
||||
response.body.next_action.redirect_to_url
|
||||
);
|
||||
}
|
||||
} else if (response.body.status === "failed") {
|
||||
expect(response.body.error_code).to.equal(res_data.body.error_code);
|
||||
}
|
||||
} else {
|
||||
defaultErrorHandler(response, res_data);
|
||||
}
|
||||
break;
|
||||
case "no_three_ds":
|
||||
if (
|
||||
response.body.capture_method === "automatic" ||
|
||||
response.body.capture_method === "manual"
|
||||
) {
|
||||
expect(response.body)
|
||||
.to.have.property("next_action")
|
||||
.to.have.property("redirect_to_url");
|
||||
globalState.set(
|
||||
"nextActionUrl",
|
||||
response.body.next_action.redirect_to_url
|
||||
);
|
||||
} else {
|
||||
defaultErrorHandler(response, res_data);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
defaultErrorHandler(response, res_data);
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
Cypress.Commands.add(
|
||||
"confirmBankTransferCallTest",
|
||||
(confirmBody, req_data, res_data, confirm, globalState) => {
|
||||
const paymentIntentID = globalState.get("paymentID");
|
||||
for (const key in req_data) {
|
||||
confirmBody[key] = req_data[key];
|
||||
}
|
||||
confirmBody.confirm = confirm;
|
||||
confirmBody.client_secret = globalState.get("clientSecret");
|
||||
globalState.set("paymentMethodType", confirmBody.payment_method_type);
|
||||
|
||||
cy.request({
|
||||
method: "POST",
|
||||
url: `${globalState.get("baseUrl")}/payments/${paymentIntentID}/confirm`,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"api-key": globalState.get("publishableKey"),
|
||||
},
|
||||
failOnStatusCode: false,
|
||||
body: confirmBody,
|
||||
}).then((response) => {
|
||||
logRequestId(response.headers["x-request-id"]);
|
||||
expect(res_data.status).to.equal(response.status);
|
||||
expect(response.headers["content-type"]).to.include("application/json");
|
||||
globalState.set("paymentID", paymentIntentID);
|
||||
if (response.status === 200) {
|
||||
if (
|
||||
response.body.capture_method === "automatic" ||
|
||||
response.body.capture_method === "manual"
|
||||
) {
|
||||
switch (response.body.payment_method_type) {
|
||||
case "pix":
|
||||
expect(response.body)
|
||||
.to.have.property("next_action")
|
||||
.to.have.property("qr_code_url");
|
||||
globalState.set(
|
||||
"nextActionUrl", // This is intentionally kept as nextActionUrl to avoid issues during handleRedirection call,
|
||||
response.body.next_action.qr_code_url
|
||||
);
|
||||
break;
|
||||
default:
|
||||
expect(response.body)
|
||||
.to.have.property("next_action")
|
||||
.to.have.property("redirect_to_url");
|
||||
globalState.set(
|
||||
"nextActionUrl",
|
||||
response.body.next_action.redirect_to_url
|
||||
);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
defaultErrorHandler(response, res_data);
|
||||
}
|
||||
} else {
|
||||
defaultErrorHandler(response, res_data);
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
Cypress.Commands.add("createConfirmPaymentTest", (createConfirmPaymentBody, req_data, res_data, authentication_type, capture_method, globalState) => {
|
||||
createConfirmPaymentBody.payment_method_data.card = req_data.card;
|
||||
createConfirmPaymentBody.authentication_type = authentication_type;
|
||||
@ -301,8 +438,7 @@ Cypress.Commands.add("createConfirmPaymentTest", (createConfirmPaymentBody, req_
|
||||
expect(res_data.body[key]).to.equal(response.body[key]);
|
||||
}
|
||||
} else {
|
||||
// Handle other authentication types as needed
|
||||
throw new Error(`Unsupported authentication type: ${authentication_type}`);
|
||||
defaultErrorHandler(response, res_data);
|
||||
}
|
||||
}
|
||||
else if (response.body.capture_method === "manual") {
|
||||
@ -317,28 +453,24 @@ Cypress.Commands.add("createConfirmPaymentTest", (createConfirmPaymentBody, req_
|
||||
else if (response.body.authentication_type === "no_three_ds") {
|
||||
for(const key in res_data.body) {
|
||||
expect(res_data.body[key]).to.equal(response.body[key]);
|
||||
} } else {
|
||||
// Handle other authentication types as needed
|
||||
throw new Error(`Unsupported authentication type: ${authentication_type}`);
|
||||
}
|
||||
} else {
|
||||
defaultErrorHandler(response, res_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
expect(response.body).to.have.property("error");
|
||||
for(const key in res_data.body.error) {
|
||||
expect(res_data.body.error[key]).to.equal(response.body.error[key]);
|
||||
}
|
||||
defaultErrorHandler(response, res_data);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// This is consequent saved card payment confirm call test(Using payment token)
|
||||
Cypress.Commands.add("saveCardConfirmCallTest", (SaveCardConfirmBody, req_data, res_data,globalState) => {
|
||||
Cypress.Commands.add("saveCardConfirmCallTest", (saveCardConfirmBody, req_data, res_data,globalState) => {
|
||||
const paymentIntentID = globalState.get("paymentID");
|
||||
SaveCardConfirmBody.card_cvc = req_data.card.card_cvc;
|
||||
SaveCardConfirmBody.payment_token = globalState.get("paymentToken");
|
||||
SaveCardConfirmBody.client_secret = globalState.get("clientSecret");
|
||||
console.log("conf conn ->" + globalState.get("connectorId"));
|
||||
saveCardConfirmBody.card_cvc = req_data.card.card_cvc;
|
||||
saveCardConfirmBody.payment_token = globalState.get("paymentToken");
|
||||
saveCardConfirmBody.client_secret = globalState.get("clientSecret");
|
||||
cy.request({
|
||||
method: "POST",
|
||||
url: `${globalState.get("baseUrl")}/payments/${paymentIntentID}/confirm`,
|
||||
@ -347,7 +479,7 @@ Cypress.Commands.add("saveCardConfirmCallTest", (SaveCardConfirmBody, req_data,
|
||||
"api-key": globalState.get("publishableKey"),
|
||||
},
|
||||
failOnStatusCode: false,
|
||||
body: SaveCardConfirmBody,
|
||||
body: saveCardConfirmBody,
|
||||
})
|
||||
.then((response) => {
|
||||
logRequestId(response.headers['x-request-id']);
|
||||
@ -368,7 +500,7 @@ Cypress.Commands.add("saveCardConfirmCallTest", (SaveCardConfirmBody, req_data,
|
||||
expect(response.body.customer_id).to.equal(globalState.get("customerId"));
|
||||
} else {
|
||||
// Handle other authentication types as needed
|
||||
throw new Error(`Unsupported authentication type: ${authentication_type}`);
|
||||
defaultErrorHandler(response, res_data);
|
||||
}
|
||||
} else if (response.body.capture_method === "manual") {
|
||||
if (response.body.authentication_type === "three_ds") {
|
||||
@ -378,18 +510,16 @@ Cypress.Commands.add("saveCardConfirmCallTest", (SaveCardConfirmBody, req_data,
|
||||
else if (response.body.authentication_type === "no_three_ds") {
|
||||
for(const key in res_data.body) {
|
||||
expect(res_data.body[key]).to.equal(response.body[key]);
|
||||
} expect(response.body.customer_id).to.equal(globalState.get("customerId"));
|
||||
}
|
||||
expect(response.body.customer_id).to.equal(globalState.get("customerId"));
|
||||
} else {
|
||||
// Handle other authentication types as needed
|
||||
throw new Error(`Unsupported authentication type: ${authentication_type}`);
|
||||
defaultErrorHandler(response, res_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
expect(response.body).to.have.property("error");
|
||||
for(const key in res_data.body.error) {
|
||||
expect(res_data.body.error[key]).to.equal(response.body.error[key]);
|
||||
}
|
||||
defaultErrorHandler(response, res_data);
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -419,12 +549,8 @@ Cypress.Commands.add("captureCallTest", (requestBody, req_data, res_data, amount
|
||||
}
|
||||
}
|
||||
else{
|
||||
expect(response.body).to.have.property("error");
|
||||
for(const key in res_data.body.error) {
|
||||
expect(res_data.body.error[key]).to.equal(response.body.error[key]);
|
||||
}
|
||||
defaultErrorHandler(response, res_data);
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@ -450,16 +576,12 @@ Cypress.Commands.add("voidCallTest", (requestBody, req_data, res_data, globalSta
|
||||
}
|
||||
}
|
||||
else{
|
||||
expect(response.body).to.have.property("error");
|
||||
for(const key in res_data.body.error) {
|
||||
expect(res_data.body.error[key]).to.equal(response.body.error[key]);
|
||||
}
|
||||
defaultErrorHandler(response, res_data);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add("retrievePaymentCallTest", (globalState) => {
|
||||
console.log("syncpaymentID ->" + globalState.get("paymentID"));
|
||||
const payment_id = globalState.get("paymentID");
|
||||
cy.request({
|
||||
method: "GET",
|
||||
@ -476,7 +598,6 @@ Cypress.Commands.add("retrievePaymentCallTest", (globalState) => {
|
||||
expect(response.body.payment_id).to.equal(payment_id);
|
||||
expect(response.body.amount).to.equal(globalState.get("paymentAmount"));
|
||||
globalState.set("paymentID", response.body.payment_id);
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@ -506,10 +627,7 @@ Cypress.Commands.add("refundCallTest", (requestBody, req_data, res_data, refund_
|
||||
expect(response.body.payment_id).to.equal(payment_id);
|
||||
}
|
||||
else{
|
||||
expect(response.body).to.have.property("error");
|
||||
for(const key in res_data.body.error) {
|
||||
expect(res_data.body.error[key]).to.equal(response.body.error[key]);
|
||||
}
|
||||
defaultErrorHandler(response, res_data);
|
||||
}
|
||||
|
||||
});
|
||||
@ -591,10 +709,7 @@ Cypress.Commands.add("citForMandatesCallTest", (requestBody, req_data, res_data,
|
||||
}
|
||||
}
|
||||
else{
|
||||
expect(response.body).to.have.property("error");
|
||||
for(const key in res_data.body.error) {
|
||||
expect(res_data.body.error[key]).to.equal(response.body.error[key]);
|
||||
}
|
||||
defaultErrorHandler(response, res_data);
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -606,7 +721,6 @@ Cypress.Commands.add("mitForMandatesCallTest", (requestBody, amount, confirm, ca
|
||||
requestBody.mandate_id = globalState.get("mandateId");
|
||||
requestBody.customer_id = globalState.get("customerId");
|
||||
globalState.set("paymentAmount", requestBody.amount);
|
||||
console.log("mit body " + JSON.stringify(requestBody));
|
||||
cy.request({
|
||||
method: "POST",
|
||||
url: `${globalState.get("baseUrl")}/payments`,
|
||||
@ -620,7 +734,6 @@ Cypress.Commands.add("mitForMandatesCallTest", (requestBody, amount, confirm, ca
|
||||
logRequestId(response.headers['x-request-id']);
|
||||
expect(response.headers["content-type"]).to.include("application/json");
|
||||
globalState.set("paymentID", response.body.payment_id);
|
||||
console.log("mit statusss-> " + response.body.status);
|
||||
if (response.body.capture_method === "automatic") {
|
||||
if (response.body.authentication_type === "three_ds") {
|
||||
expect(response.body).to.have.property("next_action")
|
||||
@ -631,8 +744,7 @@ Cypress.Commands.add("mitForMandatesCallTest", (requestBody, amount, confirm, ca
|
||||
} else if (response.body.authentication_type === "no_three_ds") {
|
||||
expect(response.body.status).to.equal("succeeded");
|
||||
} else {
|
||||
// Handle other authentication types as needed
|
||||
throw new Error(`Unsupported authentication type: ${authentication_type}`);
|
||||
defaultErrorHandler(response, res_data);
|
||||
}
|
||||
}
|
||||
else if (response.body.capture_method === "manual") {
|
||||
@ -645,8 +757,7 @@ Cypress.Commands.add("mitForMandatesCallTest", (requestBody, amount, confirm, ca
|
||||
} else if (response.body.authentication_type === "no_three_ds") {
|
||||
expect(response.body.status).to.equal("requires_capture");
|
||||
} else {
|
||||
// Handle other authentication types as needed
|
||||
throw new Error(`Unsupported authentication type: ${authentication_type}`);
|
||||
defaultErrorHandler(response, res_data);
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -698,82 +809,53 @@ Cypress.Commands.add("revokeMandateCallTest", (globalState) => {
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Cypress.Commands.add("handleRedirection", (globalState, expected_redirection) => {
|
||||
let connectorId = globalState.get("connectorId");
|
||||
let expected_url = new URL(expected_redirection);
|
||||
let redirection_url = new URL(globalState.get("nextActionUrl"));
|
||||
cy.visit(redirection_url.href);
|
||||
if (globalState.get("connectorId") == "adyen") {
|
||||
cy.get('iframe')
|
||||
.its('0.contentDocument.body')
|
||||
.within((body) => {
|
||||
cy.get('input[type="password"]').click();
|
||||
cy.get('input[type="password"]').type("password");
|
||||
cy.get('#buttonSubmit').click();
|
||||
})
|
||||
}
|
||||
else if (globalState.get("connectorId") === "cybersource" || globalState.get("connectorId") === "bankofamerica") {
|
||||
cy.get('iframe', { timeout: 15000 })
|
||||
.its('0.contentDocument.body')
|
||||
.within((body) => {
|
||||
cy.get('input[type="text"]').click().type("1234");
|
||||
cy.get('input[value="SUBMIT"]').click();
|
||||
})
|
||||
}
|
||||
else if (globalState.get("connectorId") === "nmi" || globalState.get("connectorId") === "noon") {
|
||||
cy.get('iframe', { timeout: 150000 })
|
||||
.its('0.contentDocument.body')
|
||||
.within((body) => {
|
||||
cy.get('iframe', { timeout: 20000 })
|
||||
.its('0.contentDocument.body')
|
||||
.within((body) => {
|
||||
cy.get('form[name="cardholderInput"]', { timeout: 20000 }).should('exist').then(form => {
|
||||
cy.get('input[name="challengeDataEntry"]').click().type("1234");
|
||||
cy.get('input[value="SUBMIT"]').click();
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
else if (globalState.get("connectorId") === "stripe") {
|
||||
cy.get('iframe', { timeout: 30000 })
|
||||
.its('0.contentDocument.body')
|
||||
.within((body) => {
|
||||
cy.get('iframe')
|
||||
.its('0.contentDocument.body')
|
||||
.within((body) => {
|
||||
cy.get('#test-source-authorize-3ds').click();
|
||||
})
|
||||
})
|
||||
}
|
||||
else if (globalState.get("connectorId") === "trustpay") {
|
||||
cy.get('form[name="challengeForm"]', { timeout: 10000 }).should('exist').then(form => {
|
||||
cy.get('#outcomeSelect').select('Approve').should('have.value', 'Y')
|
||||
cy.get('button[type="submit"]').click();
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
else {
|
||||
// If connectorId is neither of adyen, trustpay, nmi, stripe, bankofamerica or cybersource, wait for 10 seconds
|
||||
cy.wait(10000);
|
||||
}
|
||||
|
||||
// Handling redirection
|
||||
if (redirection_url.host.endsWith(expected_url.host)) {
|
||||
// No CORS workaround needed
|
||||
cy.window().its('location.origin').should('eq', expected_url.origin);
|
||||
} else {
|
||||
// Workaround for CORS to allow cross-origin iframe
|
||||
cy.origin(expected_url.origin, { args: { expected_url: expected_url.origin } }, ({ expected_url }) => {
|
||||
cy.window().its('location.origin').should('eq', expected_url);
|
||||
})
|
||||
}
|
||||
handleRedirection(
|
||||
"three_ds",
|
||||
{ redirection_url, expected_url },
|
||||
connectorId,
|
||||
null
|
||||
);
|
||||
});
|
||||
|
||||
Cypress.Commands.add(
|
||||
"handleBankRedirectRedirection",
|
||||
(globalState, payment_method_type, expected_redirection) => {
|
||||
let connectorId = globalState.get("connectorId");
|
||||
let expected_url = new URL(expected_redirection);
|
||||
let redirection_url = new URL(globalState.get("nextActionUrl"));
|
||||
// explicitly restricting `sofort` payment method by adyen from running as it stops other tests from running
|
||||
// trying to handle that specific case results in stripe 3ds tests to fail
|
||||
if (!(connectorId == "adyen" && payment_method_type == "sofort")) {
|
||||
handleRedirection(
|
||||
"bank_redirect",
|
||||
{ redirection_url, expected_url },
|
||||
connectorId,
|
||||
payment_method_type
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
Cypress.Commands.add(
|
||||
"handleBankTransferRedirection",
|
||||
(globalState, payment_method_type, expected_redirection) => {
|
||||
let connectorId = globalState.get("connectorId");
|
||||
let redirection_url = new URL(globalState.get("nextActionUrl"));
|
||||
cy.log(payment_method_type);
|
||||
handleRedirection(
|
||||
"bank_transfer",
|
||||
{ redirection_url, expected_redirection },
|
||||
connectorId,
|
||||
payment_method_type
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
Cypress.Commands.add("listCustomerPMCallTest", (globalState) => {
|
||||
console.log("customerID ->" + globalState.get("customerId"));
|
||||
const customerId = globalState.get("customerId");
|
||||
cy.request({
|
||||
method: "GET",
|
||||
@ -792,7 +874,7 @@ Cypress.Commands.add("listCustomerPMCallTest", (globalState) => {
|
||||
expect(paymentToken).to.equal(globalState.get("paymentToken")); // Verify paymentToken
|
||||
}
|
||||
else {
|
||||
throw new Error(`Payment token not found`);
|
||||
defaultErrorHandler(response, res_data);
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -808,11 +890,7 @@ Cypress.Commands.add("listRefundCallTest", (requestBody, globalState) => {
|
||||
body: requestBody,
|
||||
}).then((response) => {
|
||||
logRequestId(response.headers['x-request-id']);
|
||||
|
||||
expect(response.headers["content-type"]).to.include("application/json");
|
||||
expect(response.body.data).to.be.an('array').and.not.empty;
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user