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
|
# File 'lib/chan_pay/api/quick_draw.rb', line 11
def quick_draw(flow_id,
bank_business_name, card_id, true_name,
money,
business_type='0')
params = {
:TransCode => 'T10000',
:OutTradeNo => flow_id,
:BusinessType => business_type, :BankCommonName => bank_business_name,
:AcctNo => card_id,
:AcctName => true_name,
:TransAmt => money,
}
puts "\n[#{SERVICE_NAME}] 请求参数为:\n#{params.inspect}"
params[:AcctNo] = Encrypt::RSA.encrypt(@public_key, card_id)
params[:AcctName] = Encrypt::RSA.encrypt(@public_key, true_name)
response = Http.post(@partner_id, @private_key, @public_key, @server_uri, SERVICE_NAME, params)
res = {
result: 'P', msg: response[:OriginalErrorMessage],
ret_code: response[:OriginalRetCode],
flow_id: flow_id,
vendor_order_id: response[:FlowNo],
log: [params.to_json, response.to_json],
}
if response[:AcceptStatus] == 'F' || (response[:AcceptStatus] == 'S' && Http::OriginalRetCode.quick_draw_fail?(response[:OriginalRetCode]))
res[:result] = 'F'
end
if response[:AcceptStatus] == 'S' && Http::OriginalRetCode.success?(response[:OriginalRetCode])
res[:result] = 'S'
end
res
end
|