public static void ProcessCCTransaction(ICCPayment aDoc, CCProcTran refTran, CCTranType aTranType) { if (aDoc != null && aDoc.PMInstanceID != null && aDoc.CuryDocBal != null) { CCPaymentProcessing processBO = new CCPaymentProcessing(); int tranID = 0; bool result = false; bool processed = false; if (aTranType == CCTranType.AuthorizeOnly || aTranType == CCTranType.AuthorizeAndCapture) { bool doCapture = (aTranType == CCTranType.AuthorizeAndCapture); result = processBO.Authorize(aDoc, doCapture, ref tranID); processed = true; } if (aTranType == CCTranType.PriorAuthorizedCapture) { if (refTran == null) { throw new PXException(Messages.ERR_CCTransactionMustBeAuthorizedBeforeCapturing); } result = processBO.Capture(aDoc.PMInstanceID, refTran.TranNbr, aDoc.CuryID, aDoc.CuryDocBal, ref tranID); processed = true; } if (aTranType == CCTranType.Void) { if (refTran == null) { throw new PXException(Messages.ERR_CCOriginalTransactionNumberIsRequiredForVoiding); } result = processBO.Void(aDoc.PMInstanceID, refTran.TranNbr, ref tranID); processed = true; } if (aTranType == CCTranType.VoidOrCredit) { if (refTran == null) { throw new PXException(Messages.ERR_CCOriginalTransactionNumberIsRequiredForVoidingOrCrediting); } result = processBO.VoidOrCredit(aDoc.PMInstanceID, refTran.TranNbr, ref tranID); processed = true; } if (aTranType == CCTranType.Credit) { if (refTran == null) { throw new PXException(Messages.ERR_CCOriginalTransactionNumberIsRequiredForCrediting); } if (refTran.TranNbr.HasValue) { result = processBO.Credit(aDoc, refTran.TranNbr.Value, ref tranID); } else { result = processBO.Credit(aDoc, refTran.PCTranNumber, ref tranID); } processed = true; } if (aTranType == CCTranType.CaptureOnly) { //Uses Authorization Number received from Processing center in a special way (for example, by phone) if (refTran == null || string.IsNullOrEmpty(refTran.AuthNumber)) { throw new PXException(Messages.ERR_CCExternalAuthorizationNumberIsRequiredForCaptureOnlyTrans); } result = processBO.CaptureOnly(aDoc, refTran.AuthNumber, ref tranID); processed = true; } if (!processed) { throw new PXException(Messages.ERR_CCUnknownOperationType); } if (!result) { throw new PXException(Messages.ERR_CCTransactionWasNotAuthorizedByProcCenter, tranID); } } }
public virtual bool CaptureOnly(ICCPayment aPmtInfo, string aAuthorizationNbr, ref int aTranNbr) { return(_processing.CaptureOnly(aPmtInfo, aAuthorizationNbr, ref aTranNbr)); }