rock_fintech 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +55 -0
  3. data/CODE_OF_CONDUCT.md +74 -0
  4. data/Gemfile +6 -0
  5. data/Gemfile.lock +63 -0
  6. data/LICENSE.txt +21 -0
  7. data/README.md +43 -0
  8. data/Rakefile +12 -0
  9. data/bin/console +14 -0
  10. data/bin/setup +8 -0
  11. data/lib/rock_fintech/api/account/account_balance.rb +40 -0
  12. data/lib/rock_fintech/api/account/find_account_by_id.rb +42 -0
  13. data/lib/rock_fintech/api/account/find_account_by_mobile.rb +41 -0
  14. data/lib/rock_fintech/api/account/unbind_bank_card.rb +46 -0
  15. data/lib/rock_fintech/api/api_helper.rb +53 -0
  16. data/lib/rock_fintech/api/asset/.gitkeep +0 -0
  17. data/lib/rock_fintech/api/asset/asset_query.rb +48 -0
  18. data/lib/rock_fintech/api/asset/assets_enroll.rb +62 -0
  19. data/lib/rock_fintech/api/asset/assets_revoke.rb +48 -0
  20. data/lib/rock_fintech/api/batch/.gitkeep +0 -0
  21. data/lib/rock_fintech/api/batch/batch_end_credit_b.rb +59 -0
  22. data/lib/rock_fintech/api/batch/batch_payment_b.rb +76 -0
  23. data/lib/rock_fintech/api/batch/batch_repayment_b.rb +78 -0
  24. data/lib/rock_fintech/api/enterprise/.gitkeep +0 -0
  25. data/lib/rock_fintech/api/money/bank_recharge.rb +50 -0
  26. data/lib/rock_fintech/api/money/coupon_recharge.rb +40 -0
  27. data/lib/rock_fintech/api/money/coupon_withdraw.rb +40 -0
  28. data/lib/rock_fintech/api/platform/.gitkeep +0 -0
  29. data/lib/rock_fintech/api/query/.gitkeep +0 -0
  30. data/lib/rock_fintech/api/trade/.gitkeep +0 -0
  31. data/lib/rock_fintech/api/trade/auto_bid_apply.rb +61 -0
  32. data/lib/rock_fintech/api/trade/revoke_auto_bid.rb +44 -0
  33. data/lib/rock_fintech/client.rb +45 -0
  34. data/lib/rock_fintech/encrypt/rsa.rb +29 -0
  35. data/lib/rock_fintech/extensions.rb +7 -0
  36. data/lib/rock_fintech/form/account/bind_bank_card_p.rb +43 -0
  37. data/lib/rock_fintech/form/account/create_account_p.rb +52 -0
  38. data/lib/rock_fintech/form/account/set_password_p.rb +52 -0
  39. data/lib/rock_fintech/form/asset/.gitkeep +0 -0
  40. data/lib/rock_fintech/form/batch/.gitkeep +0 -0
  41. data/lib/rock_fintech/form/enterprise/.gitkeep +0 -0
  42. data/lib/rock_fintech/form/money/recharge_p.rb +59 -0
  43. data/lib/rock_fintech/form/money/sign_borrower_p.rb +48 -0
  44. data/lib/rock_fintech/form/money/sign_transfer_p.rb +44 -0
  45. data/lib/rock_fintech/form/money/withdraw_p.rb +58 -0
  46. data/lib/rock_fintech/form/platform/.gitkeep +0 -0
  47. data/lib/rock_fintech/form/query/.gitkeep +0 -0
  48. data/lib/rock_fintech/form/trade/.gitkeep +0 -0
  49. data/lib/rock_fintech/form/trade/bid_apply_p.rb +58 -0
  50. data/lib/rock_fintech/form/trade/sign_auto_bid_p.rb +46 -0
  51. data/lib/rock_fintech/http/error_code/account.rb +34 -0
  52. data/lib/rock_fintech/http/error_code/asset.rb +20 -0
  53. data/lib/rock_fintech/http/error_code/batch.rb +20 -0
  54. data/lib/rock_fintech/http/error_code/money.rb +37 -0
  55. data/lib/rock_fintech/http/error_code/trade.rb +23 -0
  56. data/lib/rock_fintech/http/request.rb +103 -0
  57. data/lib/rock_fintech/http/response.rb +54 -0
  58. data/lib/rock_fintech/railtie.rb +7 -0
  59. data/lib/rock_fintech/sign/md5.rb +18 -0
  60. data/lib/rock_fintech/utils.rb +75 -0
  61. data/lib/rock_fintech/version.rb +3 -0
  62. data/lib/rock_fintech.rb +51 -0
  63. data/rock_fintech.gemspec +41 -0
  64. metadata +223 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9e3c052086ae7491be108d049a48c47e113d5f7d
4
+ data.tar.gz: 93f6cca9105983cb34fc47fb52d471461b359a79
5
+ SHA512:
6
+ metadata.gz: 61352c706ce4de7eb8f054a9b9e8a4b1f804be2c5eb2a43b7238040de7bf26cccf1446f74dde596845a79816d0db15cf4ab462ed5912c1c5dce78fe25f80f9c9
7
+ data.tar.gz: 10dfecf9a1970d1f59561be29ca0f6987a5d8c49a12d5e0c96cdc97f86e51f9ed1035d6a651efd609f13654f0dfcebccc186f8ccf2a48f31fe8bc3b640a49f04
data/.gitignore ADDED
@@ -0,0 +1,55 @@
1
+ .rspec_status
2
+ *.gem
3
+ *.rbc
4
+ /.config
5
+ /coverage/
6
+ /InstalledFiles
7
+ /pkg/
8
+ /spec/reports/
9
+ /spec/examples.txt
10
+ /test/tmp/
11
+ /test/version_tmp/
12
+ /tmp/
13
+ /spec/support/config/config.yml
14
+
15
+ .byebug_history
16
+ Gemfile.lock
17
+
18
+ # Used by dotenv library to load environment variables.
19
+ # .env
20
+
21
+ ## Specific to RubyMotion:
22
+ .dat*
23
+ .repl_history
24
+ build/
25
+ *.bridgesupport
26
+ build-iPhoneOS/
27
+ build-iPhoneSimulator/
28
+
29
+ ## Specific to RubyMotion (use of CocoaPods):
30
+ #
31
+ # We recommend against adding the Pods directory to your .gitignore. However
32
+ # you should judge for yourself, the pros and cons are mentioned at:
33
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
34
+ #
35
+ # vendor/Pods/
36
+
37
+ ## Documentation cache and generated files:
38
+ /.yardoc/
39
+ /_yardoc/
40
+ /doc/
41
+ /rdoc/
42
+
43
+ ## Environment normalization:
44
+ /.bundle/
45
+ /vendor/bundle
46
+ /lib/bundler/man/
47
+
48
+ # for a library or gem, you might want to ignore these files since the code is
49
+ # intended to run in multiple environments; otherwise, check them in:
50
+ # Gemfile.lock
51
+ # .ruby-version
52
+ # .ruby-gemset
53
+
54
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
55
+ .rvmrc
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at chpy15@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in rock_fintech.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,63 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ rock_fintech (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ byebug (9.1.0)
10
+ concurrent-ruby (1.0.5)
11
+ diff-lcs (1.3)
12
+ domain_name (0.5.20180417)
13
+ unf (>= 0.0.5, < 1.0.0)
14
+ faker (1.8.5)
15
+ i18n (~> 0.9.1)
16
+ http-cookie (1.0.3)
17
+ domain_name (~> 0.5)
18
+ i18n (0.9.1)
19
+ concurrent-ruby (~> 1.0)
20
+ macaddr (1.7.1)
21
+ systemu (~> 2.6.2)
22
+ mime-types (3.1)
23
+ mime-types-data (~> 3.2015)
24
+ mime-types-data (3.2016.0521)
25
+ netrc (0.11.0)
26
+ rake (10.5.0)
27
+ rest-client (2.0.2)
28
+ http-cookie (>= 1.0.2, < 2.0)
29
+ mime-types (>= 1.16, < 4.0)
30
+ netrc (~> 0.8)
31
+ rspec (3.7.0)
32
+ rspec-core (~> 3.7.0)
33
+ rspec-expectations (~> 3.7.0)
34
+ rspec-mocks (~> 3.7.0)
35
+ rspec-core (3.7.0)
36
+ rspec-support (~> 3.7.0)
37
+ rspec-expectations (3.7.0)
38
+ diff-lcs (>= 1.2.0, < 2.0)
39
+ rspec-support (~> 3.7.0)
40
+ rspec-mocks (3.7.0)
41
+ diff-lcs (>= 1.2.0, < 2.0)
42
+ rspec-support (~> 3.7.0)
43
+ rspec-support (3.7.0)
44
+ systemu (2.6.5)
45
+ unf (0.1.4)
46
+ unf_ext
47
+ unf_ext (0.0.7.5)
48
+
49
+ PLATFORMS
50
+ ruby
51
+
52
+ DEPENDENCIES
53
+ bundler (~> 1.16)
54
+ byebug (~> 9.1)
55
+ faker (~> 1.8, >= 1.8.4)
56
+ macaddr (~> 1.7, >= 1.7.1)
57
+ rake (~> 10.0)
58
+ rest-client (~> 2.0, >= 2.0.2)
59
+ rock_fintech!
60
+ rspec (~> 3.0)
61
+
62
+ BUNDLED WITH
63
+ 1.16.1
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 chenpengyu
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # RockFintech
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/rock_fintech`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'rock_fintech'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install rock_fintech
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/rock_fintech. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
40
+
41
+ ## Code of Conduct
42
+
43
+ Everyone interacting in the RockFintech project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/rock_fintech/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
7
+
8
+ task :push do
9
+ puts `gem push pkg/rock_fintech-#{RockFintech::VERSION}.gem`
10
+ end
11
+
12
+ task :publish => [:build, :push]
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "rock_fintech"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,40 @@
1
+ # coding: utf-8
2
+ module RockFintech
3
+ module Api
4
+ module Account
5
+ module AccountBalance
6
+ # 电子账户余额查询
7
+ #
8
+ # @return [ Hash ] 结果集
9
+ # * :result [String] "S"/"F"/"P"
10
+ # * :request_params [Hash] 请求参数
11
+ # * :response [Object] 请求返回对象
12
+ # * :code [String] 结果代码
13
+ # * :msg [String] 结果信息
14
+ # * :data: 具体业务返回信息
15
+ # * :card_no [String] 电子账号
16
+ # * :name [String] 持卡人姓名
17
+ # * :balance [String] 账户可用余额
18
+ # * :freBi [String] 账户冻结余额
19
+ # * :third_custom [String] 第三方保留域
20
+ #
21
+ def account_balance(card_no, customer_no, third_custom='', devise='000001', remark='')
22
+ service = 'account_balance'
23
+
24
+ params = {
25
+ customer_no: customer_no,
26
+ card_no: card_no,
27
+ third_custom: third_custom,
28
+ client: devise,
29
+ custom: remark,
30
+ }
31
+
32
+ res = operate_post(:query, service, params, Http::ErrorCode.account_balance, ['RD000000'])
33
+
34
+ res
35
+ end
36
+
37
+ end # module
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,42 @@
1
+ # coding: utf-8
2
+ module RockFintech
3
+ module Api
4
+ module Account
5
+ module FindAccountById
6
+ # 按身份证号查询电子账号信息
7
+ #
8
+ # @return [ Hash ] 结果集
9
+ # * :result [String] "S"/"F"/"P"
10
+ # * :request_params [Hash] 请求参数
11
+ # * :response [Object] 请求返回对象
12
+ # * :code [String] 结果代码
13
+ # * :msg [String] 结果信息
14
+ # * :data: 具体业务返回信息
15
+ # * :mobile [String] 手机号
16
+ # * :product [String] 产品号
17
+ # * :card_no [String] 电子账号
18
+ # * :customer_no [String] 客户号
19
+ # * :issue_date [String] 开户日期
20
+ # * :name [String] 持卡人姓名
21
+ # * :cert_type [String] 证件类型,15-身份证18位
22
+ # * :cert_no [String] 证件号码
23
+ #
24
+ def find_account_by_id(cert_type, cert_no, devise='000001', remark='')
25
+ service = 'find_account_by_id'
26
+
27
+ params = {
28
+ cert_type: cert_type,
29
+ cert_no: cert_no,
30
+ client: devise,
31
+ custom: remark,
32
+ }
33
+
34
+ res = operate_post(:query, service, params, Http::ErrorCode.find_account_by_id, ['RD000000'])
35
+
36
+ res
37
+ end
38
+
39
+ end # module
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,41 @@
1
+ # coding: utf-8
2
+ module RockFintech
3
+ module Api
4
+ module Account
5
+ module FindAccountByMobile
6
+ # 按手机号查询电子账号信息
7
+ #
8
+ # @return [ Hash ] 结果集
9
+ # * :result [String] "S"/"F"/"P"
10
+ # * :request_params [Hash] 请求参数
11
+ # * :response [Object] 请求返回对象
12
+ # * :code [String] 结果代码
13
+ # * :msg [String] 结果信息
14
+ # * :data: 具体业务返回信息
15
+ # * :mobile [String] 手机号
16
+ # * :product [String] 产品号
17
+ # * :card_no [String] 电子账号
18
+ # * :customer_no [String] 客户号
19
+ # * :issue_date [String] 开户日期
20
+ # * :name [String] 持卡人姓名
21
+ # * :cert_type [String] 证件类型,15-身份证18位
22
+ # * :cert_no [String] 证件号码
23
+ #
24
+ def find_account_by_mobile(mobile, devise='000001', remark='')
25
+ service = 'find_account_by_mobile'
26
+
27
+ params = {
28
+ mobile: mobile,
29
+ client: devise,
30
+ custom: remark,
31
+ }
32
+
33
+ res = operate_post(:query, service, params, Http::ErrorCode.find_account_by_mobile, ['RD000000'])
34
+
35
+ res
36
+ end
37
+
38
+ end # module
39
+ end
40
+ end
41
+ end