Module: ActiveMerchant::Billing::Integrations::Alipay::Sign
- Included in:
- Notification, Return
- Defined in:
- lib/active_merchant/billing/integrations/alipay/sign.rb
Instance Method Summary collapse
Instance Method Details
#verify_sign ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/active_merchant/billing/integrations/alipay/sign.rb', line 9 def verify_sign sign_type = @params.delete("sign_type") sign = @params.delete("sign") md5_string = @params.sort.collect do |s| unless s[0] == "notify_id" s[0]+"="+CGI.unescape(s[1]) else s[0]+"="+s[1] end end Digest::MD5.hexdigest(md5_string.join("&")+KEY) == sign.downcase end |