1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-04 01:22:50 -05:00

[PM-19566] Update MSPs to "charge_automatically" with Admin-based opt-out (#5650)

* Update provider to charge automatically with Admin Portal-based opt-out

* Design feedback

* Run dotnet format
This commit is contained in:
Alex Morask
2025-04-16 13:36:04 -04:00
committed by GitHub
parent 3d59f5522d
commit 01a08c5814
9 changed files with 163 additions and 4 deletions

View File

@ -46,6 +46,7 @@ public static class StripeConstants
public static class MetadataKeys
{
public const string InvoiceApproved = "invoice_approved";
public const string OrganizationId = "organizationId";
public const string ProviderId = "providerId";
public const string UserId = "userId";

View File

@ -27,4 +27,8 @@ public static class CustomerExtensions
{
return customer != null ? customer.Balance / 100M : default;
}
public static bool ApprovedToPayByInvoice(this Customer customer)
=> customer.Metadata.TryGetValue(StripeConstants.MetadataKeys.InvoiceApproved, out var value) &&
int.TryParse(value, out var invoiceApproved) && invoiceApproved == 1;
}