1
0
mirror of https://github.com/bitwarden/server synced 2025-12-14 23:33:41 +00:00

setup: process paypal with stripe subscription

This commit is contained in:
Kyle Spearrin
2019-01-29 13:12:11 -05:00
parent 54c6ffeece
commit e54a381dba
8 changed files with 157 additions and 20 deletions

View File

@@ -706,16 +706,14 @@ namespace Bit.Core.Services
throw new BadRequestException("Invalid token.");
}
if(paymentToken.StartsWith("tok_"))
var paymentMethodType = PaymentMethodType.Card;
if(!paymentToken.StartsWith("tok_"))
{
paymentService = new StripePaymentService();
}
else
{
paymentService = new BraintreePaymentService(_globalSettings);
paymentMethodType = PaymentMethodType.PayPal;
}
await paymentService.PurchasePremiumAsync(user, paymentToken, additionalStorageGb);
await new StripePaymentService(_globalSettings).PurchasePremiumAsync(user, paymentMethodType,
paymentToken, additionalStorageGb);
}
else
{
@@ -805,7 +803,7 @@ namespace Bit.Core.Services
IPaymentService paymentService = null;
if(paymentToken.StartsWith("tok_"))
{
paymentService = new StripePaymentService();
paymentService = new StripePaymentService(_globalSettings);
}
else
{