Skip to content

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

ci(cypress): add gotyme_sanlam payout connector (#14060)

likhinbopannacb966ac3e66f
diff --git a/cypress-tests/README.md b/cypress-tests/README.md
index 627ba4ec03..ebe870664f 100644
--- a/cypress-tests/README.md
+++ b/cypress-tests/README.md
@@ -566,6 +566,29 @@ This will redirect all Silverflow API calls from Hyperswitch to your local mock
"key1": "key1",
"api_secret": "api_secret"
}
+ },
+ // Payout connector with runtime-injected payout bank transfer details; `<connector_name>_payout` is read by the payout create flow, and `payout_bank_transfer` holds sensitive bank info injected into payout requests at runtime via `injectGotymePayoutBankTransfer` in `cypress/e2e/configs/Payout/Utils.js` so it never appears in committed configs.
+ "gotyme_sanlam_payout": {
+ "connector_account_details": {
+ "auth_type": "BodyKey",
+ "api_key": "api_key",
+ "key1": "key1"
+ },
+ "payout_bank_transfer": {
+ "payshap": {
+ "intrabank": {
+ "bank_account_number": "bank_account_number"
+ },
+ "interbank": {
+ "bank_account_number": "bank_account_number",
+ "account_holder_name": "account_holder_name",
+ "bank_name": "bank_name"
+ }
+ },
+ "payshap_proxy": {
+ "shap_id": "shap_id"
+ }
+ }
}
}
```
diff --git a/cypress-tests/cypress/e2e/configs/Payout/GotymeSanlam.js b/cypress-tests/cypress/e2e/configs/Payout/GotymeSanlam.js
new file mode 100644
index 0000000000..d5a2f09521
--- /dev/null
+++ b/cypress-tests/cypress/e2e/configs/Payout/GotymeSanlam.js
@@ -0,0 +1,136 @@
+const billing = {
+ address: {
+ line1: "123 Main St",
+ city: "Cape Town",
+ state: "Western Cape",
+ zip: "8001",
+ country: "ZA",
+ first_name: "John",
+ last_name: "Doe",
+ },
+};
+
+/*
+ * Sensitive payout bank details (bank_account_number, account_holder_name,
+ * bank_name, shap_id) are intentionally NOT defined here. They are injected at
+ * runtime from the gitignored `creds.json` (`<connector>_payout` ->
+ * `payout_bank_transfer`) by `injectGotymePayoutBankTransfer` in
+ * `cypress/e2e/configs/Payout/Utils.js`. The configs below only declare WHICH
+ * payout_method_type is used.
+ */
+export const connectorDetails = {
+ bank_transfer_pm: {
+ payshap: {
+ Create: {
+ Request: {
+ amount: 1000,
+ currency: "ZAR",
+ payout_type: "bank",
+ description: "Test Payout",
+ billing: billing,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_payout_method_data",
+ payout_type: "bank",
+ },
+ },
+ },
+ Confirm: {
+ Request: {
+ amount: 1000,
+ currency: "ZAR",
+ payout_type: "bank",
+ payout_method_data: {
+ bank_transfer: {
+ payout_method_type: "payshap",
+ },
+ },
+ billing: billing,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_fulfillment",
+ payout_type: "bank",
+ connector: "gotyme_sanlam",
+ },
+ },
+ },
+ Fulfill: {
+ Response: {
+ status: 200,
+ body: {
+ status: "initiated",
+ amount: 1000,
+ },
+ },
+ },
+ RetrieveAfterFulfill: {
+ Response: {
+ status: 200,
+ body: {
+ status: "initiated",
+ },
+ },
+ },
+ },
+ payshap_proxy: {
+ Create: {
+ Request: {
+ amount: 2000,
+ currency: "ZAR",
+ payout_type: "bank",
+ billing: billing,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_confirmation",
+ payout_type: "bank",
+ },
+ },
+ },
+ Confirm: {
+ Request: {
+ amount: 2000,
+ currency: "ZAR",
+ payout_type: "bank",
+ payout_method_data: {
+ bank_transfer: {
+ payout_method_type: "payshap_proxy",
+ },
+ },
+ billing: billing,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_fulfillment",
+ payout_type: "bank",
+ connector: "gotyme_sanlam",
+ },
+ },
+ },
+ Fulfill: {
+ Response: {
+ status: 200,
+ body: {
+ status: "initiated",
+ amount: 2000,
+ },
+ },
+ },
+ RetrieveAfterFulfill: {
+ Response: {
+ status: 200,
+ body: {
+ status: "initiated",
+ amount: 2000,
+ },
+ },
+ },
+ },
+ },
+};
diff --git a/cypress-tests/cypress/e2e/configs/Payout/Modifiers.js b/cypress-tests/cypress/e2e/configs/Payout/Modifiers.js
index 514f7135a6..ab24a6c26f 100644
--- a/cypress-tests/cypress/e2e/configs/Payout/Modifiers.js
+++ b/cypress-tests/cypress/e2e/configs/Payout/Modifiers.js
@@ -14,6 +14,7 @@ function normalise(input) {
adyenplatform: "Adyenplatform",
wise: "Wise",
wellsfargo: "Wellsfargo",
+ gotyme_sanlam: "GotymeSanlam",
// Add more known exceptions here
};
diff --git a/cypress-tests/cypress/e2e/configs/Payout/Utils.js b/cypress-tests/cypress/e2e/configs/Payout/Utils.js
index c40717503a..14385da6b1 100644
--- a/cypress-tests/cypress/e2e/configs/Payout/Utils.js
+++ b/cypress-tests/cypress/e2e/configs/Payout/Utils.js
@@ -3,6 +3,7 @@ import { validateConfig } from "../../../utils/featureFlags.js";
import { connectorDetails as adyenConnectorDetails } from "./Adyen.js";
import { connectorDetails as adyenPlatformConnectorDetails } from "./AdyenPlatform.js";
import { connectorDetails as CommonConnectorDetails } from "./Commons.js";
+import { connectorDetails as gotymeSanlamConnectorDetails } from "./GotymeSanlam.js";
import { connectorDetails as wiseConnectorDetails } from "./Wise.js";
import { connectorDetails as nomupayConnectorDetails } from "./Nomupay.js";
import { connectorDetails as truelayerConnectorDetails } from "./Truelayer.js";
@@ -11,6 +12,7 @@ const connectorDetails = {
adyen: adyenConnectorDetails,
adyenplatform: adyenPlatformConnectorDetails,
commons: CommonConnectorDetails,
+ gotyme_sanlam: gotymeSanlamConnectorDetails,
nomupay: nomupayConnectorDetails,
truelayer: truelayerConnectorDetails,
wise: wiseConnectorDetails,
@@ -92,6 +94,13 @@ export function getValueByKey(jsonObject, key) {
// Connector inclusion/exclusion lists for feature gates
export const CONNECTOR_LISTS = {
+ // Exclusion lists (skip these connectors)
+ EXCLUDE: {
+ // gotyme_sanlam only supports bank transfer payouts (payshap /
+ // payshap_proxy) and has no card payout method, so it is skipped for
+ // the card payout tests in 00003-CardTest.cy.js
+ CARD_TEST: ["gotyme_sanlam"],
+ },
INCLUDE: {
ENTITY_TYPE: ["wise"],
// Payout recurring feature - only verified connectors
@@ -99,12 +108,19 @@ export const CONNECTOR_LISTS = {
PAYOUT_LINK: ["wise"],
BANK_TRANSFER_OPEN_BANKING: ["truelayer"],
BANK_TRANSFER_OPEN_BANKING_INVALID_REFERENCE_FULFILL: [],
+ BANK_TRANSFER_PAYSHAP: ["gotyme_sanlam"],
+ BANK_TRANSFER_PAYSHAP_PROXY: ["gotyme_sanlam"],
BANK_TRANSFER_SEPA: ["adyen", "adyenplatform", "nomupay", "wise"],
SAVED_CARD: ["adyen", "adyenplatform", "nomupay", "wise"],
SAVED_BANK_TRANSFER_SEPA: ["adyen", "adyenplatform", "nomupay", "wise"],
},
};
+// Helper functions
+export const shouldExcludeConnector = (connectorId, list) => {
+ return Array.isArray(list) && list.includes(connectorId);
+};
+
export const ENTITY_TYPE_LIST = [
{ key: "EntityTypeIndividual", name: "Individual" },
{ key: "EntityTypeCompany", name: "Company" },
@@ -132,3 +148,57 @@ export const should_continue_further = (data) => {
return true;
}
};
+
+/*
+ * Injects sensitive payout bank transfer details (bank_account_number,
+ * account_holder_name, bank_name, shap_id) from the gitignored `creds.json`
+ * (`<connector>_payout` -> `payout_bank_transfer`, stashed into globalState by
+ * `createPayoutConnectorCallTest`) into the bank_transfer payout_method_data
+ * of a payout create/confirm request body. Connector configs only declare the
+ * payout_method_type; the sensitive values never live in committed code.
+ * `creds.json` may group multiple account variants under one payout method
+ * type (e.g. `payshap` -> `intrabank` / `interbank`), but the payout API
+ * accepts only the flat bank fields, so a variant group is flattened to a
+ * single variant (interbank preferred: full field set) before injection.
+ * No-op for every connector other than `gotyme_sanlam`.
+ */
+export const injectGotymePayoutBankTransfer = (body, globalState) => {
+ if (globalState.get("connectorId") !== "gotyme_sanlam") {
+ return body;
+ }
+
+ const payoutBankTransferDetails = globalState.get(
+ "payoutBankTransferDetails"
+ );
+ const bankTransferData = body?.payout_method_data?.bank_transfer;
+
+ if (!payoutBankTransferDetails || !bankTransferData) {
+ return body;
+ }
+
+ let credsForType =
+ payoutBankTransferDetails[bankTransferData.payout_method_type];
+
+ // A variant group (e.g. payshap -> {intrabank: {...}, interbank: {...}})
+ // holds only object values, unlike flat creds (e.g. {shap_id: "..."}).
+ // Select one variant so its fields are spread flat into the request below.
+ const isVariantGroup =
+ credsForType &&
+ Object.keys(credsForType).length > 0 &&
+ Object.values(credsForType).every(
+ (variant) => variant && typeof variant === "object"
+ );
+
+ if (isVariantGroup) {
+ credsForType = credsForType.interbank || credsForType.intrabank;
+ }
+
+ if (credsForType) {
+ body.payout_method_data.bank_transfer = {
+ ...bankTransferData,
+ ...credsForType,
+ };
+ }
+
+ return body;
+};
diff --git a/cypress-tests/cypress/e2e/spec/Payout/00003-CardTest.cy.js b/cypress-tests/cypress/e2e/spec/Payout/00003-CardTest.cy.js
index 694a26b703..332112d755 100644
--- a/cypress-tests/cypress/e2e/spec/Payout/00003-CardTest.cy.js
+++ b/cypress-tests/cypress/e2e/spec/Payout/00003-CardTest.cy.js
@@ -15,6 +15,16 @@ describe("[Payout] Cards", () => {
if (!globalState.get("payoutsExecution")) {
shouldContinue = false;
}
+
+ // Skip running test against a connector that is added in the exclude list
+ if (
+ utils.shouldExcludeConnector(
+ globalState.get("connectorId"),
+ utils.CONNECTOR_LISTS.EXCLUDE.CARD_TEST
+ )
+ ) {
+ shouldContinue = false;
+ }
});
});
diff --git a/cypress-tests/cypress/e2e/spec/Payout/00004-BankTransfer.cy.js b/cypress-tests/cypress/e2e/spec/Payout/00004-BankTransfer.cy.js
index 3710fa9fea..e673bf9779 100644
--- a/cypress-tests/cypress/e2e/spec/Payout/00004-BankTransfer.cy.js
+++ b/cypress-tests/cypress/e2e/spec/Payout/00004-BankTransfer.cy.js
@@ -332,3 +332,322 @@ describe("[Payout] [Bank Transfer - Open Banking]", () => {
);
}
});
+
+// Payshap / Payshap Proxy fulfill coverage asserts the deterministic
+// shipped-environment behavior: the OSS dummy connector base_url ("dev") is
+// not a valid URL, so the fulfill call returns 500 HE_00 and the payout
+// silently stays in requires_fulfillment.
+describe("[Payout] [Bank Transfer - Payshap]", () => {
+ let shouldContinue = true; // variable that will be used to skip tests if a previous test fails
+
+ before("seed global state", function () {
+ cy.task("getGlobalState")
+ .then((state) => {
+ globalState = new State(state);
+
+ if (!globalState.get("payoutsExecution")) {
+ shouldContinue = false;
+ }
+
+ if (
+ !utils.CONNECTOR_LISTS.INCLUDE.BANK_TRANSFER_PAYSHAP.includes(
+ globalState.get("connectorId")
+ )
+ ) {
+ shouldContinue = false;
+ }
+ })
+ .then(() => {
+ if (!shouldContinue) {
+ this.skip();
+ }
+ });
+ });
+
+ after("flush global state", () => {
+ cy.task("setGlobalState", globalState.data);
+ });
+
+ beforeEach(function () {
+ if (!shouldContinue) {
+ this.skip();
+ }
+ });
+
+ context("[Payout] [Bank transfer - Payshap] Create without confirm", () => {
+ let shouldContinue = true; // variable that will be used to skip tests if a previous test fails
+
+ beforeEach(function () {
+ if (!shouldContinue) {
+ this.skip();
+ }
+ });
+
+ it("create-payout-without-confirm-test", () => {
+ const data = utils.getConnectorDetails(globalState.get("connectorId"))[
+ "bank_transfer_pm"
+ ]["payshap"]["Create"];
+
+ cy.createConfirmPayoutTest(
+ fixtures.createPayoutBody,
+ data,
+ false,
+ false,
+ globalState
+ );
+ if (shouldContinue) shouldContinue = utils.should_continue_further(data);
+ });
+
+ it("retrieve-payout-call-test", () => {
+ cy.retrievePayoutCallTest(globalState);
+ });
+ });
+
+ context("[Payout] [Bank transfer - Payshap] Create and Confirm", () => {
+ let shouldContinue = true; // variable that will be used to skip tests if a previous test fails
+
+ beforeEach(function () {
+ if (!shouldContinue) {
+ this.skip();
+ }
+ });
+
+ it("create customer", () => {
+ cy.createCustomerCallTest(fixtures.customerCreateBody, globalState);
+ });
+
+ it("confirm-payout-call-test", () => {
+ const data = utils.getConnectorDetails(globalState.get("connectorId"))[
+ "bank_transfer_pm"
+ ]["payshap"]["Confirm"];
+
+ cy.createConfirmPayoutTest(
+ fixtures.createPayoutBody,
+ data,
+ true,
+ false,
+ globalState
+ );
+ if (shouldContinue) shouldContinue = utils.should_continue_further(data);
+ });
+
+ it("retrieve-payout-call-test", () => {
+ cy.retrievePayoutCallTest(globalState);
+ });
+ });
+
+ context(
+ "[Payout] [Bank transfer - Payshap] Create, Confirm and Fulfill",
+ () => {
+ let shouldContinue = true; // variable that will be used to skip tests if a previous test fails
+
+ beforeEach(function () {
+ if (!shouldContinue) {
+ this.skip();
+ }
+ });
+
+ it("create customer", () => {
+ cy.createCustomerCallTest(fixtures.customerCreateBody, globalState);
+ });
+
+ // Create, confirm and fulfill intentionally share one it block: fulfill
+ // must always target the payout created by the immediately preceding
+ // create call, because a fulfill retry on the same payout fails in the
+ // process tracker (DuplicateValue) before reaching the connector.
+ it("create-confirm-and-fulfill-payout-test", () => {
+ const confirmData = utils.getConnectorDetails(
+ globalState.get("connectorId")
+ )["bank_transfer_pm"]["payshap"]["Confirm"];
+ const fulfillData = utils.getConnectorDetails(
+ globalState.get("connectorId")
+ )["bank_transfer_pm"]["payshap"]["Fulfill"];
+
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ return;
+ }
+
+ cy.createConfirmPayoutTest(
+ fixtures.createPayoutBody,
+ confirmData,
+ true,
+ false,
+ globalState
+ );
+ cy.fulfillPayoutCallTest({}, fulfillData, globalState);
+ // No should_continue_further on the fulfill data: its expected response
+ // is an error body, and the retrieve below must always run to verify
+ // the silent-failure state of the payout.
+ });
+
+ it("retrieve-payout-after-fulfill-test", () => {
+ const data = utils.getConnectorDetails(globalState.get("connectorId"))[
+ "bank_transfer_pm"
+ ]["payshap"]["RetrieveAfterFulfill"];
+
+ cy.retrievePayoutCallTest(globalState, data);
+ });
+ }
+ );
+});
+
+// Payshap Proxy fulfill coverage — see the note above the Payshap describe.
+describe("[Payout] [Bank Transfer - Payshap Proxy]", () => {
+ let shouldContinue = true; // variable that will be used to skip tests if a previous test fails
+
+ before("seed global state", function () {
+ cy.task("getGlobalState")
+ .then((state) => {
+ globalState = new State(state);
+
+ if (!globalState.get("payoutsExecution")) {
+ shouldContinue = false;
+ }
+
+ if (
+ !utils.CONNECTOR_LISTS.INCLUDE.BANK_TRANSFER_PAYSHAP_PROXY.includes(
+ globalState.get("connectorId")
+ )
+ ) {
+ shouldContinue = false;
+ }
+ })
+ .then(() => {
+ if (!shouldContinue) {
+ this.skip();
+ }
+ });
+ });
+
+ after("flush global state", () => {
+ cy.task("setGlobalState", globalState.data);
+ });
+
+ beforeEach(function () {
+ if (!shouldContinue) {
+ this.skip();
+ }
+ });
+
+ context(
+ "[Payout] [Bank transfer - Payshap Proxy] Create without confirm",
+ () => {
+ let shouldContinue = true; // variable that will be used to skip tests if a previous test fails
+
+ beforeEach(function () {
+ if (!shouldContinue) {
+ this.skip();
+ }
+ });
+
+ it("create-payout-without-confirm-test", () => {
+ const data = utils.getConnectorDetails(globalState.get("connectorId"))[
+ "bank_transfer_pm"
+ ]["payshap_proxy"]["Create"];
+
+ cy.createConfirmPayoutTest(
+ fixtures.createPayoutBody,
+ data,
+ false,
+ false,
+ globalState
+ );
+ if (shouldContinue)
+ shouldContinue = utils.should_continue_further(data);
+ });
+
+ it("retrieve-payout-call-test", () => {
+ cy.retrievePayoutCallTest(globalState);
+ });
+ }
+ );
+
+ context("[Payout] [Bank transfer - Payshap Proxy] Create and Confirm", () => {
+ let shouldContinue = true; // variable that will be used to skip tests if a previous test fails
+
+ beforeEach(function () {
+ if (!shouldContinue) {
+ this.skip();
+ }
+ });
+
+ it("create customer", () => {
+ cy.createCustomerCallTest(fixtures.customerCreateBody, globalState);
+ });
+
+ it("confirm-payout-call-test", () => {
+ const data = utils.getConnectorDetails(globalState.get("connectorId"))[
+ "bank_transfer_pm"
+ ]["payshap_proxy"]["Confirm"];
+
+ cy.createConfirmPayoutTest(
+ fixtures.createPayoutBody,
+ data,
+ true,
+ false,
+ globalState
+ );
+ if (shouldContinue) shouldContinue = utils.should_continue_further(data);
+ });
+
+ it("retrieve-payout-call-test", () => {
+ cy.retrievePayoutCallTest(globalState);
+ });
+ });
+
+ context(
+ "[Payout] [Bank transfer - Payshap Proxy] Create, Confirm and Fulfill",
+ () => {
+ let shouldContinue = true; // variable that will be used to skip tests if a previous test fails
+
+ beforeEach(function () {
+ if (!shouldContinue) {
+ this.skip();
+ }
+ });
+
+ it("create customer", () => {
+ cy.createCustomerCallTest(fixtures.customerCreateBody, globalState);
+ });
+
+ // Create, confirm and fulfill intentionally share one it block: fulfill
+ // must always target the payout created by the immediately preceding
+ // create call, because a fulfill retry on the same payout fails in the
+ // process tracker (DuplicateValue) before reaching the connector.
+ it("create-confirm-and-fulfill-payout-test", () => {
+ const confirmData = utils.getConnectorDetails(
+ globalState.get("connectorId")
+ )["bank_transfer_pm"]["payshap_proxy"]["Confirm"];
+ const fulfillData = utils.getConnectorDetails(
+ globalState.get("connectorId")
+ )["bank_transfer_pm"]["payshap_proxy"]["Fulfill"];
+
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ return;
+ }
+
+ cy.createConfirmPayoutTest(
+ fixtures.createPayoutBody,
+ confirmData,
+ true,
+ false,
+ globalState
+ );
+ cy.fulfillPayoutCallTest({}, fulfillData, globalState);
+ // No should_continue_further on the fulfill data: its expected response
+ // is an error body, and the retrieve below must always run to verify
+ // the silent-failure state of the payout.
+ });
+
+ it("retrieve-payout-after-fulfill-test", () => {
+ const data = utils.getConnectorDetails(globalState.get("connectorId"))[
+ "bank_transfer_pm"
+ ]["payshap_proxy"]["RetrieveAfterFulfill"];
+
+ cy.retrievePayoutCallTest(globalState, data);
+ });
+ }
+ );
+});
diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.js
index c88737259f..6a229e8e91 100644
--- a/cypress-tests/cypress/support/commands.js
+++ b/cypress-tests/cypress/support/commands.js
@@ -36,6 +36,7 @@ import getConnectorDetails, {
shouldIncludeConnector,
stringifyWithBigInt,
} from "../e2e/configs/Payment/Utils";
+import { injectGotymePayoutBankTransfer } from "../e2e/configs/Payout/Utils";
import { execConfig, validateConfig } from "../utils/featureFlags";
import * as RequestBodyUtils from "../utils/RequestBodyUtils";
import { isoTimeTomorrow, validateEnv } from "../utils/RequestBodyUtils.js";
@@ -2204,6 +2205,16 @@ Cypress.Commands.add(
createConnectorBody.connector_account_details =
authDetails.connector_account_details;
+ // Stash sensitive payout bank transfer details (if any) so payout
+ // create/confirm commands can inject them at runtime instead of
+ // keeping them in committed connector configs
+ if (authDetails.payout_bank_transfer) {
+ globalState.set(
+ "payoutBankTransferDetails",
+ authDetails.payout_bank_transfer
+ );
+ }
+
if (authDetails && authDetails.metadata) {
createConnectorBody.metadata = {
...createConnectorBody.metadata, // Preserve existing metadata fields
@@ -7090,6 +7101,7 @@ Cypress.Commands.add(
for (const key in reqData) {
createConfirmPayoutBody[key] = reqData[key];
}
+ injectGotymePayoutBankTransfer(createConfirmPayoutBody, globalState);
createConfirmPayoutBody.auto_fulfill = auto_fulfill;
createConfirmPayoutBody.confirm = confirm;
createConfirmPayoutBody.customer_id = globalState.get("customerId");
@@ -7291,6 +7303,11 @@ Cypress.Commands.add(
Cypress.Commands.add("retrievePayoutCallTest", (globalState, data) => {
const payout_id = globalState.get("payoutID");
const resBody = data?.Response?.body || {};
+ if (!payout_id) {
+ throw new Error(
+ "retrieve-payout-call-test: payout_id is not set in global state; the preceding create/confirm payout step must have failed"
+ );
+ }
cy.request({
method: "GET",
url: `${globalState.get("baseUrl")}/payouts/${payout_id}`,