Sha256: a19b2bd4f4fa301caa86b4bf4dd2800348cbe7963ac0054e301e47b7f5436b1a
Contents?: true
Size: 673 Bytes
Versions: 1
Compression:
Stored size: 673 Bytes
Contents
module JaslTenpay class Notify GATEWAY = 'https://gw.tenpay.com/gateway/simpleverifynotifyid.xml' SUCCESS_STR = '<retcode>0</retcode>' TRADE_STATE_SUCCESS_STR = '<trade_state>0</trade_state>' def self.verify?(params, options = {}) return false unless Sign.verify?(params) params = { 'input_charset' => 'UTF-8', 'partner' => JaslTenpay.pid, 'notify_id' => CGI.escape(params[:notify_id].to_s) } result = open("#{GATEWAY}?#{Utils.make_query_string(params)}").read result.include?(SUCCESS_STR) && (options[:verify_trade_state] ? result.include?(TRADE_STATE_SUCCESS_STR) : true) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
jasl_tenpay-1.0.2 | lib/jasl_tenpay/notify.rb |