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

Backport HostedForm device data collection to v2.x #135

Closed

Conversation

gsmendoza
Copy link
Contributor

Summary

Closes #132.

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.

gsmendoza and others added 4 commits March 16, 2023 15:17
Offenses:

app/models/solidus_braintree/transaction.rb:20:21: C: [Correctable] Style/InverseMethods: Use invalid? instead of inverting valid?.
      if address && !address.valid?
                    ^^^^^^^^^^^^^^^
app/models/solidus_braintree/transaction_import.rb:12:57: C: [Correctable] Style/InverseMethods: Use invalid? instead of inverting valid?.
      errors.add("Address", "is invalid") if address && !address.valid?
                                                        ^^^^^^^^^^^^^^^
app/models/solidus_braintree/transaction_import.rb:14:10: C: [Correctable] Style/InverseMethods: Use invalid? instead of inverting valid?.
      if !transaction.valid?
         ^^^^^^^^^^^^^^^^^^^
Offenses:

app/models/solidus_braintree/transaction.rb:20:10: C: [Correctable] Style/SafeNavigation: Use safe navigation (&.) instead of checking if an object exists before calling the method.
      if address && address.invalid?
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/solidus_braintree/transaction_import.rb:12:46: C: [Correctable] Style/SafeNavigation: Use safe navigation (&.) instead of checking if an object exists before calling the method.
      errors.add("Address", "is invalid") if address && address.invalid?
                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@gsmendoza gsmendoza self-assigned this Mar 16, 2023
@@ -17,7 +17,7 @@ class Transaction
unless payment_method.is_a? SolidusBraintree::Gateway
errors.add(:payment_method, 'Must be braintree')
end
if address && !address.valid?
if address&.invalid?
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added these changes to fix the RuboCop offenses in CI.

@@ -9,9 +9,9 @@ class InvalidImportError < StandardError; end
include ActiveModel::Model

validate do
errors.add("Address", "is invalid") if address && !address.valid?
errors.add("Address", "is invalid") if address&.invalid?
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added these changes to fix the RuboCop offenses in CI.

Copy link
Member

@kennyadsl kennyadsl left a comment

Choose a reason for hiding this comment

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

Approving, but I have a doubt: is this supposed to be part of 2.0? I thought we wanted to leave the 2.0 version as identical as possible to SolidusPaypalBraintree to facilitate the upgrade. If we add other features, maybe it will be more complex to upgrade.

It's not the end of the world but we can release this change in a 2.1 version. WDYT?

@gsmendoza
Copy link
Contributor Author

@kennyadsl Makes sense. Plus, I think it would be ideal if we sort out the remaining concerns with device data (compatibility with other payment methods, reuse with saved payment sources) before we backport it to 2.0x. I'm closing this for now. We can reopen it once we're ready.

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.

3 participants