bootpay 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.DS_Store +0 -0
- data/.gitignore +15 -0
- data/.rspec +1 -0
- data/CHANGELOG.md +5 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/Gemfile +12 -0
- data/LICENSE.txt +21 -0
- data/README.md +49 -0
- data/Rakefile +8 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/bootpay.gemspec +41 -0
- data/lib/.DS_Store +0 -0
- data/lib/api.rb +49 -0
- data/lib/bootpay/.DS_Store +0 -0
- data/lib/bootpay/billing.rb +111 -0
- data/lib/bootpay/cancel.rb +25 -0
- data/lib/bootpay/easy.rb +25 -0
- data/lib/bootpay/escrow.rb +23 -0
- data/lib/bootpay/link.rb +33 -0
- data/lib/bootpay/naverpay.rb +17 -0
- data/lib/bootpay/payment_resource.rb +17 -0
- data/lib/bootpay/reseller.rb +12 -0
- data/lib/bootpay/rest.rb +35 -0
- data/lib/bootpay/submit.rb +20 -0
- data/lib/bootpay/token.rb +20 -0
- data/lib/bootpay/verification.rb +55 -0
- data/lib/bootpay/version.rb +6 -0
- data/lib/response.rb +14 -0
- metadata +101 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 022100bd6bd482b36005a017f48fcb688740eeaedf6379f056c0a34174b328b6
|
4
|
+
data.tar.gz: 1aee63779b76d0adaa96b6708ed8bbc6cdb5be379cc9824372901a6dc440abd9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5f3fdc48ca258c10d22c8d413b2dead5e2b31adb5e4ff03a40819f8325b6c6c84b83c7348379e29162cc1fba2b4a97e6f04253816027b501e7ca1c9392717c5e
|
7
|
+
data.tar.gz: fa9bcf0841dc97fc5106fed67d4c02a747c623421f18d09342d4a9b20f1de53c3d2ad4551f03ad6840f88576fe89b418eebae17a186ddf1c877d1767b3e715b8
|
data/.DS_Store
ADDED
Binary file
|
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--require spec_helper
|
data/CHANGELOG.md
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
6
|
+
|
7
|
+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
8
|
+
|
9
|
+
## Our Standards
|
10
|
+
|
11
|
+
Examples of behavior that contributes to a positive environment for our community include:
|
12
|
+
|
13
|
+
* Demonstrating empathy and kindness toward other people
|
14
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
15
|
+
* Giving and gracefully accepting constructive feedback
|
16
|
+
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
17
|
+
* Focusing on what is best not just for us as individuals, but for the overall community
|
18
|
+
|
19
|
+
Examples of unacceptable behavior include:
|
20
|
+
|
21
|
+
* The use of sexualized language or imagery, and sexual attention or
|
22
|
+
advances of any kind
|
23
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
24
|
+
* Public or private harassment
|
25
|
+
* Publishing others' private information, such as a physical or email
|
26
|
+
address, without their explicit permission
|
27
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
28
|
+
professional setting
|
29
|
+
|
30
|
+
## Enforcement Responsibilities
|
31
|
+
|
32
|
+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
33
|
+
|
34
|
+
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
35
|
+
|
36
|
+
## Scope
|
37
|
+
|
38
|
+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
39
|
+
|
40
|
+
## Enforcement
|
41
|
+
|
42
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at rupy1014@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
|
43
|
+
|
44
|
+
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
45
|
+
|
46
|
+
## Enforcement Guidelines
|
47
|
+
|
48
|
+
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
49
|
+
|
50
|
+
### 1. Correction
|
51
|
+
|
52
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
53
|
+
|
54
|
+
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
55
|
+
|
56
|
+
### 2. Warning
|
57
|
+
|
58
|
+
**Community Impact**: A violation through a single incident or series of actions.
|
59
|
+
|
60
|
+
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
61
|
+
|
62
|
+
### 3. Temporary Ban
|
63
|
+
|
64
|
+
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
65
|
+
|
66
|
+
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
67
|
+
|
68
|
+
### 4. Permanent Ban
|
69
|
+
|
70
|
+
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
71
|
+
|
72
|
+
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
73
|
+
|
74
|
+
## Attribution
|
75
|
+
|
76
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
|
77
|
+
available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
78
|
+
|
79
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
|
80
|
+
|
81
|
+
[homepage]: https://www.contributor-covenant.org
|
82
|
+
|
83
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
84
|
+
https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2021 ehowlsla
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Bootpay Ruby 플러그인
|
2
|
+
|
3
|
+
Bootpay Ruby 라이브러리는 Ruby 언어로 작성된 어플리케이션, 프레임워크 등에서 사용가능합니다.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Gemfile 파일을 이용하여 설치하기
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'bootpay'
|
11
|
+
```
|
12
|
+
|
13
|
+
Gemfile에 위 라인을 추가하고, 아래 라인으로 인스톨 합니다.
|
14
|
+
|
15
|
+
$ bundle install
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
또는 아래 문장을 통해 바로 설치할 수 있습니다:
|
20
|
+
|
21
|
+
$ gem install backend-ruby
|
22
|
+
|
23
|
+
## Getting Started
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
# 결제 검증하기
|
27
|
+
receipt_id = '612df0250d681b001de61de6'
|
28
|
+
|
29
|
+
api = Bootpay::Api.new(
|
30
|
+
application_id: '5b8f6a4d396fa665fdc2b5ea',
|
31
|
+
private_key: 'rm6EYECr6aroQVG2ntW0A6LpWnkTgP4uQ3H18sDDUYw=',
|
32
|
+
)
|
33
|
+
if api.request_access_token.success?
|
34
|
+
response = api.verify(receipt_id)
|
35
|
+
print response.data.to_json
|
36
|
+
end
|
37
|
+
```
|
38
|
+
|
39
|
+
## Documentation
|
40
|
+
|
41
|
+
[부트페이 개발매뉴얼](https://app.gitbook.com/@bootpay)을 참조해주세요
|
42
|
+
|
43
|
+
## 기술문의
|
44
|
+
|
45
|
+
[부트페이 홈페이지](https://www.bootpay.co.kr) 우측 하단 채팅을 통해 기술문의 주세요!
|
46
|
+
|
47
|
+
## License
|
48
|
+
|
49
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "bundler/setup"
|
5
|
+
require "backend/ruby"
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require "irb"
|
15
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/bootpay.gemspec
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# lib = File.expand_path('../lib', __FILE__)
|
3
|
+
# $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
|
5
|
+
require_relative "lib/bootpay/version"
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
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
|
+
spec.required_ruby_version = ">= 2.4.0"
|
18
|
+
|
19
|
+
# spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
20
|
+
|
21
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
22
|
+
# spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
|
23
|
+
# spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
|
24
|
+
|
25
|
+
# Specify which files should be added to the gem when it is released.
|
26
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
27
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
28
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
|
29
|
+
end
|
30
|
+
spec.bindir = "exe"
|
31
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
32
|
+
spec.require_paths = ["lib"]
|
33
|
+
|
34
|
+
# Uncomment to register a new dependency of your gem
|
35
|
+
spec.add_dependency "activesupport", "~> 6.0"
|
36
|
+
spec.add_dependency "http"
|
37
|
+
# spec.add_dependency "example-gem", "~> 1.0"
|
38
|
+
|
39
|
+
# For more information and examples about making a new gem, checkout our
|
40
|
+
# guide at: https://bundler.io/guides/creating_gem.html
|
41
|
+
end
|
data/lib/.DS_Store
ADDED
Binary file
|
data/lib/api.rb
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'active_support/all'
|
2
|
+
require 'http'
|
3
|
+
require_relative 'response'
|
4
|
+
require_relative 'bootpay/billing'
|
5
|
+
require_relative 'bootpay/cancel'
|
6
|
+
require_relative 'bootpay/easy'
|
7
|
+
require_relative 'bootpay/escrow'
|
8
|
+
require_relative 'bootpay/link'
|
9
|
+
require_relative 'bootpay/naverpay'
|
10
|
+
require_relative 'bootpay/payment_resource'
|
11
|
+
require_relative 'bootpay/reseller'
|
12
|
+
require_relative 'bootpay/rest'
|
13
|
+
require_relative 'bootpay/submit'
|
14
|
+
require_relative 'bootpay/token'
|
15
|
+
require_relative 'bootpay/verification'
|
16
|
+
require_relative "bootpay/version"
|
17
|
+
|
18
|
+
module Bootpay
|
19
|
+
class Api
|
20
|
+
include Billing
|
21
|
+
include Cancel
|
22
|
+
include Easy
|
23
|
+
include Escrow
|
24
|
+
include Link
|
25
|
+
include Naverpay
|
26
|
+
include PaymentResource
|
27
|
+
include Reseller
|
28
|
+
include Rest
|
29
|
+
include Submit
|
30
|
+
include Token
|
31
|
+
include Verification
|
32
|
+
|
33
|
+
API =
|
34
|
+
{
|
35
|
+
development: 'https://dev-api.bootpay.co.kr/',
|
36
|
+
stage: 'https://stage-api.bootpay.co.kr/',
|
37
|
+
production: 'https://api.bootpay.co.kr/'
|
38
|
+
}.freeze
|
39
|
+
|
40
|
+
def initialize(application_id:, private_key:, mode: 'production')
|
41
|
+
|
42
|
+
@application_id = application_id
|
43
|
+
@private_key = private_key
|
44
|
+
@mode = mode.presence || 'production'
|
45
|
+
@token = nil
|
46
|
+
raise ArgumentError, "개발환경 mode는 development, stage, production 중에서 선택이 가능합니다." if API[@mode.to_sym].blank?
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
Binary file
|
@@ -0,0 +1,111 @@
|
|
1
|
+
module Bootpay::Billing
|
2
|
+
extend ActiveSupport::Concern
|
3
|
+
|
4
|
+
included do
|
5
|
+
# 빌링키 가져오기
|
6
|
+
# Comment by ehowlsla
|
7
|
+
# Date: 2021-08-30
|
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})
|
11
|
+
request(
|
12
|
+
uri: 'request/card_rebill',
|
13
|
+
payload:
|
14
|
+
{
|
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,
|
24
|
+
extra: extra.values.any? {|v|v != nil} ? extra : nil
|
25
|
+
}.compact
|
26
|
+
)
|
27
|
+
end
|
28
|
+
|
29
|
+
# 빌링키 삭제하기
|
30
|
+
# Comment by ehowlsla
|
31
|
+
# Date: 2021-08-30
|
32
|
+
def destroy_billing_key(billing_key)
|
33
|
+
request(
|
34
|
+
method: :delete,
|
35
|
+
uri: "subscribe/billing/#{billing_key}"
|
36
|
+
)
|
37
|
+
end
|
38
|
+
|
39
|
+
# 빌링키로 결제 요청하기
|
40
|
+
# Comment by ehowlsla
|
41
|
+
# Date: 2021-08-30
|
42
|
+
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},
|
44
|
+
feedback_url: nil, feedback_content_type: nil,
|
45
|
+
extra: {subscribeTestPayment: nil, raw_data: nil})
|
46
|
+
raise 'billing_key 값을 입력해주세요.' if billing_key.blank?
|
47
|
+
raise 'item_name 값을 입력해주세요.' if item_name.blank?
|
48
|
+
raise 'price 금액을 설정을 해주세요.' if price.blank?
|
49
|
+
raise 'order_id 주문번호를 설정해주세요.' if order_id.blank?
|
50
|
+
request(
|
51
|
+
uri: 'subscribe/billing',
|
52
|
+
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,
|
60
|
+
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
|
64
|
+
}.compact,
|
65
|
+
)
|
66
|
+
end
|
67
|
+
|
68
|
+
# 빌링키로 결제 예약하기
|
69
|
+
# Comment by ehowlsla
|
70
|
+
# Date: 2021-08-30
|
71
|
+
def subscribe_reserve_billing(billing_key: nil, item_name: nil, price: 0, tax_free: 0, order_id: nil, quota: 12, interest: 0,
|
72
|
+
user_info: {id: nil, username: nil, email: nil, phone: nil, gender: nil, area: nil, birth: nil},
|
73
|
+
feedback_url: nil, feedback_content_type: nil,
|
74
|
+
extra: {subscribeTestPayment: 0, raw_data: 0},
|
75
|
+
scheduler_type: nil, execute_at: nil)
|
76
|
+
raise 'billing_key 값을 입력해주세요.' if billing_key.blank?
|
77
|
+
raise 'item_name 값을 입력해주세요.' if item_name.blank?
|
78
|
+
raise 'price 금액을 설정을 해주세요.' if price.blank?
|
79
|
+
raise 'order_id 주문번호를 설정해주세요.' if order_id.blank?
|
80
|
+
request(
|
81
|
+
uri: 'subscribe/billing/reserve',
|
82
|
+
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,
|
90
|
+
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
|
96
|
+
}.compact,
|
97
|
+
)
|
98
|
+
end
|
99
|
+
|
100
|
+
# 결제 예약 취소하기
|
101
|
+
# Comment by ehowlsla
|
102
|
+
# Date: 2021-08-30
|
103
|
+
def subscribe_reserve_cancel(reserve_id)
|
104
|
+
raise 'reserve_id를 입력해주세요.' if reserve_id.blank?
|
105
|
+
request(
|
106
|
+
method: :delete,
|
107
|
+
uri: "subscribe/billing/reserve/#{reserve_id}"
|
108
|
+
)
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Bootpay::Cancel
|
2
|
+
extend ActiveSupport::Concern
|
3
|
+
|
4
|
+
included do
|
5
|
+
# 결제 취소 요청
|
6
|
+
# Comment by Gosomi
|
7
|
+
# Date: 2021-05-21
|
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 })
|
10
|
+
request(
|
11
|
+
uri: 'cancel',
|
12
|
+
payload:
|
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
|
21
|
+
}.compact
|
22
|
+
)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/lib/bootpay/easy.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
module Bootpay::Easy
|
2
|
+
extend ActiveSupport::Concern
|
3
|
+
|
4
|
+
included do
|
5
|
+
# 회원 Token을 요청한다
|
6
|
+
# Comment by ehowlsla
|
7
|
+
# Date: 2021-08-230
|
8
|
+
|
9
|
+
def get_user_token(user_id: nil, email: nil, name: nil, gender: nil, birth: nil, phone: nil)
|
10
|
+
raise 'user_id 값을 입력해주세요.' if user_id.blank?
|
11
|
+
|
12
|
+
request(
|
13
|
+
uri: 'request/user/token',
|
14
|
+
payload: {
|
15
|
+
user_id: user_id,
|
16
|
+
email: email,
|
17
|
+
name: name,
|
18
|
+
gender: gender,
|
19
|
+
birth: birth,
|
20
|
+
phone: phone
|
21
|
+
}.compact
|
22
|
+
)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Bootpay::Escrow
|
2
|
+
extend ActiveSupport::Concern
|
3
|
+
|
4
|
+
included do
|
5
|
+
|
6
|
+
# bootpay dev api
|
7
|
+
# Comment by Gosomi
|
8
|
+
# Date: 2020-06-18
|
9
|
+
# @return [Hash]
|
10
|
+
def delivery_start(receipt_id, delivery_no, delivery_corp)
|
11
|
+
raise 'receipt_id 값을 설정해주세요.' if receipt_id.blank?
|
12
|
+
request(
|
13
|
+
mode: :put,
|
14
|
+
uri: "delivery/start/#{receipt_id}",
|
15
|
+
payload:
|
16
|
+
{
|
17
|
+
delivery_no: delivery_no,
|
18
|
+
delivery_corp: delivery_corp
|
19
|
+
}.compact
|
20
|
+
)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/bootpay/link.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
|
2
|
+
# Comment by ehowlsla
|
3
|
+
# Date: 2021-08-31
|
4
|
+
# @return [Hash]
|
5
|
+
module Bootpay::Link
|
6
|
+
extend ActiveSupport::Concern
|
7
|
+
|
8
|
+
included do
|
9
|
+
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 })
|
13
|
+
request(
|
14
|
+
uri: 'request/payment',
|
15
|
+
payload:
|
16
|
+
{
|
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
|
29
|
+
}.compact
|
30
|
+
)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
|
2
|
+
# bootpay dev api
|
3
|
+
# Comment by Gosomi
|
4
|
+
# Date: 2020-06-18
|
5
|
+
# @return [Hash]
|
6
|
+
module Bootpay::Naverpay
|
7
|
+
extend ActiveSupport::Concern
|
8
|
+
|
9
|
+
included do
|
10
|
+
def naverpay_item_response(data)
|
11
|
+
request(
|
12
|
+
uri: 'npay/product',
|
13
|
+
payload: data
|
14
|
+
)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
|
2
|
+
# bootpay dev api
|
3
|
+
# Comment by Gosomi
|
4
|
+
# Date: 2020-06-18
|
5
|
+
# @return [Hash]
|
6
|
+
module Bootpay::PaymentResource
|
7
|
+
extend ActiveSupport::Concern
|
8
|
+
|
9
|
+
included do
|
10
|
+
def update_pg_resource(data)
|
11
|
+
request(
|
12
|
+
uri: 'project/payment',
|
13
|
+
payload: data
|
14
|
+
)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/bootpay/rest.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
module Bootpay::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: {})
|
11
|
+
response = HTTP.headers(
|
12
|
+
{
|
13
|
+
# Authorization: "Bearer #{@token}",
|
14
|
+
Authorization: "#{@token}",
|
15
|
+
content_type: 'application/json',
|
16
|
+
accept: 'application/json'
|
17
|
+
}.merge!(headers).compact
|
18
|
+
).send(
|
19
|
+
method.to_sym,
|
20
|
+
[Bootpay::Api::API[@mode.to_sym], uri].join('/'),
|
21
|
+
json: payload
|
22
|
+
)
|
23
|
+
Bootpay::Response.new(
|
24
|
+
response.status.success?,
|
25
|
+
JSON.parse(response.body.to_s, symbolize_names: true)
|
26
|
+
)
|
27
|
+
rescue Exception => e
|
28
|
+
Bootpay::Response.new(
|
29
|
+
false,
|
30
|
+
message: "부트페이 API 서버와의 통신이 실패하였습니다. 오류 메세지: #{e.message}",
|
31
|
+
backtrace: e.backtrace.join("\n")
|
32
|
+
)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
|
2
|
+
# Comment by ehowlsla
|
3
|
+
# Date: 2021-08-31
|
4
|
+
# @return [Hash]
|
5
|
+
module Bootpay::Submit
|
6
|
+
extend ActiveSupport::Concern
|
7
|
+
|
8
|
+
included do
|
9
|
+
def server_submit(receipt_id)
|
10
|
+
raise 'receipt_id 값을 입력해주세요.' if receipt_id.blank?
|
11
|
+
|
12
|
+
request(
|
13
|
+
uri: 'submit',
|
14
|
+
payload: {
|
15
|
+
receipt_id: receipt_id
|
16
|
+
}
|
17
|
+
)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Bootpay::Token
|
2
|
+
extend ActiveSupport::Concern
|
3
|
+
|
4
|
+
included do
|
5
|
+
# Access Token을 요청한다
|
6
|
+
# Comment by Gosomi
|
7
|
+
# Date: 2021-05-21
|
8
|
+
def request_access_token
|
9
|
+
response = request(
|
10
|
+
uri: 'request/token',
|
11
|
+
payload: {
|
12
|
+
application_id: @application_id,
|
13
|
+
private_key: @private_key
|
14
|
+
}
|
15
|
+
)
|
16
|
+
@token = response.data[:data][:token] if response.success?
|
17
|
+
response
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module Bootpay::Verification
|
2
|
+
extend ActiveSupport::Concern
|
3
|
+
|
4
|
+
included do
|
5
|
+
|
6
|
+
# 결제 검증하기
|
7
|
+
# Comment by ehowlsla
|
8
|
+
# Date: 2021-08-31
|
9
|
+
def verify(receipt_id)
|
10
|
+
raise 'receipt_id 값을 입력해주세요' if receipt_id.nil?
|
11
|
+
request(
|
12
|
+
method: :get,
|
13
|
+
uri: "receipt/#{receipt_id}"
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
# bootpay dev api
|
18
|
+
# Comment by ehowlsla
|
19
|
+
# Date: 2021-08-31
|
20
|
+
def subscribe_verify(receipt_id)
|
21
|
+
raise 'receipt_id 값을 입력해주세요' if receipt_id.nil?
|
22
|
+
request(
|
23
|
+
method: :get,
|
24
|
+
uri: "subscribe/billing/#{receipt_id}"
|
25
|
+
)
|
26
|
+
end
|
27
|
+
|
28
|
+
# 서버 승인하기
|
29
|
+
# Comment by ehowlsla
|
30
|
+
# Date: 2021-08-31
|
31
|
+
def confirm(receipt_id)
|
32
|
+
raise 'receipt_id 값을 입력해주세요' if receipt_id.nil?
|
33
|
+
request(
|
34
|
+
uri: "submit",
|
35
|
+
payload: {
|
36
|
+
receipt_id: receipt_id
|
37
|
+
}.compact
|
38
|
+
)
|
39
|
+
end
|
40
|
+
|
41
|
+
# 본인인증 검증하기
|
42
|
+
# Comment by ehowlsla
|
43
|
+
# Date: 2021-08-31
|
44
|
+
def certificate(receipt_id)
|
45
|
+
raise 'receipt_id 값을 입력해주세요' if receipt_id.nil?
|
46
|
+
request(
|
47
|
+
method: :get,
|
48
|
+
uri: "certificate/#{receipt_id}",
|
49
|
+
payload: {
|
50
|
+
receipt_id: receipt_id
|
51
|
+
}.compact
|
52
|
+
)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
data/lib/response.rb
ADDED
metadata
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bootpay
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- bootpay
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-09-03 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activesupport
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '6.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '6.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: http
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: 결제검증 및 취소 등의 기능 연동을 위한 bootpay ruby 플러그인 입니다.
|
42
|
+
email:
|
43
|
+
- bootpay.co.kr@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".DS_Store"
|
49
|
+
- ".gitignore"
|
50
|
+
- ".rspec"
|
51
|
+
- CHANGELOG.md
|
52
|
+
- CODE_OF_CONDUCT.md
|
53
|
+
- Gemfile
|
54
|
+
- LICENSE.txt
|
55
|
+
- README.md
|
56
|
+
- Rakefile
|
57
|
+
- bin/console
|
58
|
+
- bin/setup
|
59
|
+
- bootpay.gemspec
|
60
|
+
- lib/.DS_Store
|
61
|
+
- lib/api.rb
|
62
|
+
- lib/bootpay/.DS_Store
|
63
|
+
- lib/bootpay/billing.rb
|
64
|
+
- lib/bootpay/cancel.rb
|
65
|
+
- lib/bootpay/easy.rb
|
66
|
+
- lib/bootpay/escrow.rb
|
67
|
+
- lib/bootpay/link.rb
|
68
|
+
- lib/bootpay/naverpay.rb
|
69
|
+
- lib/bootpay/payment_resource.rb
|
70
|
+
- lib/bootpay/reseller.rb
|
71
|
+
- lib/bootpay/rest.rb
|
72
|
+
- lib/bootpay/submit.rb
|
73
|
+
- lib/bootpay/token.rb
|
74
|
+
- lib/bootpay/verification.rb
|
75
|
+
- lib/bootpay/version.rb
|
76
|
+
- lib/response.rb
|
77
|
+
homepage: http://www.bootpay.co.kr
|
78
|
+
licenses:
|
79
|
+
- MIT
|
80
|
+
metadata:
|
81
|
+
homepage_uri: http://www.bootpay.co.kr
|
82
|
+
post_install_message:
|
83
|
+
rdoc_options: []
|
84
|
+
require_paths:
|
85
|
+
- lib
|
86
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: 2.4.0
|
91
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
requirements: []
|
97
|
+
rubygems_version: 3.2.19
|
98
|
+
signing_key:
|
99
|
+
specification_version: 4
|
100
|
+
summary: Bootpay server side plugin for ruby
|
101
|
+
test_files: []
|