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 true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return e.Level >= LogEventLevel.Error;
|
return e.Level >= LogEventLevel.Warning;
|
||||||
});
|
});
|
||||||
|
|
||||||
if(env.IsDevelopment())
|
if(env.IsDevelopment())
|
||||||
|
@ -8,6 +8,7 @@ using System.Linq;
|
|||||||
using Bit.Core.Models.Business;
|
using Bit.Core.Models.Business;
|
||||||
using Bit.Core.Enums;
|
using Bit.Core.Enums;
|
||||||
using Bit.Core.Repositories;
|
using Bit.Core.Repositories;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace Bit.Core.Services
|
namespace Bit.Core.Services
|
||||||
{
|
{
|
||||||
@ -17,11 +18,13 @@ namespace Bit.Core.Services
|
|||||||
private const string StoragePlanId = "storage-gb-annually";
|
private const string StoragePlanId = "storage-gb-annually";
|
||||||
|
|
||||||
private readonly ITransactionRepository _transactionRepository;
|
private readonly ITransactionRepository _transactionRepository;
|
||||||
|
private readonly ILogger<StripePaymentService> _logger;
|
||||||
private readonly Braintree.BraintreeGateway _btGateway;
|
private readonly Braintree.BraintreeGateway _btGateway;
|
||||||
|
|
||||||
public StripePaymentService(
|
public StripePaymentService(
|
||||||
ITransactionRepository transactionRepository,
|
ITransactionRepository transactionRepository,
|
||||||
GlobalSettings globalSettings)
|
GlobalSettings globalSettings,
|
||||||
|
ILogger<StripePaymentService> logger)
|
||||||
{
|
{
|
||||||
_btGateway = new Braintree.BraintreeGateway
|
_btGateway = new Braintree.BraintreeGateway
|
||||||
{
|
{
|
||||||
@ -32,6 +35,7 @@ namespace Bit.Core.Services
|
|||||||
PrivateKey = globalSettings.Braintree.PrivateKey
|
PrivateKey = globalSettings.Braintree.PrivateKey
|
||||||
};
|
};
|
||||||
_transactionRepository = transactionRepository;
|
_transactionRepository = transactionRepository;
|
||||||
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task PurchaseOrganizationAsync(Organization org, PaymentMethodType paymentMethodType,
|
public async Task PurchaseOrganizationAsync(Organization org, PaymentMethodType paymentMethodType,
|
||||||
@ -970,10 +974,10 @@ namespace Bit.Core.Services
|
|||||||
var customerService = new CustomerService();
|
var customerService = new CustomerService();
|
||||||
Customer customer = null;
|
Customer customer = null;
|
||||||
var customerExists = subscriber.Gateway == GatewayType.Stripe &&
|
var customerExists = subscriber.Gateway == GatewayType.Stripe &&
|
||||||
!string.IsNullOrWhiteSpace(subscriber.GatewaySubscriptionId);
|
!string.IsNullOrWhiteSpace(subscriber.GatewayCustomerId);
|
||||||
if(customerExists)
|
if(customerExists)
|
||||||
{
|
{
|
||||||
customer = await customerService.GetAsync(subscriber.GatewaySubscriptionId);
|
customer = await customerService.GetAsync(subscriber.GatewayCustomerId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user