veritrans 1.2.5 → 1.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
- metadata.gz: 94a85d7ba51b28218640ca1b7c1cdc0f693832fa
4
- data.tar.gz: 6c3d583110c07af03ccf8f36d86f054729684c53
3
+ metadata.gz: 4a017d4aab2833fbc4ba25a649fe9a00d93eec35
4
+ data.tar.gz: bafcedb6c0a86d539747f90596e51a11766bb431
5
5
  !binary "U0hBNTEy":
6
- metadata.gz: 4348ab2ea7d56a63a402f8b810b8e825c9a11859003d79e45a54d217a584467f5fb2fb965eb82c295572a299a5f50a64cfac5e6a812291c308a1e608b95dfe82
7
- data.tar.gz: 59477c929e6df819d8794d628a8c956e378bcae3e95df8842e3d7327cde58ccbed92e065901e236ccbdf92ddc6d8dbc54f6d525b14411725a3148b4f8ddd1f21
6
+ metadata.gz: f4e0013cacbaabe14522d6e111982c6171d4955e7c25fe8b281a79096f0998f660fa20fc257d02dd626bf68837373df3daf021f382dce58ccc2477d54d90c6b5
7
+ data.tar.gz: 75430bc2305e45fb21c423d7ac8017456b54214bc305b83f9dd397180389e2aafcb59f5b4f236f9836879b3284584a5edd89abaf2149e90f6cb6910f59e7a476
@@ -117,7 +117,11 @@ module Veritrans
117
117
  delete_keys
118
118
  @resp[:url] = @resp[:url].to_s
119
119
 
120
- @token = parse_body(@resp[:body])
120
+ if version.to_i == 1
121
+ @token = JSON.parse(@resp[:body])
122
+ else
123
+ @token = parse_body(@resp[:body])
124
+ end
121
125
  end
122
126
 
123
127
  # :nodoc:
@@ -194,12 +198,16 @@ module Veritrans
194
198
  end
195
199
 
196
200
  private
197
-
201
+ # Generate merchant hash code
198
202
  def merchanthash
199
- # Generate merchant hash code
200
- return HashGenerator::generate(merchant_id, merchant_hash_key, settlement_type, order_id);
203
+ if version.to_i == 1
204
+ return HashGenerator::generate(merchant_hash_key, merchant_id, order_id);
205
+ else
206
+ return Digest::SHA512.hexdigest("#{merchant_hash_key},#{merchant_id},01,#{order_id},#{gross_amount}")
207
+ end
201
208
  end
202
209
 
210
+ # deprecated
203
211
  def parse_body(body)
204
212
  arrs = body.split("\r\n")
205
213
  arrs = arrs[-2,2] if arrs.length > 1
@@ -3,17 +3,17 @@ module Veritrans
3
3
 
4
4
  # :nodoc:
5
5
  module HashGenerator
6
-
7
6
  # Generate hash using SHA-512.
8
7
  #
9
8
  # Parameters:
10
- # * <tt>[String]merchant_id</tt> - Merchant ID
11
- # * <tt>[String]merchant_hash_key</tt> - Merchant Hash key
9
+ # * <tt>[String]merchant_hash_key</tt> - Merchant Hash key
10
+ # * <tt>[String]merchant_id</tt> - Merchant ID
12
11
  # * <tt>[String]settlement_method</tt> - '01' Credit Card
13
12
  # * <tt>[String]order_id</tt>
14
13
  # * <tt>[String]amount</tt>
15
- def self.generate(merchant_id, merchant_hash_key, settlement_method, order_id)
16
- Digest::SHA512.hexdigest("#{merchant_hash_key},#{merchant_id},#{settlement_method},#{order_id}")
14
+ def self.generate(merchant_hash_key, merchant_id, order_id)
15
+ return Digest::SHA512.hexdigest("#{merchant_hash_key},#{merchant_id},#{order_id}")
17
16
  end
17
+
18
18
  end
19
19
  end
@@ -134,7 +134,8 @@ module Veritrans
134
134
  :promo_id,
135
135
  :promo_bins,
136
136
  :enable_3d_secure,
137
- :bank
137
+ :bank,
138
+ :version
138
139
  ]
139
140
 
140
141
  # +:merchant_id,+
@@ -147,8 +148,7 @@ module Veritrans
147
148
  :merchanthash,
148
149
  :finish_payment_return_url,
149
150
  :unfinish_payment_return_url,
150
- :error_payment_return_url,
151
- :new_api
151
+ :error_payment_return_url
152
152
  ]
153
153
 
154
154
  # Params are the combination of this group:
@@ -24,7 +24,7 @@ module Veritrans
24
24
 
25
25
  # :nodoc:
26
26
  def patch
27
- 5
27
+ 6
28
28
  end
29
29
 
30
30
  # :nodoc:
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: veritrans
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.5
4
+ version: 1.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Veritrans Dev Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-03 00:00:00.000000000 Z
11
+ date: 2014-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -99,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
99
99
  version: '0'
100
100
  requirements: []
101
101
  rubyforge_project: veritrans
102
- rubygems_version: 2.0.0
102
+ rubygems_version: 2.0.3
103
103
  signing_key:
104
104
  specification_version: 4
105
105
  summary: Veritrans Webclient wrapper