Permalink
Browse files

added billing info to response

  • Loading branch information...
1 parent 45723c5 commit 66b9bc8ef8bab72520f2aa012a9947ebd114450a @benalexander committed Nov 27, 2011
Showing with 22 additions and 1 deletion.
  1. +1 −0 lib/paypal.rb
  2. +14 −1 lib/paypal/nvp/response.rb
  3. +7 −0 lib/paypal/payment/response/billing_info.rb
View
@@ -76,6 +76,7 @@ def self.sandbox=(boolean)
require 'paypal/payment/response/reference'
require 'paypal/payment/response/refund'
require 'paypal/payment/response/ship_to'
+require 'paypal/payment/response/billing_info'
require 'paypal/payment/recurring'
require 'paypal/payment/recurring/activation'
require 'paypal/payment/recurring/billing'
View
@@ -19,7 +19,7 @@ class Response < Base
}
attr_accessor *@@attribute_mapping.values
attr_accessor :shipping_options_is_default, :success_page_redirect_requested, :insurance_option_selected
- attr_accessor :amount, :description, :ship_to, :payer, :recurring, :billing_agreement, :refund
+ attr_accessor :amount, :description, :ship_to, :payer, :billing_info, :recurring, :billing_agreement, :refund
attr_accessor :payment_responses, :payment_info, :items
def initialize(attributes = {})
@@ -61,6 +61,19 @@ def initialize(attributes = {})
:email => attrs.delete(:EMAIL)
)
end
+ if attrs[:BILLINGNAME]
+ @billing_info = Payment::Response::BillingInfo.new(
+ :name => attrs.delete(:BILLINGNAME),
+ :street => attrs.delete(:STREET),
+ :city => attrs.delete(:CITY),
+ :state => attrs.delete(:STATE),
+ :zip => attrs.delete(:ZIP),
+ :country => attrs.delete(:COUNTRY),
+ :countryname => attrs.delete(:COUNTRYNAME),
+ :address_id => attrs.delete(:ADDRESSID)
+ )
+ Paypal.log @billing
+ end
if attrs[:PROFILEID]
@recurring = Payment::Recurring.new(
:identifier => attrs.delete(:PROFILEID),
@@ -0,0 +1,7 @@
+module Paypal
+ module Payment
+ class Response::BillingInfo < Base
+ attr_optional :name, :street, :city, :state, :zip, :country, :countryname, :address_id
+ end
+ end
+end

0 comments on commit 66b9bc8

Please sign in to comment.