public static void RecordCCCredit <TNode>(TNode doc, string aRefPCTranNbr, 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.Refunded)) > 0) { throw new PXException(Messages.ERR_CCPaymentIsAlreadyRefunded); } ccProcTran.View.Graph.Actions.PressSave(); TNode toProc = PXCache <TNode> .CreateCopy(doc); CCTranType operation = CCTranType.Credit; PXLongOperation.StartOperation(ccProcTran.View.Graph, delegate() { try { CCPaymentProcessing ccProcGraph = PXGraph.CreateInstance <CCPaymentProcessing>(); int?tranID; if (ccProcGraph.RecordCredit(doc, aRefPCTranNbr, aExtPCTranNbr, aPCAuthNbr, out tranID)) { } } finally { //Update doc state in any case if (aDocStateUpdater != null) { aDocStateUpdater(doc, operation); } } if (aReleaseDelegate != null) { aReleaseDelegate(toProc); //On Success Only } }); } }
public virtual bool RecordCredit(ICCPayment aPmtInfo, string aRefPCTranNbr, string aExtTranRef, string aExtAuthNbr, out int?aTranNbr) { return(_processing.RecordCredit(aPmtInfo, aRefPCTranNbr, aExtTranRef, aExtAuthNbr, out aTranNbr)); }