solidusio / solidus_stripe

💳 Integrate Solidus with Stripe
https://stripe.com
BSD 3-Clause "New" or "Revised" License
36 stars 62 forks source link

Fix `Gateway#purchase` not capturing the payment #233

Closed waiting-for-dev closed 1 year ago

waiting-for-dev commented 1 year ago

Summary

On Solidus, Gateway#purchase is meant to authorize and capture a payment in a single step. However, we were using that method only to authorize (confirm, on Stripe) the payment.

We're now moving the authorize logic to a helper method shared by the #authorize and #purchase methods, while we use the automatic capture method on #purchase.

We're also unifying the format for the success messages recorded in the response.

We're getting rid of the option to pass custom payment intent options on #authorize. That was the only method in the gateway supporting them, and we can add it later to all the methods if we feel that's needed.

Closes #232

We take the occasion to perform some house-keeping (two last commits):

Checklist

Check out our PR guidelines for more details.

The following are mandatory for all PRs:

The following are not always needed:

codecov[bot] commented 1 year ago

Codecov Report

Merging #233 (9ddb160) into master (939601a) will increase coverage by 0.85%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #233      +/-   ##
==========================================
+ Coverage   95.51%   96.37%   +0.85%     
==========================================
  Files          23       23              
  Lines         424      441      +17     
==========================================
+ Hits          405      425      +20     
+ Misses         19       16       -3     
Impacted Files Coverage Δ
app/models/solidus_stripe/gateway.rb 96.29% <100.00%> (+7.40%) :arrow_up:
lib/solidus_stripe/testing_support/factories.rb 100.00% <100.00%> (ø)

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

waiting-for-dev commented 1 year ago

Rebasing on top of master after merging https://github.com/solidusio/solidus_stripe/pull/235 to fix CI