Class: Google4R::Checkout::RiskInformationNotification

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

Overview

Google Checkout sends out <risk-information-notification> messages for fraud detection related information. See the Google Checkout documentation for more details: 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)



497
498
499
# File 'lib/google4r/checkout/notifications.rb', line 497

def avs_response
  @avs_response
end

#buyer_account_ageObject

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



509
510
511
# File 'lib/google4r/checkout/notifications.rb', line 509

def 
  
end

#buyer_billing_addressObject

The buyer’s billing address (Address).



494
495
496
# File 'lib/google4r/checkout/notifications.rb', line 494

def buyer_billing_address
  @buyer_billing_address
end

#cvn_responseObject

Credit verification value for the order (String)



500
501
502
# File 'lib/google4r/checkout/notifications.rb', line 500

def cvn_response
  @cvn_response
end

#eligible_for_protectionObject

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



491
492
493
# File 'lib/google4r/checkout/notifications.rb', line 491

def eligible_for_protection
  @eligible_for_protection
end

#ip_addressObject

The buyer’s IP address (String)



506
507
508
# File 'lib/google4r/checkout/notifications.rb', line 506

def ip_address
  @ip_address
end

#partial_card_numberObject

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



503
504
505
# File 'lib/google4r/checkout/notifications.rb', line 503

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.



516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
# File 'lib/google4r/checkout/notifications.rb', line 516

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