Beispiel #1
0
 public CashPaymentService(IUnifiedSalesService unifiedSalesService, IHttpContextAccessor httpContextAccessor,
                           IPaymentRequestRepository paymentRequestRepository) : base(unifiedSalesService, paymentRequestRepository)
 {
     _unifiedSalesService      = unifiedSalesService;
     _paymentRequestRepository = paymentRequestRepository;
     _httpContextAccessor      = httpContextAccessor;
 }
 public ResolveMessageService(IPaymentRequestRepository paymentRequestRepository, IAuditLogRepository auditLogRepository, IServiceProviderRepository serviceProviderRepository, IPaymentResponseRepository paymentResponseRepository)
 {
     _paymentRequestRepository = paymentRequestRepository;
     _paymentResponseRepository = paymentResponseRepository;
     _auditLogRepository = auditLogRepository;
     _serviceProviderRepository = serviceProviderRepository;
 }
Beispiel #3
0
 public PaymentProcessController(ILogger <PaymentProcessController> logger, IPaymentRequestRepository paymentRequestRepo,
                                 IPaymentRepository paymentRepository, IMapper mapper)
 {
     _logger             = logger;
     _paymentRequestRepo = paymentRequestRepo;
     _paymentRepository  = paymentRepository;
     _mapper             = mapper;
 }
 public PaymentController(IMessageSerializer messageDeserialize, IResolveMessageService resolveMessageService, IPaymentRequestRepository paymentRequestRepository, IPaymentResponseRepository paymentResponseRepository, IAuditLogRepository auditLogRepository)
 {
     _messageDeserialize = messageDeserialize;
     _resolveMessageService = resolveMessageService;
     _paymentRequestRepository = paymentRequestRepository;
     _paymentResponseRepository = paymentResponseRepository;
     _auditLogRepository = auditLogRepository;
 }
 public TransactionsService(
     IPaymentRequestTransactionRepository transactionRepository,
     IPaymentRequestRepository paymentRequestRepository,
     int transactionConfirmationCount)
 {
     _transactionRepository        = transactionRepository;
     _paymentRequestRepository     = paymentRequestRepository;
     _transactionConfirmationCount = transactionConfirmationCount;
 }
Beispiel #6
0
 public CardPaymentService(IMerchantAccountService merchantAccountService,
                           IPaymentRequestRepository paymentRequestRepository, IUnifiedSalesService unifiedSalesService,
                           ILogger <CardPaymentService> logger) : base(unifiedSalesService, paymentRequestRepository)
 {
     _merchantAccountService   = merchantAccountService;
     _paymentRequestRepository = paymentRequestRepository;
     _unifiedSalesService      = unifiedSalesService;
     _logger = logger;
 }
Beispiel #7
0
        public void Initialise()
        {
            var logger = Substitute.For <ILogger>();

            _handler     = Substitute.For <IPaymentRequestHandler>();
            _respository = Substitute.For <IPaymentRequestRepository>();

            _paymentsController = new PaymentsController(_handler, _respository, logger);
        }
Beispiel #8
0
 public HubtelMePaymentService(IMerchantAccountService merchantAccountService,
                               IPaymentRequestRepository paymentRequestRepository, IUnifiedSalesService unifiedSalesService,
                               ILogger <HubtelMePaymentService> logger, IHttpContextAccessor httpContextAccessor) : base(unifiedSalesService, paymentRequestRepository)
 {
     _merchantAccountService   = merchantAccountService;
     _paymentRequestRepository = paymentRequestRepository;
     _unifiedSalesService      = unifiedSalesService;
     _logger = logger;
     _httpContextAccessor = httpContextAccessor;
 }
Beispiel #9
0
        public PaymentRequestService(
            [NotNull] IPaymentRequestRepository paymentRequestRepository,
            [NotNull] IOrderService orderService,
            [NotNull] IPaymentRequestPublisher paymentRequestPublisher,
            [NotNull] ITransferService transferService,
            [NotNull] IPaymentRequestStatusResolver paymentRequestStatusResolver,
            [NotNull] ILogFactory logFactory,
            [NotNull] IWalletManager walletsManager,
            [NotNull] ITransactionsService transactionsService,
            [NotNull] ExpirationPeriodsSettings expirationPeriods,
            [NotNull] IMerchantWalletService merchantWalletService,
            [NotNull] IDistributedLocksService paymentLocksService,
            [NotNull] ITransactionPublisher transactionPublisher,
            [NotNull] IDistributedLocksService checkoutLocksService,
            [NotNull] IWalletBalanceValidator walletBalanceValidator,
            [NotNull] RetryPolicySettings retryPolicySettings,
            [NotNull] IAutoSettleSettingsResolver autoSettleSettingsResolver,
            [NotNull] IAssetSettingsService assetSettingsService)
        {
            _paymentRequestRepository     = paymentRequestRepository ?? throw new ArgumentNullException(nameof(paymentRequestRepository));
            _orderService                 = orderService ?? throw new ArgumentNullException(nameof(orderService));
            _paymentRequestPublisher      = paymentRequestPublisher ?? throw new ArgumentNullException(nameof(paymentRequestPublisher));
            _transferService              = transferService ?? throw new ArgumentNullException(nameof(transferService));
            _paymentRequestStatusResolver = paymentRequestStatusResolver ?? throw new ArgumentNullException(nameof(paymentRequestStatusResolver));
            _log                        = logFactory.CreateLog(this);
            _walletsManager             = walletsManager ?? throw new ArgumentNullException(nameof(walletsManager));
            _transactionsService        = transactionsService ?? throw new ArgumentNullException(nameof(transactionsService));
            _expirationPeriods          = expirationPeriods ?? throw new ArgumentNullException(nameof(expirationPeriods));
            _merchantWalletService      = merchantWalletService ?? throw new ArgumentNullException(nameof(merchantWalletService));
            _paymentLocksService        = paymentLocksService ?? throw new ArgumentNullException(nameof(paymentLocksService));
            _transactionPublisher       = transactionPublisher ?? throw new ArgumentNullException(nameof(transactionPublisher));
            _checkoutLocksService       = checkoutLocksService ?? throw new ArgumentNullException(nameof(checkoutLocksService));
            _walletBalanceValidator     = walletBalanceValidator ?? throw new ArgumentNullException(nameof(walletBalanceValidator));
            _autoSettleSettingsResolver = autoSettleSettingsResolver ?? throw new ArgumentNullException(nameof(autoSettleSettingsResolver));
            _assetSettingsService       = assetSettingsService ?? throw new ArgumentNullException(nameof(assetSettingsService));

            _settlementRetryPolicy = Policy
                                     .Handle <InsufficientFundsException>()
                                     .Or <SettlementOperationFailedException>()
                                     .Or <SettlementOperationPartiallyFailedException>()
                                     .WaitAndRetryAsync(
                retryPolicySettings.SettlementAttempts,
                attempt => TimeSpan.FromSeconds(Math.Pow(2, attempt)),
                (ex, timespan) => _log.Error(ex, "Settlement with retry"));

            _paymentRetryPolicy = Policy
                                  .Handle <InsufficientFundsException>()
                                  .Or <PaymentOperationFailedException>()
                                  .Or <PaymentOperationPartiallyFailedException>()
                                  .WaitAndRetryAsync(
                retryPolicySettings.DefaultAttempts,
                attempt => TimeSpan.FromSeconds(Math.Pow(2, attempt)),
                (ex, timespan) => _log.Error(ex, "Payment with retry"));
        }
        public PaymentsController(
            IPaymentRequestHandler paymentHandler,
            IPaymentRequestRepository repository,
            ILogger logger)
        {
            _logger = logger;
            _logger?.LogTrace($"Creating a {nameof(PaymentsController)}");

            _paymentHandler = paymentHandler ?? throw new ArgumentNullException(nameof(paymentHandler));
            _repository     = repository ?? throw new ArgumentNullException(nameof(repository));
        }
Beispiel #11
0
 public PaymentRequestStatusResolver(
     int transactionConfirmationCount,
     IPaymentRequestRepository paymentRequestRepository,
     IOrderService orderService,
     ICalculationService calculationService,
     ITransactionsService transactionsService)
 {
     _transactionConfirmationCount = transactionConfirmationCount;
     _paymentRequestRepository     = paymentRequestRepository;
     _orderService        = orderService;
     _calculationService  = calculationService;
     _transactionsService = transactionsService;
 }
Beispiel #12
0
        public PaymentRequestHandler(
            IPaymentRequestRepository repository,
            IPaymentRequestValidator validator,
            IBankService bankService,
            ILogger logger)
        {
            _logger = logger;
            _logger?.LogTrace($"Creating a {nameof(PaymentRequestHandler)}");

            _repository  = repository ?? throw new ArgumentNullException(nameof(repository));
            _validator   = validator ?? throw new ArgumentNullException(nameof(validator));
            _bankService = bankService ?? throw new ArgumentNullException(nameof(bankService));
        }
Beispiel #13
0
        //private readonly string flowFinaceApiUrlSecure;

        public FlowFinanceAPI(IHttpContextAccessor httpContextAccessor, IHttpClientFactory clientFactory, MerchantSettings merchantSettings, IPaymentRequestRepository paymentRequestRepository)
        {
            this._httpContextAccessor      = httpContextAccessor ?? throw new ArgumentNullException(nameof(httpContextAccessor));
            this._clientFactory            = clientFactory ?? throw new ArgumentNullException(nameof(clientFactory));
            this._paymentRequestRepository = paymentRequestRepository ?? throw new ArgumentNullException(nameof(paymentRequestRepository));

            this.client_id        = merchantSettings.clientId ?? throw new ArgumentNullException(nameof(merchantSettings.clientId));
            this.client_secret    = merchantSettings.clientSecret ?? throw new ArgumentNullException(nameof(merchantSettings.clientSecret));
            this.flowFinaceApiUrl = $"{(merchantSettings.isLive ? FlowFinanceConstants.FlowFinaceApiUrl : FlowFinanceConstants.FlowFinaceStgApiUrl)}{FlowFinanceConstants.FlowFinaceApiVersion}";
            //this.flowFinaceApiUrlSecure = $"{(merchantSettings.isLive ? FlowFinanceConstants.FlowFinaceApiUrlSecure : FlowFinanceConstants.FlowFinaceStgApiUrlSecure)}{FlowFinanceConstants.FlowFinaceApiVersion}";
            //this.flowFinaceApiUrlSecure = merchantSettings.isLive ? FlowFinanceConstants.FlowFinaceApiUrlSecure : FlowFinanceConstants.FlowFinaceStgApiUrlSecure;

            //this.accessToken = GetAccessToken().Result;
        }
        public AffirmPaymentService(IPaymentRequestRepository paymentRequestRepository, IHttpContextAccessor httpContextAccessor, HttpClient httpClient, IIOServiceContext context)
        {
            this._paymentRequestRepository = paymentRequestRepository ??
                                             throw new ArgumentNullException(nameof(paymentRequestRepository));

            this._httpContextAccessor = httpContextAccessor ??
                                        throw new ArgumentNullException(nameof(httpContextAccessor));

            this._httpClient = httpClient ??
                               throw new ArgumentNullException(nameof(httpClient));

            this._context = context ??
                            throw new ArgumentNullException(nameof(context));
        }
Beispiel #15
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;
 }
Beispiel #16
0
 public PaymentRequestCommandsHandler(
     ILogger <PaymentRequestCommandsHandler> logger,
     IUnitOfWork unitOfWork,
     IPaymentRequestRepository paymentRequestRepository,
     IPaymentRequestService paymentRequestService,
     IProcessMessageService processMessageService,
     ISystemDateTimeService systemDateTimeService,
     IInterfaceEventLogService interfaceEventLogService)
 {
     _logger = logger ?? throw new ArgumentNullException(nameof(logger));
     _paymentRequestRepository = paymentRequestRepository ?? throw new ArgumentNullException(nameof(paymentRequestRepository));
     _unitOfWork               = unitOfWork ?? throw new ArgumentNullException(nameof(unitOfWork));
     _paymentRequestService    = paymentRequestService ?? throw new ArgumentNullException(nameof(paymentRequestService));
     _processMessageService    = processMessageService ?? throw new ArgumentNullException(nameof(processMessageService));
     _systemDateTimeService    = systemDateTimeService ?? throw new ArgumentNullException(nameof(systemDateTimeService));
     _interfaceEventLogService = interfaceEventLogService ?? throw new ArgumentNullException(nameof(interfaceEventLogService));
 }
Beispiel #17
0
        public void Setup()
        {
            _paymentStateRepository  = new Mock <IPaymentStateRepository>();
            _paymentRepository       = new Mock <IPaymentRepository>();
            _cheapPaymentGateway     = new Mock <ICheapPaymentGateway>();
            _expensivePaymentGateway = new Mock <IExpensivePaymentGateway>();
            _mapper = new Mock <IMapper>();
            //_logger = new Mock<ILogger<PaymentRequestRepositoryTests>>();

            _paymentRequestRepository = new PaymentRequestRepository(_paymentRepository.Object, _paymentStateRepository.Object, _cheapPaymentGateway.Object, _expensivePaymentGateway.Object, _mapper.Object);

            _mapper.Setup(s => s.Map <PaymentCreateDto, Payment>(It.IsAny <PaymentCreateDto>())).Returns((PaymentCreateDto pc) => new Payment()
            {
                Amount = pc.Amount, CardHolder = pc.CardHolder, CreditCardNumber = pc.CreditCardNumber, ExpirationDate = pc.ExpirationDate, SecurityCode = pc.SecurityCode
            });
            _paymentRepository.Setup(v => v.CreatePaymentRecord(It.IsAny <Payment>())).Returns((Payment paymentEntity) => Task.FromResult(paymentEntity));
            _paymentStateRepository.Setup(m => m.CreatePaymentRecord(It.IsAny <PaymentState>())).Returns((PaymentState paymentStateEntity) => Task.FromResult(paymentStateEntity));
        }
Beispiel #18
0
 public PaymentRequestService(
     IPaymentRequestRepository paymentRequestRepository,
     IOrderService orderService,
     IPaymentRequestPublisher paymentRequestPublisher,
     ITransferService transferService,
     IPaymentRequestStatusResolver paymentRequestStatusResolver,
     ILog log,
     IWalletManager walletsManager,
     ITransactionsService transactionsService,
     ExpirationPeriodsSettings expirationPeriods)
 {
     _paymentRequestRepository     = paymentRequestRepository;
     _orderService                 = orderService;
     _paymentRequestPublisher      = paymentRequestPublisher;
     _transferService              = transferService;
     _paymentRequestStatusResolver = paymentRequestStatusResolver;
     _log                 = log;
     _walletsManager      = walletsManager;
     _transactionsService = transactionsService;
     _expirationPeriods   = expirationPeriods;
 }
 public TakePaymentController(IPaymentRequestRepository paymentRequestRepository, IPaymentsCommandHandler paymentsCommandHandler)
 {
     _paymentRequestRepository = paymentRequestRepository;
     _paymentsCommandHandler   = paymentsCommandHandler;
 }
Beispiel #20
0
 public PaymentRequestService(IPaymentRequestRepository repository)
 {
     _repository = repository;
 }
 public PrepairPaymentCommandHandler(IPaymentRequestRepository paymentRequestRepository, IQueryMerchants merchantQueries)
 {
     _paymentRequestRepository = paymentRequestRepository;
     _merchantQueries          = merchantQueries;
 }
 public BacsPaymentQueryService(IPaymentRequestRepository paymentRequestRepository)
 {
     _paymentRequestRepository = paymentRequestRepository;
 }
 public PaymentRequestService(IPaymentRequestRepository _paymentRequestRepository, IPaymentRequestValidator _paymentRequestValidator)
 {
     _repository = _paymentRequestRepository;
     _validator  = _paymentRequestValidator;
 }
Beispiel #24
0
 public UnitOfWork(MoulaContext context)
 {
     _context        = context;
     PaymentRequests = new PaymentRequestRepository(_context);
     Transactions    = new TransactionRepository(_context);
 }
 public PaymentRequestController()
 {
     this.paymentreqRepository = new PaymentRequestRepository();
 }
 public PaymentRequestController(IPaymentRequestRepository paymentreqRepository)
 {
     this.paymentreqRepository = paymentreqRepository;
 }
Beispiel #27
0
 public PaymentService(IUnifiedSalesService unifiedSalesService, IPaymentRequestRepository paymentRequestRepository)
 {
     _unifiedSalesService      = unifiedSalesService;
     _paymentRequestRepository = paymentRequestRepository;
 }
Beispiel #28
0
 public ProcessBacsPaymentService(IPaymentRequestRepository paymentRequestRepository)
 {
     _paymentRequestRepository = paymentRequestRepository;
 }