Skip to content

feat: Fallback to Customer Address if default payment method address doesn't exist #3878

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 30, 2025

Conversation

ajay-sentry
Copy link
Contributor

@ajay-sentry ajay-sentry commented May 28, 2025

Description

This PR adds a fallback mechanism to the address component to use the "customer address" if that exists instead. This is actually what stripe / we do under the hood anyway, we just want to make it clear to the customer as well.

FYI If the customer changes their billing address using this form, both their customer address AND the default payment method address are set.

Relates to codecov/umbrella#189

Screenshot of new params coming in and successful account-details zod parsing

Screenshot 2025-05-28 at 4 38 53 PM

Link to Sample Entry

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. In 2022 this entity acquired Codecov and as result Sentry is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

Copy link

codecov bot commented May 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.72%. Comparing base (ac06400) to head (dc50c7d).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3878   +/-   ##
=======================================
  Coverage   98.72%   98.72%           
=======================================
  Files         827      827           
  Lines       15029    15029           
  Branches     4304     4305    +1     
=======================================
  Hits        14838    14838           
  Misses        184      184           
  Partials        7        7           
Files with missing lines Coverage Δ
...rentOrgPlan/BillingDetails/Address/AddressCard.tsx 100.00% <100.00%> (ø)
src/services/account/useAccountDetails.ts 100.00% <ø> (ø)
Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.71% <ø> (ø)
Pages 98.28% <100.00%> (ø)
Services 99.35% <ø> (ø)
Shared 99.11% <ø> (ø)
UI 99.15% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ac06400...dc50c7d. Read the comment docs.

@codecov-qa
Copy link

codecov-qa bot commented May 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.72%. Comparing base (ac06400) to head (dc50c7d).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found.

@@           Coverage Diff           @@
##             main    #3878   +/-   ##
=======================================
  Coverage   98.72%   98.72%           
=======================================
  Files         827      827           
  Lines       15029    15029           
  Branches     4296     4305    +9     
=======================================
  Hits        14838    14838           
  Misses        184      184           
  Partials        7        7           
Files with missing lines Coverage Δ
...rentOrgPlan/BillingDetails/Address/AddressCard.tsx 100.00% <100.00%> (ø)
src/services/account/useAccountDetails.ts 100.00% <ø> (ø)
Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.71% <ø> (ø)
Pages 98.28% <100.00%> (ø)
Services 99.35% <ø> (ø)
Shared 99.11% <ø> (ø)
UI 99.15% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ac06400...dc50c7d. Read the comment docs.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@codecov-notifications
Copy link

codecov-notifications bot commented May 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

@@           Coverage Diff           @@
##             main    #3878   +/-   ##
=======================================
  Coverage   98.72%   98.72%           
=======================================
  Files         827      827           
  Lines       15029    15029           
  Branches     4304     4305    +1     
=======================================
  Hits        14838    14838           
  Misses        184      184           
  Partials        7        7           
Files with missing lines Coverage Δ
...rentOrgPlan/BillingDetails/Address/AddressCard.tsx 100.00% <100.00%> (ø)
src/services/account/useAccountDetails.ts 100.00% <ø> (ø)
Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.71% <ø> (ø)
Pages 98.28% <100.00%> (ø)
Services 99.35% <ø> (ø)
Shared 99.11% <ø> (ø)
UI 99.15% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ac06400...dc50c7d. Read the comment docs.

@codecov-staging
Copy link

codecov-staging bot commented May 28, 2025

Bundle Report

