mirror of
https://github.com/bitwarden/server.git
synced 2025-07-04 17:42:49 -05:00
handle PaymentMethods for PaymentSource billing info
This commit is contained in:
@ -1216,6 +1216,18 @@ namespace Bit.Core.Services
|
||||
}
|
||||
}
|
||||
}
|
||||
if(billingInfo.PaymentSource == null)
|
||||
{
|
||||
var paymentMethodService = new PaymentMethodService();
|
||||
var paymentMethods = paymentMethodService.ListAutoPaging(
|
||||
new PaymentMethodListOptions { CustomerId = customer.Id, Type = "card" });
|
||||
var paymentMethod = paymentMethods.Where(m => m.Card != null)
|
||||
.OrderByDescending(m => m.Created).FirstOrDefault();
|
||||
if(paymentMethod != null)
|
||||
{
|
||||
billingInfo.PaymentSource = new BillingInfo.BillingSource(paymentMethod);
|
||||
}
|
||||
}
|
||||
|
||||
var invoices = await invoiceService.ListAsync(new InvoiceListOptions
|
||||
{
|
||||
|
Reference in New Issue
Block a user