Skip to content
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

Stop calling Spree::Refund#perform! after creating a refund #28

Closed
DanielePalombo opened this issue Jun 23, 2023 · 4 comments
Closed
Assignees

Comments

@DanielePalombo
Copy link
Collaborator

DanielePalombo commented Jun 23, 2023

From Solidus v3.0 onwards, #perform! will need to be explicitly called when creating new refunds. Please, change your code from:

Spree::Refund.create(your: attributes)

to:

Spree::Refund.create(your: attributes, perform_after_creation: false).perform!

The perform_after_creation attribute will be removed in Solidus 3.x.

Stop calling perform! as Spree::Refund after_create callback #3641 (kennyadsl)

Look for:

For solidus 2.11 looks for Spree::Refund.create/new without perform_after_create


For Solidus < 2.11 we can consider patching the model by overriding the method as done here:

solidusio/solidus@3d6f510

solidus_minimum_version: 2.11

@DanielePalombo
Copy link
Collaborator Author

The merged PR is #11.

I discussed it with @piyushswain and @michellecrisologo, but I don't think it will be ok, because the perform! method is automatically executed when the Refund is created. If someone installs rubocop-solidus on a previous solidus version it will autocorrect it, calling the method twice.

@DanielePalombo
Copy link
Collaborator Author

Will need to research how to do the version checks on Rails/Solidus so that this won't run if the version is not correct.

@DanielePalombo
Copy link
Collaborator Author

we have to set the solidus minimum version on the cop

@MassimilianoLattanzio
Copy link
Collaborator

Added minimum Solidus version in #43

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

No branches or pull requests

2 participants