Skip to content
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.

Fix Braintree checkout helpers #252

Merged
merged 2 commits into from
Oct 15, 2020
Merged

Conversation

MinasMazar
Copy link
Contributor

@MinasMazar MinasMazar commented Feb 27, 2020

This should fix #251

Using Spree::CheckoutController.helper and Spree::OrdersController.helper in config/initializers/braintree.rb to include helper modules does not work: at checkout/payement step an exception is raised

ActionView::Template::Error (undefined method `paypal_button_preference`)

This commit move paypal_button_preferences (introduced in #236) in the already present SolidusPaypalBraintree::BraintreeCheckoutHelper module.

The same is fix is done for the BraintreeAdminHelper module, which was affected by the same bug.

@MinasMazar MinasMazar force-pushed the mm/fix-helpers branch 3 times, most recently from 7ef9e2e to bde273c Compare March 6, 2020 17:58
@MinasMazar MinasMazar marked this pull request as ready for review March 13, 2020 09:37
Copy link
Member

@elia elia left a comment

Choose a reason for hiding this comment

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

Just one nit

if SolidusSupport.frontend_available?
Spree::CheckoutController.helper :braintree_checkout
Spree::OrdersController.helper :braintree_checkout
end
Copy link
Member

Choose a reason for hiding this comment

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

Can you deal with this in a separate PR?
Maybe check if the backend helper above can also be removed. 🙏

@seand7565
Copy link
Contributor

@MinasMazar Would you have some time to finish this PR? I'm starting to work on this repo a bit, and this is definitely a big issue! If not, just let me know - I can take over the excellent work done here. Thanks!

@MinasMazar MinasMazar force-pushed the mm/fix-helpers branch 2 times, most recently from 43ab3c5 to 776d244 Compare October 9, 2020 17:38
Flavio Auciello added 2 commits October 15, 2020 14:01
Ref. solidusio#251

Using `Spree::CheckoutController.helper` and
`Spree::OrdersController.helper` in `config/initializers/braintree.rb`
to include helper modules does not work: at `checkout/payement` step an
exception is raised

```
ActionView::Template::Error (undefined method `paypal_button_preference`)
```

This commit move `paypal_button_preferences` (introduced with [1]) in
the already present `SolidusPaypalBraintree::BraintreeCheckoutHelper`
module, and adds the same helper method to the
`Spree::OrdersController` (in the same way done here [2]) to enable
the button also in the cart page.

[1] solidusio#236
[2] solidusio@28d0de9
As for the frontend helper methods in the previous commit, using
`Spree::Admin::PaymentsController.helper` in
`config/initializers/braintree.rb` does not work: at `checkout/payement`
step an exception is raised.

```
ActionView::Template::Error (undefined method `braintree_transaction_link`)
```

This commit firstly move the helper module in the appropriate
namespace (i.e. `SolidusPaypalBraintree`), then inject into the
controller via a custom decorator. This way the exception is no longer raised.
@kennyadsl kennyadsl merged commit b8bef75 into solidusio:master Oct 15, 2020
@MinasMazar MinasMazar deleted the mm/fix-helpers branch April 2, 2021 05:48
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Paypal button preference helper not found
4 participants