export type CreateApiPaymentGatewayInitiate1Args = {body: Record}; export type CreateApiPaymentGatewayInitiate1Options = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Split Payment * * POST /payment-gateway/initiate-1 */ export const createApiPaymentGatewayInitiate1 = async (args: CreateApiPaymentGatewayInitiate1Args, options?: CreateApiPaymentGatewayInitiate1Options) => { const {baseUrl = "https://app-api.edfapay.com/api/v1", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "text/plain") const url = `${baseUrl.replace(/\/+$/, '')}/payment-gateway/initiate-1${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.text() };