private void InitializeRepositories(PXGraph graph) { _graph = graph; _cctranRepository = new CCProcTranRepository(graph); _cpmRepository = new CustomerPaymentMethodRepository(graph); _cpmDetailRepository = new CustomerPaymentMethodDetailRepository(graph); _processingCenterRepository = new CCProcessingCenterRepository(graph); _processingCenterDetailRepository = new CCProcessingCenterDetailRepository(graph); _cashAccountRepository = new CashAccountRepository(graph); }
public ARPaymentsAutoProcessing() { ARSetup setup = ARSetup.Current; PXCurrencyAttribute.SetBaseCalc <PaymentFilter.curySelTotal>(Filter.Cache, null, false); ARDocumentList.SetSelected <ARPaymentInfo.selected>(); ARDocumentList.SetProcessDelegate <ARPaymentCCProcessing>(delegate(ARPaymentCCProcessing aGraph, ARPaymentInfo doc) { ProcessPayment(aGraph, doc); } ); ARDocumentList.Cache.AllowInsert = false; tranRepo = new CCProcTranRepository(this); }
public static bool HasVoidPreAuthorizedInHistory(PXGraph graph, IExternalTransaction extTran) { if (graph == null) { throw new ArgumentNullException(nameof(graph)); } if (extTran == null) { throw new ArgumentNullException(nameof(extTran)); } CCProcTranRepository repo = new CCProcTranRepository(graph); var history = repo.GetCCProcTranByTranID(extTran.TransactionID); return(CCProcTranHelper.HasVoidPreAuthorized(history)); }
public static bool HasOpenCCProcTran(PXGraph graph, IExternalTransaction extTran) { if (graph == null) { throw new ArgumentNullException(nameof(graph)); } if (extTran == null) { return(false); } CCProcTranRepository repo = new CCProcTranRepository(graph); var records = repo.GetCCProcTranByTranID(extTran.TransactionID); return(CCProcTranHelper.HasOpenCCTran(records)); }
public static void FormatDescription(CCProcTranRepository repo, ExternalTransactionState extTranState) { string descr = null; string currStatus = null; string prevStatus = null; IExternalTransaction extTran = extTranState.ExternalTransaction; if (extTran == null) { return; } ExtTransactionProcStatusCode.ListAttribute attr = new ExtTransactionProcStatusCode.ListAttribute(); string procStatusStr = ExtTransactionProcStatusCode.GetProcStatusStrByProcessingStatus(extTranState.ProcessingStatus); if (!string.IsNullOrEmpty(procStatusStr)) { currStatus = PXMessages.LocalizeNoPrefix(attr.ValueLabelDic[procStatusStr]); } bool needPrevStatus = extTranState.HasErrors; if (!string.IsNullOrEmpty(currStatus) && needPrevStatus) { ICCPaymentTransaction procTran = LastSuccessfulCCProcTranTran(extTranState.ExternalTransaction.TransactionID, repo); if (procTran != null) { prevStatus = GetStatusByTranType(procTran.TranType); } } if (!string.IsNullOrEmpty(currStatus) && !string.IsNullOrEmpty(prevStatus)) { descr = prevStatus + ", " + currStatus; } else if (!string.IsNullOrEmpty(currStatus)) { descr = currStatus; } else { descr = string.Empty; } extTranState.Description = descr; }
private static void ApplyLastSuccessfulTran(CCProcTranRepository repo, ExternalTransactionState state) { ICCPaymentTransaction paymentTran = LastSuccessfulCCProcTranTran(state.ExternalTransaction.TransactionID, repo); if (paymentTran != null) { switch (paymentTran.TranType) { case CCTranTypeCode.Authorize: state.IsPreAuthorized = true; break; case CCTranTypeCode.AuthorizeAndCapture: case CCTranTypeCode.PriorAuthorizedCapture: case CCTranTypeCode.CaptureOnly: state.IsCaptured = true; break; case CCTranTypeCode.Credit: state.IsRefunded = true; break; } state.IsOpenForReview = paymentTran.TranStatus == CCTranStatusCode.HeldForReview; CheckAuthExpired(state); } }
public static ExternalTransactionState GetActiveTransactionState(PXGraph graph, IEnumerable <IExternalTransaction> extTrans) { if (graph == null) { throw new ArgumentNullException(nameof(graph)); } if (extTrans == null) { throw new ArgumentNullException(nameof(extTrans)); } ExternalTransactionState state = new ExternalTransactionState(); CCProcTranRepository repo = new CCProcTranRepository(graph); var extTran = GetActiveTransaction(extTrans); if (extTran != null) { state = GetTransactionState(graph, extTran); } return(state); }
public static ExternalTransactionState GetTransactionState(PXGraph graph, IExternalTransaction extTran) { if (graph == null) { throw new ArgumentNullException(nameof(graph)); } if (extTran == null) { throw new ArgumentNullException(nameof(extTran)); } CCProcTranRepository repo = new CCProcTranRepository(graph); ExternalTransactionState state = new ExternalTransactionState(extTran); CheckAuthExpired(state); if (state.HasErrors) { ApplyLastSuccessfulTran(repo, state); } FormatDescription(repo, state); return(state); }
private static ICCPaymentTransaction LastSuccessfulCCProcTranTran(int?extTranId, CCProcTranRepository repo) { var procTrans = repo.GetCCProcTranByTranID(extTranId).Cast <ICCPaymentTransaction>(); ICCPaymentTransaction paymentTran = CCProcTranHelper.FindCCLastSuccessfulTran(procTrans); return(paymentTran); }