Changes will increase total bundle size by 256 bytes (0.0%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
gazebo-staging-system 6.23MB 89 bytes (0.0%) ⬆️
gazebo-staging-esm 6.31MB 167 bytes (0.0%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: gazebo-staging-system

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/index-legacy.*.js 30 bytes 51.99kB 0.06%
assets/useAccountDetails-legacy.*.js 59 bytes 3.36kB 1.79%

Files in assets/index-legacy.*.js:

  • ./src/pages/PlanPage/subRoutes/CurrentOrgPlan/BillingDetails/Address/AddressCard.tsx → Total Size: 3.03kB

Files in assets/useAccountDetails-legacy.*.js:

  • ./src/services/account/useAccountDetails.ts → Total Size: 4.46kB
view changes for bundle: gazebo-staging-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/index.*.js 108 bytes 55.12kB 0.2%
assets/useAccountDetails.*.js 59 bytes 3.3kB 1.82%

Files in assets/index.*.js:

  • ./src/pages/PlanPage/subRoutes/CurrentOrgPlan/BillingDetails/Address/AddressCard.tsx → Total Size: 3.03kB

Files in assets/useAccountDetails.*.js:

  • ./src/services/account/useAccountDetails.ts → Total Size: 4.46kB

Copy link

codecov bot commented May 28, 2025

Bundle Report

Changes will increase total bundle size by 256 bytes (0.0%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
gazebo-production-system 6.23MB 89 bytes (0.0%) ⬆️
gazebo-production-esm 6.31MB 167 bytes (0.0%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: gazebo-production-system

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/index-legacy.*.js 30 bytes 51.99kB 0.06%
assets/useAccountDetails-legacy.*.js 59 bytes 3.36kB 1.79%

Files in assets/index-legacy.*.js:

  • ./src/pages/PlanPage/subRoutes/CurrentOrgPlan/BillingDetails/Address/AddressCard.tsx → Total Size: 3.03kB

Files in assets/useAccountDetails-legacy.*.js:

  • ./src/services/account/useAccountDetails.ts → Total Size: 4.46kB
view changes for bundle: gazebo-production-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/index.*.js 108 bytes 55.12kB 0.2%
assets/useAccountDetails.*.js 59 bytes 3.3kB 1.82%

Files in assets/index.*.js:

  • ./src/pages/PlanPage/subRoutes/CurrentOrgPlan/BillingDetails/Address/AddressCard.tsx → Total Size: 3.03kB

Files in assets/useAccountDetails.*.js:

  • ./src/services/account/useAccountDetails.ts → Total Size: 4.46kB

Copy link

codecov-public-qa bot commented May 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.72%. Comparing base (ac06400) to head (dc50c7d).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found.

@@           Coverage Diff           @@
##             main    #3878   +/-   ##
=======================================
  Coverage   98.72%   98.72%           
=======================================
  Files         827      827           
  Lines       15029    15029           
  Branches     4296     4305    +9     
=======================================
  Hits        14838    14838           
  Misses        184      184           
  Partials        7        7           
Files with missing lines Coverage Δ
...rentOrgPlan/BillingDetails/Address/AddressCard.tsx 100.00% <100.00%> (ø)
src/services/account/useAccountDetails.ts 100.00% <ø> (ø)
Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.71% <ø> (ø)
Pages 98.28% <100.00%> (ø)
Services 99.35% <ø> (ø)
Shared 99.11% <ø> (ø)
UI 99.15% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ac06400...dc50c7d. Read the comment docs.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

✅ Sentry found no issues in your recent changes ✅

@codecov-releaser
Copy link
Contributor

✅ Deploy preview for gazebo ready!

Previews expire after 1 month automatically.

Storybook

Commit Created Cloud Enterprise
dc50c7d Wed, 28 May 2025 23:45:17 GMT Cloud Enterprise

Copy link
Contributor

@suejung-sentry suejung-sentry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice thanks for doing this. Looks like we're good to get the dependent version of api deployed in all environments (incl dec) before / with this gazebo PR so good to go there

@@ -102,7 +104,7 @@ export const SubscriptionDetailSchema = z
expires: z.number().nullable(),
})
.nullish(),
email: z.string(),
name: z.string().nullable(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is name nullish? I feel like I've seen it undefined in the past

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It actually should have always been undefined in the past because it was never on the StripeSerializer to begin with, but based off the stripe docs, they call it nullable: https://docs.stripe.com/api/customers/object

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah got it, cool. As long as all our code in-between continues to treat it as null should be good to go. Worst case if we see it error can make adjustments as it comes up haha

@ajay-sentry ajay-sentry added this pull request to the merge queue May 30, 2025
Merged via the queue into main with commit b1079cd May 30, 2025
64 checks passed
@ajay-sentry ajay-sentry deleted the Ajay/uptake-customer-address branch May 30, 2025 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants