suning_pay 0.2.3 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 97ec05b437374da105374bd63f4ae23ec2fbe233
4
- data.tar.gz: cb7636a6a2b6ee9c7ebd0c453efd7159bb5a7479
3
+ metadata.gz: a729ab0b12960ae49743dc188564d879a0b70046
4
+ data.tar.gz: e94846f05ee12b967bf6822b5fde5a1b75c152f3
5
5
  SHA512:
6
- metadata.gz: c3abf85a1d7d61c17c8fdd9ebe787f9812e50d3deb8b5ab34cdb6f4ea8a4e56d10049ea95c0e71d57aeac2240319d9678aeb84d2d53da3eddf4ae14819bd5238
7
- data.tar.gz: 9b1f8d926bd9a45748b72398fb4c2855e42be90041baddb8ee9b06e4dab2160f5be0bff0dff5ef4153926e000b9c7559585e7a8a3ddb5d52502698d5078e202d
6
+ metadata.gz: b16ab01d62c740fcbbb8dbffe1df02b02e585bdb896f6ce5af18d60d409836b293f78962d6b53d3f2793714ec372e79f7ff99f9483969fa89587d2a516c2e7ab
7
+ data.tar.gz: 05a4d313875e15fbbc2cf624af9965cbdccb28e8b4d8cadb1d2137f93d7263662581ba52d0449cd71a56d845b38a0419f5f1f211af3a343b78241c58f19a1b46
data/README.md CHANGED
@@ -1,114 +1,118 @@
1
- # SuningPay
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/suning_pay`. 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 'suning_pay'
13
- ```
14
-
15
- And then execute:
16
-
17
- $ bundle
18
-
19
- Or install it yourself as:
20
-
21
- $ gem install suning_pay
22
-
23
- Add init file (suning_pay.rb) to Rails config/initializers
24
-
25
- rake suning_pay:init:create
26
-
27
- configuration
28
-
29
- ```ruby
30
- ##################TEST##################
31
- #接口地址-委托代收
32
- SuningPay.api_base_url = 'https://ebanksandbox.suning.com/epps-ebpg/api/contract/'
33
- SuningPay.api_query_base_url = 'https://paymentsandbox.suning.com/epps-pag/apiGateway/merchantOrder/'
34
- #接口地址-批量付款
35
- SuningPay.api_tranfer_url = 'https://wagtestpre.suning.com/epps-twg/'
36
- SuningPay.api_card_tranfer_url ='https://wagtestpre.suning.com/epps-wag/'
37
- #客户号
38
- SuningPay.merchant_no = '70057278'
39
- #Suning证书存放路径
40
- SuningPay.api_suning_cert = '/Users/terry/Documents/RUBY/hex/yifubao-pre.cer'
41
- #客户端RSA 公钥,1024, pem文件路径
42
- SuningPay.api_client_public_key = '/Users/terry/Documents/RUBY/hex/rsa_public_key.pem'
43
- #客户端RSA 私钥,1024, pem文件路径
44
- SuningPay.api_client_private_key = '/Users/terry/Documents/RUBY/hex/rsa_private_key.pem'
45
-
46
- ##################PROD##################
47
- #SuningPay.api_base_url = 'https://ebankpay.suning.com/epps-ebpg/api/contract/'
48
- #SuningPay.api_query_base_url = 'https://payment.suning.com/epps-pag/apiGateway/merchantOrder/'
49
- #SuningPay.api_tranfer_url = 'https://tag.yifubao.com/epps-twg/'
50
- #SuningPay.api_card_tranfer_url ='https://wag.yifubao.com/epps-wag/'
51
-
52
- #SuningPay.merchant_no = ''
53
- #SuningPay.api_suning_cert = ''
54
- #SuningPay.api_client_public_key = ''
55
- #SuningPay.api_client_private_key = ''
56
-
57
- #SuningPay.debug_mode = false
58
- ```
59
-
60
- ## API-委托代收
61
-
62
- 1. 签约请求_发送短信接口
63
- 2. 签约请求_验证短信接口
64
- 3. 签约请求接口(易付宝不发短信)
65
- 4. 解约请求接口
66
- 5. 支付订单请求(已签约)
67
- 6. 支付订单查询接口
68
- 7. 支持银行查询接口
69
-
70
- ```
71
- SuningPay::Service.post_send_msg
72
- SuningPay::Service.post_validate_sign
73
- SuningPay::Service.post_sign
74
- SuningPay::Service.post_cancel
75
- SuningPay::Service.post_pay
76
- SuningPay::Service.post_query_merchant_order
77
- SuningPay::Service.post_query_channel
78
- ```
79
-
80
- ## API-企业批量付款
81
-
82
- 1. 批量转账下单接口
83
- 2. 批量出款到卡接口
84
- 3. 转账批次查询接口
85
- 4. 出款批次查询接口
86
-
87
- ```
88
- SuningPay::EntService.post_transfer_acquire
89
- SuningPay::EntService.post_withdraw
90
- SuningPay::EntService.post_transfer_query
91
- SuningPay::EntService.post_withdraw_query
92
- ```
93
-
94
- ## Usage
95
-
96
- TODO: Write usage instructions here
97
-
98
- ## Development
99
-
100
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
101
-
102
- 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).
103
-
104
- ## Contributing
105
-
106
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/suning_pay. 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.
107
-
108
- ## License
109
-
110
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
111
-
112
- ## Code of Conduct
113
-
114
- Everyone interacting in the SuningPay project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/suning_pay/blob/master/CODE_OF_CONDUCT.md).
1
+ # SuningPay
2
+
3
+ SuningPay(易付宝) API
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'suning_pay'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install suning_pay
20
+
21
+ Add init file (suning_pay.rb) to Rails config/initializers
22
+
23
+ rake suning_pay:init:create
24
+
25
+ Configuration
26
+
27
+ ```ruby
28
+ ##################TEST##################
29
+ #接口地址-委托代收
30
+ SuningPay.api_base_url = 'https://ebanksandbox.suning.com/epps-ebpg/api/contract/'
31
+ SuningPay.api_query_base_url = 'https://paymentsandbox.suning.com/epps-pag/apiGateway/merchantOrder/'
32
+ #接口地址-批量付款
33
+ SuningPay.api_tranfer_url = 'https://wagtestpre.suning.com/epps-twg/'
34
+ SuningPay.api_card_tranfer_url ='https://wagtestpre.suning.com/epps-wag/'
35
+ #客户号
36
+ SuningPay.merchant_no = '70057278'
37
+ #Suning证书存放路径
38
+ SuningPay.api_suning_cert = '/Users/terry/Documents/RUBY/hex/yifubao-pre.cer'
39
+ #客户端RSA 公钥,1024, pem文件路径
40
+ SuningPay.api_client_public_key = '/Users/terry/Documents/RUBY/hex/rsa_public_key.pem'
41
+ #客户端RSA 私钥,1024, pem文件路径
42
+ SuningPay.api_client_private_key = '/Users/terry/Documents/RUBY/hex/rsa_private_key.pem'
43
+
44
+ ##################PROD##################
45
+ #SuningPay.api_base_url = 'https://ebankpay.suning.com/epps-ebpg/api/contract/'
46
+ #SuningPay.api_query_base_url = 'https://payment.suning.com/epps-pag/apiGateway/merchantOrder/'
47
+ #SuningPay.api_tranfer_url = 'https://tag.yifubao.com/epps-twg/'
48
+ #SuningPay.api_card_tranfer_url ='https://wag.yifubao.com/epps-wag/'
49
+
50
+ #SuningPay.merchant_no = ''
51
+ #SuningPay.api_suning_cert = ''
52
+ #SuningPay.api_client_public_key = ''
53
+ #SuningPay.api_client_private_key = ''
54
+
55
+ #SuningPay.debug_mode = false
56
+ ```
57
+
58
+ Add Migration
59
+ ```ruby
60
+ rails g suning_pay:migration
61
+ ```
62
+
63
+
64
+ ## API-委托代收
65
+
66
+ 1. 签约请求_发送短信接口
67
+ 2. 签约请求_验证短信接口
68
+ 3. 签约请求接口(易付宝不发短信)
69
+ 4. 解约请求接口
70
+ 5. 支付订单请求(已签约)
71
+ 6. 支付订单查询接口
72
+ 7. 支持银行查询接口
73
+
74
+ ```ruby
75
+ SuningPay::Service.post_send_msg
76
+ SuningPay::Service.post_validate_sign
77
+ SuningPay::Service.post_sign
78
+ SuningPay::Service.post_cancel
79
+ SuningPay::Service.post_pay
80
+ SuningPay::Service.post_query_merchant_order
81
+ SuningPay::Service.post_query_channel
82
+ ```
83
+
84
+ ## API-企业批量付款
85
+
86
+ 1. 批量转账下单接口
87
+ 2. 批量出款到卡接口
88
+ 3. 转账批次查询接口
89
+ 4. 出款批次查询接口
90
+
91
+ ```ruby
92
+ SuningPay::EntService.post_transfer_acquire
93
+ SuningPay::EntService.post_withdraw
94
+ SuningPay::EntService.post_transfer_query
95
+ SuningPay::EntService.post_withdraw_query
96
+ ```
97
+
98
+ ## Usage
99
+
100
+ TODO: Write usage instructions here
101
+
102
+ ## Development
103
+
104
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
105
+
106
+ 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).
107
+
108
+ ## Contributing
109
+
110
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/suning_pay. 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.
111
+
112
+ ## License
113
+
114
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
115
+
116
+ ## Code of Conduct
117
+
118
+ Everyone interacting in the SuningPay project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/suning_pay/blob/master/CODE_OF_CONDUCT.md).
@@ -0,0 +1,15 @@
1
+ module SuningPay
2
+ class NotifyController < ::ActionController::Base
3
+ if _process_action_callbacks.any?{|a| a.filter == :verify_authenticity_token}
4
+ # ActionController::Base no longer protects from forgery in Rails 5
5
+ skip_before_filter :verify_authenticity_token
6
+ end
7
+
8
+ layout false
9
+
10
+ def index
11
+ SuningPay::Notice.create(:content => params[:content], :sign=>params[:sign], :sign_type=>params[:sign_type], :vk_version=>params[:vk_version])
12
+ render text: 'true'
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,4 @@
1
+ module SuningPay
2
+ class Notice < ActiveRecord::Base
3
+ end
4
+ end
data/config/routes.rb ADDED
@@ -0,0 +1,3 @@
1
+ SuningPay::Engine.routes.draw do
2
+ post "notify" => "notify#index"
3
+ end
@@ -0,0 +1,15 @@
1
+ require 'rails/generators/active_record'
2
+
3
+ class SuningPay::MigrationGenerator < ::Rails::Generators::Base
4
+ include Rails::Generators::Migration
5
+ source_root File.expand_path('../templates', __FILE__)
6
+ desc 'Installs SuningPay migration file.'
7
+
8
+ def install
9
+ migration_template 'migration.rb', 'db/migrate/create_suning_pay_notices.rb'
10
+ end
11
+
12
+ def self.next_migration_number(dirname)
13
+ ActiveRecord::Generators::Base.next_migration_number(dirname)
14
+ end
15
+ end
@@ -0,0 +1,16 @@
1
+ class CreateSuningPayNotices < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :suning_pay_notices do |t|
4
+ t.text :content
5
+ t.string :sign
6
+ t.string :sign_type, :limit=>30
7
+ t.string :vk_version, :limit=>30
8
+ t.string :deal_flag, :limit=>30
9
+ t.timestamps
10
+ end
11
+ end
12
+
13
+ def self.down
14
+ drop_table :suning_pay_notices
15
+ end
16
+ end
data/lib/suning_pay.rb CHANGED
@@ -4,7 +4,9 @@ require 'openssl'
4
4
  require 'digest/md5'
5
5
  require 'base64'
6
6
 
7
+
7
8
  require "suning_pay/version"
9
+ require 'suning_pay/engine'
8
10
  require "suning_pay/result"
9
11
  require "suning_pay/rsa"
10
12
  require "suning_pay/util"
@@ -25,6 +27,8 @@ module SuningPay
25
27
  API_CODE_Q_PAY = 'Q_PAY'
26
28
  API_CODE_TRANSFER_CARD = 'TRAN_C'
27
29
 
30
+ API_ENT_POST_NOTICE_URL = '/api/suning_pay/notify'
31
+
28
32
  class<< self
29
33
  attr_accessor :merchant_no, :signature, :sign_algorithm, :submit_time, :debug_mode
30
34
  attr_reader :api_base_url, :api_query_base_url, :api_tranfer_url, :api_card_tranfer_url
@@ -0,0 +1,12 @@
1
+ module SuningPay
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace SuningPay
4
+
5
+ initializer 'SuningPay', group: :all do |app|
6
+ Rails.application.routes.prepend do
7
+ mount SuningPay::Engine, at: '/api/suning_pay'
8
+ end
9
+ end
10
+ end
11
+ end
12
+
@@ -1,6 +1,8 @@
1
1
  #encoding: utf-8
2
- class SuningPay::Railtie < Rails::Railtie
3
- rake_tasks do
4
- load 'rake/suning_pay.rake'
2
+ module SuningPay
3
+ class Railtie < Rails::Railtie
4
+ rake_tasks do
5
+ load 'rake/suning_pay.rake'
6
+ end
5
7
  end
