private void SetProps(IExternalTransaction extTran)
 {
     ProcessingStatus = ExtTransactionProcStatusCode.GetProcessingStatusByProcStatusStr(extTran.ProcessingStatus);
     IsActive         = extTran.Active.GetValueOrDefault();
     IsCompleted      = extTran.Completed.GetValueOrDefault();
     IsVoided         = ProcessingStatus == ProcessingStatus.VoidSuccess ||
                        ProcessingStatus == ProcessingStatus.VoidHeldForReview;
     IsCaptured = ProcessingStatus == ProcessingStatus.CaptureSuccess ||
                  ProcessingStatus == ProcessingStatus.CaptureHeldForReview;
     IsPreAuthorized = ProcessingStatus == ProcessingStatus.AuthorizeSuccess ||
                       ProcessingStatus == ProcessingStatus.AuthorizeHeldForReview;
     IsRefunded = ProcessingStatus == ProcessingStatus.CreditSuccess ||
                  ProcessingStatus == ProcessingStatus.CreditHeldForReview;
     IsUnknown       = ProcessingStatus == ProcessingStatus.Unknown;
     IsOpenForReview = ProcessingStatus == ProcessingStatus.AuthorizeHeldForReview ||
                       ProcessingStatus == ProcessingStatus.CaptureHeldForReview ||
                       ProcessingStatus == ProcessingStatus.AuthorizeHeldForReview ||
                       ProcessingStatus == ProcessingStatus.VoidHeldForReview ||
                       ProcessingStatus == ProcessingStatus.CreditHeldForReview;
     IsDeclined = ProcessingStatus == ProcessingStatus.AuthorizeDecline ||
                  ProcessingStatus == ProcessingStatus.CaptureDecline ||
                  ProcessingStatus == ProcessingStatus.VoidDecline ||
                  ProcessingStatus == ProcessingStatus.CreditDecline;
     HasErrors = ProcessingStatus == ProcessingStatus.AuthorizeFail ||
                 ProcessingStatus == ProcessingStatus.CaptureFail ||
                 ProcessingStatus == ProcessingStatus.VoidFail ||
                 ProcessingStatus == ProcessingStatus.CreditFail;
 }
