public virtual async void TestUpdate()
        {
            var builder = new WebHostBuilder()
                          .UseEnvironment("Production")
                          .UseStartup <TestStartup>();
            TestServer testServer = new TestServer(builder);

            var client = new ApiClient(testServer.CreateClient());

            client.SetBearerToken(JWTTestHelper.GenerateBearerToken());
            var mapper = new ApiTransactionStatusServerModelMapper();
            ApplicationDbContext      context             = testServer.Host.Services.GetService(typeof(ApplicationDbContext)) as ApplicationDbContext;
            ITransactionStatusService service             = testServer.Host.Services.GetService(typeof(ITransactionStatusService)) as ITransactionStatusService;
            ApiTransactionStatusServerResponseModel model = await service.Get(1);

            ApiTransactionStatusClientRequestModel request = mapper.MapServerResponseToClientRequest(model);

            request.SetProperties("B");

            UpdateResponse <ApiTransactionStatusClientResponseModel> updateResponse = await client.TransactionStatusUpdateAsync(model.Id, request);

            context.Entry(context.Set <TransactionStatus>().ToList()[0]).Reload();
            updateResponse.Record.Should().NotBeNull();
            updateResponse.Success.Should().BeTrue();
            updateResponse.Record.Id.Should().Be(1);
            context.Set <TransactionStatus>().ToList()[0].Name.Should().Be("B");

            updateResponse.Record.Id.Should().Be(1);
            updateResponse.Record.Name.Should().Be("B");
        }
Exemplo n.º 2
0
        public PaystackController(ITransactionStatusService transactionStatusService
                                  , ISupportedCurrencyService supportedCurrencyService
                                  , IHostingEnvironment env
                                  , IGatewayLuncher gatewayLuncher
                                  //, HttpContext httpContext
                                  , ITransactionLogService transactionLogService
                                  , IHttpContextAccessor httpContextAccessor
                                  , ISettingService settingService)
        {
            Guard.NotNull(env, nameof(env));
            //Guard.NotNull(httpContext, nameof(httpContext));
            Guard.NotNull(settingService, nameof(settingService));
            Guard.NotNull(gatewayLuncher, nameof(gatewayLuncher));
            Guard.NotNull(transactionLogService, nameof(transactionLogService));
            Guard.NotNull(transactionStatusService, nameof(transactionStatusService));
            Guard.NotNull(supportedCurrencyService, nameof(supportedCurrencyService));
            Guard.NotNull(httpContextAccessor, nameof(httpContextAccessor));


            _hostEnvironment = env;

            _settingService           = settingService;
            _gatewayLuncher           = gatewayLuncher;
            _transactionLogService    = transactionLogService;
            _transactionStatusService = transactionStatusService;
            _supportedCurrencyService = supportedCurrencyService;
            _httpContext = httpContextAccessor.HttpContext;
        }
        public virtual async void TestDelete()
        {
            var builder = new WebHostBuilder()
                          .UseEnvironment("Production")
                          .UseStartup <TestStartup>();
            TestServer testServer = new TestServer(builder);
            var        client     = new ApiClient(testServer.CreateClient());

            client.SetBearerToken(JWTTestHelper.GenerateBearerToken());
            ApplicationDbContext context = testServer.Host.Services.GetService(typeof(ApplicationDbContext)) as ApplicationDbContext;

            ITransactionStatusService service = testServer.Host.Services.GetService(typeof(ITransactionStatusService)) as ITransactionStatusService;
            var model = new ApiTransactionStatusServerRequestModel();

            model.SetProperties("B");
            CreateResponse <ApiTransactionStatusServerResponseModel> createdResponse = await service.Create(model);

            createdResponse.Success.Should().BeTrue();

            ActionResponse deleteResult = await client.TransactionStatusDeleteAsync(2);

            deleteResult.Success.Should().BeTrue();
            ApiTransactionStatusServerResponseModel verifyResponse = await service.Get(2);

            verifyResponse.Should().BeNull();
        }
Exemplo n.º 4
0
 public AbstractTransactionStatusController(
     ApiSettings settings,
     ILogger <AbstractTransactionStatusController> logger,
     ITransactionCoordinator transactionCoordinator,
     ITransactionStatusService transactionStatusService,
     IApiTransactionStatusModelMapper transactionStatusModelMapper
     )
     : base(settings, logger, transactionCoordinator)
 {
     this.TransactionStatusService     = transactionStatusService;
     this.TransactionStatusModelMapper = transactionStatusModelMapper;
 }
Exemplo n.º 5
0
 public Plugin(ICommonServices services,
               IGTPayCurrencyService supportedCurrencyService,
               ITransactionStatusService transactionStatusService,
               ILocalizationService localizationService,
               ISettingService settingService,
               ILogger logger)
 {
     _services = services;
     _transactionStatusService = transactionStatusService;
     _supportedCurrencyService = supportedCurrencyService;
     _localizationService      = localizationService;
     _settingService           = settingService;
     _logger = logger;
 }
Exemplo n.º 6
0
 public TransactionStatusController(
     ApiSettings settings,
     ILogger <TransactionStatusController> logger,
     ITransactionCoordinator transactionCoordinator,
     ITransactionStatusService transactionStatusService,
     IApiTransactionStatusServerModelMapper transactionStatusModelMapper
     )
     : base(settings, logger, transactionCoordinator)
 {
     this.TransactionStatusService     = transactionStatusService;
     this.TransactionStatusModelMapper = transactionStatusModelMapper;
     this.BulkInsertLimit = 250;
     this.MaxLimit        = 1000;
     this.DefaultLimit    = 250;
 }
Exemplo n.º 7
0
        public async Task c()
        {
            HostingEnvironment hostEnvironment = new HostingEnvironment();

            hostEnvironment.ContentRootPath         = "C:\\Users\\LENOVO\\Documents\\Repositories\\lms-gateway\\src\\Presentation\\LmsGateway.Web";
            hostEnvironment.ContentRootFileProvider = new PhysicalFileProvider(hostEnvironment.ContentRootPath);
            hostEnvironment.EnvironmentName         = "Development";

            Startup            startup = new Web.Startup(hostEnvironment);
            IServiceCollection sc      = new ServiceCollection();

            startup.ConfigureServices(sc);

            IServiceProvider          serviceProvider          = sc.BuildServiceProvider();
            ISupportedCurrencyService supportedCurrencyService = serviceProvider.GetService <ISupportedCurrencyService>();
            IGatewayLuncher           gatewayLuncher           = serviceProvider.GetService <IGatewayLuncher>();
            ITransactionLogService    transactionLogService    = serviceProvider.GetService <ITransactionLogService>();
            ITransactionStatusService transactionStatusService = serviceProvider.GetService <ITransactionStatusService>();
            ISettingService           settingService           = serviceProvider.GetService <ISettingService>();

            //PaystackController paystackController = new PaystackController(transactionStatusService
            //    , supportedCurrencyService
            //    , hostEnvironment
            //    , gatewayLuncher
            //    , transactionLogService
            //    , settingService);

            //var response = await paystackController.InvokeAsync();
            //var result = (ViewViewComponentResult)response;

            //Assert.NotNull(result);
            //Assert.NotNull(response);
            //Assert.IsType<ViewViewComponentResult>(response);
            //Assert.IsType<PaymentInfoModel>(result.ViewData.Model);
            //Assert.True((result.ViewData.Model as PaymentInfoModel).IconUrl != null);
        }