Module: Paypal::IPN

Defined in:
lib/paypal/ipn.rb

Class Method Summary collapse

Class Method Details

.endpointObject



3
4
5
6
7
8
9
# File 'lib/paypal/ipn.rb', line 3

def self.endpoint
  _endpoint_ = URI.parse Paypal.endpoint
  _endpoint_.query = {
    :cmd => '_notify-validate'
  }.to_query
  _endpoint_.to_s
end

.verify!(raw_post) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/paypal/ipn.rb', line 11

def self.verify!(raw_post)
  response = RestClient.post(
    endpoint, raw_post
  )
  case response.body
  when 'VERIFIED'
    true
  else
    raise Exception::APIError.new(response.body)
  end
end