1
0
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:
Jonas Hendrickx
2025-03-07 09:52:04 +01:00
committed by GitHub
parent 6cb97d9bf9
commit c589f9a330
6 changed files with 58 additions and 1573 deletions

View File

@ -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;
}
}

View 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];
}
}