wx_pay 0.14.2 → 0.15.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: ea8c2a2950264c3ef20b181aecd5dd1b03a1b514
4
- data.tar.gz: 983a59f2c04e8bed5d7747b8f17b8f143935b320
3
+ metadata.gz: c7716b9c31fb5cbf24db64ca0aad7c228ab1dc1f
4
+ data.tar.gz: ec0a6c208012f09829ff8e2b37238a25b5c07659
5
5
  SHA512:
6
- metadata.gz: a1b20a71134dcaa5a96a9fd9a7f165af93bee435dbbdc3dce25393b36b9669076650a1ca0519b69cde4c51428293991ef92c9663f84e13e44172471143e30215
7
- data.tar.gz: 7bac70017ebe7a3117e51285addc63c42d0eb023fbd301606985a0a296dbe12f53b9235229fba604139b73e14fec3354a1b9174915521ceea2c19c2e65530925
6
+ metadata.gz: 4edecc4552ee556a99620920fb3126d09f7ae3d478c7544e6981827375edd35ed8c452037ee9616dcd5bcede35626f434f3e0e41a3e416dda1e95583b2794e94
7
+ data.tar.gz: 4ac03cae8b014baadad894fe6ef26f528e1f27c41ec12d35414a787f4471fbcb04436d2736616e191d38c5875595bf30f682eb91d927276fe3e1fae2bbb497b6
@@ -25,6 +25,18 @@ module WxPay
25
25
  ), quirks_mode: true)
26
26
  end
27
27
 
28
+ def self.authenticate_from_weapp(js_code, options = {})
29
+ options = WxPay.extra_rest_client_options.merge(options)
30
+ url = "https://api.weixin.qq.com/sns/jscode2session?appid=#{WxPay.appid}&secret=#{WxPay.appsecret}&js_code=#{js_code}&grant_type=authorization_code"
31
+
32
+ ::JSON.parse(RestClient::Request.execute(
33
+ {
34
+ method: :get,
35
+ url: url
36
+ }.merge(options)
37
+ ), quirks_mode: true)
38
+ end
39
+
28
40
  INVOKE_UNIFIEDORDER_REQUIRED_FIELDS = [:body, :out_trade_no, :total_fee, :spbill_create_ip, :notify_url, :trade_type]
29
41
  def self.invoke_unifiedorder(params, options = {})
30
42
  params = {
@@ -1,3 +1,3 @@
1
1
  module WxPay
2
- VERSION = '0.14.2'
2
+ VERSION = '0.15.0'
3
3
  end
data/test/test_helper.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'active_support/core_ext/hash/conversions'
2
2
  require 'minitest/autorun'
3
3
  require 'wx_pay'
4
- require 'fakeweb'
4
+ require 'webmock/minitest'
5
5
 
6
6
  WxPay.appid = 'wxd930ea5d5a258f4f'
7
7
  WxPay.key = '8934e7d15453e97507ef794cf7b0519d'
@@ -32,11 +32,7 @@ class ServiceTest < MiniTest::Test
32
32
  </xml>
33
33
  EOF
34
34
 
35
- FakeWeb.register_uri(
36
- :post,
37
- %r|https://api\.mch\.weixin\.qq\.com*|,
38
- body: response_body
39
- )
35
+ stub_request(:post, 'api.mch.weixin.qq.com').to_return(body: response_body)
40
36
  end
41
37
 
42
38
  def test_accept_multiple_app_id_when_invoke
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wx_pay
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.2
4
+ version: 0.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jasl
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-14 00:00:00.000000000 Z
11
+ date: 2017-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -67,19 +67,19 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '11.2'
69
69
  - !ruby/object:Gem::Dependency
70
- name: fakeweb
70
+ name: webmock
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '1'
75
+ version: '2.3'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '1'
82
+ version: '2.3'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: minitest
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -132,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
132
  version: '0'
133
133
  requirements: []
134
134
  rubyforge_project:
135
- rubygems_version: 2.6.10
135
+ rubygems_version: 2.6.11
136
136
  signing_key:
137
137
  specification_version: 4
138
138
  summary: An unofficial simple wechat pay gem