Sha256: f8cfc903f12ff1a15c63ed7acc8a6b4062895da62899f7a6635c119a82b6ffbc

Contents?: true

Size: 551 Bytes

Versions: 19

Compression:

Stored size: 551 Bytes

Contents

module Alipay
  module Notify
    def self.verify?(params, options = {})
      params = Utils.stringify_keys(params)
      pid = options[:pid] || Alipay.pid
      Sign.verify?(params, options) && verify_notify_id?(pid, params['notify_id'])
    end

    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
  end
end

Version data entries

19 entries across 19 versions & 2 rubygems

Version Path
alipay-0.17.0 lib/alipay/notify.rb
alipay-0.16.0 lib/alipay/notify.rb
alipay-0.15.2 lib/alipay/notify.rb
alipay-0.15.1 lib/alipay/notify.rb
alipay-0.15.0 lib/alipay/notify.rb
yl_alipay-0.15.3 lib/alipay/notify.rb
yl_alipay-0.15.2 lib/alipay/notify.rb
alipay-0.14.0 lib/alipay/notify.rb
alipay-0.13.0 lib/alipay/notify.rb
alipay-0.12.0 lib/alipay/notify.rb
alipay-0.11.0 lib/alipay/notify.rb
alipay-0.10.0 lib/alipay/notify.rb
alipay-0.9.0 lib/alipay/notify.rb
alipay-0.8.0 lib/alipay/notify.rb
alipay-0.7.1 lib/alipay/notify.rb
alipay-0.7.0 lib/alipay/notify.rb
alipay-0.6.0 lib/alipay/notify.rb
alipay-0.6.0.beta3 lib/alipay/notify.rb
alipay-0.6.0.beta2 lib/alipay/notify.rb