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

Disable PayPal messaging when vault flow is enabled #278

Merged
merged 1 commit into from
Nov 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ The checkout view
[initializes the PayPal button](/lib/views/frontend/spree/checkout/payment/_paypal_braintree.html.erb)
using the
[Vault flow](https://developers.braintreepayments.com/guides/paypal/overview/javascript/v3),
which allows the source to be reused. If you want, you can use [Checkout with PayPal](https://developers.braintreepayments.com/guides/paypal/checkout-with-paypal/javascript/v3)
which allows the source to be reused. Please note that PayPal messaging is disabled with vault flow. If you want, you can use [Checkout with PayPal](https://developers.braintreepayments.com/guides/paypal/checkout-with-paypal/javascript/v3)
instead, which doesn't allow you to reuse sources but allows your customers to pay with their PayPal
balance and with PayPal financing options ([see setup instructions](#create-a-new-payment-method)).

Expand All @@ -190,7 +190,7 @@ render "spree/shared/paypal_cart_button"

### PayPal Financing Messaging

PayPal offers an [on-site messaging component](https://www.paypal.com/us/webapps/mpp/on-site-messaging) to notify the customer that there are financing options available. By default, this component is used in both the cart and checkout partials.
PayPal offers an [on-site messaging component](https://www.paypal.com/us/webapps/mpp/on-site-messaging) to notify the customer that there are financing options available. This component is included in both the cart and checkout partials, but is disabled by default. To enable this option, you'll need to use the `checkout` flow, and set the `paypal button messaging` option to `true` in your Braintree configuration.

You can also include this view partial to implement this messaging component anywhere - for instance, on the product page:
```ruby
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ SolidusPaypalBraintree.PaypalButton.prototype.initializeCallback = function() {
currency: this._paypalOptions.currency,
commit: true,
vault: this._paypalOptions.flow == "vault",
components: this.style['messaging'] == "true" ? "buttons,messages" : "buttons",
components: this.style['messaging'] == "true" && this._paypalOptions.flow != "vault" ? "buttons,messages" : "buttons",
intent: this._paypalOptions.flow == "vault" ? "tokenize" : "authorize"
}).then(() => {
var create_method = this._paypalOptions.flow == "vault" ? "createBillingAgreement" : "createOrder"
Expand Down
2 changes: 1 addition & 1 deletion app/models/solidus_paypal_braintree/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Configuration < ::Spree::Base
label: { availables: %w[checkout credit pay buynow paypal installment], default: 'checkout' },
tagline: { availables: %w[true false], default: 'false' },
layout: { availables: %w[horizontal vertical], default: 'horizontal' },
messaging: { availables: %w[true false], default: 'true' }
messaging: { availables: %w[true false], default: 'false' }
Copy link
Member

Choose a reason for hiding this comment

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

If it's disabled by default, should we explain in the readme how to enable messaging?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added this to the paypal financing messaging section:

To enable this option, you'll need to use the `checkout` flow, and set the `paypal button messaging` option to `true` in your Braintree configuration.

Does that work?

Copy link
Member

Choose a reason for hiding this comment

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

Oh right, sorry!

}.freeze

belongs_to :store, class_name: 'Spree::Store'
Expand Down