public static bool IsFeatureSupported(Type pluginType, CCProcessingFeature feature)
        {
            bool result = false;

            if (typeof(V1.ICCPaymentProcessing).IsAssignableFrom(pluginType))
            {
                switch (feature)
                {
                case CCProcessingFeature.ProfileManagement:
                    result = typeof(V1.ICCTokenizedPaymentProcessing).IsAssignableFrom(pluginType);
                    break;

                case CCProcessingFeature.HostedForm:
                    result = typeof(V1.ICCProcessingHostedForm).IsAssignableFrom(pluginType);
                    break;

                case CCProcessingFeature.ExtendedProfileManagement:
                    result = false;
                    break;

                default:
                    result = false;
                    break;
                }
            }
            else if (typeof(V2.ICCProcessingPlugin).IsAssignableFrom(pluginType))
            {
                V2.ICCProcessingPlugin plugin = (V2.ICCProcessingPlugin)Activator.CreateInstance(pluginType);
                object processorInstnace      = null;
                try
                {
                    switch (feature)
                    {
                    case CCProcessingFeature.ProfileManagement:
                        processorInstnace = plugin.CreateProcessor <V2.ICCProfileProcessor>(null);
                        break;

                    case CCProcessingFeature.HostedForm:
                        processorInstnace = plugin.CreateProcessor <V2.ICCHostedFormProcessor>(null);
                        break;

                    case CCProcessingFeature.ExtendedProfileManagement:
                        processorInstnace = plugin.CreateProcessor <V2.ICCProfileProcessor>(null);
                        break;

                    default:
                        break;
                    }
                    result = processorInstnace != null;
                }
                catch
                {
                    //ignoring any initialization errors!
                    result = true;
                }
            }
            return(result);
        }
        public static bool IsFeatureSupported(Type pluginType, CCProcessingFeature feature)
        {
            bool result = false;

            if (typeof(V2.ICCProcessingPlugin).IsAssignableFrom(pluginType))
            {
                V2.ICCProcessingPlugin plugin       = (V2.ICCProcessingPlugin)Activator.CreateInstance(pluginType);
                Func <object>[]        checkFuncArr = null;
                switch (feature)
                {
                case CCProcessingFeature.ProfileManagement:
                    checkFuncArr = new Func <object>[] { () => plugin.CreateProcessor <V2.ICCProfileProcessor>(null) };
                    break;

                case CCProcessingFeature.HostedForm:
                    checkFuncArr = new Func <object>[] { () => plugin.CreateProcessor <V2.ICCHostedFormProcessor>(null) };
                    break;

                case CCProcessingFeature.ExtendedProfileManagement:
                    checkFuncArr = new Func <object>[] { () => plugin.CreateProcessor <V2.ICCProfileProcessor>(null) };
                    break;

                case CCProcessingFeature.PaymentHostedForm:
                    checkFuncArr = new Func <object>[] {
                        () => plugin.CreateProcessor <V2.ICCHostedPaymentFormProcessor>(null),
                        () => plugin.CreateProcessor <V2.ICCTransactionGetter>(null),
                        () => plugin.CreateProcessor <V2.ICCProfileCreator>(null),
                        () => plugin.CreateProcessor <V2.ICCHostedPaymentFormResponseParser>(null)
                    };
                    break;

                case CCProcessingFeature.WebhookManagement:
                    checkFuncArr = new Func <object>[] {
                        () => plugin.CreateProcessor <V2.ICCWebhookProcessor>(null),
                        () => plugin.CreateProcessor <V2.ICCWebhookResolver>(null)
                    };
                    break;

                case CCProcessingFeature.TransactionGetter:
                    checkFuncArr = new Func <object>[] { () => plugin.CreateProcessor <V2.ICCTransactionGetter>(null) };
                    break;
                }

                if (checkFuncArr != null)
                {
                    result = checkFuncArr.All(f => CheckV2TypeWrapper(f));
                }
            }

            return(result);
        }
            private T GetProcessor <T>(CCProcessingFeature feature = CCProcessingFeature.HostedForm) where T : class
            {
                V2SettingsGenerator seetingsGen = new V2SettingsGenerator(_provider);
                T processor = _plugin.CreateProcessor <T>(seetingsGen.GetSettings());

                if (processor == null)
                {
                    string errorMessage = PXMessages.LocalizeFormatNoPrefixNLA(
                        Messages.FeatureNotSupportedByProcessing,
                        CCProcessingFeature.HostedForm);
                    throw new PXException(errorMessage);
                }
                return(processor);
            }
            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);
            }
Пример #5
0
            private V2.ICCHostedFormProcessor GetProcessor()
            {
                if (HttpContext.Current.Request.UrlReferrer != null && HttpContext.Current.Request.UrlReferrer.Scheme != System.Uri.UriSchemeHttps)
                {
                    throw new PXException(CCProcessingBase.Messages.MustUseHttps);
                }
                V2SettingsGenerator seetingsGen = new V2SettingsGenerator(_provider);

                V2.ICCHostedFormProcessor processor = _plugin.CreateProcessor <V2.ICCHostedFormProcessor>(seetingsGen.GetSettings());
                if (processor == null)
                {
                    string errorMessage = PXMessages.LocalizeFormatNoPrefixNLA(
                        Messages.FeatureNotSupportedByProcessing,
                        CCProcessingFeature.HostedForm);
                    throw new PXException(errorMessage);
                }
                return(processor);
            }
Пример #6
0
            private V2.ICCProfileProcessor GetProcessor()
            {
                V2SettingsGenerator settingsGen = new V2SettingsGenerator(_provider);

                V2.ICCProfileProcessor processor = _plugin.CreateProcessor <V2.ICCProfileProcessor>(settingsGen.GetSettings());
                if (processor == null)
                {
                    string errorMessage = PXMessages.LocalizeFormatNoPrefixNLA(
                        Messages.FeatureNotSupportedByProcessing,
                        CCProcessingFeature.ProfileManagement);
                    throw new PXException(errorMessage);
                }
                return(processor);
            }
            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);
            }