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)); }
public virtual IEnumerable CaptureCCPayment(PXAdapter adapter) { var methodName = GetClassMethodName(); AccessInfo info = this.Base.Accessinfo; PXTrace.WriteInformation($"{methodName} started."); List <TPrimary> list = new List <TPrimary>(); foreach (TPrimary doc in adapter.Get <TPrimary>()) { CheckDocumentUpdatedInDb(doc); PXCache cache = this.Base.Caches[typeof(TPrimary)]; bool prevAllowUpdateState = cache.AllowUpdate; cache.AllowUpdate = true; ICCPayment pDoc = GetPaymentDoc(doc); PXTrace.WriteInformation($"{methodName}. RefNbr:{pDoc.RefNbr}; UserName:{info.UserName}"); list.Add(doc); BeforeCapturePayment(doc); CheckHeldForReviewTranStatus(pDoc); var tranAdapter = new GenericExternalTransactionAdapter <ExternalTransactionDetail>(ExternalTransaction); var afterCaptureActions = GetAfterCaptureActions(); CCPaymentEntry paymentEntry = GetCCPaymentEntry(); foreach (var item in afterCaptureActions) { paymentEntry.AddAfterProcessCallback(item); } if (ReleaseAfterCapture) { paymentEntry.AddAfterProcessCallback(ReleaseARDocument); } if (adapter.MassProcess) { paymentEntry.AddAfterProcessCallback(CheckForHeldForReviewStatusAfterProc); } paymentEntry.CaptureCCpayment(pDoc, tranAdapter); cache.AllowUpdate = prevAllowUpdateState; } return(list); }