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

1.3 KB
Raw Blame
import { connectorDetails as adyenConnectorDetails } from "./Adyen.js";
import { connectorDetails as autoretryConnectorDetails } from "./Autoretries.js";
import { connectorDetails as commonConnectorDetails } from "./Commons.js";
import { connectorDetails as stripeConnectorDetails } from "./Stripe.js";

const connectorDetails = {
  adyen: adyenConnectorDetails,
  autoretries: autoretryConnectorDetails,
  common: commonConnectorDetails,
  stripe: stripeConnectorDetails,
};

export const getConnectorDetails = (connectorId) => {
  const x = getValueByKey(connectorDetails, connectorId);
  return x;
};

function getValueByKey(jsonObject, key) {
  const data =
    typeof jsonObject === "string" ? JSON.parse(jsonObject) : jsonObject;

  if (data && typeof data === "object" && key in data) {
    return data[key];
  } else {
    return null;
  }
}

export const should_continue_further = (data) => {
  const resData = data.Response || {};

  if (
    typeof resData.body.error !== "undefined" ||
    typeof resData.body.error_code !== "undefined" ||
    typeof resData.body.error_message !== "undefined"
  ) {
    return false;
  } else {
    return true;
  }
};

export const CONNECTOR_LISTS = {
  INCLUDE: {
    PAYOUT_ROUTING: ["adyenplatform", "wise"],
  },
};

export const shouldRunForConnectorList = (connectorId, list) => {
  return list.includes(connectorId);
};