class PayPal::SDK::Core::API::IPN::Message

Attributes

message[RW]

Public Class Methods

new(message, env = nil, options = {}) click to toggle source
# File lib/paypal-sdk/core/api/ipn.rb, line 19
def initialize(message, env = nil, options = {})
  @message = message
  set_config(env, options)
end

Public Instance Methods

default_ipn_endpoint() click to toggle source

Default IPN end point

# File lib/paypal-sdk/core/api/ipn.rb, line 30
def default_ipn_endpoint
  endpoint = END_POINTS[(config.mode || :sandbox).to_sym] rescue nil
  endpoint || END_POINTS[:sandbox]
end
ipn_endpoint() click to toggle source

Fetch end point

# File lib/paypal-sdk/core/api/ipn.rb, line 25
def ipn_endpoint
  config.ipn_endpoint || default_ipn_endpoint
end
request() click to toggle source

Request IPN service for validating the content

Return

return http response object

# File lib/paypal-sdk/core/api/ipn.rb, line 38
def request
  uri  = URI(ipn_endpoint)
  query_string = "cmd=_notify-validate&#{message}"
  http_call(:method => :post, :uri => uri, :body => query_string)
end
valid?() click to toggle source

Validate the given content

Return

return true or false

# File lib/paypal-sdk/core/api/ipn.rb, line 47
def valid?
  request.body == VERIFIED
end