reapal 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -0
  3. data/lib/reapal.rb +2 -0
  4. data/lib/reapal/api/asset/tender_all_cancel.rb +64 -0
  5. data/lib/reapal/api/asset/tender_apply.rb +81 -0
  6. data/lib/reapal/api/asset/tender_auth_cancel.rb +66 -0
  7. data/lib/reapal/api/asset/tender_auth_query.rb +64 -0
  8. data/lib/reapal/api/asset/tender_finish.rb +78 -0
  9. data/lib/reapal/api/asset/tender_repayment_complete.rb +75 -0
  10. data/lib/reapal/api/asset/tender_repayment_project.rb +70 -0
  11. data/lib/reapal/api/error_codes.rb +46 -0
  12. data/lib/reapal/api/money/.keep +0 -0
  13. data/lib/reapal/api/order/.keep +0 -0
  14. data/lib/reapal/api/user/balance_query.rb +61 -0
  15. data/lib/reapal/api/user/bank_card_add_sms.rb +71 -0
  16. data/lib/reapal/api/user/bank_card_add_sms_again.rb +62 -0
  17. data/lib/reapal/api/user/bank_card_add_sms_confirm.rb +61 -0
  18. data/lib/reapal/api/user/bind_card_query.rb +67 -0
  19. data/lib/reapal/api/user/contract_query.rb +18 -0
  20. data/lib/reapal/api/user/mobile_query.rb +56 -0
  21. data/lib/reapal/api/{trust → user}/onekey_batch_contract.rb +8 -26
  22. data/lib/reapal/api/user/onekey_contract.rb +61 -0
  23. data/lib/reapal/api/user/undo_bind_bank_card.rb +60 -0
  24. data/lib/reapal/client.rb +6 -0
  25. data/lib/reapal/form/business_auth_form.rb +61 -0
  26. data/lib/reapal/form/find_trade_password_form.rb +48 -0
  27. data/lib/reapal/form/mobile_modify_form.rb +50 -0
  28. data/lib/reapal/form/signle_tender_transfer_form.rb +72 -0
  29. data/lib/reapal/form/tender_invest_form.rb +62 -0
  30. data/lib/reapal/form/tender_refund_form.rb +84 -0
  31. data/lib/reapal/form/withdraw_apply_form.rb +54 -0
  32. data/lib/reapal/http/communicate.rb +45 -20
  33. data/lib/reapal/http/response.rb +21 -0
  34. data/lib/reapal/utils.rb +16 -0
  35. data/lib/reapal/version.rb +1 -1
  36. metadata +29 -9
  37. data/lib/reapal/api/trust/balance_query.rb +0 -58
  38. data/lib/reapal/api/trust/contract_query.rb +0 -35
  39. data/lib/reapal/api/trust/find_trade_password.rb +0 -41
  40. data/lib/reapal/api/trust/mobile_modify.rb +0 -42
  41. data/lib/reapal/api/trust/onekey_contract.rb +0 -77
  42. data/lib/reapal/api/trust/withdraw_apply.rb +0 -44
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6e38648add5df9616409c90709a5fdd459fd589b
4
- data.tar.gz: 22a7db3fa2ff9c81c4e39508f1922e928267dbb7
3
+ metadata.gz: dec4bffac163868bb8653e0a4a8c581805d972ee
4
+ data.tar.gz: c78c514b8ffaa353fb25cc192f540332863a74e3
5
5
  SHA512:
6
- metadata.gz: 4b2c768f32bcb81d9e826f94ef005773f6186f027838a339b4051dd23e432ae229c261cc866c8a2a7e0ef4fcca95d8c104ba4f5d75bda5075926bb0c803b9ea9
7
- data.tar.gz: 63113c5a50d43575fa73faa4f7e77a77c2a3d998333880514a67df5b4abc080597cb48db0326744ce7206a75084cd99ff0a0419fb1c0b7402812bdbf6c03d474
6
+ metadata.gz: 95d1285c4361aa039f080c5a743295c21563c127eef94411ed2702f46c564ac94025b70388bcddbbd6e4b80c24c4fddb6f603aa475a985d8cfffccf1255a5051
7
+ data.tar.gz: f294e4e9588ed898361effef09cfea57b63a54bbe8c4b2b67a58e9872895763d18ff68d7e8248bf3820403c758b6d895a604ddf57721506b7e41ce55612b4567
data/.gitignore CHANGED
@@ -13,3 +13,6 @@ Gemfile.lock
13
13
 
