jasl_tenpay 1.0.2 → 1.1.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: 40b69167296fd37ae3156d644cc9385a83a8cd70
4
- data.tar.gz: ae11063ac2e002a8cfd7702e2c2448ad7391c02e
3
+ metadata.gz: 0eb0ec6d4ae624fc3b537816fc80910ef7c0db30
4
+ data.tar.gz: 07c2159ab2d429a6b141904892a9b929b194d616
5
5
  SHA512:
6
- metadata.gz: 49a87f61bec986be2b647ad42e19a5ff9ef0782f97c06e515d66f9141d77cb90a7e923e896825cd30388424c0a865ea60b7d7c5bb5fa976eefdfaf6ee5785c8c
7
- data.tar.gz: 71ac45ccbfca7517a3e9c950131c7cd78315962a4edd644ba69690701c7b86e13eed82ab8fcca5e51c7a1bee3368e339701ff7a8830ca21002f40983bbc594b1
6
+ metadata.gz: f2117ae40e7525856791fcaab225aa94f335dc5fa3dcbf7b226aac4bf131a27608e1575e0f0a025ace0338c0098463eea06170e8f82fce20192d3d9ce1ac29f7
7
+ data.tar.gz: 8c7fe851802b2a3f201c927c70d078c9a35617ef2edc24a0871aeb66ec11f5fe65dc21b9b2de372fbca3e04ac8d2ac838e9c3309c90b8a222f71ff0015d7d1ca
@@ -1,10 +1,9 @@
1
1
  module JaslTenpay
2
- class Notify
2
+ module Notify
3
3
  GATEWAY = 'https://gw.tenpay.com/gateway/simpleverifynotifyid.xml'
4
4
  SUCCESS_STR = '<retcode>0</retcode>'
5
- TRADE_STATE_SUCCESS_STR = '<trade_state>0</trade_state>'
6
5
 
7
- def self.verify?(params, options = {})
6
+ def self.verify?(params)
8
7
  return false unless Sign.verify?(params)
9
8
 
10
9
  params = {
@@ -12,9 +11,8 @@ module JaslTenpay
12
11
  'partner' => JaslTenpay.pid,
13
12
  'notify_id' => CGI.escape(params[:notify_id].to_s)
14
13
  }
15
- result = open("#{GATEWAY}?#{Utils.make_query_string(params)}").read
16
14
 
17
- result.include?(SUCCESS_STR) && (options[:verify_trade_state] ? result.include?(TRADE_STATE_SUCCESS_STR) : true)
15
+ open("#{GATEWAY}?#{Utils.make_query_string(params)}").read.include?(SUCCESS_STR)
18
16
  end
19
17
  end
20
18
  end
@@ -1,3 +1,3 @@
1
1
  module JaslTenpay
2
- VERSION = "1.0.2"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -7,7 +7,6 @@ class JaslTenpay::NotifyTest < Test::Unit::TestCase
7
7
  <input_charset>UTF-8</input_charset>
8
8
  <partner>2000054321</partner>
9
9
  <retcode>0</retcode>
10
- <trade_state>0</trade_state>
11
10
  <retmsg />
12
11
  <sign>1C58B3A778D9F49F3FA91D30E9A831D2</sign>
13
12
  <sign_key_index>1</sign_key_index>
@@ -28,19 +27,6 @@ class JaslTenpay::NotifyTest < Test::Unit::TestCase
28
27
  </root>
29
28
  XML
30
29
 
31
- SUCCESS_BUT_TRADE_STATE_FAIL_RETURN = <<-XML
32
- <?xml version="1.0" encoding="GBK"?>
33
- <root>
34
- <input_charset>UTF-8</input_charset>
35
- <partner>2000054321</partner>
36
- <retcode>0</retcode>
37
- <retmsg />
38
- <sign>1C58B3A778D9F49F3FA91D30E9A831D2</sign>
39
- <sign_key_index>1</sign_key_index>
40
- <sign_type>MD5</sign_type>
41
- </root>
42
- XML
43
-
44
30
  def setup
45
31
  @options = {
46
32
  :notify_id => '123456789012345678901234567890',
@@ -58,14 +44,4 @@ class JaslTenpay::NotifyTest < Test::Unit::TestCase
58
44
  FakeWeb.register_uri(:get, @url, :body => FAIL_RETURN)
59
45
  assert !JaslTenpay::Notify.verify?(@options)
60
46
  end
61
-
62
- def test_verify_notify_with_trade_state_when_success
63
- FakeWeb.register_uri(:get, @url, :body => SUCCESS_RETURN)
64
- assert JaslTenpay::Notify.verify?(@options, verify_trade_state: true)
65
- end
66
-
67
- def test_verify_notify_with_trade_state_when_fail
68
- FakeWeb.register_uri(:get, @url, :body => SUCCESS_BUT_TRADE_STATE_FAIL_RETURN)
69
- assert !JaslTenpay::Notify.verify?(@options, verify_trade_state: true)
70
- end
71
47
  end
metadata CHANGED
@@ -1,55 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jasl_tenpay
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jasl
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-18 00:00:00.000000000 Z
11
+ date: 2013-12-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: fakeweb
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  description: An unofficial simple tenpay gem
@@ -59,15 +59,15 @@ executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
+ - MIT-LICENSE
63
+ - Rakefile
64
+ - lib/jasl_tenpay.rb
62
65
  - lib/jasl_tenpay/notify.rb
63
66
  - lib/jasl_tenpay/service.rb
64
67
  - lib/jasl_tenpay/sign.rb
65
68
  - lib/jasl_tenpay/utils.rb
66
69
  - lib/jasl_tenpay/version.rb
67
- - lib/jasl_tenpay.rb
68
70
  - lib/tasks/jasl_tenpay_tasks.rake
69
- - MIT-LICENSE
70
- - Rakefile
71
71
  - test/jasl_tenpay/notify_test.rb
72
72
  - test/jasl_tenpay/service_test.rb
73
73
  - test/jasl_tenpay/sign_test.rb
@@ -83,17 +83,17 @@ require_paths:
83
83
  - lib
84
84
  required_ruby_version: !ruby/object:Gem::Requirement
85
85
  requirements:
86
- - - '>='
86
+ - - ">="
87
87
  - !ruby/object:Gem::Version
88
88
  version: '0'
89
89
  required_rubygems_version: !ruby/object:Gem::Requirement
90
90
  requirements:
91
- - - '>='
91
+ - - ">="
92
92
  - !ruby/object:Gem::Version
93
93
  version: '0'
94
94
  requirements: []
95
95
  rubyforge_project:
96
- rubygems_version: 2.1.11
96
+ rubygems_version: 2.2.0.rc.1
97
97
  signing_key:
98
98
  specification_version: 4
99
99
  summary: An unofficial simple tenpay gem