public void when_paymentsettings_updated_successfully() { var key = Guid.NewGuid().ToString(); var newSettings = new ServerPaymentSettings { PaymentMode = PaymentMethod.Cmt, BraintreeClientSettings = { ClientKey = key } }; _sut.When(new UpdatePaymentSettings { ServerPaymentSettings = newSettings }); var evt = _sut.ThenHasSingle <PaymentSettingUpdated>(); _sut.ThenHasNo <PaymentModeChanged>(); //dont delete cc if payment mode doesnt change Assert.AreEqual(_companyId, evt.SourceId); Assert.AreEqual(key, evt.ServerPaymentSettings.BraintreeClientSettings.ClientKey); Assert.AreSame(newSettings, evt.ServerPaymentSettings); }
private static KeyValuePair <string, string> ExtractPropertyValue(ServerPaymentSettings paymentSettings, string propertyName) { var settingValue = paymentSettings.GetNestedPropertyValue(propertyName); var settingStringValue = settingValue.SelectOrDefault(value => value.ToString(), string.Empty); settingStringValue = settingStringValue.IsBool() ? settingStringValue.ToLowerInvariant() : settingStringValue; return(new KeyValuePair <string, string>(propertyName, settingStringValue)); }
public void SetPaymentSettings(string companyKey, ServerPaymentSettings settings) { companyKey = companyKey ?? string.Empty; if (_serverPaymentSettings.ContainsKey(companyKey)) { _serverPaymentSettings[companyKey] = settings; } else { _serverPaymentSettings.Add(companyKey, settings); } }
public CmtPaymentService(ICommandBus commandBus, IOrderDao orderDao, ILogger logger, IAccountDao accountDao, IOrderPaymentDao paymentDao, ServerPaymentSettings serverPaymentSettings, IPairingService pairingService, ICreditCardDao creditCardDao) { _commandBus = commandBus; _orderDao = orderDao; _logger = logger; _accountDao = accountDao; _paymentDao = paymentDao; _serverPaymentSettings = serverPaymentSettings; _pairingService = pairingService; _creditCardDao = creditCardDao; }
public void when_paymentmode_changed() { var newSettings = new ServerPaymentSettings { PaymentMode = PaymentMethod.Braintree }; _sut.When(new UpdatePaymentSettings { ServerPaymentSettings = newSettings }); Assert.AreEqual(2, _sut.Events.Count); var evt = _sut.ThenHasOne <PaymentSettingUpdated>(); var evt2 = _sut.ThenHasOne <PaymentModeChanged>(); Assert.AreEqual(_companyId, evt2.SourceId); }
public MonerisPaymentService(ICommandBus commandBus, ILogger logger, IOrderPaymentDao paymentDao, IServerSettings serverSettings, ServerPaymentSettings serverPaymentSettings, IPairingService pairingService, ICreditCardDao creditCardDao, IOrderDao orderDao) { _commandBus = commandBus; _logger = logger; _paymentDao = paymentDao; _serverSettings = serverSettings; _serverPaymentSettings = serverPaymentSettings; _pairingService = pairingService; _creditCardDao = creditCardDao; _orderDao = orderDao; MonerisHttpRequestWrapper.SetLogger(_logger); }
public BraintreePaymentService(ICommandBus commandBus, ILogger logger, IOrderPaymentDao paymentDao, IOrderDao orderDao, IServerSettings serverSettings, ServerPaymentSettings serverPaymentSettings, IPairingService pairingService, ICreditCardDao creditCardDao) { _commandBus = commandBus; _logger = logger; _paymentDao = paymentDao; _orderDao = orderDao; _serverSettings = serverSettings; _pairingService = pairingService; _creditCardDao = creditCardDao; BraintreeGateway = GetBraintreeGateway(serverPaymentSettings.BraintreeServerSettings); }
public void when_paymentmode_changed_from_cmt_to_ridelinq() { var newSettings = new ServerPaymentSettings { PaymentMode = PaymentMethod.RideLinqCmt }; _sut.When(new UpdatePaymentSettings { ServerPaymentSettings = newSettings }); Assert.AreEqual(1, _sut.Events.Count); var evt = _sut.ThenHasOne <PaymentSettingUpdated>(); _sut.ThenHasNo <PaymentModeChanged>(); Assert.AreEqual(_companyId, evt.SourceId); }
public PayPalService(IServerSettings serverSettings, ServerPaymentSettings serverPaymentSettings, ICommandBus commandBus, IAccountDao accountDao, IOrderDao orderDao, ILogger logger, IPairingService pairingService, IOrderPaymentDao paymentDao) : base(serverPaymentSettings, accountDao) { _serverSettings = serverSettings; _serverPaymentSettings = serverPaymentSettings; _commandBus = commandBus; _accountDao = accountDao; _orderDao = orderDao; _logger = logger; _pairingService = pairingService; _paymentDao = paymentDao; _resources = new Resources.Resources(serverSettings); }
private bool HavePayPalSettingsChanged(ServerPaymentSettings newPaymentSettings) { if (PayPalClientSettings == null || PayPalServerSettings == null) { return(true); } var disabledStatusChanged = PayPalClientSettings.IsEnabled != newPaymentSettings.PayPalClientSettings.IsEnabled; var webLandingPageChanged = PayPalServerSettings.LandingPageType != newPaymentSettings.PayPalServerSettings.LandingPageType; var environmentChanged = PayPalClientSettings.IsSandbox != newPaymentSettings.PayPalClientSettings.IsSandbox; var sandboxSettingsChanged = PayPalClientSettings.SandboxCredentials.ClientId != newPaymentSettings.PayPalClientSettings.SandboxCredentials.ClientId || PayPalServerSettings.SandboxCredentials.Secret != newPaymentSettings.PayPalServerSettings.SandboxCredentials.Secret; var prodSettingsChanged = PayPalClientSettings.Credentials.ClientId != newPaymentSettings.PayPalClientSettings.Credentials.ClientId || PayPalServerSettings.Credentials.Secret != newPaymentSettings.PayPalServerSettings.Credentials.Secret; return(disabledStatusChanged || webLandingPageChanged || environmentChanged || sandboxSettingsChanged || prodSettingsChanged); }
private void SaveConfigurationChanges(ServerPaymentSettings newSettings, ServerPaymentSettings oldSettings) { var oldSettingsDictionary = oldSettings.GetType().GetAllProperties() .ToDictionary(s => s.Key, s => oldSettings.GetNestedPropertyValue(s.Key).ToNullSafeString()); var newSettingsDictionary = newSettings.GetType().GetAllProperties() .ToDictionary(s => s.Key, s => newSettings.GetNestedPropertyValue(s.Key).ToNullSafeString()); var oldValues = new Dictionary <string, string>(); var newValues = new Dictionary <string, string>(); foreach (var oldSetting in oldSettingsDictionary) { if (newSettingsDictionary.ContainsKey(oldSetting.Key)) { var newValue = newSettingsDictionary[oldSetting.Key]; if (oldSetting.Value != newValue) { //Special case for Amounts if not formatted the same way double oldAmount; double newAmount; double.TryParse(oldSetting.Value, out oldAmount); double.TryParse(newValue, out newAmount); if ((oldAmount == 0 && newAmount == 0) || Math.Abs(oldAmount - newAmount) > 0) { oldValues.Add(oldSetting.Key, oldSetting.Value); newValues.Add(oldSetting.Key, newSettingsDictionary[oldSetting.Key]); } } } } var authSession = this.GetSession(); _configurationChangeService.Add(oldValues, newValues, ConfigurationChangeType.PaymentSetttings, new Guid(authSession.UserAuthId), authSession.UserAuthName); }
public BasePayPalService(ServerPaymentSettings serverPaymentSettings, IAccountDao accountDao) { _serverPaymentSettings = serverPaymentSettings; _accountDao = accountDao; }
private bool ChargeAccountPaymentEnabledChanged(ServerPaymentSettings newPaymentSettings) { return(newPaymentSettings.IsChargeAccountPaymentEnabled != IsChargeAccountEnabled); }