bootpay-backend-ruby 2.0.1 → 2.0.4
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/.gitignore +3 -1
- data/README.md +44 -8
- data/lib/bootpay/concern/authenticate.rb +52 -0
- data/lib/bootpay/concern/cash_receipt.rb +35 -0
- data/lib/bootpay/concern/escrow.rb +3 -2
- data/lib/bootpay/concern/payment.rb +81 -11
- data/lib/bootpay/concern/reseller.rb +30 -2
- data/lib/bootpay/concern/rest.rb +7 -4
- data/lib/bootpay/concern/seller.rb +15 -0
- data/lib/bootpay/concern/subscription.rb +75 -1
- data/lib/bootpay/concern.rb +2 -0
- data/lib/bootpay/version.rb +1 -1
- data/lib/bootpay-backend-ruby.rb +19 -1
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 38d5c0abc185377ab50ee35741f6292bc7b7d120af37a4e7a4381284aaa96386
|
4
|
+
data.tar.gz: f79e975b04aeca94fd7bb2868e0e87997be642c6f3e39176a1aa67c6c6a394f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7dbc65ca723151fda2fb613338ebe3c9e6207f36fe1039532e3d7340ca1cbdbb6bc0f3ca11180cca5b84b964e5a358bd7601713309f9e522ee6a51513d0d393c
|
7
|
+
data.tar.gz: 8bfa409bbadad4e0aeddd681e3a465786be62d5c325c21ba899a98a0610c599ce4a66c5151eb4cde2c80b3fe1f93eeb5dedee084058202d61b52357d79e22f04
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -13,15 +13,23 @@ Ruby 언어로 작성된 어플리케이션, 프레임워크 등에서 사용가
|
|
13
13
|
2. 결제 단건 조회
|
14
14
|
3. 결제 취소 (전액 취소 / 부분 취소)
|
15
15
|
4. 신용카드 자동결제 (빌링결제)
|
16
|
+
|
16
17
|
4-1. 빌링키 발급
|
18
|
+
|
17
19
|
4-2. 발급된 빌링키로 결제 승인 요청
|
20
|
+
|
18
21
|
4-3. 발급된 빌링키로 결제 예약 요청
|
22
|
+
|
19
23
|
4-4. 발급된 빌링키로 결제 예약 - 취소 요청
|
24
|
+
|
20
25
|
4-5. 빌링키 삭제
|
21
|
-
|
26
|
+
|
27
|
+
4-6. 빌링키 조회
|
28
|
+
|
22
29
|
5. (생체인증, 비밀번호 결제를 위한) 구매자 토큰 발급
|
23
30
|
6. 서버 승인 요청
|
24
31
|
7. 본인 인증 결과 조회
|
32
|
+
8. (에스크로 이용시) PG사로 배송정보 보내기
|
25
33
|
|
26
34
|
## Gem으로 설치하기
|
27
35
|
|
@@ -75,7 +83,7 @@ api.request_access_token.success?
|
|
75
83
|
|
76
84
|
|
77
85
|
## 2. 결제 단건 조회
|
78
|
-
|
86
|
+
승인/취소된 결제건을 조회합니다. 위변조된 결제인지 검증하기 위해 사용됩니다.
|
79
87
|
```ruby
|
80
88
|
api = Bootpay::RestClient.new(
|
81
89
|
application_id: '59bfc738e13f337dbd6ca48a',
|
@@ -118,7 +126,7 @@ end
|
|
118
126
|
```
|
119
127
|
|
120
128
|
## 4-1. 빌링키 발급
|
121
|
-
REST API 방식으로
|
129
|
+
REST API 방식으로 고객의 카드 정보를 전달하여, PG사로부터 빌링키를 발급받을 수 있습니다. (부트페이에서는 PG사의 빌링키를 개발사에게 전달하지 않고, 부트페이가 내부적으로 발급한 빌링키를 전달합니다)
|
122
130
|
발급받은 빌링키를 저장하고 있다가, 원하는 시점, 원하는 금액에 결제 승인 요청하여 좀 더 자유로운 결제시나리오에 적용이 가능합니다.
|
123
131
|
* 비인증 정기결제(REST API) 방식을 지원하는 PG사만 사용 가능합니다.
|
124
132
|
```ruby
|
@@ -168,7 +176,7 @@ if api.request_access_token.success?
|
|
168
176
|
end
|
169
177
|
```
|
170
178
|
## 4-3. 발급된 빌링키로 결제 예약 요청
|
171
|
-
원하는 시점에 4-1로 결제 승인 요청을 보내도 되지만, 빌링키 발급 이후에 바로 결제 예약 할 수 있습니다. (빌링키당 최대
|
179
|
+
원하는 시점에 4-1로 결제 승인 요청을 보내도 되지만, 빌링키 발급 이후에 바로 결제 예약 할 수 있습니다. (빌링키당 최대 10건)
|
172
180
|
```ruby
|
173
181
|
api = Bootpay::RestClient.new(
|
174
182
|
application_id: '59bfc738e13f337dbd6ca48a',
|
@@ -219,7 +227,7 @@ if api.request_access_token.success?
|
|
219
227
|
end
|
220
228
|
```
|
221
229
|
## 4-5. 빌링키 삭제
|
222
|
-
발급된
|
230
|
+
발급된 빌링키가 더 이상 사용되지 않도록, 삭제 요청합니다.
|
223
231
|
```ruby
|
224
232
|
api = Bootpay::RestClient.new(
|
225
233
|
application_id: '59bfc738e13f337dbd6ca48a',
|
@@ -233,8 +241,9 @@ if api.request_access_token.success?
|
|
233
241
|
end
|
234
242
|
```
|
235
243
|
|
236
|
-
## 4-6.
|
237
|
-
|
244
|
+
## 4-6. 빌링키 조회
|
245
|
+
(빌링키 발급 완료시 리턴받았던 receipt_id에 한정) 어떤 빌링키였는지 조회합니다.
|
246
|
+
```ruby
|
238
247
|
api = Bootpay::RestClient.new(
|
239
248
|
application_id: '59bfc738e13f337dbd6ca48a',
|
240
249
|
private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0='
|
@@ -248,7 +257,7 @@ end
|
|
248
257
|
```
|
249
258
|
|
250
259
|
## 5. (생체인증, 비밀번호 결제를 위한) 구매자 토큰 발급
|
251
|
-
|
260
|
+
부트페이에서 제공하는 간편결제창, 생체인증 기반의 결제 사용을 위해서는 개발사에서 회원 고유번호를 관리해야하며, 해당 회원에 대한 사용자 토큰을 발급합니다.
|
252
261
|
이 토큰값을 기반으로 클라이언트에서 결제요청 하시면 되겠습니다.
|
253
262
|
```ruby
|
254
263
|
api = Bootpay::RestClient.new(
|
@@ -302,6 +311,33 @@ if api.request_access_token.success?
|
|
302
311
|
end
|
303
312
|
```
|
304
313
|
|
314
|
+
|
315
|
+
## 8. (에스크로 이용시) PG사로 배송정보 보내기
|
316
|
+
현금 거래에 한해 구매자의 안전거래를 보장하는 방법으로, 판매자와 구매자의 온라인 전자상거래가 원활하게 이루어질 수 있도록 중계해주는 매매보호서비스입니다. 국내법에 따라 전자상거래에서 반드시 적용이 되어 있어야합니다. PG에서도 에스크로 결제를 지원하며, 에스크로 결제 사용을 원하시면 PG사 가맹시에 에스크로결제를 미리 얘기하고나서 진행을 하시는 것이 수월합니다.
|
317
|
+
|
318
|
+
PG사로 배송정보( 이니시스, KCP만 지원 )를 보내서 에스크로 상태를 변경하는 API 입니다.
|
319
|
+
```ruby
|
320
|
+
api = Bootpay::RestClient.new(
|
321
|
+
application_id: '59bfc738e13f337dbd6ca48a',
|
322
|
+
private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=',
|
323
|
+
mode: 'development'
|
324
|
+
)
|
325
|
+
if api.request_access_token.success?
|
326
|
+
response = api.shipping_start(
|
327
|
+
receipt_id: "62a818cf1fc19203154a8f2e",
|
328
|
+
tracking_number: '123456',
|
329
|
+
delivery_corp: 'CJ대한통운',
|
330
|
+
user: {
|
331
|
+
username: '강훈',
|
332
|
+
phone: '01095735114',
|
333
|
+
address: '경기도 화성시 동탄기흥로 277번길 59',
|
334
|
+
zipcode: '08490'
|
335
|
+
}
|
336
|
+
)
|
337
|
+
print response.data.to_json
|
338
|
+
end
|
339
|
+
```
|
340
|
+
|
305
341
|
## Example 프로젝트
|
306
342
|
|
307
343
|
[적용한 샘플 프로젝트](https://github.com/bootpay/backend-ruby-example)을 참조해주세요
|
@@ -11,5 +11,57 @@ module Bootpay::Concern::Authenticate
|
|
11
11
|
uri: "certificate/#{receipt_id}"
|
12
12
|
)
|
13
13
|
end
|
14
|
+
|
15
|
+
# REST API로 본인인증 요청하기
|
16
|
+
# Comment by Gosomi
|
17
|
+
# Date: 2022-11-02
|
18
|
+
def request_authentication(pg:, method:, username:, identity_no:, carrier:, phone:, site_url:,
|
19
|
+
authenticate_type: 'sms', order_name: '', authentication_id: '', extra: {}, user: {})
|
20
|
+
request(
|
21
|
+
method: :post,
|
22
|
+
uri: 'request/authentication',
|
23
|
+
payload: {
|
24
|
+
pg: pg,
|
25
|
+
method: method,
|
26
|
+
username: username,
|
27
|
+
identity_no: identity_no,
|
28
|
+
carrier: carrier,
|
29
|
+
phone: phone,
|
30
|
+
site_url: site_url,
|
31
|
+
authenticate_type: authenticate_type,
|
32
|
+
order_name: order_name,
|
33
|
+
authentication_id: authentication_id,
|
34
|
+
extra: extra,
|
35
|
+
user: user
|
36
|
+
}
|
37
|
+
)
|
38
|
+
end
|
39
|
+
|
40
|
+
# 본인인증 승인결과를 가져온다
|
41
|
+
# Comment by Gosomi
|
42
|
+
# Date: 2022-11-03
|
43
|
+
def confirm_authentication(receipt_id:, otp: nil)
|
44
|
+
request(
|
45
|
+
method: :post,
|
46
|
+
uri: 'authenticate/confirm',
|
47
|
+
payload: {
|
48
|
+
receipt_id: receipt_id,
|
49
|
+
otp: otp
|
50
|
+
}
|
51
|
+
)
|
52
|
+
end
|
53
|
+
|
54
|
+
# 다시 SMS/알람 보내기
|
55
|
+
# Comment by Gosomi
|
56
|
+
# Date: 2022-11-03
|
57
|
+
def realarm_authentication(receipt_id)
|
58
|
+
request(
|
59
|
+
method: :post,
|
60
|
+
uri: 'authenticate/realarm',
|
61
|
+
payload: {
|
62
|
+
receipt_id: receipt_id
|
63
|
+
}
|
64
|
+
)
|
65
|
+
end
|
14
66
|
end
|
15
67
|
end
|
@@ -41,5 +41,40 @@ module Bootpay::Concern::CashReceipt
|
|
41
41
|
}
|
42
42
|
)
|
43
43
|
end
|
44
|
+
|
45
|
+
# 결제된 계좌이체/가상계좌 결제건중 누락된 현금영수증을 발행해주는 API
|
46
|
+
# Comment by Gosomi
|
47
|
+
# Date: 2022-07-21
|
48
|
+
def cash_receipt_publish_on_receipt(receipt_id:, username:, email:, phone:, identity_no:, currency: 'WON', cash_receipt_type: '소득공제')
|
49
|
+
request(
|
50
|
+
method: :post,
|
51
|
+
uri: "request/receipt/cash/publish",
|
52
|
+
payload: {
|
53
|
+
receipt_id: receipt_id,
|
54
|
+
username: username,
|
55
|
+
email: email,
|
56
|
+
phone: phone,
|
57
|
+
identity_no: identity_no,
|
58
|
+
currency: currency,
|
59
|
+
cash_receipt_type: cash_receipt_type
|
60
|
+
}
|
61
|
+
)
|
62
|
+
end
|
63
|
+
|
64
|
+
# 결제에 포함된 현금영수증 취소
|
65
|
+
# Comment by Gosomi
|
66
|
+
# Date: 2022-07-21
|
67
|
+
def cash_receipt_cancel_on_receipt(receipt_id:, cancel_username:, cancel_message:)
|
68
|
+
request(
|
69
|
+
method: :delete,
|
70
|
+
uri: "request/receipt/cash/cancel/#{receipt_id}",
|
71
|
+
headers: {
|
72
|
+
params: {
|
73
|
+
cancel_username: cancel_username,
|
74
|
+
cancel_message: cancel_message
|
75
|
+
}
|
76
|
+
}
|
77
|
+
)
|
78
|
+
end
|
44
79
|
end
|
45
80
|
end
|
@@ -6,7 +6,7 @@ module Bootpay::Concern::Escrow
|
|
6
6
|
# Comment by Gosomi
|
7
7
|
# Date: 2021-12-14
|
8
8
|
def shipping_start(receipt_id:, tracking_number:, delivery_corp:, shipping_prepayment: true,
|
9
|
-
shipping_day: 5, user: nil, company: {})
|
9
|
+
shipping_day: 5, user: nil, company: {}, redirect_url: nil)
|
10
10
|
request(
|
11
11
|
method: :put,
|
12
12
|
uri: "escrow/shipping/start/#{receipt_id}",
|
@@ -16,7 +16,8 @@ module Bootpay::Concern::Escrow
|
|
16
16
|
shipping_prepayment: shipping_prepayment,
|
17
17
|
shipping_day: shipping_day,
|
18
18
|
user: user,
|
19
|
-
company: company
|
19
|
+
company: company,
|
20
|
+
redirect_url: redirect_url
|
20
21
|
}
|
21
22
|
)
|
22
23
|
end
|
@@ -5,10 +5,20 @@ module Bootpay::Concern::Payment
|
|
5
5
|
# 결제 정보 가져오기
|
6
6
|
# Comment by Gosomi
|
7
7
|
# Date: 2021-12-08
|
8
|
-
def receipt_payment(receipt_id)
|
8
|
+
def receipt_payment(receipt_id, lookup_user_data = false)
|
9
9
|
request(
|
10
10
|
method: :get,
|
11
|
-
uri: "receipt/#{receipt_id}"
|
11
|
+
uri: "receipt/#{receipt_id}?lookup_user_data=#{lookup_user_data}",
|
12
|
+
)
|
13
|
+
end
|
14
|
+
|
15
|
+
# OrderId로 결제 정보 조회하기
|
16
|
+
# Comment by GOSOMI
|
17
|
+
# @date: 2024-01-27
|
18
|
+
def lookup_order_id(order_id)
|
19
|
+
request(
|
20
|
+
method: :get,
|
21
|
+
uri: "lookup/order/#{order_id}",
|
12
22
|
)
|
13
23
|
end
|
14
24
|
|
@@ -28,19 +38,79 @@ module Bootpay::Concern::Payment
|
|
28
38
|
# Comment by Gosomi
|
29
39
|
# Date: 2021-05-21
|
30
40
|
def cancel_payment(cancel_id: nil, receipt_id:, cancel_price: nil, cancel_tax_free: nil, cancel_username: '시스템', cancel_message: '결제취소',
|
31
|
-
refund: { bank_account: nil, bank_username: nil, bank_code: nil }, items: nil)
|
41
|
+
cancel_requester: '관리자', refund: { bank_account: nil, bank_username: nil, bank_code: nil }, items: nil)
|
32
42
|
request(
|
33
43
|
uri: 'cancel',
|
34
44
|
payload:
|
35
45
|
{
|
36
|
-
cancel_id:
|
37
|
-
receipt_id:
|
38
|
-
cancel_price:
|
39
|
-
cancel_tax_free:
|
40
|
-
cancel_username:
|
41
|
-
cancel_message:
|
42
|
-
|
43
|
-
|
46
|
+
cancel_id: cancel_id.presence || SecureRandom.uuid,
|
47
|
+
receipt_id: receipt_id,
|
48
|
+
cancel_price: cancel_price,
|
49
|
+
cancel_tax_free: cancel_tax_free,
|
50
|
+
cancel_username: cancel_username,
|
51
|
+
cancel_message: cancel_message,
|
52
|
+
cancel_requester: cancel_requester,
|
53
|
+
refund: refund,
|
54
|
+
items: items
|
55
|
+
}.compact
|
56
|
+
)
|
57
|
+
end
|
58
|
+
|
59
|
+
# REST API로 결제 요청하기
|
60
|
+
# Comment by Gosomi
|
61
|
+
# Date: 2023-03-28
|
62
|
+
def request_payment(platform_application_id:, pg:, method: nil, price:, tax_free: 0, order_name:, order_id:, user_token: nil, uuid: nil, sk: nil,
|
63
|
+
ti: 0, tk: nil, items: [], extra: {}, user: {}, agent: nil)
|
64
|
+
rand_uuid = SecureRandom.uuid
|
65
|
+
request(
|
66
|
+
uri: 'request/payment',
|
67
|
+
payload:
|
68
|
+
{
|
69
|
+
platform_application_id: platform_application_id,
|
70
|
+
pg: pg,
|
71
|
+
method: method,
|
72
|
+
price: price,
|
73
|
+
tax_free: tax_free,
|
74
|
+
order_name: order_name,
|
75
|
+
order_id: order_id,
|
76
|
+
user_token: user_token,
|
77
|
+
uuid: uuid.presence || rand_uuid,
|
78
|
+
sk: sk.presence || "#{rand_uuid}-#{Time.current.to_i}",
|
79
|
+
ti: ti,
|
80
|
+
tk: tk.presence || "#{rand_uuid}-#{Time.current.to_i}",
|
81
|
+
items: items,
|
82
|
+
extra: extra,
|
83
|
+
user: user,
|
84
|
+
__agent: agent,
|
85
|
+
ver: Bootpay::RestClient::SDK_VERSION,
|
86
|
+
sdk_version: Bootpay::V2_VERSION
|
87
|
+
}
|
88
|
+
)
|
89
|
+
end
|
90
|
+
|
91
|
+
# 가상계좌 bulk 발급 요청
|
92
|
+
# Comment by GOSOMI
|
93
|
+
# @date: 2023-08-08
|
94
|
+
def request_virtual_account_bulk(pg:, order_id:, order_name:, currency: 'KRW', price:, tax_free: nil, bank_code:, bank_account:,
|
95
|
+
bank_username:, cash_receipt_type: nil, identity_no: nil, user: {}, metadata: {}, extra: {})
|
96
|
+
request(
|
97
|
+
uri: 'request/virtual-account/bulk',
|
98
|
+
payload:
|
99
|
+
{
|
100
|
+
pg: pg,
|
101
|
+
order_id: order_id,
|
102
|
+
order_name: order_name,
|
103
|
+
currency: currency,
|
104
|
+
price: price,
|
105
|
+
tax_free: tax_free,
|
106
|
+
bank_code: bank_code,
|
107
|
+
bank_account: bank_account,
|
108
|
+
bank_username: bank_username,
|
109
|
+
cash_receipt_type: cash_receipt_type,
|
110
|
+
identity_no: identity_no,
|
111
|
+
user: user,
|
112
|
+
metadata: metadata,
|
113
|
+
extra: extra
|
44
114
|
}.compact
|
45
115
|
)
|
46
116
|
end
|
@@ -6,7 +6,8 @@ module Bootpay::Concern::Reseller
|
|
6
6
|
# Comment by Gosomi
|
7
7
|
# Date: 2022-01-05
|
8
8
|
def create_seller(company_alias:, company_name:, email: nil, regist_no: nil, owner_name: nil,
|
9
|
-
phone: nil, zip: nil, address1: nil, address2: nil
|
9
|
+
phone: nil, zip: nil, address1: nil, address2: nil, app_name: nil, primary_key:, resources: nil,
|
10
|
+
send_email: false)
|
10
11
|
request(
|
11
12
|
uri: 'reseller/seller',
|
12
13
|
payload: {
|
@@ -18,7 +19,34 @@ module Bootpay::Concern::Reseller
|
|
18
19
|
phone: phone,
|
19
20
|
zip: zip,
|
20
21
|
address1: address1,
|
21
|
-
address2: address2
|
22
|
+
address2: address2,
|
23
|
+
app_name: app_name,
|
24
|
+
primary_key: primary_key,
|
25
|
+
resources: resources,
|
26
|
+
send_email: send_email
|
27
|
+
}
|
28
|
+
)
|
29
|
+
end
|
30
|
+
|
31
|
+
# 테스트로 생성한 계정을 모두 삭제한다
|
32
|
+
# Comment by GOSOMI
|
33
|
+
# @date: 2023-10-11
|
34
|
+
def test_destroy_provider(provider_id)
|
35
|
+
request(
|
36
|
+
uri: "reseller/test/seller/#{provider_id}",
|
37
|
+
method: :delete
|
38
|
+
)
|
39
|
+
end
|
40
|
+
|
41
|
+
# Resource 정보를 갱신한다
|
42
|
+
# Comment by GOSOMI
|
43
|
+
# @date: 2023-10-12
|
44
|
+
def update_seller_payment_resources(app_id:, resources:)
|
45
|
+
request(
|
46
|
+
uri: "reseller/seller/app/resource/#{app_id}",
|
47
|
+
method: :put,
|
48
|
+
payload: {
|
49
|
+
resources: resources
|
22
50
|
}
|
23
51
|
)
|
24
52
|
end
|
data/lib/bootpay/concern/rest.rb
CHANGED
@@ -10,9 +10,12 @@ module Bootpay::Concern::Rest
|
|
10
10
|
def request(method: :post, uri:, payload: {}, headers: {})
|
11
11
|
response = HTTP.headers(
|
12
12
|
{
|
13
|
-
Authorization:
|
14
|
-
content_type:
|
15
|
-
accept:
|
13
|
+
Authorization: "Bearer #{@token}",
|
14
|
+
content_type: 'application/json',
|
15
|
+
accept: 'application/json',
|
16
|
+
bootpay_api_version: @api_version,
|
17
|
+
bootpay_sdk_version: Bootpay::V2_VERSION,
|
18
|
+
bootpay_sdk_type: '300'
|
16
19
|
}.merge!(headers).compact
|
17
20
|
).send(
|
18
21
|
method.to_sym,
|
@@ -20,7 +23,7 @@ module Bootpay::Concern::Rest
|
|
20
23
|
json: payload
|
21
24
|
)
|
22
25
|
Bootpay::Response.new(
|
23
|
-
response.status.
|
26
|
+
response.status.to_i == 200,
|
24
27
|
JSON.parse(response.body.to_s, symbolize_names: true)
|
25
28
|
)
|
26
29
|
rescue Exception => e
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Bootpay::Concern::Seller
|
2
|
+
extend ActiveSupport::Concern
|
3
|
+
|
4
|
+
included do
|
5
|
+
# 현재 사용가능한 결제수단 목록 보기
|
6
|
+
# Comment by Gosomi
|
7
|
+
# Date: 2022-08-19
|
8
|
+
def lookup_payment_methods
|
9
|
+
request(
|
10
|
+
uri: 'seller/payment/method',
|
11
|
+
method: :get
|
12
|
+
)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -16,11 +16,12 @@ module Bootpay::Concern::Subscription
|
|
16
16
|
# Comment by Gosomi
|
17
17
|
# Date: 2021-11-02
|
18
18
|
def request_subscribe_card_payment(billing_key:, order_name:, price:, tax_free: 0, card_quota: '00',
|
19
|
-
card_interest: nil, order_id:, items: [], user: {}, extra: {})
|
19
|
+
card_interest: nil, order_id:, items: [], user: {}, extra: {}, metadata: {})
|
20
20
|
request(
|
21
21
|
uri: 'subscribe/payment',
|
22
22
|
payload: {
|
23
23
|
billing_key: billing_key,
|
24
|
+
metadata: metadata,
|
24
25
|
order_name: order_name,
|
25
26
|
price: price,
|
26
27
|
tax_free: tax_free,
|
@@ -57,6 +58,26 @@ module Bootpay::Concern::Subscription
|
|
57
58
|
)
|
58
59
|
end
|
59
60
|
|
61
|
+
# 예약결제 조회 기능
|
62
|
+
# Comment by Gosomi
|
63
|
+
# Date: 2023-03-08
|
64
|
+
def subscribe_payment_reserve_lookup(reserve_id)
|
65
|
+
request(
|
66
|
+
method: :get,
|
67
|
+
uri: "subscribe/payment/reserve/#{reserve_id}"
|
68
|
+
)
|
69
|
+
end
|
70
|
+
|
71
|
+
# 자동결제 조회하기
|
72
|
+
# Comment by Gosomi
|
73
|
+
# Date: 2023-02-24
|
74
|
+
def subscribe_lookup(reserve_id)
|
75
|
+
request(
|
76
|
+
method: :get,
|
77
|
+
uri: "subscribe/payment/reserve/#{reserve_id}"
|
78
|
+
)
|
79
|
+
end
|
80
|
+
|
60
81
|
# 자동결제 예약 취소
|
61
82
|
# Comment by Gosomi
|
62
83
|
# Date: 2022-04-21
|
@@ -102,6 +123,49 @@ module Bootpay::Concern::Subscription
|
|
102
123
|
)
|
103
124
|
end
|
104
125
|
|
126
|
+
# 빌링키 발급 요청하기
|
127
|
+
# Comment by GOSOMI
|
128
|
+
# @date: 2024-01-26
|
129
|
+
def request_subscribe_automatic_transfer_billing_key(pg:, order_name:, price: nil, tax_free: nil, subscription_id:,
|
130
|
+
extra: {}, user: {}, metadata: {}, auth_type: 'ARS', username:,
|
131
|
+
bank_name:, bank_account:, identity_no:, cash_receipt_type: 1,
|
132
|
+
cash_receipt_identity_no: nil, phone:)
|
133
|
+
request(
|
134
|
+
uri: 'request/subscribe/automatic-transfer',
|
135
|
+
payload: {
|
136
|
+
pg: pg,
|
137
|
+
order_name: order_name,
|
138
|
+
subscription_id: subscription_id,
|
139
|
+
price: price,
|
140
|
+
tax_free: tax_free,
|
141
|
+
extra: extra,
|
142
|
+
user: user,
|
143
|
+
metadata: metadata,
|
144
|
+
auth_type: auth_type,
|
145
|
+
username: username,
|
146
|
+
bank_name: bank_name,
|
147
|
+
bank_account: bank_account,
|
148
|
+
identity_no: identity_no,
|
149
|
+
cash_receipt_type: cash_receipt_type,
|
150
|
+
cash_receipt_identity_no: cash_receipt_identity_no,
|
151
|
+
phone: phone
|
152
|
+
}
|
153
|
+
)
|
154
|
+
end
|
155
|
+
|
156
|
+
# ARS나 본인인증 이후 빌링키 발급
|
157
|
+
# Comment by GOSOMI
|
158
|
+
# @date: 2024-01-26
|
159
|
+
def publish_automatic_transfer_billing_key(receipt_id:)
|
160
|
+
request(
|
161
|
+
method: :post,
|
162
|
+
uri: "request/subscribe/automatic-transfer/publish",
|
163
|
+
payload: {
|
164
|
+
receipt_id: receipt_id
|
165
|
+
}
|
166
|
+
)
|
167
|
+
end
|
168
|
+
|
105
169
|
# 정기결제를 계속해서 진행한다
|
106
170
|
# Comment by Gosomi
|
107
171
|
# Date: 2022-01-18
|
@@ -111,5 +175,15 @@ module Bootpay::Concern::Subscription
|
|
111
175
|
uri: "request/subscribe/#{receipt_id}"
|
112
176
|
)
|
113
177
|
end
|
178
|
+
|
179
|
+
# 빌링키로 조회하는 기능을 만든다
|
180
|
+
# Comment by GOSOMI
|
181
|
+
# @date: 2023-09-14
|
182
|
+
def lookup_billing_key(billing_key)
|
183
|
+
request(
|
184
|
+
method: :get,
|
185
|
+
uri: "billing_key/#{billing_key}"
|
186
|
+
)
|
187
|
+
end
|
114
188
|
end
|
115
189
|
end
|
data/lib/bootpay/concern.rb
CHANGED
@@ -8,6 +8,7 @@ module Bootpay
|
|
8
8
|
require_relative 'concern/reseller'
|
9
9
|
require_relative 'concern/rest'
|
10
10
|
require_relative 'concern/sdk'
|
11
|
+
require_relative 'concern/seller'
|
11
12
|
require_relative 'concern/subscription'
|
12
13
|
require_relative 'concern/token'
|
13
14
|
require_relative 'concern/user_token'
|
@@ -21,6 +22,7 @@ module Bootpay
|
|
21
22
|
include Reseller
|
22
23
|
include Rest
|
23
24
|
include Sdk
|
25
|
+
include Seller
|
24
26
|
include Subscription
|
25
27
|
include Token
|
26
28
|
include UserToken
|
data/lib/bootpay/version.rb
CHANGED
data/lib/bootpay-backend-ruby.rb
CHANGED
@@ -15,14 +15,32 @@ module Bootpay
|
|
15
15
|
development: 'https://dev-api.bootpay.co.kr/v2',
|
16
16
|
stage: 'https://stage-api.bootpay.co.kr/v2',
|
17
17
|
production: 'https://api.bootpay.co.kr/v2'
|
18
|
-
}
|
18
|
+
}
|
19
|
+
|
20
|
+
SDK_VERSION = '4.2.1'
|
19
21
|
|
20
22
|
def initialize(application_id:, private_key:, mode: 'production')
|
21
23
|
@application_id = application_id
|
22
24
|
@private_key = private_key
|
23
25
|
@mode = mode.presence || 'production'
|
24
26
|
@token = nil
|
27
|
+
@api_version = SDK_VERSION
|
25
28
|
raise ArgumentError, "개발환경 mode는 development, stage, production 중에서 선택이 가능합니다." if API[@mode.to_sym].blank?
|
26
29
|
end
|
30
|
+
|
31
|
+
# API URL을 변경
|
32
|
+
# Comment by GOSOMI
|
33
|
+
# @date: 2023-05-26
|
34
|
+
def set_api_url(url)
|
35
|
+
API[@mode.to_sym] = url
|
36
|
+
end
|
37
|
+
|
38
|
+
# API 버전을 설정한다
|
39
|
+
# Comment by Gosomi
|
40
|
+
# Date: 2022-07-29
|
41
|
+
def set_api_version(version)
|
42
|
+
raise ArgumentError, 'API Version은 4.0.0 이상만 설정이 가능합니다.' if version < '4.0.0'
|
43
|
+
@api_version = version
|
44
|
+
end
|
27
45
|
end
|
28
46
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bootpay-backend-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- gosomi
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -66,17 +66,18 @@ files:
|
|
66
66
|
- lib/bootpay/concern/reseller.rb
|
67
67
|
- lib/bootpay/concern/rest.rb
|
68
68
|
- lib/bootpay/concern/sdk.rb
|
69
|
+
- lib/bootpay/concern/seller.rb
|
69
70
|
- lib/bootpay/concern/subscription.rb
|
70
71
|
- lib/bootpay/concern/token.rb
|
71
72
|
- lib/bootpay/concern/user_token.rb
|
72
73
|
- lib/bootpay/concern/webhook.rb
|
73
74
|
- lib/bootpay/version.rb
|
74
75
|
- lib/response.rb
|
75
|
-
homepage:
|
76
|
+
homepage:
|
76
77
|
licenses:
|
77
78
|
- MIT
|
78
79
|
metadata: {}
|
79
|
-
post_install_message:
|
80
|
+
post_install_message:
|
80
81
|
rdoc_options: []
|
81
82
|
require_paths:
|
82
83
|
- lib
|
@@ -91,8 +92,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
91
92
|
- !ruby/object:Gem::Version
|
92
93
|
version: '0'
|
93
94
|
requirements: []
|
94
|
-
rubygems_version: 3.
|
95
|
-
signing_key:
|
95
|
+
rubygems_version: 3.3.3
|
96
|
+
signing_key:
|
96
97
|
specification_version: 4
|
97
98
|
summary: Bootpay Ruby REST Client
|
98
99
|
test_files: []
|