Skip to content

Commit cdbe027

Browse files
Provide plans to OrganizationEditModel for resellers (#5493)
1 parent d5fb374 commit cdbe027

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/Admin/AdminConsole/Controllers/ProvidersController.cs

+8-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
using Bit.Core.Billing.Entities;
1212
using Bit.Core.Billing.Enums;
1313
using Bit.Core.Billing.Extensions;
14+
using Bit.Core.Billing.Pricing;
1415
using Bit.Core.Billing.Repositories;
1516
using Bit.Core.Billing.Services;
1617
using Bit.Core.Billing.Services.Contracts;
@@ -42,6 +43,7 @@ public class ProvidersController : Controller
4243
private readonly IFeatureService _featureService;
4344
private readonly IProviderPlanRepository _providerPlanRepository;
4445
private readonly IProviderBillingService _providerBillingService;
46+
private readonly IPricingClient _pricingClient;
4547
private readonly string _stripeUrl;
4648
private readonly string _braintreeMerchantUrl;
4749
private readonly string _braintreeMerchantId;
@@ -60,7 +62,8 @@ public ProvidersController(
6062
IFeatureService featureService,
6163
IProviderPlanRepository providerPlanRepository,
6264
IProviderBillingService providerBillingService,
63-
IWebHostEnvironment webHostEnvironment)
65+
IWebHostEnvironment webHostEnvironment,
66+
IPricingClient pricingClient)
6467
{
6568
_organizationRepository = organizationRepository;
6669
_organizationService = organizationService;
@@ -75,6 +78,7 @@ public ProvidersController(
7578
_featureService = featureService;
7679
_providerPlanRepository = providerPlanRepository;
7780
_providerBillingService = providerBillingService;
81+
_pricingClient = pricingClient;
7882
_stripeUrl = webHostEnvironment.GetStripeUrl();
7983
_braintreeMerchantUrl = webHostEnvironment.GetBraintreeMerchantUrl();
8084
_braintreeMerchantId = globalSettings.Braintree.MerchantId;
@@ -415,7 +419,9 @@ public async Task<IActionResult> CreateOrganization(Guid providerId)
415419
return RedirectToAction("Index");
416420
}
417421

418-
return View(new OrganizationEditModel(provider));
422+
var plans = await _pricingClient.ListPlans();
423+
424+
return View(new OrganizationEditModel(provider, plans));
419425
}
420426

421427
[HttpPost]

src/Admin/AdminConsole/Models/OrganizationEditModel.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,14 @@ public class OrganizationEditModel : OrganizationViewModel
2222

2323
public OrganizationEditModel() { }
2424

25-
public OrganizationEditModel(Provider provider)
25+
public OrganizationEditModel(Provider provider, List<Plan> plans)
2626
{
2727
Provider = provider;
2828
BillingEmail = provider.Type == ProviderType.Reseller ? provider.BillingEmail : string.Empty;
2929
PlanType = Core.Billing.Enums.PlanType.TeamsMonthly;
3030
Plan = Core.Billing.Enums.PlanType.TeamsMonthly.GetDisplayAttribute()?.GetName();
3131
LicenseKey = RandomLicenseKey;
32+
_plans = plans;
3233
}
3334

3435
public OrganizationEditModel(

0 commit comments

Comments
 (0)