Sha256: fc35f4ef0e0063430565835883248cb79811f4e989fd6fd4aeaef91515990e54

Contents?: true

Size: 1.31 KB

Versions: 36

Compression:

Stored size: 1.31 KB

Contents

module ActiveMerchant #:nodoc:
  module Billing #:nodoc:
    class PaypalExpressResponse < Response
      def email
        info['Payer']
      end

      def info
        (@params['PayerInfo']||{})
      end
      
      def name
        payer = (info['PayerName']||{})
        [payer['FirstName'], payer['MiddleName'], payer['LastName']].compact.join(' ')
      end
      
      def token
        @params['Token']
      end
      
      def payer_id
        info['PayerID']
      end
      
      def payer_country
        info['PayerCountry']
      end
      
      # PayPal returns a contact telephone number only if your Merchant account profile settings require that the buyer enter one.
      def contact_phone
        @params['ContactPhone']
      end
      
      def address
        address = (@params['PaymentDetails']||{})['ShipToAddress']
        {  'name'       => address['Name'],
           'company'    => info['PayerBusiness'],
           'address1'   => address['Street1'],
           'address2'   => address['Street2'],
           'city'       => address['CityName'],
           'state'      => address['StateOrProvince'],
           'country'    => address['Country'],
           'zip'        => address['PostalCode'],
           'phone'      => (contact_phone || address['Phone'])
        }
      end
    end
  end
end

Version data entries

36 entries across 36 versions & 10 rubygems

Version Path
activemerchant-nsp-1.27.0 lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb
activemerchant-1.28.0 lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb
yetanothernguyen-activemerchant-1.21.2 lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb
activemerchant-1.27.0 lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb
yetanothernguyen-activemerchant-1.21.1 lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb
activemerchant-1.26.0 lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb
activemerchant-1.25.0 lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb
jelaniharris-activemerchant-1.24.1 lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb
activemerchant-1.24.0 lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb
tlconnor-activemerchant-1.23.3 lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb
tlconnor-activemerchant-1.23.2 lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb
tlconnor-activemerchant-1.23.1 lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb
tlconnor-activemerchant-1.23.0 lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb
activemerchant-1.23.0 lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb
activemerchant-1.22.0 lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb
yetanothernguyen-activemerchant-1.21.0 lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb
activemerchant-1.21.0 lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb
tlconnor-activemerchant-1.20.4 lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb
activemerchant-1.20.4 lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb
activemerchant-1.20.3 lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb