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

Credit card fixes related to Wallet updates #1773

Merged
merged 1 commit into from
Apr 7, 2017

Conversation

jordan-brough
Copy link
Contributor

The deprecated methods didn't handle all cases.

The deprecated methods didn't handle all cases.
end

def default=(set_as_default)
Spree::Deprecation.warn("CreditCard.default= is deprecated. Please use user.wallet.default_wallet_payment_source= instead.", caller)
if set_as_default # setting this card as default
if user.nil?
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this work reasonably with the current default behavior and guest checkouts?

https://github.com/solidusio/solidus/blob/master/core/app/models/spree/wallet/default_payment_builder.rb#L14

Its tough to trace all the way through easily (with all the aliases and whatnot) but I think we'll get the default set to nil if there is no user? Though none of our specs seem to be failing...

Copy link
Contributor Author

@jordan-brough jordan-brough Mar 16, 2017

Choose a reason for hiding this comment

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

@cbrunsdon that code you referenced (and the add_default_payment_from_wallet method that calls it) is a no-op when order.user is nil, right? Is that what you're asking?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also the AddPaymentSourcesToWallet code is a no-op if order.user is nil.

Copy link
Contributor Author

@jordan-brough jordan-brough Mar 16, 2017

Choose a reason for hiding this comment

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

I also checked our permitted attrs and it looks like they prevent setting credit card defaults via the API so I don't think there should be a problem in that direction.

And the admin doesn't allow setting the default attribute either.

I'm not seeing any other code that tries to set the default on a credit card, other than the above items.

@jordan-brough jordan-brough added this to the 2.2.0 milestone Apr 5, 2017
Copy link
Contributor

@jhawthorn jhawthorn left a comment

Choose a reason for hiding this comment

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

Looks good to me

Copy link
Member

@tvdeyen tvdeyen left a comment

Choose a reason for hiding this comment

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

👍

@jhawthorn jhawthorn merged commit 7678e7e into solidusio:master Apr 7, 2017
@jordan-brough jordan-brough deleted the credit-card-wallet-fix branch April 10, 2017 19:05
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.

4 participants