From 32b70f70f587939a3f851844b6fa627c58b7909a Mon Sep 17 00:00:00 2001 From: smeevil Date: Thu, 19 Nov 2015 13:51:17 +0100 Subject: [PATCH 1/2] added support to add a shipping address to the sender options --- .../billing/gateways/paypal_adaptive_payment.rb | 11 +++++++++++ test/fixtures.example.yml | 9 +++++++++ 2 files changed, 20 insertions(+) diff --git a/lib/active_merchant/billing/gateways/paypal_adaptive_payment.rb b/lib/active_merchant/billing/gateways/paypal_adaptive_payment.rb index e7c7664..6802c4b 100644 --- a/lib/active_merchant/billing/gateways/paypal_adaptive_payment.rb +++ b/lib/active_merchant/billing/gateways/paypal_adaptive_payment.rb @@ -210,6 +210,17 @@ def build_adaptive_set_payment_options_request(opts) x.sharePhoneNumber opts[:sender][:share_phone_number] if opts[:sender][:share_phone_number] x.requireShippingAddressSelection opts[:sender][:require_shipping_address_selection] if opts[:sender][:require_shipping_address_selection] x.referrerCode opts[:sender][:referrerCode] if opts[:sender][:referrerCode] + if opts[:sender][:shipping_address] + x.shippingAddress do |x| + x.addresseeName opts[:sender][:shipping_address][:name] if opts[:sender][:shipping_address][:name] + x.street1 opts[:sender][:shipping_address][:street1] if opts[:sender][:shipping_address][:street1] + x.street2 opts[:sender][:shipping_address][:street2] if opts[:sender][:shipping_address][:street2] + x.city opts[:sender][:shipping_address][:city] if opts[:sender][:shipping_address][:city] + x.state opts[:sender][:shipping_address][:state] if opts[:sender][:shipping_address][:state] + x.zip opts[:sender][:shipping_address][:zip] if opts[:sender][:shipping_address][:zip] + x.country opts[:sender][:shipping_address][:country] if opts[:sender][:shipping_address][:country] + end + end end unless opts[:display_options].blank? x.displayOptions do |x| diff --git a/test/fixtures.example.yml b/test/fixtures.example.yml index f313343..776e2d8 100644 --- a/test/fixtures.example.yml +++ b/test/fixtures.example.yml @@ -19,3 +19,12 @@ pay_options: :return_url: http://example.com/return :cancel_url: http://example.com/cancel :receiver_list: *recipients + :sender_options: + :shipping_address: + :name: John + :street1: 17 Magneson St + :street2: building 1 + :city: San Jose + :state: CA + :zip: 12345 + :country: US From 6b51e0a15e7e5ba2b5fd96593d26d341944ba89a Mon Sep 17 00:00:00 2001 From: smeevil Date: Thu, 19 Nov 2015 14:04:37 +0100 Subject: [PATCH 2/2] updated the fixtures.example.yml --- .gitignore | 2 ++ test/fixtures.example.yml | 18 +++++++++--------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 7658e8f..69e3741 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,5 @@ Gemfile.lock *.gem TAGS diagram.txt +.bundle +vendor diff --git a/test/fixtures.example.yml b/test/fixtures.example.yml index 776e2d8..ae71b64 100644 --- a/test/fixtures.example.yml +++ b/test/fixtures.example.yml @@ -6,6 +6,15 @@ credentials: paydetails_options: pay_key: AP-49N53304XXkjh2374P + :sender: + :shipping_address: + :name: John + :street1: 17 Magneson St + :street2: building 1 + :city: San Jose + :state: CA + :zip: 12345 + :country: US recipients: &recipients - :email: seller_1313041935_biz@gmail.com @@ -19,12 +28,3 @@ pay_options: :return_url: http://example.com/return :cancel_url: http://example.com/cancel :receiver_list: *recipients - :sender_options: - :shipping_address: - :name: John - :street1: 17 Magneson St - :street2: building 1 - :city: San Jose - :state: CA - :zip: 12345 - :country: US