-
-
Notifications
You must be signed in to change notification settings - Fork 23
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
Add payment method parent class #8
Add payment method parent class #8
Conversation
This helps to get the parent class for payment methods. For Solidus < 2.3 it is Spree::PaymentMethod for non credit card payment methods or Spree::Gateway for credit card payment methods. For Solidus >= 2.3 it is Spree::PaymentMethod for non credit card payment methods or Spree::PaymentMethod::CreditCard for credit card payment methods. Usage: My::NonCreditCardPaymentMethod < SolidusSupport.payment_method_parent_class My::CreditCardPaymentMethod < SolidusSupport.payment_method_parent_class(credit_card: true)
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.
👍 on having the payment_method_parent_class
method.
No opinion on the other things.
@@ -24,6 +24,18 @@ def payment_source_parent_class | |||
end | |||
end | |||
|
|||
def payment_method_parent_class(credit_card: false) |
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.
Since this is only useful when credit_card
is true
(otherwise it is Spree::PaymentMethod
in all versions).
Maybe we should call this credit_card_payment_method_parent_class
instead, and only deal with that case?
Either way 👍
@jhawthorn would you mind to review your comment? |
Looks fine to me |
I'm agree with @jhawthorn. Since there isn't a change for non-credit card payment methods, I think is not useful include them. 👍 to add a test suite Aside, there are differences about how define partial name and provider class in gateway between some versions that could be useful in this lib. I build something similar in a payment extension. Not sure what do you think? |
Add
SolidusSupport.payment_method_parent_class
This helps to get the parent class for payment methods.
For Solidus < 2.3 it is
Spree::PaymentMethod
for non credit card payment methods orSpree::Gateway
for credit card payment methods.For Solidus >= 2.3 it is
Spree::PaymentMethod
for non credit card payment methods orSpree::PaymentMethod::CreditCard
for credit card payment methods.Usage: