private void ProcessOrderAux(long shopifyOrderId)
 {
     try
     {
         ProcessOrder(shopifyOrderId);
     }
     catch (Exception ex)
     {
         _systemLogger.Error(ex);
         _logService.Log($"Encounter error syncing Payments for Shopify Order {shopifyOrderId}");
         _syncOrderRepository.IncreaseOrderErrorCount(shopifyOrderId);
     }
 }
예제 #2
0
        public void RunOrder(long shopifyOrderId)
        {
            try
            {
                CorrectSalesOrderWithUnknownRef(shopifyOrderId);

                // *** SAVE THIS, JONES! - This little branch of logic increases throughput!!
                //
                var orderPreAction = _pendingActionService.Create(shopifyOrderId).OrderAction;
                if (orderPreAction.ActionCode == ActionCode.UpdateInAcumatica && !orderPreAction.IsValid)
                {
                    _acumaticaOrderPaymentPut.ProcessOrder(shopifyOrderId);
                }

                var orderAction = _pendingActionService.Create(shopifyOrderId).OrderAction;
                if (!orderAction.IsValid)
                {
                    _logService.Log(LogBuilder.SkippingInvalidShopifyOrder(shopifyOrderId));
                    return;
                }

                if (orderAction.ActionCode == ActionCode.CreateInAcumatica)
                {
                    CreateSalesOrder(shopifyOrderId);
                    _acumaticaOrderPaymentPut.ProcessOrder(shopifyOrderId);
                    return;
                }

                if (orderAction.ActionCode == ActionCode.UpdateInAcumatica)
                {
                    _acumaticaOrderPaymentPut.ProcessOrder(shopifyOrderId);
                    UpdateExistingSalesOrder(shopifyOrderId);
                    return;
                }

                if (orderAction.ActionCode == ActionCode.CreateBlankSyncRecord)
                {
                    CreateBlankSalesOrderRecord(shopifyOrderId);
                    return;
                }
            }
            catch (Exception ex)
            {
                _systemLogger.Error(ex);
                _logService.Log($"Encountered error syncing Shopify Order {shopifyOrderId}");
                _syncOrderRepository.IncreaseOrderErrorCount(shopifyOrderId);
            }
        }
예제 #3
0
        private void PushFulfillmentToShopifyAux(AcumaticaSoShipment salesOrderShipment)
        {
            try
            {
                CorrectFulfillmentWithUnknownRef(salesOrderShipment.AcumaticaShipmentNbr);

                var syncReadiness = _fulfillmentStatusService.Validate(salesOrderShipment);

                if (syncReadiness.Success)
                {
                    PushFulfillmentToShopify(salesOrderShipment.AcumaticaShipmentNbr);
                }
            }
            catch (Exception ex)
            {
                _pushLogger.Error(ex);
                _logService.Log($"Encounter error syncing {salesOrderShipment.LogDescriptor()}");
                _syncOrderRepository
                .IncreaseOrderErrorCount(salesOrderShipment.AcumaticaSalesOrder.ShopifyOrder.ShopifyOrderId);
                throw;
            }
        }