bootpay 1.0.9 → 1.2.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 +4 -4
- data/.DS_Store +0 -0
- data/.env.example +23 -0
- data/.gitignore +8 -1
- data/.rspec +1 -0
- data/CHANGELOG.md +8 -0
- data/README.md +38 -13
- data/bootpay.gemspec +11 -11
- data/lib/.DS_Store +0 -0
- data/lib/bootpay/.DS_Store +0 -0
- data/lib/bootpay/authentication.rb +61 -0
- data/lib/bootpay/automatic_transfer.rb +56 -0
- data/lib/bootpay/billing.rb +25 -1
- data/lib/bootpay/cash_receipt.rb +77 -0
- data/lib/bootpay/commerce/cart.rb +20 -0
- data/lib/bootpay/commerce/category.rb +39 -0
- data/lib/bootpay/commerce/commerce_resource.rb +196 -0
- data/lib/bootpay/commerce/coupon.rb +41 -0
- data/lib/bootpay/commerce/invoice.rb +46 -0
- data/lib/bootpay/commerce/order.rb +61 -0
- data/lib/bootpay/commerce/order_cancel.rb +52 -0
- data/lib/bootpay/commerce/order_subscription.rb +117 -0
- data/lib/bootpay/commerce/order_subscription_adjustment.rb +29 -0
- data/lib/bootpay/commerce/order_subscription_bill.rb +50 -0
- data/lib/bootpay/commerce/order_subscription_request.rb +60 -0
- data/lib/bootpay/commerce/point.rb +36 -0
- data/lib/bootpay/commerce/product.rb +63 -0
- data/lib/bootpay/commerce/store.rb +21 -0
- data/lib/bootpay/commerce/user.rb +75 -0
- data/lib/bootpay/commerce/user_group.rb +70 -0
- data/lib/bootpay/escrow.rb +1 -1
- data/lib/bootpay/rest.rb +15 -4
- data/lib/bootpay/token.rb +16 -3
- data/lib/bootpay/version.rb +1 -1
- data/lib/bootpay/wallet.rb +56 -0
- data/lib/bootpay.rb +22 -5
- data/lib/bootpay_commerce.rb +152 -0
- metadata +33 -8
- data/lib/bootpay/bootpay.rb +0 -49
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9857f52bec71aa5dd18ebc6348be24579e75dcb786adad6179f9abe628363cc5
|
|
4
|
+
data.tar.gz: c45ef8873b722b9ff22a5edfec482be0ccd5b5c953733d48d5e9b31a6bd4f62d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: aff54ec2aa4f15e611171cc5741a5f7c3d1d9d67c3dc846db396d11c13339b93ec4c1be02fc90bf0d6340ab8620ec5c61c8207b4cbfd3518f4511dcf6dcf368c
|
|
7
|
+
data.tar.gz: 6bbb59991a54f12a2b260dac55c71c043ad5da7e3d65e6f67e10f7cf22bc30072be912678afb31da4bb940482657bac530ba2bb5b0e7d8778319643e716fffbd
|
data/.DS_Store
ADDED
|
Binary file
|
data/.env.example
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Bootpay server SDK example/test credentials
|
|
2
|
+
BOOTPAY_ENV=production
|
|
3
|
+
|
|
4
|
+
# PG 인증 방식: new (client_key/secret_key, default) 또는 legacy (application_id/private_key)
|
|
5
|
+
BOOTPAY_AUTH_MODE=new
|
|
6
|
+
|
|
7
|
+
# PG API - recommended client_key/secret_key
|
|
8
|
+
BOOTPAY_PG_CLIENT_KEY_PROD=OdKci2s0ux9iyFWsgYHdKw
|
|
9
|
+
BOOTPAY_PG_SECRET_KEY_PROD=L15AxIjXxGwFj9xe7NUUOt9VPHqP-CvyXJuK-FqMHto=
|
|
10
|
+
BOOTPAY_PG_CLIENT_KEY_DEV=K1Xok7RzFxbT7zMBmiBXNw
|
|
11
|
+
BOOTPAY_PG_SECRET_KEY_DEV=vcd_5OXoQAxTA8JSg2VGaSnwmQPkd8DgQ6xiyL6QkyE=
|
|
12
|
+
|
|
13
|
+
# PG API - legacy application_id/private_key (호환성 검증용)
|
|
14
|
+
BOOTPAY_PG_APPLICATION_ID_PROD=5b8f6a4d396fa665fdc2b5ea
|
|
15
|
+
BOOTPAY_PG_PRIVATE_KEY_PROD=rm6EYECr6aroQVG2ntW0A6LpWnkTgP4uQ3H18sDDUYw=
|
|
16
|
+
BOOTPAY_PG_APPLICATION_ID_DEV=59bfc738e13f337dbd6ca48a
|
|
17
|
+
BOOTPAY_PG_PRIVATE_KEY_DEV=pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=
|
|
18
|
+
|
|
19
|
+
# Commerce API
|
|
20
|
+
BOOTPAY_COMMERCE_CLIENT_KEY_PROD=K1Xok7RzFxbT7zMBmiBXNw
|
|
21
|
+
BOOTPAY_COMMERCE_SECRET_KEY_PROD=vcd_5OXoQAxTA8JSg2VGaSnwmQPkd8DgQ6xiyL6QkyE=
|
|
22
|
+
BOOTPAY_COMMERCE_CLIENT_KEY_DEV=ZYEi9d93uIaQFEuxXEZfyQ
|
|
23
|
+
BOOTPAY_COMMERCE_SECRET_KEY_DEV=j8ONDlZQVHgAWq52g97pGNCqxahGatyZKuC2O09r9MM=
|
data/.gitignore
CHANGED
data/.rspec
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
--require spec_helper
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
### 1.2.0
|
|
2
|
+
- NodeJS @bootpay/backend-js@2.6.0 기준 PG API parity 보완. 신규 11개 메서드 추가 (기존 메서드 시그니처/URL 불변, 백워드 호환 유지).
|
|
3
|
+
- 본인인증: `request_authentication`, `confirm_authentication`, `realarm_authentication`
|
|
4
|
+
- 현금영수증: `cash_receipt_publish_on_receipt`, `cash_receipt_cancel_on_receipt`, `request_cash_receipt`, `cancel_cash_receipt`
|
|
5
|
+
- 자동이체 빌링키: `request_subscribe_automatic_transfer_billing_key`, `publish_automatic_transfer_billing_key`
|
|
6
|
+
- 단일 조회: `lookup_billing_key`, `subscribe_payment_reserve_lookup`
|
|
7
|
+
- `Bootpay::Rest#request` 에 `params:` 옵션 추가 — DELETE 의 query-string (현금영수증 취소의 `cancel_username` / `cancel_message`) 등에 사용. 기존 호출은 영향 없음.
|
|
8
|
+
|
|
1
9
|
### 1.0.6
|
|
2
10
|
- request_link api 에 주석 추가
|
|
3
11
|
|
data/README.md
CHANGED
|
@@ -43,22 +43,49 @@ Gemfile에 위 라인을 추가하고, 아래 라인으로 인스톨 합니다.
|
|
|
43
43
|
|
|
44
44
|
$ gem install backend-ruby
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
#
|
|
47
|
+
## 환경변수 설정
|
|
48
|
+
|
|
49
|
+
예제와 테스트는 각 SDK 루트의 `.env` 파일을 우선 읽습니다. 먼저 `.env.example`을 복사한 뒤 필요한 키만 변경하세요. `.env`는 gitignore 처리되어 커밋되지 않습니다.
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
cp .env.example .env
|
|
53
|
+
# BOOTPAY_ENV=production 또는 development
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
주요 변수:
|
|
57
|
+
|
|
58
|
+
```env
|
|
59
|
+
BOOTPAY_ENV=production
|
|
60
|
+
BOOTPAY_PG_CLIENT_KEY_PROD=...
|
|
61
|
+
BOOTPAY_PG_SECRET_KEY_PROD=...
|
|
62
|
+
BOOTPAY_PG_CLIENT_KEY_DEV=...
|
|
63
|
+
BOOTPAY_PG_SECRET_KEY_DEV=...
|
|
64
|
+
BOOTPAY_COMMERCE_CLIENT_KEY_PROD=...
|
|
65
|
+
BOOTPAY_COMMERCE_SECRET_KEY_PROD=...
|
|
66
|
+
BOOTPAY_COMMERCE_CLIENT_KEY_DEV=...
|
|
67
|
+
BOOTPAY_COMMERCE_SECRET_KEY_DEV=...
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
변수가 없으면 SDK 테스트용 기본값(NodeJS 기준 ck/sk)으로 fallback 합니다.
|
|
71
|
+
|
|
72
|
+
# 사용하기
|
|
47
73
|
|
|
48
74
|
```ruby
|
|
49
75
|
|
|
50
76
|
require 'bootpay'
|
|
51
77
|
|
|
52
78
|
@api = Bootpay::Api.new(
|
|
53
|
-
|
|
54
|
-
|
|
79
|
+
client_key: ENV.fetch('BOOTPAY_PG_CLIENT_KEY_PROD'),
|
|
80
|
+
secret_key: ENV.fetch('BOOTPAY_PG_SECRET_KEY_PROD'),
|
|
55
81
|
)
|
|
82
|
+
# Legacy application_id/private_key 방식도 계속 지원됩니다.
|
|
56
83
|
response = @api.request_access_token
|
|
57
84
|
if response.success?
|
|
58
85
|
puts response.data.to_json
|
|
59
86
|
end
|
|
60
87
|
```
|
|
61
|
-
함수 단위의 샘플 코드는 [이곳](https://github.com/bootpay/backend-ruby/tree/main/spec/
|
|
88
|
+
함수 단위의 샘플 코드는 [이곳](https://github.com/bootpay/backend-ruby/tree/main/spec/pg)을 참조하세요.
|
|
62
89
|
|
|
63
90
|
|
|
64
91
|
## 1. 토큰 발급
|
|
@@ -188,15 +215,13 @@ end
|
|
|
188
215
|
```
|
|
189
216
|
## 4-3. 빌링키 삭제
|
|
190
217
|
발급된 빌링키로 더 이상 사용되지 않도록, 삭제 요청합니다.
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
e.printStackTrace();
|
|
199
|
-
}
|
|
218
|
+
```ruby
|
|
219
|
+
def destroy_billing_key
|
|
220
|
+
if @api.request_access_token.success?
|
|
221
|
+
response = @api.destroy_billing_key('6100e7ea0d681b001fd4de69')
|
|
222
|
+
puts response.data.to_json
|
|
223
|
+
end
|
|
224
|
+
end
|
|
200
225
|
```
|
|
201
226
|
## 5. 사용자 토큰 발급
|
|
202
227
|
(부트페이 단독) 부트페이에서 제공하는 간편결제창, 생체인증 기반의 결제 사용을 위해서는 개발사에서 회원 고유번호를 관리해야하며, 해당 회원에 대한 사용자 토큰을 발급합니다.
|
data/bootpay.gemspec
CHANGED
|
@@ -5,15 +5,15 @@
|
|
|
5
5
|
require_relative "lib/bootpay/version"
|
|
6
6
|
|
|
7
7
|
Gem::Specification.new do |spec|
|
|
8
|
-
spec.name
|
|
9
|
-
spec.version
|
|
10
|
-
spec.authors
|
|
11
|
-
spec.email
|
|
12
|
-
|
|
13
|
-
spec.summary
|
|
14
|
-
spec.description
|
|
15
|
-
spec.homepage
|
|
16
|
-
spec.license
|
|
8
|
+
spec.name = "bootpay"
|
|
9
|
+
spec.version = Bootpay::VERSION
|
|
10
|
+
spec.authors = ["bootpay"]
|
|
11
|
+
spec.email = ["bootpay.co.kr@gmail.com"]
|
|
12
|
+
|
|
13
|
+
spec.summary = "Bootpay server side plugin for ruby"
|
|
14
|
+
spec.description = "결제검증 및 취소 등의 기능 연동을 위한 bootpay ruby 플러그인 입니다."
|
|
15
|
+
spec.homepage = "http://www.bootpay.co.kr"
|
|
16
|
+
spec.license = "MIT"
|
|
17
17
|
spec.required_ruby_version = ">= 2.4.0"
|
|
18
18
|
|
|
19
19
|
# spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
|
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
|
|
|
24
24
|
|
|
25
25
|
# Specify which files should be added to the gem when it is released.
|
|
26
26
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
27
|
-
spec.files
|
|
27
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
|
28
28
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
|
|
29
29
|
end
|
|
30
30
|
spec.bindir = "exe"
|
|
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
|
|
|
32
32
|
spec.require_paths = ["lib"]
|
|
33
33
|
|
|
34
34
|
# Uncomment to register a new dependency of your gem
|
|
35
|
-
spec.add_dependency "activesupport"
|
|
35
|
+
spec.add_dependency "activesupport"
|
|
36
36
|
spec.add_dependency "http"
|
|
37
37
|
# spec.add_dependency "example-gem", "~> 1.0"
|
|
38
38
|
|
data/lib/.DS_Store
ADDED
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
module Bootpay::Authentication
|
|
2
|
+
extend ActiveSupport::Concern
|
|
3
|
+
|
|
4
|
+
included do
|
|
5
|
+
# 본인인증 요청 (SMS / PASS)
|
|
6
|
+
# NodeJS: POST request/authentication
|
|
7
|
+
def request_authentication(authentication_id: nil, pg: nil, method: nil, username: nil,
|
|
8
|
+
identity_no: nil, carrier: nil, phone: nil, client_ip: nil,
|
|
9
|
+
order_name: nil, site_url: nil, authenticate_type: nil,
|
|
10
|
+
extra: nil, user: nil, metadata: nil)
|
|
11
|
+
raise 'authentication_id 값을 입력해주세요.' if authentication_id.blank?
|
|
12
|
+
raise 'pg 값을 입력해주세요.' if pg.blank?
|
|
13
|
+
raise 'method 값을 입력해주세요.' if method.blank?
|
|
14
|
+
raise 'username 값을 입력해주세요.' if username.blank?
|
|
15
|
+
raise 'identity_no 값을 입력해주세요.' if identity_no.blank?
|
|
16
|
+
raise 'carrier 값을 입력해주세요.' if carrier.blank?
|
|
17
|
+
raise 'phone 값을 입력해주세요.' if phone.blank?
|
|
18
|
+
raise 'client_ip 값을 입력해주세요.' if client_ip.blank?
|
|
19
|
+
raise 'order_name 값을 입력해주세요.' if order_name.blank?
|
|
20
|
+
request(
|
|
21
|
+
uri: 'request/authentication',
|
|
22
|
+
payload: {
|
|
23
|
+
authentication_id: authentication_id,
|
|
24
|
+
pg: pg,
|
|
25
|
+
method: method,
|
|
26
|
+
username: username,
|
|
27
|
+
identity_no: identity_no,
|
|
28
|
+
carrier: carrier,
|
|
29
|
+
phone: phone,
|
|
30
|
+
client_ip: client_ip,
|
|
31
|
+
order_name: order_name,
|
|
32
|
+
site_url: site_url,
|
|
33
|
+
authenticate_type: authenticate_type,
|
|
34
|
+
extra: extra,
|
|
35
|
+
user: user,
|
|
36
|
+
metadata: metadata
|
|
37
|
+
}.compact
|
|
38
|
+
)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# 본인인증 확인 (OTP 입력)
|
|
42
|
+
# NodeJS: POST authenticate/confirm
|
|
43
|
+
def confirm_authentication(receipt_id, otp: nil)
|
|
44
|
+
raise 'receipt_id 값을 입력해주세요.' if receipt_id.blank?
|
|
45
|
+
request(
|
|
46
|
+
uri: 'authenticate/confirm',
|
|
47
|
+
payload: { receipt_id: receipt_id, otp: otp }.compact
|
|
48
|
+
)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# 본인인증 SMS 재발송
|
|
52
|
+
# NodeJS: POST authenticate/realarm
|
|
53
|
+
def realarm_authentication(receipt_id)
|
|
54
|
+
raise 'receipt_id 값을 입력해주세요.' if receipt_id.blank?
|
|
55
|
+
request(
|
|
56
|
+
uri: 'authenticate/realarm',
|
|
57
|
+
payload: { receipt_id: receipt_id }
|
|
58
|
+
)
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
module Bootpay::AutomaticTransfer
|
|
2
|
+
extend ActiveSupport::Concern
|
|
3
|
+
|
|
4
|
+
included do
|
|
5
|
+
# 자동이체 빌링키 발급 요청
|
|
6
|
+
# NodeJS: POST request/subscribe/automatic-transfer
|
|
7
|
+
def request_subscribe_automatic_transfer_billing_key(
|
|
8
|
+
pg: nil, order_name: nil, subscription_id: nil,
|
|
9
|
+
auth_type: nil, username: nil, bank_name: nil, bank_account: nil, identity_no: nil,
|
|
10
|
+
method: nil, cash_receipt_type: nil, cash_receipt_identity_no: nil,
|
|
11
|
+
phone: nil, price: nil, tax_free: nil,
|
|
12
|
+
extra: nil, user: nil, metadata: nil
|
|
13
|
+
)
|
|
14
|
+
raise 'pg 값을 입력해주세요.' if pg.blank?
|
|
15
|
+
raise 'order_name 값을 입력해주세요.' if order_name.blank?
|
|
16
|
+
raise 'subscription_id 값을 입력해주세요.' if subscription_id.blank?
|
|
17
|
+
raise 'auth_type 값을 입력해주세요.' if auth_type.blank?
|
|
18
|
+
raise 'username 값을 입력해주세요.' if username.blank?
|
|
19
|
+
raise 'bank_name 값을 입력해주세요.' if bank_name.blank?
|
|
20
|
+
raise 'bank_account 값을 입력해주세요.' if bank_account.blank?
|
|
21
|
+
raise 'identity_no 값을 입력해주세요.' if identity_no.blank?
|
|
22
|
+
request(
|
|
23
|
+
uri: 'request/subscribe/automatic-transfer',
|
|
24
|
+
payload: {
|
|
25
|
+
pg: pg,
|
|
26
|
+
order_name: order_name,
|
|
27
|
+
subscription_id: subscription_id,
|
|
28
|
+
auth_type: auth_type, # ARS | 간편인증
|
|
29
|
+
username: username,
|
|
30
|
+
bank_name: bank_name,
|
|
31
|
+
bank_account: bank_account,
|
|
32
|
+
identity_no: identity_no,
|
|
33
|
+
method: method,
|
|
34
|
+
cash_receipt_type: cash_receipt_type, # 소득공제 | 지출증빙
|
|
35
|
+
cash_receipt_identity_no: cash_receipt_identity_no,
|
|
36
|
+
phone: phone,
|
|
37
|
+
price: price,
|
|
38
|
+
tax_free: tax_free,
|
|
39
|
+
extra: extra,
|
|
40
|
+
user: user,
|
|
41
|
+
metadata: metadata
|
|
42
|
+
}.compact
|
|
43
|
+
)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# 자동이체 빌링키 발급 완료
|
|
47
|
+
# NodeJS: POST request/subscribe/automatic-transfer/publish
|
|
48
|
+
def publish_automatic_transfer_billing_key(receipt_id)
|
|
49
|
+
raise 'receipt_id 값을 입력해주세요.' if receipt_id.blank?
|
|
50
|
+
request(
|
|
51
|
+
uri: 'request/subscribe/automatic-transfer/publish',
|
|
52
|
+
payload: { receipt_id: receipt_id }
|
|
53
|
+
)
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
data/lib/bootpay/billing.rb
CHANGED
|
@@ -60,6 +60,7 @@ module Bootpay::Billing
|
|
|
60
60
|
area: nil, # 서울|인천|대구|광주|부산|울산|경기|강원|충청북도|충북|충청남도|충남|전라북도|전북|전라남도|전남|경상북도|경북|경상남도|경남|제주|세종|대전 중 택 1
|
|
61
61
|
birth: nil # 생일 901004
|
|
62
62
|
},
|
|
63
|
+
items: nil, # 상품 정보 배열
|
|
63
64
|
feedback_url: nil, feedback_content_type: nil,
|
|
64
65
|
extra: { # 기타 설정
|
|
65
66
|
subscribe_test_payment: nil, # subscribe_test_payment:100원 결제 후 결제가 되면 billing key를 발행, 결제가 실패하면 에러
|
|
@@ -80,6 +81,7 @@ module Bootpay::Billing
|
|
|
80
81
|
quota: quota, # 5만원 이상 결제건에 적용하는 할부개월수. 0-일시불, 1은 지정시 에러 발생함, 2-2개월, 3-3개월... 12까지 지정가능
|
|
81
82
|
interest: interest, # 웰컴페이먼츠 전용, 무이자여부를 보내는 파라미터가 있다
|
|
82
83
|
user_info: user_info.values.any? {|v|v != nil} ? user_info : nil,
|
|
84
|
+
items: items, # 상품 정보 배열
|
|
83
85
|
feedback_url: feedback_url, # webhook 통지시 받으실 url 주소 (localhost 사용 불가)
|
|
84
86
|
feedback_content_type: feedback_content_type.presence || 'urlencoded', # webhook 통지시 받으실 데이터 타입 (json 또는 urlencoded, 기본값 urlencoded)
|
|
85
87
|
extra: extra.values.any? {|v|v != nil} ? extra : nil # subscribe_test_payment:100원 결제 후 결제가 되면 billing key를 발행, 결제가 실패하면 에러, raw_data: PG 오류 코드 및 메세지까지 리턴
|
|
@@ -92,8 +94,9 @@ module Bootpay::Billing
|
|
|
92
94
|
# Date: 2021-08-30
|
|
93
95
|
def subscribe_reserve_billing(billing_key: nil, item_name: nil, price: 0, tax_free: 0, order_id: nil, quota: 12, interest: 0,
|
|
94
96
|
user_info: {id: nil, username: nil, email: nil, phone: nil, gender: nil, area: nil, birth: nil},
|
|
97
|
+
items: nil, # 상품 정보 배열
|
|
95
98
|
feedback_url: nil, feedback_content_type: nil,
|
|
96
|
-
extra: {
|
|
99
|
+
extra: {subscribe_test_payment: 0, raw_data: 0},
|
|
97
100
|
execute_at: nil)
|
|
98
101
|
raise 'billing_key 값을 입력해주세요.' if billing_key.blank?
|
|
99
102
|
raise 'item_name 값을 입력해주세요.' if item_name.blank?
|
|
@@ -110,6 +113,7 @@ module Bootpay::Billing
|
|
|
110
113
|
quota: quota, # 5만원 이상 결제건에 적용하는 할부개월수. 0-일시불, 1은 지정시 에러 발생함, 2-2개월, 3-3개월... 12까지 지정가능
|
|
111
114
|
interest: interest, # 웰컴페이먼츠 전용, 무이자여부를 보내는 파라미터가 있다
|
|
112
115
|
user_info: user_info.values.any? {|v|v != nil} ? user_info : nil,
|
|
116
|
+
items: items, # 상품 정보 배열
|
|
113
117
|
feedback_url: feedback_url, # webhook 통지시 받으실 url 주소 (localhost 사용 불가)
|
|
114
118
|
feedback_content_type: feedback_content_type.presence || 'urlencoded', # webhook 통지시 받으실 데이터 타입 (json 또는 urlencoded, 기본값 urlencoded)
|
|
115
119
|
extra: extra.values.any? {|v|v != nil} ? extra : nil, # subscribe_test_payment:100원 결제 후 결제가 되면 billing key를 발행, 결제가 실패하면 에러, raw_data: PG 오류 코드 및 메세지까지 리턴
|
|
@@ -129,5 +133,25 @@ module Bootpay::Billing
|
|
|
129
133
|
uri: "subscribe/billing/reserve/#{reserve_id}"
|
|
130
134
|
)
|
|
131
135
|
end
|
|
136
|
+
|
|
137
|
+
# 빌링키 단일 조회
|
|
138
|
+
# NodeJS: GET billing_key/{billingKey}
|
|
139
|
+
def lookup_billing_key(billing_key)
|
|
140
|
+
raise 'billing_key 값을 입력해주세요.' if billing_key.blank?
|
|
141
|
+
request(
|
|
142
|
+
method: :get,
|
|
143
|
+
uri: "billing_key/#{billing_key}"
|
|
144
|
+
)
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
# 예약 결제 단일 조회
|
|
148
|
+
# NodeJS: GET subscribe/payment/reserve/{reserveId}
|
|
149
|
+
def subscribe_payment_reserve_lookup(reserve_id)
|
|
150
|
+
raise 'reserve_id 값을 입력해주세요.' if reserve_id.blank?
|
|
151
|
+
request(
|
|
152
|
+
method: :get,
|
|
153
|
+
uri: "subscribe/payment/reserve/#{reserve_id}"
|
|
154
|
+
)
|
|
155
|
+
end
|
|
132
156
|
end
|
|
133
157
|
end
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
module Bootpay::CashReceipt
|
|
2
|
+
extend ActiveSupport::Concern
|
|
3
|
+
|
|
4
|
+
included do
|
|
5
|
+
# 결제 건에 현금영수증 발급 요청
|
|
6
|
+
# NodeJS: POST request/receipt/cash/publish
|
|
7
|
+
def cash_receipt_publish_on_receipt(receipt_id: nil, identity_no: nil,
|
|
8
|
+
cash_receipt_type: nil, username: nil,
|
|
9
|
+
email: nil, phone: nil, currency: nil)
|
|
10
|
+
raise 'receipt_id 값을 입력해주세요.' if receipt_id.blank?
|
|
11
|
+
raise 'identity_no 값을 입력해주세요.' if identity_no.blank?
|
|
12
|
+
raise 'cash_receipt_type 값을 입력해주세요.' if cash_receipt_type.blank?
|
|
13
|
+
request(
|
|
14
|
+
uri: 'request/receipt/cash/publish',
|
|
15
|
+
payload: {
|
|
16
|
+
receipt_id: receipt_id,
|
|
17
|
+
identity_no: identity_no,
|
|
18
|
+
cash_receipt_type: cash_receipt_type, # 소득공제 | 지출증빙
|
|
19
|
+
username: username,
|
|
20
|
+
email: email,
|
|
21
|
+
phone: phone,
|
|
22
|
+
currency: currency
|
|
23
|
+
}.compact
|
|
24
|
+
)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# 결제 건에 발급된 현금영수증 취소
|
|
28
|
+
# NodeJS: DELETE request/receipt/cash/cancel/{receiptId}
|
|
29
|
+
def cash_receipt_cancel_on_receipt(receipt_id, cancel_username: nil, cancel_message: nil)
|
|
30
|
+
raise 'receipt_id 값을 입력해주세요.' if receipt_id.blank?
|
|
31
|
+
request(
|
|
32
|
+
method: :delete,
|
|
33
|
+
uri: "request/receipt/cash/cancel/#{receipt_id}",
|
|
34
|
+
params: { cancel_username: cancel_username, cancel_message: cancel_message }.compact
|
|
35
|
+
)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# 단독 현금영수증 발급
|
|
39
|
+
# NodeJS: POST request/cash/receipt
|
|
40
|
+
def request_cash_receipt(pg: nil, price: nil, order_name: nil, cash_receipt_type: nil,
|
|
41
|
+
identity_no: nil, order_id: nil, tax_free: nil,
|
|
42
|
+
purchased_at: nil, user: nil, extra: nil)
|
|
43
|
+
raise 'pg 값을 입력해주세요.' if pg.blank?
|
|
44
|
+
raise 'price 값을 입력해주세요.' if price.blank?
|
|
45
|
+
raise 'order_name 값을 입력해주세요.' if order_name.blank?
|
|
46
|
+
raise 'cash_receipt_type 값을 입력해주세요.' if cash_receipt_type.blank?
|
|
47
|
+
raise 'identity_no 값을 입력해주세요.' if identity_no.blank?
|
|
48
|
+
raise 'order_id 값을 입력해주세요.' if order_id.blank?
|
|
49
|
+
request(
|
|
50
|
+
uri: 'request/cash/receipt',
|
|
51
|
+
payload: {
|
|
52
|
+
pg: pg,
|
|
53
|
+
price: price,
|
|
54
|
+
order_name: order_name,
|
|
55
|
+
cash_receipt_type: cash_receipt_type,
|
|
56
|
+
identity_no: identity_no,
|
|
57
|
+
order_id: order_id,
|
|
58
|
+
tax_free: tax_free,
|
|
59
|
+
purchased_at: purchased_at,
|
|
60
|
+
user: user,
|
|
61
|
+
extra: extra
|
|
62
|
+
}.compact
|
|
63
|
+
)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# 단독 현금영수증 취소
|
|
67
|
+
# NodeJS: DELETE request/cash/receipt/{receiptId}
|
|
68
|
+
def cancel_cash_receipt(receipt_id, cancel_username: nil, cancel_message: nil)
|
|
69
|
+
raise 'receipt_id 값을 입력해주세요.' if receipt_id.blank?
|
|
70
|
+
request(
|
|
71
|
+
method: :delete,
|
|
72
|
+
uri: "request/cash/receipt/#{receipt_id}",
|
|
73
|
+
params: { cancel_username: cancel_username, cancel_message: cancel_message }.compact
|
|
74
|
+
)
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Bootpay
|
|
4
|
+
module Commerce
|
|
5
|
+
class CartModule
|
|
6
|
+
def initialize(bootpay)
|
|
7
|
+
@bootpay = bootpay
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
# 주문 미리보기 (배송비/할인 권위적 계산)
|
|
11
|
+
# POST /v1/cart/order-preview
|
|
12
|
+
#
|
|
13
|
+
# member_mode='guest' (기본): cart_items 필수
|
|
14
|
+
# member_mode='member': 서버 장바구니 사용 (user 토큰 필요)
|
|
15
|
+
def order_preview(params = {})
|
|
16
|
+
@bootpay.post('cart/order-preview', params)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Bootpay
|
|
4
|
+
module Commerce
|
|
5
|
+
class CategoryModule
|
|
6
|
+
def initialize(bootpay)
|
|
7
|
+
@bootpay = bootpay
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
# 카테고리 트리 조회
|
|
11
|
+
def list
|
|
12
|
+
@bootpay.get('categories')
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# 카테고리 단건 조회
|
|
16
|
+
def detail(category_id)
|
|
17
|
+
@bootpay.get("categories/#{category_id}")
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# 카테고리 생성
|
|
21
|
+
def create(params)
|
|
22
|
+
@bootpay.post('categories', params)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# 카테고리 수정
|
|
26
|
+
def update(params)
|
|
27
|
+
raise ArgumentError, 'category_id is required' unless params[:category_id]
|
|
28
|
+
category_id = params[:category_id]
|
|
29
|
+
body = params.reject { |k, _| k == :category_id }
|
|
30
|
+
@bootpay.put("categories/#{category_id}", body)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# 카테고리 삭제
|
|
34
|
+
def destroy(category_id)
|
|
35
|
+
@bootpay.delete("categories/#{category_id}")
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|