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 ActionResult Enable(Guid id, string remarks) { try { var timezoneId = _brandQueries.GetBrandOrNull(_paymentQueries.GetTransferSettings(id).BrandId).TimezoneId; _settingsCommands.Enable(id, timezoneId, remarks); return(this.Success()); } catch (Exception ex) { return(this.Failed(ex)); } }
public void Enable_transfer_settings_test() { // Arrange var transferSettings = new TransferSettings(); transferSettings.Id = new Guid("84c60b9f-16ad-49e0-bb9a-0e7670054dd5"); _paymentRepository.TransferSettings.Add(transferSettings); // Act _commands.Enable(transferSettings.Id, TestDataGenerator.GetRandomTimeZone().Id, "remark"); //Assert var settings = _paymentRepository.TransferSettings.Single(x => x.Id == transferSettings.Id); settings.Enabled.Should().BeTrue(); settings.EnabledBy.ShouldBeEquivalentTo(_securityProvider.Actor.UserName); settings.EnabledDate.Should().BeCloseTo(DateTime.Now, 5000); }