export type PropertyRecord = {property_record_id?: string | undefined, property_id: string, property_name?: string | undefined, property_value?: (string | number | number | boolean | Array | Record) | undefined, last_change?: string | undefined}; export type PurchaseItem = {purchase_item_id?: string | undefined, product_id: string, product_name?: string | undefined, product_group_id?: string | undefined, product_group_name?: string | undefined, product_brand_id?: string | undefined, product_brand_name?: string | undefined, external_id?: string | undefined, purchase_item_type_id: string, price: number, amount: number, vat_rate: number, additional_properties?: Array | undefined}; export type Purchase = {purchase_id?: string | undefined, customer_id: string, store_id: string, external_purchase_id: string, payment_time: string, items_count: number, purchase_items?: Array | undefined, type_id: string, total_price: number, currency_id: string, card_number?: string | undefined, cashdesk_number: string, last_change?: string | undefined, purchase_property_records?: Array | undefined}; export type UpdateApiPurchasesPurchaseIdArgs = {'Accept-Language'?: string | undefined, purchase_id: string, body: {purchase: Purchase}}; export type UpdateApiPurchasesPurchaseIdOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update a purchase * * PUT /purchases/{purchase_id} * * Also accepts auth: basicAuth */ export const updateApiPurchasesPurchaseId = async (args: UpdateApiPurchasesPurchaseIdArgs, options?: UpdateApiPurchasesPurchaseIdOptions) => { const {baseUrl = "https://sandbox.crmcarecloud.com/webservice/rest-api/enterprise-interface/v1.0", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['Accept-Language'] != null) headers.set("Accept-Language", String(args['Accept-Language'])) if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/purchases/${encodeURIComponent(String(args.purchase_id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 };