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-1.20.2 lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb
activemerchant-1.20.1 lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb
activemerchant-1.20.0 lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb
vibedeck-activemerchant-1.18.2 lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb
activemerchant-1.18.1 lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb
fishman-activemerchant-1.18.0 lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb
activemerchant-1.18.0 lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb
activemerchant-1.17.0 lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb
yetanothernguyen-activemerchant-1.16.0 lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb
activemerchant-1.16.0 lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb
gonow-activemerchant-1.15.0 lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb
bitfluent-activemerchant-1.15.1 lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb
activemerchant-kiddy-1.15.0.kiddy.1 lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb
activemerchant-kiddy-1.15.0.kiddy lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb
activemerchant-1.15.0 lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb
activemerchant-1.14.0 lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb