Exemple #1
0
        protected TestBase()
        {
            var appRoot = AppContext.BaseDirectory.Substring(0, AppContext.BaseDirectory.IndexOf("bin", StringComparison.Ordinal));

            Configuration = TestHelper.GetApplicationConfiguration(appRoot);

            var services = new ServiceCollection();

            serviceProvider = services.BuildServiceProvider();

            var handler = new HttpClientHandler
            {
                AllowAutoRedirect = false
            };

            var checkoutApihttpClient = new HttpClient(handler)
            {
                BaseAddress = Configuration.SveaApiUrls.CheckoutApiUri
            };
            var paymentAdminApiHttpClient = new HttpClient(handler)
            {
                BaseAddress = Configuration.SveaApiUrls.PaymentAdminApiUri
            };

            this.Sut = new SveaWebPayClient(checkoutApihttpClient, paymentAdminApiHttpClient, new Credentials(Configuration.Credentials.MerchantId, Configuration.Credentials.Secret));
        }
Exemple #2
0
        public void OneTimeSetUp()
        {
            var config = new ConfigurationBuilder()
                         .AddJsonFile("appsettings.json")
                         .AddUserSecrets("6343ea20-120b-4075-a141-c8154cad1d14")
                         .AddEnvironmentVariables()
                         .Build();

            var handler = new HttpClientHandler
            {
                AllowAutoRedirect = false
            };

            var checkoutApihttpClient = new HttpClient(handler)
            {
                BaseAddress = new Uri(config.GetSection("SveaApiUrls").GetSection("CheckoutApiUri").Value)
            };
            var paymentAdminApiHttpClient = new HttpClient(handler)
            {
                BaseAddress = new Uri(config.GetSection("SveaApiUrls").GetSection("PaymentAdminApiUri").Value)
            };

            _sveaClient = new SveaWebPayClient(
                checkoutApihttpClient,
                paymentAdminApiHttpClient,
                new Credentials(
                    config.GetSection("Credentials").GetSection("MerchantId").Value,
                    config.GetSection("Credentials").GetSection("Secret").Value
                    )
                );
        }
Exemple #3
0
 public CheckOutController(
     IOptionsSnapshot <Models.MerchantSettings> merchantsAccessor,
     Cart cartService,
     SveaWebPayClient sveaClient)
 {
     _merchantSettings = merchantsAccessor.Value;
     _cartService      = cartService;
     _sveaClient       = sveaClient;
 }
Exemple #4
0
 public SveaController(Cart cartService, StoreDbContext context, SveaWebPayClient sveaClient)
 {
     _cartService = cartService;
     _context     = context;
     _sveaClient  = sveaClient;
 }
Exemple #5
0
 public OrdersController(StoreDbContext context,
                         SveaWebPayClient sveaClient)
 {
     this.context     = context;
     this._sveaClient = sveaClient;
 }
Exemple #6
0
 public PaymentController(SveaWebPayClient sveaClient)
 {
     this._sveaClient = sveaClient;
 }