/// <summary> /// Creates a new <see cref="Fulfillment"/> on the order. /// </summary> /// <param name="orderId">The order id to which the fulfillments belong.</param> /// <param name="inputObject">A new <see cref="Fulfillment"/>. 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="Fulfillment"/>.</returns> public virtual async Task <Fulfillment> CreateAsync(long orderId, Fulfillment inputObject, bool notifyCustomer = false) { var body = inputObject.ToDictionary(); body["notify_customer"] = notifyCustomer; var root = new Dictionary <string, object> { { "fulfillment", body } }; return(await MakeRequestAsync <Fulfillment>($"orders/{orderId}/fulfillments.json", HttpMethod.Post, "fulfillment", root)); }
/// <summary> /// Updates the given <see cref="Fulfillment"/>. /// </summary> /// <param name="orderId">The order id to which the fulfillments belong.</param> /// <param name="fulfillmentId">Id of the object being updated.</param> /// <param name="inputObject">The <see cref="Fulfillment"/> to update.</param> /// <returns>The updated <see cref="Fulfillment"/>.</returns> public virtual async Task <Fulfillment> UpdateAsync(long orderId, long fulfillmentId, Fulfillment inputObject) { var root = new Dictionary <string, object> { { "fulfillment", inputObject } }; return (await MakeRequestAsync <Fulfillment>($"orders/{orderId}/fulfillments/{fulfillmentId}.json", HttpMethod.Put, "fulfillment", root)); }