1
0
mirror of https://github.com/bitwarden/server synced 2025-12-15 07:43:54 +00:00

apis for subscription vs billing

This commit is contained in:
Kyle Spearrin
2019-02-18 15:40:47 -05:00
parent 5945c39b32
commit b036657d78
14 changed files with 353 additions and 340 deletions

View File

@@ -868,20 +868,20 @@ namespace Bit.Core.Services
}
}
public async Task<UserLicense> GenerateLicenseAsync(User user, BillingInfo billingInfo = null)
public async Task<UserLicense> GenerateLicenseAsync(User user, SubscriptionInfo subscriptionInfo = null)
{
if(user == null)
{
throw new NotFoundException();
}
if(billingInfo == null && user.Gateway != null)
if(subscriptionInfo == null && user.Gateway != null)
{
billingInfo = await _paymentService.GetBillingAsync(user);
subscriptionInfo = await _paymentService.GetSubscriptionAsync(user);
}
return billingInfo == null ? new UserLicense(user, _licenseService) :
new UserLicense(user, billingInfo, _licenseService);
return subscriptionInfo == null ? new UserLicense(user, _licenseService) :
new UserLicense(user, subscriptionInfo, _licenseService);
}
public override async Task<bool> CheckPasswordAsync(User user, string password)