bootpay 1.2.0 → 3.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 +4 -4
- data/.gitignore +8 -9
- data/.rspec +2 -0
- data/CHANGELOG.md +63 -21
- data/CODE_OF_CONDUCT.md +1 -1
- data/Gemfile +2 -4
- data/LICENSE.txt +1 -1
- data/README.md +309 -196
- data/Rakefile +3 -3
- data/bin/console +1 -1
- data/bootpay.gemspec +23 -20
- data/lib/bootpay/bootpay-rest-client.rb +51 -0
- data/lib/bootpay/concern/authenticate.rb +69 -0
- data/lib/bootpay/concern/cash_receipt.rb +83 -0
- data/lib/bootpay/concern/easy.rb +18 -0
- data/lib/bootpay/concern/escrow.rb +25 -0
- data/lib/bootpay/concern/payment.rb +126 -0
- data/lib/bootpay/concern/reseller.rb +97 -0
- data/lib/bootpay/concern/rest.rb +56 -0
- data/lib/bootpay/concern/sdk.rb +52 -0
- data/lib/bootpay/concern/seller.rb +15 -0
- data/lib/bootpay/concern/service.rb +15 -0
- data/lib/bootpay/concern/subscription.rb +211 -0
- data/lib/bootpay/concern/token.rb +33 -0
- data/lib/bootpay/concern/user_token.rb +23 -0
- data/lib/bootpay/concern/wallet.rb +20 -0
- data/lib/bootpay/concern/webhook.rb +18 -0
- data/lib/bootpay/concern.rb +35 -0
- data/lib/bootpay-backend-ruby.rb +6 -0
- data/lib/bootpay.rb +10 -66
- data/lib/bootpay_storage/bootpay-storage-rest-client.rb +46 -0
- data/lib/bootpay_storage/concern/csv.rb +18 -0
- data/lib/bootpay_storage/concern/image.rb +30 -0
- data/lib/bootpay_storage/concern/rest.rb +176 -0
- data/lib/bootpay_storage/concern/token.rb +9 -0
- data/lib/bootpay_storage/concern.rb +12 -0
- data/lib/bootpay_storage/response.rb +14 -0
- data/lib/bootpay_store/bootpay-store-rest-client.rb +47 -0
- data/lib/bootpay_store/concern/alimtalk_message.rb +67 -0
- data/lib/bootpay_store/concern/alimtalk_official.rb +63 -0
- data/lib/bootpay_store/concern/alimtalk_optout.rb +72 -0
- data/lib/bootpay_store/concern/alimtalk_send.rb +83 -0
- data/lib/bootpay_store/concern/alimtalk_sender.rb +105 -0
- data/lib/bootpay_store/concern/alimtalk_template.rb +215 -0
- data/lib/bootpay_store/concern/alimtalk_webhook.rb +84 -0
- data/lib/bootpay_store/concern/invoice.rb +102 -0
- data/lib/bootpay_store/concern/mall_setting.rb +385 -0
- data/lib/bootpay_store/concern/order.rb +74 -0
- data/lib/bootpay_store/concern/order_subscription.rb +391 -0
- data/lib/bootpay_store/concern/payment.rb +119 -0
- data/lib/bootpay_store/concern/product.rb +175 -0
- data/lib/bootpay_store/concern/rest.rb +128 -0
- data/lib/bootpay_store/concern/store.rb +31 -0
- data/lib/bootpay_store/concern/supervisor.rb +211 -0
- data/lib/bootpay_store/concern/token.rb +24 -0
- data/lib/bootpay_store/concern/user.rb +325 -0
- data/lib/bootpay_store/concern/user_group.rb +221 -0
- data/lib/bootpay_store/concern/webhook.rb +17 -0
- data/lib/bootpay_store/concern.rb +45 -0
- data/lib/bootpay_store/response.rb +14 -0
- data/lib/version.rb +9 -0
- metadata +77 -49
- data/.DS_Store +0 -0
- data/.env.example +0 -23
- data/lib/.DS_Store +0 -0
- data/lib/bootpay/.DS_Store +0 -0
- data/lib/bootpay/authentication.rb +0 -61
- data/lib/bootpay/automatic_transfer.rb +0 -56
- data/lib/bootpay/billing.rb +0 -157
- data/lib/bootpay/cancel.rb +0 -29
- data/lib/bootpay/cash_receipt.rb +0 -77
- data/lib/bootpay/commerce/cart.rb +0 -20
- data/lib/bootpay/commerce/category.rb +0 -39
- data/lib/bootpay/commerce/commerce_resource.rb +0 -196
- data/lib/bootpay/commerce/coupon.rb +0 -41
- data/lib/bootpay/commerce/invoice.rb +0 -46
- data/lib/bootpay/commerce/order.rb +0 -61
- data/lib/bootpay/commerce/order_cancel.rb +0 -52
- data/lib/bootpay/commerce/order_subscription.rb +0 -117
- data/lib/bootpay/commerce/order_subscription_adjustment.rb +0 -29
- data/lib/bootpay/commerce/order_subscription_bill.rb +0 -50
- data/lib/bootpay/commerce/order_subscription_request.rb +0 -60
- data/lib/bootpay/commerce/point.rb +0 -36
- data/lib/bootpay/commerce/product.rb +0 -63
- data/lib/bootpay/commerce/store.rb +0 -21
- data/lib/bootpay/commerce/user.rb +0 -75
- data/lib/bootpay/commerce/user_group.rb +0 -70
- data/lib/bootpay/easy.rb +0 -25
- data/lib/bootpay/escrow.rb +0 -24
- data/lib/bootpay/link.rb +0 -60
- data/lib/bootpay/naverpay.rb +0 -17
- data/lib/bootpay/payment_resource.rb +0 -31
- data/lib/bootpay/reseller.rb +0 -12
- data/lib/bootpay/rest.rb +0 -46
- data/lib/bootpay/submit.rb +0 -20
- data/lib/bootpay/token.rb +0 -33
- data/lib/bootpay/verification.rb +0 -55
- data/lib/bootpay/version.rb +0 -25
- data/lib/bootpay/wallet.rb +0 -56
- data/lib/bootpay_commerce.rb +0 -152
- /data/lib/{response.rb → bootpay/response.rb} +0 -0
data/bootpay.gemspec
CHANGED
|
@@ -1,31 +1,34 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
# lib = File.expand_path('../lib', __FILE__)
|
|
3
|
-
# $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
2
|
|
|
5
|
-
require_relative "lib/
|
|
3
|
+
require_relative "lib/version"
|
|
6
4
|
|
|
7
5
|
Gem::Specification.new do |spec|
|
|
8
6
|
spec.name = "bootpay"
|
|
9
7
|
spec.version = Bootpay::VERSION
|
|
10
|
-
spec.authors = ["
|
|
11
|
-
spec.email = ["bootpay.co.kr
|
|
12
|
-
|
|
13
|
-
spec.summary
|
|
14
|
-
spec.description
|
|
15
|
-
spec.
|
|
16
|
-
spec.
|
|
17
|
-
spec.required_ruby_version = ">= 2.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
spec.metadata["
|
|
22
|
-
|
|
23
|
-
# spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
|
|
24
|
-
|
|
8
|
+
spec.authors = ["gosomi"]
|
|
9
|
+
spec.email = ["gosomi@bootpay.co.kr"]
|
|
10
|
+
|
|
11
|
+
spec.summary = "Bootpay Ruby REST Client"
|
|
12
|
+
spec.description = "부트페이 공식 Ruby 서버사이드 모듈입니다. 결제조회, 취소, 빌링키 결제시 사용됩니다."
|
|
13
|
+
spec.license = "MIT"
|
|
14
|
+
spec.homepage = "https://www.bootpay.ai"
|
|
15
|
+
spec.required_ruby_version = ">= 2.6.0"
|
|
16
|
+
|
|
17
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
|
18
|
+
spec.metadata["source_code_uri"] = "https://github.com/bootpay/backend-ruby/tree/2-x-development"
|
|
19
|
+
spec.metadata["changelog_uri"] = "https://github.com/bootpay/backend-ruby/blob/2-x-development/CHANGELOG.md"
|
|
20
|
+
spec.metadata["documentation_uri"] = "https://developers.bootpay.ai"
|
|
25
21
|
# Specify which files should be added to the gem when it is released.
|
|
26
22
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
23
|
+
# ⚠️ 루트의 tests_*.rb / *.gem 도 제외한다 — 종전 규칙은 test/·spec/·features/ **디렉터리**만
|
|
24
|
+
# 걸러서 루트에 있던 tests_basic_auth_product_info.rb 가 gem 에 실려 나갔다.
|
|
25
|
+
# 그 파일에는 dev Commerce secret_key 가 하드코딩돼 있었다 (26-09-02).
|
|
27
26
|
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
|
28
|
-
`git ls-files -z`.split("\x0").reject
|
|
27
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
|
28
|
+
f.match(%r{\A(?:test|spec|features)/}) ||
|
|
29
|
+
f.match(%r{\A(?:tests?_.*\.rb|.*\.gem)\z}) ||
|
|
30
|
+
f.match(%r{\A\.env})
|
|
31
|
+
end
|
|
29
32
|
end
|
|
30
33
|
spec.bindir = "exe"
|
|
31
34
|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
|
@@ -34,7 +37,7 @@ Gem::Specification.new do |spec|
|
|
|
34
37
|
# Uncomment to register a new dependency of your gem
|
|
35
38
|
spec.add_dependency "activesupport"
|
|
36
39
|
spec.add_dependency "http"
|
|
37
|
-
|
|
40
|
+
spec.add_dependency "addressable"
|
|
38
41
|
|
|
39
42
|
# For more information and examples about making a new gem, checkout our
|
|
40
43
|
# guide at: https://bundler.io/guides/creating_gem.html
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'active_support/all'
|
|
4
|
+
require 'http'
|
|
5
|
+
require_relative 'response'
|
|
6
|
+
require_relative '../version'
|
|
7
|
+
require_relative 'concern'
|
|
8
|
+
|
|
9
|
+
module Bootpay
|
|
10
|
+
class RestClient
|
|
11
|
+
include Concern
|
|
12
|
+
|
|
13
|
+
attr_accessor :application_id, :private_key, :client_key, :secret_key, :use_client_key, :mode, :token, :api_version
|
|
14
|
+
|
|
15
|
+
API =
|
|
16
|
+
{
|
|
17
|
+
development: 'https://dev-api.bootpay.co.kr/v2',
|
|
18
|
+
stage: 'https://stage-api.bootpay.co.kr/v2',
|
|
19
|
+
production: 'https://api.bootpay.co.kr/v2'
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
SDK_VERSION = '5.3.0'
|
|
23
|
+
|
|
24
|
+
def initialize(application_id: nil, private_key: nil, client_key: nil, secret_key: nil, mode: 'production')
|
|
25
|
+
@application_id = application_id
|
|
26
|
+
@private_key = private_key
|
|
27
|
+
@client_key = client_key
|
|
28
|
+
@secret_key = secret_key
|
|
29
|
+
@use_client_key = client_key.present?
|
|
30
|
+
@mode = mode.presence || 'production'
|
|
31
|
+
@token = nil
|
|
32
|
+
@api_version = SDK_VERSION
|
|
33
|
+
raise ArgumentError, "개발환경 mode는 development, stage, production 중에서 선택이 가능합니다." if API[@mode.to_sym].blank?
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# API URL을 변경
|
|
37
|
+
# Comment by GOSOMI
|
|
38
|
+
# @date: 2023-05-26
|
|
39
|
+
def set_api_url(url)
|
|
40
|
+
API[@mode.to_sym] = url
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# API 버전을 설정한다
|
|
44
|
+
# Comment by Gosomi
|
|
45
|
+
# Date: 2022-07-29
|
|
46
|
+
def set_api_version(version)
|
|
47
|
+
raise ArgumentError, 'API Version은 4.0.0 이상만 설정이 가능합니다.' if version < '4.0.0'
|
|
48
|
+
@api_version = version
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
module Bootpay::Concern::Authenticate
|
|
2
|
+
extend ActiveSupport::Concern
|
|
3
|
+
|
|
4
|
+
included do
|
|
5
|
+
# 본인인증 데이터 가져오기
|
|
6
|
+
# Comment by Gosomi
|
|
7
|
+
# Date: 2021-12-08
|
|
8
|
+
def certificate(receipt_id)
|
|
9
|
+
request(
|
|
10
|
+
method: :get,
|
|
11
|
+
uri: "certificate/#{receipt_id}"
|
|
12
|
+
)
|
|
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: {}, client_ip: nil)
|
|
20
|
+
request(
|
|
21
|
+
method: :post,
|
|
22
|
+
uri: 'request/authentication',
|
|
23
|
+
payload:
|
|
24
|
+
{
|
|
25
|
+
pg: pg,
|
|
26
|
+
method: method,
|
|
27
|
+
username: username,
|
|
28
|
+
identity_no: identity_no,
|
|
29
|
+
carrier: carrier,
|
|
30
|
+
phone: phone,
|
|
31
|
+
site_url: site_url,
|
|
32
|
+
authenticate_type: authenticate_type,
|
|
33
|
+
order_name: order_name,
|
|
34
|
+
authentication_id: authentication_id,
|
|
35
|
+
extra: extra,
|
|
36
|
+
user: user,
|
|
37
|
+
client_ip: client_ip
|
|
38
|
+
}.compact
|
|
39
|
+
)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# 본인인증 승인결과를 가져온다
|
|
43
|
+
# Comment by Gosomi
|
|
44
|
+
# Date: 2022-11-03
|
|
45
|
+
def confirm_authentication(receipt_id:, otp: nil)
|
|
46
|
+
request(
|
|
47
|
+
method: :post,
|
|
48
|
+
uri: 'authenticate/confirm',
|
|
49
|
+
payload: {
|
|
50
|
+
receipt_id: receipt_id,
|
|
51
|
+
otp: otp
|
|
52
|
+
}
|
|
53
|
+
)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# 다시 SMS/알람 보내기
|
|
57
|
+
# Comment by Gosomi
|
|
58
|
+
# Date: 2022-11-03
|
|
59
|
+
def realarm_authentication(receipt_id)
|
|
60
|
+
request(
|
|
61
|
+
method: :post,
|
|
62
|
+
uri: 'authenticate/realarm',
|
|
63
|
+
payload: {
|
|
64
|
+
receipt_id: receipt_id
|
|
65
|
+
}
|
|
66
|
+
)
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
module Bootpay::Concern::CashReceipt
|
|
2
|
+
extend ActiveSupport::Concern
|
|
3
|
+
|
|
4
|
+
included do
|
|
5
|
+
# 현금 영수증 발행 처리 하기
|
|
6
|
+
# Comment by Gosomi
|
|
7
|
+
# Date: 2021-12-15
|
|
8
|
+
def request_cash_receipt(pg: nil, order_name:, identity_no:, purchased_at:, cash_receipt_type:, price:, tax_free:, user: {},
|
|
9
|
+
metadata: {}, extra: {}, order_id:)
|
|
10
|
+
request(
|
|
11
|
+
method: :post,
|
|
12
|
+
uri: 'request/cash/receipt',
|
|
13
|
+
payload: {
|
|
14
|
+
pg: pg,
|
|
15
|
+
order_name: order_name,
|
|
16
|
+
identity_no: identity_no,
|
|
17
|
+
purchased_at: purchased_at,
|
|
18
|
+
cash_receipt_type: cash_receipt_type,
|
|
19
|
+
price: price,
|
|
20
|
+
tax_free: tax_free,
|
|
21
|
+
user: user,
|
|
22
|
+
metadata: metadata,
|
|
23
|
+
order_id: order_id,
|
|
24
|
+
extra: extra
|
|
25
|
+
}
|
|
26
|
+
)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# 현금영수증 발행 취소
|
|
30
|
+
# Comment by Gosomi
|
|
31
|
+
# Date: 2021-12-16
|
|
32
|
+
def cancel_cash_receipt(receipt_id:, cancel_username:, cancel_message:)
|
|
33
|
+
request(
|
|
34
|
+
method: :delete,
|
|
35
|
+
uri: "request/cash/receipt/#{receipt_id}",
|
|
36
|
+
headers: {
|
|
37
|
+
params: {
|
|
38
|
+
cancel_username: cancel_username,
|
|
39
|
+
cancel_message: cancel_message
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
)
|
|
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',
|
|
49
|
+
cash_receipt_type: '소득공제', pg: nil, test_production: false)
|
|
50
|
+
request(
|
|
51
|
+
method: :post,
|
|
52
|
+
uri: "request/receipt/cash/publish",
|
|
53
|
+
payload: {
|
|
54
|
+
pg: pg,
|
|
55
|
+
receipt_id: receipt_id,
|
|
56
|
+
username: username,
|
|
57
|
+
email: email,
|
|
58
|
+
phone: phone,
|
|
59
|
+
identity_no: identity_no,
|
|
60
|
+
currency: currency,
|
|
61
|
+
cash_receipt_type: cash_receipt_type,
|
|
62
|
+
test_production: test_production
|
|
63
|
+
}
|
|
64
|
+
)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# 결제에 포함된 현금영수증 취소
|
|
68
|
+
# Comment by Gosomi
|
|
69
|
+
# Date: 2022-07-21
|
|
70
|
+
def cash_receipt_cancel_on_receipt(receipt_id:, cancel_username:, cancel_message:)
|
|
71
|
+
request(
|
|
72
|
+
method: :delete,
|
|
73
|
+
uri: "request/receipt/cash/cancel/#{receipt_id}",
|
|
74
|
+
headers: {
|
|
75
|
+
params: {
|
|
76
|
+
cancel_username: cancel_username,
|
|
77
|
+
cancel_message: cancel_message
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
)
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module Bootpay::Concern::Easy
|
|
2
|
+
extend ActiveSupport::Concern
|
|
3
|
+
|
|
4
|
+
included do
|
|
5
|
+
# 간편결제 subscribe
|
|
6
|
+
# Comment by Gosomi
|
|
7
|
+
# Date: 2022-02-11
|
|
8
|
+
def subscribe_on_easy(receipt_id:, billing_key:)
|
|
9
|
+
request(
|
|
10
|
+
uri: 'subscribe/easy',
|
|
11
|
+
payload: {
|
|
12
|
+
receipt_id: receipt_id,
|
|
13
|
+
billing_key: billing_key
|
|
14
|
+
}
|
|
15
|
+
)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module Bootpay::Concern::Escrow
|
|
2
|
+
extend ActiveSupport::Concern
|
|
3
|
+
|
|
4
|
+
included do
|
|
5
|
+
# 배송시작 API
|
|
6
|
+
# Comment by Gosomi
|
|
7
|
+
# Date: 2021-12-14
|
|
8
|
+
def shipping_start(receipt_id:, tracking_number:, delivery_corp:, shipping_prepayment: true,
|
|
9
|
+
shipping_day: 5, user: nil, company: {}, redirect_url: nil)
|
|
10
|
+
request(
|
|
11
|
+
method: :put,
|
|
12
|
+
uri: "escrow/shipping/start/#{receipt_id}",
|
|
13
|
+
payload: {
|
|
14
|
+
tracking_number: tracking_number,
|
|
15
|
+
delivery_corp: delivery_corp,
|
|
16
|
+
shipping_prepayment: shipping_prepayment,
|
|
17
|
+
shipping_day: shipping_day,
|
|
18
|
+
user: user,
|
|
19
|
+
company: company,
|
|
20
|
+
redirect_url: redirect_url
|
|
21
|
+
}
|
|
22
|
+
)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
module Bootpay::Concern::Payment
|
|
2
|
+
extend ActiveSupport::Concern
|
|
3
|
+
|
|
4
|
+
included do
|
|
5
|
+
# 결제 정보 가져오기
|
|
6
|
+
# Comment by Gosomi
|
|
7
|
+
# Date: 2021-12-08
|
|
8
|
+
def receipt_payment(receipt_id, lookup_user_data = false)
|
|
9
|
+
request(
|
|
10
|
+
method: :get,
|
|
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}",
|
|
22
|
+
)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# 결제 승인처리
|
|
26
|
+
# Comment by Gosomi
|
|
27
|
+
# Date: 2022-01-04
|
|
28
|
+
def confirm_payment(receipt_id)
|
|
29
|
+
request(
|
|
30
|
+
uri: 'confirm',
|
|
31
|
+
payload: {
|
|
32
|
+
receipt_id: receipt_id
|
|
33
|
+
}
|
|
34
|
+
)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# 결제 취소 요청
|
|
38
|
+
# Comment by Gosomi
|
|
39
|
+
# Date: 2021-05-21
|
|
40
|
+
def cancel_payment(cancel_id: nil, receipt_id:, cancel_price: nil, cancel_tax_free: nil, cancel_username: '시스템', cancel_message: '결제취소',
|
|
41
|
+
cancel_requester: '관리자', refund: { bank_account: nil, bank_username: nil, bank_code: nil }, items: nil)
|
|
42
|
+
request(
|
|
43
|
+
uri: 'cancel',
|
|
44
|
+
payload:
|
|
45
|
+
{
|
|
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: nil, 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, commission_keys: nil, wallet_id: nil, terms: [], widget_key: nil, widget_sandbox: false,
|
|
64
|
+
redirect_url: nil)
|
|
65
|
+
rand_uuid = SecureRandom.uuid
|
|
66
|
+
request(
|
|
67
|
+
uri: 'request/payment',
|
|
68
|
+
payload:
|
|
69
|
+
{
|
|
70
|
+
platform_application_id: platform_application_id,
|
|
71
|
+
pg: pg,
|
|
72
|
+
method: method,
|
|
73
|
+
price: price,
|
|
74
|
+
tax_free: tax_free,
|
|
75
|
+
order_name: order_name,
|
|
76
|
+
order_id: order_id,
|
|
77
|
+
user_token: user_token,
|
|
78
|
+
wallet_id: wallet_id,
|
|
79
|
+
commission_keys: commission_keys,
|
|
80
|
+
terms: terms,
|
|
81
|
+
redirect_url: redirect_url,
|
|
82
|
+
widget: widget_key.present? ? 1 : 0,
|
|
83
|
+
widget_key: widget_key,
|
|
84
|
+
widget_sandbox: widget_sandbox,
|
|
85
|
+
uuid: uuid.presence || rand_uuid,
|
|
86
|
+
sk: sk.presence || "#{rand_uuid}-#{Time.current.to_i}",
|
|
87
|
+
ti: ti,
|
|
88
|
+
tk: tk.presence || "#{rand_uuid}-#{Time.current.to_i}",
|
|
89
|
+
items: items,
|
|
90
|
+
extra: extra,
|
|
91
|
+
user: user,
|
|
92
|
+
__agent: agent,
|
|
93
|
+
ver: Bootpay::RestClient::SDK_VERSION,
|
|
94
|
+
sdk_version: Bootpay::V2_VERSION
|
|
95
|
+
}
|
|
96
|
+
)
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
# 가상계좌 bulk 발급 요청
|
|
100
|
+
# Comment by GOSOMI
|
|
101
|
+
# @date: 2023-08-08
|
|
102
|
+
def request_virtual_account_bulk(pg:, order_id:, order_name:, currency: 'KRW', price:, tax_free: nil, bank_code:, bank_account:,
|
|
103
|
+
bank_username:, cash_receipt_type: nil, identity_no: nil, user: {}, metadata: {}, extra: {})
|
|
104
|
+
request(
|
|
105
|
+
uri: 'request/virtual-account/bulk',
|
|
106
|
+
payload:
|
|
107
|
+
{
|
|
108
|
+
pg: pg,
|
|
109
|
+
order_id: order_id,
|
|
110
|
+
order_name: order_name,
|
|
111
|
+
currency: currency,
|
|
112
|
+
price: price,
|
|
113
|
+
tax_free: tax_free,
|
|
114
|
+
bank_code: bank_code,
|
|
115
|
+
bank_account: bank_account,
|
|
116
|
+
bank_username: bank_username,
|
|
117
|
+
cash_receipt_type: cash_receipt_type,
|
|
118
|
+
identity_no: identity_no,
|
|
119
|
+
user: user,
|
|
120
|
+
metadata: metadata,
|
|
121
|
+
extra: extra
|
|
122
|
+
}.compact
|
|
123
|
+
)
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
end
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
module Bootpay::Concern::Reseller
|
|
2
|
+
extend ActiveSupport::Concern
|
|
3
|
+
|
|
4
|
+
included do
|
|
5
|
+
# 가맹점 계정을 생성한다
|
|
6
|
+
# Comment by Gosomi
|
|
7
|
+
# Date: 2022-01-05
|
|
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, app_name: nil, primary_key:, resources: nil,
|
|
10
|
+
send_email: false)
|
|
11
|
+
request(
|
|
12
|
+
uri: 'reseller/seller',
|
|
13
|
+
payload: {
|
|
14
|
+
company_alias: company_alias,
|
|
15
|
+
company_name: company_name,
|
|
16
|
+
email: email,
|
|
17
|
+
regist_no: regist_no,
|
|
18
|
+
owner_name: owner_name,
|
|
19
|
+
phone: phone,
|
|
20
|
+
zip: zip,
|
|
21
|
+
address1: address1,
|
|
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: 2024-07-09
|
|
34
|
+
def lookup_seller(provider_id)
|
|
35
|
+
request(
|
|
36
|
+
method: :get,
|
|
37
|
+
uri: "reseller/seller/#{provider_id}",
|
|
38
|
+
)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# 테스트로 생성한 계정을 모두 삭제한다
|
|
42
|
+
# Comment by GOSOMI
|
|
43
|
+
# @date: 2023-10-11
|
|
44
|
+
def test_destroy_provider(provider_id)
|
|
45
|
+
request(
|
|
46
|
+
uri: "reseller/test/seller/#{provider_id}",
|
|
47
|
+
method: :delete
|
|
48
|
+
)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Resource 정보를 갱신한다
|
|
52
|
+
# Comment by GOSOMI
|
|
53
|
+
# @date: 2023-10-12
|
|
54
|
+
def update_seller_payment_resources(app_id:, resources:)
|
|
55
|
+
request(
|
|
56
|
+
uri: "reseller/seller/app/resource/#{app_id}",
|
|
57
|
+
method: :put,
|
|
58
|
+
payload: {
|
|
59
|
+
resources: resources
|
|
60
|
+
}
|
|
61
|
+
)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# 판매점의 프로젝트 생성하기
|
|
65
|
+
# Comment by Gosomi
|
|
66
|
+
# Date: 2022-01-05
|
|
67
|
+
def create_seller_app(provider_id:, name:, unit: 'KRW', real: '실물', desc: nil, timezone: 'Asia/Seoul')
|
|
68
|
+
request(
|
|
69
|
+
uri: 'reseller/seller/app',
|
|
70
|
+
payload: {
|
|
71
|
+
provider_id: provider_id,
|
|
72
|
+
name: name,
|
|
73
|
+
unit: unit,
|
|
74
|
+
real: real,
|
|
75
|
+
desc: desc,
|
|
76
|
+
timezone: timezone
|
|
77
|
+
}
|
|
78
|
+
)
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# 프로젝트/가맹점 초대하기
|
|
82
|
+
# Comment by Gosomi
|
|
83
|
+
# Date: 2022-01-13
|
|
84
|
+
def member_invite(email:, level:, app_id: nil, invite_type:, provider_id: nil)
|
|
85
|
+
request(
|
|
86
|
+
uri: 'reseller/invite',
|
|
87
|
+
payload: {
|
|
88
|
+
email: email,
|
|
89
|
+
level: level,
|
|
90
|
+
app_id: app_id,
|
|
91
|
+
provider_id: provider_id,
|
|
92
|
+
invite_type: invite_type
|
|
93
|
+
}
|
|
94
|
+
)
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
end
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
module Bootpay::Concern::Rest
|
|
2
|
+
extend ActiveSupport::Concern
|
|
3
|
+
|
|
4
|
+
included do
|
|
5
|
+
private
|
|
6
|
+
|
|
7
|
+
# HTTP Request 기본 Method
|
|
8
|
+
# Comment by Gosomi
|
|
9
|
+
# Date: 2021-05-21
|
|
10
|
+
def request(method: :post, uri:, payload: {}, headers: {}, params: nil)
|
|
11
|
+
response = HTTP.headers(
|
|
12
|
+
{
|
|
13
|
+
Authorization: authotization_header,
|
|
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'
|
|
19
|
+
}.merge!(headers).compact
|
|
20
|
+
).send(
|
|
21
|
+
method.to_sym,
|
|
22
|
+
[Bootpay::RestClient::API[@mode.to_sym], uri].join('/'),
|
|
23
|
+
json: payload,
|
|
24
|
+
params: params
|
|
25
|
+
)
|
|
26
|
+
Bootpay::Response.new(
|
|
27
|
+
response.status.to_i == 200,
|
|
28
|
+
JSON.parse(response.body.to_s, symbolize_names: true)
|
|
29
|
+
)
|
|
30
|
+
rescue Exception => e
|
|
31
|
+
Bootpay::Response.new(
|
|
32
|
+
false,
|
|
33
|
+
message: "부트페이 API 서버와의 통신이 실패하였습니다. 오류 메세지: #{e.message}",
|
|
34
|
+
backtrace: e.backtrace.join("\n")
|
|
35
|
+
)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Authorize Header
|
|
39
|
+
# Comment by GOSOMI
|
|
40
|
+
# @date: 2026-03-11
|
|
41
|
+
def authotization_header
|
|
42
|
+
if @use_client_key
|
|
43
|
+
"Basic #{basic_authentification}"
|
|
44
|
+
else
|
|
45
|
+
"Bearer #{@token}" if @token.present?
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# basic_authentification
|
|
50
|
+
# Comment by GOSOMI
|
|
51
|
+
# @date: 2026-03-11
|
|
52
|
+
def basic_authentification
|
|
53
|
+
@token = Base64.strict_encode64("#{@client_key}:#{@secret_key}")
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
module Bootpay::Concern::Sdk
|
|
2
|
+
extend ActiveSupport::Concern
|
|
3
|
+
|
|
4
|
+
included do
|
|
5
|
+
# 현재 등록된 지갑 정보를 가져온다
|
|
6
|
+
# Comment by Gosomi
|
|
7
|
+
# Date: 2022-02-21
|
|
8
|
+
def wallets(user_token)
|
|
9
|
+
request(
|
|
10
|
+
method: :get,
|
|
11
|
+
uri: "sdk/easy/wallet",
|
|
12
|
+
headers: {
|
|
13
|
+
'Bootpay-User-Token': user_token
|
|
14
|
+
}
|
|
15
|
+
)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Biometric Authenticate
|
|
19
|
+
# Comment by Gosomi
|
|
20
|
+
# Date: 2022-02-21
|
|
21
|
+
def regist_biometric_authenticate(os:, token:, user_token:, uuid:)
|
|
22
|
+
request(
|
|
23
|
+
method: :post,
|
|
24
|
+
uri: 'sdk/easy/biometric',
|
|
25
|
+
headers: {
|
|
26
|
+
'Bootpay-User-Token': user_token,
|
|
27
|
+
'Bootpay-Device-UUID': uuid
|
|
28
|
+
},
|
|
29
|
+
payload: {
|
|
30
|
+
os: os,
|
|
31
|
+
token: token
|
|
32
|
+
}
|
|
33
|
+
)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Validate Password Token
|
|
37
|
+
# Comment by GOSOMI
|
|
38
|
+
# @date: 2025-12-24
|
|
39
|
+
def validate_password_token(token:, user_token:)
|
|
40
|
+
request(
|
|
41
|
+
method: :post,
|
|
42
|
+
uri: 'sdk/password-token',
|
|
43
|
+
headers: {
|
|
44
|
+
'Bootpay-User-Token': user_token
|
|
45
|
+
},
|
|
46
|
+
payload: {
|
|
47
|
+
token: token
|
|
48
|
+
}
|
|
49
|
+
)
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
@@ -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
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Bootpay::Concern::Service
|
|
2
|
+
extend ActiveSupport::Concern
|
|
3
|
+
|
|
4
|
+
included do
|
|
5
|
+
# 등록된 Wallet 정보를 가져온다
|
|
6
|
+
# Comment by GOSOMI
|
|
7
|
+
# @date: 2024-06-27
|
|
8
|
+
def lookup_service_wallets
|
|
9
|
+
request(
|
|
10
|
+
uri: 'seller/service/wallet',
|
|
11
|
+
method: :get
|
|
12
|
+
)
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|