public ProcessDonationsCmd(AppConfig cfg)
 {
     _paypal   = CreatePayPalClient(cfg.PayPal);
     _db       = CreateMySqlConnection(cfg.MySql.ConnectionString);
     _payments = new PaymentStore(_db);
     _cfg      = cfg;
 }
Example #2
0
 public PaymentController(
     PaymentStore paymentStore,
     IConfiguration configuration,
     AuthenticationContext authenticationContext)
 {
     _paymentStore           = paymentStore;
     _configuration          = configuration;
     _authenticaationContext = authenticationContext;
 }
Example #3
0
        public void Add_ShouldThrowInvalidOperationException_WhenPaymentIsAlreadyAdded()
        {
            var logger       = new Mock <ILogger <PaymentStore> >();
            var paymentStore = new PaymentStore(logger.Object);

            var paymentRequest = new PaymentRequest()
            {
                CardNumber = "1234_1234_1234_1234"
            };
            var bankResponse = new BankResponse(reference: default, status: default);
        static IDbConnection CreateMySqlConnection(string connectionString)
        {
            var connection = new MySqlConnection(connectionString);

            connection.Open(); // throws if database doesn't exist which is good

            // Validate schema sort of
            if (!PaymentStore.ValidateTable(connection))
            {
                throw new DataException("Invalid schema detected for payments table");
            }

            return(connection);
        }
Example #5
0
 /// <summary>
 /// Creates an instance of the Klarna client.
 /// </summary>
 /// <param name="apiSession">Session representation object for communicating with the Klarna API</param>
 /// <param name="jsonSerializer">Instance of a class implementing the IJsonSerializer interface</param>
 public Klarna(ApiSession apiSession, IJsonSerializer jsonSerializer)
 {
     if (string.IsNullOrEmpty(apiSession.UserAgent))
     {
         apiSession.UserAgent = GetDefaultUserAgent();
     }
     Checkout           = new CheckoutStore(apiSession, jsonSerializer);
     Payment            = new PaymentStore(apiSession, jsonSerializer);
     OrderManagement    = new OrderManagementStore(apiSession, jsonSerializer);
     Settlement         = new SettlementStore(apiSession, jsonSerializer);
     CustomerToken      = new CustomerTokenStore(apiSession, jsonSerializer);
     HostedPaymentPage  = new HostedPaymentPageStore(apiSession, jsonSerializer);
     VirtualCardService = new VirtualCardServiceStore(apiSession, jsonSerializer);
     ApiSession         = apiSession;
 }
Example #6
0
 public OrderController(ProductStore productStore, PaymentStore paymentStore)
 {
     _productStore = productStore;
     _paymentStore = paymentStore;
 }