mirror of
https://github.com/bitwarden/server.git
synced 2025-07-07 02:52:50 -05:00
[BEEEP] [PM-18518] Cleanup StripePaymentService (#5435)
This commit is contained in:
@ -22,4 +22,9 @@ public static class CustomerExtensions
|
||||
/// <returns></returns>
|
||||
public static bool HasTaxLocationVerified(this Customer customer) =>
|
||||
customer?.Tax?.AutomaticTax == StripeConstants.AutomaticTaxStatus.Supported;
|
||||
|
||||
public static decimal GetBillingBalance(this Customer customer)
|
||||
{
|
||||
return customer != null ? customer.Balance / 100M : default;
|
||||
}
|
||||
}
|
||||
|
26
src/Core/Billing/Extensions/SubscriberExtensions.cs
Normal file
26
src/Core/Billing/Extensions/SubscriberExtensions.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using Bit.Core.Entities;
|
||||
|
||||
namespace Bit.Core.Billing.Extensions;
|
||||
|
||||
public static class SubscriberExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// We are taking only first 30 characters of the SubscriberName because stripe provide for 30 characters for
|
||||
/// custom_fields,see the link: https://stripe.com/docs/api/invoices/create
|
||||
/// </summary>
|
||||
/// <param name="subscriber"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetFormattedInvoiceName(this ISubscriber subscriber)
|
||||
{
|
||||
var subscriberName = subscriber.SubscriberName();
|
||||
|
||||
if (string.IsNullOrWhiteSpace(subscriberName))
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
return subscriberName.Length <= 30
|
||||
? subscriberName
|
||||
: subscriberName[..30];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user