All files / src/features/MerchantPortal/DeveloperApi utils.ts

50% Statements 5/10
0% Branches 0/6
0% Functions 0/2
50% Lines 5/10

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36                8x   8x                     8x           8x             8x  
import * as Yup from "yup";
import {
  BASE_APP_URL,
  MERCHANT_PATH_NAME,
  PROVIDER_PATH_NAME,
} from "./constants";
import { checkPortals } from "@utils/routing";
 
const environment = process.env.VITE_ENVIRONMENT;
 
export const getDocsDomain = () => {
  const { isEnterprisePortal } = checkPortals();
  const subdomain =
    environment === "production"
      ? "developer"
      : `${environment}-developer-docs`;
  const pathName = isEnterprisePortal ? PROVIDER_PATH_NAME : MERCHANT_PATH_NAME;
 
  return `https://${subdomain}.${BASE_APP_URL}/${pathName}`;
};
 
export const getBaseUrl = (isSandbox: boolean) => {
  return isSandbox
    ? process.env.VITE_SANDBOX_API_URL
    : process.env.VITE_DEVELOPER_API_URL;
};
 
export const generateApiSchema = Yup.object().shape({
  name: Yup.string().required("First Name is required"),
  description: Yup.string(),
  origin: Yup.string(),
  environment: Yup.string(),
});
 
export const SANDBOX_PORTAL_URL = "https://sandbox.givepayments.com";