public async Task TipDeliveryAsync() { Random rnd = new Random(); var tipAmount = rnd.Next(1, 1000); var deliveries = await PostmatesClient.GetDeliveriesAsync(); var deliveryToTip = deliveries.Where(d => d.Status == PostmatesDeliveryStatuses.Delivered && d.Tip is null).FirstOrDefault(); var tipArgs = new PostmatesDeliveryTipArgs() { TipByCustomer = tipAmount }; var result = await PostmatesClient.TipCourierAsync(deliveryToTip.Id, tipArgs); Assert.True(result.Tip == tipAmount); Assert.True(result.Id == deliveryToTip.Id); }
/// <summary> /// After an order has completed, you can add a tip for the courier. /// </summary> public async Task <PostmatesDelivery> TipCourierAsync(string deliveryId, PostmatesDeliveryTipArgs args, CancellationToken cancellationToken = default) { var postArgs = FormatJson(args); return(await PostFormAsync <PostmatesDelivery>(FormatPath($"deliveries/{deliveryId}"), postArgs)); }