1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-21 12:05:42 +01:00

expand sources and tax_ids for stripe api 2020-08-27 (#2199)

This commit is contained in:
Kyle Spearrin 2022-08-17 14:39:21 -04:00 committed by GitHub
parent 4b144f4cda
commit 13d1e74d69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -549,7 +549,8 @@ namespace Bit.Core.Services
var bankService = new BankAccountService(); var bankService = new BankAccountService();
var customerService = new CustomerService(); var customerService = new CustomerService();
var customer = await customerService.GetAsync(organization.GatewayCustomerId); var customer = await customerService.GetAsync(organization.GatewayCustomerId,
new CustomerGetOptions { Expand = new List<string> { "sources" } });
if (customer == null) if (customer == null)
{ {
throw new GatewayException("Cannot find customer."); throw new GatewayException("Cannot find customer.");

View File

@ -1345,6 +1345,7 @@ namespace Bit.Core.Services
City = taxInfo.BillingAddressCity, City = taxInfo.BillingAddressCity,
State = taxInfo.BillingAddressState, State = taxInfo.BillingAddressState,
}, },
Expand = new List<string> { "sources" },
}); });
subscriber.Gateway = GatewayType.Stripe; subscriber.Gateway = GatewayType.Stripe;
@ -1539,7 +1540,8 @@ namespace Bit.Core.Services
return null; return null;
} }
var customer = await _stripeAdapter.CustomerGetAsync(subscriber.GatewayCustomerId); var customer = await _stripeAdapter.CustomerGetAsync(subscriber.GatewayCustomerId,
new Stripe.CustomerGetOptions { Expand = new List<string> { "tax_ids" } });
if (customer == null) if (customer == null)
{ {
@ -1583,6 +1585,7 @@ namespace Bit.Core.Services
PostalCode = taxInfo.BillingAddressPostalCode, PostalCode = taxInfo.BillingAddressPostalCode,
Country = taxInfo.BillingAddressCountry, Country = taxInfo.BillingAddressCountry,
}, },
Expand = new List<string> { "tax_ids" }
}); });
if (!subscriber.IsUser() && customer != null) if (!subscriber.IsUser() && customer != null)