示例#1
0
        public V2.ProcessingInput GetProcessingInput(V1.CCTranType aTranType, V1.ProcessingInput inputData)
        {
            if (inputData == null)
            {
                throw new ArgumentNullException(nameof(inputData));
            }
            V2.CCTranType      tranType = ToV2(aTranType);
            V2.ProcessingInput result   = new V2.ProcessingInput()
            {
                TranType   = tranType,
                Amount     = inputData.Amount,
                CuryID     = inputData.CuryID,
                OrigTranID = aTranType == V1.CCTranType.CaptureOnly ? null : inputData.OrigRefNbr,
                AuthCode   = aTranType == V1.CCTranType.CaptureOnly ? inputData.OrigRefNbr : null
            };

            if (FillCardData)
            {
                result.CardData             = GetCardData(_provider.GetCardDataReader());
                result.CardData.AddressData = GetAddressData(_provider.GetCustomerDataReader());
            }

            if (FillCustomerData)
            {
                result.CustomerData = GetCustomerData(_provider.GetCustomerDataReader());
            }
            result.DocumentData           = new V2.DocumentData();
            result.DocumentData.DocType   = inputData.DocType;
            result.DocumentData.DocRefNbr = inputData.DocRefNbr;
            FillDocumentData(result);
            return(result);
        }
示例#2
0
        public static V2.CCTranType ToV2(V1.CCTranType tranTypeV1)
        {
            switch (tranTypeV1)
            {
            case V1.CCTranType.AuthorizeAndCapture:
                return(V2.CCTranType.AuthorizeAndCapture);

            case V1.CCTranType.AuthorizeOnly:
                return(V2.CCTranType.AuthorizeOnly);

            case V1.CCTranType.PriorAuthorizedCapture:
                return(V2.CCTranType.PriorAuthorizedCapture);

            case V1.CCTranType.CaptureOnly:
                return(V2.CCTranType.CaptureOnly);

            case V1.CCTranType.Credit:
                return(V2.CCTranType.Credit);

            case V1.CCTranType.Void:
                return(V2.CCTranType.Void);

            case V1.CCTranType.VoidOrCredit:
                return(V2.CCTranType.VoidOrCredit);

            default:
                throw new PXException(CCProcessingBase.Messages.UnexpectedTranType, tranTypeV1);
            }
        }
 public V1.ProcessingResult DoTransaction(V1.CCTranType aTranType, V1.ProcessingInput inputData)
 {
     _plugin.Initialize(
         _provider.GetProcessingCenterSettingsStorage(),
         _provider.GetCardDataReader(),
         _provider.GetCustomerDataReader(),
         _provider.GetDocDetailsDataReader());
     V1.ProcessingResult result = new V1.ProcessingResult();
     _plugin.DoTransaction(aTranType, inputData, result);
     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);
            }