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

upcoming invoice info

This commit is contained in:
Kyle Spearrin
2017-04-10 11:30:36 -04:00
parent 265b3285a6
commit f8baf3abb3
3 changed files with 33 additions and 4 deletions

View File

@ -46,6 +46,7 @@ namespace Bit.Core.Services
var customerService = new StripeCustomerService();
var subscriptionService = new StripeSubscriptionService();
var chargeService = new StripeChargeService();
var invoiceService = new StripeInvoiceService();
if(!string.IsNullOrWhiteSpace(organization.StripeCustomerId))
{
@ -72,6 +73,19 @@ namespace Bit.Core.Services
Limit = 20
});
orgBilling.Charges = charges.OrderByDescending(c => c.Created);
if(!string.IsNullOrWhiteSpace(organization.StripeSubscriptionId))
{
try
{
var upcomingInvoice = await invoiceService.UpcomingAsync(organization.StripeCustomerId);
if(upcomingInvoice != null)
{
orgBilling.UpcomingInvoice = upcomingInvoice;
}
}
catch(StripeException) { }
}
}
}