Example #1
0
 public UnitOfWork(AppDbContext dbContext, ILogger <UnitOfWork> logger, IPaymentRepository paymentRepository, IPaymentStateRepository paymentStateRepository)
 {
     this.dbContext         = dbContext;
     this.logger            = logger;
     PaymentRepository      = paymentRepository;
     PaymentStateRepository = paymentStateRepository;
 }
        public PaymentGatewayTest()
        {
            var options = new DbContextOptionsBuilder <ApplicationDbContext>().UseSqlServer("Data Source=(local)\\SQLEXPRESS;Initial Catalog=PaymentGateway;Integrated Security=True;").Options;

            _context = new ApplicationDbContext(options);
            _context.Database.EnsureDeleted();
            _context.Database.EnsureCreated();

            if (_mapper == null)
            {
                var mappingConfig = new MapperConfiguration(mc =>
                {
                    mc.AddProfile(new AutoMapperProfile());
                });
                IMapper mapper = mappingConfig.CreateMapper();
                _mapper = mapper;
            }

            _cheapPaymentGateway     = new CheapPaymentGateway();
            _expensivePaymentGateway = new ExpensivePaymentGateway(_cheapPaymentGateway);
            _premiumPaymentGateway   = new PremiumPaymentGateway();
            _paymentRepo             = new PaymentRepository(_context);
            _paymentStateRepo        = new PaymentStateRepository(_context);
            _paymentGateway          = new PaymentGateway(_cheapPaymentGateway, _expensivePaymentGateway, _premiumPaymentGateway, _paymentRepo, _paymentStateRepo, _mapper);
        }
 public PaymentRequestService(ICheapPaymentGateway cheapPaymentGateway, IExpensivePaymentGateway expensivePaymentGateway, IPaymentRepository paymentRepository, IPaymentStateRepository paymentStateRepository)
 {
     _cheapPaymentGateway     = cheapPaymentGateway;
     _expensivePaymentGateway = expensivePaymentGateway;
     _paymentRepository       = paymentRepository;
     _paymentStateRepository  = paymentStateRepository;
 }
Example #4
0
 public PaymentService(ICheapPaymentGateway cheapPaymentGateway, IExpensivePaymentGateway expensivePaymentGateway, IMapper mapper, IPaymentRepository paymentRepository, IPaymentStateRepository paymentStateRepository)
 {
     _mapper = mapper;
     _cheapPaymentGateway     = cheapPaymentGateway;
     _expensivePaymentGateway = expensivePaymentGateway;
     _paymentRepository       = paymentRepository;
     _paymentStateRepository  = paymentStateRepository;
 }
 public PaymentRequestService(ICheapPaymentGateway ICheap, IExpensivePaymentGateway IExp, IPaymentRepository IpayRepo, IPaymentStateRepository payStRepo)
 {
     // map = mapper;
     cheapPayGateway     = ICheap;
     expensivePayGateway = IExp;
     payRepo             = IpayRepo;
     payStateRepo        = payStRepo;
 }
 public PaymentService(IPaymentRepository paymentRepository, IPaymentStateRepository paymentStateRepository, IUnitOfWork UWO, IMapper mapper, IPaymentGateway paymentGateway)
 {
     _paymentRepository      = paymentRepository;
     _paymentStateRepository = paymentStateRepository;
     _UOW            = UWO;
     _mapper         = mapper;
     _paymentGateway = paymentGateway;
 }
Example #7
0
 public PaymentGateWay(IPaymentStateRepository paymentStateRepository, IUnitOfWork UWO,
                       ICheapPaymentGateway cheapPaymentGateway, IExpensivePaymentGateway expensivePaymentGateway)
 {
     _paymentStateRepository = paymentStateRepository;
     _UOW = UWO;
     _cheapPaymentGateway     = cheapPaymentGateway;
     _expensivePaymentGateway = expensivePaymentGateway;
 }
Example #8
0
 public PaymentGateway(ICheapPaymentGateway cheapPaymentGateway, IExpensivePaymentGateway expensivePaymentGateway, IPremiumPaymentGateway premiumPaymentGateway, IPaymentRepository paymentRepo, IPaymentStateRepository paymentStateRepo, IMapper mapper)
 {
     _cheapPaymentGateway     = cheapPaymentGateway;
     _expensivePaymentGateway = expensivePaymentGateway;
     _premiumPaymentGateway   = premiumPaymentGateway;
     _paymentRepo             = paymentRepo;
     _paymentStateRepo        = paymentStateRepo;
     _mapper = mapper;
 }
        //private readonly ILogger<PaymentRequestRepository> _logger;

        public PaymentRequestRepository(IPaymentRepository paymentRepository, IPaymentStateRepository paymentStateRepository,
                                        ICheapPaymentGateway cheapPaymentGateway, IExpensivePaymentGateway expensivePaymentGateway,
                                        IMapper mapper)//, ILogger<PaymentRequestRepository> logger)
        {
            _paymentRepository       = paymentRepository;
            _paymentStateRepository  = paymentStateRepository;
            _cheapPaymentGateway     = cheapPaymentGateway;
            _expensivePaymentGateway = expensivePaymentGateway;
            _mapper = mapper;
            //_logger = logger;
        }
Example #10
0
 public PaymentService(IPaymentRepository paymentRepository
                       , IPaymentStateRepository paymentStateRepository
                       , IExpensivePaymentGateway expensivePaymentGateway
                       , ICheapPaymentGateway cheapPaymentGateway
                       , IExpensivePaymentGateway premiumPaymentGateway)
 {
     this._paymentRepository       = paymentRepository;
     this._paymentStateRepository  = paymentStateRepository;
     this._expensivePaymentGateway = expensivePaymentGateway;
     this._cheapPaymentGateway     = cheapPaymentGateway;
     this._premiumPaymentGateway   = premiumPaymentGateway;
     this._retryPolicy             = Policy <PremiumPaymentService> .Handle <Exception>().Retry(3);
 }
 public PaymentController(
     IPaymentRepository paymentRepository,
     IPaymentStateRepository paymentStateRepository,
     IExpensivePaymentGateway expensivePaymentGateway,
     ICheapPaymentGateway cheapPaymentGateway,
     IMapper mapper)
 {
     _paymentRepository       = paymentRepository;
     _paymentStateRepository  = paymentStateRepository;
     _expensivePaymentGateway = expensivePaymentGateway;
     _cheapPaymentGateway     = cheapPaymentGateway;
     _mapper = mapper;
 }
Example #12
0
 public UnitOfWork(PaymentProcessorContext paymentDbContext, IPaymentRepository paymentRepository, IPaymentStateRepository state)
 {
     this._context                = paymentDbContext;
     this._paymentRepository      = paymentRepository;
     this._paymentStateRepository = state;
 }
Example #13
0
 public UnitOfWork(ApplicationDbContext context, IPaymentRepository paymentRepository, IPaymentStateRepository _paymentState)
 {
     _Dbcontext    = context;
     payments      = paymentRepository;
     paymentStates = _paymentState;
 }