コード例 #1
0
        public virtual async Task <Fulfillment> CreateAsync(long orderId, Fulfillment fulfillment, bool notifyCustomer)
        {
            // Set the notifyCustomer property on the fulfillment
            fulfillment.NotifyCustomer = notifyCustomer;

            return(await CreateAsync(orderId, fulfillment));
        }
コード例 #2
0
        /// <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="fulfillment">A new <see cref="Fulfillment"/>. Id should be set to null.</param>
        /// <returns>The new <see cref="Fulfillment"/>.</returns>
        public virtual async Task <Fulfillment> CreateAsync(long orderId, Fulfillment fulfillment)
        {
            var req  = PrepareRequest($"orders/{orderId}/fulfillments.json");
            var body = fulfillment.ToDictionary();

            var content = new JsonContent(new
            {
                fulfillment = body
            });

            return(await ExecuteRequestAsync <Fulfillment>(req, HttpMethod.Post, content, "fulfillment"));
        }
コード例 #3
0
        /// <summary>
        /// Updates the given <see cref="Fulfillment"/>.
        /// </summary>
        /// <param name="orderId">The order id to which the fulfillments belong.</param>
        /// <param name="">Id of the object being updated.</param>
        /// <param name="fulfillment">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 fulfillment, bool notifyCustomer = false)
        {
            var req = PrepareRequest($"orders/{orderId}/fulfillments/{fulfillmentId}.json");

            var body = fulfillment.ToDictionary();

            body.Add("notify_customer", notifyCustomer);

            var content = new JsonContent(new
            {
                fulfillment = body
            });

            return(await ExecuteRequestAsync <Fulfillment>(req, HttpMethod.Put, content, "fulfillment"));
        }
コード例 #4
0
        /// <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="fulfillment">The <see cref="Fulfillment"/> to update.</param>
        /// <param name="cancellationToken">Cancellation Token</param>
        /// <returns>The updated <see cref="Fulfillment"/>.</returns>
        public virtual async Task <Fulfillment> UpdateAsync(long orderId, long fulfillmentId, Fulfillment fulfillment, CancellationToken cancellationToken = default)
        {
            var req     = PrepareRequest($"orders/{orderId}/fulfillments/{fulfillmentId}.json");
            var body    = fulfillment.ToDictionary();
            var content = new JsonContent(new
            {
                fulfillment = body
            });

            var response = await ExecuteRequestAsync <Fulfillment>(req, HttpMethod.Put, cancellationToken, content, "fulfillment");

            return(response.Result);
        }
コード例 #5
0
        /// <summary>
        /// Updates the given <see cref="Fulfillment"/>.
        /// </summary>
        /// <param name="orderId">The order id to which the fulfillments belong.</param>
        /// <param name="">Id of the object being updated.</param>
        /// <param name="fulfillment">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 fulfillment)
        {
            var req     = PrepareRequest($"orders/{orderId}/fulfillments/{fulfillmentId}.json");
            var content = new JsonContent(new
            {
                fulfillment = fulfillment
            });

            return(await ExecuteRequestAsync <Fulfillment>(req, HttpMethod.Put, content, "fulfillment"));
        }
コード例 #6
0
        public virtual async Task<Fulfillment> UpdateAsync(long orderId, long fulfillmentId, Fulfillment fulfillment, bool notifyCustomer = false)
        {
            // Set the notifyCustomer property on the fulfillment
            fulfillment.NotifyCustomer = notifyCustomer;

            return await UpdateAsync(orderId, fulfillmentId, fulfillment);
        }