Module: Alipay::Notify
- Defined in:
- lib/alipay/notify.rb
Class Method Summary collapse
Class Method Details
.verify?(params, options = {}) ⇒ Boolean
3 4 5 6 7 |
# File 'lib/alipay/notify.rb', line 3 def self.verify?(params, = {}) params = Utils.stringify_keys(params) pid = [:pid] || Alipay.pid Sign.verify?(params, ) && verify_notify_id?(pid, params['notify_id']) end |
.verify_notify_id?(pid, notify_id) ⇒ Boolean
9 10 11 12 13 14 15 16 17 |
# File 'lib/alipay/notify.rb', line 9 def self.verify_notify_id?(pid, notify_id) uri = URI("https://mapi.alipay.com/gateway.do") uri.query = URI.encode_www_form( 'service' => 'notify_verify', 'partner' => pid, 'notify_id' => notify_id ) Net::HTTP.get(uri) == 'true' end |