reapal 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/lib/reapal.rb +2 -0
- data/lib/reapal/api/asset/tender_all_cancel.rb +64 -0
- data/lib/reapal/api/asset/tender_apply.rb +81 -0
- data/lib/reapal/api/asset/tender_auth_cancel.rb +66 -0
- data/lib/reapal/api/asset/tender_auth_query.rb +64 -0
- data/lib/reapal/api/asset/tender_finish.rb +78 -0
- data/lib/reapal/api/asset/tender_repayment_complete.rb +75 -0
- data/lib/reapal/api/asset/tender_repayment_project.rb +70 -0
- data/lib/reapal/api/error_codes.rb +46 -0
- data/lib/reapal/api/money/.keep +0 -0
- data/lib/reapal/api/order/.keep +0 -0
- data/lib/reapal/api/user/balance_query.rb +61 -0
- data/lib/reapal/api/user/bank_card_add_sms.rb +71 -0
- data/lib/reapal/api/user/bank_card_add_sms_again.rb +62 -0
- data/lib/reapal/api/user/bank_card_add_sms_confirm.rb +61 -0
- data/lib/reapal/api/user/bind_card_query.rb +67 -0
- data/lib/reapal/api/user/contract_query.rb +18 -0
- data/lib/reapal/api/user/mobile_query.rb +56 -0
- data/lib/reapal/api/{trust → user}/onekey_batch_contract.rb +8 -26
- data/lib/reapal/api/user/onekey_contract.rb +61 -0
- data/lib/reapal/api/user/undo_bind_bank_card.rb +60 -0
- data/lib/reapal/client.rb +6 -0
- data/lib/reapal/form/business_auth_form.rb +61 -0
- data/lib/reapal/form/find_trade_password_form.rb +48 -0
- data/lib/reapal/form/mobile_modify_form.rb +50 -0
- data/lib/reapal/form/signle_tender_transfer_form.rb +72 -0
- data/lib/reapal/form/tender_invest_form.rb +62 -0
- data/lib/reapal/form/tender_refund_form.rb +84 -0
- data/lib/reapal/form/withdraw_apply_form.rb +54 -0
- data/lib/reapal/http/communicate.rb +45 -20
- data/lib/reapal/http/response.rb +21 -0
- data/lib/reapal/utils.rb +16 -0
- data/lib/reapal/version.rb +1 -1
- metadata +29 -9
- data/lib/reapal/api/trust/balance_query.rb +0 -58
- data/lib/reapal/api/trust/contract_query.rb +0 -35
- data/lib/reapal/api/trust/find_trade_password.rb +0 -41
- data/lib/reapal/api/trust/mobile_modify.rb +0 -42
- data/lib/reapal/api/trust/onekey_contract.rb +0 -77
- data/lib/reapal/api/trust/withdraw_apply.rb +0 -44
@@ -1,58 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
module Reapal
|
4
|
-
module Api
|
5
|
-
module Agreement
|
6
|
-
module BalanceQuery
|
7
|
-
|
8
|
-
# 1.6 查询余额(API)
|
9
|
-
#
|
10
|
-
# @param contracts [ String ] 用户协议号
|
11
|
-
#
|
12
|
-
# @return [ Hash ] 结果集
|
13
|
-
# * :success [bool] 查询结果是否有效
|
14
|
-
# * :data [Hash] 成功数据
|
15
|
-
# * :total_amount [BigDecimal] 账户总额
|
16
|
-
# * :usable_amount [BigDecimal] 可用金额
|
17
|
-
# * :tender_amount [BigDecimal] 投标金额
|
18
|
-
#
|
19
|
-
def balance_query(contracts)
|
20
|
-
service = 'reapal.trust.balanceQuery'
|
21
|
-
post_path = '/reagw/agreement/agreeApi.htm'
|
22
|
-
|
23
|
-
params = {
|
24
|
-
contracts: contracts,
|
25
|
-
applyTime: Time.now.strftime('%Y-%m-%d %H:%M:%S'),
|
26
|
-
}
|
27
|
-
|
28
|
-
response = Http.post(service, params, @config, post_path)
|
29
|
-
|
30
|
-
# 如果数据不合法
|
31
|
-
unless response.data_valid
|
32
|
-
return {success: false}
|
33
|
-
end
|
34
|
-
|
35
|
-
# 如果网络出错,包括超时或者非200类数据
|
36
|
-
unless response.http_response.kind_of?(Net::HTTPSuccess)
|
37
|
-
return {success: false}
|
38
|
-
end
|
39
|
-
|
40
|
-
# 如果 api 出异常
|
41
|
-
if response.data[:errorCode]
|
42
|
-
return {success: false}
|
43
|
-
end
|
44
|
-
|
45
|
-
{
|
46
|
-
success: true,
|
47
|
-
data: {
|
48
|
-
total_amount: response.data[:totalAmount].to_d,
|
49
|
-
usable_amount: response.data[:usableAmount].to_d,
|
50
|
-
tender_amount: response.data[:tenderAmount].to_d,
|
51
|
-
}
|
52
|
-
}
|
53
|
-
end
|
54
|
-
|
55
|
-
end # module Agree
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
module Reapal
|
4
|
-
module Api
|
5
|
-
module Trust
|
6
|
-
module ContractQuery
|
7
|
-
|
8
|
-
# 1.5 签约查询,支持个人和企业(API)
|
9
|
-
#
|
10
|
-
# @param ori_flow_id [ String ] 原订单号
|
11
|
-
#
|
12
|
-
# @return [ Hash ] 结果集
|
13
|
-
# * :result [String] "S"/"F"/"P"
|
14
|
-
# * :error_msg [String] 错误提示
|
15
|
-
# * :data [Hash] 成功数据,解析和【个人签约API】/【企业签约API】一致
|
16
|
-
#
|
17
|
-
def contract_query(ori_flow_id)
|
18
|
-
# TODO(tony): 目前我们只用个人签约,个人签约都是同步返回,所以先不做实现
|
19
|
-
raise "Not Implement"
|
20
|
-
|
21
|
-
# service = 'reapal.trust.contractQuery'
|
22
|
-
# post_path = '/reagw/agreement/agreeApi.htm'
|
23
|
-
|
24
|
-
# params = {
|
25
|
-
# orderNo: ori_flow_id,
|
26
|
-
# applyTime: Time.now.strftime('%Y-%m-%d %H:%M:%S'),
|
27
|
-
# }
|
28
|
-
|
29
|
-
# response = Http.post(service, params, @config, post_path)
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,41 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
module Reapal
|
4
|
-
module Api
|
5
|
-
module Trust
|
6
|
-
module FindTradePassowrd
|
7
|
-
|
8
|
-
# 1.9 设置/修改交易密码
|
9
|
-
#
|
10
|
-
# @param
|
11
|
-
#
|
12
|
-
# @return [ Hash ] 结果集
|
13
|
-
# * :merchant_id
|
14
|
-
# * :encryptkey
|
15
|
-
# * :data
|
16
|
-
# * :url
|
17
|
-
# * :method
|
18
|
-
#
|
19
|
-
def find_trade_password(contracts, returnUrl, notifyUrl, busway='01')
|
20
|
-
service = 'reapal.trust.findTradePassword'
|
21
|
-
post_path = '/reagw/findTradePassword/findTradePassword.htm'
|
22
|
-
|
23
|
-
params = {
|
24
|
-
contracts: contracts,
|
25
|
-
busway: busway,
|
26
|
-
returnUrl: returnUrl,
|
27
|
-
notifyUrl: notifyUrl,
|
28
|
-
applyTime: Time.now.strftime('%Y-%m-%d %H:%M:%S'),
|
29
|
-
}
|
30
|
-
|
31
|
-
request = Http.get_body(service, params, @config)
|
32
|
-
request[:method] = :post
|
33
|
-
request[:url] = config[:server_url] + post_path
|
34
|
-
|
35
|
-
request
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
module Reapal
|
4
|
-
module Api
|
5
|
-
module Trust
|
6
|
-
module MobileModify
|
7
|
-
|
8
|
-
# 1.7 签约手机号修改
|
9
|
-
#
|
10
|
-
# @param
|
11
|
-
#
|
12
|
-
# @return [ Hash ] 结果集
|
13
|
-
# * :merchant_id
|
14
|
-
# * :encryptkey
|
15
|
-
# * :data
|
16
|
-
# * :url
|
17
|
-
# * :method
|
18
|
-
#
|
19
|
-
def mobile_modify(contracts, new_phone, busway='01')
|
20
|
-
service = 'reapal.trust.mobileModify'
|
21
|
-
post_path = '/reagw/user/rest.htm'
|
22
|
-
|
23
|
-
params = {
|
24
|
-
contracts: contracts,
|
25
|
-
mobile: new_phone,
|
26
|
-
busway: busway,
|
27
|
-
returnUrl: '',
|
28
|
-
notifyUrl: '',
|
29
|
-
applyTime: Time.now.strftime('%Y-%m-%d %H:%M:%S'),
|
30
|
-
}
|
31
|
-
|
32
|
-
request = Http.get_body(service, params, @config)
|
33
|
-
request[:method] = :post
|
34
|
-
request[:url] = config[:server_url] + post_path
|
35
|
-
|
36
|
-
request
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
@@ -1,77 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
module Reapal
|
4
|
-
module Api
|
5
|
-
module Trust
|
6
|
-
module OnekeyContract
|
7
|
-
|
8
|
-
# 1.2 个人一键签约(API)
|
9
|
-
#
|
10
|
-
# @param flow_id [ String ] 订单号
|
11
|
-
# @param true_name [ String ] 真实姓名
|
12
|
-
# @param identity_id [ String ] 身份证号
|
13
|
-
# @param phone [ String ] 手机号
|
14
|
-
# @param bus_way [ String ] 00:PC端;01:手机端;02:Pad端;03:其它
|
15
|
-
#
|
16
|
-
# @return [ Hash ] 结果集
|
17
|
-
# * :result [String] "S"/"F"/"P"
|
18
|
-
# * :error_msg [String] 错误提示
|
19
|
-
# * :error_code [String] 融宝的错误编号
|
20
|
-
# * :data [Hash] 成功数据,返回的数据不一定是上送数据,比如手机号。所以要以返回数据为准
|
21
|
-
# * :contracts [String] 用户签约协议号
|
22
|
-
# * :userName [String] 姓名
|
23
|
-
# * :userIdentity [String] 身份证
|
24
|
-
# * :userMobile [String] 手机号
|
25
|
-
#
|
26
|
-
def onekey_contract(flow_id, true_name, identity_id, phone, bus_way='01')
|
27
|
-
service = 'reapal.trust.onekeyContract'
|
28
|
-
post_path = '/reagw/agreement/agree.htm'
|
29
|
-
|
30
|
-
params = {
|
31
|
-
orderNo: flow_id,
|
32
|
-
userName: true_name,
|
33
|
-
userIdentity: identity_id,
|
34
|
-
userMobile: phone,
|
35
|
-
busway: bus_way,
|
36
|
-
remark: '',
|
37
|
-
applyTime: Time.now.strftime('%Y-%m-%d %H:%M:%S'),
|
38
|
-
}
|
39
|
-
|
40
|
-
response = Http.post(service, params, @config, post_path)
|
41
|
-
|
42
|
-
error_result = {
|
43
|
-
data: nil,
|
44
|
-
result: "F",
|
45
|
-
error_msg: "未知错误",
|
46
|
-
}
|
47
|
-
|
48
|
-
# 如果数据不合法
|
49
|
-
unless response.data_valid
|
50
|
-
error_result[:error_msg] = "返回数据不合法"
|
51
|
-
return error_result
|
52
|
-
end
|
53
|
-
|
54
|
-
# 如果网络出错,包括超时或者非200类数据
|
55
|
-
unless response.http_response.kind_of?(Net::HTTPSuccess)
|
56
|
-
error_result[:error_msg] = "网络出错"
|
57
|
-
return error_result
|
58
|
-
end
|
59
|
-
|
60
|
-
# 个人签约只有返回码是 '0000', '0007' 才成功
|
61
|
-
if ['0000', '0007'].include?(response.data[:resultCode])
|
62
|
-
return {
|
63
|
-
data: response.data,
|
64
|
-
result: "S",
|
65
|
-
error_msg: nil,
|
66
|
-
}
|
67
|
-
else
|
68
|
-
error_result[:error_code] = response.data[:errorCode]
|
69
|
-
error_result[:error_msg] = response.data[:errorMsg]
|
70
|
-
return error_result
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
end # module Agree
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
module Reapal
|
4
|
-
module Api
|
5
|
-
module Trust
|
6
|
-
module WithdrawApply
|
7
|
-
|
8
|
-
# 2.7 提现申请
|
9
|
-
#
|
10
|
-
# @param
|
11
|
-
#
|
12
|
-
# @return [ Hash ] 结果集
|
13
|
-
# * :merchant_id
|
14
|
-
# * :encryptkey
|
15
|
-
# * :data
|
16
|
-
# * :url
|
17
|
-
# * :method
|
18
|
-
#
|
19
|
-
def withdraw_apply(contracts, flow_id, money, charge, busway='01')
|
20
|
-
service = 'reapal.trust.withdrawApply'
|
21
|
-
post_path = '/reagw/service/withdraw.htm'
|
22
|
-
|
23
|
-
params = {
|
24
|
-
orderNo: flow_id,
|
25
|
-
contracts: contracts,
|
26
|
-
amount: money,
|
27
|
-
charge: charge,
|
28
|
-
busway: busway,
|
29
|
-
returnUrl: '',
|
30
|
-
notifyUrl: '',
|
31
|
-
applyTime: Time.now.strftime('%Y-%m-%d %H:%M:%S'),
|
32
|
-
}
|
33
|
-
|
34
|
-
request = Http.get_body(service, params, @config)
|
35
|
-
request[:method] = :post
|
36
|
-
request[:url] = config[:server_url] + post_path
|
37
|
-
|
38
|
-
request
|
39
|
-
end
|
40
|
-
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|