toss_payments 0.5.1 → 0.6.1
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 +4 -4
- data/lib/toss_payments.rb +10 -9
- 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: 19fd7f260f18f07dbbd138cba5ce4e83505b69dd866c98c57b6a625535915c22
|
4
|
+
data.tar.gz: fa6f41b17e4a86a0e1a29edbcc085154547a29297ff216f5cca84fe1e9be7cde
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2b590261adaf9c820c492a2a20d41286faa2374cae3af02b5dab985b96d2feb5f483fb6d2018cbd9507015fad28a04e22ee8430852febb3ff59bd3715cd8066
|
7
|
+
data.tar.gz: 4be8a8dc2160ebf270fc19ab758ed8df38cf6040b881ac41bcff60a5acc617eae0aad624a75efc25cacd3b0a9776dd4590b28916f577749782325f824cdcd874
|
data/lib/toss_payments.rb
CHANGED
@@ -153,6 +153,7 @@ module TossPayments
|
|
153
153
|
|
154
154
|
class Config
|
155
155
|
attr_accessor :secret_key
|
156
|
+
attr_accessor :billing_secret_key
|
156
157
|
end
|
157
158
|
|
158
159
|
class << self
|
@@ -201,34 +202,34 @@ module TossPayments
|
|
201
202
|
|
202
203
|
def billing_auth_card(payload = {})
|
203
204
|
uri = "billing/authorizations/card"
|
204
|
-
post(uri, payload, response_type: :billing)
|
205
|
+
post(uri, payload, response_type: :billing, secret_key_type: :billing)
|
205
206
|
end
|
206
207
|
|
207
208
|
def billing_auth_issue(payload = {})
|
208
209
|
uri = "billing/authorizations/issue"
|
209
|
-
post(uri, payload, response_type: :billing)
|
210
|
+
post(uri, payload, response_type: :billing, secret_key_type: :billing)
|
210
211
|
end
|
211
212
|
|
212
213
|
def billing(billing_key, payload = {})
|
213
214
|
uri = "billing/#{billing_key}"
|
214
|
-
post(uri, payload)
|
215
|
+
post(uri, payload, secret_key_type: :billing)
|
215
216
|
end
|
216
217
|
|
217
218
|
private
|
218
219
|
|
219
|
-
def headers
|
220
|
-
{ "Authorization": "Basic #{Base64.strict_encode64(config.secret_key + ":")}" }
|
220
|
+
def headers(secret_key_type: :normal)
|
221
|
+
{ "Authorization": "Basic #{Base64.strict_encode64((secret_key_type === :billing ? billing_config : config).secret_key + ":")}" }
|
221
222
|
end
|
222
223
|
|
223
|
-
def get(uri, payload = {}, response_type: :payment)
|
224
|
+
def get(uri, payload = {}, response_type: :payment, secret_key_type: :normal)
|
224
225
|
url = "#{HOST}/#{uri}"
|
225
|
-
response = HTTParty.get(url, headers: headers
|
226
|
+
response = HTTParty.get(url, headers: headers(secret_key_type: secret_key_type)).parsed_response
|
226
227
|
response_to_model(response, response_type: response_type)
|
227
228
|
end
|
228
229
|
|
229
|
-
def post(uri, payload = {}, response_type: :payment)
|
230
|
+
def post(uri, payload = {}, response_type: :payment, secret_key_type: :normal)
|
230
231
|
url = "#{HOST}/#{uri}"
|
231
|
-
response = HTTParty.post(url, headers: headers.merge("Content-Type": "application/json"), body: payload.to_json).parsed_response
|
232
|
+
response = HTTParty.post(url, headers: headers(secret_key_type: secret_key_type).merge("Content-Type": "application/json"), body: payload.to_json).parsed_response
|
232
233
|
response_to_model(response, response_type: response_type)
|
233
234
|
end
|
234
235
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: toss_payments
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Soohyeon Lee
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-04-14 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: toss payments api
|
14
14
|
email: lsh59727@gmail.com
|