Skip to content

Commit 326373c

Browse files
committed
updating status to Billit: cannot set OrderStatus, only Paid & PaidDate
1 parent 0b5112b commit 326373c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

backend/src/services/billit/api-client.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,12 @@ export class ApiClient {
116116
/**
117117
* Updates the OrderStatus of an existing Billit order
118118
*/
119-
async patchOrderStatus(billitOrderId: number, status: BillitOrderStatus): Promise<void> {
119+
async patchOrderStatus(billitOrderId: number, status: 'ToPay' | 'Paid'): Promise<void> {
120+
const body = {
121+
Paid: status === 'Paid',
122+
PaidDate: status === 'Paid' ? new Date().toISOString() : null,
123+
};
124+
120125
const response: fetch.Response = await fetch(`${this.config.apiUrl}/orders/${billitOrderId}`, {
121126
method: 'PATCH',
122127
headers: {
@@ -125,7 +130,7 @@ export class ApiClient {
125130
PartyID: this.config.partyId,
126131
ContextPartyID: this.config.contextPartyId,
127132
},
128-
body: JSON.stringify({OrderStatus: status}),
133+
body: JSON.stringify(body),
129134
});
130135

131136
if (!response.ok) {

0 commit comments

Comments
 (0)