6
- end
8
+ end
@@ -1,3 +1,3 @@
1
1
  module SuningPay
2
- VERSION = "0.2.3"
2
+ VERSION = "0.3.0"
3
3
  end
data/suning_pay.gemspec CHANGED
@@ -30,8 +30,11 @@ Gem::Specification.new do |spec|
30
30
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
31
  spec.require_paths = ["lib"]
32
32
 
33
+ spec.add_dependency "railties", ">= 3.1.0"
34
+ spec.add_dependency "faraday", "~> 0.9.0"
35
+ #spec.add_runtime_dependency 'railties', '>= 3.1.0'
36
+
33
37
  spec.add_development_dependency "bundler", "~> 1.15"
34
38
  spec.add_development_dependency "rake", "~> 10.0"
35
39
  spec.add_development_dependency "minitest", "~> 5.0"
36
- spec.add_development_dependency "faraday", "~> 0.9.0"
37
40
  end
metadata CHANGED
@@ -1,71 +1,85 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: suning_pay
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Terry.Tu
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-08-10 00:00:00.000000000 Z
11
+ date: 2017-08-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: bundler
14
+ name: railties
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 3.1.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 3.1.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: faraday
15
29
  requirement: !ruby/object:Gem::Requirement
16
30
  requirements:
17
31
  - - "~>"
