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

New cop to warn about existing_card_id usage #62

Merged
merged 5 commits into from
Nov 3, 2023

Conversation

MassimilianoLattanzio
Copy link
Collaborator

Description

Create a new cop to find existing_card_id occurrences and suggest using wallet_payment_source_id instead.

Closes #60.


Severity:

  • - info
  • - refactor
  • - convention (default)
  • - warning
  • - error
  • - fatal

Wrong Code

source_attributes: {
  name: payment_method.name,
  existing_card_id: payment_source.id
}

Correct Code

source_attributes: {
  name: payment_method.name,
  wallet_payment_source_id: payment_source.wallet.wallet_payment_sources.first.id
}

Solidus PR Link: solidusio/solidus@eacc898


Before submitting the PR make sure the following are checked:

  • The PR relates to only one cop with a clear title and description.
  • Feature branch is up-to-date with main (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Ran and ensured all tests are passing on a development environment.
  • If this is a new cop, added an entry for the cop on /config/default.yml
  • Updated Changelog

@MassimilianoLattanzio MassimilianoLattanzio self-assigned this Nov 2, 2023
@MassimilianoLattanzio MassimilianoLattanzio changed the title Ml/existing card id deprecation New cop to warn about existing_card_id usage Nov 2, 2023
In d525445, we updated the `add_offense` method to let it work with
older ruby versions. Everything worked fine until we started passing
other params to the method, such as the severity, which doesn't work
in Ruby 2.7 because the behavior is incorrect. Our way of calling
the super method was introduced in Ruby 2.7, so we need to start using
the new way from the correct version.
Copy link
Collaborator

@safafa safafa left a comment

Choose a reason for hiding this comment

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

LGTM!

@MassimilianoLattanzio MassimilianoLattanzio merged commit ea03a4b into main Nov 3, 2023
4 checks passed
@MassimilianoLattanzio MassimilianoLattanzio deleted the ml/existing_card_id_deprecation branch November 3, 2023 15:02
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.

existing_card_id -> wallet_payment_source_id
2 participants