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

Deprecate provider in favour of payment method type #1974

Merged
merged 1 commit into from
Jul 7, 2017

Conversation

tvdeyen
Copy link
Member

@tvdeyen tvdeyen commented May 29, 2017

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.

@tvdeyen tvdeyen force-pushed the rename-providers branch from f6e89eb to 4a64737 Compare May 29, 2017 08:51
@tvdeyen tvdeyen requested a review from jordan-brough May 29, 2017 08:51
@tvdeyen tvdeyen added changelog:solidus_backend Changes to the solidus_backend gem Code review needed type:enhancement Proposed or newly added feature labels May 29, 2017
@tvdeyen tvdeyen force-pushed the rename-providers branch from 4a64737 to 970028e Compare May 29, 2017 08:53
Copy link
Contributor

@mamhoff mamhoff left a 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!

@tvdeyen tvdeyen added the WIP label May 29, 2017
@tvdeyen tvdeyen self-assigned this May 29, 2017
@tvdeyen
Copy link
Member Author

tvdeyen commented May 29, 2017

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)
Copy link
Member

@kennyadsl kennyadsl Jun 1, 2017

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::PaymentMethods there instead now it contains possible types of Spree::PaymentMethod. What about some more semantic variable name like @payment_method_types?

Copy link
Member Author

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?

Copy link
Member

Choose a reason for hiding this comment

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

or available_payment_methods?

Copy link
Contributor

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.

Copy link
Member Author

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

@tvdeyen tvdeyen force-pushed the rename-providers branch from 970028e to fb07b37 Compare June 4, 2017 20:59
Copy link
Contributor

@mamhoff mamhoff left a 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
Copy link
Contributor

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?

Copy link
Member Author

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 😊

@tvdeyen tvdeyen force-pushed the rename-providers branch from fb07b37 to de8dd7d Compare June 8, 2017 12:36
@tvdeyen
Copy link
Member Author

tvdeyen commented Jun 8, 2017

@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. ' \
Copy link
Contributor

@jhawthorn jhawthorn Jun 20, 2017

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 😄

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed. Thanks

@tvdeyen tvdeyen force-pushed the rename-providers branch 2 times, most recently from 84984be to 52dafa0 Compare June 22, 2017 06:50
@tvdeyen
Copy link
Member Author

tvdeyen commented Jun 22, 2017

@jhawthorn rebased on latest master. Might have another look?

@solidusio solidusio deleted a comment from houndci-bot Jun 22, 2017
@gmacdougall
Copy link
Member

@tvdeyen Can we get a rebase on this?

@tvdeyen tvdeyen force-pushed the rename-providers branch from 52dafa0 to 7b94840 Compare July 2, 2017 15:42
@tvdeyen
Copy link
Member Author

tvdeyen commented Jul 2, 2017

@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.
@tvdeyen tvdeyen force-pushed the rename-providers branch from 7b94840 to c6c4531 Compare July 2, 2017 16:18
@jhawthorn jhawthorn merged commit 96795fa into solidusio:master Jul 7, 2017
@tvdeyen tvdeyen deleted the rename-providers branch July 7, 2017 22:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:solidus_backend Changes to the solidus_backend gem type:enhancement Proposed or newly added feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants