From 13d1e74d6960cf0d042620b72d85bf583a4236f7 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Wed, 17 Aug 2022 14:39:21 -0400 Subject: [PATCH] expand sources and tax_ids for stripe api 2020-08-27 (#2199) --- src/Core/Services/Implementations/OrganizationService.cs | 3 ++- src/Core/Services/Implementations/StripePaymentService.cs | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Core/Services/Implementations/OrganizationService.cs b/src/Core/Services/Implementations/OrganizationService.cs index 6ab9f1e66..b0b3dfc07 100644 --- a/src/Core/Services/Implementations/OrganizationService.cs +++ b/src/Core/Services/Implementations/OrganizationService.cs @@ -549,7 +549,8 @@ namespace Bit.Core.Services var bankService = new BankAccountService(); var customerService = new CustomerService(); - var customer = await customerService.GetAsync(organization.GatewayCustomerId); + var customer = await customerService.GetAsync(organization.GatewayCustomerId, + new CustomerGetOptions { Expand = new List { "sources" } }); if (customer == null) { throw new GatewayException("Cannot find customer."); diff --git a/src/Core/Services/Implementations/StripePaymentService.cs b/src/Core/Services/Implementations/StripePaymentService.cs index 812f5cdaf..e3ed16368 100644 --- a/src/Core/Services/Implementations/StripePaymentService.cs +++ b/src/Core/Services/Implementations/StripePaymentService.cs @@ -1345,6 +1345,7 @@ namespace Bit.Core.Services City = taxInfo.BillingAddressCity, State = taxInfo.BillingAddressState, }, + Expand = new List { "sources" }, }); subscriber.Gateway = GatewayType.Stripe; @@ -1539,7 +1540,8 @@ namespace Bit.Core.Services return null; } - var customer = await _stripeAdapter.CustomerGetAsync(subscriber.GatewayCustomerId); + var customer = await _stripeAdapter.CustomerGetAsync(subscriber.GatewayCustomerId, + new Stripe.CustomerGetOptions { Expand = new List { "tax_ids" } }); if (customer == null) { @@ -1583,6 +1585,7 @@ namespace Bit.Core.Services PostalCode = taxInfo.BillingAddressPostalCode, Country = taxInfo.BillingAddressCountry, }, + Expand = new List { "tax_ids" } }); if (!subscriber.IsUser() && customer != null)