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 +4 -4
- data/README.md +118 -114
- data/app/controllers/notify_controller.rb +15 -0
- data/app/models/suning_pay/notice.rb +4 -0
- data/config/routes.rb +3 -0
- data/lib/generators/suning_pay/migration_generator.rb +15 -0
- data/lib/generators/suning_pay/templates/migration.rb +16 -0
- data/lib/suning_pay.rb +4 -0
- data/lib/suning_pay/engine.rb +12 -0
- data/lib/suning_pay/railtie.rb +6 -4
- data/lib/suning_pay/version.rb +1 -1
- data/suning_pay.gemspec +4 -1
- metadata +35 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a729ab0b12960ae49743dc188564d879a0b70046
|
4
|
+
data.tar.gz: e94846f05ee12b967bf6822b5fde5a1b75c152f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b16ab01d62c740fcbbb8dbffe1df02b02e585bdb896f6ce5af18d60d409836b293f78962d6b53d3f2793714ec372e79f7ff99f9483969fa89587d2a516c2e7ab
|
7
|
+
data.tar.gz: 05a4d313875e15fbbc2cf624af9965cbdccb28e8b4d8cadb1d2137f93d7263662581ba52d0449cd71a56d845b38a0419f5f1f211af3a343b78241c58f19a1b46
|
data/README.md
CHANGED
@@ -1,114 +1,118 @@
|
|
1
|
-
# SuningPay
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
```
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
SuningPay.
|
34
|
-
|
35
|
-
|
36
|
-
SuningPay.
|
37
|
-
|
38
|
-
SuningPay.
|
39
|
-
|
40
|
-
SuningPay.
|
41
|
-
#客户端RSA
|
42
|
-
SuningPay.
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
#SuningPay.
|
48
|
-
#SuningPay.
|
49
|
-
|
50
|
-
#SuningPay.
|
51
|
-
|
52
|
-
#SuningPay.
|
53
|
-
#SuningPay.
|
54
|
-
|
55
|
-
#SuningPay.
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
SuningPay::Service.
|
76
|
-
SuningPay::Service.
|
77
|
-
SuningPay::Service.
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
##
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
##
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
##
|
113
|
-
|
114
|
-
|
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
|
data/config/routes.rb
ADDED
@@ -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
|
data/lib/suning_pay/railtie.rb
CHANGED
data/lib/suning_pay/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2017-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
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:
|
20
|
-
type: :
|
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:
|
40
|
+
version: 0.9.0
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
42
|
+
name: bundler
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
45
|
- - "~>"
|
32
46
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
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: '
|
54
|
+
version: '1.15'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
56
|
+
name: rake
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
59
|
- - "~>"
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
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: '
|
68
|
+
version: '10.0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
70
|
+
name: minitest
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
73
|
- - "~>"
|
60
74
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
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:
|
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
|