module PaypalSubscribe
Constants
- SHIPPING
Public Instance Methods
additional_values=(method)
click to toggle source
Extend config options which ever you want. See cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_Appx_websitestandard_htmlvariables
This has to be a lambda:
PaypalSubscribe.additional_values = ->(config) do
config[:modify] = value_for_modify return config end
# File lib/paypal-subscribe.rb, line 186 def additional_values=(method) unless method.is_a?(Proc) raise Errors::ArgumentError.new("Expected a proc (lambda) as argument.") else @@paypal_config_hash = method.call(@@paypal_config_hash) end end
no_note=(value)
click to toggle source
Do not prompt buyers to include a note with their payments.
# File lib/paypal-subscribe.rb, line 151 def no_note=(value) @@no_note = no_able(value) end
no_shipping=(value)
click to toggle source
Do not prompt buyers for a shipping address.
Allowable values are:
:address – prompt for an address, but do not require one :none - do not prompt for an address :required_address – prompt for an address, and require one
# File lib/paypal-subscribe.rb, line 163 def no_shipping=(value) @@no_shipping = SHIPPING[value] end
paypal_config()
click to toggle source
INTERNAL - Builds the form config hash
Returns a hash with all config options.
# File lib/paypal-subscribe.rb, line 197 def paypal_config exceptionals = {:success_callback => :return, :failure_callback => :cancel_return, :notify_callback => :notify_url} self.class_variables.each do |c_var| key = c_var.to_s.gsub("@@","").to_sym unless key.eql?(:paypal_config_hash) if exceptionals.keys.include?(key) key = exceptionals[key] end @@paypal_config_hash[key] = self.class_variable_get(c_var) end end return @@paypal_config_hash end
paypal_url()
click to toggle source
INTERNAL - Form url.
For production environment:
- https://www.paypal.com/cgi-bin/webscr
In any other environment it returns a sandbox link.
# File lib/paypal-subscribe.rb, line 36 def paypal_url if defined?(Rails.env) return Rails.env.eql?("production") ? @production_uri : @sandbox_uri else return @sandbox_uri end end
setup() { |self| ... }
click to toggle source
# File lib/paypal-subscribe.rb, line 213 def setup(&block) yield(self) end
sra=(value)
click to toggle source
# File lib/paypal-subscribe.rb, line 138 def sra=(value) @@sra = no_able(value) end
src=(value)
click to toggle source
# File lib/paypal-subscribe.rb, line 131 def src=(value) @@src = no_able(value) end
Private Instance Methods
no_able(value)
click to toggle source
# File lib/paypal-subscribe.rb, line 219 def no_able(value) return case value.class.name when "TrueClass" then 1 when "FalseClass" then 0 else value end end