bootpay 1.0.1 → 1.0.5

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
  SHA256:
3
- metadata.gz: 4f4571d472aea39ea1af1906ba2d69cc60712f0438633cd697097bd03bdae78d
4
- data.tar.gz: 9027f9825321d43c1f93c852cbb40605338dcccaed31f98ace4a05c7ca41ee1b
3
+ metadata.gz: 1db5c75a6a35e6085bb32d154260ceefd3dce35fc02b8419baba46f4a7c9166b
4
+ data.tar.gz: 138c6ffa96ef2cda07a575d35507e1fd98a9e4c767a90619e06a539f5abc0ec8
5
5
  SHA512:
6
- metadata.gz: 3692d6c28adb7e876f1cf129482182b99eed58f5570bae2d07d1cf779ef255877402f59523e8a11ef8f5559a54824e12441a94a37503ccc2dd4d43b6f0621df5
7
- data.tar.gz: d9c4056f3b02a808ff6358b6bf7ef52fa5f2ca1c0a35e60da2467e9cdbdc57bed9b08df2914aac77a65d15f4e716af167e486621329713105c5b94ae2f4aad8a
6
+ metadata.gz: b01db426e436f99f84a6bc741df6252cb3df6692aaa037ac264409d8574858548898296d591876097f70c29ea8ae5d6feee3b15403a88214c064df7686ab82f7
7
+ data.tar.gz: 0a85381bdf7a0018417803137124025c72a8f59a7dc5014884262f8aae380018e37b58615b2a6bbd06bf123606cd931527eb71a01208c6375a79a5f2d76c7752
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
- ## [Unreleased]
1
+ ## 1.0.4
2
2
 
3
- ## [0.1.0] - 2021-08-30
3
+ - cancel에 refund 형식 수정
4
4
 
5
- - Initial release
5
+ ## 1.0.3
6
+
7
+ - BankCode 추가
8
+
9
+ ## 1.0.2
10
+ - certificate data type application/json 으로 수정
11
+
12
+ ## 1.0.1
13
+ - namespace 변경
14
+
15
+ ## 1.0.0
16
+
17
+ - 첫 배포
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2021 ehowlsla
3
+ Copyright (c) 2021 bootpay
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,10 +1,33 @@
1
- # Bootpay Ruby 플러그인
2
1
 
3
- Bootpay Ruby 라이브러리는 Ruby 언어로 작성된 어플리케이션, 프레임워크 등에서 사용가능합니다.
2
+ ## Bootpay Ruby Server Side Library
3
+ 부트페이 공식 Ruby 라이브러리 입니다 (서버사이드 용)
4
4
 
5
- ## Installation
5
+ Ruby 언어로 작성된 어플리케이션, 프레임워크 등에서 사용가능합니다.
6
+
7
+ * PG 결제창 연동은 클라이언트 라이브러리에서 수행됩니다. (Javascript, Android, iOS, React Native, Flutter 등)
8
+ * 결제 검증 및 취소, 빌링키 발급, 본인인증 등의 수행은 서버사이드에서 진행됩니다. (Java, PHP, Python, Ruby, Node.js, Go, ASP.NET 등)
9
+
10
+
11
+ ## 기능
12
+ 1. (부트페이 통신을 위한) 토큰 발급 요청
13
+ 2. 결제 검증
14
+ 3. 결제 취소 (전액 취소 / 부분 취소)
15
+ 4. 빌링키 발급
16
+
17
+ 4-1. 발급된 빌링키로 결제 승인 요청
18
+
19
+ 4-2. 발급된 빌링키로 결제 승인 예약 요청
20
+
21
+ 4-2-1. 발급된 빌링키로 결제 승인 예약 - 취소 요청
22
+
23
+ 4-3. 빌링키 삭제
24
+ 5. (부트페이 단독) 사용자 토큰 발급
25
+ 6. (부트페이 단독) 결제 링크 생성
26
+ 7. 서버 승인 요청
27
+ 8. 본인 인증 결과 조회
28
+
29
+ ## Gem으로 설치하기
6
30
 
7
- Gemfile 파일을 이용하여 설치하기
8
31
 
9
32
  ```ruby
10
33
  gem 'bootpay'
@@ -20,25 +43,229 @@ Gemfile에 위 라인을 추가하고, 아래 라인으로 인스톨 합니다.
20
43
 
21
44
  $ gem install backend-ruby
22
45
 
23
- ## Getting Started
46
+ ## 사용하기
24
47
 
25
48
  ```ruby
