daicadp 0.1.2 → 0.1.3

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
  SHA256:
3
- metadata.gz: d7c322db429b5e652b0f3408b4df108edcf9c86f43423230e8670789bf4317db
4
- data.tar.gz: 600252241935528dabb70cea2b5dccc4bfd8e2734d310b52fef8115a1475a7d1
3
+ metadata.gz: a41689b926a3ae445a4f211d887bf8ca6d33ae3c6408107fc2830d4e4410506f
4
+ data.tar.gz: 18607da2a352ebea0c4ee3986b3bd60b29437ec389f6c984e9d9c6930a8c4eef
5
5
  SHA512:
6
- metadata.gz: 3c3157a4d91f78c1da71eef7dbf13ffd7692bb3a8a0fd88ccb14af672930aa91e20c0b8079bb47281d86b549e694cfee3aed5f4e36f67ffe205724cb2ea67168
7
- data.tar.gz: '049e712c0898584063e04777a383fa224f1d9ce3e16545f58575cf222c5d596d6bf2b944292e6b72d1b495f8b87820f98d846961b09b6f89f5c91040a124f63a'
6
+ metadata.gz: 4e1ad3bc6b8adf4a838c8ed079fc60701131a8c82114ec4f7b833ce89234a62366d06ab8fbad5b957f18603dc50c755b70139c26ddfc83831ffb80206f2042c7
7
+ data.tar.gz: b08b59c25438ea471ccf244645121485ba51bf4ad4e4fa04afd0035972cb02c39a1a4562620bd542a9e27605f9f7b423697aff4271f821550da8ed75f9441d24
@@ -1,8 +1,8 @@
1
1
  require 'openssl'
2
2
 
3
- module Daicadp
4
- module Helper
5
- def sign(data, secret, type = 'sha256')
6
- digest = OpenSSL::Digest.new(type)
7
- OpenSSL::HMAC.hexdigest(digest, secret, data)
8
- end
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
@@ -1,3 +1,3 @@
1
1
  module Daicadp
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
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.ZKPAY_HOST_DEV : ZkConstants.ZKPAY_HOST
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.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - daicadp