suning_pay 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,6 +2,11 @@
2
2
  module SuningPay
3
3
  class Result < ::Hash
4
4
  RESULT_SUCCESS_FLAG = '0000'
5
+ RESULT_ERR_FLAG = '9999'
6
+ PAY_SUCCESS_FLAG = 'S'
7
+ PAY_FAILURE_FLAG = 'F'
8
+ PAY_PENDING_FLAG = 'P'
9
+ PAY_CLOSE_FLAG = 'C'
5
10
 
6
11
  RESULT_MSG = {
7
12
  '0000' => '成功',
@@ -84,5 +89,21 @@ module SuningPay
84
89
  def success?
85
90
  self['responseCode'] == RESULT_SUCCESS_FLAG
86
91
  end
92
+
93
+ def pay_success?
94
+ self['responseCode'] == RESULT_SUCCESS_FLAG and self['payResult'] == PAY_SUCCESS_FLAG
95
+ end
96
+
97
+ def pay_fail?
98
+ self['responseCode'] == RESULT_SUCCESS_FLAG and self['payResult'] == PAY_FAILURE_FLAG
99
+ end
100
+
101
+ def order_success?
102
+ self['responseCode'] == RESULT_SUCCESS_FLAG and self['orderStatus'] == PAY_SUCCESS_FLAG
103
+ end
104
+
105
+ def order_close?
106
+ self['responseCode'] == RESULT_SUCCESS_FLAG and self['orderStatus'] == PAY_CLOSE_FLAG
107
+ end
87
108
  end
88
109
  end
@@ -59,8 +59,8 @@ module SuningPay
59
59
  msg
60
60
  end
61
61
 
62
- #5.支付订单请求
63
- def self.post_pay(contract_no, out_order_no, order_type, order_amount, order_time, saler_merchant_no, goods_type, goods_name, pay_timeout, remark, tunnel_data = '', options = {})
62
+ #5.支付订单请求(默认使用2.0版本)
63
+ def self.post_pay(contract_no, out_order_no, order_type, order_amount, order_time, saler_merchant_no, goods_type, goods_name, pay_timeout, remark, tunnel_data = '', options = {:version => '2.0'})
64
64
  input_hash = {:contractNo => contract_no,
65
65
  :outOrderNo => out_order_no,
66
66
  :orderType => order_type,
@@ -81,7 +81,7 @@ module SuningPay
81
81
  end
82
82
 
83
83
  #6.支付订单查询接口
84
- def self.post_query_merchant_order(out_order_no, order_time, options = {})
84
+ def self.post_query_merchant_order(out_order_no, order_time, options = {:version => '1.2'})
85
85
  input_hash = {:outOrderNo => out_order_no,
86
86
  :orderTime => order_time}
87
87
 
@@ -1,3 +1,3 @@
1
1
  module SuningPay
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.3"
3
3
  end
metadata CHANGED
@@ -1,83 +1,94 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: suning_pay
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Terry.Tu
8
9
  autorequire:
9
10
  bindir: exe
10
11
  cert_chain: []
11
- date: 2017-08-18 00:00:00.000000000 Z
12
+ date: 2017-08-21 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: railties
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
- - - ">="
19
+ - - ! '>='
18
20
  - !ruby/object:Gem::Version
19
21
  version: 3.1.0
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
- - - ">="
27
+ - - ! '>='
25
28
  - !ruby/object:Gem::Version
26
29
  version: 3.1.0
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: faraday
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
- - - "~>"
35
+ - - ~>
32
36
  - !ruby/object:Gem::Version
33
37
  version: 0.9.0
34
38
  type: :runtime
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
- - - "~>"
43
+ - - ~>
39
44
  - !ruby/object:Gem::Version
40
45
  version: 0.9.0
41
46
  - !ruby/object:Gem::Dependency
42
47
  name: bundler
43
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
44
50
  requirements:
45
- - - "~>"
51
+ - - ~>
46
52
  - !ruby/object:Gem::Version
47
53
  version: '1.15'
48
54
  type: :development
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
51
58
  requirements:
52
- - - "~>"
59
+ - - ~>
53
60
  - !ruby/object:Gem::Version
54
61
  version: '1.15'
55
62
  - !ruby/object:Gem::Dependency
56
63
  name: rake
57
64
  requirement: !ruby/object:Gem::Requirement
65
+ none: false
58
66
  requirements:
59
- - - "~>"
67
+ - - ~>
60
68
  - !ruby/object:Gem::Version
61
69
  version: '10.0'
62
70
  type: :development
63
71
  prerelease: false
64
72
  version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
65
74
  requirements:
66
- - - "~>"
75
+ - - ~>
67
76
  - !ruby/object:Gem::Version
68
77
  version: '10.0'
69
78
  - !ruby/object:Gem::Dependency
70
79
  name: minitest
71
80
  requirement: !ruby/object:Gem::Requirement
81
+ none: false
72
82
  requirements:
73
- - - "~>"
83
+ - - ~>
74
84
  - !ruby/object:Gem::Version
75
85
  version: '5.0'
76
86
  type: :development
77
87
  prerelease: false
78
88
  version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
79
90
  requirements:
80
- - - "~>"
91
+ - - ~>
81
92
  - !ruby/object:Gem::Version
82
93
  version: '5.0'
83
94
  description: Suning Pay 1.1.2 doc.
@@ -87,8 +98,8 @@ executables: []
87
98
  extensions: []
88
99
  extra_rdoc_files: []
89
100
  files:
90
- - ".gitignore"
91
- - ".travis.yml"
101
+ - .gitignore
102
+ - .travis.yml
92
103
  - CODE_OF_CONDUCT.md
93
104
  - Gemfile
94
105
  - LICENSE.txt
@@ -120,25 +131,26 @@ files:
120
131
  homepage: https://github.com/tuminfei/suning_pay
121
132
  licenses:
122
133
  - MIT
123
- metadata: {}
124
134
  post_install_message:
125
135
  rdoc_options: []
126
136
  require_paths:
127
137
  - lib
128
138
  required_ruby_version: !ruby/object:Gem::Requirement
139
+ none: false
129
140
  requirements:
130
- - - ">="
141
+ - - ! '>='
131
142
  - !ruby/object:Gem::Version
132
143
  version: '0'
133
144
  required_rubygems_version: !ruby/object:Gem::Requirement
145
+ none: false
134
146
  requirements:
135
- - - ">="
147
+ - - ! '>='
136
148
  - !ruby/object:Gem::Version
137
149
  version: '0'
138
150
  requirements: []
139
151
  rubyforge_project:
140
- rubygems_version: 2.4.6
152
+ rubygems_version: 1.8.25
141
153
  signing_key:
142
- specification_version: 4
154
+ specification_version: 3
143
155
  summary: Suning Pay 1.1.2 doc.
144
156
  test_files: []
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 38850acc8a1b1623c68ac8b15d5053dcab8685c4
4
- data.tar.gz: 35bdce9eddc6623abdf9baafa7acdda6de464e3d
5
- SHA512:
6
- metadata.gz: 2e9ed3876db66cb6dab7cf7ffeda5da1abf984d213330836af29719d3a2397d5a0b4ad3c0f3cb7aeba0e5530806d41f9179623d3915ddb1f39d003160b1a83a5
7
- data.tar.gz: 0a1b9723f74cfa0d3fed7ad5506ec691f7bd9c3ced475c163dd629c292e5d93b97b4f3c0a8dd4a9bb2ef56efbdec08bdd4797e025dd76f250afb829ab8f60cc0