public static void ProcessPayment(ARPaymentCCProcessing aProcessingGraph, ARPaymentInfo aDoc) { aProcessingGraph.Clear(); aProcessingGraph.Document.Current = aProcessingGraph.Document.Search <ARPayment.docType, ARPayment.refNbr>(aDoc.DocType, aDoc.RefNbr); ARPaymentEntry.CheckValidPeriodForCCTran(aProcessingGraph, aProcessingGraph.Document.Current); CCPaymentEntry.CaptureCCPayment <ARPayment>(aDoc, aProcessingGraph.ccProcTran, true, ARPaymentEntry.UpdateARPaymentAndSetWarning); }
protected virtual IEnumerable ardocumentlist() { DateTime now = DateTime.Now.Date; PXSelectBase <CCProcTran> tranSelect = new PXSelect <CCProcTran, Where <CCProcTran.docType, Equal <Optional <CCProcTran.docType> >, And <CCProcTran.refNbr, Equal <Optional <CCProcTran.refNbr> > > >, OrderBy <Desc <CCProcTran.tranNbr> > >(this); foreach (PXResult <ARPaymentInfo, Customer, CustomerPaymentMethod, PaymentMethod, CCProcessingCenterPmntMethod> it in PXSelectJoin <ARPaymentInfo, InnerJoin <Customer, On <Customer.bAccountID, Equal <ARPaymentInfo.customerID> >, InnerJoin <CustomerPaymentMethod, On <CustomerPaymentMethod.pMInstanceID, Equal <ARPaymentInfo.pMInstanceID> >, InnerJoin <PaymentMethod, On <PaymentMethod.paymentMethodID, Equal <ARPaymentInfo.paymentMethodID>, And <PaymentMethod.paymentType, Equal <PaymentMethodType.creditCard>, And <PaymentMethod.aRIsProcessingRequired, Equal <True> > > >, LeftJoin <CCProcessingCenterPmntMethod, On <CCProcessingCenterPmntMethod.paymentMethodID, Equal <PaymentMethod.paymentMethodID>, And <CCProcessingCenterPmntMethod.isDefault, Equal <True>, And <CCProcessingCenterPmntMethod.isActive, Equal <True> > > > > > > >, Where <ARPaymentInfo.released, Equal <False>, And <ARPaymentInfo.hold, Equal <False>, And <ARPaymentInfo.voided, Equal <False>, And <ARPaymentInfo.docType, Equal <ARPaymentType.payment>, And <ARPaymentInfo.docDate, LessEqual <Current <PaymentFilter.payDate> >, And <ARPaymentInfo.isMigratedRecord, NotEqual <True>, And2 <Where <Customer.statementCycleId, Equal <Current <PaymentFilter.statementCycleId> >, Or <Current <PaymentFilter.statementCycleId>, IsNull> >, And2 <Where <PaymentMethod.paymentMethodID, Equal <Current <PaymentFilter.paymentMethodID> >, Or <Current <PaymentFilter.paymentMethodID>, IsNull> >, And <Match <Customer, Current <AccessInfo.userName> > > > > > > > > > >, OrderBy <Asc <ARPaymentInfo.refNbr> > > .Select(this)) { ARPaymentInfo doc = (ARPaymentInfo)it; CustomerPaymentMethod cpm = (CustomerPaymentMethod)it; CCProcessingCenterPmntMethod pcpm = (CCProcessingCenterPmntMethod)it; if (!String.IsNullOrEmpty(this.Filter.Current.ProcessingCenterID) && (this.Filter.Current.ProcessingCenterID != pcpm.ProcessingCenterID)) { continue; } ARDocKey key = new ARDocKey(doc); if (Filter.Current == null || Filter.Current.CustomerID == null || object.Equals(Filter.Current.CustomerID, doc.CustomerID)) { doc.PMInstanceDescr = cpm.Descr; doc.PaymentMethodID = cpm.PaymentMethodID; doc.IsCCExpired = (cpm.ExpirationDate < now); doc.ProcessingCenterID = (pcpm != null) ? pcpm.ProcessingCenterID: string.Empty; CCProcTran lastTran; CCPaymentState ccPaymentState = CCProcTranHelper.ResolveCCPaymentState(tranSelect.Select(doc.DocType, doc.RefNbr), out lastTran); doc.CCPaymentStateDescr = CCProcTranHelper.FormatCCPaymentState(ccPaymentState); doc.CCTranDescr = (lastTran != null) ? (string.IsNullOrEmpty(lastTran.PCResponseReasonText)?lastTran.PCResponseReasonText: lastTran.ErrorText): String.Empty; if (doc.IsCCExpired == true && String.IsNullOrEmpty(doc.CCTranDescr)) { doc.CCTranDescr = Messages.CreditCardIsExpired; } if ((ccPaymentState & CCPaymentState.Captured) == 0) { yield return(doc); } } } }
public static void ProcessPayment(ARPaymentCCProcessing aProcessingGraph, ARPaymentInfo aDoc) { aProcessingGraph.Clear(); aProcessingGraph.Document.Current = aProcessingGraph.Document.Search <ARPayment.docType, ARPayment.refNbr>(aDoc.DocType, aDoc.RefNbr); ARPaymentEntry graph = CreateInstance <ARPaymentEntry>(); graph.Document.Current = aDoc; var ext = graph.GetExtension <ARPaymentEntry.PaymentTransaction>(); ext.CheckHeldForReviewTranStatus(aDoc); ARPaymentEntry.CheckValidPeriodForCCTran(aProcessingGraph, aProcessingGraph.Document.Current); CCPaymentEntry paymentEntry = new CCPaymentEntry(aProcessingGraph); paymentEntry.AddAfterProcessCallback(ARPaymentEntry.PaymentTransaction.ChangeDocProcessingStatus); paymentEntry.AddAfterProcessCallback(ARPaymentEntry.PaymentTransaction.UpdateARPaymentAndSetWarning); paymentEntry.AddAfterProcessCallback(PaymentTransactionGraph <ARPaymentCCProcessing, ARPayment> .ReleaseARDocument); paymentEntry.AddAfterProcessCallback(PaymentTransactionGraph <ARPaymentCCProcessing, ARPayment> .CheckForHeldForReviewStatusAfterProc); paymentEntry.CaptureCCpayment(aDoc, new GenericExternalTransactionAdapter <ExternalTransaction>(aProcessingGraph.ExtTran)); }
protected virtual IEnumerable ardocumentlist() { DateTime now = DateTime.Now.Date; PXSelectBase <ExternalTransaction> tranSelect = new PXSelect <ExternalTransaction, Where <ExternalTransaction.docType, Equal <Optional <ExternalTransaction.docType> >, And <ExternalTransaction.refNbr, Equal <Optional <ExternalTransaction.refNbr> > > >, OrderBy <Desc <ExternalTransaction.transactionID> > >(this); foreach (PXResult <ARPaymentInfo, Customer, PaymentMethod, CustomerPaymentMethod, CCProcessingCenterPmntMethod> it in PXSelectJoin <ARPaymentInfo, InnerJoin <Customer, On <Customer.bAccountID, Equal <ARPaymentInfo.customerID> >, InnerJoin <PaymentMethod, On <PaymentMethod.paymentMethodID, Equal <ARPaymentInfo.paymentMethodID>, And <PaymentMethod.paymentType, Equal <PaymentMethodType.creditCard>, And <PaymentMethod.aRIsProcessingRequired, Equal <True> > > >, LeftJoin <CustomerPaymentMethod, On <CustomerPaymentMethod.pMInstanceID, Equal <ARPaymentInfo.pMInstanceID> >, LeftJoin <CCProcessingCenterPmntMethod, On <CCProcessingCenterPmntMethod.paymentMethodID, Equal <PaymentMethod.paymentMethodID>, And <CCProcessingCenterPmntMethod.isDefault, Equal <True>, And <CCProcessingCenterPmntMethod.isActive, Equal <True> > > > > > > >, Where <ARPaymentInfo.released, Equal <False>, And <ARPaymentInfo.hold, Equal <False>, And <ARPaymentInfo.voided, Equal <False>, And <ARPaymentInfo.docType, Equal <ARPaymentType.payment>, And <ARPaymentInfo.docDate, LessEqual <Current <PaymentFilter.payDate> >, And <ARPaymentInfo.isMigratedRecord, NotEqual <True>, And2 <Where <Customer.statementCycleId, Equal <Current <PaymentFilter.statementCycleId> >, Or <Current <PaymentFilter.statementCycleId>, IsNull> >, And2 <Where <PaymentMethod.paymentMethodID, Equal <Current <PaymentFilter.paymentMethodID> >, Or <Current <PaymentFilter.paymentMethodID>, IsNull> >, And <Match <Customer, Current <AccessInfo.userName> > > > > > > > > > >, OrderBy <Asc <ARPaymentInfo.refNbr> > > .Select(this)) { ARPaymentInfo doc = (ARPaymentInfo)it; CustomerPaymentMethod cpm = (CustomerPaymentMethod)it; CCProcessingCenterPmntMethod pcpm = (CCProcessingCenterPmntMethod)it; if (!string.IsNullOrEmpty(this.Filter.Current.ProcessingCenterID) && (this.Filter.Current.ProcessingCenterID != pcpm.ProcessingCenterID)) { continue; } ARDocKey key = new ARDocKey(doc); if (Filter.Current == null || Filter.Current.CustomerID == null || object.Equals(Filter.Current.CustomerID, doc.CustomerID)) { if (cpm?.PMInstanceID != null) { doc.PMInstanceDescr = cpm.Descr; doc.PaymentMethodID = cpm.PaymentMethodID; doc.IsCCExpired = (cpm.ExpirationDate < now); } doc.ProcessingCenterID = (pcpm != null) ? pcpm.ProcessingCenterID : string.Empty; ExternalTransactionState paymentState = ExternalTranHelper.GetActiveTransactionState(this, tranSelect.Select(doc.DocType, doc.RefNbr).RowCast <ExternalTransaction>()); ExternalTransaction lastTran = (ExternalTransaction)paymentState.ExternalTransaction; doc.CCPaymentStateDescr = paymentState.Description; int?tranId = paymentState?.ExternalTransaction?.TransactionID; if (paymentState.HasErrors && tranId != null) { string errText = tranRepo.GetCCProcTranByTranID(tranId).OrderByDescending(i => i.TranNbr).Select(i => i.ErrorText).FirstOrDefault(); doc.CCTranDescr = errText; } if (doc.IsCCExpired == true && string.IsNullOrEmpty(doc.CCTranDescr)) { doc.CCTranDescr = Messages.CreditCardIsExpired; } if (doc.PMInstanceID == PaymentTranExtConstants.NewPaymentProfile && paymentState.IsOpenForReview) { yield return(doc); } if (doc.PMInstanceID != PaymentTranExtConstants.NewPaymentProfile && (!paymentState.IsCaptured || (paymentState.IsCaptured && paymentState.IsOpenForReview))) { yield return(doc); } } } }
public static void ProcessPayment(ARPaymentCCProcessing aProcessingGraph, ARPaymentInfo aDoc) { aProcessingGraph.Clear(); aProcessingGraph.Document.Current = aProcessingGraph.Document.Search <ARPayment.docType, ARPayment.refNbr>(aDoc.DocType, aDoc.RefNbr); CCPaymentEntry.CaptureCCPayment <ARPayment>(aDoc, aProcessingGraph.ccProcTran, true); }