private void Process(Func <TranOperationResult> func)
        {
            TranOperationResult res = func();

            if (!res.Success)
            {
                throw new PXException(Messages.ERR_CCTransactionProcessingFailed, res.TransactionId);
            }
        }
 public void ProcessCredit(ICCPayment doc, IExternalTransaction tran)
 {
     CheckInput(doc, tran);
     Process(() => {
         TranOperationResult opRes = null;
         if (tran.TransactionID.HasValue)
         {
             opRes = _processingClass.Credit(doc, tran.TransactionID.Value);
         }
         else
         {
             opRes = _processingClass.Credit(doc, tran.TranNumber);
         }
         return(opRes);
     });
 }