mirror of
https://github.com/bitwarden/server.git
synced 2024-11-22 12:15:36 +01:00
fixes for credit add
This commit is contained in:
parent
c5b2a929d2
commit
78fa990b1f
@ -87,7 +87,7 @@ namespace Bit.Billing
|
||||
return true;
|
||||
}
|
||||
|
||||
return e.Level >= LogEventLevel.Error;
|
||||
return e.Level >= LogEventLevel.Warning;
|
||||
});
|
||||
|
||||
if(env.IsDevelopment())
|
||||
|
@ -8,6 +8,7 @@ using System.Linq;
|
||||
using Bit.Core.Models.Business;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Repositories;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Bit.Core.Services
|
||||
{
|
||||
@ -17,11 +18,13 @@ namespace Bit.Core.Services
|
||||
private const string StoragePlanId = "storage-gb-annually";
|
||||
|
||||
private readonly ITransactionRepository _transactionRepository;
|
||||
private readonly ILogger<StripePaymentService> _logger;
|
||||
private readonly Braintree.BraintreeGateway _btGateway;
|
||||
|
||||
public StripePaymentService(
|
||||
ITransactionRepository transactionRepository,
|
||||
GlobalSettings globalSettings)
|
||||
GlobalSettings globalSettings,
|
||||
ILogger<StripePaymentService> logger)
|
||||
{
|
||||
_btGateway = new Braintree.BraintreeGateway
|
||||
{
|
||||
@ -32,6 +35,7 @@ namespace Bit.Core.Services
|
||||
PrivateKey = globalSettings.Braintree.PrivateKey
|
||||
};
|
||||
_transactionRepository = transactionRepository;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public async Task PurchaseOrganizationAsync(Organization org, PaymentMethodType paymentMethodType,
|
||||
@ -970,10 +974,10 @@ namespace Bit.Core.Services
|
||||
var customerService = new CustomerService();
|
||||
Customer customer = null;
|
||||
var customerExists = subscriber.Gateway == GatewayType.Stripe &&
|
||||
!string.IsNullOrWhiteSpace(subscriber.GatewaySubscriptionId);
|
||||
!string.IsNullOrWhiteSpace(subscriber.GatewayCustomerId);
|
||||
if(customerExists)
|
||||
{
|
||||
customer = await customerService.GetAsync(subscriber.GatewaySubscriptionId);
|
||||
customer = await customerService.GetAsync(subscriber.GatewayCustomerId);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user