private void SetFinancialInformationobjectsData(PrepareAndImportOrdersParams orderParams) { SOOrder financialInformation = (SOOrder)orderParams.objSOOrderEntry.Document.Current; if (financialInformation == null) { return; } if (orderParams.objSOOrderEntry.sosetup.Current != null) { bool isCarrierAvaliable = false; SOSetupAmazonExt objSOOSetupext = orderParams.objSOOrderEntry.sosetup.Current.GetExtension <SOSetupAmazonExt>(); if (orderParams != null && orderParams.objSOProcessOrderRecord != null && (orderParams.objSOProcessOrderRecord.Carrier != null || !string.IsNullOrEmpty(orderParams.objSOProcessOrderRecord.Carrier))) { isCarrierAvaliable = orderParams.listOfCarriers.Any(x => x.ToLower().Trim() == orderParams.objSOProcessOrderRecord.Carrier.ToLower().Trim()); } if (isCarrierAvaliable) { financialInformation.ShipVia = orderParams.objSOProcessOrderRecord.Carrier; } else if (objSOOSetupext != null && !string.IsNullOrEmpty(objSOOSetupext.UsrAmazonShipVia)) { financialInformation.ShipVia = objSOOSetupext.UsrAmazonShipVia; } orderParams.objSOOrderEntry.Document.Update(financialInformation); } AssignValueAsPerIntegrationMapping(orderParams.objliUsrMapping, financialInformation, orderParams.ObjCurrentOrder, null, /*SOConstants.currentDocument*/ orderParams.objSOOrderEntry.CurrentDocument.View.Name); orderParams.objSOOrderEntry.Document.Update(financialInformation); }
private void SetSOHeaderObjectsData(PrepareAndImportOrdersParams orderParams) { SOOrder newOrder = new SOOrder(); if (orderParams.objSOOrderEntry.sosetup.Current != null) { SOSetupAmazonExt objSOOSetupext = orderParams.objSOOrderEntry.sosetup.Current.GetExtension <SOSetupAmazonExt>(); if (objSOOSetupext != null && objSOOSetupext.UsrGuestCustID.HasValue) { newOrder.OrderType = orderParams.objSOAmazonSetup.OrderType; newOrder = (SOOrder)orderParams.objSOOrderEntry.Document.Cache.Insert(newOrder); newOrder.CustomerID = objSOOSetupext.UsrGuestCustID; } else { throw new PXException(SOMessages.guestCustomerErrorMsg); } } AssignValueAsPerIntegrationMapping(orderParams.objliUsrMapping, newOrder, orderParams.ObjCurrentOrder, null, orderParams.objSOOrderEntry.Document.View.Name); newOrder.OrderDesc = !string.IsNullOrEmpty(orderParams.ObjCurrentOrder.FulfillmentChannel) ? orderParams.ObjCurrentOrder.FulfillmentChannel == SOConstants.fulfillmentChannelAFN ? string.IsNullOrEmpty(newOrder.OrderDesc) ? SOMessages.fbaOrder : newOrder.OrderDesc + " - " + SOMessages.fbaOrder : orderParams.ObjCurrentOrder.FulfillmentChannel == SOConstants.fulfillmentChannelMFN ? string.IsNullOrEmpty(newOrder.OrderDesc) ? SOMessages.fbmOrder : newOrder.OrderDesc + " - " + SOMessages.fbmOrder : newOrder.OrderDesc : newOrder.OrderDesc; newOrder.DefaultSiteID = orderParams.objSOAmazonSetup.DfltWarehouseID; SOOrderAmazonExt newOrderExt = newOrder.GetExtension <SOOrderAmazonExt>(); if (newOrderExt != null) { newOrderExt.UsrAmazonOrderID = orderParams.ObjCurrentOrder.AmazonOrderId; } orderParams.objSOOrderEntry.Document.Current = newOrder; orderParams.objSOOrderEntry.Document.Update(orderParams.objSOOrderEntry.Document.Current); }
private void SetDocumentLevelDiscountandTaxData(PrepareAndImportOrdersParams orderParams) { if (taxtotal <= 0) { return; } SOOrder currentFin = (SOOrder)orderParams.objSOOrderEntry.Document.Current; if (currentFin != null && orderParams.objSOOrderEntry.sosetup.Current != null) { SOSetupAmazonExt objSOOSetupext = orderParams.objSOOrderEntry.sosetup.Current.GetExtension <SOSetupAmazonExt>(); if (objSOOSetupext != null && !string.IsNullOrEmpty(objSOOSetupext.UsrAmazonTaxID)) { if (currentFin.TaxZoneID != objSOOSetupext.UsrAmazonTaxZoneID) { currentFin.OverrideTaxZone = true; currentFin = orderParams.objSOOrderEntry.CurrentDocument.Update(currentFin); currentFin.TaxZoneID = objSOOSetupext.UsrAmazonTaxZoneID; currentFin = orderParams.objSOOrderEntry.CurrentDocument.Update(currentFin); } if (currentFin.TaxZoneID != objSOOSetupext.UsrAmazonTaxZoneID) { return; } SOTaxTran orderTax = (SOTaxTran)orderParams.objSOOrderEntry.Taxes.Select(); if (orderTax == null && !string.IsNullOrEmpty(objSOOSetupext.UsrAmazonTaxID)) { orderTax = (SOTaxTran)orderParams.objSOOrderEntry.Taxes.Cache.Insert(); orderTax.OrderType = orderParams.objSOOrderEntry.Document.Current.OrderType; orderTax.OrderNbr = orderParams.objSOOrderEntry.Document.Current.OrderNbr; orderTax.LineNbr = int.MaxValue; orderTax.TaxID = objSOOSetupext.UsrAmazonTaxID; orderParams.objSOOrderEntry.Taxes.Cache.Update(orderTax); orderTax.CuryTaxableAmt = taxableamount; orderTax.CuryTaxAmt = taxtotal; orderTax.TaxRate = taxRate; orderParams.objSOOrderEntry.Taxes.Cache.Update(orderTax); orderParams.objSOOrderEntry.Document.SetValueExt <SOOrder.curyTaxTotal>(orderParams.objSOOrderEntry.Document.Current, taxtotal); orderTotal = orderParams.objSOOrderEntry.Document.Current.OrderTotal + orderTax.CuryTaxAmt; orderParams.objSOOrderEntry.Document.SetValueExt <SOOrder.curyOrderTotal>(orderParams.objSOOrderEntry.Document.Current, orderTotal); orderParams.objSOOrderEntry.Document.Cache.Update(orderParams.objSOOrderEntry.Document.Current); } else if (orderTax != null && !string.IsNullOrEmpty(objSOOSetupext.UsrAmazonTaxID)) { orderTax.CuryTaxAmt = taxtotal; orderParams.objSOOrderEntry.Taxes.Cache.Update(orderTax); orderParams.objSOOrderEntry.Document.SetValueExt <SOOrder.curyTaxTotal>(orderParams.objSOOrderEntry.Document.Current, taxtotal); orderTotal = orderParams.objSOOrderEntry.Document.Current.OrderTotal + orderTax.CuryTaxAmt; orderParams.objSOOrderEntry.Document.SetValueExt <SOOrder.curyOrderTotal>(orderParams.objSOOrderEntry.Document.Current, orderTotal); orderParams.objSOOrderEntry.Document.Cache.Update(orderParams.objSOOrderEntry.Document.Current); } } } }
internal static bool IsSOPreferencesDetailsExist(SOOrderEntry orderEntry, SOSetupAmazonExt objSOOSetupext) { if (orderEntry.sosetup.Current != null && objSOOSetupext != null && objSOOSetupext.UsrGuestCustID.HasValue && !string.IsNullOrEmpty(objSOOSetupext.UsrAmazonTaxZoneID) && !string.IsNullOrEmpty(objSOOSetupext.UsrAmazonTaxID) && !string.IsNullOrEmpty(objSOOSetupext.UsrAmazonShipVia) && !string.IsNullOrEmpty(objSOOSetupext.UsrAmazonPaymentMethodID) && objSOOSetupext.UsrAmazonInitialFromDate != null) { return(true); } else { return(false); } }
protected virtual void SOSetup_UsrAmazonInitialFromDate_FieldVerifying(PXCache sender, PXFieldVerifyingEventArgs e) { SOSetup row = e.Row as SOSetup; if (row == null) { return; } SOSetupAmazonExt objSOSetupExt = row.GetExtension <SOSetupAmazonExt>(); if (objSOSetupExt != null && e.NewValue != null && Convert.ToDateTime(e.NewValue) > Base.Accessinfo.BusinessDate) { sender.RaiseExceptionHandling <SOSetupAmazonExt.usrAmazonInitialFromDate>(e.Row, null, new PXSetPropertyException(SOMessages.DateValidation)); } }
public void CreatePaymentProcess(PrepareAndImportOrdersParams orderParams) { SOOrder order = orderParams.objSOOrderEntry.Document.Current; SOOrderAmazonExt OrderExt = order.GetExtension <SOOrderAmazonExt>(); if (orderParams.objSOOrderEntry.sosetup.Current != null) { SOSetupAmazonExt objSOOSetupext = orderParams.objSOOrderEntry.sosetup.Current.GetExtension <SOSetupAmazonExt>(); if (objSOOSetupext != null && !string.IsNullOrEmpty(objSOOSetupext.UsrAmazonPaymentMethodID)) { string paymentType = ARPaymentType.Payment; orderParams.paymentGraph.Clear(); ARPayment payment = new ARPayment() { DocType = paymentType }; payment = PXCache <ARPayment> .CreateCopy(orderParams.paymentGraph.Document.Insert(payment)); payment.CustomerID = order.CustomerID; payment.CustomerLocationID = order.CustomerLocationID; payment.PaymentMethodID = objSOOSetupext.UsrAmazonPaymentMethodID; payment.PMInstanceID = order.PMInstanceID; payment.CuryOrigDocAmt = 0m; payment.ExtRefNbr = OrderExt != null ? OrderExt.UsrAmazonOrderID : order.OrderNbr; payment.DocDesc = order.OrderDesc; payment = orderParams.paymentGraph.Document.Update(payment); SOAdjust adj = new SOAdjust() { AdjdOrderType = order.OrderType.Trim(), AdjdOrderNbr = order.OrderNbr.Trim() }; orderParams.paymentGraph.SOAdjustments.Insert(adj); if (payment.CuryOrigDocAmt == 0m) { payment.CuryOrigDocAmt = payment.CurySOApplAmt; payment = orderParams.paymentGraph.Document.Update(payment); } orderParams.paymentGraph.Actions.PressSave(); if (orderParams.paymentGraph.Actions.Contains("Release")) { orderParams.paymentGraph.Actions["Release"].Press(); } } } }
protected virtual void SOSetup_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { SOSetup row = e.Row as SOSetup; if (row != null) { SOSetupAmazonExt objSOSetupExt = row.GetExtension <SOSetupAmazonExt>(); PXUIFieldAttribute.SetVisible <SOSetupAmazonExt.usrInitialFromDateNote>(sender, row, objSOSetupExt != null && objSOSetupExt.UsrAmazonInitialFromDate != null); SOProcessOrder objSOOrder = PXSelect <SOProcessOrder> .Select(Base); if (objSOOrder != null) { PXUIFieldAttribute.SetEnabled <SOSetupAmazonExt.usrAmazonInitialFromDate>(sender, row, false); } else { PXUIFieldAttribute.SetEnabled <SOSetupAmazonExt.usrAmazonInitialFromDate>(sender, row, true); } } }
private DateTime?GetMaxOrderDate(SOOrderEntry orderEntry, string intetgrationId) { DateTime? maxDate = null; SOProcessOrder objProcessOrder = new PXSelect <SOProcessOrder, Where <SOProcessOrder.integrationID, Equal <Required <SOProcessOrder.integrationID> > >, OrderBy <Desc <SOProcessOrder.amazonOrderDate> > >(this).SelectSingle(intetgrationId); if (objProcessOrder == null || (objProcessOrder != null && objProcessOrder.AmazonOrderDate == null)) { orderEntry.Clear(); SOSetupAmazonExt objSOOSetupext = orderEntry.sosetup.Current.GetExtension <SOSetupAmazonExt>(); if (objSOOSetupext != null && objSOOSetupext.UsrAmazonInitialFromDate != null) { maxDate = objSOOSetupext.UsrAmazonInitialFromDate; } } else if (objProcessOrder != null && objProcessOrder.AmazonOrderDate.HasValue) { maxDate = objProcessOrder.AmazonOrderDate; } return(maxDate); }
private void SetSOLineObjectsData(PrepareAndImportOrdersParams orderParams) { IEnumerable <SOFieldMapping> objMapping = orderParams.objliUsrMapping.Where(x => x.TargetObject == orderParams.objSOOrderEntry.Transactions.View.Name && x.TargetField.ToLower() == SOConstants.inventoryID.ToLower()); if (objMapping.ToList().Count > 0) { foreach (OrderItem currentitem in orderParams.objamwLineItems) { SOLine newitems = (SOLine)orderParams.objSOOrderEntry.Transactions.Cache.Insert(); foreach (SOFieldMapping data in orderParams.objliUsrMapping.Where(x => x.TargetObject == orderParams.objSOOrderEntry.Transactions.View.Name && x.TargetField.ToLower() == SOConstants.inventoryID.ToLower())) { if (data.SourceObject.ToLower().Trim() == SOConstants.orderItemTag.ToLower()) { string fieldValue = currentitem != null?Convert.ToString(currentitem.GetType().GetProperty(data.SourceField).GetValue(currentitem, null)) : string.Empty; string itemCode = SOLineInventoryItemAmazonExtAttribute.GetInventoryCode(orderParams.objSOOrderEntry.Transactions.Cache, fieldValue); InventoryItem item = PXSelect <InventoryItem, Where <InventoryItem.inventoryCD, Equal <Required <InventoryItem.inventoryCD> >, And <InventoryItem.itemStatus, Equal <InventoryItemStatus.active> > > > .Select(orderParams.objSOOrderEntry, itemCode); newitems.InventoryID = item != null && item.InventoryID.HasValue ? item.InventoryID : null; orderParams.objSOOrderEntry.Transactions.Update(newitems); if (newitems.InventoryID.HasValue) { AssignValueAsPerIntegrationMapping(orderParams.objliUsrMapping, newitems, orderParams.ObjCurrentOrder, currentitem, orderParams.objSOOrderEntry.Transactions.View.Name); //Embedd GiftPrice string sGiftWrappPrice = currentitem.GiftWrapPrice != null?Convert.ToString(currentitem.GiftWrapPrice.Amount) : string.Empty; newitems.CuryUnitPrice += String.IsNullOrEmpty(sGiftWrappPrice) ? 0m : Convert.ToDecimal(sGiftWrappPrice); newitems.CuryUnitPrice = newitems.CuryUnitPrice > 0 && currentitem.QuantityOrdered > 0 ? newitems.CuryUnitPrice / currentitem.QuantityOrdered : newitems.CuryUnitPrice; newitems.SiteID = orderParams.objSOAmazonSetup.DfltWarehouseID; SOSetupAmazonExt objSOOSetupext = orderParams.objSOOrderEntry.sosetup.Current.GetExtension <SOSetupAmazonExt>(); if (objSOOSetupext != null && !string.IsNullOrEmpty(objSOOSetupext.UsrAmazonTaxID)) { TaxCategoryDet objTaxDetails = PXSelect <TaxCategoryDet, Where <TaxCategoryDet.taxID, Equal <Required <Tax.taxID> > > > .Select(orderParams.objSOOrderEntry, objSOOSetupext.UsrAmazonTaxID); if (objTaxDetails != null) { newitems.TaxCategoryID = objTaxDetails.TaxCategoryID; } SOLineAmazonExt objnewitemsext = newitems.GetExtension <SOLineAmazonExt>(); if (objnewitemsext != null) { objnewitemsext.UsrAMOrderItemID = currentitem.OrderItemId; } orderParams.objSOOrderEntry.Transactions.Update(newitems); FillDiscountObjectsData(orderParams.objSOOrderEntry, newitems, currentitem); taxtotal += currentitem.GiftWrapTax != null && !string.IsNullOrEmpty(currentitem.GiftWrapTax.Amount) && Convert.ToDecimal(currentitem.GiftWrapTax.Amount) > 0 ? Convert.ToDecimal(currentitem.GiftWrapTax.Amount) : 0; taxtotal += currentitem.ItemTax != null && !string.IsNullOrEmpty(currentitem.ItemTax.Amount) && Convert.ToDecimal(currentitem.ItemTax.Amount) > 0 ? Convert.ToDecimal(currentitem.ItemTax.Amount) : 0; taxtotal += currentitem.ShippingTax != null && !string.IsNullOrEmpty(currentitem.ShippingTax.Amount) && Convert.ToDecimal(currentitem.ShippingTax.Amount) > 0 ? Convert.ToDecimal(currentitem.ShippingTax.Amount) : 0; taxableamount += currentitem.ItemPrice != null && !string.IsNullOrEmpty(currentitem.ItemPrice.Amount) && Convert.ToDecimal(currentitem.ItemPrice.Amount) > 0 ? Convert.ToDecimal(currentitem.ItemPrice.Amount) : 0; shippingprice += currentitem.ShippingPrice != null && !string.IsNullOrEmpty(currentitem.ShippingPrice.Amount) && Convert.ToDecimal(currentitem.ShippingPrice.Amount) > 0 ? Convert.ToDecimal(currentitem.ShippingPrice.Amount) : 0; taxRate = (taxableamount > 0) ? (taxtotal * 100) / taxableamount : 0; } else { throw new PXException(SOMessages.configMissing); } } else { throw new PXException(SOMessages.inventoryItemNotExists); } } else { throw new PXException(SOMessages.inventoryMappedtoOrderItem); } } } } else { throw new PXException(SOMessages.InvMappingErrorMsg); } }
protected virtual void prepareRecords() { List <string> importedRecords = new List <string>(); SOImportFilter currentFilter = Filter.Current; PXLongOperation.StartOperation(this, delegate() { SOOrderEntry orderEntry = PXGraph.CreateInstance <SOOrderEntry>(); SOImportProcess graph = PXGraph.CreateInstance <SOImportProcess>(); SOPartialMaint logGraph = PXGraph.CreateInstance <SOPartialMaint>(); if (currentFilter != null) { if ((string.IsNullOrEmpty(currentFilter.IntegrationID) && currentFilter.ProcessAllTypes == false) || (!string.IsNullOrEmpty(currentFilter.IntegrationID) && currentFilter.ProcessAllTypes == true)) { throw new PXException(SOMessages.validationIntegrationIdandprocessall); } if (currentFilter.TODate.Value.Date > graph.Accessinfo.BusinessDate.Value.Date) { throw new PXException(SOMessages.validationTodateandBusinessDate); } if (currentFilter.LastSyncDate > currentFilter.TODate) { throw new PXException(SOMessages.validationFromandTodate); } try { orderEntry.Clear(); SOSetupAmazonExt objSOOSetupext = orderEntry.sosetup.Current.GetExtension <SOSetupAmazonExt>(); if (SOHelper.IsSOPreferencesDetailsExist(orderEntry, objSOOSetupext)) { SOAmazonSetup objSOAmazonSetupDetails = null; objOrdersParameters = new OrdersParameters(); SOProcessOrder processrecord = null; int?processedCount = 0; bool isValidConfiguration = SOHelper.MarketplaceConfigurations(graph, currentFilter.IntegrationID, out objSOAmazonSetupDetails); // To Get the Max date & time if the same date is processed again //Dhiren-4/11/2019 - We need to revisit date range Delta logic. //SOProcessOrder objProcessOrder = new PXSelect<SOProcessOrder, Where<SOProcessOrder.integrationID, Equal<Required<SOProcessOrder.integrationID>>, // And<SOProcessOrder.amazonOrderDate, Between<Required<SOProcessOrder.amazonOrderDate>, Required<SOProcessOrder.amazonOrderDate>>>>, // OrderBy<Desc<SOProcessOrder.amazonOrderDate>>>(graph).SelectSingle(currentFilter.IntegrationID, currentFilter.LastSyncDate, currentFilter.TODate); //currentFilter.FromDate = objProcessOrder != null && objProcessOrder.AmazonOrderDate.HasValue ? objProcessOrder.AmazonOrderDate : currentFilter.LastSyncDate; currentFilter.FromDate = currentFilter.LastSyncDate; Filter.Cache.Update(currentFilter); if (currentFilter.IntegrationID != null && currentFilter.ProcessAllTypes == false) { if (isValidConfiguration) { int?processId = SOHelper.GetProcessID(graph); PrepareAllRecords(graph, importedRecords, currentFilter, out processrecord, objSOAmazonSetupDetails, processId, out processedCount, logGraph); if (processedCount > 0) { LogProcessCount(processedCount, currentFilter.IntegrationID, logGraph); } graph.Actions.PressSave(); } else { throw new PXException(SOMessages.apidetailsMissing); } } else if (string.IsNullOrEmpty(currentFilter.IntegrationID) && currentFilter.ProcessAllTypes == true) { ImportOrderList.Cache.Clear(); int?processId = SOHelper.GetProcessID(graph); foreach (SOAmazonSetup objSOAmazonSetup in PXSelectReadonly <SOAmazonSetup, Where <SOAmazonSetup.status, Equal <True> > > .Select(graph)) { try { PrepareAllRecords(graph, importedRecords, currentFilter, out processrecord, objSOAmazonSetup, processId, out processedCount, logGraph); if (processedCount > 0) { LogProcessCount(processedCount, objSOAmazonSetup.IntegrationID, logGraph); } processId++; graph.Actions.PressSave(); } catch (Exception ex) { throw new PXException(!string.IsNullOrEmpty(ex.Message) ? ex.Message : ex.InnerException != null && ex.InnerException.InnerException != null ? ex.InnerException.InnerException.Message : SOConstants.exceptionIsEmpty); } } } } else { throw new PXException(SOMessages.configMissing); } } catch (Exception ex) { throw new PXException(!string.IsNullOrEmpty(ex.Message) ? ex.Message : ex.InnerException != null && ex.InnerException.InnerException != null ? ex.InnerException.InnerException.Message : SOConstants.exceptionIsEmpty); } } }); }
public void PrepareAndImportAmazonRecords(SOScheduleProcess graph, List <SOPrepareAndImport> listOfPrepareAndImport) { objSyncOrderResponse = new InvokeServicesCallResponse(); amwOrders = new List <Order>(); amwLineItems = new List <OrderItem>(); SOAmazonSetup objSOAmazonSetup = null; SOPartialMaint logGraph = PXGraph.CreateInstance <SOPartialMaint>(); SOOrderEntry orderEntry = PXGraph.CreateInstance <SOOrderEntry>(); ARPaymentEntry paymentGraph = PXGraph.CreateInstance <ARPaymentEntry>(); bool isErrorOccured = false; DateTime? businessDateTime = PX.Common.PXTimeZoneInfo.Now; List <string> liCarriers = PXSelect <Carrier> .Select(graph).RowCast <Carrier>().Select(c => c.CarrierID).ToList(); try { SOSetupAmazonExt objSOOSetupext = orderEntry.sosetup.Current.GetExtension <SOSetupAmazonExt>(); if (SOHelper.IsSOPreferencesDetailsExist(orderEntry, objSOOSetupext)) { foreach (SOPrepareAndImport currentRecord in listOfPrepareAndImport) { objSOAmazonSetup = null; if (SOHelper.MarketplaceConfigurations(graph, currentRecord.IntegrationID, out objSOAmazonSetup)) { objSyncOrderResponse = objSyncOrderResponse != null ? null : objSyncOrderResponse; if (amwOrders != null && amwOrders.Count > 0) { amwOrders.Clear(); } if (amwLineItems != null && amwLineItems.Count > 0) { amwLineItems.Clear(); } orderEntry.Clear(); logGraph.Clear(); paymentGraph.Clear(); objServiceCallParams = new ServiceCallParameters(); objServiceCallParams.objSOAmazonSetup = objSOAmazonSetup; objServiceCallParams.amwOrderID = string.Empty; objServiceCallParams.methodCall = SOConstants.invokeListOrders; objServiceCallParams.fromDate = currentRecord.LastSyncDate; objServiceCallParams.toDate = currentRecord.ToDate; // Prepare action is invoked objSyncOrderResponse = new SOOrdersServiceCall(clientOrder).InvokeServicesCalls(graph, objServiceCallParams); if (amwLineItems != null && amwLineItems.Count > 0) { amwLineItems.Clear(); } if (objSyncOrderResponse != null && objSyncOrderResponse.objListOrderResponse != null && objSyncOrderResponse.objListOrderResponse.ListOrdersResult != null && objSyncOrderResponse.objListOrderResponse.ListOrdersResult.Orders != null && objSyncOrderResponse.objListOrderResponse.ListOrdersResult.Orders.Count > 0) { amwOrders = objSyncOrderResponse.objListOrderResponse.ListOrdersResult.Orders.ToList(); // Saving the prepare action response objScheduleParams = new PrepareAndImportOrdersParams(); objScheduleParams.objSOPrepareAndImport = currentRecord; objScheduleParams.objSOAmazonSetup = objSOAmazonSetup; objScheduleParams.objSOOrderEntry = orderEntry; objScheduleParams.objSOPartialMaint = logGraph; objScheduleParams.businessDateTime = businessDateTime; objScheduleParams.paymentGraph = paymentGraph; objScheduleParams.listOfCarriers = liCarriers; objScheduleParams.amwOrders = amwOrders; SOHelper.PrepareRecord(graph, objScheduleParams, ref isErrorOccured); if (objSyncOrderResponse.objListOrderResponse.ListOrdersResult.NextToken != null) { objScheduleParams.objNextToken = objSyncOrderResponse.objListOrderResponse.ListOrdersResult.NextToken; objScheduleParams.paymentGraph = paymentGraph; GetAmazonOrdersbyNextToken(graph, objScheduleParams, ref isErrorOccured); } } else { SOLogService.LogImportCount(null, currentRecord.IntegrationID, logGraph, currentRecord.ProcessID, SOConstants.scheduleimportorders, true); } } else { throw new PXException(SOMessages.apidetailsMissing); } } } else { throw new PXException(SOMessages.configMissing); } } catch (Exception ex) { SOLogService.LogImportStatus(objScheduleParams, false, ex.Message); throw new PXException(ex.Message); } }