Skip to content

Commit 901e86a

Browse files
[PM-31780] Add exempt from billing automation toggle (#7438)
* feat(admin): add exempt from billing automation toggle for organizations * style: apply file-scoped namespaces to EF migration files * chore: rename migration to avoid sequence collision with 2026-04-10_00 * fix(sql): refresh Organization-dependent views after column addition * fix(sql): rename migration to resolve ordering conflict
1 parent 409cab3 commit 901e86a

18 files changed

Lines changed: 11498 additions & 6 deletions

src/Admin/AdminConsole/Controllers/OrganizationsController.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,7 @@ private void UpdateOrganization(Organization organization, OrganizationEditModel
591591
organization.Gateway = model.Gateway;
592592
organization.GatewayCustomerId = model.GatewayCustomerId;
593593
organization.GatewaySubscriptionId = model.GatewaySubscriptionId;
594+
organization.ExemptFromBillingAutomation = model.ExemptFromBillingAutomation;
594595
}
595596
}
596597

src/Admin/AdminConsole/Models/OrganizationEditModel.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ public OrganizationEditModel(
110110
UseDisableSmAdsForUsers = org.UseDisableSmAdsForUsers;
111111
UsePhishingBlocker = org.UsePhishingBlocker;
112112
UseMyItems = org.UseMyItems;
113+
ExemptFromBillingAutomation = org.ExemptFromBillingAutomation;
113114

114115
_plans = plans;
115116
}
@@ -205,6 +206,8 @@ public OrganizationEditModel(
205206
public bool UseAutomaticUserConfirmation { get; set; }
206207
[Display(Name = "Create My Items for organization ownership")]
207208
public bool UseMyItems { get; set; }
209+
[Display(Name = "Exempt From Billing Automation")]
210+
public bool ExemptFromBillingAutomation { get; set; }
208211
/**
209212
* Creates a Plan[] object for use in Javascript
210213
* This is mapped manually below to provide some type safety in case the plan objects change
@@ -340,6 +343,7 @@ public Organization ToOrganization(Organization existingOrganization)
340343
existingOrganization.UseDisableSmAdsForUsers = UseDisableSmAdsForUsers;
341344
existingOrganization.UsePhishingBlocker = UsePhishingBlocker;
342345
existingOrganization.UseMyItems = UseMyItems;
346+
existingOrganization.ExemptFromBillingAutomation = ExemptFromBillingAutomation;
343347
return existingOrganization;
344348
}
345349

src/Admin/AdminConsole/Views/Shared/_OrganizationForm.cshtml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,5 +338,13 @@
338338
</div>
339339
</div>
340340
</div>
341+
<div class="row">
342+
<div class="col-sm">
343+
<div class="form-check mb-3">
344+
<input type="checkbox" class="form-check-input" asp-for="ExemptFromBillingAutomation" disabled="@(!canEditBilling)">
345+
<label class="form-check-label" asp-for="ExemptFromBillingAutomation"></label>
346+
</div>
347+
</div>
348+
</div>
341349
}
342350
</form>

src/Core/AdminConsole/Entities/Organization.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,12 @@ public class Organization : ITableObject<Guid>, IStorableSubscriber, IRevisable
150150
/// </summary>
151151
public bool UseMyItems { get; set; }
152152

153+
/// <summary>
154+
/// When set to <see langword="true"/>, the organization is excluded from automated billing
155+
/// lifecycle operations such as subscription cancellation and disabling for non-payment.
156+
/// </summary>
157+
public bool ExemptFromBillingAutomation { get; set; }
158+
153159
public void SetNewId()
154160
{
155161
if (Id == default(Guid))

src/Sql/dbo/Stored Procedures/Organization_Create.sql

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ CREATE PROCEDURE [dbo].[Organization_Create]
6262
@UseAutomaticUserConfirmation BIT = 0,
6363
@UsePhishingBlocker BIT = 0,
6464
@UseDisableSmAdsForUsers BIT = 0,
65-
@UseMyItems BIT = 0
65+
@UseMyItems BIT = 0,
66+
@ExemptFromBillingAutomation BIT = 0
6667
AS
6768
BEGIN
6869
SET NOCOUNT ON
@@ -133,7 +134,8 @@ BEGIN
133134
[UsePhishingBlocker],
134135
[MaxStorageGbIncreased],
135136
[UseDisableSmAdsForUsers],
136-
[UseMyItems]
137+
[UseMyItems],
138+
[ExemptFromBillingAutomation]
137139
)
138140
VALUES
139141
(
@@ -201,6 +203,7 @@ BEGIN
201203
@UsePhishingBlocker,
202204
@MaxStorageGb,
203205
@UseDisableSmAdsForUsers,
204-
@UseMyItems
206+
@UseMyItems,
207+
@ExemptFromBillingAutomation
205208
);
206209
END

src/Sql/dbo/Stored Procedures/Organization_Update.sql

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ CREATE PROCEDURE [dbo].[Organization_Update]
6262
@UseAutomaticUserConfirmation BIT = 0,
6363
@UsePhishingBlocker BIT = 0,
6464
@UseDisableSmAdsForUsers BIT = 0,
65-
@UseMyItems BIT = 0
65+
@UseMyItems BIT = 0,
66+
@ExemptFromBillingAutomation BIT = 0
6667
AS
6768
BEGIN
6869
SET NOCOUNT ON
@@ -133,7 +134,8 @@ BEGIN
133134
[UsePhishingBlocker] = @UsePhishingBlocker,
134135
[MaxStorageGbIncreased] = @MaxStorageGb,
135136
[UseDisableSmAdsForUsers] = @UseDisableSmAdsForUsers,
136-
[UseMyItems] = @UseMyItems
137+
[UseMyItems] = @UseMyItems,
138+
[ExemptFromBillingAutomation] = @ExemptFromBillingAutomation
137139
WHERE
138140
[Id] = @Id;
139141
END

src/Sql/dbo/Tables/Organization.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ CREATE TABLE [dbo].[Organization] (
6464
[UsePhishingBlocker] BIT NOT NULL CONSTRAINT [DF_Organization_UsePhishingBlocker] DEFAULT (0),
6565
[UseDisableSmAdsForUsers] BIT NOT NULL CONSTRAINT [DF_Organization_UseDisableSmAdsForUsers] DEFAULT (0),
6666
[UseMyItems] BIT NOT NULL CONSTRAINT [DF_Organization_UseMyItems] DEFAULT (0),
67+
[ExemptFromBillingAutomation] BIT NOT NULL CONSTRAINT [DF_Organization_ExemptFromBillingAutomation] DEFAULT (0),
6768
CONSTRAINT [PK_Organization] PRIMARY KEY CLUSTERED ([Id] ASC)
6869
);
6970

src/Sql/dbo/Views/OrganizationView.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ SELECT
6464
[UseAutomaticUserConfirmation],
6565
[UsePhishingBlocker],
6666
[UseDisableSmAdsForUsers],
67-
[UseMyItems]
67+
[UseMyItems],
68+
[ExemptFromBillingAutomation]
6869
FROM
6970
[dbo].[Organization]

0 commit comments

Comments
 (0)