public ProcessDonationsCmd(AppConfig cfg) { _paypal = CreatePayPalClient(cfg.PayPal); _db = CreateMySqlConnection(cfg.MySql.ConnectionString); _payments = new PaymentStore(_db); _cfg = cfg; }
public PaymentController( PaymentStore paymentStore, IConfiguration configuration, AuthenticationContext authenticationContext) { _paymentStore = paymentStore; _configuration = configuration; _authenticaationContext = authenticationContext; }
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); }
/// <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; }
public OrderController(ProductStore productStore, PaymentStore paymentStore) { _productStore = productStore; _paymentStore = paymentStore; }