mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-03 05:17:02 +08:00
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
42 lines
1.1 KiB
JavaScript
42 lines
1.1 KiB
JavaScript
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;
|
|
}
|
|
};
|