Class: ActiveMerchant::Billing::Integrations::Notification
- Inherits:
-
Object
- Object
- ActiveMerchant::Billing::Integrations::Notification
- Defined in:
- lib/active_merchant/billing/integrations/notification.rb
Direct Known Subclasses
Bogus::Notification, Chronopay::Notification, Gestpay::Notification, ActiveMerchant::Billing::Integrations::Nochex::Notification, Paypal::Notification
Instance Attribute Summary collapse
-
#params ⇒ Object
Returns the value of attribute params.
-
#raw ⇒ Object
Returns the value of attribute raw.
Instance Method Summary collapse
-
#amount ⇒ Object
This combines the gross and currency and returns a proper Money object.
-
#empty! ⇒ Object
reset the notification.
-
#gross ⇒ Object
the money amount we received in X.2 decimal.
- #gross_cents ⇒ Object
-
#initialize(post) ⇒ Notification
constructor
A new instance of Notification.
- #status ⇒ Object
Constructor Details
#initialize(post) ⇒ Notification
Returns a new instance of Notification.
8 9 10 11 |
# File 'lib/active_merchant/billing/integrations/notification.rb', line 8 def initialize(post) empty! parse(post) end |
Instance Attribute Details
#params ⇒ Object
Returns the value of attribute params.
5 6 7 |
# File 'lib/active_merchant/billing/integrations/notification.rb', line 5 def params @params end |
#raw ⇒ Object
Returns the value of attribute raw.
6 7 8 |
# File 'lib/active_merchant/billing/integrations/notification.rb', line 6 def raw @raw end |
Instance Method Details
#amount ⇒ Object
This combines the gross and currency and returns a proper Money object. this requires the money library located at dist.leetsoft.com/api/money
28 29 30 31 |
# File 'lib/active_merchant/billing/integrations/notification.rb', line 28 def amount return Money.new(gross_cents, currency) rescue ArgumentError return Money.new(gross_cents) # maybe you have an own money object which doesn't take a currency? end |
#empty! ⇒ Object
reset the notification.
34 35 36 37 |
# File 'lib/active_merchant/billing/integrations/notification.rb', line 34 def empty! @params = Hash.new @raw = "" end |
#gross ⇒ Object
the money amount we received in X.2 decimal.
18 19 20 |
# File 'lib/active_merchant/billing/integrations/notification.rb', line 18 def gross raise NotImplementedError, "Must implement this method in the subclass" end |
#gross_cents ⇒ Object
22 23 24 |
# File 'lib/active_merchant/billing/integrations/notification.rb', line 22 def gross_cents (gross.to_f * 100.0).round end |
#status ⇒ Object
13 14 15 |
# File 'lib/active_merchant/billing/integrations/notification.rb', line 13 def status raise NotImplementedError, "Must implement this method in the subclass" end |