Class: Google4R::Checkout::OrderStateChangeNotification
- Inherits:
-
Notification
- Object
- Notification
- Google4R::Checkout::OrderStateChangeNotification
- Defined in:
- lib/google4r/checkout/notifications.rb
Overview
GoogleCheckout sends
Instance Attribute Summary collapse
-
#new_financial_order_state ⇒ Object
The new financial state of the order (String, one of FinancialOrderState::*).
-
#new_fulfillment_order_state ⇒ Object
The new fulfillment state of the order (String, one of FulfillmentOrderState::*).
-
#previous_financial_order_state ⇒ Object
The previous financial state of the order (String, one of FinancialOrderState::*).
-
#previous_fulfillment_order_state ⇒ Object
The previous fulfillment state of the order (String, one of FulfillmentOrderState::*).
-
#reason ⇒ Object
The reason for the change (String, can be nil).
-
#tax_tables ⇒ Object
readonly
The tax tables for the items in the order notification.
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 OrderStateChangeNotification from an REXML::Element instance.
Instance Method Summary collapse
-
#timestamp=(time) ⇒ Object
Set the order's timestamp (Time).
Methods inherited from Notification
Constructor Details
This class inherits a constructor from Google4R::Checkout::Notification
Instance Attribute Details
#new_financial_order_state ⇒ Object
The new financial state of the order (String, one of FinancialOrderState::*).
246 247 248 |
# File 'lib/google4r/checkout/notifications.rb', line 246 def new_financial_order_state @new_financial_order_state end |
#new_fulfillment_order_state ⇒ Object
The new fulfillment state of the order (String, one of FulfillmentOrderState::*).
252 253 254 |
# File 'lib/google4r/checkout/notifications.rb', line 252 def new_fulfillment_order_state @new_fulfillment_order_state end |
#previous_financial_order_state ⇒ Object
The previous financial state of the order (String, one of FinancialOrderState::*).
243 244 245 |
# File 'lib/google4r/checkout/notifications.rb', line 243 def previous_financial_order_state @previous_financial_order_state end |
#previous_fulfillment_order_state ⇒ Object
The previous fulfillment state of the order (String, one of FulfillmentOrderState::*).
249 250 251 |
# File 'lib/google4r/checkout/notifications.rb', line 249 def previous_fulfillment_order_state @previous_fulfillment_order_state end |
#reason ⇒ Object
The reason for the change (String, can be nil).
255 256 257 |
# File 'lib/google4r/checkout/notifications.rb', line 255 def reason @reason end |
#tax_tables ⇒ Object (readonly)
The tax tables for the items in the order notification.
258 259 260 |
# File 'lib/google4r/checkout/notifications.rb', line 258 def tax_tables @tax_tables end |
Class Method Details
.create_from_element(element, frontend) ⇒ Object
Factory method that creates a new OrderStateChangeNotification from an REXML::Element instance. Use this to create instances of OrderStateChangeNotification.
Raises NoMethodError and RuntimeError exceptions if the given element misses required elements.
273 274 275 276 277 278 279 280 281 282 283 284 285 286 |
# File 'lib/google4r/checkout/notifications.rb', line 273 def self.create_from_element(element, frontend) result = OrderStateChangeNotification.new(frontend) result. = Time.parse(element.elements['timestamp'].text) result.serial_number = element.attributes['serial-number'] result.google_order_number = element.elements['google-order-number'].text result.new_financial_order_state = element.elements['new-financial-order-state'].text result.previous_financial_order_state = element.elements['previous-financial-order-state'].text result.new_fulfillment_order_state = element.elements['new-fulfillment-order-state'].text result.previous_fulfillment_order_state = element.elements['previous-fulfillment-order-state'].text result.reason = element.elements['reason'].text rescue nil return result end |
Instance Method Details
#timestamp=(time) ⇒ Object
Set the order's timestamp (Time). When the timestamp is set then the tax tables valid at the given point of time are set into the attribute tax tables from the frontend's tax_table_factory.
263 264 265 266 |
# File 'lib/google4r/checkout/notifications.rb', line 263 def (time) = time @tax_tables = frontend.tax_table_factory.effective_tax_tables_at(time) end |