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

handle PaymentMethods for PaymentSource billing info

This commit is contained in:
Kyle Spearrin
2019-08-09 15:53:01 -04:00
parent 9686b4bf2b
commit b11fd2fab8
2 changed files with 26 additions and 0 deletions

View File

@ -15,6 +15,20 @@ namespace Bit.Core.Models.Business
public class BillingSource
{
public BillingSource(PaymentMethod method)
{
if(method.Card != null)
{
Type = PaymentMethodType.Card;
Description = $"{method.Card.Brand?.ToUpperInvariant()}, *{method.Card.Last4}, " +
string.Format("{0}/{1}",
string.Concat(method.Card.ExpMonth < 10 ?
"0" : string.Empty, method.Card.ExpMonth),
method.Card.ExpYear);
CardBrand = method.Card.Brand;
}
}
public BillingSource(IPaymentSource source)
{
if(source is BankAccount bankAccount)