bootpay 1.0.2 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 33a31e6f76ace934746e7409622b6ba70dc3c186c6776aab87036709d7b0a95e
4
- data.tar.gz: d22f00f5a79f49f567d210c338a2482906b1424cf9e227d7cb99925ab4522c4e
3
+ metadata.gz: 62000bbd11d35179e8c378660dcb69ea6ef76f210b456e739e60c65f0400bcc7
4
+ data.tar.gz: 5e2c39cfe97cebecb17a1caa296ed47ee07688bc2849a573260f33a42d70d357
5
5
  SHA512:
6
- metadata.gz: 36f81ee3544ac487d51401bfd6456caef845a2d9096b3bf085a51113f207080bbb30c1feaaaef49b1ede76f99459fb1fea9d54b11975e85b3f03f4d61bf5ffca
7
- data.tar.gz: '09ed84e9f946fc8c1f17565a7aa44c2bea2372cdfbcf47d8d599b8ac5e88013f30ac977dca7d089b53865decb22a0c7f1baec752b35e2421c5781c52472e8b6e'
6
+ metadata.gz: 1efc1b4ae4873f145e0aa9345b3e70eb71c495d203d2a54cc43e8fea7237b7cf455ee56423763e79231072f1b7bcee37811421a26792887991e0532761c06e87
7
+ data.tar.gz: 4833950cb2fb366a831fc2c79991b733e4c532becdbce662244348ad58477031799edc453e6911384b6bfb45a1052f6ab83c3e2eec7dc8f82b6dce31088b1227
data/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
- ## [Unreleased]
1
+ ### 1.0.6
2
+ - request_link api 에 주석 추가
2
3
 
3
- ## [0.1.0] - 2021-08-30
4
+ ### 1.0.5
5
+ - model별 주석 추가, extra에 불필요한 파라미터 제거
4
6
 
5
- - Initial release
7
+ ### 1.0.4
8
+
9
+ - cancel에 refund 형식 수정
10
+
11
+ ### 1.0.3
12
+
13
+ - BankCode 추가
14
+
15
+ ### 1.0.2
16
+ - certificate data type application/json 으로 수정
17
+
18
+ ### 1.0.1
19
+ - namespace 변경
20
+
21
+ ### 1.0.0
22
+
23
+ - 첫 배포
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- ## Bootpay Java Server Side Library
2
+ ## Bootpay Ruby Server Side Library
3
3
  부트페이 공식 Ruby 라이브러리 입니다 (서버사이드 용)
4
4
 
5
5
  Ruby 언어로 작성된 어플리케이션, 프레임워크 등에서 사용가능합니다.
@@ -46,16 +46,17 @@ Gemfile에 위 라인을 추가하고, 아래 라인으로 인스톨 합니다.
46
46
  ## 사용하기
47
47
 
48
48
  ```ruby
49
- # 결제 검증하기
50
- receipt_id = '612df0250d681b001de61de6'
51
49
 
52
- api = Bootpay::Api.new(
53
- application_id: '5b8f6a4d396fa665fdc2b5ea',
54
- private_key: 'rm6EYECr6aroQVG2ntW0A6LpWnkTgP4uQ3H18sDDUYw=',
55
- )
56
- if api.request_access_token.success?
57
- print response.data.to_json
58
- end
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
59
60
  ```
