export type PaymentRuleActionRequest = {type: 'ACTIVATE' | 'DEACTIVATE'}; export type CreateApiPaymentV1RulesIdActionsArgs = {id: string, body: PaymentRuleActionRequest}; export type CreateApiPaymentV1RulesIdActionsOptions = {baseUrl?: string | undefined, BearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Activate or deactivate payment rule * * POST /payment/v1/rules/{id}/actions */ export const createApiPaymentV1RulesIdActions = async (args: CreateApiPaymentV1RulesIdActionsArgs, options?: CreateApiPaymentV1RulesIdActionsOptions) => { const {baseUrl = "https://api.sandbox.bvnk.com", fetch: fetchFn = fetch, BearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (BearerAuth !== undefined) headers.set('authorization', `Bearer ${BearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/payment/v1/rules/${encodeURIComponent(String(args.id))}/actions${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 };