export type SettlementTimeIndication = {creditDateTime?: string | undefined, debitDateTime?: string | undefined}; export type TransactionIdentification = {approvalCode?: string | undefined, retrievalReferenceNumber?: string | undefined, transactionReference?: string | undefined, transactionDateTime?: string | undefined}; export type CreditorStatusReasonInformationUpdate = {description?: string | undefined, reasonCode?: string | undefined}; export type CreditorPaymentStatusUpdate = {status: 'APPROVED' | 'DECLINED' | 'REJECTED' | 'SETTLED' | 'CANCELLATION_ACCEPTED' | 'CANCELLATION_REJECTED', settlementTimeIndication?: SettlementTimeIndication | undefined, transactionIdentification?: TransactionIdentification | undefined, statusReasonInformation?: Array | undefined}; export type UpdateApiCreditorAgentsIcaPaymentAcceptancesInstructionIdentificationArgs = {ica: string, instruction_identification: string, body: CreditorPaymentStatusUpdate}; export type UpdateApiCreditorAgentsIcaPaymentAcceptancesInstructionIdentificationOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update transaction status * * PUT /creditor-agents/{ica}/payment-acceptances/{instruction_identification} */ export const updateApiCreditorAgentsIcaPaymentAcceptancesInstructionIdentification = async (args: UpdateApiCreditorAgentsIcaPaymentAcceptancesInstructionIdentificationArgs, options?: UpdateApiCreditorAgentsIcaPaymentAcceptancesInstructionIdentificationOptions) => { const {baseUrl = "https://api.mastercard.com/commercial/payments", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/creditor-agents/${encodeURIComponent(String(args.ica))}/payment-acceptances/${encodeURIComponent(String(args.instruction_identification))}${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 };