60
61
  함수 단위의 샘플 코드는 [이곳](https://github.com/bootpay/backend-ruby/tree/main/spec/bootpay)을 참조하세요.
61
62
 
@@ -65,12 +66,11 @@ Gemfile에 위 라인을 추가하고, 아래 라인으로 인스톨 합니다.
65
66
  부트페이와 서버간 통신을 하기 위해서는 부트페이 서버로부터 토큰을 발급받아야 합니다.
66
67
  발급된 토큰은 30분간 유효하며, 최초 발급일로부터 30분이 지날 경우 토큰 발급 함수를 재호출 해주셔야 합니다.
67
68
  ```ruby
68
- api = Bootpay::Api.new(
69
- application_id: '5b8f6a4d396fa665fdc2b5ea',
70
- private_key: 'rm6EYECr6aroQVG2ntW0A6LpWnkTgP4uQ3H18sDDUYw=',
71
- )
72
- if api.request_access_token.success?
73
- print response.data.to_json
69
+ def get_token
70
+ response = @api.request_access_token
71
+ if response.success?
72
+ puts response.data.to_json
73
+ end
74
74
  end
75
75
  ```
76
76
 
@@ -78,19 +78,194 @@ end
78
78
  ## 2. 결제 검증
79
79
  결제창 및 정기결제에서 승인/취소된 결제건에 대하여 올바른 결제건인지 서버간 통신으로 결제검증을 합니다.
80
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
+ }
114
+ )
115
+ puts response.data.to_json
116
+ end
117
+ end
118
+ ```
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
81
192
  Bootpay bootpay = new Bootpay("5b8f6a4d396fa665fdc2b5ea", "rm6EYECr6aroQVG2ntW0A6LpWnkTgP4uQ3H18sDDUYw=");
82
193
 
83
194
  try {
84
- ResDefault<VerificationData> res = bootpay.verify("6100e8e7019943003850f9b0");
195
+ ResDefault res = bootpay.destroyBillingKey("6100e7ea0d681b001fd4de69");
85
196
  System.out.println(res.toJson());
86
197
  } catch (Exception e) {
87
198
  e.printStackTrace();
88
199
  }
89
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)을 참조해주세요
90
265
 
91
266
  ## Documentation
92
267
 
93
- [부트페이 개발매뉴얼](https://app.gitbook.com/@bootpay)을 참조해주세요
268
+ [부트페이 개발매뉴얼](https://bootpay.gitbook.io/docs/)을 참조해주세요
94
269
 
95
270
  ## 기술문의
96
271
 
@@ -98,4 +273,4 @@ try {
98
273
 
99
274
  ## License
100
275
 
101
- 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.2.gem ADDED
Binary file
data/bootpay-1.0.3.gem ADDED
Binary file
data/bootpay-1.0.4.gem ADDED
Binary file
data/bootpay-1.0.5.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만원 이상 결제건에 적용하는 할부개월수. 0-일시불, 1은 지정시 에러 발생함, 2-2개월, 3-3개월... 12까지 지정가능
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만원 이상 결제건에 적용하는 할부개월수. 0-일시불, 1은 지정시 에러 발생함, 2-2개월, 3-3개월... 12까지 지정가능
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,22 @@ 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: { # (선택사항) 가상계좌 환불요청시, 전제조건으로 PG사와 CMS 특약이 체결되어 있을 경우에만 환불요청 가능, 기본적으로 가상계좌는 결제취소가 안됨
10
+ account: nil, # 환불받을 계좌번호 - 675601***1234
11
+ accountholder: nil, # 환불받을 계좌주 - 홍길동
12
+ bankcode: nil # 은행 코드
13
+ })
10
14
  request(
11
15
  uri: 'cancel',
12
16
  payload:
13
17
  {
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
18
+ cancel_id: cancel_id.presence || SecureRandom.uuid, # (선택사항) 부분취소 요청시 중복 요청을 방지하기 위한 고유값
19
+ receipt_id: receipt_id, # 부트페이에서 발급한 영수증 id
20
+ price: cancel_price, # (선택사항) 부분취소 요청시 금액을 지정, 미지정시 전액 취소 (부분취소가 가능한 PG사, 결제수단에 한해 적용됨)
21
+ tax_free: cancel_tax_free, # 취소할 비과세 금액
22
+ name: cancel_username, # 취소 요청자 이름
23
+ reason: cancel_message, # 취소 요청 사유
24
+ refund: refund.values.any? {|v|v != nil} ? refund : nil # (선택사항) 가상계좌 환불요청시, 전제조건으로 PG사와 CMS 특약이 체결되어 있을 경우에만 환불요청 가능, 기본적으로 가상계좌는 결제취소가 안됨
21
25
  }.compact
22
26
  )
23
27
  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
@@ -6,26 +6,53 @@ module Bootpay::Link
6
6
  extend ActiveSupport::Concern
7
7
 
8
8
  included do
9
+ # item 모델 설명
10
+ # {
11
+ # item_name: '', # 상품명
12
+ # qty: 1, # 수량
13
+ # unique: '', # 상품 고유키
14
+ # price: 1000, # 상품단가
15
+ # cat1: '', # 카테고리 상
16
+ # cat2: '', # 카테고리 중
17
+ # cat3: '' # 카테고리 하
18
+ # }
9
19
  def request_link(pg: nil, method: nil, methods: nil, price: nil, order_id: nil, params: nil, tax_free: nil, name: nil,
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 })
20
+ user_info: {
21
+ id: nil, # 개발사에서 관리하는 회원 고유 id
22
+ username: nil, # 구매자 이름
23
+ email: nil, # 구매자 email
24
+ phone: nil, # 01012341234
25
+ gender: nil, # 0:여자, 1:남자
26
+ area: nil, # 서울|인천|대구|광주|부산|울산|경기|강원|충청북도|충북|충청남도|충남|전라북도|전북|전라남도|전남|경상북도|경북|경상남도|경남|제주|세종|대전 중 택 1
27
+ birth: nil # 생일 901004
28
+ },
29
+ items: nil, # item array
30
+ extra: {
31
+ escrow: nil, # 에스크로 연동 시 true, 기본값 false
32
+ quota: nil, #List<int> 형태, 결제금액이 5만원 이상시 할부개월 허용범위를 설정할 수 있음, ex) "0,2,3" 지정시 - [0(일시불), 2개월, 3개월] 허용, 미설정시 PG사별 기본값 적용, 1 지정시 에러가 발생할 수 있음
33
+ disp_cash_result: nil, # 현금영수증 노출할지 말지 (가상계좌 이용시)
34
+ offer_period: nil, # 통합결제창, PG 정기결제창에서 표시되는 '월 자동결제'에 해당하는 문구를 지정한 값으로 변경, 지원하는 PG사만 적용 가능
35
+ theme: nil, # 통합결제창 테마, [ red, purple(기본), custom ] 중 택 1
36
+ custom_background: nil, # 통합결제창 배경색, ex) "#00a086" theme가 custom 일 때 background 색상 지정 가능
37
+ custom_font_color: nil # 통합결제창 글자색, ex) "#ffffff" theme가 custom 일 때 font color 색상 지정 가능
38
+ }
39
+ )
13
40
  request(
14
41
  uri: 'request/payment',
15
42
  payload:
16
43
  {
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
44
+ pg: pg, # [PG 결제] 사용하고자 하는 PG사의 Alias를 입력. ex) danal, kcp, inicis등, 미 지정시 통합결제창이 오픈
45
+ method: method, # card:카드, phone: 휴대폰, bank: 실시간 계좌이체, vbank: 가상계좌, auth: 본인인증, card_rebill: 정기결제, easy: 카카오,페이코,네이버페이 등의 간편결제, 미지정시 통합결제창 오픈
46
+ methods: methods, # 통합결제시 사용할 method 배열 형태
47
+ price: price, # 결제금액
48
+ order_id: order_id, # 개발사에서 관리하는 고유결제번호
49
+ params: params, # string 형태로 전달 할 값, 결제 후 똑같이 리턴해드림
50
+ tax_free: tax_free, # 비과세 금액
51
+ name: name, # 결제할 상품명
52
+ user_info: user_info, # 구매자 정보
53
+ items: items, # 상품정보
54
+ # return_url: return_url, # 결제후 이동할 페이지 url, 아직 사용하지 않음
55
+ extra: extra.values.any? {|v|v != nil} ? extra : nil # 기타 옵션
29
56
  }.compact
30
57
  )
31
58
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bootpay
4
- VERSION = "1.0.2"
4
+ VERSION = "1.0.6"
5
5
  BANKCODE = {
6
6
  "한국은행" => "001",
7
7
  "기업은행" => "003",
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.2
4
+ version: 1.0.6
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-07 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
@@ -58,6 +58,10 @@ files:
58
58
  - bin/setup
59
59
  - bootpay-1.0.0.gem
60
60
  - bootpay-1.0.1.gem
61
+ - bootpay-1.0.2.gem
62
+ - bootpay-1.0.3.gem
63
+ - bootpay-1.0.4.gem
64
+ - bootpay-1.0.5.gem
61
65
  - bootpay.gemspec
62
66
  - lib/.DS_Store
63
67
  - lib/bootpay.rb