Beispiel #1
0
 //protected static readonly string paymentCookie = "_pc";
 //public static string CookieName
 //{
 //    get { return paymentCookie; }
 //}
 public PaymentManager(PaymentManagerConfig config, IPaymentProviderFactory providerFactory, IDbHelper db, ILogger logger)
 {
     _providerFactory = providerFactory;
     _db    = db;
     Config = config;
     Logger = logger;
 }
Beispiel #2
0
 public OrderDetailsViewModelFactory(
     ILocalizationProvider localizationProvider,
     IViewModelMapper viewModelMapper,
     ICountryService countryService,
     IProductUrlProvider productUrlProvider,
     ICartViewModelFactory cartViewModelFactory,
     IPaymentProviderFactory paymentProviderFactory,
     IShippingTrackingProviderFactory shippingTrackingProviderFactory,
     ITaxViewModelFactory taxViewModelFactory,
     ILineItemViewModelFactory lineItemViewModelFactory,
     IRewardViewModelFactory rewardViewModelFactory,
     ICurrencyProvider currencyProvider)
 {
     LocalizationProvider            = localizationProvider ?? throw new ArgumentNullException(nameof(localizationProvider));
     ViewModelMapper                 = viewModelMapper ?? throw new ArgumentNullException(nameof(viewModelMapper));
     CountryService                  = countryService ?? throw new ArgumentNullException(nameof(countryService));
     ProductUrlProvider              = productUrlProvider ?? throw new ArgumentNullException(nameof(productUrlProvider));
     CartViewModelFactory            = cartViewModelFactory ?? throw new ArgumentNullException(nameof(cartViewModelFactory));
     PaymentProviderFactory          = paymentProviderFactory ?? throw new ArgumentNullException(nameof(paymentProviderFactory));
     ShippingTrackingProviderFactory = shippingTrackingProviderFactory ?? throw new ArgumentNullException(nameof(shippingTrackingProviderFactory));
     TaxViewModelFactory             = taxViewModelFactory ?? throw new ArgumentNullException(nameof(taxViewModelFactory));
     LineItemViewModelFactory        = lineItemViewModelFactory ?? throw new ArgumentNullException(nameof(lineItemViewModelFactory));
     RewardViewModelFactory          = rewardViewModelFactory ?? throw new ArgumentNullException(nameof(rewardViewModelFactory));
     CurrencyProvider                = currencyProvider ?? throw new ArgumentNullException(nameof(currencyProvider));
 }
 public VaultProfileViewService(IVaultProfileRepository vaultProfileRepository, IViewModelMapper viewModelMapper,
                                IPaymentProviderFactory paymentProviderFactory)
 {
     VaultProfileRepository = vaultProfileRepository ?? throw new ArgumentNullException(nameof(vaultProfileRepository));
     ViewModelMapper        = viewModelMapper ?? throw new ArgumentNullException(nameof(viewModelMapper));
     PaymentProviderFactory = paymentProviderFactory ?? throw new ArgumentNullException(nameof(paymentProviderFactory));
 }
Beispiel #4
0
        public PaymentServiceMakePaymentTests()
        {
            _input = new Payment
            {
                Amount      = 120.49m,
                CardNumber  = "1234-1234-1234-1234",
                Currency    = Currency.GBP,
                CVV         = 333,
                ExpiryYear  = DateTime.Now.Year + 1,
                ExpiryMonth = DateTime.Now.Month + 1
            };

            _paymentProcessResults = new PaymentProcessResults
            {
                Success = true,
                TranscactionIdentifier = "111111111111111",
            };

            _paymentRepository      = Substitute.For <IPaymentRepository>();
            _paymentProvider        = Substitute.For <IPaymentProvider>();
            _paymentProviderFactory = Substitute.For <IPaymentProviderFactory>();

            _paymentRepository.Create(Arg.Do <Payment>(p => _persistedPayment = p));
            _paymentProvider.ProcessPayment(Arg.Any <Payment>()).Returns(_paymentProcessResults);
            _paymentProviderFactory.Create(Arg.Any <string>()).Returns(_paymentProvider);

            _target = new PaymentService(_paymentRepository, new BusinessRulesValidator(), _paymentProviderFactory);
        }
 public PaymentService(IPaymentRepository paymentRepository,
                       IBusinessRulesValidator businessRulesValidator,
                       IPaymentProviderFactory paymentProviderFactory)
 {
     _paymentProviderFactory = paymentProviderFactory;
     _businessRulesValidator = businessRulesValidator;
     _paymentRepository      = paymentRepository;
 }
