/// <summary>
 /// Initializes a new instance of the <see cref="CheckoutRenderControllerBase"/> class.
 /// </summary>
 /// <param name="merchelloContext">
 /// The merchello context.
 /// </param>
 protected CheckoutRenderControllerBase(IMerchelloContext merchelloContext)
 {
     Mandate.ParameterNotNull(merchelloContext, "merchelloContext");
     _storeSettingService = merchelloContext.Services.StoreSettingService;
     _gatewayContext = merchelloContext.Gateways;
     this.Initialize();
 }
Beispiel #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CheckoutRenderControllerBase"/> class.
 /// </summary>
 /// <param name="merchelloContext">
 /// The merchello context.
 /// </param>
 protected CheckoutRenderControllerBase(IMerchelloContext merchelloContext)
 {
     Mandate.ParameterNotNull(merchelloContext, "merchelloContext");
     _storeSettingService = merchelloContext.Services.StoreSettingService;
     _gatewayContext      = merchelloContext.Gateways;
     this.Initialize();
 }
Beispiel #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MerchelloContext"/> class.
        /// </summary>
        /// <param name="serviceContext">
        /// The service context.
        /// </param>
        /// <param name="gatewayContext">
        /// The gateway context.
        /// </param>
        /// <param name="cache">
        /// The cache.
        /// </param>
        internal MerchelloContext(IServiceContext serviceContext, IGatewayContext gatewayContext, CacheHelper cache)
        {
            Mandate.ParameterNotNull(serviceContext, "serviceContext");
            Mandate.ParameterNotNull(gatewayContext, "gatewayContext");
            Mandate.ParameterNotNull(cache, "cache");

            _services = serviceContext;
            _gateways = gatewayContext;
            Cache = cache;
        }
Beispiel #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MerchelloContext"/> class.
        /// </summary>
        /// <param name="serviceContext">
        /// The service context.
        /// </param>
        /// <param name="gatewayContext">
        /// The gateway context.
        /// </param>
        /// <param name="cache">
        /// The cache.
        /// </param>
        internal MerchelloContext(IServiceContext serviceContext, IGatewayContext gatewayContext, CacheHelper cache)
        {
            Mandate.ParameterNotNull(serviceContext, "serviceContext");
            Mandate.ParameterNotNull(gatewayContext, "gatewayContext");
            Mandate.ParameterNotNull(cache, "cache");

            _services = serviceContext;
            _gateways = gatewayContext;
            Cache     = cache;
        }
Beispiel #5
0
 public GatewayClient(
     IGatewayContext gatewayContext,
     Identify identify,
     GatewayConfig config,
     ILogger logger,
     JsonSerializerOptions serializerOptions)
 {
     _gatewayContext        = gatewayContext;
     _identify              = identify;
     _config                = config;
     _logger                = logger;
     _jsonSerializerOptions = serializerOptions;
     _firstConnection       = true;
     _decompressor          = new Decompressor();
     _stopwatch             = new System.Diagnostics.Stopwatch();
 }