예제 #2
0
        protected string GetProcessingStatus(V2.TransactionData tranData)
        {
            string tranStatusCode = CCTranStatusCode.GetCode(V2Converter.ConvertTranStatus(tranData.TranStatus));
            string tranTypeCode   = CCTranTypeCode.GetTypeCode(V2Converter.ConvertTranType(tranData.TranType.Value));
            string procStatus     = ExtTransactionProcStatusCode.GetStatusByTranStatusTranType(tranStatusCode, tranTypeCode);

            return(procStatus);
        }
 public CCProcTran UpdateTransaction(CCProcTran procTran)
 {
     if (procTran.TransactionID.GetValueOrDefault() == 0)
     {
         throw new ArgumentNullException(nameof(procTran.TransactionID));
     }
     using (var scope = new PXTransactionScope())
     {
         ExternalTransaction extTran = _externalTran.GetExternalTransaction(procTran.TransactionID);
         if (extTran == null)
         {
             throw new Exception($"Could not find External transaction record by TransactionID = {procTran.TransactionID}");
         }
         if (procTran.ProcStatus != CCProcStatus.Opened)
         {
             if (procTran.AuthNumber != null)
             {
                 extTran.AuthNumber = procTran.AuthNumber;
             }
             if (procTran.ExpirationDate != null)
             {
                 extTran.ExpirationDate = procTran.ExpirationDate;
             }
             if (procTran.CVVVerificationStatus != null)
             {
                 extTran.CVVVerification = procTran.CVVVerificationStatus;
             }
             if (procTran.PCTranNumber != null)
             {
                 extTran.TranNumber = procTran.PCTranNumber;
             }
             if (procTran.Amount != null)
             {
                 extTran.Amount = procTran.Amount;
             }
             extTran.PMInstanceID     = procTran.PMInstanceID;
             extTran.ProcessingStatus = ExtTransactionProcStatusCode.GetStatusByTranStatusTranType(procTran.TranStatus, procTran.TranType);
             extTran.LastActivityDate = procTran.EndTime;
             extTran.Active           = CCProcTranHelper.IsActiveTran(procTran);
             extTran.Completed        = CCProcTranHelper.IsCompletedTran(procTran);
             _externalTran.UpdateExternalTransaction(extTran);
             UpdateParentTransaction(extTran, procTran);
         }
         procTran = _cctranRepository.UpdateCCProcTran(procTran);
         Save();
         scope.Complete();
         return(procTran);
     }
 }
 public CCProcTran InsertTransaction(CCProcTran procTran)
 {
     using (var scope = new PXTransactionScope())
     {
         ExternalTransaction extTran = new ExternalTransaction();
         extTran.DocType         = procTran.DocType;
         extTran.RefNbr          = procTran.RefNbr;
         extTran.OrigDocType     = procTran.OrigDocType;
         extTran.OrigRefNbr      = procTran.OrigRefNbr;
         extTran.Amount          = procTran.Amount;
         extTran.Direction       = ExternalTransaction.TransactionDirection.Debet;
         extTran.PMInstanceID    = procTran.PMInstanceID;
         extTran.CVVVerification = procTran.CVVVerificationStatus;
         extTran.ExpirationDate  = procTran.ExpirationDate;
         if (procTran.TranType == CCTranTypeCode.Credit)
         {
             extTran.Direction = ExternalTransaction.TransactionDirection.Credit;
             if (procTran.RefTranNbr != null)
             {
                 CCProcTran refProcTran = _cctranRepository.GetCCProcTran(procTran.RefTranNbr);
                 extTran.ParentTranID = refProcTran.TransactionID;
             }
         }
         if (procTran.ProcStatus == CCProcStatus.Opened)
         {
             extTran.ProcessingStatus = ExtTransactionProcStatusCode.Unknown;
         }
         else
         {
             extTran.ProcessingStatus = ExtTransactionProcStatusCode.GetStatusByTranStatusTranType(procTran.TranStatus, procTran.TranType);
             extTran.Active           = CCProcTranHelper.IsActiveTran(procTran);
             extTran.Completed        = CCProcTranHelper.IsCompletedTran(procTran);
             extTran.TranNumber       = procTran.PCTranNumber;
             extTran.AuthNumber       = procTran.AuthNumber;
             extTran.ExpirationDate   = procTran.ExpirationDate;
             extTran.LastActivityDate = procTran.EndTime;
         }
         extTran = _externalTran.InsertExternalTransaction(extTran);
         UpdateParentTransaction(extTran, procTran);
         procTran.TransactionID = extTran.TransactionID;
         procTran = _cctranRepository.InsertCCProcTran(procTran);
         Save();
         scope.Complete();
         return(procTran);
     }
 }
예제 #5
0
        public static void FormatDescription(CCProcTranRepository repo, ExternalTransactionState extTranState)
        {
            string descr                 = null;
            string currStatus            = null;
            string prevStatus            = null;
            IExternalTransaction extTran = extTranState.ExternalTransaction;

            if (extTran == null)
            {
                return;
            }
            ExtTransactionProcStatusCode.ListAttribute attr = new ExtTransactionProcStatusCode.ListAttribute();
            string procStatusStr = ExtTransactionProcStatusCode.GetProcStatusStrByProcessingStatus(extTranState.ProcessingStatus);

            if (!string.IsNullOrEmpty(procStatusStr))
            {
                currStatus = PXMessages.LocalizeNoPrefix(attr.ValueLabelDic[procStatusStr]);
            }
            bool needPrevStatus = extTranState.HasErrors;

            if (!string.IsNullOrEmpty(currStatus) && needPrevStatus)
            {
                ICCPaymentTransaction procTran = LastSuccessfulCCProcTranTran(extTranState.ExternalTransaction.TransactionID, repo);
                if (procTran != null)
                {
                    prevStatus = GetStatusByTranType(procTran.TranType);
                }
            }
            if (!string.IsNullOrEmpty(currStatus) && !string.IsNullOrEmpty(prevStatus))
            {
                descr = prevStatus + ", " + currStatus;
            }
            else if (!string.IsNullOrEmpty(currStatus))
            {
                descr = currStatus;
            }
            else
            {
                descr = string.Empty;
            }
            extTranState.Description = descr;
        }