Payment method preferences returns different object types depending on setup #4584
Closed
seand7565
started this conversation in
New Features or Ideas
Replies: 2 comments
|
Using |
0 replies
|
This was fixed by @AlistairNorman's work in #6616, so this is fixed in v4.8. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
When setting up a payment_method, if you don't use static model preferences, you get a Hash object when you call
payment_method.preferences. If you do use static model preferences, you instead get aSpree::Preferences::StaticModelPreferences::Definitionobject when you callpayment_method.preferencesWhile using the default preference source, this command will succeed:
payment_method.preferences[:available_to_users]While using static model preferences, the same command will fail.
Solidus Version:
2.10 - though likely an issue in more versions
To Reproduce
Spree::PaymentMethod.last.preferences[:test_mode]- it will failSpree::PaymentMethod.last.preferences[:test_mode]- it will succeedExample static model preference:
Current behavior
payment_method.preferencescould return either a Hash or a model object depending on the setupExpected behavior
payment_method.preferencesshould always return just one object type - IMO preferably a Hash object.Screenshots


All reactions