Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
import * as fixtures from "../../../fixtures/imports";
import State from "../../../utils/State";
import getConnectorDetails, * as utils from "../../configs/Payment/Utils";
let connector;
let globalState;
describe("[Payment] Overcapture", () => {
before(function () {
// Changed to regular function instead of arrow function
let skip = false;
cy.task("getGlobalState")
.then((state) => {
globalState = new State(state);
connector = globalState.get("connectorId");
// Skip the test if the connector is not in the inclusion list
if (
utils.shouldIncludeConnector(
connector,
utils.CONNECTOR_LISTS.INCLUDE.OVERCAPTURE
)
) {
skip = true;
}
})
.then(() => {
if (skip) {
this.skip();
}
});
});
afterEach("flush global state", () => {
cy.task("setGlobalState", globalState.data);
});
context("[Payment] Overcapture Pre-Auth", () => {
let shouldContinue = true;
it("create-call-test", () => {
const data = getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
]["PaymentIntent"];
const newData = {
...data,
Request: {
...data.Request,
enable_overcapture: true,
},
};
cy.createPaymentIntentTest(
fixtures.createPaymentBody,
newData,
"no_three_ds",
"manual",
globalState
);
if (shouldContinue) shouldContinue = utils.should_continue_further(data);
});
it("confirm-call-test", () => {
const data = getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
]["No3DSManualCapture"];
cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);
if (shouldContinue) shouldContinue = utils.should_continue_further(data);
});
it("capture-call-test", () => {
const data = getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
]["Overcapture"];
cy.captureCallTest(fixtures.captureBody, data, globalState);
if (shouldContinue) shouldContinue = utils.should_continue_further(data);
});
it("retrieve-payment-call-test", () => {
const data = getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
]["Overcapture"];
cy.retrievePaymentCallTest({ globalState, data });
});
});
});