export type BillingCallbackCommand = {Amount: number, BillID: string, BillType?: string | undefined, Description?: string | undefined, ExtraInfo?: string | undefined, MobileNumber?: string | undefined, PaymentID: string, RecordNumber?: string | undefined, TraceNumber?: string | undefined, TransactionDateTime?: string | undefined, UniqueID?: string | undefined}; export type CreateApiApiPublicGhabzinoCallbackArgs = {body: BillingCallbackCommand}; export type CreateApiApiPublicGhabzinoCallbackOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * callback * * POST /api/public/ghabzino/callback */ export const createApiApiPublicGhabzinoCallback = async (args: CreateApiApiPublicGhabzinoCallbackArgs, options: CreateApiApiPublicGhabzinoCallbackOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/api/public/ghabzino/callback${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 undefined };