18
32
  - !ruby/object:Gem::Version
19
- version: '1.15'
20
- type: :development
33
+ version: 0.9.0
34
+ type: :runtime
21
35
  prerelease: false
22
36
  version_requirements: !ruby/object:Gem::Requirement
23
37
  requirements:
24
38
  - - "~>"
25
39
  - !ruby/object:Gem::Version
26
- version: '1.15'
40
+ version: 0.9.0
27
41
  - !ruby/object:Gem::Dependency
28
- name: rake
42
+ name: bundler
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
45
  - - "~>"
32
46
  - !ruby/object:Gem::Version
33
- version: '10.0'
47
+ version: '1.15'
34
48
  type: :development
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
52
  - - "~>"
39
53
  - !ruby/object:Gem::Version
40
- version: '10.0'
54
+ version: '1.15'
41
55
  - !ruby/object:Gem::Dependency
42
- name: minitest
56
+ name: rake
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
59
  - - "~>"
46
60
  - !ruby/object:Gem::Version
47
- version: '5.0'
61
+ version: '10.0'
48
62
  type: :development
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
66
  - - "~>"
53
67
  - !ruby/object:Gem::Version
54
- version: '5.0'
68
+ version: '10.0'
55
69
  - !ruby/object:Gem::Dependency
56
- name: faraday
70
+ name: minitest
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
73
  - - "~>"
60
74
  - !ruby/object:Gem::Version
61
- version: 0.9.0
75
+ version: '5.0'
62
76
  type: :development
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
80
  - - "~>"
67
81
  - !ruby/object:Gem::Version
68
- version: 0.9.0
82
+ version: '5.0'
69
83
  description: Suning Pay 1.1.2 doc.
70
84
  email:
71
85
  - tuminfei1981@gmail.com
@@ -80,14 +94,20 @@ files:
80
94
  - LICENSE.txt
81
95
  - README.md
82
96
  - Rakefile
97
+ - app/controllers/notify_controller.rb
98
+ - app/models/suning_pay/notice.rb
83
99
  - bin/console
84
100
  - bin/setup
85
101
  - bin/suning_pay
102
+ - config/routes.rb
86
103
  - data/rsa_private_key.pem
87
104
  - data/rsa_public_key.pem
88
105
  - data/yifubao-pre.cer
106
+ - lib/generators/suning_pay/migration_generator.rb
107
+ - lib/generators/suning_pay/templates/migration.rb
89
108
  - lib/rake/suning_pay.rake
90
109
  - lib/suning_pay.rb
110
+ - lib/suning_pay/engine.rb
91
111
  - lib/suning_pay/ent_service.rb
92
112
  - lib/suning_pay/railtie.rb
93
113
  - lib/suning_pay/result.rb