Beispiel #6
0
 public PaymentController(IHtmlHelper htmlHelper,
                          IPaymentProviderFactory paymentProviderFactory,
                          ICreditCardResolver creditCardResolver)
 {
     _htmlHelper             = htmlHelper;
     _paymentProviderFactory = paymentProviderFactory;
     _creditCardResolver     = creditCardResolver;
 }
Beispiel #7
0
 public PaymentController(IBankService bankService,
                          IPaymentService paymentService,
                          IHtmlHelper htmlHelper,
                          IPaymentProviderFactory paymentProviderFactory)
 {
     _bankService            = bankService;
     _paymentService         = paymentService;
     _htmlHelper             = htmlHelper;
     _paymentProviderFactory = paymentProviderFactory;
 }
Beispiel #8
0
 public WebhookService(IOrderRepository orderRepository, IDeliveryRepository deliveryRepository, IInvoiceRepository invoiceRepository, ISaleRepository saleRepository, ISaleDetailRepository saleDetailRepository, IProductRepository productRepository, IPaymentProviderFactory paymentProviderFactory)
 {
     _orderRepository        = orderRepository ?? throw new ArgumentNullException(nameof(orderRepository));
     _deliveryRepository     = deliveryRepository ?? throw new ArgumentNullException(nameof(deliveryRepository));
     _invoiceRepository      = invoiceRepository ?? throw new ArgumentNullException(nameof(invoiceRepository));
     _saleRepository         = saleRepository ?? throw new ArgumentNullException(nameof(saleRepository));
     _saleDetailRepository   = saleDetailRepository ?? throw new ArgumentNullException(nameof(saleDetailRepository));
     _productRepository      = productRepository ?? throw new ArgumentNullException(nameof(productRepository));
     _paymentProviderFactory = paymentProviderFactory ?? throw new ArgumentNullException(nameof(paymentProviderFactory));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Spectrum.Content.BaseController" /> class.
 /// </summary>
 /// <param name="loggingService">The logging service.</param>
 /// <param name="braintreeManager">The braintree manager.</param>
 /// <param name="rulesEngineService">The rules engine service.</param>
 /// <param name="paymentProviderFactory">The payment provider factory.</param>
 /// <inheritdoc />
 public BraintreeController(
     ILoggingService loggingService,
     IBraintreeManager braintreeManager,
     IRulesEngineService rulesEngineService,
     IPaymentProviderFactory paymentProviderFactory)
     : base(loggingService)
 {
     this.braintreeManager       = braintreeManager;
     this.rulesEngineService     = rulesEngineService;
     this.paymentProviderFactory = paymentProviderFactory;
 }
Beispiel #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Spectrum.Content.Payments.Controllers.PaymentController" /> class.
 /// </summary>
 /// <param name="loggingService">The logging service.</param>
 /// <param name="paymentManager">The payment manager.</param>
 /// <param name="rulesEngineService">The rules engine service.</param>
 /// <param name="paymentProviderFactory">The payment provider factory.</param>
 /// <inheritdoc />
 public PaymentController(
     ILoggingService loggingService,
     IPaymentManager paymentManager,
     IRulesEngineService rulesEngineService,
     IPaymentProviderFactory paymentProviderFactory)
     : base(loggingService)
 {
     this.paymentManager         = paymentManager;
     this.rulesEngineService     = rulesEngineService;
     this.paymentProviderFactory = paymentProviderFactory;
 }
Beispiel #11
0
 public DonateController(ICampaignRepository campaignRepository, IUserProfileRepository userProfileRepository, 
     IDonateMailer donateMailer, IPaymentProviderFactory paymentProviderFactory, ICampaignDonorRepository campaignDonorRepository)
 {
     this.campaignRepository = campaignRepository;
     this.userProfileRepository = userProfileRepository;
     this.donateMailer = donateMailer;
     this.paymentProviderFactory = paymentProviderFactory;
     this.campaignDonorRepository = campaignDonorRepository;
     Mapper.CreateMap<UserProfile, Payment>();
     Mapper.CreateMap<Payment, CampaignDonor>();
     Mapper.CreateMap<CampaignDonor, DonationDetailsModel>();
     Mapper.CreateMap<Campaign, CampaignDetailsModel>();
     Mapper.CreateMap<CampaignDonor, DonationDetailsModel>();
 }
Beispiel #12
0
 public SaleService(ISaleValidator saleValidator, ISaleRepository saleRepository, ICustomerRepository customerRepository, IAddressRepository addressRepository, IOrderRepository orderRepository, ISaleDetailRepository saleDetailRepository, IInvoiceRepository invoiceRepository, IProductRepository productRepository, IDeliveryRepository deliveryRepository, ICouponCodeRepository couponCodeRepository, IPaymentProviderFactory paymentProviderFactory)
 {
     _saleValidator          = saleValidator ?? throw new ArgumentNullException(nameof(saleValidator));
     _saleRepository         = saleRepository ?? throw new ArgumentNullException(nameof(saleRepository));
     _customerRepository     = customerRepository ?? throw new ArgumentNullException(nameof(customerRepository));
     _addressRepository      = addressRepository ?? throw new ArgumentNullException(nameof(addressRepository));
     _orderRepository        = orderRepository ?? throw new ArgumentNullException(nameof(orderRepository));
     _saleDetailRepository   = saleDetailRepository ?? throw new ArgumentNullException(nameof(saleDetailRepository));
     _invoiceRepository      = invoiceRepository ?? throw new ArgumentNullException(nameof(invoiceRepository));
     _productRepository      = productRepository ?? throw new ArgumentNullException(nameof(productRepository));
     _deliveryRepository     = deliveryRepository ?? throw new ArgumentNullException(nameof(deliveryRepository));
     _couponCodeRepository   = couponCodeRepository ?? throw new ArgumentNullException(nameof(couponCodeRepository));
     _paymentProviderFactory = paymentProviderFactory ?? throw new ArgumentNullException(nameof(paymentProviderFactory));
 }
Beispiel #13
0
        public VaultProfileViewService(IVaultProfileRepository vaultProfileRepository, IViewModelMapper viewModelMapper,
                                       IPaymentProviderFactory paymentProviderFactory)
        {
            if (vaultProfileRepository == null)
            {
                throw new ArgumentNullException("vaultProfileRepository");
            }
            if (viewModelMapper == null)
            {
                throw new ArgumentNullException("viewModelMapper");
            }
            if (paymentProviderFactory == null)
            {
                throw new ArgumentNullException("paymentProviderFactory");
            }

            VaultProfileRepository = vaultProfileRepository;
            ViewModelMapper        = viewModelMapper;
            PaymentProviderFactory = paymentProviderFactory;
        }
        public OrderDetailsViewModelFactory(
            ILocalizationProvider localizationProvider,
            IViewModelMapper viewModelMapper,
            ICountryService countryService,
            IProductUrlProvider productUrlProvider,
            ICartViewModelFactory cartViewModelFactory,
            IPaymentProviderFactory paymentProviderFactory,
            IShippingTrackingProviderFactory shippingTrackingProviderFactory,
            ITaxViewModelFactory taxViewModelFactory,
            ILineItemViewModelFactory lineItemViewModelFactory,
            IRewardViewModelFactory rewardViewModelFactory)
        {
            if (localizationProvider == null)
            {
                throw new ArgumentNullException("localizationProvider");
            }
            if (viewModelMapper == null)
            {
                throw new ArgumentNullException("viewModelMapper");
            }
            if (productUrlProvider == null)
            {
                throw new ArgumentNullException("productUrlProvider");
            }
            if (cartViewModelFactory == null)
            {
                throw new ArgumentNullException("cartViewModelFactory");
            }
            if (countryService == null)
            {
                throw new ArgumentNullException("countryService");
            }
            if (paymentProviderFactory == null)
            {
                throw new ArgumentNullException("paymentProviderFactory");
            }
            if (shippingTrackingProviderFactory == null)
            {
                throw new ArgumentNullException("shippingTrackingProviderFactory");
            }
            if (taxViewModelFactory == null)
            {
                throw new ArgumentNullException("taxViewModelFactory");
            }
            if (lineItemViewModelFactory == null)
            {
                throw new ArgumentNullException("lineItemViewModelFactory");
            }
            if (rewardViewModelFactory == null)
            {
                throw new ArgumentNullException("rewardViewModelFactory");
            }

            LocalizationProvider            = localizationProvider;
            ViewModelMapper                 = viewModelMapper;
            CountryService                  = countryService;
            ProductUrlProvider              = productUrlProvider;
            CartViewModelFactory            = cartViewModelFactory;
            PaymentProviderFactory          = paymentProviderFactory;
            ShippingTrackingProviderFactory = shippingTrackingProviderFactory;
            TaxViewModelFactory             = taxViewModelFactory;
            LineItemViewModelFactory        = lineItemViewModelFactory;
            RewardViewModelFactory          = rewardViewModelFactory;
        }
Beispiel #15
0
 public PaymentController(IHtmlHelper htmlHelper,
                          IPaymentProviderFactory paymentProviderFactory)
 {
     _htmlHelper             = htmlHelper;
     _paymentProviderFactory = paymentProviderFactory;
 }
Beispiel #16
0
 public PaymentViewService(IPaymentRepository paymentRepository, ICartViewModelFactory cartViewModelFactory, ICartRepository cartRepository,
                           ILookupService lookupService, IViewModelMapper viewModelMapper, IPaymentProviderFactory paymentProviderFactory,
                           IRecurringOrderTemplatesViewService recurringOrderTemplatesViewService,
                           IRecurringOrderCartsViewService recurringOrderCartsViewService,
                           IRecurringOrdersSettings recurringOrdersSettings
                           )
 {
     PaymentRepository                  = paymentRepository ?? throw new ArgumentNullException(nameof(paymentRepository));
     CartViewModelFactory               = cartViewModelFactory ?? throw new ArgumentNullException(nameof(cartViewModelFactory));
     CartRepository                     = cartRepository ?? throw new ArgumentNullException(nameof(cartRepository));
     LookupService                      = lookupService ?? throw new ArgumentNullException(nameof(lookupService));
     ViewModelMapper                    = viewModelMapper ?? throw new ArgumentNullException(nameof(viewModelMapper));
     PaymentProviderFactory             = paymentProviderFactory ?? throw new ArgumentNullException(nameof(paymentProviderFactory));
     RecurringOrderTemplatesViewService = recurringOrderTemplatesViewService ?? throw new ArgumentNullException(nameof(recurringOrderTemplatesViewService));
     RecurringOrderCartsViewService     = recurringOrderCartsViewService ?? throw new ArgumentNullException(nameof(recurringOrderCartsViewService));
     RecurringOrdersSettings            = recurringOrdersSettings;
 }
        private void SetUpController()
        {
            var mailer = mocks.DynamicMock<IDonateMailer>();
            MailerBase.IsTestModeEnabled = true;
            paymentProviderFactory = mocks.DynamicMock<IPaymentProviderFactory>();

            controller = new DonateController(campaignRepository, userProfileRepository, mailer, paymentProviderFactory, campaignDonorRepository)
                             {
                                 OrganizationRepository = organizationRepository
                             };

            TestHelpers.MockBasicRequest(controller);
        }
Beispiel #18
0
 public PaymentAggregate(PaymentId id, IPaymentProviderFactory paymentProviderFactory) : base(id,
                                                                                              SnapshotEveryFewVersionsStrategy.With(SnapshotEveryVersion))
 {
     _paymentProviderFactory = paymentProviderFactory;
     Register(_paymentState);
 }