Class: Google4R::Checkout::AuthorizationAmountNotification
- Inherits:
-
Notification
- Object
- Notification
- Google4R::Checkout::AuthorizationAmountNotification
- Defined in:
- lib/google4r/checkout/notifications.rb
Overview
Google Checkout sends an <authorization-amount-notification> in response to a successful request for an explicit credit card reauthorization. See the Google Checkout documentation for more details: code.google.com/apis/checkout/developer/index.html#authorization_amount_notification
Instance Attribute Summary collapse
-
#authorization_amount ⇒ Object
The amount that is reauthorized to be charged to the customer’s credit card (Money).
-
#authorization_expiration_date ⇒ Object
The time that a credit card authorization for an order expires.
-
#avs_response ⇒ Object
The address verification response (String).
-
#cvn_response ⇒ Object
Credit verification value for the order (String).
Attributes inherited from Notification
#frontend, #google_order_number, #serial_number, #timestamp
Class Method Summary collapse
-
.create_from_element(element, frontend) ⇒ Object
Factory method that creates a new AuthorizationAmountNotification from an REXML::Element instance.
Methods inherited from Notification
Constructor Details
This class inherits a constructor from Google4R::Checkout::Notification
Instance Attribute Details
#authorization_amount ⇒ Object
The amount that is reauthorized to be charged to the customer’s credit card (Money)
448 449 450 |
# File 'lib/google4r/checkout/notifications.rb', line 448 def @authorization_amount end |
#authorization_expiration_date ⇒ Object
The time that a credit card authorization for an order expires.
451 452 453 |
# File 'lib/google4r/checkout/notifications.rb', line 451 def @authorization_expiration_date end |
#avs_response ⇒ Object
The address verification response (String)
454 455 456 |
# File 'lib/google4r/checkout/notifications.rb', line 454 def avs_response @avs_response end |
#cvn_response ⇒ Object
Credit verification value for the order (String)
457 458 459 |
# File 'lib/google4r/checkout/notifications.rb', line 457 def cvn_response @cvn_response end |
Class Method Details
.create_from_element(element, frontend) ⇒ Object
Factory method that creates a new AuthorizationAmountNotification from an REXML::Element instance. Use this to create instances of AuthorizationAmountNotification.
Raises NoMethodError and RuntimeError exceptions if the given element misses required elements.
464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 |
# File 'lib/google4r/checkout/notifications.rb', line 464 def self.create_from_element(element, frontend) = AuthorizationAmountNotification.new(frontend) .serial_number = element.attributes['serial-number'] .google_order_number = element.elements['google-order-number'].text currency = element.elements['authorization-amount'].attributes['currency'] amount = (BigDecimal.new(element.elements['authorization-amount'].text)*100).to_i . = Money.new(amount, currency) . = Time.parse(element.elements['authorization-expiration-date'].text) .avs_response = element.elements['avs-response'].text .cvn_response = element.elements['cvn-response'].text . = Time.parse(element.elements['timestamp'].text) return end |