Skip to content

Commit

Permalink
Merge pull request #123 from DanielePalombo/no-shippping-preference
Browse files Browse the repository at this point in the history
Add NO_SHIPPING to shipping preference
  • Loading branch information
DanielePalombo authored May 11, 2021
2 parents c558e60 + a0432ad commit 3a5f97d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/models/solidus_paypal_commerce_platform/payment_method.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ def javascript_sdk_url(order: nil, currency: nil)
currency: currency
}

parameters[:shipping_preference] = 'NO_SHIPPING' if step_names.exclude? 'delivery'

"https://www.paypal.com/sdk/js?#{parameters.to_query}"
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,14 @@ def Struct(data) # rubocop:disable Naming/MethodName
end
end

context 'when checkout_steps does not include "delivery"' do
let(:order) { instance_double(Spree::Order, checkout_steps: { "foo" => "bar" }) }

it 'disables autocommit' do
expect(url.query.split("&")).to include("shipping_preference=NO_SHIPPING")
end
end

context 'when messaging is turned on' do
let(:order) { instance_double(Spree::Order, checkout_steps: { "foo" => "bar" }) }

Expand Down

0 comments on commit 3a5f97d

Please sign in to comment.