export type CallbackDto = {app_id: string, customer_email: string, created_at: number, amount: string, currency_code: string, url: string, idempotency_key: string, sign: string}; export type CreateApiV1PaymentsCallbackGcowArgs = {body: CallbackDto}; export type CreateApiV1PaymentsCallbackGcowOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * POST /v1/payments/callback/gcow */ export const createApiV1PaymentsCallbackGcow = async (args: CreateApiV1PaymentsCallbackGcowArgs, options: CreateApiV1PaymentsCallbackGcowOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/v1/payments/callback/gcow${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 };