Skip to content

Add test for the integration with Solidus backend#237

Merged
rainerdema merged 2 commits into
masterfrom
nebulab/rainerd/add-test-for-the-integration-with-solidus-backend
Mar 22, 2023
Merged

Add test for the integration with Solidus backend#237
rainerdema merged 2 commits into
masterfrom
nebulab/rainerd/add-test-for-the-integration-with-solidus-backend

Conversation

@rainerdema

@rainerdema rainerdema commented Mar 21, 2023

Copy link
Copy Markdown
Contributor

Summary

Closes #150

The tests cover the following cases:

Description Context Expected Result Pending
Navigates to the payments page with successful payment operations Payment is displayed no
Displays log entries for a payment with successful payment operations Log entries are displayed no
Captures an authorized payment successfully with successful payment operations Payment is successfully captured no
Voids a payment from an order with successful payment operations Payment is successfully voided no
Refunds a payment from an order with successful payment operations Payment is successfully refunded no
Partially refunds a payment from an order with successful payment operations Payment is partially refunded no
Cancels an order with captured payment with successful payment operations Payment is successfully voided yes
Cancels an order with authorized payment with successful payment operations Payment is successfully voided yes
Fails to capture a payment due to incomplete 3D Secure authentication with failed payment operations Payment capture fails and notification is displayed no

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.

@rainerdema rainerdema self-assigned this Mar 21, 2023
@rainerdema rainerdema force-pushed the nebulab/rainerd/add-test-for-the-integration-with-solidus-backend branch 2 times, most recently from 58a5f40 to 6d65a67 Compare March 21, 2023 09:12
@rainerdema rainerdema marked this pull request as ready for review March 21, 2023 09:22
@codecov

codecov Bot commented Mar 21, 2023

Copy link
Copy Markdown

Codecov Report

Merging #237 (df6af3a) into master (a54e2c8) will increase coverage by 1.42%.
The diff coverage is 100.00%.

❗ Current head df6af3a differs from pull request most recent head 152dd3f. Consider uploading reports for the commit 152dd3f to get more accurate results

@@            Coverage Diff             @@
##           master     #237      +/-   ##
==========================================
+ Coverage   98.35%   99.78%   +1.42%     
==========================================
  Files          23       24       +1     
  Lines         426      469      +43     
==========================================
+ Hits          419      468      +49     
+ Misses          7        1       -6     
Impacted Files Coverage Δ
app/models/solidus_stripe/gateway.rb 100.00% <100.00%> (+3.38%) ⬆️
lib/solidus_stripe/testing_support/factories.rb 100.00% <100.00%> (ø)

... and 2 files with indirect coverage changes

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

@rainerdema rainerdema force-pushed the nebulab/rainerd/add-test-for-the-integration-with-solidus-backend branch from 6d65a67 to 033aa2e Compare March 21, 2023 10:56

@waiting-for-dev waiting-for-dev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cool 🙌

Comment thread spec/support/solidus_stripe/backend_test_helper.rb Outdated

@elia elia left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Great to see this also finally covered by specs 🙌

Left a few comments, mostly nits but I'm interested in your take

Comment thread app/models/solidus_stripe/gateway.rb
Comment thread spec/system/backend/solidus_stripe/orders/payments_spec.rb
Comment thread spec/system/backend/solidus_stripe/orders/payments_spec.rb Outdated
This commit updates the void and credit methods in `SolidusStripe::Gateway` to
remove the `_source` parameter, which is no longer required when calling these
methods due to the `payment_profiles_supported?` being set to false.
This change is necessary because the `_source` parameter was previously defined
but not called when invoking these methods in Solidus.

Specifically, this change is made to align with the behavior of the:
 - void action invoked in Spree::Payment::Processing#void_transaction! (https://github.com/solidusio/solidus/blob/6d5580068d00c8fb711710a71e350e4c1358946c/core/app/models/spree/payment/processing.rb#L98)
 - credit action invoked in Spree::Refund#process! (https://github.com/solidusio/solidus/blob/6d5580068d00c8fb711710a71e350e4c1358946c/core/app/models/spree/refund.rb#L68)
@rainerdema rainerdema force-pushed the nebulab/rainerd/add-test-for-the-integration-with-solidus-backend branch from 033aa2e to df6af3a Compare March 22, 2023 17:15
@rainerdema rainerdema requested a review from elia March 22, 2023 17:43

@elia elia left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Awesome, one final nit, not blocking ✅

Comment thread spec/system/backend/solidus_stripe/orders/payments_spec.rb Outdated
This commit adds new tests to cover basic Stripe payment use cases.
The tests verify payment creation, cancellation, capture, refund, and void operations.
Note that these tests do not cover payment creation through a Stripe interface
in Solidus Backend that currently doesn't exist.

Additionally, there are identified issues with canceled orders and payments not
being correctly voided due to limitations in try_void and Solidus. Further work
is required to address these issues.
@rainerdema rainerdema force-pushed the nebulab/rainerd/add-test-for-the-integration-with-solidus-backend branch from df6af3a to 152dd3f Compare March 22, 2023 18:00
@rainerdema rainerdema merged commit 6ecda67 into master Mar 22, 2023
@rainerdema rainerdema deleted the nebulab/rainerd/add-test-for-the-integration-with-solidus-backend branch March 22, 2023 18:17
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.

Add test for the integration with solidus_backend

3 participants