daicadp 0.1.1 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/daicadp.gemspec +1 -1
- data/lib/daicadp/helper.rb +6 -6
- data/lib/daicadp/version.rb +1 -1
- data/lib/daicadp.rb +3 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a41689b926a3ae445a4f211d887bf8ca6d33ae3c6408107fc2830d4e4410506f
|
4
|
+
data.tar.gz: 18607da2a352ebea0c4ee3986b3bd60b29437ec389f6c984e9d9c6930a8c4eef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e1ad3bc6b8adf4a838c8ed079fc60701131a8c82114ec4f7b833ce89234a62366d06ab8fbad5b957f18603dc50c755b70139c26ddfc83831ffb80206f2042c7
|
7
|
+
data.tar.gz: b08b59c25438ea471ccf244645121485ba51bf4ad4e4fa04afd0035972cb02c39a1a4562620bd542a9e27605f9f7b423697aff4271f821550da8ed75f9441d24
|
data/daicadp.gemspec
CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
18
18
|
|
19
19
|
spec.add_dependency 'json'
|
20
|
-
spec.add_dependency 'net
|
20
|
+
spec.add_dependency 'net-http'
|
21
21
|
spec.add_dependency 'openssl'
|
22
22
|
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
23
23
|
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
data/lib/daicadp/helper.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'openssl'
|
2
2
|
|
3
|
-
module Daicadp
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
3
|
+
module Daicadp::Helper
|
4
|
+
def self.sign(data, secret, type = 'sha256')
|
5
|
+
digest = OpenSSL::Digest.new(type)
|
6
|
+
OpenSSL::HMAC.hexdigest(digest, secret, data)
|
7
|
+
end
|
8
|
+
end
|
data/lib/daicadp/version.rb
CHANGED
data/lib/daicadp.rb
CHANGED
@@ -12,11 +12,12 @@ $ZkConstants = {
|
|
12
12
|
};
|
13
13
|
|
14
14
|
module Daicadp
|
15
|
+
include Daicadp::Helper
|
15
16
|
class Client
|
16
17
|
attr_reader :options
|
17
18
|
|
18
19
|
def initialize(options)
|
19
|
-
options[:host] = options[:test] ? ZkConstants
|
20
|
+
options[:host] = options[:test] ? ZkConstants[:ZKPAY_HOST_DEV] : ZkConstants[:ZKPAY_HOST]
|
20
21
|
@options = options
|
21
22
|
end
|
22
23
|
|
@@ -27,12 +28,10 @@ module Daicadp
|
|
27
28
|
merchantOrder: order[:orderId],
|
28
29
|
}
|
29
30
|
data[:merchantUser] = order[:userId] if order[:userId]
|
30
|
-
|
31
31
|
sorted_params = data.sort.to_h
|
32
32
|
query = sorted_params.map { |key, value| "#{key}=#{value}" }.join('&')
|
33
33
|
signed_data = Helper.sign(query, options[:secret], 'sha256')
|
34
|
-
|
35
|
-
return "#{options[:test] ? ZkConstants.ZKPAY_WEB_DEV : ZkConstants.ZKPAY_WEB}?#{query}&secureHash=#{signed_data}&returnUrl=#{options[:returnUrl]}"
|
34
|
+
return "#{options[:test] ? ZkConstants[:ZKPAY_WEB_DEV] : ZkConstants[:ZKPAY_WEB]}?#{query}&secureHash=#{signed_data}&returnUrl=#{options[:returnUrl]}"
|
36
35
|
end
|
37
36
|
|
38
37
|
def get_merchant_transaction(id)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: daicadp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- daicadp
|
@@ -25,7 +25,7 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name: net
|
28
|
+
name: net-http
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|