public TranProcessingResult DoTransaction(CCTranType aTranType, TranProcessingInput inputData)
            {
                V2.ICCTransactionProcessor processor = GetProcessor <V2.ICCTransactionProcessor>();
                var inputGenerator  = new V2ProcessingInputGenerator(_provider);
                var processingInput = inputGenerator.GetProcessingInput(aTranType, inputData);

                V2.ProcessingResult  v2Result = processor.DoTransaction(processingInput);
                TranProcessingResult result   = V2Converter.ConvertTranProcessingResult(v2Result);

                V2.ICCTranStatusGetter tranStatusGetter = _plugin.CreateProcessor <V2.ICCTranStatusGetter>(null);
                if (tranStatusGetter != null)
                {
                    V2.CCTranStatus tranStatus = tranStatusGetter.GetTranStatus(v2Result);
                    result.TranStatus = V2Converter.ConvertTranStatus(tranStatus);
                }
                return(result);
            }
            public V1.ProcessingResult DoTransaction(V1.CCTranType aTranType, V1.ProcessingInput inputData)
            {
                V2SettingsGenerator seetingsGen = new V2SettingsGenerator(_provider);

                V2.ICCTransactionProcessor processor = _plugin.CreateProcessor <V2.ICCTransactionProcessor>(seetingsGen.GetSettings());
                V1.ProcessingResult        result    = null;
                if (processor == null)
                {
                    string errorMessage = PXMessages.LocalizeFormatNoPrefixNLA(
                        Messages.FeatureNotSupportedByProcessing,
                        CCProcessingFeature.Base);
                    result = V1ProcessingDTOGenerator.GetProcessingResult(errorMessage);
                    return(result);
                }

                var inputGenerator  = new V2ProcessingInputGenerator(_provider);
                var processingInput = inputGenerator.GetProcessingInput(aTranType, inputData);

                V2.ProcessingResult v2Result = processor.DoTransaction(processingInput);
                result = V1ProcessingDTOGenerator.GetProcessingResult(v2Result);

                return(result);
            }
        public static V1.ProcessingResult GetProcessingResult(V2.ProcessingResult inputResult)
        {
            if (inputResult == null)
            {
                throw new ArgumentNullException(nameof(inputResult));
            }

            V1.ProcessingResult result = new V1.ProcessingResult()
            {
                AuthorizationNbr     = inputResult.AuthorizationNbr,
                CcvVerificatonStatus = ToV1(inputResult.CcvVerificatonStatus),
                ExpireAfterDays      = inputResult.ExpireAfterDays,
                isAuthorized         = true,
                PCResponse           = inputResult.ResponseText,
                PCResponseCode       = inputResult.ResponseCode,
                PCResponseReasonCode = inputResult.ResponseReasonCode,
                PCResponseReasonText = inputResult.ResponseReasonText,
                PCTranNumber         = inputResult.TransactionNumber,
                ResultFlag           = V1.CCResultFlag.None,
                TranStatus           = V1.CCTranStatus.Approved
            };
            return(result);
        }
Esempio n. 4
0
        public static TranProcessingResult ConvertTranProcessingResult(V2.ProcessingResult processingResult)
        {
            if (processingResult == null)
            {
                throw new ArgumentNullException(nameof(processingResult));
            }

            TranProcessingResult result = new TranProcessingResult()
            {
                AuthorizationNbr     = processingResult.AuthorizationNbr,
                CcvVerificatonStatus = ConvertCvvStatus(processingResult.CcvVerificatonStatus),
                ExpireAfterDays      = processingResult.ExpireAfterDays,
                Success              = true,
                PCResponse           = processingResult.ResponseText,
                PCResponseCode       = processingResult.ResponseCode,
                PCResponseReasonCode = processingResult.ResponseReasonCode,
                PCResponseReasonText = processingResult.ResponseReasonText,
                PCTranNumber         = processingResult.TransactionNumber,
                ResultFlag           = CCResultFlag.None,
                TranStatus           = CCTranStatus.Approved
            };

            return(result);
        }