Module: Paypal::Config

Defined in:
lib/paypal/config.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.business_certObject

Returns the value of attribute business_cert.



5
6
7
# File 'lib/paypal/config.rb', line 5

def business_cert
  @business_cert
end

.business_cert_idObject

Returns the value of attribute business_cert_id.



5
6
7
# File 'lib/paypal/config.rb', line 5

def business_cert_id
  @business_cert_id
end

.business_keyObject

Returns the value of attribute business_key.



5
6
7
# File 'lib/paypal/config.rb', line 5

def business_key
  @business_key
end

.ipn_urlsObject

Returns the value of attribute ipn_urls.



5
6
7
# File 'lib/paypal/config.rb', line 5

def ipn_urls
  @ipn_urls
end

.modeObject

Returns the value of attribute mode.



5
6
7
# File 'lib/paypal/config.rb', line 5

def mode
  @mode
end

.paypal_production_certObject

Returns the value of attribute paypal_production_cert.



5
6
7
# File 'lib/paypal/config.rb', line 5

def paypal_production_cert
  @paypal_production_cert
end

.paypal_sandbox_certObject

Returns the value of attribute paypal_sandbox_cert.



5
6
7
# File 'lib/paypal/config.rb', line 5

def paypal_sandbox_cert
  @paypal_sandbox_cert
end

Class Method Details

.ipn_urlObject



22
23
24
# File 'lib/paypal/config.rb', line 22

def ipn_url
  ipn_urls[mode]
end

.ipn_validation_pathObject



26
27
28
# File 'lib/paypal/config.rb', line 26

def ipn_validation_path
  URI.parse(ipn_url).path + "?cmd=_notify-validate"
end

.ipn_validation_urlObject



30
31
32
# File 'lib/paypal/config.rb', line 30

def ipn_validation_url
"#{ipn_url}?cmd=_notify-validate"
end

.paypal_certObject



38
39
40
41
42
43
44
45
46
# File 'lib/paypal/config.rb', line 38

def paypal_cert
  case mode
  when :sandbox
    paypal_sandbox_cert
  when :production
    raise StandardError.new("You should set Paypal::Config.paypal_production_cert with your paypal production certificate") unless paypal_production_cert
    paypal_production_cert
  end
end