1
0
mirror of https://github.com/bitwarden/server synced 2025-12-17 16:53:23 +00:00

custom ids to braintree customers

This commit is contained in:
Kyle Spearrin
2019-02-02 23:04:44 -05:00
parent 98bd42dde1
commit 856e331ef3
2 changed files with 26 additions and 5 deletions

View File

@@ -54,7 +54,11 @@ namespace Bit.Core.Services
{
PaymentMethodNonce = paymentToken,
Email = org.BillingEmail,
Id = org.BraintreeCustomerIdPrefix() + org.Id.ToString("N").ToLower() + randomSuffix
Id = org.BraintreeCustomerIdPrefix() + org.Id.ToString("N").ToLower() + randomSuffix,
CustomFields = new Dictionary<string, string>
{
[org.BraintreeIdField()] = org.Id.ToString()
}
});
if(!customerResult.IsSuccess() || customerResult.Target.PaymentMethods.Length == 0)
@@ -174,7 +178,11 @@ namespace Bit.Core.Services
{
PaymentMethodNonce = paymentToken,
Email = user.Email,
Id = user.BraintreeCustomerIdPrefix() + user.Id.ToString("N").ToLower() + randomSuffix
Id = user.BraintreeCustomerIdPrefix() + user.Id.ToString("N").ToLower() + randomSuffix,
CustomFields = new Dictionary<string, string>
{
[user.BraintreeIdField()] = user.Id.ToString()
}
});
if(!customerResult.IsSuccess() || customerResult.Target.PaymentMethods.Length == 0)
@@ -767,7 +775,11 @@ namespace Bit.Core.Services
PaymentMethodNonce = paymentToken,
Email = subscriber.BillingEmailAddress(),
Id = subscriber.BraintreeCustomerIdPrefix() + subscriber.Id.ToString("N").ToLower() +
Utilities.CoreHelpers.RandomString(3, upper: false, numeric: false)
Utilities.CoreHelpers.RandomString(3, upper: false, numeric: false),
CustomFields = new Dictionary<string, string>
{
[subscriber.BraintreeIdField()] = subscriber.Id.ToString()
}
});
if(!customerResult.IsSuccess() || customerResult.Target.PaymentMethods.Length == 0)