Skip to content

Add SolidusStripe::Customer#216

Merged
elia merged 1 commit into
masterfrom
elia+kennyadsl+marc/customer-refactor
Mar 17, 2023
Merged

Add SolidusStripe::Customer#216
elia merged 1 commit into
masterfrom
elia+kennyadsl+marc/customer-refactor

Conversation

@elia

@elia elia commented Mar 14, 2023

Copy link
Copy Markdown
Member

Summary

Fixes #163

Adds a SolidusStripe::Customer class that connects the user or the order (for guest users) to a stripe customer, ensuring it stays the same across order and intents generation.

  • Use a polymorphic association to allow connecting it to either users or orders (for guest users)
  • Stop using metadata since we now store the id and we can rely on the database for fetching it
  • No need for fetching the customer form the API anywhere in the current implementation

Checklist

Check out our PR guidelines for more details.

The following are mandatory for all PRs:

The following are not always needed:

  • 📖 I have updated the README to account for my changes.
  • 📑 I have documented new code with YARD.
  • 🛣️ I have opened a PR to update the guides.
  • ✅ I have added automated tests to cover my changes.
  • 📸 I have attached screenshots to demo visual changes.

@elia elia force-pushed the elia+kennyadsl+marc/customer-refactor branch 2 times, most recently from 78f2185 to 95e6787 Compare March 14, 2023 16:13
@elia elia marked this pull request as ready for review March 15, 2023 08:49
Comment thread db/migrate/20230313150008_create_solidus_stripe_customers.rb
@elia elia force-pushed the elia+kennyadsl+marc/customer-refactor branch 3 times, most recently from f25f5f6 to 26f579e Compare March 17, 2023 15:18
…ed class

- Use a polymorphic association to allow connecting it to either users or orders (for guest users)
- Stop using metadata since we now store the id and we can rely on the database for fetching it
- No need for fetching the customer form the API anywhere in the current implementation

Co-Authored-By: Alberto Vena <kennyadsl@gmail.com>
Co-Authored-By: Marc Busqué <marc@lamarciana.com>
@elia elia force-pushed the elia+kennyadsl+marc/customer-refactor branch from 26f579e to 9c940fe Compare March 17, 2023 15:47
@codecov

codecov Bot commented Mar 17, 2023

Copy link
Copy Markdown

Codecov Report

Merging #216 (9c940fe) into master (d45eeee) will increase coverage by 0.46%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #216      +/-   ##
==========================================
+ Coverage   94.92%   95.38%   +0.46%     
==========================================
  Files          21       22       +1     
  Lines         414      412       -2     
==========================================
  Hits          393      393              
+ Misses         21       19       -2     
Impacted Files Coverage Δ
app/models/solidus_stripe/payment_method.rb 100.00% <ø> (+3.38%) ⬆️
app/models/solidus_stripe/customer.rb 100.00% <100.00%> (ø)
app/models/solidus_stripe/payment_intent.rb 100.00% <100.00%> (ø)
app/models/solidus_stripe/setup_intent.rb 100.00% <100.00%> (ø)
lib/solidus_stripe/testing_support/factories.rb 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@elia elia merged commit c553558 into master Mar 17, 2023
@elia elia deleted the elia+kennyadsl+marc/customer-refactor branch March 17, 2023 17:08
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.

Track Stripe Customers with a SolidusStripe::Customer model

4 participants