diff options
author | Florian Dold <florian@dold.me> | 2024-01-15 19:38:34 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2024-01-15 19:38:41 +0100 |
commit | cc07d767abb0c1ba37be92014b06a94d3a3206d9 (patch) | |
tree | dbd037f08b4a438a3cc786778876b83762fc175e /packages/taler-util | |
parent | 728bab6584ee5632def40f22103dc7578ec3d64c (diff) | |
download | wallet-core-cc07d767abb0c1ba37be92014b06a94d3a3206d9.tar.xz |
wallet-core: fix pay state machine when order is deleted
Diffstat (limited to 'packages/taler-util')
-rw-r--r-- | packages/taler-util/src/MerchantApiClient.ts | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/packages/taler-util/src/MerchantApiClient.ts b/packages/taler-util/src/MerchantApiClient.ts index 2e10e394a..fe523cd43 100644 --- a/packages/taler-util/src/MerchantApiClient.ts +++ b/packages/taler-util/src/MerchantApiClient.ts @@ -239,6 +239,21 @@ export class MerchantApiClient { ); } + async deleteOrder(req: { orderId: string; force?: boolean }): Promise<void> { + let url = new URL(`private/orders/${req.orderId}`, this.baseUrl); + if (req.force) { + url.searchParams.set("force", "yes"); + } + const resp = await this.httpClient.fetch(url.href, { + method: "DELETE", + body: req, + headers: this.makeAuthHeader(), + }); + if (resp.status !== 204) { + throw Error(`failed to delete order (status ${resp.status})`); + } + } + async queryPrivateOrderStatus( query: PrivateOrderStatusQuery, ): Promise<MerchantOrderPrivateStatusResponse> { |