Class ActiveMerchant::Billing::Integrations::Notification
In: lib/active_merchant/billing/integrations/notification.rb
Parent: Object

Methods

amount   empty!   gross   gross_cents   new   status   valid_sender?  

Attributes

params  [RW] 
raw  [RW] 

Public Class methods

[Source]

    # File lib/active_merchant/billing/integrations/notification.rb, line 11
11:         def initialize(post, options = {})
12:           @options = options
13:           empty!
14:           parse(post)
15:         end

Public Instance methods

This combines the gross and currency and returns a proper Money object. this requires the money library located at dist.leetsoft.com/api/money

[Source]

    # File lib/active_merchant/billing/integrations/notification.rb, line 32
32:         def amount
33:           return Money.new(gross_cents, currency) rescue ArgumentError
34:           return Money.new(gross_cents) # maybe you have an own money object which doesn't take a currency?
35:         end

reset the notification.

[Source]

    # File lib/active_merchant/billing/integrations/notification.rb, line 38
38:         def empty!
39:           @params  = Hash.new
40:           @raw     = ""      
41:         end

the money amount we received in X.2 decimal.

[Source]

    # File lib/active_merchant/billing/integrations/notification.rb, line 22
22:         def gross
23:           raise NotImplementedError, "Must implement this method in the subclass"
24:         end

[Source]

    # File lib/active_merchant/billing/integrations/notification.rb, line 26
26:         def gross_cents
27:           (gross.to_f * 100.0).round
28:         end

[Source]

    # File lib/active_merchant/billing/integrations/notification.rb, line 17
17:         def status
18:           raise NotImplementedError, "Must implement this method in the subclass"
19:         end

Check if the request comes from an official IP

[Source]

    # File lib/active_merchant/billing/integrations/notification.rb, line 44
44:         def valid_sender?(ip)
45:           return true if ActiveMerchant::Billing::Base.integration_mode == :test || production_ips.blank?
46:           production_ips.include?(ip)
47:         end

[Validate]