Ejemplo n.º 1
0
        /// <summary>
        /// Creates a tax transaction record in the calculating system. Use this once on purchase, payment capture, or fulfillment.
        /// </summary>
        public async Task <OrderTaxCalculation> CommitTransactionAsync(OrderWorksheet orderWorksheet, List <OrderPromotion> promotions)
        {
            var orders = await CalculateTax(orderWorksheet);

            foreach (var response in orders)
            {
                response.request.TransactionDate = DateTime.Now.ToString("yyyy/MM/dd");
                response.request.SalesTax        = response.response.TaxableAmount;
            }

            await Throttler.RunAsync(orders, 100, 8, async order => await MakeRequest(() => _client.CreateOrderAsync(order)));

            var orderTaxCalculation = orders.ToOrderTaxCalculation();

            return(orderTaxCalculation);
        }