Example #1
0
        public V2.ProcessingInput GetProcessingInput(CCTranType aTranType, TranProcessingInput inputData)
        {
            if (inputData == null)
            {
                throw new ArgumentNullException(nameof(inputData));
            }
            V2.CCTranType      tranType = V2Converter.ConvertTranTypeToV2(aTranType);
            V2.ProcessingInput result   = new V2.ProcessingInput()
            {
                TranType   = tranType,
                Amount     = inputData.Amount,
                CuryID     = inputData.CuryID,
                OrigTranID = aTranType == CCTranType.CaptureOnly ? null : inputData.OrigRefNbr,
                AuthCode   = aTranType == 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);
        }
            public HostedFormResponse ParsePaymentFormResponse(string response)
            {
                var parser = GetProcessor <V2.ICCHostedPaymentFormResponseParser>();
                var result = V2PluginErrorHandler.ExecuteAndHandleError(() => {
                    return(parser.Parse(response));
                });

                return(V2Converter.ConvertHostedFormResponse(result));
            }
            public void ExportSettings(IList <PluginSettingDetail> aSettings)
            {
                var v2Settings = _plugin.ExportSettings();

                foreach (var item in v2Settings)
                {
                    aSettings.Add(V2Converter.ConvertSettingsDetail(item));
                }
            }
            public CCError ValidateSettings(PluginSettingDetail setting)
            {
                string result = _plugin.ValidateSettings(V2Converter.ConvertSettingDetailToV2(setting));

                CCError ret = new CCError()
                {
                    source       = string.IsNullOrEmpty(result) ? CCError.CCErrorSource.None : CCError.CCErrorSource.Internal,
                    ErrorMessage = result
                };

                return(ret);
            }
            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);
            }