From 8b386ae164c6bb56815aef4214aaae4476cfc81f Mon Sep 17 00:00:00 2001 From: "Allison C. Reilly" Date: Wed, 8 Jun 2016 19:29:33 -0400 Subject: [PATCH] added preference for button source --- app/models/spree/gateway/pay_pal_express.rb | 3 ++- lib/spree_paypal_express/engine.rb | 6 ++++++ spec/models/pay_pal_express_spec.rb | 3 ++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/models/spree/gateway/pay_pal_express.rb b/app/models/spree/gateway/pay_pal_express.rb index f9086cb6..92a78178 100644 --- a/app/models/spree/gateway/pay_pal_express.rb +++ b/app/models/spree/gateway/pay_pal_express.rb @@ -45,7 +45,8 @@ def purchase(amount, express_checkout, gateway_options={}) :PaymentAction => "Sale", :Token => express_checkout.token, :PayerID => express_checkout.payer_id, - :PaymentDetails => pp_details_response.get_express_checkout_details_response_details.PaymentDetails + :PaymentDetails => pp_details_response.get_express_checkout_details_response_details.PaymentDetails, + :ButtonSource => Spree::Config.paypal_button_source } }) diff --git a/lib/spree_paypal_express/engine.rb b/lib/spree_paypal_express/engine.rb index e8473e97..c4329c87 100644 --- a/lib/spree_paypal_express/engine.rb +++ b/lib/spree_paypal_express/engine.rb @@ -22,5 +22,11 @@ def self.activate initializer "spree.paypal_express.payment_methods", :after => "spree.register.payment_methods" do |app| app.config.spree.payment_methods << Spree::Gateway::PayPalExpress end + + initializer "spree.paypal_express.preferences" do |app| + Spree::AppConfiguration.class_eval do + preference :paypal_button_source, :string + end + end end end diff --git a/spec/models/pay_pal_express_spec.rb b/spec/models/pay_pal_express_spec.rb index aa8808c4..edb9fad4 100644 --- a/spec/models/pay_pal_express_spec.rb +++ b/spec/models/pay_pal_express_spec.rb @@ -36,7 +36,8 @@ :PaymentAction => "Sale", :Token => "fake_token", :PayerID => "fake_payer_id", - :PaymentDetails => pp_details_response.get_express_checkout_details_response_details.PaymentDetails + :PaymentDetails => pp_details_response.get_express_checkout_details_response_details.PaymentDetails, + :ButtonSource => nil } }) end