leshua_pay 0.0.1 → 0.0.2

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: 5a53ae13d626b0bc0673f7b008448d79e42f114b
4
- data.tar.gz: 525108a9ff39aee947fbaf551b509ce1f072e907
3
+ metadata.gz: 23d3aca522ac9302b61e918e4d79cd3b422f912e
4
+ data.tar.gz: 87cbd70a820e27c70f39056e6ab6a80798dd7133
5
5
  SHA512:
6
- metadata.gz: 47a7c4a8855d0663f2e11a155d2428f931c77fae3fd4664309d636b636913e3fd17a5079b2b6e37bbe906868fa46c67153ac35b0def384139eb2f8c2b78410a7
7
- data.tar.gz: 3bef41811ac21014d4d4d14b7379d59ba73dbaa98ad9ee9573084ffdecd969a32d32acf57927ecf5fdcea17bb22e28ba8c4f47a31c1d3fe3fdbc9c098af1873b
6
+ metadata.gz: 8cbb8dcedd8aa446f3aa9b223cccb72be7e5ff7ab8055fdcb3fa13af55a1899140ad5732f8952fbc48814cf46481d5168e6a5ed76c5ef3ac391ce6b76ec04e4c
7
+ data.tar.gz: 41279cf0475abfb80b65aa5661aab9eb74503d8cfbf94b951f47969da97c07838ba4c1dc7e060479a3b35e289805a5031f9f6a16bcf1696180a48c1e7ced74f9
@@ -11,26 +11,27 @@ module LeshuaPay
11
11
  def scan_code_pay opt
12
12
  options = {
13
13
  merchant_id: Config.mch_id,
14
- nonce_str: SecureRandom.base64(16),
14
+ nonce_str: SecureRandom.hex(16),
15
15
  service: 'get_tdcode',
16
16
  pay_way: 'WXZF',
17
17
  appid: Config.app_id,
18
18
  body: 'LeshuaPay',
19
- jspay_flag: 0,
19
+ jspay_flag: 3,
20
20
  }
21
21
 
22
22
  ext_opt = opt.slice(
23
- :pay_way, :sub_openid, :third_order_id, :body, :client_ip, :amount, :notify_url,
23
+ :pay_way, :sub_openid, :jspay_flag, :third_order_id, :body, :client_ip, :amount, :notify_url,
24
24
  :callback_url, :goods_tag, :limit_pay, :shop_no, :pos_no, :attach, :app_id)
25
25
 
26
26
  options = options.merge ext_opt
27
+
27
28
  http_post(Config::LEPOS_PAY_GATEWAY_URL, Sign.signature(options))
28
29
  end
29
30
 
30
31
  def barcode_pay opt
31
32
  options = {
32
33
  merchant_id: Config.mch_id,
33
- nonce_str: SecureRandom.base64(16),
34
+ nonce_str: SecureRandom.hex(16),
34
35
  service: 'upload_authcode',
35
36
  appid: Config.app_id,
36
37
  body: 'LeshuaPay',
@@ -49,7 +50,7 @@ module LeshuaPay
49
50
  merchant_id: Config.mch_id,
50
51
  service: 'query_status',
51
52
  third_order_id: order_id,
52
- nonce_str: SecureRandom.base64(16),
53
+ nonce_str: SecureRandom.hex(16),
53
54
  }
54
55
 
55
56
  http_post(Config::LEPOS_PAY_GATEWAY_URL, Sign.signature(options))
@@ -58,7 +59,7 @@ module LeshuaPay
58
59
  def refund opt
59
60
  options = {
60
61
  merchant_id: Config.mch_id,
61
- nonce_str: SecureRandom.base64(16),
62
+ nonce_str: SecureRandom.hex(16),
62
63
  service: 'unified_refund',
63
64
  }
64
65
 
@@ -72,7 +73,7 @@ module LeshuaPay
72
73
  def unified_query_refund opt
73
74
  options = {
74
75
  merchant_id: Config.mch_id,
75
- nonce_str: SecureRandom.base64(16),
76
+ nonce_str: SecureRandom.hex(16),
76
77
  service: 'unified_query_refund',
77
78
  }
78
79
 
@@ -86,6 +87,7 @@ module LeshuaPay
86
87
  private
87
88
 
88
89
  def http_post url, body
90
+ puts body
89
91
  response = HTTParty.post(
90
92
  url,
91
93
  body: body,
@@ -15,6 +15,8 @@ module LeshuaPay
15
15
 
16
16
  def signature options
17
17
  to_param(options)+"&sign="+md5(options)
18
+ # options[:sign] = md5(options)
19
+ # options.to_json
18
20
  end
19
21
 
20
22
  def valid? options
@@ -1,3 +1,3 @@
1
1
  module LeshuaPay
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/leshua_pay.rb CHANGED
@@ -1,13 +1,13 @@
1
1
  require "leshua_pay/version"
2
2
  require "leshua_pay/sign"
3
- require "leshua_pay/utils"
4
3
  require "leshua_pay/service"
5
4
 
6
5
  module LeshuaPay
7
6
 
8
7
  class Config
9
8
 
10
- API_HOST = 'http://testlepos.yeahka.com:43102'
9
+ # API_HOST = 'https://testpaygate.yeahka.s'
10
+ API_HOST = 'https://mobilepos.yeahka.com'
11
11
  LEPOS_PAY_GATEWAY_URL = API_HOST + '/cgi-bin/lepos_pay_gateway.cgi'
12
12
 
13
13
  class << self
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe LeshuaPay::Utils do
4
- let (:utils) { LeshuaPay::Utils }
5
4
  let (:hash) { {a:1, b:'TEST'} }
6
5
 
7
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: leshua_pay
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tony Tong
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-10 00:00:00.000000000 Z
11
+ date: 2018-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -182,7 +182,6 @@ files:
182
182
  - lib/leshua_pay.rb
183
183
  - lib/leshua_pay/service.rb
184
184
  - lib/leshua_pay/sign.rb
185
- - lib/leshua_pay/utils.rb
186
185
  - lib/leshua_pay/version.rb
187
186
  - spec/leshua_pay/sign_spec.rb
188
187
  - spec/leshua_pay/utils_spec.rb
@@ -1,13 +0,0 @@
1
- module LeshuaPay
2
- module Utils
3
- class << self
4
- def timestamp
5
- Time.now.to_i
6
- end
7
-
8
- def nonce_str
9
- SecureRandom.urlsafe_base64(nil, false)
10
- end
11
- end
12
- end
13
- end