14
14
  # rspec failure tracking
15
15
  .rspec_status
16
+
17
+ .DS_Store
18
+ */**/.DS_Store
@@ -20,6 +20,8 @@ require "reapal/http/communicate"
20
20
  require "reapal/http/response"
21
21
  # 自动加载所有 api
22
22
  Dir["#{File.dirname(__FILE__)}/reapal/api/**/*.rb"].each { |file| require file }
23
+ # 自动加载所有 form
24
+ Dir["#{File.dirname(__FILE__)}/reapal/form/**/*.rb"].each { |file| require file }
23
25
 
24
26
  require "reapal/client"
25
27
 
@@ -0,0 +1,64 @@
1
+ # coding: utf-8
2
+
3
+ module Reapal
4
+ module Api
5
+ module Asset
6
+ module TenderAllCancel
7
+
8
+ # 3.7 撤标
9
+ #
10
+ # @param flow_id [String] 撤标订单号
11
+ # @param tender_no [String] 商户系统标的号
12
+ # @param org_order_no [String] 原来投标时订单号
13
+ # @param busway [String] 设备通道, '00':PC端;'01':手机端(默认);'02':Pad端;'03':其它
14
+ # @param remark [String] 备注
15
+ #
16
+ # @return [ Hash ] 结果集
17
+ # * :result [String] 业务结果:'S/F/P'
18
+ # * :request_params [Hash] 请求参数
19
+ # * :response [Object] 请求返回对象
20
+ # * :error_code [String] 错误代号
21
+ # * :error_msg [String] 错误信息
22
+ # * :data: 具体业务返回信息
23
+ # * :orderNo [String] 撤销订单号
24
+ # * :resultCode [String] 结果代码
25
+ #
26
+ def tender_all_cancel(flow_id, tender_no, org_order_no, busway="01", remark='')
27
+ service = 'reapal.trust.tenderAllCancel'
28
+ post_path = '/reagw/tender/rest.htm'
29
+
30
+ params = {
31
+ orderNo: flow_id,
32
+ tenderNo: tender_no,
33
+ orgOrderNo: org_order_no,
34
+ busway: busway,
35
+ remark: remark,
36
+ applyTime: Time.now.strftime('%Y-%m-%d %H:%M:%S'),
37
+ }
38
+
39
+ response = Http.post(service, params, @config, post_path)
40
+
41
+ res = Reapal::Utils.api_result(params, response)
42
+
43
+ return res if response.http_pending? # 比如超时等操作
44
+
45
+ if Reapal::Api::ErrorCode.tender_cancel.include?(response.data[:resultCode])
46
+ res[:result] = "F"
47
+ return res
48
+ end
49
+
50
+ # 只有返回码是 '0000'撤标才成功
51
+ if ['0000'].include?(response.data[:resultCode])
52
+ res[:result] = "S"
53
+ return res
54
+ end
55
+
56
+ # 不能确定的错误 ,pending
57
+ res
58
+
59
+ end
60
+
61
+ end # module TenderAllCancel
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,81 @@
1
+ # coding: utf-8
2
+
3
+ module Reapal
4
+ module Api
5
+ module Asset
6
+ module TenderApply
7
+
8
+ # 3.1 发标
9
+ #
10
+ # @param flow_id [String] 发标订单号
11
+ # @param tender_no [String] 商户系统标的号
12
+ # @param tender_name [String] 商户系统标的名称
13
+ # @param money [BigDecimal] 金额
14
+ # @param rate [BigDecimal] 利率 10.3表示10.3%
15
+ # @param debit_term [BigDecimal] 标的期限
16
+ # @param debit_type [String] 期数类型,年:0,月:1,日:2
17
+ # @param repay_date [String] 还款日期,格式YYYYMMDD
18
+ # @param expiry_date [String] 投标截止日期,格式YYYYMMDD
19
+ # @param debit_contracts [String] 借款方协议号
20
+ # @param guarant_contract [String] 担保方协议号
21
+ # @param busway [String] 设备通道, '00':PC端;'01':手机端(默认);'02':Pad端;'03':其它
22
+ # @param remark [String] 备注
23
+ #
24
+ # @return [ Hash ] 结果集
25
+ # * :result [String] 业务结果:'S/F/P'
26
+ # * :request_params [Hash] 请求参数
27
+ # * :response [Object] 请求返回对象
28
+ # * :error_code [String] 错误代号
29
+ # * :error_msg [String] 错误信息
30
+ # * :data: 具体业务返回信息
31
+ # * :orderNo [String] 发标订单号
32
+ # * :resultCode [String] 结果代码
33
+ #
34
+ def tender_apply(flow_id, tender_no, tender_name, money, rate,
35
+ debit_term, debit_type, rapay_date, expiry_date,
36
+ debit_contracts, guarant_contract, busway='01', remark='')
37
+ service = 'reapal.trust.tenderApply'
38
+ post_path = '/reagw/tender/rest.htm'
39
+
40
+ params = {
41
+ orderNo: flow_id,
42
+ tenderNo: tender_no,
43
+ tenderName: tender_name,
44
+ amount: money,
45
+ rate: rate,
46
+ debitTerm: debit_term,
47
+ debitType: debit_type,
48
+ expiryDate: expiry_date,
49
+ debitContracts: debit_contracts,
50
+ guarantContract: guarant_contract,
51
+ busway: busway,
52
+ remark: remark,
53
+ applyTime: Time.now.strftime('%Y-%m-%d %H:%M:%S'),
54
+ }
55
+
56
+ response = Http.post(service, params, @config, post_path)
57
+
58
+ res = Reapal::Utils.api_result(params, response)
59
+
60
+ #非返回类错误
61
+ return res if response.http_pending? # 比如超时等操作
62
+
63
+ # 只有返回码是 '0000'发标才成功
64
+ if ['0000'].include?(response.data[:resultCode])
65
+ res[:result] = "S"
66
+ end
67
+
68
+ #确定的错误
69
+ if Reapal::Api::ErrorCode.tender_apply.include?(response.data[:resultCode])
70
+ res[:result] = "F"
71
+ return res
72
+ end
73
+
74
+ # 不能确定的错误 ,pending
75
+ res
76
+ end
77
+
78
+ end # module TenderApply
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,66 @@
1
+ # coding: utf-8
2
+
3
+ module Reapal
4
+ module Api
5
+ module Asset
6
+ module TenderAuthCancel
7
+
8
+ # 3.22 标的授权取消API
9
+ #
10
+ # @param flow_id [String] 订单号
11
+ # @param contracts [ String ] 用户协议号
12
+ # @param services [String] 授权业务。 02一键投标 ,03 为一键还款 04 一键债转
13
+ # @param tender_no [String] 标的号
14
+ # @param busway [String] 设备通道, '00':PC端;'01':手机端(默认);'02':Pad端;'03':其它
15
+ # @param remark [String] 备注
16
+ #
17
+ # @return [ Hash ] 结果集
18
+ # * :result [String] 业务结果:'S/F/P'
19
+ # * :request_params [Hash] 请求参数
20
+ # * :response [Object] 请求返回对象
21
+ # * :error_code [String] 错误代号
22
+ # * :error_msg [String] 错误信息
23
+ # * :data: 具体业务返回信息
24
+ # * :services [String] 授权业务。 02一键投标 ,03 为一键还款 04 一键债转
25
+ # * :resultCode [String] 结果代码
26
+ #
27
+ def tender_auth_cancel(flow_id, contracts, services, tender_no, busway="01", remark='')
28
+ service = 'reapal.trust.authCancel'
29
+ post_path = '/reagw/user/restApi.htm'
30
+
31
+ params = {
32
+ cancelOrderNo: flow_id,
33
+ contracts: contracts,
34
+ services: services,
35
+ busway: busway,
36
+ tenderNo: tender_no,
37
+ remark: remark,
38
+ applyTime: Time.now.strftime('%Y-%m-%d %H:%M:%S'),
39
+ }
40
+
41
+ response = Http.post(service, params, @config, post_path)
42
+
43
+ res = Reapal::Utils.api_result(params, response)
44
+
45
+ return res if response.http_pending? # 比如超时等操作
46
+
47
+ if Reapal::Api::ErrorCode.tender_auth_cancel.include?(response.data[:resultCode])
48
+ res[:result] = "F"
49
+ return res
50
+ end
51
+
52
+ # 只有返回码是 '0000'撤标才成功
53
+ if ['0000'].include?(response.data[:resultCode])
54
+ res[:result] = "S"
55
+ return res
56
+ end
57
+
58
+ # 不能确定的错误 ,pending
59
+ res
60
+
61
+ end
62
+
63
+ end # module TenderAuthCancel
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,64 @@
1
+ # coding: utf-8
2
+
3
+ module Reapal
4
+ module Api
5
+ module Asset
6
+ module TenderAuthQuery
7
+
8
+ # 3.21 标的授权查询
9
+ #
10
+ # @param flow_id [String] 操作订单号
11
+ # @param contracts [String] 用户协议号
12
+
13
+
14
+ # @return [ Hash ] 结果集
15
+ # * :result [String] 业务结果:'S/F/P'
16
+ # * :request_params [Hash] 请求参数
17
+ # * :response [Object] 请求返回对象
18
+ # * :error_code [String] 错误代号
19
+ # * :error_msg [String] 错误信息
20
+ # * :data: 具体业务返回信息
21
+ # * :orderNo [String] 操作订单号
22
+ # * :contracts [String] 用户协议号
23
+ # * :servicesDetail [JSON] 授权明细
24
+ # * :services [String] 授权服务。 02一键投标 ,03 为一键还款 04 一键债转
25
+ # * :authLimit [String] 授权期限日期 YYYYMMDD
26
+ # * :terderNo [String] 标的号
27
+
28
+ def tender_auth_query(flow_id, contracts)
29
+ service = 'reapal.trust.authQuery'
30
+ post_path = '/reagw/user/restApi.htm'
31
+
32
+ params = {
33
+ orderNo: flow_id,
34
+ contracts: contracts,
35
+ queryTime: Time.now.strftime('%Y-%m-%d %H:%M:%S'),
36
+ }
37
+
38
+ response = Http.post(service, params, @config, post_path)
39
+
40
+ res = Reapal::Utils.api_result(params, response)
41
+
42
+ #查询类 api,http 没成功都返回 pending
43
+ return res if response.http_success?
44
+
45
+ #确定的错误
46
+ if Reapal::Api::ErrorCode.tender_auth_query.include?(response.data[:resultCode])
47
+ res[:result] = "F"
48
+ return res
49
+ end
50
+
51
+
52
+ # 其余 api 错误不知道
53
+ return res unless response.data[:errorCode].nil?
54
+
55
+ #查询成功
56
+ res[:result] = "S"
57
+
58
+ res
59
+ end
60
+
61
+ end # module TenderAuthQuery
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,78 @@
1
+ # coding: utf-8
2
+
3
+ module Reapal
4
+ module Api
5
+ module Asset
6
+ module TenderFinish
7
+
8
+ # 3.8 满标 API
9
+ #
10
+ # @param flow_id [String] 完成订单号
11
+ # @param tender_no [String] 商户系统标的号
12
+ # @param debit_contracts [String] 借款方协议号
13
+ # @param debit_details [JSON] 借款方分账
14
+ # *seria_no [String] 商户流水号
15
+ # *payee_contracts [String] 收款方协议号
16
+ # *amount [BigDecimal] 金额
17
+ # *remark [String] 备注
18
+ # @param invest_details [JSON] 投资方分账
19
+ # *seria_no [String] 商户流水号
20
+ # *invest_contracts [String] 投资方协议号
21
+ # *payee_contracts [String] 收款方协议号
22
+ # *amount [BigDecimal] 金额
23
+ # *remark [String] 备注
24
+ # @param busway [String] 设备通道, '00':PC端;'01':手机端(默认);'02':Pad端;'03':其它
25
+ # @param remark [String] 备注
26
+ #
27
+ # @return [ Hash ] 结果集
28
+ # * :result [String] 业务结果:'S/F/P'
29
+ # * :request_params [Hash] 请求参数
30
+ # * :response [Object] 请求返回对象
31
+ # * :error_code [String] 错误代号
32
+ # * :error_msg [String] 错误信息
33
+ # * :data: 具体业务返回信息
34
+ # * :orderNo [String] 完成订单号
35
+ # * :resultCode [String] 结果代码
36
+ #
37
+ def tender_finish(flow_id, tender_no, debit_contracts, debit_details,
38
+ invest_details, busway='01', remark='')
39
+ service = 'reapal.trust.tenderFinish'
40
+ post_path = '/reagw/tender/rest.htm'
41
+
42
+ params = {
43
+ orderNo: flow_id,
44
+ tenderNo: tender_no,
45
+ debitContracts: debit_contracts,
46
+ debitDetails: debit_details,
47
+ investDetails: invest_details,
48
+ busway: busway,
49
+ remark: remark,
50
+ applyTime: Time.now.strftime('%Y-%m-%d %H:%M:%S'),
51
+ }
52
+
53
+ response = Http.post(service, params, @config, post_path)
54
+
55
+ res = Reapal::Utils.api_result(params, response)
56
+
57
+ #非返回类错误
58
+ return res if response.http_pending? # 比如超时等操作
59
+
60
+ # 只有返回码是 '0000'发标才成功
61
+ if ['0000'].include?(response.data[:resultCode])
62
+ res[:result] = "S"
63
+ end
64
+
65
+ #确定的错误
66
+ if Reapal::Api::ErrorCode.tender_finish.include?(response.data[:resultCode])
67
+ res[:result] = "F"
68
+ return res
69
+ end
70
+
71
+ # 不能确定的错误 ,pending
72
+ res
73
+ end
74
+
75
+ end # module TenderFinish
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,75 @@
1
+ # coding: utf-8
2
+
3
+ module Reapal
4
+ module Api
5
+ module Asset
6
+ module TenderRepaymentComplete
7
+
8
+ # 3.15 还款计划更新(API)
9
+ #
10
+ # @param flow_id [String] 执行还款计划订单号
11
+ # @param tender_no [String] 商户系统标的号
12
+ # @param periods [String] 还款期数
13
+ # @param comp_principal [BigDecimal] 执行还款本金
14
+ # @param comp_interest [BigDecimal] 执行还款利息
15
+ # @param comp_poundage [BigDecimal] 执行还款手续费
16
+ # @param comp_amount [BigDecimal] 执行还款总金额
17
+ # @param comp_time [String] 执行还款日期
18
+ # @param busway [String] 设备通道, '00':PC端;'01':手机端(默认);'02':Pad端;'03':其它
19
+ # @param remark [String] 备注
20
+
21
+ # @return [ Hash ] 结果集
22
+ # * :result [String] 业务结果:'S/F/P'
23
+ # * :request_params [Hash] 请求参数
24
+ # * :response [Object] 请求返回对象
25
+ # * :error_code [String] 错误代号
26
+ # * :error_msg [String] 错误信息
27
+ # * :data: 具体业务返回信息
28
+ # * :orderNo [String] 执行还款订单号
29
+ # * :resultCode [String] 结果代码
30
+ #
31
+ def tender_repayment_complete(flow_id, tender_no, periods, comp_principal, comp_interest,
32
+ comp_poundage, comp_amount, comp_time, busway='01', remark='')
33
+ service = 'reapal.trust.repaymentComplete'
34
+ post_path = '/reagw/tender/rest.htm'
35
+
36
+ params = {
37
+ orderNo: flow_id,
38
+ tenderNo: tender_no,
39
+ periods: periods,
40
+ compPrincipal: comp_principal,
41
+ compInterest: comp_interest,
42
+ compPoundage: comp_poundage,
43
+ compAmount: comp_amount,
44
+ compTime: comp_time,
45
+ busway: busway,
46
+ remark: remark,
47
+ applyTime: Time.now.strftime('%Y-%m-%d %H:%M:%S'),
48
+ }
49
+
50
+ response = Http.post(service, params, @config, post_path)
51
+
52
+ res = Reapal::Utils.api_result(params, response)
53
+
54
+ #非返回类错误
55
+ return res if response.http_pending? # 比如超时等操作
56
+
57
+ # 只有返回码是 '0000'还款信息同步成功
58
+ if ['0000'].include?(response.data[:resultCode])
59
+ res[:result] = "S"
60
+ end
61
+
62
+ #确定的错误
63
+ if Reapal::Api::ErrorCode.tender_repayment_complete.include?(response.data[:resultCode])
64
+ res[:result] = "F"
65
+ return res
66
+ end
67
+
68
+ # 不能确定的错误 ,pending
69
+ res
70
+ end
71
+
72
+ end # module TenderRepaymentComplete
73
+ end
74
+ end
75
+ end