/// <summary> /// Updates the given <see cref="ShopifyFulfillment"/>. Id must not be null. /// </summary> /// <param name="orderId">The order id to which the fulfillments belong.</param> /// <param name="fulfillment">The <see cref="ShopifyFulfillment"/> to update.</param> /// <returns>The updated <see cref="ShopifyFulfillment"/>.</returns> public async Task <ShopifyFulfillment> UpdateAsync(long orderId, ShopifyFulfillment fulfillment) { var req = RequestEngine.CreateRequest($"orders/{orderId}/fulfillments/{fulfillment.Id.Value}.json", Method.PUT, "fulfillment"); req.AddJsonBody(new { fulfillment }); return(await RequestEngine.ExecuteRequestAsync <ShopifyFulfillment>(_RestClient, req)); }
/// <summary> /// Creates a new <see cref="ShopifyFulfillment"/> on the store. /// </summary> /// <param name="orderId">The order id to which the fulfillments belong.</param> /// <param name="fulfillment">A new <see cref="ShopifyFulfillment"/>. Id should be set to null.</param> /// <param name="notifyCustomer">Whether the customer should be notified that the fulfillment /// has been created.</param> /// <returns>The new <see cref="ShopifyFulfillment"/>.</returns> public async Task<ShopifyFulfillment> CreateAsync(long orderId, ShopifyFulfillment fulfillment, bool notifyCustomer) { var req = RequestEngine.CreateRequest($"orders/{orderId}/fulfillments.json", Method.POST, "fulfillment"); //Convert the fulfillment to a dictionary and add the notifyCustomer prop var body = fulfillment.ToDictionary(); body.Add("notify_customer", notifyCustomer); req.AddJsonBody(new { fulfillment = body }); return await RequestEngine.ExecuteRequestAsync<ShopifyFulfillment>(_RestClient, req); }
/// <summary> /// Creates a new <see cref="ShopifyFulfillment"/> on the store. /// </summary> /// <param name="orderId">The order id to which the fulfillments belong.</param> /// <param name="fulfillment">A new <see cref="ShopifyFulfillment"/>. Id should be set to null.</param> /// <param name="notifyCustomer">Whether the customer should be notified that the fulfillment /// has been created.</param> /// <returns>The new <see cref="ShopifyFulfillment"/>.</returns> public async Task <ShopifyFulfillment> CreateAsync(long orderId, ShopifyFulfillment fulfillment, bool notifyCustomer) { var req = RequestEngine.CreateRequest($"orders/{orderId}/fulfillments.json", Method.POST, "fulfillment"); //Convert the fulfillment to a dictionary and add the notifyCustomer prop var body = fulfillment.ToDictionary(); body.Add("notify_customer", notifyCustomer); req.AddJsonBody(new { fulfillment = body }); return(await RequestEngine.ExecuteRequestAsync <ShopifyFulfillment>(_RestClient, req)); }
/// <summary> /// Updates the given <see cref="ShopifyFulfillment"/>. Id must not be null. /// </summary> /// <param name="orderId">The order id to which the fulfillments belong.</param> /// <param name="fulfillment">The <see cref="ShopifyFulfillment"/> to update.</param> /// <returns>The updated <see cref="ShopifyFulfillment"/>.</returns> public async Task<ShopifyFulfillment> UpdateAsync(long orderId, ShopifyFulfillment fulfillment) { var req = RequestEngine.CreateRequest($"orders/{orderId}/fulfillments/{fulfillment.Id.Value}.json", Method.PUT, "fulfillment"); req.AddJsonBody(new { fulfillment }); return await RequestEngine.ExecuteRequestAsync<ShopifyFulfillment>(_RestClient, req); }