Ejemplo n.º 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));
        }
Ejemplo n.º 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
                    )
                );
        }
Ejemplo n.º 3
0
 public CheckOutController(
     IOptionsSnapshot <Models.MerchantSettings> merchantsAccessor,
     Cart cartService,
     SveaWebPayClient sveaClient)
 {
     _merchantSettings = merchantsAccessor.Value;
     _cartService      = cartService;
     _sveaClient       = sveaClient;
 }
Ejemplo n.º 4
0
 public SveaController(Cart cartService, StoreDbContext context, SveaWebPayClient sveaClient)
 {
     _cartService = cartService;
     _context     = context;
     _sveaClient  = sveaClient;
 }
Ejemplo n.º 5
0
 public OrdersController(StoreDbContext context,
                         SveaWebPayClient sveaClient)
 {
     this.context     = context;
     this._sveaClient = sveaClient;
 }
Ejemplo n.º 6
0
 public PaymentController(SveaWebPayClient sveaClient)
 {
     this._sveaClient = sveaClient;
 }