26
- # 결제 검증하기
27
- receipt_id = '612df0250d681b001de61de6'
28
49
 
29
- api = Bootpay::Api.new(
30
- application_id: '5b8f6a4d396fa665fdc2b5ea',
31
- private_key: 'rm6EYECr6aroQVG2ntW0A6LpWnkTgP4uQ3H18sDDUYw=',
50
+ require 'bootpay'
51
+
52
+ @api = Bootpay::Api.new(
53
+ application_id: '5b8f6a4d396fa665fdc2b5ea',
54
+ private_key: 'rm6EYECr6aroQVG2ntW0A6LpWnkTgP4uQ3H18sDDUYw=',
55
+ )
56
+ response = @api.request_access_token
57
+ if response.success?
58
+ puts response.data.to_json
59
+ end
60
+ ```
61
+ 함수 단위의 샘플 코드는 [이곳](https://github.com/bootpay/backend-ruby/tree/main/spec/bootpay)을 참조하세요.
62
+
63
+
64
+ ## 1. 토큰 발급
65
+
66
+ 부트페이와 서버간 통신을 하기 위해서는 부트페이 서버로부터 토큰을 발급받아야 합니다.
67
+ 발급된 토큰은 30분간 유효하며, 최초 발급일로부터 30분이 지날 경우 토큰 발급 함수를 재호출 해주셔야 합니다.
68
+ ```ruby
69
+ def get_token
70
+ response = @api.request_access_token
71
+ if response.success?
72
+ puts response.data.to_json
73
+ end
74
+ end
75
+ ```
76
+
77
+
78
+ ## 2. 결제 검증
79
+ 결제창 및 정기결제에서 승인/취소된 결제건에 대하여 올바른 결제건인지 서버간 통신으로 결제검증을 합니다.
80
+ ```ruby
81
+ def verification
82
+ receipt_id = '612df0250d681b001de61de6'
83
+ if @api.request_access_token.success?
84
+ response = @api.verify(receipt_id)
85
+ puts response.data.to_json
86
+ end
87
+ end
88
+ ```
89
+
90
+
91
+ ## 3. 결제 취소 (전액 취소 / 부분 취소)
92
+ price를 지정하지 않으면 전액취소 됩니다.
93
+ * 휴대폰 결제의 경우 이월될 경우 이통사 정책상 취소되지 않습니다
94
+ * 정산받으실 금액보다 취소금액이 클 경우 PG사 정책상 취소되지 않을 수 있습니다. 이때 PG사에 문의하시면 되겠습니다.
95
+ * 가상계좌의 경우 CMS 특약이 되어있지 않으면 취소되지 않습니다. 그러므로 결제 테스트시에는 가상계좌로 테스트 하지 않길 추천합니다.
96
+
97
+ 부분취는 카드로 결제된 건만 가능하며, 일부 PG사만 지원합니다. 요청시 price에 금액을 지정하시면 되겠습니다.
98
+ * (지원가능 PG사: 이니시스, kcp, 다날, 페이레터, 나이스페이, 카카오페이, 페이코)
99
+
100
+ 간혹 개발사에서 실수로 여러번 부분취소를 보내서 여러번 취소되는 경우가 있기때문에, 부트페이에서는 부분취소 중복 요청을 막기 위해 cancel_id 라는 필드를 추가했습니다. cancel_id를 지정하시면, 해당 건에 대해 중복 요청방지가 가능합니다.
101
+ ```ruby
102
+ def cancel
103
+ if @api.request_access_token.success?
104
+ response = @api.cancel_payment(
105
+ receipt_id: "612df0250d681b001de61de6",
106
+ cancel_username: 'test',
107
+ cancel_message: 'test',
108
+ cancel_price: 1000, # 부분취소 요청시
109
+ refund: { # 가상계좌 환불 요청시, 단 CMS 특약이 되어있어야만 환불요청이 가능하다.
110
+ account: '675601010124', # 환불계좌
111
+ accountholder: '홍길동', # 환불계좌주
112
+ bankcode: Bootpay::BANKCODE["국민은행"] # 은행코드
113
+ }
32
114
  )
33
- if api.request_access_token.success?
34
- response = api.verify(receipt_id)
35
- print response.data.to_json
36
- end
115
+ puts response.data.to_json
116
+ end
117
+ end
37
118
  ```
38
119
 
120
+ ## 4. 빌링키 발급
121
+ REST API 방식으로 고객으로부터 카드 정보를 전달하여, PG사에게 빌링키를 발급받을 수 있습니다.
122
+ 발급받은 빌링키를 저장하고 있다가, 원하는 시점, 원하는 금액에 결제 승인 요청하여 좀 더 자유로운 결제시나리오에 적용이 가능합니다.
123
+ * 비인증 정기결제(REST API) 방식을 지원하는 PG사만 사용 가능합니다.
124
+ ```ruby
125
+ def get_billing_key
126
+ if @api.request_access_token.success?
127
+ response = @api.get_billing_key(
128
+ order_id: '1234',
129
+ pg: 'nicepay',
130
+ item_name: '테스트 결제',
131
+ card_no: '', # 값 할당 필요
132
+ card_pw: '', # 값 할당 필요
133
+ expire_year: '', # 값 할당 필요
134
+ expire_month: '', # 값 할당 필요
135
+ identify_number: '' # 값 할당 필요
136
+ )
137
+ puts response.data.to_json
138
+ end
139
+ end
140
+ ```
141
+
142
+ ## 4-1. 발급된 빌링키로 결제 승인 요청
143
+ 발급된 빌링키로 원하는 시점에 원하는 금액으로 결제 승인 요청을 할 수 있습니다. 잔액이 부족하거나 도난 카드 등의 특별한 건이 아니면 PG사에서 결제를 바로 승인합니다.
144
+
145
+ ```ruby
146
+ def subscribe_billing
147
+ billing_key = '612deb53019943001fb52312'
148
+ if @api.request_access_token.success?
149
+ response = @api.subscribe_billing(
150
+ billing_key: billing_key,
151
+ item_name: '테스트 결제',
152
+ price: 1000,
153
+ tax_free: 1000,
154
+ order_id: '1234'
155
+ )
156
+ puts response.data.to_json
157
+ end
158
+ end
159
+ ```
160
+ ## 4-2. 발급된 빌링키로 결제 예약 요청
161
+ 원하는 시점에 4-1로 결제 승인 요청을 보내도 되지만, 빌링키 발급 이후에 바로 결제 예약 할 수 있습니다. (빌링키당 최대 5건)
162
+ ```ruby
163
+ def subscribe_reserve_billing
164
+ billing_key = '612deb53019943001fb52312'
165
+ if @api.request_access_token.success?
166
+ response = @api.subscribe_reserve_billing(
167
+ billing_key: billing_key,
168
+ item_name: '테스트 결제',
169
+ price: 1000,
170
+ tax_free: 1000,
171
+ order_id: '1234',
172
+ execute_at: (Time.now + 10.seconds).to_i # 10초 뒤 결제
173
+ )
174
+ puts response.data.to_json
175
+ end
176
+ end
177
+ ```
178
+ ## 4-2-1. 발급된 빌링키로 결제 예약 - 취소 요청
179
+ 빌링키로 예약된 결제건을 취소합니다.
180
+ ```ruby
181
+ def subscribe_reserve_cancel
182
+ reserve_id = '612deb53019943001fb52312'
183
+ if @api.request_access_token.success?
184
+ response = @api.subscribe_reserve_cancel(reserve_id)
185
+ puts response.data.to_json
186
+ end
187
+ end
188
+ ```
189
+ ## 4-3. 빌링키 삭제
190
+ 발급된 빌링키로 더 이상 사용되지 않도록, 삭제 요청합니다.
191
+ ```java
192
+ Bootpay bootpay = new Bootpay("5b8f6a4d396fa665fdc2b5ea", "rm6EYECr6aroQVG2ntW0A6LpWnkTgP4uQ3H18sDDUYw=");
193
+
194
+ try {
195
+ ResDefault res = bootpay.destroyBillingKey("6100e7ea0d681b001fd4de69");
196
+ System.out.println(res.toJson());
197
+ } catch (Exception e) {
198
+ e.printStackTrace();
199
+ }
200
+ ```
201
+ ## 5. 사용자 토큰 발급
202
+ (부트페이 단독) 부트페이에서 제공하는 간편결제창, 생체인증 기반의 결제 사용을 위해서는 개발사에서 회원 고유번호를 관리해야하며, 해당 회원에 대한 사용자 토큰을 발급합니다.
203
+ 이 토큰값을 기반으로 클라이언트에서 결제요청 하시면 되겠습니다.
204
+ ```ruby
205
+ def destroy_billing_key
206
+ if @api.request_access_token.success?
207
+ billing_key = '612debc70d681b0039e6133d'
208
+ response = @api.destroy_billing_key(billing_key)
209
+ puts response.data.to_json
210
+ end
211
+ end
212
+ ```
213
+ ## 6. 결제 링크 생성
214
+ (부트페이 단독) 요청 하시면 결제링크가 리턴되며, 해당 url을 고객에게 안내, 결제 유도하여 결제를 진행할 수 있습니다.
215
+ ```ruby
216
+ def request_link
217
+ if @api.request_access_token.success?
218
+ response = @api.request_link(
219
+ pg: 'nicepay',
220
+ price: 1000,
221
+ tax_free: 1000,
222
+ order_id: '1234',
223
+ name: '결제테스트'
224
+ )
225
+ puts response.data.to_json
226
+ end
227
+ end
228
+ ```
229
+
230
+ ## 7. 서버 승인 요청
231
+ 결제승인 방식은 클라이언트 승인 방식과, 서버 승인 방식으로 총 2가지가 있습니다.
232
+
233
+ 클라이언트 승인 방식은 javascript나 native 등에서 confirm 함수에서 진행하는 일반적인 방법입니다만, 경우에 따라 서버 승인 방식이 필요할 수 있습니다.
234
+
235
+ 필요한 이유
236
+ 1. 100% 안정적인 결제 후 고객 안내를 위해 - 클라이언트에서 PG결제 진행 후 승인 완료될 때 onDone이 수행되지 않아 (인터넷 환경 등), 결제 이후 고객에게 안내하지 못할 수 있습니다
237
+ 2. 단일 트랜잭션의 개념이 필요할 경우 - 재고파악이 중요한 커머스를 운영할 경우 트랜잭션 개념이 필요할 수 있겠으며, 이를 위해서는 서버 승인을 사용해야 합니다.
238
+
239
+ ```ruby
240
+ def submit
241
+ receipt_id = '612e09260d681b0021e61ab9'
242
+ if @api.request_access_token.success?
243
+ response = @api.server_submit(receipt_id)
244
+ puts response.data.to_json
245
+ end
246
+ end
247
+ ```
248
+
249
+ ## 8. 본인 인증 결과 조회
250
+ 다날 본인인증 후 결과값을 조회합니다.
251
+ 다날 본인인증에서 통신사, 외국인여부, 전화번호 이 3가지 정보는 다날에 추가로 요청하셔야 받으실 수 있습니다.
252
+ ```ruby
253
+ def certificate
254
+ receipt_id = '612e09260d681b0021e61ab9'
255
+ if @api.request_access_token.success?
256
+ response = @api.certificate(receipt_id)
257
+ puts response.data.to_json
258
+ end
259
+ end
260
+ ```
261
+
262
+ ## Example 프로젝트
263
+
264
+ [적용한 샘플 프로젝트](https://github.com/bootpay/backend-ruby-example)을 참조해주세요
265
+
39
266
  ## Documentation
40
267
 
41
- [부트페이 개발매뉴얼](https://app.gitbook.com/@bootpay)을 참조해주세요
268
+ [부트페이 개발매뉴얼](https://bootpay.gitbook.io/docs/)을 참조해주세요
42
269
 
43
270
  ## 기술문의
44
271
 
@@ -46,4 +273,4 @@ Gemfile에 위 라인을 추가하고, 아래 라인으로 인스톨 합니다.
46
273
 
47
274
  ## License
48
275
 
49
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
276
+ [MIT License](https://opensource.org/licenses/MIT).
data/bootpay-1.0.0.gem ADDED
Binary file
data/bootpay-1.0.1.gem ADDED
Binary file
data/bootpay-1.0.2.gem ADDED
Binary file
data/bootpay-1.0.3.gem ADDED
Binary file
data/bootpay-1.0.4.gem ADDED
Binary file
@@ -6,21 +6,32 @@ module Bootpay::Billing
6
6
  # Comment by ehowlsla
7
7
  # Date: 2021-08-30
8
8
  def get_billing_key(order_id: nil, pg: nil, item_name: nil, card_no: nil, card_pw: nil, expire_year: nil, expire_month: nil, identify_number: nil,
9
- user_info: {id: nil, username: nil, email: nil, phone: nil, gender: nil, area: nil, birth: nil},
10
- extra: {subscribeTestPayment: nil, raw_data: nil})
9
+ user_info: { # 구매자 정보
10
+ id: nil, # 개발사에서 관리하는 회원 고유 id
11
+ username: nil, # 구매자 이름
12
+ email: nil, # 구매자 email
13
+ phone: nil, # 01012341234
14
+ gender: nil, # 0:여자, 1:남자
15
+ area: nil, # 서울|인천|대구|광주|부산|울산|경기|강원|충청북도|충북|충청남도|충남|전라북도|전북|전라남도|전남|경상북도|경북|경상남도|경남|제주|세종|대전 중 택 1
16
+ birth: nil # 생일 901004
17
+ },
18
+ extra: { # 기타 설정
19
+ subscribe_test_payment: nil, # subscribe_test_payment:100원 결제 후 결제가 되면 billing key를 발행, 결제가 실패하면 에러
20
+ raw_data: nil # raw_data: PG 오류 코드 및 메세지까지 리턴
21
+ })
11
22
  request(
12
23
  uri: 'request/card_rebill',
13
24
  payload:
14
25
  {
15
- order_id: order_id,
16
- pg: pg,
17
- item_name: item_name,
18
- card_no: card_no,
19
- card_pw: card_pw,
20
- expire_year: expire_year,
21
- expire_month: expire_month,
22
- identify_number: identify_number,
23
- user_info: user_info,
26
+ order_id: order_id, # 개발사에서 관리하는 고유 주문 번호
27
+ pg: pg, # PG사의 Alias ex) danal, kcp, inicis 등
28
+ item_name: item_name, # 상품명
29
+ card_no: card_no, # 카드 일련번호
30
+ card_pw: card_pw, # 카드 비밀번호 앞 2자리
31
+ expire_year: expire_year, # 카드 유효기간 년
32
+ expire_month: expire_month, # 카드 유효기간 월
33
+ identify_number: identify_number, # 주민등록번호 또는 사업자번호
34
+ user_info: user_info, # 구매자 정보
24
35
  extra: extra.values.any? {|v|v != nil} ? extra : nil
25
36
  }.compact
26
37
  )
@@ -40,9 +51,20 @@ module Bootpay::Billing
40
51
  # Comment by ehowlsla
41
52
  # Date: 2021-08-30
42
53
  def subscribe_billing(billing_key: nil, item_name: nil, price: 0, tax_free: 0, order_id: nil, quota: nil, interest: nil,
43
- user_info: {id: nil, username: nil, email: nil, phone: nil, gender: nil, area: nil, birth: nil},
54
+ user_info: { # 구매자 정보
55
+ id: nil, # 개발사에서 관리하는 회원 고유 id
56
+ username: nil, # 구매자 이름
57
+ email: nil, # 구매자 email
58
+ phone: nil, # 01012341234
59
+ gender: nil, # 0:여자, 1:남자
60
+ area: nil, # 서울|인천|대구|광주|부산|울산|경기|강원|충청북도|충북|충청남도|충남|전라북도|전북|전라남도|전남|경상북도|경북|경상남도|경남|제주|세종|대전 중 택 1
61
+ birth: nil # 생일 901004
62
+ },
44
63
  feedback_url: nil, feedback_content_type: nil,
45
- extra: {subscribeTestPayment: nil, raw_data: nil})
64
+ extra: { # 기타 설정
65
+ subscribe_test_payment: nil, # subscribe_test_payment:100원 결제 후 결제가 되면 billing key를 발행, 결제가 실패하면 에러
66
+ raw_data: nil # raw_data: PG 오류 코드 및 메세지까지 리턴
67
+ })
46
68
  raise 'billing_key 값을 입력해주세요.' if billing_key.blank?
47
69
  raise 'item_name 값을 입력해주세요.' if item_name.blank?
48
70
  raise 'price 금액을 설정을 해주세요.' if price.blank?
@@ -50,17 +72,17 @@ module Bootpay::Billing
50
72
  request(
51
73
  uri: 'subscribe/billing',
52
74
  payload: {
53
- billing_key: billing_key,
54
- item_name: item_name,
55
- price: price,
56
- tax_free: tax_free,
57
- order_id: order_id,
58
- quota: quota,
59
- interest: interest,
75
+ billing_key: billing_key, # 발급받은 빌링키
76
+ item_name: item_name, # 결제할 상품명, 결제창에 노출됨
77
+ price: price, # 결제할 상품금액
78
+ tax_free: tax_free, # 면세 상품일 경우 해당만큼의 금액을 설정
79
+ order_id: order_id, # 개발사에서 지정하는 고유주문번호
80
+ quota: quota, # 5만원 이상 결제건에 대한 할부개월 노출 설정. 00-일시불, 01-1개월, 02-2개월 ... 12까지 지정가능, 만약 09로 지정할 경우 최대 9개월까지 선택가능. 지정하지 않을 경우 해당 PG사의 기본값 적용
81
+ interest: interest, # 웰컴페이먼츠 전용, 무이자여부를 보내는 파라미터가 있다
60
82
  user_info: user_info.values.any? {|v|v != nil} ? user_info : nil,
61
- feedback_url: feedback_url,
62
- feedback_content_type: feedback_content_type,
63
- extra: extra.values.any? {|v|v != nil} ? extra : nil
83
+ feedback_url: feedback_url, # webhook 통지시 받으실 url 주소 (localhost 사용 불가)
84
+ feedback_content_type: feedback_content_type.presence || 'urlencoded', # webhook 통지시 받으실 데이터 타입 (json 또는 urlencoded, 기본값 urlencoded)
85
+ extra: extra.values.any? {|v|v != nil} ? extra : nil # subscribe_test_payment:100원 결제 후 결제가 되면 billing key를 발행, 결제가 실패하면 에러, raw_data: PG 오류 코드 및 메세지까지 리턴
64
86
  }.compact,
65
87
  )
66
88
  end
@@ -72,7 +94,7 @@ module Bootpay::Billing
72
94
  user_info: {id: nil, username: nil, email: nil, phone: nil, gender: nil, area: nil, birth: nil},
73
95
  feedback_url: nil, feedback_content_type: nil,
74
96
  extra: {subscribeTestPayment: 0, raw_data: 0},
75
- scheduler_type: nil, execute_at: nil)
97
+ execute_at: nil)
76
98
  raise 'billing_key 값을 입력해주세요.' if billing_key.blank?
77
99
  raise 'item_name 값을 입력해주세요.' if item_name.blank?
78
100
  raise 'price 금액을 설정을 해주세요.' if price.blank?
@@ -80,19 +102,19 @@ module Bootpay::Billing
80
102
  request(
81
103
  uri: 'subscribe/billing/reserve',
82
104
  payload: {
83
- billing_key: billing_key,
84
- item_name: item_name,
85
- price: price,
86
- tax_free: tax_free,
87
- order_id: order_id,
88
- quota: quota,
89
- interest: interest,
105
+ billing_key: billing_key, # 발급받은 빌링키
106
+ item_name: item_name, # 결제할 상품명, 결제창에 노출됨
107
+ price: price, # 결제할 상품금액
108
+ tax_free: tax_free, # 면세 상품일 경우 해당만큼의 금액을 설정
109
+ order_id: order_id, # 개발사에서 지정하는 고유주문번호
110
+ quota: quota, # 5만원 이상 결제건에 대한 할부개월 노출 설정. 00-일시불, 01-1개월, 02-2개월 ... 12까지 지정가능, 만약 09로 지정할 경우 최대 9개월까지 선택가능. 지정하지 않을 경우 해당 PG사의 기본값 적용
111
+ interest: interest, # 웰컴페이먼츠 전용, 무이자여부를 보내는 파라미터가 있다
90
112
  user_info: user_info.values.any? {|v|v != nil} ? user_info : nil,
91
- feedback_url: feedback_url,
92
- feedback_content_type: feedback_content_type,
93
- extra: extra.values.any? {|v|v != nil} ? extra : nil,
94
- scheduler_type: scheduler_type.presence || 'oneshot',
95
- execute_at: execute_at.presence || (Time.now + 10.seconds).to_i
113
+ feedback_url: feedback_url, # webhook 통지시 받으실 url 주소 (localhost 사용 불가)
114
+ feedback_content_type: feedback_content_type.presence || 'urlencoded', # webhook 통지시 받으실 데이터 타입 (json 또는 urlencoded, 기본값 urlencoded)
115
+ extra: extra.values.any? {|v|v != nil} ? extra : nil, # subscribe_test_payment:100원 결제 후 결제가 되면 billing key를 발행, 결제가 실패하면 에러, raw_data: PG 오류 코드 및 메세지까지 리턴
116
+ scheduler_type: 'oneshot',
117
+ execute_at: execute_at.presence || (Time.now + 10.seconds).to_i # 예약 실행시간, 미지정 시 10초뒤 실행
96
118
  }.compact,
97
119
  )
98
120
  end
@@ -6,18 +6,18 @@ module Bootpay::Cancel
6
6
  # Comment by Gosomi
7
7
  # Date: 2021-05-21
8
8
  def cancel_payment(cancel_id: nil, receipt_id:, cancel_price: nil, cancel_tax_free: 0, cancel_username: '시스템', cancel_message: '결제취소',
9
- refund: { bank_account: nil, bank_username: nil, bank_code: nil })
9
+ refund: { account: nil, accountholder: nil, bankcode: nil })
10
10
  request(
11
11
  uri: 'cancel',
12
12
  payload:
13
13
  {
14
- cancel_id: cancel_id.presence || SecureRandom.uuid,
15
- receipt_id: receipt_id,
16
- price: cancel_price,
17
- tax_free: cancel_tax_free,
18
- name: cancel_username,
19
- reason: cancel_message,
20
- refund: refund.values.any? {|v|v != nil} ? refund : nil
14
+ cancel_id: cancel_id.presence || SecureRandom.uuid, # (선택사항) 부분취소 요청시 중복 요청을 방지하기 위한 고유값
15
+ receipt_id: receipt_id, # 부트페이에서 발급한 영수증 id
16
+ price: cancel_price, # (선택사항) 부분취소 요청시 금액을 지정, 미지정시 전액 취소 (부분취소가 가능한 PG사, 결제수단에 한해 적용됨)
17
+ tax_free: cancel_tax_free, # 취소할 비과세 금액
18
+ name: cancel_username, # 취소 요청자 이름
19
+ reason: cancel_message, # 취소 요청 사유
20
+ refund: refund.values.any? {|v|v != nil} ? refund : nil # (선택사항) 가상계좌 환불요청시, 전제조건으로 PG사와 CMS 특약이 체결되어 있을 경우에만 환불요청 가능, 기본적으로 가상계좌는 결제취소가 안됨
21
21
  }.compact
22
22
  )
23
23
  end
data/lib/bootpay/easy.rb CHANGED
@@ -12,12 +12,12 @@ module Bootpay::Easy
12
12
  request(
13
13
  uri: 'request/user/token',
14
14
  payload: {
15
- user_id: user_id,
16
- email: email,
17
- name: name,
18
- gender: gender,
19
- birth: birth,
20
- phone: phone
15
+ user_id: user_id, # 개발사에서 관리하는 회원 고유 id
16
+ email: email, # 회원 email
17
+ name: name, # 회원명
18
+ gender: gender, # 0:여자, 1:남자
19
+ birth: birth, # 생일 901004
20
+ phone: phone # 01012341234
21
21
  }.compact
22
22
  )
23
23
  end
@@ -3,7 +3,8 @@ module Bootpay::Escrow
3
3
 
4
4
  included do
5
5
 
6
- # bootpay dev api
6
+
7
+ # @deprecated, 사용되지 않는 api
7
8
  # Comment by Gosomi
8
9
  # Date: 2020-06-18
9
10
  # @return [Hash]
data/lib/bootpay/link.rb CHANGED
@@ -8,24 +8,33 @@ module Bootpay::Link
8
8
  included do
9
9
  def request_link(pg: nil, method: nil, methods: nil, price: nil, order_id: nil, params: nil, tax_free: nil, name: nil,
10
10
  user_info: {id: nil, username: nil, email: nil, phone: nil, gender: nil, area: nil, birth: nil},
11
- items: nil, return_url: nil,
12
- extra: {escrow: nil, expire_month: nil, quota: nil, subscribe_test_payment: nil, disp_cash_result: nil, offer_period: nil, seller_name: nil, theme: nil, custom_background: nil, custom_font_color: nil })
11
+ items: nil,
12
+ extra: {
13
+ escrow: nil, # 에스크로 연동 시 true, 기본값 false
14
+ quota: nil, #List<int> 형태, 결제금액이 5만원 이상시 할부개월 허용범위를 설정할 수 있음, ex) "0,2,3" 지정시 - [0(일시불), 2개월, 3개월] 허용, 미설정시 PG사별 기본값 적용
15
+ disp_cash_result: nil, # 현금영수증 노출할지 말지 (가상계좌 이용시)
16
+ offer_period: nil, # 통합결제창, PG 정기결제창에서 표시되는 '월 자동결제'에 해당하는 문구를 지정한 값으로 변경, 지원하는 PG사만 적용 가능
17
+ theme: nil, # 통합결제창 테마, [ red, purple(기본), custom ] 중 택 1
18
+ custom_background: nil, # 통합결제창 배경색, ex) "#00a086" theme가 custom 일 때 background 색상 지정 가능
19
+ custom_font_color: nil # 통합결제창 글자색, ex) "#ffffff" theme가 custom 일 때 font color 색상 지정 가능
20
+ }
21
+ )
13
22
  request(
14
23
  uri: 'request/payment',
15
24
  payload:
16
25
  {
17
- pg: pg,
18
- method: method,
19
- methods: methods,
20
- price: price,
21
- order_id: order_id,
22
- params: params,
23
- tax_free: tax_free,
24
- name: name,
25
- user_info: user_info,
26
- items: items,
27
- return_url: return_url,
28
- extra: extra.values.any? {|v|v != nil} ? extra : nil
26
+ pg: pg, # [PG 결제] 사용하고자 하는 PG사의 Alias를 입력. ex) danal, kcp, inicis등, 미 지정시 통합결제창이 오픈
27
+ method: method, # card:카드, phone: 휴대폰, bank: 실시간 계좌이체, vbank: 가상계좌, auth: 본인인증, card_rebill: 정기결제, easy: 카카오,페이코,네이버페이 등의 간편결제, 미지정시 통합결제창 오픈
28
+ methods: methods, # 통합결제시 사용할 method 배열 형태
29
+ price: price, # 결제금액
30
+ order_id: order_id, # 개발사에서 관리하는 고유결제번호
31
+ params: params, # string 형태로 전달 할 값, 결제 후 똑같이 리턴해드림
32
+ tax_free: tax_free, # 비과세 금액
33
+ name: name, # 결제할 상품명
34
+ user_info: user_info, # 구매자 정보
35
+ items: items, # 상품정보
36
+ # return_url: return_url, # 결제후 이동할 페이지 url, 아직 사용하지 않음
37
+ extra: extra.values.any? {|v|v != nil} ? extra : nil # 기타 옵션
29
38
  }.compact
30
39
  )
31
40
  end
@@ -1,6 +1,25 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bootpay
4
- VERSION = "1.0.1"
4
+ VERSION = "1.0.5"
5
+ BANKCODE = {
6
+ "한국은행" => "001",
7
+ "기업은행" => "003",
8
+ "국민은행" => "004",
9
+ "외환은행" => "005",
10
+ "수협은행" => "007",
11
+ "농협은행" => "011",
12
+ "우리은행" => "020",
13
+ "SC은행" => "023",
14
+ "대구은행" => "031",
15
+ "부산은행" => "032",
16
+ "광주은행" => "034",
17
+ "경남은행" => "039",
18
+ "우체국" => "071",
19
+ "KEB하나은행" => "081",
20
+ "신한은행" => "088",
21
+ "케이뱅크" => "089",
22
+ "카카오뱅크" => "090",
23
+ }
5
24
  end
6
25
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootpay
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - bootpay
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-09-03 00:00:00.000000000 Z
11
+ date: 2021-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -56,6 +56,11 @@ files:
56
56
  - Rakefile
57
57
  - bin/console
58
58
  - bin/setup
59
+ - bootpay-1.0.0.gem
60
+ - bootpay-1.0.1.gem
61
+ - bootpay-1.0.2.gem
62
+ - bootpay-1.0.3.gem
63
+ - bootpay-1.0.4.gem
59
64
  - bootpay.gemspec
60
65
  - lib/.DS_Store
61
66
  - lib/bootpay.rb