export type CreateApiCardsCardId3dsAnswerInitiateActionIdArgs = {cardId: string, initiateActionId: string, 'Accept-Version': string, body: {approve: boolean}}; export type CreateApiCardsCardId3dsAnswerInitiateActionIdOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Respond to 3DS verification * * POST /cards/{cardId}/3ds-answer/{initiateActionId} */ export const createApiCardsCardId3dsAnswerInitiateActionId = async (args: CreateApiCardsCardId3dsAnswerInitiateActionIdArgs, options?: CreateApiCardsCardId3dsAnswerInitiateActionIdOptions) => { const {baseUrl = "https://sandbox.api.caas.reap.global", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['Accept-Version'] != null) headers.set("Accept-Version", String(args['Accept-Version'])) if (ApiKeyAuth !== undefined) headers.set("x-reap-api-key", ApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/cards/${encodeURIComponent(String(args.cardId))}/3ds-answer/${encodeURIComponent(String(args.initiateActionId))}${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 };