public static void RecordCCPayment <TNode>(TNode doc, string aExtPCTranNbr, string aPCAuthNbr, PXSelectBase <CCProcTran> ccProcTran, CCPaymentEntry.ReleaseDelegate aReleaseDelegate, UpdateDocStateDelegate aDocStateUpdater) where TNode : class, IBqlTable, ICCPayment, new() { if (doc != null && doc.PMInstanceID != null && doc.CuryDocBal != null) { if (CCPaymentEntry.HasOpenCCTran(ccProcTran)) { throw new PXException(Messages.ERR_CCTransactionCurrentlyInProgress); } if (string.IsNullOrEmpty(aExtPCTranNbr)) { throw new PXException(Messages.ERR_PCTransactionNumberOfTheOriginalPaymentIsRequired); } CCPaymentState paymentState = CCPaymentEntry.ResolveCCPaymentState(ccProcTran.Select()); if ((paymentState & (CCPaymentState.Captured)) > 0) { throw new PXException(Messages.ERR_CCAuthorizedPaymentAlreadyCaptured); } ccProcTran.View.Graph.Actions.PressSave(); TNode toProc = PXCache <TNode> .CreateCopy(doc); CCProcTran authTran = CCPaymentEntry.findCCPreAthorizing(ccProcTran.Select()); CCTranType operation = CCTranType.AuthorizeAndCapture; PXLongOperation.StartOperation(ccProcTran.View.Graph, delegate() { try { CCPaymentProcessing ccProcGraph = PXGraph.CreateInstance <CCPaymentProcessing>(); int?tranID = 0; string extTranID = aExtPCTranNbr; if (ccProcGraph.RecordCapture(doc, extTranID, aPCAuthNbr, null, ref tranID)) { } } finally { //Update doc state in any case if (aDocStateUpdater != null) { aDocStateUpdater(doc, operation); } } if (aReleaseDelegate != null) { aReleaseDelegate(toProc); //On Success Only } }); } }
public virtual void RecordCapture(ICCPayment aPmtInfo, string aExtTranRef, string aExtAuthNbr, Decimal?aAmount, ref int?aTranNbr) { _processing.RecordCapture(aPmtInfo, aExtTranRef, aExtAuthNbr, aAmount, ref aTranNbr); }