Пример #1
0
        private void InjectTotalsFromAcumatica(ShopifyOrder shopifyOrderRecord, OrderAnalysisTotals output)
        {
            SalesOrder acumaticaOrder    = null;
            var        acumaticaOrderNbr = shopifyOrderRecord.AcumaticaSalesOrder.AcumaticaOrderNbr;

            _acumaticaHttpContext.SessionRun(() =>
            {
                var json = _salesOrderClient
                           .RetrieveSalesOrder(acumaticaOrderNbr, SalesOrderType.SO, Expand.Totals);
                acumaticaOrder = json.ToSalesOrderObj();
            });

            output.AcumaticaOrderLineTotal = (decimal)acumaticaOrder.Totals.LineTotalAmount.value;
            output.AcumaticaOrderFreight   = (decimal)acumaticaOrder.Totals.Freight.value;
            output.AcumaticaTaxTotal       = (decimal)acumaticaOrder.Totals.TaxTotal.value;
            output.AcumaticaOrderTotal     = (decimal)acumaticaOrder.OrderTotal.value;
        }
Пример #2
0
        public OrderAnalysisTotals GetOrderFinancialSummary(long shopifyOrderId)
        {
            var shopifyOrderRecord =
                ShopifyOrderQueryable.FirstOrDefault(x => x.ShopifyOrderId == shopifyOrderId);

            var shopifyOrder = _shopifyJsonService.RetrieveOrder(shopifyOrderId);

            var output = new OrderAnalysisTotals();

            output.ShopifyOrderNbr  = shopifyOrderRecord.ShopifyOrderNumber;
            output.ShopifyOrderId   = shopifyOrderRecord.ShopifyOrderId;
            output.ShopifyOrderHref = _shopifyUrlService.ShopifyOrderUrl(shopifyOrderRecord.ShopifyOrderId);

            output.ShopifyCustomerId   = shopifyOrderRecord.ShopifyCustomer.ShopifyCustomerId;
            output.ShopifyCustomerHref =
                _shopifyUrlService
                .ShopifyCustomerUrl(shopifyOrderRecord.ShopifyCustomer.ShopifyCustomerId);

            output.ShopifyTotalLinePrice     = shopifyOrder.LineItemAmountAfterDiscountAndRefund;
            output.ShopifyShippingPriceTotal = shopifyOrder.NetShippingPrice;
            output.ShopifyTotalTax           = shopifyOrder.NetTax;
            output.ShopifyOrderTotal         = shopifyOrder.NetOrderTotal;

            output.ShopifyOrderPayment  = shopifyOrderRecord.ShopifyPaymentAmount();
            output.ShopifyRefundPayment = shopifyOrderRecord.RefundTransactions().Sum(x => x.ShopifyAmount);
            output.ShopifyNetPayment    = shopifyOrderRecord.ShopifyNetPayment();

            output.ShopifyRefundItemTotal     = shopifyOrder.RefundLineItemTotal;
            output.ShopifyRefundShippingTotal = shopifyOrder.RefundShippingTotal;
            output.ShopifyRefundTaxTotal      = shopifyOrder.RefundTotalTax;
            output.ShopifyCreditTotal         = shopifyOrder.RefundCreditTotal;
            output.ShopifyDebitTotal          = shopifyOrder.RefundDebitTotal;
            output.ShopifyRefundTotal         = shopifyOrder.RefundTotal;
            output.ShopifyRefundOverpayment   = shopifyOrder.RefundOverpayment;

            if (shopifyOrderRecord.ExistsInAcumatica() &&
                shopifyOrderRecord.AcumaticaSalesOrder.AcumaticaOrderNbr != AcumaticaSyncConstants.BlankRefNbr)
            {
                output.AcumaticaSalesOrderNbr
                    = shopifyOrderRecord.AcumaticaSalesOrder.AcumaticaOrderNbr ?? "BLANK";
                output.AcumaticaSalesOrderHref
                    = _acumaticaUrlService.AcumaticaSalesOrderUrl(
                          SalesOrderType.SO, shopifyOrderRecord.AcumaticaSalesOrder.AcumaticaOrderNbr);

                output.AcumaticaCustomerNbr = shopifyOrderRecord.AcumaticaSalesOrder.AcumaticaCustomer.AcumaticaCustomerId;
                output.AcumaticaCustomerHref
                    = _acumaticaUrlService.AcumaticaCustomerUrl(
                          shopifyOrderRecord.AcumaticaSalesOrder.AcumaticaCustomer.AcumaticaCustomerId);

                var acumaticaOrder = shopifyOrderRecord.AcumaticaSalesOrder;
                output.AcumaticaOrderLineTotal = acumaticaOrder.AcumaticaLineTotal;
                output.AcumaticaOrderFreight   = acumaticaOrder.AcumaticaFreight;
                output.AcumaticaTaxTotal       = acumaticaOrder.AcumaticaTaxTotal;
                output.AcumaticaOrderTotal     = acumaticaOrder.AcumaticaOrderTotal;
            }

            output.AcumaticaPaymentTotal       = shopifyOrderRecord.AcumaticaPaymentAmount();
            output.AcumaticaRefundPaymentTotal = shopifyOrderRecord.AcumaticaCustomerRefundTotal();
            output.AcumaticaNetPaymentTotal    = shopifyOrderRecord.AcumaticaNetPaymentAmount();

            output.AcumaticaRefundCreditTotal = shopifyOrderRecord.AcumaticaCreditMemosTotal();
            output.AcumaticaRefundDebitTotal  = shopifyOrderRecord.AcumaticaDebitMemosTotal();

            output.AcumaticaInvoiceTaxTotal = shopifyOrderRecord.AcumaticaInvoiceTaxTotal();
            output.AcumaticaInvoiceTotal    = shopifyOrderRecord.AcumaticaInvoiceTotal();

            return(output);
        }