public void CreateTransferSettings( Core.Brand.Interface.Data.Brand brand, SaveTransferSettingsCommand saveTransferSettingsCommand, Guid walletTemplateId, TransferFundType transferType = TransferFundType.FundIn ) { var transferSettings = new SaveTransferSettingsCommand { Brand = brand.Id, Licensee = brand.Licensee.Id, TimezoneId = brand.TimezoneId, TransferType = TransferFundType.FundIn, Currency = brand.DefaultCurrency, //VipLevel = brand.VipLevels.Single().Code, VipLevel = brand.VipLevels.Single().Id, Wallet = walletTemplateId.ToString(), MinAmountPerTransaction = saveTransferSettingsCommand.MinAmountPerTransaction, MaxAmountPerTransaction = saveTransferSettingsCommand.MaxAmountPerTransaction, MaxAmountPerDay = saveTransferSettingsCommand.MaxAmountPerDay, MaxTransactionPerDay = saveTransferSettingsCommand.MaxTransactionPerDay, MaxTransactionPerWeek = saveTransferSettingsCommand.MaxTransactionPerWeek, MaxTransactionPerMonth = saveTransferSettingsCommand.MaxTransactionPerMonth }; var transferSettingsId = _transferSettingsCommands.AddSettings(transferSettings); _transferSettingsCommands.Enable(transferSettingsId, brand.TimezoneId, "remark"); }
public void Cannot_execute_Commands_without_permissions() { // Arrange LogWithNewAdmin(Modules.TransferSettings, Permissions.View); // Act Assert.Throws <InsufficientPermissionsException>(() => _transferSettingsCommands.AddSettings(new SaveTransferSettingsCommand())); Assert.Throws <InsufficientPermissionsException>(() => _transferSettingsCommands.UpdateSettings(new SaveTransferSettingsCommand())); Assert.Throws <InsufficientPermissionsException>(() => _transferSettingsCommands.Enable(new Guid(), "", "12345")); Assert.Throws <InsufficientPermissionsException>(() => _transferSettingsCommands.Disable(new Guid(), "", "12345")); }
public string Save(SaveTransferSettingsCommand model) { model.TimezoneId = _brandQueries.GetBrandOrNull(model.Brand).TimezoneId; try { string message; Guid transferSettingsId = model.Id; if (model.Id == Guid.Empty) { transferSettingsId = _settingsCommands.AddSettings(model); message = "CreatedSuccessfully"; } else { _settingsCommands.UpdateSettings(model); message = "UpdatedSuccessfully"; } return(SerializeJson(new { Result = "success", Data = message, Id = transferSettingsId })); } catch (RegoException regoEx) { return(SerializeJson(new { Result = "failed", Data = regoEx.Message })); } catch (ValidationError e) { return(SerializeJson(new { Result = "failed", Data = e.ErrorMessage })); } }
public void Should_throw_exception_if_try_to_add_same_settings() { // Arrange var timeZoneId = TestDataGenerator.GetRandomTimeZone().Id; var savePaymentSettingsCommand1 = new SaveTransferSettingsCommand(); //required field savePaymentSettingsCommand1.TimezoneId = timeZoneId; _commands.AddSettings(savePaymentSettingsCommand1); var savePaymentSettingsCommand2 = new SaveTransferSettingsCommand(); //required field savePaymentSettingsCommand1.TimezoneId = timeZoneId; // Act Action action = () => _commands.AddSettings(savePaymentSettingsCommand2); //Assert action.ShouldThrow <RegoException>().WithMessage("AlreadyExistsError"); }
public void Should_throw_exception_if_negative_values_in_MinAmountPerTransaction() { // Arrange var saveSettingsCommand = new SaveTransferSettingsCommand(); saveSettingsCommand.MinAmountPerTransaction = -1; saveSettingsCommand.TimezoneId = TestDataGenerator.GetRandomTimeZone().Id; // Act Action action = () => _commands.AddSettings(saveSettingsCommand); //Assert action.ShouldThrow <RegoException>().WithMessage("MinAmountPerTransactionError"); }