Parent

Class Index [+]

Quicksearch

ActiveMerchant::Billing::Integrations::Notification

Attributes

params[RW]
raw[RW]

Public Class Methods

new(post, options = {}) click to toggle 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

amount() click to toggle source

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

    # 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
empty!() click to toggle source

reset the notification.

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

the money amount we received in X.2 decimal.

    # 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
gross_cents() click to toggle source
    # File lib/active_merchant/billing/integrations/notification.rb, line 26
26:         def gross_cents
27:           (gross.to_f * 100.0).round
28:         end
status() click to toggle 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
valid_sender?(ip) click to toggle source

Check if the request comes from an official IP

    # 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

Private Instance Methods

parse(post) click to toggle source

Take the posted data and move the relevant data into a hash

    # File lib/active_merchant/billing/integrations/notification.rb, line 52
52:         def parse(post)
53:           @raw = post.to_s
54:           for line in @raw.split('&')    
55:             key, value = *line.scan( %{^([A-Za-z0-9_.]+)\=(.*)$} ).flatten
56:             params[key] = CGI.unescape(value)
57:           end
58:         end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.