Skip to content

Commit 1800d3b

Browse files
committed
Merge branch 'feat/availability-rules'
2 parents eb2f339 + d0665c9 commit 1800d3b

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

libs/TrybeSDK/Api/Shop/Orders/OrderOperations.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,17 @@ partial class ShopOperations
2222

2323
public partial interface IOrderOperations
2424
{
25+
/// <summary>
26+
/// Cancels an order. The Order ID can also be a Basket ID.
27+
/// HTTP POST /shop/orders/{orderId}/cancel
28+
/// </summary>
29+
/// <param name="orderId">The order ID, or the basket ID.</param>
30+
/// <param name="cancellationToken">The cancellation token.</param>
31+
/// <returns>The order instance.</returns>
32+
Task<TrybeResponse<Order>> CancelOrderAsync(
33+
string orderId,
34+
CancellationToken cancellationToken = default);
35+
2536
/// <summary>
2637
/// Submits an order. The Order ID can also be a Basket ID.
2738
/// HTTP POST /shop/orders/{orderId}/submit
@@ -49,6 +60,18 @@ Task<TrybeResponse<Order>> UpdateOrderAsync(
4960

5061
public partial class OrderOperations(PathString path, ApiClient client) : IOrderOperations
5162
{
63+
public async Task<TrybeResponse<Order>> CancelOrderAsync(
64+
string orderId,
65+
CancellationToken cancellationToken = default)
66+
{
67+
Ensure.IsNotNullOrEmpty(orderId, nameof(orderId));
68+
69+
var request = new TrybeRequest(HttpMethod.Post, path + $"/{orderId}/cancel");
70+
71+
return await client.FetchAsync<Order>(request, cancellationToken)
72+
.ConfigureAwait(false);
73+
}
74+
5275
public async Task<TrybeResponse<Order>> SubmitOrderAsync(
5376
string orderId,
5477
CancellationToken cancellationToken = default)

0 commit comments

Comments
 (0)