Class: ActiveMerchant::Billing::Integrations::Tenpay::Return
- Inherits:
-
Return
- Object
- Return
- ActiveMerchant::Billing::Integrations::Tenpay::Return
- Defined in:
- lib/active_merchant/billing/integrations/tenpay/return.rb
Instance Method Summary collapse
Instance Method Details
#account ⇒ Object
9 10 11 |
# File 'lib/active_merchant/billing/integrations/tenpay/return.rb', line 9 def account @params["bargainor_id"] end |
#amount ⇒ Object
17 18 19 |
# File 'lib/active_merchant/billing/integrations/tenpay/return.rb', line 17 def amount @params["total_fee"] end |
#message ⇒ Object
40 41 42 |
# File 'lib/active_merchant/billing/integrations/tenpay/return.rb', line 40 def @message || @params['pay_info'] end |
#order ⇒ Object
13 14 15 |
# File 'lib/active_merchant/billing/integrations/tenpay/return.rb', line 13 def order @params["sp_billno"] end |
#success? ⇒ Boolean
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/active_merchant/billing/integrations/tenpay/return.rb', line 21 def success? return false unless @params["pay_info"] == "OK" && @params["pay_result"] == "0" unless account == ACCOUNT @message = "Tenpay Error: INCORRECT_ACCOUNT" return false end hash_keys = %w(cmdno pay_result date transaction_id sp_billno total_fee fee_type attach) md5_string = hash_keys.inject([]){|array, key| array << "#{key}=#{@params[key]}"}.join("&") unless Digest::MD5.hexdigest(md5_string+"&key=#{KEY}") == @params["sign"].downcase @message = "Tenpay Error: ILLEGAL_SIGN" return false end return true end |