export type EventRequest = {eventTime: string, partnerId: string, rID: string, updateInfo?: Array> | undefined, pluginVersion?: number | undefined, additionalInfo?: ({info?: string | undefined}) | undefined, restaurantVersion: string, implementedFeatures: Array<{feature?: string | undefined, available?: boolean | undefined, implemented?: boolean | undefined, info?: ({orderTypeCode?: number | undefined}) | undefined}>, restaurantLicenseDateEnd: string}; export type CreateApiApiShaketopayComUaCallbackVersionInfoArgs = {body: EventRequest}; export type CreateApiApiShaketopayComUaCallbackVersionInfoOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Сервіс отримання налаштувань від інтеграції * * POST //api.shaketopay.com.ua/callback/versionInfo */ export const createApiApiShaketopayComUaCallbackVersionInfo = async (args: CreateApiApiShaketopayComUaCallbackVersionInfoArgs, options: CreateApiApiShaketopayComUaCallbackVersionInfoOptions) => { 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.shaketopay.com.ua/callback/versionInfo${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 };