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
# 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.
# 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.
# 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
# File lib/active_merchant/billing/integrations/notification.rb, line 26 26: def gross_cents 27: (gross.to_f * 100.0).round 28: end
# 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
# 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
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.
Generated with the Darkfish Rdoc Generator 1.1.6.