Class: Google4R::Checkout::RiskInformationNotification

Inherits:
Notification
  • Object
show all
Defined in:
lib/google4r/checkout/notifications.rb

Overview

Google Checkout sends out messages for fraud detection related information. See the Google Checkout documentation for more details: http://code.google.com/apis/checkout/developer/index.html#risk_information_notification

Instance Attribute Summary collapse

Attributes inherited from Notification

#frontend, #google_order_number, #serial_number, #timestamp

Class Method Summary collapse

Methods inherited from Notification

#initialize

Constructor Details

This class inherits a constructor from Google4R::Checkout::Notification

Instance Attribute Details

#avs_responseObject

The address verification response (String)



453
454
455
# File 'lib/google4r/checkout/notifications.rb', line 453

def avs_response
  @avs_response
end

#buyer_account_ageObject

The age of the buyer's google checkout account in days



465
466
467
# File 'lib/google4r/checkout/notifications.rb', line 465

def 
  
end

#buyer_billing_addressObject

The buyer's billing address (Address).



450
451
452
# File 'lib/google4r/checkout/notifications.rb', line 450

def buyer_billing_address
  @buyer_billing_address
end

#cvn_responseObject

Credit verification value for the order (String)



456
457
458
# File 'lib/google4r/checkout/notifications.rb', line 456

def cvn_response
  @cvn_response
end

#eligible_for_protectionObject

Is the order eligible for Google Checkout's payment guarantee policy (boolean).



447
448
449
# File 'lib/google4r/checkout/notifications.rb', line 447

def eligible_for_protection
  @eligible_for_protection
end

#ip_addressObject

The buyer's IP address (String)



462
463
464
# File 'lib/google4r/checkout/notifications.rb', line 462

def ip_address
  @ip_address
end

#partial_card_numberObject

The last 4 digits of the credit card used to pay for the order (integer)



459
460
461
# File 'lib/google4r/checkout/notifications.rb', line 459

def partial_card_number
  @partial_card_number
end

Class Method Details

.create_from_element(element, frontend) ⇒ Object

Factory method that creates a new RiskInformationNotification from an REXML::Element instance. Use this to create instances of RiskInformationNotification

Raises NoMethodError and RuntimeError exceptions if the given element misses required elements.



472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
# File 'lib/google4r/checkout/notifications.rb', line 472

def self.create_from_element(element, frontend)
  risk = RiskInformationNotification.new(frontend)
  
  risk.serial_number = element.attributes['serial-number']
  risk.timestamp = Time.parse(element.elements['timestamp'].text)       
  risk.partial_card_number = element.elements['risk-information/partial-cc-number'].text
  risk.ip_address = element.elements['risk-information/ip-address'].text
  risk.google_order_number = element.elements['google-order-number'].text
  risk.eligible_for_protection = element.elements['risk-information/eligible-for-protection'].text == 'true'
  risk.cvn_response = element.elements['risk-information/cvn-response'].text
  risk.buyer_billing_address = Address.create_from_element(element.elements['risk-information/billing-address'])
  risk. = element.elements['risk-information/buyer-account-age'].text.to_i
  risk.avs_response = element.elements['risk-information/avs-response'].text

  return risk
end