Class: ActiveMerchant::Billing::PaypalExpressResponse

Inherits:
Response
  • Object
show all
Defined in:
lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb

Instance Attribute Summary

Attributes inherited from Response

#authorization, #avs_result, #cvv_result, #message, #params, #test

Instance Method Summary collapse

Methods inherited from Response

#fraud_review?, #initialize, #success?, #test?

Constructor Details

This class inherits a constructor from ActiveMerchant::Billing::Response

Instance Method Details

#addressObject



34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb', line 34

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

#contact_phoneObject

PayPal returns a contact telephone number only if your Merchant account profile settings require that the buyer enter one.



30
31
32
# File 'lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb', line 30

def contact_phone
  @params['ContactPhone']
end

#emailObject



4
5
6
# File 'lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb', line 4

def email
  info['Payer']
end

#infoObject



8
9
10
# File 'lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb', line 8

def info
  (@params['PayerInfo']||{})
end

#nameObject



12
13
14
15
# File 'lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb', line 12

def name
  payer = (info['PayerName']||{})
  [payer['FirstName'], payer['MiddleName'], payer['LastName']].compact.join(' ')
end

#payer_countryObject



25
26
27
# File 'lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb', line 25

def payer_country
  info['PayerCountry']
end

#payer_idObject



21
22
23
# File 'lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb', line 21

def payer_id
  info['PayerID']
end

#shippingObject



48
49
50
51
52
53
# File 'lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb', line 48

def shipping
  shipping = (@params['UserSelectedOptions']||{})
  {  'amount'   => shipping['ShippingOptionAmount'],
     'name'     => shipping['ShippingOptionName']
  }
end

#tokenObject



17
18
19
# File 'lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb', line 17

def token
  @params['Token']
end