/
query_response.rb
66 lines (66 loc) · 1.64 KB
/
query_response.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# -*- encoding : utf-8 -*-
module Tencentpay
class QueryResponse #
# def initialize(response)
# @body = response
# end
#
# def valid?
# sign == Digest::MD5.hexdigest(sign_params).upcase
# end
#
# def successful?
# valid? && pay_result == '0'
# end
#
# def doc
# @doc ||= Hpricot(@body)
# end
#
# def attach
# @attach ||= (doc / 'attach').inner_text
# end
#
# def cmdno
# @cmdno ||= (doc / 'cmdno').inner_text
# end
#
# def date
# @date ||= (doc / 'date').inner_text
# end
#
# def fee_type
# @fee_type ||= (doc / 'fee_type').inner_text
# end
#
# def pay_info
# @pay_info ||= (doc / 'pay_info').inner_text
# end
#
# def pay_result
# @pay_result ||= (doc / 'pay_result').inner_text
# end
#
# def order_id
# @order_id ||= (doc / 'sp_billno').inner_text
# end
#
# def total_fee
# @total_fee ||= (doc / 'total_fee').inner_text
# end
#
# def transaction_id
# @transaction_id ||= (doc / 'transaction_id').inner_text
# end
#
# def sign
# @sign ||= (doc / 'sign').inner_text
# end
# private
# def sign_params
# "attach=#{attach}&bargainor_id=#{Tenpay::Config.spid}&cmdno=#{cmdno}&date=#{date}&fee_type=#{fee_type}" +
# "&pay_info=#{pay_info}&pay_result=#{pay_result}&sp_billno=#{order_id}&total_fee=#{total_fee}&" +
# "transaction_id=#{transaction_id}&key=#{Tenpay::Config.key}"
# end
end
end