/// <summary>
        /// Adds the ZarinPal gateway to Parbad services.
        /// </summary>
        /// <param name="builder"></param>
        public static IGatewayConfigurationBuilder <ZarinPalGateway> AddZarinPal(this IGatewayBuilder builder)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            return(builder.AddGateway <ZarinPalGateway>());
        }
示例#2
0
        /// <summary>
        /// Adds Melli gateway to Parbad services.
        /// </summary>
        /// <param name="builder"></param>
        public static IGatewayConfigurationBuilder <MelliGateway> AddMelli(this IGatewayBuilder builder)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            return(builder.AddGateway <MelliGateway>(new Uri(MelliHelper.BaseServiceUrl)));
        }
示例#3
0
        /// <summary>
        /// Adds IranKish gateway to Parbad services.
        /// </summary>
        /// <param name="builder"></param>
        public static IGatewayConfigurationBuilder <IranKishGateway> AddIranKish(this IGatewayBuilder builder)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            builder.AddGatewayAccountProvider <IranKishGatewayAccount>();

            return(builder.AddGateway <IranKishGateway>(new Uri(IranKishHelper.BaseServiceUrl)));
        }
示例#4
0
        /// <summary>
        /// Adds IranKish gateway to Parbad services.
        /// </summary>
        /// <param name="builder"></param>
        public static IGatewayConfigurationBuilder <IranKishGateway> AddIranKish(this IGatewayBuilder builder)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            return(builder.AddGateway <IranKishGateway>()
                   .WithHttpClient(clientBuilder => clientBuilder.ConfigureHttpClient(client =>
                                                                                      client.BaseAddress = new Uri(IranKishHelper.BaseServiceUrl))));
        }
        /// <summary>
        /// Adds the YekPay gateway to Parbad services.
        /// </summary>
        /// <param name="builder"></param>
        public static IGatewayConfigurationBuilder <YekPayGateway> AddYekPay(this IGatewayBuilder builder)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            return(builder.AddGateway <YekPayGateway>()
                   .WithHttpClient(clientBuilder =>
                                   clientBuilder.ConfigureHttpClient(client => client.BaseAddress = new Uri(YekPayHelper.ApiBaseUrl))));
        }
        /// <summary>
        /// Adds Parsian gateway to Parbad services.
        /// </summary>
        /// <param name="builder"></param>
        public static IGatewayConfigurationBuilder <ParsianGateway> AddParsian(this IGatewayBuilder builder)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            return(builder
                   .AddGateway <ParsianGateway>()
                   .WithHttpClient(clientBuilder => { })
                   .WithOptions(options => { }));
        }
示例#7
0
        public ThingSubSystem(IGatewayBuilder gatewayBuilder, IThingBuilder thingBuilder,
                              IThingTemplateRepository thingTemplateRepository, IKernelRequestDispatcher requestDispatcher,
                              IMessageHub messageHub)
        {
            _gatewayBuilder          = gatewayBuilder;
            _thingBuilder            = thingBuilder;
            _thingTemplateRepository = thingTemplateRepository;
            _requestDispatcher       = requestDispatcher;
            _messageHub = messageHub;

            _gatewayInitializedHandlers = new ConcurrentDictionary <GatewayConfigurationPackage, IDisposable>();
        }
        /// <summary>
        /// Adds Melli gateway to Parbad services.
        /// </summary>
        /// <param name="builder"></param>
        public static IGatewayConfigurationBuilder <MelliGateway> AddMelli(this IGatewayBuilder builder)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            builder.Services.AddSingleton <IMelliGatewayCrypto, MelliGatewayCrypto>();

            return(builder
                   .AddGateway <MelliGateway>()
                   .WithHttpClient(clientBuilder => { })
                   .WithOptions(options => { }));
        }
示例#9
0
        internal static IGatewayBuilder AddGatewayAccountProvider <TAccount>(this IGatewayBuilder builder)
            where TAccount : GatewayAccount
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            builder.Services
            .TryAddTransient <
                IGatewayAccountProvider <TAccount>,
                GatewayAccountProvider <TAccount> >();

            return(builder);
        }
        /// <summary>
        /// Adds the Parbad Virtual Gateway to Parbad services.
        /// </summary>
        /// <param name="builder"></param>
        public static IGatewayConfigurationBuilder <ParbadVirtualGateway> AddParbadVirtual(this IGatewayBuilder builder)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            builder.Services.TryAddTransient <IParbadVirtualGatewayMiddlewareInvoker, ParbadVirtualGatewayMiddlewareInvoker>();

            return(builder
                   .AddGateway <ParbadVirtualGateway>()
                   .WithAccounts(accounts => accounts.AddInMemory(account => { })));
        }
        /// <summary>
        /// Adds AsanPardakht gateway to Parbad services.
        /// </summary>
        /// <param name="builder"></param>
        public static IGatewayConfigurationBuilder <AsanPardakhtGateway> AddAsanPardakht(this IGatewayBuilder builder)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            builder.Services.AddSingleton <IAsanPardakhtCrypto, AsanPardakhtCrypto>();

            return(builder
                   .AddGateway <AsanPardakhtGateway>()
                   .WithOptions(options => { })
                   .WithHttpClient(clientBuilder => clientBuilder.ConfigureHttpClient(client => { })));
        }
示例#12
0
        /// <summary>
        /// Adds AsanPardakht gateway to Parbad services.
        /// </summary>
        /// <param name="builder"></param>
        public static IGatewayConfigurationBuilder <AsanPardakhtGateway> AddAsanPardakht(this IGatewayBuilder builder)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            return(builder.AddGateway <AsanPardakhtGateway>(new Uri(AsanPardakhtHelper.BaseServiceUrl)));
        }
        /// <summary>
        /// Adds ParbadVirtual gateway to Parbad services.
        /// </summary>
        /// <param name="builder"></param>
        public static IGatewayConfigurationBuilder <ParbadVirtualGateway> AddParbadVirtual(this IGatewayBuilder builder)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            builder.Services.TryAddTransient <ParbadVirtualGateway>();
            builder.Services.TryAddTransient <IParbadVirtualGatewayMiddlewareInvoker, ParbadVirtualGatewayMiddlewareInvoker>();

            return(new GatewayConfigurationBuilder <ParbadVirtualGateway>(builder.Services));
        }
示例#14
0
        /// <summary>
        /// Adds the Parbad Virtual Gateway to Parbad services.
        /// </summary>
        /// <param name="builder"></param>
        public static IGatewayConfigurationBuilder <ParbadVirtualGateway> AddParbadVirtual(this IGatewayBuilder builder)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            builder.Services.AddSingleton(new GatewayDescriptor(typeof(ParbadVirtualGateway)));
            builder.Services.TryAddTransient <ParbadVirtualGateway>();

            builder.Services.TryAddTransient <IParbadVirtualGatewayMiddlewareInvoker, ParbadVirtualGatewayMiddlewareInvoker>();

            var gatewayConfigurationBuilder = new GatewayConfigurationBuilder <ParbadVirtualGateway>(builder.Services);

            gatewayConfigurationBuilder
            .WithAccounts(accounts =>
            {
                accounts
                .AddInMemory(account => { });
            });

            return(gatewayConfigurationBuilder);
        }