Ejemplo n.º 1
0
 public MerchantAccountService(IMerchantAccountHttpClient merchantAccountHttpClient,
                               IMerchantAccountConfiguration merchantAccountConfiguration, IPaymentTypeConfiguration paymentTypeConfiguration,
                               ILogger <MerchantAccountService> logger, IDistributedCache cache)
 {
     _merchantAccountHttpClient    = merchantAccountHttpClient;
     _merchantAccountConfiguration = merchantAccountConfiguration;
     _paymentTypeConfiguration     = paymentTypeConfiguration;
     _logger       = logger;
     _cache        = cache;
     _cacheOptions = new DistributedCacheEntryOptions()
                     .SetAbsoluteExpiration(TimeSpan.FromMinutes(72400))
                     .SetSlidingExpiration(TimeSpan.FromMinutes(3600));
 }
Ejemplo n.º 2
0
 public PaymentStatusCheckService(ILogger <PaymentStatusCheckService> logger,
                                  IPaymentTypeConfiguration paymentTypeConfiguration, IServiceProvider provider,
                                  IConfiguration configuration, IMomoPaymentService momoPaymentService,
                                  ICardPaymentService cardPaymentService, IHubtelMePaymentService hubtelMePaymentService)
 {
     _logger = logger;
     _paymentTypeConfiguration = paymentTypeConfiguration;
     _provider               = provider;
     _configuration          = configuration;
     _momoPaymentService     = momoPaymentService;
     _cardPaymentService     = cardPaymentService;
     _hubtelMePaymentService = hubtelMePaymentService;
 }
Ejemplo n.º 3
0
 public PaymentsController(ICardPaymentService cardPaymentService,
                           IMomoPaymentService momoPaymentService, IMapper mapper,
                           IPaymentRequestRepository paymentRequestRepository, IServiceProvider provider,
                           IPaymentTypeConfiguration paymentTypeConfiguration, IUnifiedSalesService unifiedSalesService,
                           IMerchantAccountService merchantAccountService, ICustomerProfileService customerProfileService)
 {
     _mapper = mapper;
     _paymentRequestRepository = paymentRequestRepository;
     _cardPaymentService       = cardPaymentService;
     _momoPaymentService       = momoPaymentService;
     _provider = provider;
     _paymentTypeConfiguration = paymentTypeConfiguration;
     _unifiedSalesService      = unifiedSalesService;
     _merchantAccountService   = merchantAccountService;
     _customerProfileService   = customerProfileService;
 }
Ejemplo n.º 4
0
        public CustomerProfileService(IDistributedCache distributedCache,
                                      IConfiguration configuration,
                                      IMnpHttpClient mnpHttpClient,
                                      IProfilerHttpClient profilerHttpClient,
                                      ILogger <CustomerProfileService> logger,
                                      IPaymentTypeConfiguration paymentTypeConfiguration)
        {
            var cacheDuration = Convert.ToInt32(configuration["MnpApi:CacheExpiryDurationMinutes"]);

            _distributedCache         = distributedCache;
            _configuration            = configuration;
            _mnpHttpClient            = mnpHttpClient;
            _profilerHttpClient       = profilerHttpClient;
            _logger                   = logger;
            _paymentTypeConfiguration = paymentTypeConfiguration;
            _cacheEntryOptions        = new DistributedCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromMinutes(cacheDuration));
        }
Ejemplo n.º 5
0
        public PaymentRequestValidator(IPaymentTypeConfiguration paymentTypeConfiguration)
        {
            _paymentTypeConfiguration = paymentTypeConfiguration;

            RuleFor(vm => vm.Description).NotNull().NotEmpty();
            RuleFor(vm => vm.PaymentType).NotNull().NotEmpty();
            RuleFor(vm => vm.PaymentType).Must(HaveValidPaymentType)
            .WithMessage("The payment type is not valid");
            RuleFor(vm => vm.AmountPaid).NotNull().NotEmpty();
            RuleFor(vm => vm.PosDeviceId).NotNull().NotEmpty();
            RuleFor(vm => vm.AmountPaid).GreaterThanOrEqualTo(0);
            RuleFor(vm => vm.MomoPhoneNumber).Must(HaveValidCustomerMsisdn).When(x => isMsisdnRequired(x.PaymentType));
            RuleFor(vm => vm.MomoPhoneNumber).Must(HaveValidChannel).When(x => isMsisdnRequired(x.PaymentType));
            RuleFor(vm => vm.MomoToken).NotEmpty().When(x => isChannelTokenRequired(x.MomoChannel));
            RuleFor(vm => vm.ChargeCustomer).NotNull().NotEmpty().When(x => isMsisdnRequired(x.PaymentType));
            RuleFor(x => x.EmployeeId).NotEmpty().When(x => !string.IsNullOrEmpty(x.EmployeeName.Trim()));
            RuleFor(x => x.EmployeeName).NotEmpty().When(x => !string.IsNullOrEmpty(x.EmployeeId.Trim()));
            RuleFor(x => x.BranchId).NotEmpty().When(x => !string.IsNullOrEmpty(x.BranchName));
            RuleFor(x => x.BranchName).NotEmpty().When(x => !string.IsNullOrEmpty(x.BranchId));
        }