class PayzaPayments::IpnHandler
Constants
- PRODUCTION_IPN
- SANDBOX_IPN
Public Class Methods
new(attributes = {})
click to toggle source
Calls superclass method
PayzaPayments::Base::new
# File lib/payza_payments/ipn_handler.rb, line 8 def initialize(attributes = {}) super end
Public Instance Methods
handle_ipn(params)
click to toggle source
# File lib/payza_payments/ipn_handler.rb, line 12 def handle_ipn(params) if params[:ap_securitycode] == self.ipn_security_code and params[:ap_merchant] == self.merchant_email true else false end end
handle_ipn_v2(token)
click to toggle source
# File lib/payza_payments/ipn_handler.rb, line 20 def handle_ipn_v2(token) validate_ipn(token) ? @response.parsed_response : 'INVALID REQUEST' end
Private Instance Methods
send_ipn_validation(token_value, url)
click to toggle source
# File lib/payza_payments/ipn_handler.rb, line 34 def send_ipn_validation(token_value, url) token = { token: token_value } @response = HTTParty.post(url, token) if @response.parsed_response == 'INVALID TOKEN' false else true end end
validate_ipn(token)
click to toggle source
# File lib/payza_payments/ipn_handler.rb, line 26 def validate_ipn(token) if PayzaPayments.sandbox? send_ipn_validation(token, SANDBOX_IPN) else send_ipn_validation(token, PRODUCTION_IPN) end end