toss_payments 0.0.0
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 +7 -0
- data/lib/toss_payments.rb +85 -0
- metadata +43 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e315444c4049b45e7230121e53497109beec335dad556bba86531e73920cb9c8
|
4
|
+
data.tar.gz: 6c449188660da72d13d3de59567c59fbe0cd29292a4f4f305d1beb6091d28905
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: '09eeb48de04535a5e20e77ed01ed229f17f11cc0dfa4f0df6f0f87c5c006373439b13b2f47378c3d1b2e073744a3bc50c21942a14714110c71d8a6863452e5ed'
|
7
|
+
data.tar.gz: 3aae4d18e2b2c87106889ea51f0290530893595fc1ebb8f236f007c18bc28c505f3984775f0ea93f18673c41a9e8c8e0df0eb9088568d486ea760225da4d4341
|
@@ -0,0 +1,85 @@
|
|
1
|
+
require "httparty"
|
2
|
+
|
3
|
+
module TossPayments
|
4
|
+
HOST = "https://api.tosspayments.com/v1"
|
5
|
+
|
6
|
+
class Config
|
7
|
+
attr_accessor :secret_key
|
8
|
+
end
|
9
|
+
|
10
|
+
class << self
|
11
|
+
def configure
|
12
|
+
yield(config) if block_given?
|
13
|
+
end
|
14
|
+
|
15
|
+
def config
|
16
|
+
@config ||= Config.new
|
17
|
+
end
|
18
|
+
|
19
|
+
def payments(payload = {})
|
20
|
+
uri = "payments"
|
21
|
+
post(uri, payload)
|
22
|
+
end
|
23
|
+
|
24
|
+
def confirm(payload = {})
|
25
|
+
uri = "confirm"
|
26
|
+
post(uri, payload)
|
27
|
+
end
|
28
|
+
|
29
|
+
def find(payment_key)
|
30
|
+
uri = "payments/#{payment_key}"
|
31
|
+
get(uri)
|
32
|
+
end
|
33
|
+
|
34
|
+
def find_by_order_id(order_id)
|
35
|
+
uri = "payments/orders/#{order_id}"
|
36
|
+
get(uri)
|
37
|
+
end
|
38
|
+
|
39
|
+
def cancel(payment_key, payload = {})
|
40
|
+
uri = "payments/#{payment_key}/cancel"
|
41
|
+
post(uri, payload)
|
42
|
+
end
|
43
|
+
|
44
|
+
def payments_key_in(payload = {})
|
45
|
+
uri = "payments/key-in"
|
46
|
+
post(uri, payload)
|
47
|
+
end
|
48
|
+
|
49
|
+
def virtual_accounts(payload = {})
|
50
|
+
uri = "virtual-accounts"
|
51
|
+
post(uri, payload)
|
52
|
+
end
|
53
|
+
|
54
|
+
def billing_auth_card(payload = {})
|
55
|
+
uri = "billing/authorizations/card"
|
56
|
+
post(uri, payload)
|
57
|
+
end
|
58
|
+
|
59
|
+
def billing_auth_issue(payload = {})
|
60
|
+
uri = "billing/authorizations/issue"
|
61
|
+
post(uri, payload)
|
62
|
+
end
|
63
|
+
|
64
|
+
def billing(billing_key, payload = {})
|
65
|
+
uri = "billing/#{billingKey}"
|
66
|
+
post(uri, payload)
|
67
|
+
end
|
68
|
+
|
69
|
+
private
|
70
|
+
|
71
|
+
def headers
|
72
|
+
{ "Authorization": "Basic #{Base64.strict_encode64(config.secret_key)}:" }
|
73
|
+
end
|
74
|
+
|
75
|
+
def get(uri, payload = {})
|
76
|
+
url = "#{HOST}/#{uri}"
|
77
|
+
HTTParty.get(url, headers: headers, body: payload)
|
78
|
+
end
|
79
|
+
|
80
|
+
def post
|
81
|
+
url = "#{HOST}/#{uri}"
|
82
|
+
HTTParty.post(url, headers: headers.merge("Content-Type": "application/json"), body: payload.to_json)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
metadata
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: toss_payments
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Soohyeon Lee
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-03-10 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: toss payments api
|
14
|
+
email: lsh59727@gmail.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/toss_payments.rb
|
20
|
+
homepage: https://github.com/lsh5972/toss-payments-ruby
|
21
|
+
licenses:
|
22
|
+
- MIT
|
23
|
+
metadata: {}
|
24
|
+
post_install_message:
|
25
|
+
rdoc_options: []
|
26
|
+
require_paths:
|
27
|
+
- lib
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ">="
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
requirements: []
|
39
|
+
rubygems_version: 3.3.7
|
40
|
+
signing_key:
|
41
|
+
specification_version: 4
|
42
|
+
summary: toss payments api
|
43
|
+
test_files: []
|