Prepare for deferred confirm#252
Conversation
Co-Authored-By: Rainer Dema <rainer.dema@gmail.com>
Co-Authored-By: Rainer Dema <rainer.dema@gmail.com>
Co-Authored-By: Rainer Dema <rainer.dema@gmail.com>
Co-Authored-By: Rainer Dema <rainer.dema@gmail.com>
Although no one should write a 10-line ternary, for simple cases is more than ok. Co-Authored-By: Rainer Dema <rainer.dema@gmail.com>
cde5440 to
3680a7f
Compare
Co-Authored-By: Elia Schito <elia@schito.me> Co-Authored-By: Rainer Dema <rainer.dema@gmail.com>
3680a7f to
a628c5f
Compare
This file is needed to properly display Stripe payment information in confirm and thank-you pages. Co-Authored-By: Rainer Dema <rainer.dema@gmail.com>
Co-Authored-By: Rainer Dema <rainer.dema@gmail.com>
CI will start from scratch every time.
a628c5f to
b401f6b
Compare
Codecov Report
@@ Coverage Diff @@
## master #252 +/- ##
=======================================
Coverage 99.79% 99.79%
=======================================
Files 24 25 +1
Lines 478 480 +2
=======================================
+ Hits 477 479 +2
Misses 1 1
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
waiting-for-dev
left a comment
There was a problem hiding this comment.
Thanks! Left two questions and a non-blocking suggestion 🙏
| # The capture method should stay manual in order to | ||
| # avoid capturing the money before the order is completed. | ||
| capture_method: 'manual', | ||
| capture_method: payment_method.auto_capture? ? 'automatic' : 'manual', |
There was a problem hiding this comment.
Does it fix #178? If so, do we need to implement the unhappy path (see #178 (comment)). IMHO, if so, at least this one should deserve a separate PR for better reference in the future.
There was a problem hiding this comment.
Agree with @waiting-for-dev here. I'm fine doing this before, and even partially (updating the issue with the remaining things to do), but I'd like this not to be part of the preparatory PR.
There was a problem hiding this comment.
This was added because the comment didn't seem relevant anymore with the deferred confirm and so it made sense to connect the value to the auto_capture setting instead of just deleting the comment.
But open to postponing the change, it's not strictly required for the deferred capture PR.
kennyadsl
left a comment
There was a problem hiding this comment.
Left a couple of comments/questions before approval. Overall I'm ok with this but the majority of the changes are not related to the preparation.
As usual, I'd like to have multiple PRs (eg. for the sandbox stuff), but this is not blocking.
| # The capture method should stay manual in order to | ||
| # avoid capturing the money before the order is completed. | ||
| capture_method: 'manual', | ||
| capture_method: payment_method.auto_capture? ? 'automatic' : 'manual', |
There was a problem hiding this comment.
Agree with @waiting-for-dev here. I'm fine doing this before, and even partially (updating the issue with the remaining things to do), but I'd like this not to be part of the preparatory PR.
| if storefront_layout_path.exist? | ||
| insert_into_file( | ||
| storefront_layout_path.to_s, | ||
| "\n <script async src='https://js.stripe.com/v3/'></script>", |
There was a problem hiding this comment.
This comes straight outta importmaps-rails https://github.com/rails/importmap-rails/blob/main/lib/install/install.rb#L1-L9 and is in line with Stripe advising to load the JS on every page to better support fraud prevention. The stripe-js imported in .js files on the other hand is just a thin layer that will load this same file if it's not already available, so we can have the global script tag marked as async and at the same time use a comfy import in our JS files.
Summary
Preparation for #249, these are all commits that are preparatory but not strictly related to the deferred confirm.
Checklist
Check out our PR guidelines for more details.
The following are mandatory for all PRs:
The following are not always needed: