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, #emv_authorization, #error_code, #message, #network_transaction_id, #params, #test

Instance Method Summary collapse

Methods inherited from Response

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

Constructor Details

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

Instance Method Details

#addressObject



43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb', line 43

def address
  address = (details['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

#checkout_statusObject



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

def checkout_status
  (@params['CheckoutStatus']||{})
end

#contact_phoneObject

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



39
40
41
# File 'lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb', line 39

def contact_phone
  @params['ContactPhone']
end

#detailsObject



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

def details
  (@params['PaymentDetails']||{})
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



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

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

#noteObject



64
65
66
# File 'lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb', line 64

def note
  @params['note_text']
end

#payer_countryObject



33
34
35
# File 'lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb', line 33

def payer_country
  info['PayerCountry']
end

#payer_idObject



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

def payer_id
  info['PayerID']
end

#shippingObject



57
58
59
60
61
62
# File 'lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb', line 57

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

#tokenObject



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

def token
  @params['Token']
end