-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Deprecate provider in favour of payment method type #1974
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. This clarifies stuff a lot!
Will rebase on top of #1975 if we decided to make this change. |
|
||
def validate_payment_method_provider | ||
def load_payment_methods | ||
@payment_methods = Rails.application.config.spree.payment_methods.sort_by(&:name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think having a @payment_methods
ivar can be confusing since, as a developer, I expect to find currently persisted Spree::PaymentMethod
s there instead now it contains possible types of Spree::PaymentMethod
. What about some more semantic variable name like @payment_method_types
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. payment_method_types
is ok, or configured_payment_methods
could also work, no? @mamhoff thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or available_payment_methods
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like @payment_method_types
. Or even @available_payment_method_types
. I agree with @kennyadsl s sentiment that payment_methods
sounds like instances, but the collection is an array of class names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kennyadsl @mamhoff updated. Please re-review
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a minor nit. Otherwise this is still good, and even improved.
klass.name == requested_type | ||
end | ||
# TODO: Remove `@payment_method_type` instance var once `load_providers` gets removed. | ||
@payment_method_type = @payment_method_type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you move the comment up to new line 70, we shouldn't really need this line, should we?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, good catch. Due to the re-rename 😊
@mamhoff fixed |
@@ -25,6 +25,8 @@ class PaymentMethod < Spree::Base | |||
include Spree::Preferences::StaticallyConfigurable | |||
|
|||
def self.providers | |||
Spree::Deprecation.warn 'Spree::PaymentMethod.providers will be deleted without replacement. ' \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not without replacement. The replacement is Rails.application.config.spree.payment_methods
😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. Thanks
84984be
to
52dafa0
Compare
@jhawthorn rebased on latest master. Might have another look? |
@tvdeyen Can we get a rebase on this? |
@gmacdougall here you go |
Payment method types get referenced as providers in the admin payment methods configuration. In order to remove confusion about what a payment method and a provider actually is we rename usages of provider to payment method type. Later on a real payment provider class will get introduced, that hold all commons for multiple payment methods, like credentials and api communication through its gateway.
Payment method types get referenced as providers in the admin payment methods configuration.
In order to remove confusion about what a payment method and a provider actually is we rename usages of provider to payment method type.
Later on a real payment provider class will get introduced, that hold all commons for multiple payment methods, like credentials and api communication through its gateway.