public async Task <Template> CreateFirstDepositTemplateAsync(string brandName, IssuanceMode mode = IssuanceMode.Automatic) { var brand = _brandQueries.GetBrands().Single(b => b.Name == brandName); var model = new CreateUpdateTemplate { Id = Guid.Empty, Info = new CreateUpdateTemplateInfo { Name = TestDataGenerator.GetRandomString(), TemplateType = BonusType.FirstDeposit, BrandId = brand.Id, WalletTemplateId = brand.WalletTemplates.First().Id, Mode = mode } }; var response = await _bonusApiProxy.CreateUpdateBonusTemplateAsync(model); if (response.Success == false) { throw new Exception(response.Errors.First().ErrorMessage); } model = new CreateUpdateTemplate { Id = response.Id.Value, Version = response.Version.Value, Availability = new CreateUpdateTemplateAvailability(), Rules = new CreateUpdateTemplateRules { RewardTiers = new List <CreateUpdateRewardTier> { new CreateUpdateRewardTier { CurrencyCode = "CAD", BonusTiers = new List <CreateUpdateTemplateTier> { new CreateUpdateTemplateTier { Reward = 27 } } } } }, Wagering = new CreateUpdateTemplateWagering(), Notification = new CreateUpdateTemplateNotification() }; response = await _bonusApiProxy.CreateUpdateBonusTemplateAsync(model); if (response.Success == false) { throw new Exception(response.Errors.First().ErrorMessage); } return(await _bonusApiProxy.GetTemplateOrNull(response.Id.Value)); }
public async Task <AddEditTemplateResponse> CreateEdit(CreateUpdateTemplate model) { VerifyPermission(Permissions.Create, Modules.BonusTemplateManager); VerifyPermission(Permissions.Update, Modules.BonusTemplateManager); var brandId = model.Id == Guid.Empty ? model.Info.BrandId : (await _bonusApiProxy.GetTemplateOrNull(model.Id)).Info.BrandId; CheckBrand(brandId.Value); return(await _bonusApiProxy.CreateUpdateBonusTemplateAsync(model)); }