mirror of
https://github.com/bitwarden/server.git
synced 2025-05-23 20:41:04 -05:00
set customer source and method earlier
This commit is contained in:
parent
18e6149329
commit
fa3bb0c081
@ -332,6 +332,20 @@ namespace Bit.Core.Services
|
|||||||
var stripePaymentMethod = paymentMethodType == PaymentMethodType.Card ||
|
var stripePaymentMethod = paymentMethodType == PaymentMethodType.Card ||
|
||||||
paymentMethodType == PaymentMethodType.BankAccount || paymentMethodType == PaymentMethodType.Credit;
|
paymentMethodType == PaymentMethodType.BankAccount || paymentMethodType == PaymentMethodType.Credit;
|
||||||
|
|
||||||
|
string stipeCustomerPaymentMethodId = null;
|
||||||
|
string stipeCustomerSourceToken = null;
|
||||||
|
if(stripePaymentMethod)
|
||||||
|
{
|
||||||
|
if(paymentToken.StartsWith("pm_"))
|
||||||
|
{
|
||||||
|
stipeCustomerPaymentMethodId = paymentToken;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
stipeCustomerSourceToken = paymentToken;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(user.Gateway == GatewayType.Stripe && !string.IsNullOrWhiteSpace(user.GatewayCustomerId))
|
if(user.Gateway == GatewayType.Stripe && !string.IsNullOrWhiteSpace(user.GatewayCustomerId))
|
||||||
{
|
{
|
||||||
if(!string.IsNullOrWhiteSpace(paymentToken))
|
if(!string.IsNullOrWhiteSpace(paymentToken))
|
||||||
@ -349,24 +363,10 @@ namespace Bit.Core.Services
|
|||||||
catch { }
|
catch { }
|
||||||
}
|
}
|
||||||
|
|
||||||
string stipeCustomerPaymentMethodId = null;
|
|
||||||
if(customer == null && !string.IsNullOrWhiteSpace(paymentToken))
|
if(customer == null && !string.IsNullOrWhiteSpace(paymentToken))
|
||||||
{
|
{
|
||||||
string stipeCustomerSourceToken = null;
|
|
||||||
var stripeCustomerMetadata = new Dictionary<string, string>();
|
var stripeCustomerMetadata = new Dictionary<string, string>();
|
||||||
|
if(paymentMethodType == PaymentMethodType.PayPal)
|
||||||
if(stripePaymentMethod)
|
|
||||||
{
|
|
||||||
if(paymentToken.StartsWith("pm_"))
|
|
||||||
{
|
|
||||||
stipeCustomerPaymentMethodId = paymentToken;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
stipeCustomerSourceToken = paymentToken;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(paymentMethodType == PaymentMethodType.PayPal)
|
|
||||||
{
|
{
|
||||||
var randomSuffix = Utilities.CoreHelpers.RandomString(3, upper: false, numeric: false);
|
var randomSuffix = Utilities.CoreHelpers.RandomString(3, upper: false, numeric: false);
|
||||||
var customerResult = await _btGateway.Customer.CreateAsync(new Braintree.CustomerRequest
|
var customerResult = await _btGateway.Customer.CreateAsync(new Braintree.CustomerRequest
|
||||||
|
Loading…
x
Reference in New Issue
Block a user