Beispiel #6
0
 private void StartConfig(ClientConfig clientConfig)
 {
     _clientConfig = clientConfig;
     _restContext  = clientConfig.GetRest();
     _restContext.Init();
     _cacheContext      = clientConfig.CacheContext;
     _serializerOptions = new JsonSerializerOptions()
     {
         Converters =
         {
             new MemberCollectionConverter(_cacheContext,  this,         Logger),
             new UserCollectionConverter(_cacheContext,    this,         Logger),
             new ChannelCollectionConverter(_cacheContext, this,         _restContext,Logger),
             new ChannelConverter(_cacheContext,           _restContext, Logger),
             new ULongConverter(),
             new TimeSpanConverter()
         }
     };
     _gatewayContext = clientConfig.GetGateway();
     Logger          = clientConfig.Logger;
     Logger.Log(LoggingLevel.Dcs, "DiscosCs v0.1-dev");
     InitCollections();
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="merchelloContext"></param>
 public GatewayProviderApiController(IMerchelloContext merchelloContext)
     : base((MerchelloContext) merchelloContext)
 {
     _gatewayContext = merchelloContext.Gateways;
     _gatewayProviderService = merchelloContext.Services.GatewayProviderService;
 }
 /// <summary>
 /// This is a helper contructor for unit testing
 /// </summary>
 internal GatewayProviderApiController(IMerchelloContext merchelloContext, UmbracoContext umbracoContext)
     : base((MerchelloContext) merchelloContext, umbracoContext)
 {
     _gatewayContext = merchelloContext.Gateways;
     _gatewayProviderService = merchelloContext.Services.GatewayProviderService;
 }
Beispiel #9
0
 internal TableGateway(IGatewayContext connection)
 {
     Guard.Against.Null(connection, nameof(connection));
     _connection = connection;
 }
Beispiel #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MerchelloContext"/> class.
 /// </summary>
 /// <param name="serviceContext">
 /// The service context.
 /// </param>
 /// <param name="gatewayContext">
 /// The gateway context.
 /// </param>
 internal MerchelloContext(IServiceContext serviceContext, IGatewayContext gatewayContext)
     : this(serviceContext, gatewayContext, ApplicationContext.Current.ApplicationCache)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="GatewayProviderApiController"/> class.
 /// </summary>
 /// <param name="merchelloContext">
 /// The merchello context.
 /// </param>
 public GatewayProviderApiController(IMerchelloContext merchelloContext)
     : base(merchelloContext)
 {
     _gatewayContext         = merchelloContext.Gateways;
     _gatewayProviderService = merchelloContext.Services.GatewayProviderService;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="GatewayProviderApiController"/> class.
 /// </summary>
 /// <param name="merchelloContext">
 /// The merchello context.
 /// </param>
 /// <param name="umbracoContext">
 /// The umbraco context.
 /// </param>
 internal GatewayProviderApiController(IMerchelloContext merchelloContext, UmbracoContext umbracoContext)
     : base(merchelloContext, umbracoContext)
 {
     _gatewayContext         = merchelloContext.Gateways;
     _gatewayProviderService = merchelloContext.Services.GatewayProviderService;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CheckoutShipRateQuoteModelFactory{TShipRateQuoteModel}"/> class.
 /// </summary>
 /// <param name="merchelloContext">
 /// The <see cref="IMerchelloContext"/>.
 /// </param>
 public CheckoutShipRateQuoteModelFactory(IMerchelloContext merchelloContext)
 {
     Mandate.ParameterNotNull(merchelloContext, "merchelloContext");
     _gatewayContext = merchelloContext.Gateways;
 }
Beispiel #14
0
        /// <summary>
        /// Builds the MerchelloContext internals
        /// </summary>
        /// <param name="isUnitTest">True/false indicating whether or not is being called by certain unit tests</param>
        private void BuildMerchelloContext(bool isUnitTest)
        {
            if (isUnitTest) return;

            var gatewayResolver = new Lazy<GatewayProviderResolver>(() => new GatewayProviderResolver(_services.GatewayProviderService, Cache.RuntimeCache));

            _gateways = new GatewayContext(
                new ShippingContext(_services.GatewayProviderService, _services.StoreSettingService, gatewayResolver.Value),
                new TaxationContext(_services.GatewayProviderService, gatewayResolver.Value),
                new PaymentContext(_services.GatewayProviderService, gatewayResolver.Value)
                );
        }
Beispiel #15
0
 internal DomainGateway(IGatewayContext context)
 {
     Guard.Against.Null(context, nameof(context));
     _context = context;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CheckoutPaymentMethodModelFactory{TPaymentMethodModel}"/> class.
 /// </summary>
 /// <param name="merchelloContext">
 /// The merchello context.
 /// </param>
 public CheckoutPaymentMethodModelFactory(IMerchelloContext merchelloContext)
 {
     Mandate.ParameterNotNull(merchelloContext, "merchelloContext");
     _gatewayContext = merchelloContext.Gateways;
 }
Beispiel #17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MerchelloContext"/> class.
 /// </summary>
 /// <param name="serviceContext">
 /// The service context.
 /// </param>
 /// <param name="gatewayContext">
 /// The gateway context.
 /// </param>
 internal MerchelloContext(IServiceContext serviceContext, IGatewayContext gatewayContext)
     : this(serviceContext, gatewayContext, ApplicationContext.Current.ApplicationCache)
 {
 }