From 29aa9c1ba4c842b25353f92ef58c42dc0dbec38a Mon Sep 17 00:00:00 2001 From: gosomi Date: Thu, 24 Jun 2021 08:48:32 +0900 Subject: [PATCH 001/133] api version 2 REST Client --- .gitignore | 14 +++++ .rspec | 3 ++ CODE_OF_CONDUCT.md | 84 ++++++++++++++++++++++++++++++ Gemfile | 10 ++++ LICENSE.txt | 21 ++++++++ README.md | 43 +++++++++++++++ Rakefile | 8 +++ bin/console | 15 ++++++ bin/setup | 8 +++ bootpay-rest-client.gemspec | 29 +++++++++++ lib/bootpay-rest-client.rb | 32 ++++++++++++ lib/bootpay/payment.rb | 25 +++++++++ lib/bootpay/rest.rb | 34 ++++++++++++ lib/bootpay/token.rb | 20 +++++++ lib/bootpay/version.rb | 4 ++ lib/response.rb | 14 +++++ spec/bootpay/cancel_spec.rb | 20 +++++++ spec/bootpay/request_token_spec.rb | 13 +++++ spec/bootpay/rest/client_spec.rb | 11 ++++ spec/spec_helper.rb | 15 ++++++ 20 files changed, 423 insertions(+) create mode 100644 .gitignore create mode 100644 .rspec create mode 100644 CODE_OF_CONDUCT.md create mode 100644 Gemfile create mode 100644 LICENSE.txt create mode 100644 README.md create mode 100644 Rakefile create mode 100755 bin/console create mode 100755 bin/setup create mode 100644 bootpay-rest-client.gemspec create mode 100644 lib/bootpay-rest-client.rb create mode 100644 lib/bootpay/payment.rb create mode 100644 lib/bootpay/rest.rb create mode 100644 lib/bootpay/token.rb create mode 100644 lib/bootpay/version.rb create mode 100644 lib/response.rb create mode 100644 spec/bootpay/cancel_spec.rb create mode 100644 spec/bootpay/request_token_spec.rb create mode 100644 spec/bootpay/rest/client_spec.rb create mode 100644 spec/spec_helper.rb diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b528597 --- /dev/null +++ b/.gitignore @@ -0,0 +1,14 @@ +/.bundle/ +/.yardoc +/_yardoc/ +/coverage/ +/doc/ +/pkg/ +/spec/reports/ +/tmp/ + +# rspec failure tracking +.rspec_status +*.idea +*.iml +Gemfile.lock diff --git a/.rspec b/.rspec new file mode 100644 index 0000000..34c5164 --- /dev/null +++ b/.rspec @@ -0,0 +1,3 @@ +--format documentation +--color +--require spec_helper diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..93b24f9 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,84 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +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. + +We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience +* Focusing on what is best not just for us as individuals, but for the overall community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or + advances of any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email + address, without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +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. + +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. + +## Scope + +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. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at gosomi@udid.co.kr. All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community. + +**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. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series of actions. + +**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. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior. + +**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. + +### 4. Permanent Ban + +**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. + +**Consequence**: A permanent ban from any sort of public interaction within the community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0, +available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. + +Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity). + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see the FAQ at +https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations. diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..eba9392 --- /dev/null +++ b/Gemfile @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +source "https://rubygems.org" + +# Specify your gem's dependencies in bootpay-rest-client.gemspec +gemspec + +gem "rake", "~> 13.0" + +gem "rspec", "~> 3.0" diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..025b04f --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2021 gosomi + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..97787ba --- /dev/null +++ b/README.md @@ -0,0 +1,43 @@ +# Bootpay::Rest::Client + +Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/bootpay/rest/client`. To experiment with that code, run `bin/console` for an interactive prompt. + +TODO: Delete this and the text above, and describe your gem + +## Installation + +Add this line to your application's Gemfile: + +```ruby +gem 'bootpay-rest-client' +``` + +And then execute: + + $ bundle install + +Or install it yourself as: + + $ gem install bootpay-rest-client + +## Usage + +TODO: Write usage instructions here + +## Development + +After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. + +To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org). + +## Contributing + +Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/bootpay-rest-client. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/bootpay-rest-client/blob/master/CODE_OF_CONDUCT.md). + +## License + +The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT). + +## Code of Conduct + +Everyone interacting in the Bootpay::Rest::Client project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/bootpay-rest-client/blob/master/CODE_OF_CONDUCT.md). diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..b6ae734 --- /dev/null +++ b/Rakefile @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +require "bundler/gem_tasks" +require "rspec/core/rake_task" + +RSpec::Core::RakeTask.new(:spec) + +task default: :spec diff --git a/bin/console b/bin/console new file mode 100755 index 0000000..530368b --- /dev/null +++ b/bin/console @@ -0,0 +1,15 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +require "bundler/setup" +require "bootpay/rest/client" + +# You can add fixtures and/or initialization code here to make experimenting +# with your gem easier. You can also use a different console, if you like. + +# (If you use this, don't forget to add pry to your Gemfile!) +# require "pry" +# Pry.start + +require "irb" +IRB.start(__FILE__) diff --git a/bin/setup b/bin/setup new file mode 100755 index 0000000..dce67d8 --- /dev/null +++ b/bin/setup @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +set -euo pipefail +IFS=$'\n\t' +set -vx + +bundle install + +# Do any other automated setup that you need to do here diff --git a/bootpay-rest-client.gemspec b/bootpay-rest-client.gemspec new file mode 100644 index 0000000..8592400 --- /dev/null +++ b/bootpay-rest-client.gemspec @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +require_relative "lib/bootpay/version" + +Gem::Specification.new do |spec| + spec.name = "bootpay-rest-client" + spec.version = Bootpay::VERSION + spec.authors = ["gosomi"] + spec.email = ["gosomi@udid.co.kr"] + + spec.summary = "Bootpay Rest Client Version 2.0" + spec.description = "Bootpay Rest Client Version 2.0용입니다." + spec.license = "MIT" + # Specify which files should be added to the gem when it is released. + # The `git ls-files -z` loads the files in the RubyGem that have been added into git. + spec.files = Dir.chdir(File.expand_path(__dir__)) do + `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) } + end + spec.bindir = "exe" + spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) } + spec.require_paths = ["lib"] + + # Uncomment to register a new dependency of your gem + spec.add_dependency "activesupport", "~> 6.0" + spec.add_dependency "http" + + # For more information and examples about making a new gem, checkout our + # guide at: https://bundler.io/guides/creating_gem.html +end diff --git a/lib/bootpay-rest-client.rb b/lib/bootpay-rest-client.rb new file mode 100644 index 0000000..2d19f5d --- /dev/null +++ b/lib/bootpay-rest-client.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +require 'active_support/all' +require 'http' +require_relative 'response' +require_relative 'bootpay/payment' +require_relative 'bootpay/rest' +require_relative "bootpay/version" +require_relative 'bootpay/token' + +module Bootpay + class RestClient + include Payment + include Rest + include Token + + API = + { + development: 'https://dev-api.bootpay.co.kr/v2', + stage: 'https://stage-api.bootpay.co.kr/v2', + production: 'https://api.bootpay.co.kr/v2' + }.freeze + + def initialize(application_id:, private_key:, mode: 'production') + @application_id = application_id + @private_key = private_key + @mode = mode.presence || 'production' + @token = nil + raise ArgumentError, "개발환경 mode는 development, stage, production 중에서 선택이 가능합니다." if API[@mode.to_sym].blank? + end + end +end diff --git a/lib/bootpay/payment.rb b/lib/bootpay/payment.rb new file mode 100644 index 0000000..17dfb32 --- /dev/null +++ b/lib/bootpay/payment.rb @@ -0,0 +1,25 @@ +module Bootpay::Payment + extend ActiveSupport::Concern + + included do + # 결제 취소 요청 + # Comment by Gosomi + # Date: 2021-05-21 + def cancel_payment(cancel_id: nil, receipt_id:, cancel_price:, cancel_tax_free: 0, username: '시스템', message: '결제취소', + refund: { account: nil, account_holder: nil, bank_code: nil }) + request( + uri: 'cancel', + payload: + { + cancel_id: cancel_id.presence || SecureRandom.uuid, + receipt_id: receipt_id, + cancel_price: cancel_price, + cancel_tax_free: cancel_tax_free, + username: username, + message: message, + refund: refund + }.compact + ) + end + end +end \ No newline at end of file diff --git a/lib/bootpay/rest.rb b/lib/bootpay/rest.rb new file mode 100644 index 0000000..c70a412 --- /dev/null +++ b/lib/bootpay/rest.rb @@ -0,0 +1,34 @@ +module Bootpay::Rest + extend ActiveSupport::Concern + + included do + private + + # HTTP Request 기본 Method + # Comment by Gosomi + # Date: 2021-05-21 + def request(method: :post, uri:, payload: {}, headers: {}) + response = HTTP.headers( + { + Authorization: "Bearer #{@token}", + content_type: 'application/json', + accept: 'application/json' + }.merge!(headers).compact + ).send( + method.to_sym, + [Bootpay::RestClient::API[@mode.to_sym], uri].join('/'), + json: payload + ) + Bootpay::Response.new( + response.status.success?, + JSON.parse(response.body.to_s, symbolize_names: true) + ) + rescue Exception => e + Bootpay::Response.new( + false, + message: "부트페이 API 서버와의 통신이 실패하였습니다. 오류 메세지: #{e.message}", + backtrace: e.backtrace.join("\n") + ) + end + end +end \ No newline at end of file diff --git a/lib/bootpay/token.rb b/lib/bootpay/token.rb new file mode 100644 index 0000000..530a9f5 --- /dev/null +++ b/lib/bootpay/token.rb @@ -0,0 +1,20 @@ +module Bootpay::Token + extend ActiveSupport::Concern + + included do + # Access Token을 요청한다 + # Comment by Gosomi + # Date: 2021-05-21 + def request_access_token + response = request( + uri: 'request/token', + payload: { + application_id: @application_id, + private_key: @private_key + } + ) + @token = response.data[:access_token] if response.success? + response + end + end +end \ No newline at end of file diff --git a/lib/bootpay/version.rb b/lib/bootpay/version.rb new file mode 100644 index 0000000..abf8ca6 --- /dev/null +++ b/lib/bootpay/version.rb @@ -0,0 +1,4 @@ +# frozen_string_literal: true +module Bootpay + VERSION = "0.1.0" +end \ No newline at end of file diff --git a/lib/response.rb b/lib/response.rb new file mode 100644 index 0000000..d79ff04 --- /dev/null +++ b/lib/response.rb @@ -0,0 +1,14 @@ +module Bootpay + class Response + attr_reader :data + + def initialize(success = true, data = {}) + @success = success + @data = data + end + + def success? + @success + end + end +end \ No newline at end of file diff --git a/spec/bootpay/cancel_spec.rb b/spec/bootpay/cancel_spec.rb new file mode 100644 index 0000000..21bc629 --- /dev/null +++ b/spec/bootpay/cancel_spec.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +RSpec.describe Bootpay::RestClient do + it "cancel payment" do + api = Bootpay::RestClient.new( + application_id: '59bfc738e13f337dbd6ca48a', + private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', + mode: 'development' + ) + if api.request_access_token.success? + response = api.cancel_payment( + receipt_id: "60c7f87b1fc19200b1f43568", + cancel_price: 1000, + username: 'test', + message: 'test' + ) + print response.data.to_json + end + end +end diff --git a/spec/bootpay/request_token_spec.rb b/spec/bootpay/request_token_spec.rb new file mode 100644 index 0000000..0b456d2 --- /dev/null +++ b/spec/bootpay/request_token_spec.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +RSpec.describe Bootpay::RestClient do + it "request token" do + api = Bootpay::RestClient.new( + application_id: '59bfc738e13f337dbd6ca48a', + private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', + mode: 'development' + ) + response = api.request_access_token + print response.data + end +end diff --git a/spec/bootpay/rest/client_spec.rb b/spec/bootpay/rest/client_spec.rb new file mode 100644 index 0000000..5c093ee --- /dev/null +++ b/spec/bootpay/rest/client_spec.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +RSpec.describe Bootpay::Rest::Client do + it "has a version number" do + expect(Bootpay::Rest::Client::VERSION).not_to be nil + end + + it "does something useful" do + expect(false).to eq(true) + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..1ee6c94 --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +require "bootpay-rest-client" + +RSpec.configure do |config| + # Enable flags like --only-failures and --next-failure + config.example_status_persistence_file_path = ".rspec_status" + + # Disable RSpec exposing methods globally on `Module` and `main` + config.disable_monkey_patching! + + config.expect_with :rspec do |c| + c.syntax = :expect + end +end From c0097a89cb2af5604571d7fad69475a8f82a8b5d Mon Sep 17 00:00:00 2001 From: gosomi Date: Thu, 24 Jun 2021 08:50:17 +0900 Subject: [PATCH 002/133] =?UTF-8?q?rest=20client=20=EB=B2=84=EC=A0=84=202.?= =?UTF-8?q?0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bootpay/version.rb b/lib/bootpay/version.rb index abf8ca6..30eda9d 100644 --- a/lib/bootpay/version.rb +++ b/lib/bootpay/version.rb @@ -1,4 +1,4 @@ # frozen_string_literal: true module Bootpay - VERSION = "0.1.0" + VERSION = "2.0.0" end \ No newline at end of file From 532615b9007a2d29502d702a14bfa254c2d686bc Mon Sep 17 00:00:00 2001 From: gosomi Date: Thu, 24 Jun 2021 09:18:22 +0900 Subject: [PATCH 003/133] =?UTF-8?q?=EC=9D=B4=EB=A9=94=EC=9D=BC=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bootpay-rest-client.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootpay-rest-client.gemspec b/bootpay-rest-client.gemspec index 8592400..9e92de1 100644 --- a/bootpay-rest-client.gemspec +++ b/bootpay-rest-client.gemspec @@ -6,7 +6,7 @@ Gem::Specification.new do |spec| spec.name = "bootpay-rest-client" spec.version = Bootpay::VERSION spec.authors = ["gosomi"] - spec.email = ["gosomi@udid.co.kr"] + spec.email = ["gosomi@bootpay.co.kr"] spec.summary = "Bootpay Rest Client Version 2.0" spec.description = "Bootpay Rest Client Version 2.0용입니다." From 5c9b6aa8789f99f4cf9980539eda1eb5f946f2fc Mon Sep 17 00:00:00 2001 From: gosomi Date: Thu, 24 Jun 2021 09:19:58 +0900 Subject: [PATCH 004/133] =?UTF-8?q?=EB=AA=85=EC=B9=AD=EC=9D=84=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bootpay-rest-client.gemspec => bootpay-rest-client-ruby.gemspec | 2 +- lib/{bootpay-rest-client.rb => bootpay-rest-client-ruby.rb} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename bootpay-rest-client.gemspec => bootpay-rest-client-ruby.gemspec (96%) rename lib/{bootpay-rest-client.rb => bootpay-rest-client-ruby.rb} (100%) diff --git a/bootpay-rest-client.gemspec b/bootpay-rest-client-ruby.gemspec similarity index 96% rename from bootpay-rest-client.gemspec rename to bootpay-rest-client-ruby.gemspec index 9e92de1..6a9dfe4 100644 --- a/bootpay-rest-client.gemspec +++ b/bootpay-rest-client-ruby.gemspec @@ -3,7 +3,7 @@ require_relative "lib/bootpay/version" Gem::Specification.new do |spec| - spec.name = "bootpay-rest-client" + spec.name = "bootpay-rest-client-ruby" spec.version = Bootpay::VERSION spec.authors = ["gosomi"] spec.email = ["gosomi@bootpay.co.kr"] diff --git a/lib/bootpay-rest-client.rb b/lib/bootpay-rest-client-ruby.rb similarity index 100% rename from lib/bootpay-rest-client.rb rename to lib/bootpay-rest-client-ruby.rb From 7220a5a7f9936f74e761a2117841348b72ef0d4d Mon Sep 17 00:00:00 2001 From: gosomi Date: Fri, 2 Jul 2021 11:08:50 +0900 Subject: [PATCH 005/133] =?UTF-8?q?=EC=B7=A8=EC=86=8C=20=EC=82=AC=EC=9C=A0?= =?UTF-8?q?=20=EB=B0=8F=20=EC=B7=A8=EC=86=8C=EC=9E=90=EB=AA=85=20=EB=AA=85?= =?UTF-8?q?=EC=8B=9C=EC=A0=81=EC=9C=BC=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay/payment.rb | 6 +++--- spec/bootpay/cancel_spec.rb | 8 ++++---- spec/spec_helper.rb | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/bootpay/payment.rb b/lib/bootpay/payment.rb index 17dfb32..6024757 100644 --- a/lib/bootpay/payment.rb +++ b/lib/bootpay/payment.rb @@ -5,7 +5,7 @@ module Bootpay::Payment # 결제 취소 요청 # Comment by Gosomi # Date: 2021-05-21 - def cancel_payment(cancel_id: nil, receipt_id:, cancel_price:, cancel_tax_free: 0, username: '시스템', message: '결제취소', + def cancel_payment(cancel_id: nil, receipt_id:, cancel_price: nil, cancel_tax_free: 0, cancel_username: '시스템', cancel_message: '결제취소', refund: { account: nil, account_holder: nil, bank_code: nil }) request( uri: 'cancel', @@ -15,8 +15,8 @@ def cancel_payment(cancel_id: nil, receipt_id:, cancel_price:, cancel_tax_free: receipt_id: receipt_id, cancel_price: cancel_price, cancel_tax_free: cancel_tax_free, - username: username, - message: message, + cancel_username: cancel_username, + cancel_message: cancel_message, refund: refund }.compact ) diff --git a/spec/bootpay/cancel_spec.rb b/spec/bootpay/cancel_spec.rb index 21bc629..197f4cd 100644 --- a/spec/bootpay/cancel_spec.rb +++ b/spec/bootpay/cancel_spec.rb @@ -9,10 +9,10 @@ ) if api.request_access_token.success? response = api.cancel_payment( - receipt_id: "60c7f87b1fc19200b1f43568", - cancel_price: 1000, - username: 'test', - message: 'test' + receipt_id: "60dac1611fc192010874cf01", + # cancel_price: 200, + cancel_username: 'test', + cancel_message: 'test' ) print response.data.to_json end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 1ee6c94..0207aca 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require "bootpay-rest-client" +require "bootpay-rest-client-ruby" RSpec.configure do |config| # Enable flags like --only-failures and --next-failure From 71255267d74c20b49739cb606cd02f947d1fd30a Mon Sep 17 00:00:00 2001 From: gosomi Date: Fri, 2 Jul 2021 11:09:41 +0900 Subject: [PATCH 006/133] =?UTF-8?q?refund=20params=20=EB=AA=85=EC=8B=9C?= =?UTF-8?q?=EC=A0=81=EC=9C=BC=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay/payment.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bootpay/payment.rb b/lib/bootpay/payment.rb index 6024757..889768a 100644 --- a/lib/bootpay/payment.rb +++ b/lib/bootpay/payment.rb @@ -6,7 +6,7 @@ module Bootpay::Payment # Comment by Gosomi # Date: 2021-05-21 def cancel_payment(cancel_id: nil, receipt_id:, cancel_price: nil, cancel_tax_free: 0, cancel_username: '시스템', cancel_message: '결제취소', - refund: { account: nil, account_holder: nil, bank_code: nil }) + refund: { bank_account: nil, bank_username: nil, bank_code: nil }) request( uri: 'cancel', payload: From 28846b77e82748aa4981144cc4a9d65f21be2866 Mon Sep 17 00:00:00 2001 From: gosomi Date: Thu, 4 Nov 2021 13:52:54 +0900 Subject: [PATCH 007/133] =?UTF-8?q?=EB=B9=8C=EB=A7=81=ED=82=A4=20=EB=B0=9C?= =?UTF-8?q?=EA=B8=89=20=EB=B0=8F=20=EB=A7=8C=EB=A3=8C=20=EA=B8=B0=EB=8A=A5?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay-rest-client-ruby.rb | 2 + lib/bootpay/payment.rb | 5 ++- lib/bootpay/subscription.rb | 47 +++++++++++++++++++++ spec/bootpay/billing_key_spec.rb | 17 ++++++++ spec/bootpay/cancel_spec.rb | 16 +++++-- spec/bootpay/destroy_billing_key_spec.rb | 17 ++++++++ spec/bootpay/subscribe_card_payment_spec.rb | 21 +++++++++ 7 files changed, 119 insertions(+), 6 deletions(-) create mode 100644 lib/bootpay/subscription.rb create mode 100644 spec/bootpay/billing_key_spec.rb create mode 100644 spec/bootpay/destroy_billing_key_spec.rb create mode 100644 spec/bootpay/subscribe_card_payment_spec.rb diff --git a/lib/bootpay-rest-client-ruby.rb b/lib/bootpay-rest-client-ruby.rb index 2d19f5d..b52d651 100644 --- a/lib/bootpay-rest-client-ruby.rb +++ b/lib/bootpay-rest-client-ruby.rb @@ -6,12 +6,14 @@ require_relative 'bootpay/payment' require_relative 'bootpay/rest' require_relative "bootpay/version" +require_relative 'bootpay/subscription' require_relative 'bootpay/token' module Bootpay class RestClient include Payment include Rest + include Subscription include Token API = diff --git a/lib/bootpay/payment.rb b/lib/bootpay/payment.rb index 889768a..5084e19 100644 --- a/lib/bootpay/payment.rb +++ b/lib/bootpay/payment.rb @@ -6,7 +6,7 @@ module Bootpay::Payment # Comment by Gosomi # Date: 2021-05-21 def cancel_payment(cancel_id: nil, receipt_id:, cancel_price: nil, cancel_tax_free: 0, cancel_username: '시스템', cancel_message: '결제취소', - refund: { bank_account: nil, bank_username: nil, bank_code: nil }) + refund: { bank_account: nil, bank_username: nil, bank_code: nil }, items: nil) request( uri: 'cancel', payload: @@ -17,7 +17,8 @@ def cancel_payment(cancel_id: nil, receipt_id:, cancel_price: nil, cancel_tax_fr cancel_tax_free: cancel_tax_free, cancel_username: cancel_username, cancel_message: cancel_message, - refund: refund + refund: refund, + items: items }.compact ) end diff --git a/lib/bootpay/subscription.rb b/lib/bootpay/subscription.rb new file mode 100644 index 0000000..b3b1cf1 --- /dev/null +++ b/lib/bootpay/subscription.rb @@ -0,0 +1,47 @@ +module Bootpay::Subscription + extend ActiveSupport::Concern + + included do + # 빌링키 결제 데이터 가져오기 + # Comment by Gosomi + # Date: 2021-11-01 + def subscribe_billing_key(receipt_id) + request( + method: :get, + uri: "subscribe/billing_key/#{receipt_id}" + ) + end + + # 빌링키로 결제 요청하기 + # Comment by Gosomi + # Date: 2021-11-02 + def request_subscribe_card_payment(billing_key:, item_name:, price:, tax_free: 0, card_quota: '00', + card_interest: nil, order_id:, items: [], user: {}, extra: {}) + request( + uri: 'subscribe/payment', + payload: { + billing_key: billing_key, + item_name: item_name, + price: price, + tax_free: tax_free, + card_quota: card_quota, + card_interest: card_interest, + order_id: order_id, + items: items, + user: user, + extra: extra + } + ) + end + + # 빌링키를 강제로 만료한다 + # Comment by Gosomi + # Date: 2021-11-04 + def destroy_billing_key(billing_key) + request( + method: :delete, + uri: "subscribe/billing_key/#{billing_key}" + ) + end + end +end \ No newline at end of file diff --git a/spec/bootpay/billing_key_spec.rb b/spec/bootpay/billing_key_spec.rb new file mode 100644 index 0000000..078e241 --- /dev/null +++ b/spec/bootpay/billing_key_spec.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +RSpec.describe Bootpay::RestClient do + it "billing key" do + api = Bootpay::RestClient.new( + application_id: '59bfc738e13f337dbd6ca48a', + private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', + mode: 'development' + ) + if api.request_access_token.success? + response = api.subscribe_billing_key( + "61832d311fc19202de55794c" + ) + print response.data.to_json + end + end +end diff --git a/spec/bootpay/cancel_spec.rb b/spec/bootpay/cancel_spec.rb index 197f4cd..cd4ed8b 100644 --- a/spec/bootpay/cancel_spec.rb +++ b/spec/bootpay/cancel_spec.rb @@ -9,10 +9,18 @@ ) if api.request_access_token.success? response = api.cancel_payment( - receipt_id: "60dac1611fc192010874cf01", - # cancel_price: 200, - cancel_username: 'test', - cancel_message: 'test' + receipt_id: "61833d5d1fc19202dd57334a", + cancel_price: 1000, + cancel_username: 'test_user', + cancel_message: 'test_message', + # items: [ + # { + # id: 'test_1', + # name: '테스트 아이템2', + # price: 500, + # qty: 1 + # } + # ] ) print response.data.to_json end diff --git a/spec/bootpay/destroy_billing_key_spec.rb b/spec/bootpay/destroy_billing_key_spec.rb new file mode 100644 index 0000000..e8147fe --- /dev/null +++ b/spec/bootpay/destroy_billing_key_spec.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +RSpec.describe Bootpay::RestClient do + it "destroy billing key" do + api = Bootpay::RestClient.new( + application_id: '59bfc738e13f337dbd6ca48a', + private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', + mode: 'development' + ) + if api.request_access_token.success? + response = api.destroy_billing_key( + '61832d6f0e019e02e699625a' + ) + print response.data.to_json + end + end +end diff --git a/spec/bootpay/subscribe_card_payment_spec.rb b/spec/bootpay/subscribe_card_payment_spec.rb new file mode 100644 index 0000000..33f4617 --- /dev/null +++ b/spec/bootpay/subscribe_card_payment_spec.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +RSpec.describe Bootpay::RestClient do + it "billing key" do + api = Bootpay::RestClient.new( + application_id: '59bfc738e13f337dbd6ca48a', + private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', + mode: 'development' + ) + if api.request_access_token.success? + response = api.request_subscribe_card_payment( + billing_key: '61832d6f0e019e02e699625a', + item_name: '테스트결제', + price: 1000, + card_quota: '00', + order_id: Time.current.to_i + ) + print response.data.to_json + end + end +end From ca6d7736cdde49bea0210466bd9a7fcb147ddec7 Mon Sep 17 00:00:00 2001 From: gosomi Date: Wed, 8 Dec 2021 15:42:07 +0900 Subject: [PATCH 008/133] =?UTF-8?q?=EA=B2=B0=EC=A0=9C=20=ED=99=95=EC=9D=B8?= =?UTF-8?q?=20api=20=EC=B6=94=EA=B0=80=20=EB=B3=B8=EC=9D=B8=EC=9D=B8?= =?UTF-8?q?=EC=A6=9D=20=ED=99=95=EC=9D=B8=20api=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + lib/bootpay-rest-client-ruby.rb | 2 ++ lib/bootpay/authenticate.rb | 15 ++++++++++++ lib/bootpay/payment.rb | 10 ++++++++ lib/bootpay/subscription.rb | 27 +++++++++++++++++++-- spec/bootpay/billing_key_spec.rb | 2 +- spec/bootpay/cancel_spec.rb | 18 +++++++------- spec/bootpay/certificate_spec.rb | 17 +++++++++++++ spec/bootpay/destroy_billing_key_spec.rb | 2 +- spec/bootpay/receipt_payment_spec.rb | 17 +++++++++++++ spec/bootpay/subscribe_card_payment_spec.rb | 7 ++++-- 11 files changed, 103 insertions(+), 15 deletions(-) create mode 100644 lib/bootpay/authenticate.rb create mode 100644 spec/bootpay/certificate_spec.rb create mode 100644 spec/bootpay/receipt_payment_spec.rb diff --git a/.gitignore b/.gitignore index b528597..8f35358 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ *.idea *.iml Gemfile.lock +/spec/bootpay/request_rest_billing_key_spec.rb \ No newline at end of file diff --git a/lib/bootpay-rest-client-ruby.rb b/lib/bootpay-rest-client-ruby.rb index b52d651..d8b499a 100644 --- a/lib/bootpay-rest-client-ruby.rb +++ b/lib/bootpay-rest-client-ruby.rb @@ -3,6 +3,7 @@ require 'active_support/all' require 'http' require_relative 'response' +require_relative 'bootpay/authenticate' require_relative 'bootpay/payment' require_relative 'bootpay/rest' require_relative "bootpay/version" @@ -11,6 +12,7 @@ module Bootpay class RestClient + include Authenticate include Payment include Rest include Subscription diff --git a/lib/bootpay/authenticate.rb b/lib/bootpay/authenticate.rb new file mode 100644 index 0000000..27bb5bd --- /dev/null +++ b/lib/bootpay/authenticate.rb @@ -0,0 +1,15 @@ +module Bootpay::Authenticate + extend ActiveSupport::Concern + + included do + # 본인인증 데이터 가져오기 + # Comment by Gosomi + # Date: 2021-12-08 + def certificate(receipt_id) + request( + method: :get, + uri: "certificate/#{receipt_id}" + ) + end + end +end \ No newline at end of file diff --git a/lib/bootpay/payment.rb b/lib/bootpay/payment.rb index 5084e19..f993ecf 100644 --- a/lib/bootpay/payment.rb +++ b/lib/bootpay/payment.rb @@ -2,6 +2,16 @@ module Bootpay::Payment extend ActiveSupport::Concern included do + # 결제 정보 가져오기 + # Comment by Gosomi + # Date: 2021-12-08 + def receipt_payment(receipt_id) + request( + method: :get, + uri: "receipt/#{receipt_id}" + ) + end + # 결제 취소 요청 # Comment by Gosomi # Date: 2021-05-21 diff --git a/lib/bootpay/subscription.rb b/lib/bootpay/subscription.rb index b3b1cf1..8c16293 100644 --- a/lib/bootpay/subscription.rb +++ b/lib/bootpay/subscription.rb @@ -28,7 +28,7 @@ def request_subscribe_card_payment(billing_key:, item_name:, price:, tax_free: 0 card_interest: card_interest, order_id: order_id, items: items, - user: user, + user: user, extra: extra } ) @@ -40,7 +40,30 @@ def request_subscribe_card_payment(billing_key:, item_name:, price:, tax_free: 0 def destroy_billing_key(billing_key) request( method: :delete, - uri: "subscribe/billing_key/#{billing_key}" + uri: "subscribe/billing_key/#{billing_key}" + ) + end + + # 빌링키를 REST + # Comment by Gosomi + # Date: 2021-11-04 + def request_subscribe_billing_key(pg:, name:, subscription_id:, card_no:, card_pw:, + card_identity_no:, card_expire_year:, card_expire_month:, extra: {}, user: {}, user_params: {}) + request( + uri: 'request/subscribe', + payload: { + pg: pg, + name: name, + subscription_id: subscription_id, + card_no: card_no, + card_pw: card_pw, + card_identity_no: card_identity_no, + card_expire_year: card_expire_year, + card_expire_month: card_expire_month, + extra: extra, + user: user, + user_params: user_params + } ) end end diff --git a/spec/bootpay/billing_key_spec.rb b/spec/bootpay/billing_key_spec.rb index 078e241..ef81cd7 100644 --- a/spec/bootpay/billing_key_spec.rb +++ b/spec/bootpay/billing_key_spec.rb @@ -9,7 +9,7 @@ ) if api.request_access_token.success? response = api.subscribe_billing_key( - "61832d311fc19202de55794c" + "61973fa11fc19202e1f4cb8a" ) print response.data.to_json end diff --git a/spec/bootpay/cancel_spec.rb b/spec/bootpay/cancel_spec.rb index cd4ed8b..973ee1f 100644 --- a/spec/bootpay/cancel_spec.rb +++ b/spec/bootpay/cancel_spec.rb @@ -9,18 +9,18 @@ ) if api.request_access_token.success? response = api.cancel_payment( - receipt_id: "61833d5d1fc19202dd57334a", + receipt_id: "61a9e1e01fc192030badb156", cancel_price: 1000, cancel_username: 'test_user', cancel_message: 'test_message', - # items: [ - # { - # id: 'test_1', - # name: '테스트 아이템2', - # price: 500, - # qty: 1 - # } - # ] + # items: [ + # { + # id: 'test_1', + # name: '테스트 아이템2', + # price: 500, + # qty: 1 + # } + # ] ) print response.data.to_json end diff --git a/spec/bootpay/certificate_spec.rb b/spec/bootpay/certificate_spec.rb new file mode 100644 index 0000000..6095d1c --- /dev/null +++ b/spec/bootpay/certificate_spec.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +RSpec.describe Bootpay::RestClient do + it "certificate authentication" do + api = Bootpay::RestClient.new( + application_id: '59bfc738e13f337dbd6ca48a', + private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', + mode: 'development' + ) + if api.request_access_token.success? + response = api.certificate( + "61b040ec1fc19203129abd60" + ) + print response.data.to_json + end + end +end diff --git a/spec/bootpay/destroy_billing_key_spec.rb b/spec/bootpay/destroy_billing_key_spec.rb index e8147fe..05dae8e 100644 --- a/spec/bootpay/destroy_billing_key_spec.rb +++ b/spec/bootpay/destroy_billing_key_spec.rb @@ -9,7 +9,7 @@ ) if api.request_access_token.success? response = api.destroy_billing_key( - '61832d6f0e019e02e699625a' + '61a8879d1fc192030b0938fe' ) print response.data.to_json end diff --git a/spec/bootpay/receipt_payment_spec.rb b/spec/bootpay/receipt_payment_spec.rb new file mode 100644 index 0000000..2890d3f --- /dev/null +++ b/spec/bootpay/receipt_payment_spec.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +RSpec.describe Bootpay::RestClient do + it "receipt payment data" do + api = Bootpay::RestClient.new( + application_id: '59bfc738e13f337dbd6ca48a', + private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', + mode: 'development' + ) + if api.request_access_token.success? + response = api.receipt_payment( + "61b009aaec81b4057e7f6ecd" + ) + print response.data.to_json + end + end +end diff --git a/spec/bootpay/subscribe_card_payment_spec.rb b/spec/bootpay/subscribe_card_payment_spec.rb index 33f4617..2ab3b13 100644 --- a/spec/bootpay/subscribe_card_payment_spec.rb +++ b/spec/bootpay/subscribe_card_payment_spec.rb @@ -9,11 +9,14 @@ ) if api.request_access_token.success? response = api.request_subscribe_card_payment( - billing_key: '61832d6f0e019e02e699625a', + billing_key: '61a888681fc192030b093909', item_name: '테스트결제', price: 1000, card_quota: '00', - order_id: Time.current.to_i + order_id: Time.current.to_i, + user: { + phone: '01095735114' + } ) print response.data.to_json end From fd7c87a33e8f7ac6a76b44ab4822ae1890a2653c Mon Sep 17 00:00:00 2001 From: gosomi Date: Wed, 8 Dec 2021 15:42:55 +0900 Subject: [PATCH 009/133] =?UTF-8?q?=EC=A0=84=ED=99=94=EB=B2=88=ED=98=B8=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spec/bootpay/subscribe_card_payment_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/bootpay/subscribe_card_payment_spec.rb b/spec/bootpay/subscribe_card_payment_spec.rb index 2ab3b13..1353b7f 100644 --- a/spec/bootpay/subscribe_card_payment_spec.rb +++ b/spec/bootpay/subscribe_card_payment_spec.rb @@ -15,7 +15,7 @@ card_quota: '00', order_id: Time.current.to_i, user: { - phone: '01095735114' + phone: '01000000000' } ) print response.data.to_json From 02c9e80f279b2813b957887a64d0a5d12c7e2ac5 Mon Sep 17 00:00:00 2001 From: gosomi Date: Wed, 15 Dec 2021 17:40:28 +0900 Subject: [PATCH 010/133] =?UTF-8?q?=ED=98=84=EA=B8=88=EC=98=81=EC=88=98?= =?UTF-8?q?=EC=A6=9D=20=EB=B0=9C=ED=96=89=20=EB=B0=8F=20=EC=B7=A8=EC=86=8C?= =?UTF-8?q?=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay-rest-client-ruby.rb | 4 +++ lib/bootpay/cash_receipt.rb | 39 +++++++++++++++++++++++ lib/bootpay/escrow.rb | 23 +++++++++++++ spec/bootpay/cancel_spec.rb | 2 +- spec/bootpay/request_cash_receipt_spec.rb | 29 +++++++++++++++++ spec/bootpay/shipping_start_spec.rb | 25 +++++++++++++++ 6 files changed, 121 insertions(+), 1 deletion(-) create mode 100644 lib/bootpay/cash_receipt.rb create mode 100644 lib/bootpay/escrow.rb create mode 100644 spec/bootpay/request_cash_receipt_spec.rb create mode 100644 spec/bootpay/shipping_start_spec.rb diff --git a/lib/bootpay-rest-client-ruby.rb b/lib/bootpay-rest-client-ruby.rb index d8b499a..51ce02e 100644 --- a/lib/bootpay-rest-client-ruby.rb +++ b/lib/bootpay-rest-client-ruby.rb @@ -4,6 +4,8 @@ require 'http' require_relative 'response' require_relative 'bootpay/authenticate' +require_relative 'bootpay/cash_receipt' +require_relative 'bootpay/escrow' require_relative 'bootpay/payment' require_relative 'bootpay/rest' require_relative "bootpay/version" @@ -13,6 +15,8 @@ module Bootpay class RestClient include Authenticate + include CashReceipt + include Escrow include Payment include Rest include Subscription diff --git a/lib/bootpay/cash_receipt.rb b/lib/bootpay/cash_receipt.rb new file mode 100644 index 0000000..d242929 --- /dev/null +++ b/lib/bootpay/cash_receipt.rb @@ -0,0 +1,39 @@ +module Bootpay::CashReceipt + extend ActiveSupport::Concern + + included do + # 현금 영수증 발행 처리 하기 + # Comment by Gosomi + # Date: 2021-12-15 + def request_cash_receipt(pg:, item_name:, identity_no:, purchased_at:, cash_receipt_type:, price:, tax_free:, user: {}, + user_params: {}, extra: {}, order_id:) + request( + method: :post, + uri: 'request/cash/receipt', + payload: { + pg: pg, + item_name: item_name, + identity_no: identity_no, + purchased_at: purchased_at, + cash_receipt_type: cash_receipt_type, + price: price, + tax_free: tax_free, + user: user, + user_params: user_params, + order_id: order_id, + extra: extra + } + ) + end + + # 현금 영수증 취소 + # Comment by Gosomi + # Date: 2021-12-15 + def cancel_cash_receipt(receipt_id) + request( + method: :delete, + uri: "request/cash/receipt/#{receipt_id}" + ) + end + end +end \ No newline at end of file diff --git a/lib/bootpay/escrow.rb b/lib/bootpay/escrow.rb new file mode 100644 index 0000000..0d5628f --- /dev/null +++ b/lib/bootpay/escrow.rb @@ -0,0 +1,23 @@ +module Bootpay::Escrow + extend ActiveSupport::Concern + + included do + # 배송시작 API + # Comment by Gosomi + # Date: 2021-12-14 + def shipping_start(receipt_id:, tracking_number:, delivery_corp:, shipping_prepayment: true, + shipping_day: 5, user: nil) + request( + method: :put, + uri: "escrow/shipping/start/#{receipt_id}", + payload: { + tracking_number: tracking_number, + delivery_corp: delivery_corp, + shipping_prepayment: shipping_prepayment, + shipping_day: shipping_day, + user: user + } + ) + end + end +end \ No newline at end of file diff --git a/spec/bootpay/cancel_spec.rb b/spec/bootpay/cancel_spec.rb index 973ee1f..22fc4c9 100644 --- a/spec/bootpay/cancel_spec.rb +++ b/spec/bootpay/cancel_spec.rb @@ -9,7 +9,7 @@ ) if api.request_access_token.success? response = api.cancel_payment( - receipt_id: "61a9e1e01fc192030badb156", + receipt_id: "61b9410b1fc192030c746b61", cancel_price: 1000, cancel_username: 'test_user', cancel_message: 'test_message', diff --git a/spec/bootpay/request_cash_receipt_spec.rb b/spec/bootpay/request_cash_receipt_spec.rb new file mode 100644 index 0000000..e56e014 --- /dev/null +++ b/spec/bootpay/request_cash_receipt_spec.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +RSpec.describe Bootpay::RestClient do + it "request cash receipt" do + api = Bootpay::RestClient.new( + application_id: '59bfc738e13f337dbd6ca48a', + private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', + mode: 'development' + ) + if api.request_access_token.success? + response = api.request_cash_receipt( + pg: '페이앱', + price: 100, + tax_free: 0, + item_name: '테스트', + cash_receipt_type: '소득공제', + user: { + username: '부트페이', + phone: '01095735114', + email: 'aqure84@naver.com' + }, + identity_no: '01095735114', + purchased_at: Time.current.strftime('%Y-%m-%d %H:%M:%S'), + order_id: Time.current.to_f + ) + print response.data.to_json + end + end +end diff --git a/spec/bootpay/shipping_start_spec.rb b/spec/bootpay/shipping_start_spec.rb new file mode 100644 index 0000000..15e6c8e --- /dev/null +++ b/spec/bootpay/shipping_start_spec.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +RSpec.describe Bootpay::RestClient do + it "shipping start" do + api = Bootpay::RestClient.new( + application_id: '59bfc738e13f337dbd6ca48a', + private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', + mode: 'development' + ) + if api.request_access_token.success? + response = api.shipping_start( + receipt_id: "61b9410b1fc192030c746b61", + tracking_number: '123456', + delivery_corp: 'CJ대한통운', + user: { + username: '강훈', + phone: '01095735114', + address: '경기도 화성시 동탄기흥로 277번길 59', + zipcode: '08490' + } + ) + print response.data.to_json + end + end +end From 3dd72f33285655b764edc9e42bb029b48a504ff9 Mon Sep 17 00:00:00 2001 From: gosomi Date: Mon, 20 Dec 2021 08:49:39 +0900 Subject: [PATCH 011/133] =?UTF-8?q?active=20support=20=EB=B2=84=EC=A0=84?= =?UTF-8?q?=20=EC=9D=98=EC=A1=B4=EC=84=B1=20=EC=82=AD=EC=A0=9C=20spec=20?= =?UTF-8?q?=ED=8C=8C=EC=9D=BC=20=EC=97=85=EB=8D=B0=EC=9D=B4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bootpay-rest-client-ruby.gemspec | 2 +- lib/bootpay/cash_receipt.rb | 16 +++++++++++----- spec/bootpay/cancel_cash_receipt_spec.rb | 19 +++++++++++++++++++ spec/bootpay/cancel_spec.rb | 2 +- spec/bootpay/request_cash_receipt_spec.rb | 4 ++-- 5 files changed, 34 insertions(+), 9 deletions(-) create mode 100644 spec/bootpay/cancel_cash_receipt_spec.rb diff --git a/bootpay-rest-client-ruby.gemspec b/bootpay-rest-client-ruby.gemspec index 6a9dfe4..2628290 100644 --- a/bootpay-rest-client-ruby.gemspec +++ b/bootpay-rest-client-ruby.gemspec @@ -21,7 +21,7 @@ Gem::Specification.new do |spec| spec.require_paths = ["lib"] # Uncomment to register a new dependency of your gem - spec.add_dependency "activesupport", "~> 6.0" + spec.add_dependency "activesupport" spec.add_dependency "http" # For more information and examples about making a new gem, checkout our diff --git a/lib/bootpay/cash_receipt.rb b/lib/bootpay/cash_receipt.rb index d242929..e2591c8 100644 --- a/lib/bootpay/cash_receipt.rb +++ b/lib/bootpay/cash_receipt.rb @@ -26,13 +26,19 @@ def request_cash_receipt(pg:, item_name:, identity_no:, purchased_at:, cash_rece ) end - # 현금 영수증 취소 + # 현금영수증 발행 취소 # Comment by Gosomi - # Date: 2021-12-15 - def cancel_cash_receipt(receipt_id) + # Date: 2021-12-16 + def cancel_cash_receipt(receipt_id:, cancel_username:, cancel_message:) request( - method: :delete, - uri: "request/cash/receipt/#{receipt_id}" + method: :delete, + uri: "request/cash/receipt/#{receipt_id}", + headers: { + params: { + cancel_username: cancel_username, + cancel_message: cancel_message + } + } ) end end diff --git a/spec/bootpay/cancel_cash_receipt_spec.rb b/spec/bootpay/cancel_cash_receipt_spec.rb new file mode 100644 index 0000000..8fd5fa7 --- /dev/null +++ b/spec/bootpay/cancel_cash_receipt_spec.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +RSpec.describe Bootpay::RestClient do + it "cancel cash receipt" do + api = Bootpay::RestClient.new( + application_id: '59bfc738e13f337dbd6ca48a', + private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', + mode: 'development' + ) + if api.request_access_token.success? + response = api.cancel_cash_receipt( + receipt_id: '61baf1d91fc1920311e080c4', + cancel_username: 'test', + cancel_message: 'test 취소' + ) + print response.data.to_json + end + end +end diff --git a/spec/bootpay/cancel_spec.rb b/spec/bootpay/cancel_spec.rb index 22fc4c9..c2df6be 100644 --- a/spec/bootpay/cancel_spec.rb +++ b/spec/bootpay/cancel_spec.rb @@ -9,7 +9,7 @@ ) if api.request_access_token.success? response = api.cancel_payment( - receipt_id: "61b9410b1fc192030c746b61", + receipt_id: "61baf7e81fc1920311e08106", cancel_price: 1000, cancel_username: 'test_user', cancel_message: 'test_message', diff --git a/spec/bootpay/request_cash_receipt_spec.rb b/spec/bootpay/request_cash_receipt_spec.rb index e56e014..36c9c83 100644 --- a/spec/bootpay/request_cash_receipt_spec.rb +++ b/spec/bootpay/request_cash_receipt_spec.rb @@ -9,8 +9,8 @@ ) if api.request_access_token.success? response = api.request_cash_receipt( - pg: '페이앱', - price: 100, + pg: '이니시스', + price: 1000, tax_free: 0, item_name: '테스트', cash_receipt_type: '소득공제', From 7219c3c894a3c090a907626a444b35d46338de85 Mon Sep 17 00:00:00 2001 From: gosomi Date: Mon, 20 Dec 2021 09:51:12 +0900 Subject: [PATCH 012/133] =?UTF-8?q?namespace=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay-rest-client-ruby.rb | 18 +++--------------- lib/bootpay/concern.rb | 19 +++++++++++++++++++ lib/bootpay/{ => concern}/authenticate.rb | 2 +- lib/bootpay/{ => concern}/cash_receipt.rb | 2 +- lib/bootpay/{ => concern}/escrow.rb | 2 +- lib/bootpay/{ => concern}/payment.rb | 2 +- lib/bootpay/{ => concern}/rest.rb | 2 +- lib/bootpay/{ => concern}/subscription.rb | 2 +- lib/bootpay/{ => concern}/token.rb | 2 +- 9 files changed, 29 insertions(+), 22 deletions(-) create mode 100644 lib/bootpay/concern.rb rename lib/bootpay/{ => concern}/authenticate.rb (87%) rename lib/bootpay/{ => concern}/cash_receipt.rb (97%) rename lib/bootpay/{ => concern}/escrow.rb (95%) rename lib/bootpay/{ => concern}/payment.rb (97%) rename lib/bootpay/{ => concern}/rest.rb (96%) rename lib/bootpay/{ => concern}/subscription.rb (98%) rename lib/bootpay/{ => concern}/token.rb (93%) diff --git a/lib/bootpay-rest-client-ruby.rb b/lib/bootpay-rest-client-ruby.rb index 51ce02e..7ccf926 100644 --- a/lib/bootpay-rest-client-ruby.rb +++ b/lib/bootpay-rest-client-ruby.rb @@ -3,24 +3,12 @@ require 'active_support/all' require 'http' require_relative 'response' -require_relative 'bootpay/authenticate' -require_relative 'bootpay/cash_receipt' -require_relative 'bootpay/escrow' -require_relative 'bootpay/payment' -require_relative 'bootpay/rest' -require_relative "bootpay/version" -require_relative 'bootpay/subscription' -require_relative 'bootpay/token' +require_relative 'bootpay/version' +require_relative 'bootpay/concern' module Bootpay class RestClient - include Authenticate - include CashReceipt - include Escrow - include Payment - include Rest - include Subscription - include Token + include Concern API = { diff --git a/lib/bootpay/concern.rb b/lib/bootpay/concern.rb new file mode 100644 index 0000000..9e2d941 --- /dev/null +++ b/lib/bootpay/concern.rb @@ -0,0 +1,19 @@ +module Bootpay + module Concern + require_relative 'concern/authenticate' + require_relative 'concern/cash_receipt' + require_relative 'concern/escrow' + require_relative 'concern/payment' + require_relative 'concern/rest' + require_relative 'concern/subscription' + require_relative 'concern/token' + + include Authenticate + include CashReceipt + include Escrow + include Payment + include Rest + include Subscription + include Token + end +end \ No newline at end of file diff --git a/lib/bootpay/authenticate.rb b/lib/bootpay/concern/authenticate.rb similarity index 87% rename from lib/bootpay/authenticate.rb rename to lib/bootpay/concern/authenticate.rb index 27bb5bd..1c76493 100644 --- a/lib/bootpay/authenticate.rb +++ b/lib/bootpay/concern/authenticate.rb @@ -1,4 +1,4 @@ -module Bootpay::Authenticate +module Bootpay::Concern::Authenticate extend ActiveSupport::Concern included do diff --git a/lib/bootpay/cash_receipt.rb b/lib/bootpay/concern/cash_receipt.rb similarity index 97% rename from lib/bootpay/cash_receipt.rb rename to lib/bootpay/concern/cash_receipt.rb index e2591c8..682ef96 100644 --- a/lib/bootpay/cash_receipt.rb +++ b/lib/bootpay/concern/cash_receipt.rb @@ -1,4 +1,4 @@ -module Bootpay::CashReceipt +module Bootpay::Concern::CashReceipt extend ActiveSupport::Concern included do diff --git a/lib/bootpay/escrow.rb b/lib/bootpay/concern/escrow.rb similarity index 95% rename from lib/bootpay/escrow.rb rename to lib/bootpay/concern/escrow.rb index 0d5628f..ce6c7e7 100644 --- a/lib/bootpay/escrow.rb +++ b/lib/bootpay/concern/escrow.rb @@ -1,4 +1,4 @@ -module Bootpay::Escrow +module Bootpay::Concern::Escrow extend ActiveSupport::Concern included do diff --git a/lib/bootpay/payment.rb b/lib/bootpay/concern/payment.rb similarity index 97% rename from lib/bootpay/payment.rb rename to lib/bootpay/concern/payment.rb index f993ecf..85d1cbe 100644 --- a/lib/bootpay/payment.rb +++ b/lib/bootpay/concern/payment.rb @@ -1,4 +1,4 @@ -module Bootpay::Payment +module Bootpay::Concern::Payment extend ActiveSupport::Concern included do diff --git a/lib/bootpay/rest.rb b/lib/bootpay/concern/rest.rb similarity index 96% rename from lib/bootpay/rest.rb rename to lib/bootpay/concern/rest.rb index c70a412..7844caa 100644 --- a/lib/bootpay/rest.rb +++ b/lib/bootpay/concern/rest.rb @@ -1,4 +1,4 @@ -module Bootpay::Rest +module Bootpay::Concern::Rest extend ActiveSupport::Concern included do diff --git a/lib/bootpay/subscription.rb b/lib/bootpay/concern/subscription.rb similarity index 98% rename from lib/bootpay/subscription.rb rename to lib/bootpay/concern/subscription.rb index 8c16293..eac6b41 100644 --- a/lib/bootpay/subscription.rb +++ b/lib/bootpay/concern/subscription.rb @@ -1,4 +1,4 @@ -module Bootpay::Subscription +module Bootpay::Concern::Subscription extend ActiveSupport::Concern included do diff --git a/lib/bootpay/token.rb b/lib/bootpay/concern/token.rb similarity index 93% rename from lib/bootpay/token.rb rename to lib/bootpay/concern/token.rb index 530a9f5..4b8d8c5 100644 --- a/lib/bootpay/token.rb +++ b/lib/bootpay/concern/token.rb @@ -1,4 +1,4 @@ -module Bootpay::Token +module Bootpay::Concern::Token extend ActiveSupport::Concern included do From 53f0eb3a429acd571608958e3f87f22599c3a7c1 Mon Sep 17 00:00:00 2001 From: gosomi Date: Mon, 20 Dec 2021 09:53:14 +0900 Subject: [PATCH 013/133] =?UTF-8?q?=EB=B2=84=EC=A0=84=EC=9D=84=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bootpay-rest-client-ruby.gemspec | 2 +- lib/bootpay/version.rb | 2 +- spec/bootpay/rest/client_spec.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bootpay-rest-client-ruby.gemspec b/bootpay-rest-client-ruby.gemspec index 2628290..f874511 100644 --- a/bootpay-rest-client-ruby.gemspec +++ b/bootpay-rest-client-ruby.gemspec @@ -4,7 +4,7 @@ require_relative "lib/bootpay/version" Gem::Specification.new do |spec| spec.name = "bootpay-rest-client-ruby" - spec.version = Bootpay::VERSION + spec.version = Bootpay::V2_VERSION spec.authors = ["gosomi"] spec.email = ["gosomi@bootpay.co.kr"] diff --git a/lib/bootpay/version.rb b/lib/bootpay/version.rb index 30eda9d..7b9eb11 100644 --- a/lib/bootpay/version.rb +++ b/lib/bootpay/version.rb @@ -1,4 +1,4 @@ # frozen_string_literal: true module Bootpay - VERSION = "2.0.0" + V2_VERSION = "2.0.0" end \ No newline at end of file diff --git a/spec/bootpay/rest/client_spec.rb b/spec/bootpay/rest/client_spec.rb index 5c093ee..3bc3747 100644 --- a/spec/bootpay/rest/client_spec.rb +++ b/spec/bootpay/rest/client_spec.rb @@ -2,7 +2,7 @@ RSpec.describe Bootpay::Rest::Client do it "has a version number" do - expect(Bootpay::Rest::Client::VERSION).not_to be nil + expect(Bootpay::Rest::Client::V2_VERSION).not_to be nil end it "does something useful" do From 4f1d820095823376337167dc7e7a5f79330ac186 Mon Sep 17 00:00:00 2001 From: gosomi Date: Tue, 21 Dec 2021 14:55:08 +0900 Subject: [PATCH 014/133] =?UTF-8?q?webhook=EC=9D=84=20=EC=9E=AC=EC=9A=94?= =?UTF-8?q?=EC=B2=AD=20API=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay/concern/webhook.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 lib/bootpay/concern/webhook.rb diff --git a/lib/bootpay/concern/webhook.rb b/lib/bootpay/concern/webhook.rb new file mode 100644 index 0000000..6046830 --- /dev/null +++ b/lib/bootpay/concern/webhook.rb @@ -0,0 +1,17 @@ +module Bootpay::Concern::Webhook + extend ActiveSupport::Concern + + included do + # Access Token을 요청한다 + # Comment by Gosomi + # Date: 2021-05-21 + def request_webhook(receipt_id) + request( + uri: 'request/webhook', + payload: { + receipt_id: receipt_id + } + ) + end + end +end \ No newline at end of file From 59f211c4f924033cf3599c6304a8c3bb40e972fa Mon Sep 17 00:00:00 2001 From: gosomi Date: Tue, 21 Dec 2021 15:03:36 +0900 Subject: [PATCH 015/133] =?UTF-8?q?webhook=20url=20=EC=9E=AC=EC=8B=9C?= =?UTF-8?q?=EB=8F=84=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay/concern/webhook.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/bootpay/concern/webhook.rb b/lib/bootpay/concern/webhook.rb index 6046830..bf73aa9 100644 --- a/lib/bootpay/concern/webhook.rb +++ b/lib/bootpay/concern/webhook.rb @@ -5,11 +5,12 @@ module Bootpay::Concern::Webhook # Access Token을 요청한다 # Comment by Gosomi # Date: 2021-05-21 - def request_webhook(receipt_id) + def request_webhook(receipt_id:, webhook_url:) request( uri: 'request/webhook', payload: { - receipt_id: receipt_id + receipt_id: receipt_id, + webhook_url: webhook_url } ) end From 11c71c630a731395896d811814b530a6f32d522f Mon Sep 17 00:00:00 2001 From: gosomi Date: Tue, 21 Dec 2021 15:38:30 +0900 Subject: [PATCH 016/133] =?UTF-8?q?webhook=20include=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay/concern.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/bootpay/concern.rb b/lib/bootpay/concern.rb index 9e2d941..19ddd47 100644 --- a/lib/bootpay/concern.rb +++ b/lib/bootpay/concern.rb @@ -7,6 +7,7 @@ module Concern require_relative 'concern/rest' require_relative 'concern/subscription' require_relative 'concern/token' + require_relative 'concern/webhook' include Authenticate include CashReceipt @@ -15,5 +16,6 @@ module Concern include Rest include Subscription include Token + include Webhook end end \ No newline at end of file From b345a90272108e173a3b039b3a951e2c2202a609 Mon Sep 17 00:00:00 2001 From: gosomi Date: Thu, 23 Dec 2021 16:53:08 +0900 Subject: [PATCH 017/133] =?UTF-8?q?item=5Fname=20->=20order=5Fname?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay/concern/cash_receipt.rb | 4 ++-- lib/bootpay/concern/subscription.rb | 4 ++-- spec/bootpay/request_cash_receipt_spec.rb | 2 +- spec/bootpay/subscribe_card_payment_spec.rb | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/bootpay/concern/cash_receipt.rb b/lib/bootpay/concern/cash_receipt.rb index 682ef96..317960d 100644 --- a/lib/bootpay/concern/cash_receipt.rb +++ b/lib/bootpay/concern/cash_receipt.rb @@ -5,14 +5,14 @@ module Bootpay::Concern::CashReceipt # 현금 영수증 발행 처리 하기 # Comment by Gosomi # Date: 2021-12-15 - def request_cash_receipt(pg:, item_name:, identity_no:, purchased_at:, cash_receipt_type:, price:, tax_free:, user: {}, + def request_cash_receipt(pg:, order_name:, identity_no:, purchased_at:, cash_receipt_type:, price:, tax_free:, user: {}, user_params: {}, extra: {}, order_id:) request( method: :post, uri: 'request/cash/receipt', payload: { pg: pg, - item_name: item_name, + order_name: order_name, identity_no: identity_no, purchased_at: purchased_at, cash_receipt_type: cash_receipt_type, diff --git a/lib/bootpay/concern/subscription.rb b/lib/bootpay/concern/subscription.rb index eac6b41..c610795 100644 --- a/lib/bootpay/concern/subscription.rb +++ b/lib/bootpay/concern/subscription.rb @@ -15,13 +15,13 @@ def subscribe_billing_key(receipt_id) # 빌링키로 결제 요청하기 # Comment by Gosomi # Date: 2021-11-02 - def request_subscribe_card_payment(billing_key:, item_name:, price:, tax_free: 0, card_quota: '00', + def request_subscribe_card_payment(billing_key:, order_name:, price:, tax_free: 0, card_quota: '00', card_interest: nil, order_id:, items: [], user: {}, extra: {}) request( uri: 'subscribe/payment', payload: { billing_key: billing_key, - item_name: item_name, + order_name: order_name, price: price, tax_free: tax_free, card_quota: card_quota, diff --git a/spec/bootpay/request_cash_receipt_spec.rb b/spec/bootpay/request_cash_receipt_spec.rb index 36c9c83..b36dc5c 100644 --- a/spec/bootpay/request_cash_receipt_spec.rb +++ b/spec/bootpay/request_cash_receipt_spec.rb @@ -12,7 +12,7 @@ pg: '이니시스', price: 1000, tax_free: 0, - item_name: '테스트', + order_name: '테스트', cash_receipt_type: '소득공제', user: { username: '부트페이', diff --git a/spec/bootpay/subscribe_card_payment_spec.rb b/spec/bootpay/subscribe_card_payment_spec.rb index 1353b7f..4458929 100644 --- a/spec/bootpay/subscribe_card_payment_spec.rb +++ b/spec/bootpay/subscribe_card_payment_spec.rb @@ -10,7 +10,7 @@ if api.request_access_token.success? response = api.request_subscribe_card_payment( billing_key: '61a888681fc192030b093909', - item_name: '테스트결제', + order_name: '테스트결제', price: 1000, card_quota: '00', order_id: Time.current.to_i, From ba9897ff7e321ef3720043c22d89b68b1949ac68 Mon Sep 17 00:00:00 2001 From: gosomi Date: Mon, 3 Jan 2022 15:20:32 +0900 Subject: [PATCH 018/133] =?UTF-8?q?user=5Fparams=20->=20return=5Fparameter?= =?UTF-8?q?s=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay/concern/cash_receipt.rb | 6 +++--- lib/bootpay/concern/subscription.rb | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/bootpay/concern/cash_receipt.rb b/lib/bootpay/concern/cash_receipt.rb index 317960d..71e9cfb 100644 --- a/lib/bootpay/concern/cash_receipt.rb +++ b/lib/bootpay/concern/cash_receipt.rb @@ -6,20 +6,20 @@ module Bootpay::Concern::CashReceipt # Comment by Gosomi # Date: 2021-12-15 def request_cash_receipt(pg:, order_name:, identity_no:, purchased_at:, cash_receipt_type:, price:, tax_free:, user: {}, - user_params: {}, extra: {}, order_id:) + return_parameters: {}, extra: {}, order_id:) request( method: :post, uri: 'request/cash/receipt', payload: { pg: pg, - order_name: order_name, + order_name: order_name, identity_no: identity_no, purchased_at: purchased_at, cash_receipt_type: cash_receipt_type, price: price, tax_free: tax_free, user: user, - user_params: user_params, + return_parameters: return_parameters, order_id: order_id, extra: extra } diff --git a/lib/bootpay/concern/subscription.rb b/lib/bootpay/concern/subscription.rb index c610795..4d37253 100644 --- a/lib/bootpay/concern/subscription.rb +++ b/lib/bootpay/concern/subscription.rb @@ -21,14 +21,14 @@ def request_subscribe_card_payment(billing_key:, order_name:, price:, tax_free: uri: 'subscribe/payment', payload: { billing_key: billing_key, - order_name: order_name, + order_name: order_name, price: price, tax_free: tax_free, card_quota: card_quota, card_interest: card_interest, order_id: order_id, items: items, - user: user, + user: user, extra: extra } ) @@ -48,7 +48,7 @@ def destroy_billing_key(billing_key) # Comment by Gosomi # Date: 2021-11-04 def request_subscribe_billing_key(pg:, name:, subscription_id:, card_no:, card_pw:, - card_identity_no:, card_expire_year:, card_expire_month:, extra: {}, user: {}, user_params: {}) + card_identity_no:, card_expire_year:, card_expire_month:, extra: {}, user: {}, return_parameters: {}) request( uri: 'request/subscribe', payload: { @@ -62,7 +62,7 @@ def request_subscribe_billing_key(pg:, name:, subscription_id:, card_no:, card_p card_expire_month: card_expire_month, extra: extra, user: user, - user_params: user_params + return_parameters: return_parameters } ) end From 2f169373dffe582abcd3fa68e9f4b8a13c88af0b Mon Sep 17 00:00:00 2001 From: gosomi Date: Tue, 4 Jan 2022 14:01:13 +0900 Subject: [PATCH 019/133] =?UTF-8?q?=EC=84=9C=EB=B2=84=20=EC=8A=B9=EC=9D=B8?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay/concern/payment.rb | 12 ++++++++++++ spec/bootpay/confirm_payment_spec.rb | 17 +++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 spec/bootpay/confirm_payment_spec.rb diff --git a/lib/bootpay/concern/payment.rb b/lib/bootpay/concern/payment.rb index 85d1cbe..45af37c 100644 --- a/lib/bootpay/concern/payment.rb +++ b/lib/bootpay/concern/payment.rb @@ -12,6 +12,18 @@ def receipt_payment(receipt_id) ) end + # 결제 승인처리 + # Comment by Gosomi + # Date: 2022-01-04 + def confirm_payment(receipt_id) + request( + uri: 'confirm', + payload: { + receipt_id: receipt_id + } + ) + end + # 결제 취소 요청 # Comment by Gosomi # Date: 2021-05-21 diff --git a/spec/bootpay/confirm_payment_spec.rb b/spec/bootpay/confirm_payment_spec.rb new file mode 100644 index 0000000..90edea3 --- /dev/null +++ b/spec/bootpay/confirm_payment_spec.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +RSpec.describe Bootpay::RestClient do + it "confirm payment" do + api = Bootpay::RestClient.new( + application_id: '59bfc738e13f337dbd6ca48a', + private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', + mode: 'development' + ) + if api.request_access_token.success? + response = api.confirm_payment( + "61d3d41b1fc19202e483320b" + ) + print response.data.to_json + end + end +end From 09e10be4762b420158f961c74d29438b47adc8bf Mon Sep 17 00:00:00 2001 From: gosomi Date: Tue, 18 Jan 2022 16:06:36 +0900 Subject: [PATCH 020/133] =?UTF-8?q?subscribe=20on=20continue=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay/concern/subscription.rb | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/bootpay/concern/subscription.rb b/lib/bootpay/concern/subscription.rb index 4d37253..9fdd764 100644 --- a/lib/bootpay/concern/subscription.rb +++ b/lib/bootpay/concern/subscription.rb @@ -47,13 +47,13 @@ def destroy_billing_key(billing_key) # 빌링키를 REST # Comment by Gosomi # Date: 2021-11-04 - def request_subscribe_billing_key(pg:, name:, subscription_id:, card_no:, card_pw:, + def request_subscribe_billing_key(pg:, order_name:, subscription_id:, card_no:, card_pw:, card_identity_no:, card_expire_year:, card_expire_month:, extra: {}, user: {}, return_parameters: {}) request( uri: 'request/subscribe', payload: { pg: pg, - name: name, + order_name: order_name, subscription_id: subscription_id, card_no: card_no, card_pw: card_pw, @@ -66,5 +66,15 @@ def request_subscribe_billing_key(pg:, name:, subscription_id:, card_no:, card_p } ) end + + # 정기결제를 계속해서 진행한다 + # Comment by Gosomi + # Date: 2022-01-18 + def request_subscribe_on_continue(receipt_id) + request( + method: :put, + uri: "request/subscribe/#{receipt_id}" + ) + end end end \ No newline at end of file From b8695a9249d442c3ae801428e5b78a4cfef340d3 Mon Sep 17 00:00:00 2001 From: gosomi Date: Thu, 3 Feb 2022 17:56:06 +0900 Subject: [PATCH 021/133] =?UTF-8?q?return=5Fparameters=20->=20metadata?= =?UTF-8?q?=EB=A1=9C=20=EB=B3=80=EA=B2=BD=20test=20spec=20=EB=B3=80?= =?UTF-8?q?=EC=88=98=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay/concern.rb | 4 ++ lib/bootpay/concern/cash_receipt.rb | 4 +- lib/bootpay/concern/reseller.rb | 59 +++++++++++++++++++ lib/bootpay/concern/subscription.rb | 4 +- spec/bootpay/billing_key_spec.rb | 2 +- .../reseller_create_seller_app_spec.rb | 21 +++++++ spec/bootpay/reseller_create_seller_spec.rb | 22 +++++++ spec/bootpay/reseller_member_invite_spec.rb | 29 +++++++++ spec/bootpay/subscribe_card_payment_spec.rb | 2 +- 9 files changed, 141 insertions(+), 6 deletions(-) create mode 100644 lib/bootpay/concern/reseller.rb create mode 100644 spec/bootpay/reseller_create_seller_app_spec.rb create mode 100644 spec/bootpay/reseller_create_seller_spec.rb create mode 100644 spec/bootpay/reseller_member_invite_spec.rb diff --git a/lib/bootpay/concern.rb b/lib/bootpay/concern.rb index 19ddd47..cee889f 100644 --- a/lib/bootpay/concern.rb +++ b/lib/bootpay/concern.rb @@ -4,18 +4,22 @@ module Concern require_relative 'concern/cash_receipt' require_relative 'concern/escrow' require_relative 'concern/payment' + require_relative 'concern/reseller' require_relative 'concern/rest' require_relative 'concern/subscription' require_relative 'concern/token' + require_relative 'concern/user_token' require_relative 'concern/webhook' include Authenticate include CashReceipt include Escrow include Payment + include Reseller include Rest include Subscription include Token + include UserToken include Webhook end end \ No newline at end of file diff --git a/lib/bootpay/concern/cash_receipt.rb b/lib/bootpay/concern/cash_receipt.rb index 71e9cfb..524c13f 100644 --- a/lib/bootpay/concern/cash_receipt.rb +++ b/lib/bootpay/concern/cash_receipt.rb @@ -6,7 +6,7 @@ module Bootpay::Concern::CashReceipt # Comment by Gosomi # Date: 2021-12-15 def request_cash_receipt(pg:, order_name:, identity_no:, purchased_at:, cash_receipt_type:, price:, tax_free:, user: {}, - return_parameters: {}, extra: {}, order_id:) + metadata: {}, extra: {}, order_id:) request( method: :post, uri: 'request/cash/receipt', @@ -19,7 +19,7 @@ def request_cash_receipt(pg:, order_name:, identity_no:, purchased_at:, cash_rec price: price, tax_free: tax_free, user: user, - return_parameters: return_parameters, + metadata: metadata, order_id: order_id, extra: extra } diff --git a/lib/bootpay/concern/reseller.rb b/lib/bootpay/concern/reseller.rb new file mode 100644 index 0000000..10092bc --- /dev/null +++ b/lib/bootpay/concern/reseller.rb @@ -0,0 +1,59 @@ +module Bootpay::Concern::Reseller + extend ActiveSupport::Concern + + included do + # 가맹점 계정을 생성한다 + # Comment by Gosomi + # Date: 2022-01-05 + def create_seller(company_alias:, company_name:, email: nil, regist_no: nil, owner_name: nil, + phone: nil, zip: nil, address1: nil, address2: nil) + request( + uri: 'reseller/seller', + payload: { + company_alias: company_alias, + company_name: company_name, + email: email, + regist_no: regist_no, + owner_name: owner_name, + phone: phone, + zip: zip, + address1: address1, + address2: address2 + } + ) + end + + # 판매점의 프로젝트 생성하기 + # Comment by Gosomi + # Date: 2022-01-05 + def create_seller_app(provider_id:, name:, unit: 'KRW', real: '실물', desc: nil, timezone: 'Asia/Seoul') + request( + uri: 'reseller/seller/app', + payload: { + provider_id: provider_id, + name: name, + unit: unit, + real: real, + desc: desc, + timezone: timezone + } + ) + end + + # 프로젝트/가맹점 초대하기 + # Comment by Gosomi + # Date: 2022-01-13 + def member_invite(email:, level:, app_id: nil, invite_type:, provider_id: nil) + request( + uri: 'reseller/invite', + payload: { + email: email, + level: level, + app_id: app_id, + provider_id: provider_id, + invite_type: invite_type + } + ) + end + end +end \ No newline at end of file diff --git a/lib/bootpay/concern/subscription.rb b/lib/bootpay/concern/subscription.rb index 9fdd764..a5be224 100644 --- a/lib/bootpay/concern/subscription.rb +++ b/lib/bootpay/concern/subscription.rb @@ -48,7 +48,7 @@ def destroy_billing_key(billing_key) # Comment by Gosomi # Date: 2021-11-04 def request_subscribe_billing_key(pg:, order_name:, subscription_id:, card_no:, card_pw:, - card_identity_no:, card_expire_year:, card_expire_month:, extra: {}, user: {}, return_parameters: {}) + card_identity_no:, card_expire_year:, card_expire_month:, extra: {}, user: {}, metadata: {}) request( uri: 'request/subscribe', payload: { @@ -62,7 +62,7 @@ def request_subscribe_billing_key(pg:, order_name:, subscription_id:, card_no:, card_expire_month: card_expire_month, extra: extra, user: user, - return_parameters: return_parameters + metadata: metadata } ) end diff --git a/spec/bootpay/billing_key_spec.rb b/spec/bootpay/billing_key_spec.rb index ef81cd7..b00b2c2 100644 --- a/spec/bootpay/billing_key_spec.rb +++ b/spec/bootpay/billing_key_spec.rb @@ -9,7 +9,7 @@ ) if api.request_access_token.success? response = api.subscribe_billing_key( - "61973fa11fc19202e1f4cb8a" + "61df7f541fc192039249ca59" ) print response.data.to_json end diff --git a/spec/bootpay/reseller_create_seller_app_spec.rb b/spec/bootpay/reseller_create_seller_app_spec.rb new file mode 100644 index 0000000..d04c38c --- /dev/null +++ b/spec/bootpay/reseller_create_seller_app_spec.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +RSpec.describe Bootpay::RestClient do + it "create seller app" do + api = Bootpay::RestClient.new( + application_id: '61d4d60b367997009490429d', + private_key: 'USsMUaEBBb66H+g6r8z5ZZaWECnrldhszGWiNRfVjdU=', + mode: 'development' + ) + r = api.request_access_token + if r.success? + response = api.create_seller_app( + provider_id: '61d7828e1fc19202e52d1865', + name: '생성된 봇 앱2' + ) + print response.data.to_json + else + print r.data.to_json + end + end +end diff --git a/spec/bootpay/reseller_create_seller_spec.rb b/spec/bootpay/reseller_create_seller_spec.rb new file mode 100644 index 0000000..e645447 --- /dev/null +++ b/spec/bootpay/reseller_create_seller_spec.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +RSpec.describe Bootpay::RestClient do + it "create seller start" do + api = Bootpay::RestClient.new( + application_id: '61d4d60b367997009490429d', + private_key: 'USsMUaEBBb66H+g6r8z5ZZaWECnrldhszGWiNRfVjdU=', + mode: 'development' + ) + r = api.request_access_token + if r.success? + response = api.create_seller( + company_alias: '회사 Alias', + company_name: '회사명', + email: 'gosomi@bootpay.com' + ) + print response.data.to_json + else + print r.data.to_json + end + end +end diff --git a/spec/bootpay/reseller_member_invite_spec.rb b/spec/bootpay/reseller_member_invite_spec.rb new file mode 100644 index 0000000..9888e2e --- /dev/null +++ b/spec/bootpay/reseller_member_invite_spec.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +RSpec.describe Bootpay::RestClient do + it "member invite" do + api = Bootpay::RestClient.new( + application_id: '61d4d60b367997009490429d', + private_key: 'USsMUaEBBb66H+g6r8z5ZZaWECnrldhszGWiNRfVjdU=', + mode: 'development' + ) + r = api.request_access_token + if r.success? + # response = api.member_invite( + # email: 'aqure84@naver.com', + # app_id: '61dfbccf1fc192039249ca6b', + # level: '관리자', + # invite_type: '프로젝트' + # ) + response = api.member_invite( + email: 'gosomi@bootpay.co.kr', + provider_id: '61d7828e1fc19202e52d1865', + level: '관리자', + invite_type: '팀' + ) + print response.data.to_json + else + print r.data.to_json + end + end +end diff --git a/spec/bootpay/subscribe_card_payment_spec.rb b/spec/bootpay/subscribe_card_payment_spec.rb index 4458929..f16f14a 100644 --- a/spec/bootpay/subscribe_card_payment_spec.rb +++ b/spec/bootpay/subscribe_card_payment_spec.rb @@ -9,7 +9,7 @@ ) if api.request_access_token.success? response = api.request_subscribe_card_payment( - billing_key: '61a888681fc192030b093909', + billing_key: '61df7f551fc192039249ca5c', order_name: '테스트결제', price: 1000, card_quota: '00', From 80cb453eb7915c72ff38ddfe715daebc32d00b3e Mon Sep 17 00:00:00 2001 From: gosomi Date: Thu, 3 Feb 2022 17:56:21 +0900 Subject: [PATCH 022/133] =?UTF-8?q?user=5Ftoken=20=EC=9A=94=EC=B2=AD=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay/concern/user_token.rb | 23 +++++++++++++++++++++++ spec/bootpay/request_user_token_spec.rb | 17 +++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 lib/bootpay/concern/user_token.rb create mode 100644 spec/bootpay/request_user_token_spec.rb diff --git a/lib/bootpay/concern/user_token.rb b/lib/bootpay/concern/user_token.rb new file mode 100644 index 0000000..e942490 --- /dev/null +++ b/lib/bootpay/concern/user_token.rb @@ -0,0 +1,23 @@ +module Bootpay::Concern::UserToken + extend ActiveSupport::Concern + + included do + # User Token 정보를 가져온다 + # Comment by Gosomi + # Date: 2022-02-03 + def request_user_token(user_id:, email: nil, name: nil, gender: -1, birth: nil, phone: nil) + request( + method: :post, + uri: 'request/user/token', + payload: { + user_id: user_id, + email: email, + name: name, + gender: gender, + birth: birth, + phone: phone + } + ) + end + end +end \ No newline at end of file diff --git a/spec/bootpay/request_user_token_spec.rb b/spec/bootpay/request_user_token_spec.rb new file mode 100644 index 0000000..df3b69a --- /dev/null +++ b/spec/bootpay/request_user_token_spec.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +RSpec.describe Bootpay::RestClient do + it "request user token" do + api = Bootpay::RestClient.new( + application_id: '59bfc738e13f337dbd6ca48a', + private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', + mode: 'development' + ) + if api.request_access_token.success? + response = api.request_user_token( + user_id: 'gosomi1' + ) + print response.data.to_json + end + end +end From f00c5ab915728a8a44ed90811a3a6967a1601424 Mon Sep 17 00:00:00 2001 From: gosomi Date: Tue, 8 Feb 2022 11:27:59 +0900 Subject: [PATCH 023/133] =?UTF-8?q?username=EC=9C=BC=EB=A1=9C=20=ED=82=A4?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay/concern/user_token.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/bootpay/concern/user_token.rb b/lib/bootpay/concern/user_token.rb index e942490..e371ced 100644 --- a/lib/bootpay/concern/user_token.rb +++ b/lib/bootpay/concern/user_token.rb @@ -5,17 +5,17 @@ module Bootpay::Concern::UserToken # User Token 정보를 가져온다 # Comment by Gosomi # Date: 2022-02-03 - def request_user_token(user_id:, email: nil, name: nil, gender: -1, birth: nil, phone: nil) + def request_user_token(user_id:, email: nil, username: nil, gender: -1, birth: nil, phone: nil) request( method: :post, uri: 'request/user/token', payload: { - user_id: user_id, - email: email, - name: name, - gender: gender, - birth: birth, - phone: phone + user_id: user_id, + email: email, + username: username, + gender: gender, + birth: birth, + phone: phone } ) end From a4510add618c4390e52ca7fbe0e3900db511983b Mon Sep 17 00:00:00 2001 From: gosomi Date: Fri, 11 Feb 2022 15:57:52 +0900 Subject: [PATCH 024/133] =?UTF-8?q?=EA=B0=84=ED=8E=B8=EA=B2=B0=EC=A0=9C=20?= =?UTF-8?q?=EB=A1=9C=EC=A7=81=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay/concern.rb | 2 ++ lib/bootpay/concern/easy.rb | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 lib/bootpay/concern/easy.rb diff --git a/lib/bootpay/concern.rb b/lib/bootpay/concern.rb index cee889f..a232e78 100644 --- a/lib/bootpay/concern.rb +++ b/lib/bootpay/concern.rb @@ -2,6 +2,7 @@ module Bootpay module Concern require_relative 'concern/authenticate' require_relative 'concern/cash_receipt' + require_relative 'concern/easy' require_relative 'concern/escrow' require_relative 'concern/payment' require_relative 'concern/reseller' @@ -13,6 +14,7 @@ module Concern include Authenticate include CashReceipt + include Easy include Escrow include Payment include Reseller diff --git a/lib/bootpay/concern/easy.rb b/lib/bootpay/concern/easy.rb new file mode 100644 index 0000000..980e635 --- /dev/null +++ b/lib/bootpay/concern/easy.rb @@ -0,0 +1,18 @@ +module Bootpay::Concern::CashReceipt + extend ActiveSupport::Concern + + included do + # 간편결제 subscribe + # Comment by Gosomi + # Date: 2022-02-11 + def subscribe_on_easy(receipt_id:, billing_key:) + request( + uri: 'subscribe/easy', + payload: { + receipt_id: receipt_id, + billing_key: billing_key + } + ) + end + end +end \ No newline at end of file From 9ee080f773f9fbbffefdb8e5e6690ba6c7599219 Mon Sep 17 00:00:00 2001 From: gosomi Date: Fri, 11 Feb 2022 16:18:40 +0900 Subject: [PATCH 025/133] =?UTF-8?q?=EB=B2=84=EA=B7=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay/concern/easy.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bootpay/concern/easy.rb b/lib/bootpay/concern/easy.rb index 980e635..e477644 100644 --- a/lib/bootpay/concern/easy.rb +++ b/lib/bootpay/concern/easy.rb @@ -1,4 +1,4 @@ -module Bootpay::Concern::CashReceipt +module Bootpay::Concern::Easy extend ActiveSupport::Concern included do From 133b866c179b817684e0ea433de3604b64aa7238 Mon Sep 17 00:00:00 2001 From: gosomi Date: Fri, 11 Feb 2022 18:27:47 +0900 Subject: [PATCH 026/133] =?UTF-8?q?gitignore=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 8f35358..de71961 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,5 @@ *.idea *.iml Gemfile.lock -/spec/bootpay/request_rest_billing_key_spec.rb \ No newline at end of file +/spec/bootpay/request_rest_billing_key_spec.rb +.DS_Store \ No newline at end of file From 2ade3ca44655c3d385ae987adf4523a766684004 Mon Sep 17 00:00:00 2001 From: gosomi Date: Tue, 12 Apr 2022 14:28:33 +0900 Subject: [PATCH 027/133] =?UTF-8?q?=EB=B0=B0=ED=8F=AC=EC=A0=84=20=EC=97=85?= =?UTF-8?q?=EB=8D=B0=EC=9D=B4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay/concern.rb | 2 ++ lib/bootpay/concern/sdk.rb | 36 +++++++++++++++++++++ lib/bootpay/concern/subscription.rb | 4 ++- spec/bootpay/billing_key_spec.rb | 2 +- spec/bootpay/cancel_spec.rb | 2 +- spec/bootpay/certificate_spec.rb | 2 +- spec/bootpay/destroy_billing_key_spec.rb | 2 +- spec/bootpay/request_token_spec.rb | 4 +-- spec/bootpay/sdk_regist_biometric_spec.rb | 26 +++++++++++++++ spec/bootpay/sdk_wallet_spec.rb | 21 ++++++++++++ spec/bootpay/subscribe_card_payment_spec.rb | 6 ++-- 11 files changed, 98 insertions(+), 9 deletions(-) create mode 100644 lib/bootpay/concern/sdk.rb create mode 100644 spec/bootpay/sdk_regist_biometric_spec.rb create mode 100644 spec/bootpay/sdk_wallet_spec.rb diff --git a/lib/bootpay/concern.rb b/lib/bootpay/concern.rb index a232e78..6887d06 100644 --- a/lib/bootpay/concern.rb +++ b/lib/bootpay/concern.rb @@ -7,6 +7,7 @@ module Concern require_relative 'concern/payment' require_relative 'concern/reseller' require_relative 'concern/rest' + require_relative 'concern/sdk' require_relative 'concern/subscription' require_relative 'concern/token' require_relative 'concern/user_token' @@ -19,6 +20,7 @@ module Concern include Payment include Reseller include Rest + include Sdk include Subscription include Token include UserToken diff --git a/lib/bootpay/concern/sdk.rb b/lib/bootpay/concern/sdk.rb new file mode 100644 index 0000000..4eaf424 --- /dev/null +++ b/lib/bootpay/concern/sdk.rb @@ -0,0 +1,36 @@ +module Bootpay::Concern::Sdk + extend ActiveSupport::Concern + + included do + # 현재 등록된 지갑 정보를 가져온다 + # Comment by Gosomi + # Date: 2022-02-21 + def wallets(user_token) + request( + method: :get, + uri: "sdk/easy/wallet", + headers: { + 'Bootpay-User-Token': user_token + } + ) + end + + # Biometric Authenticate + # Comment by Gosomi + # Date: 2022-02-21 + def regist_biometric_authenticate(os:, token:, user_token:, uuid:) + request( + method: :post, + uri: 'sdk/easy/biometric', + headers: { + 'Bootpay-User-Token': user_token, + 'Bootpay-Device-UUID': uuid + }, + payload: { + os: os, + token: token + } + ) + end + end +end \ No newline at end of file diff --git a/lib/bootpay/concern/subscription.rb b/lib/bootpay/concern/subscription.rb index a5be224..e08e747 100644 --- a/lib/bootpay/concern/subscription.rb +++ b/lib/bootpay/concern/subscription.rb @@ -47,7 +47,7 @@ def destroy_billing_key(billing_key) # 빌링키를 REST # Comment by Gosomi # Date: 2021-11-04 - def request_subscribe_billing_key(pg:, order_name:, subscription_id:, card_no:, card_pw:, + def request_subscribe_billing_key(pg:, order_name:, price: nil, tax_free: nil, subscription_id:, card_no:, card_pw:, card_identity_no:, card_expire_year:, card_expire_month:, extra: {}, user: {}, metadata: {}) request( uri: 'request/subscribe', @@ -55,6 +55,8 @@ def request_subscribe_billing_key(pg:, order_name:, subscription_id:, card_no:, pg: pg, order_name: order_name, subscription_id: subscription_id, + price: price, + tax_free: tax_free, card_no: card_no, card_pw: card_pw, card_identity_no: card_identity_no, diff --git a/spec/bootpay/billing_key_spec.rb b/spec/bootpay/billing_key_spec.rb index b00b2c2..1576da9 100644 --- a/spec/bootpay/billing_key_spec.rb +++ b/spec/bootpay/billing_key_spec.rb @@ -9,7 +9,7 @@ ) if api.request_access_token.success? response = api.subscribe_billing_key( - "61df7f541fc192039249ca59" + "624e4f7c1fc19202e4746f91" ) print response.data.to_json end diff --git a/spec/bootpay/cancel_spec.rb b/spec/bootpay/cancel_spec.rb index c2df6be..891f5b1 100644 --- a/spec/bootpay/cancel_spec.rb +++ b/spec/bootpay/cancel_spec.rb @@ -9,7 +9,7 @@ ) if api.request_access_token.success? response = api.cancel_payment( - receipt_id: "61baf7e81fc1920311e08106", + receipt_id: "624a56111fc19202e4746df2", cancel_price: 1000, cancel_username: 'test_user', cancel_message: 'test_message', diff --git a/spec/bootpay/certificate_spec.rb b/spec/bootpay/certificate_spec.rb index 6095d1c..b0a4982 100644 --- a/spec/bootpay/certificate_spec.rb +++ b/spec/bootpay/certificate_spec.rb @@ -9,7 +9,7 @@ ) if api.request_access_token.success? response = api.certificate( - "61b040ec1fc19203129abd60" + "624d2e531fc19202e4746f40" ) print response.data.to_json end diff --git a/spec/bootpay/destroy_billing_key_spec.rb b/spec/bootpay/destroy_billing_key_spec.rb index 05dae8e..a68c370 100644 --- a/spec/bootpay/destroy_billing_key_spec.rb +++ b/spec/bootpay/destroy_billing_key_spec.rb @@ -9,7 +9,7 @@ ) if api.request_access_token.success? response = api.destroy_billing_key( - '61a8879d1fc192030b0938fe' + '6209e85b1fc19203127651cf' ) print response.data.to_json end diff --git a/spec/bootpay/request_token_spec.rb b/spec/bootpay/request_token_spec.rb index 0b456d2..0f1c35e 100644 --- a/spec/bootpay/request_token_spec.rb +++ b/spec/bootpay/request_token_spec.rb @@ -5,9 +5,9 @@ api = Bootpay::RestClient.new( application_id: '59bfc738e13f337dbd6ca48a', private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', - mode: 'development' + # mode: 'development' ) response = api.request_access_token - print response.data + print response.data.to_json end end diff --git a/spec/bootpay/sdk_regist_biometric_spec.rb b/spec/bootpay/sdk_regist_biometric_spec.rb new file mode 100644 index 0000000..2b820c1 --- /dev/null +++ b/spec/bootpay/sdk_regist_biometric_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +RSpec.describe Bootpay::RestClient do + it "regist biometic" do + api = Bootpay::RestClient.new( + application_id: '59bfc738e13f337dbd6ca48a', + private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', + mode: 'development' + ) + if api.request_access_token.success? + response = api.request_user_token( + user_id: 'gosomi1' + ) + user_token = response.data[:user_token] + if response.success? + response = api.regist_biometric_authenticate( + user_token: user_token, + os: 'ios', + token: '621330b613612600925627b2', + uuid: 'test-uuid' + ) + print response.data.to_json + end + end + end +end diff --git a/spec/bootpay/sdk_wallet_spec.rb b/spec/bootpay/sdk_wallet_spec.rb new file mode 100644 index 0000000..2a6f412 --- /dev/null +++ b/spec/bootpay/sdk_wallet_spec.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +RSpec.describe Bootpay::RestClient do + it "get wallets" do + api = Bootpay::RestClient.new( + application_id: '59bfc738e13f337dbd6ca48a', + private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', + mode: 'development' + ) + if api.request_access_token.success? + response = api.request_user_token( + user_id: 'gosomi1' + ) + user_token = response.data[:user_token] + if response.success? + response = api.wallets(user_token) + print response.data.to_json + end + end + end +end diff --git a/spec/bootpay/subscribe_card_payment_spec.rb b/spec/bootpay/subscribe_card_payment_spec.rb index f16f14a..ad76e88 100644 --- a/spec/bootpay/subscribe_card_payment_spec.rb +++ b/spec/bootpay/subscribe_card_payment_spec.rb @@ -9,13 +9,15 @@ ) if api.request_access_token.success? response = api.request_subscribe_card_payment( - billing_key: '61df7f551fc192039249ca5c', + billing_key: '623028630e019e036fe98478', order_name: '테스트결제', price: 1000, card_quota: '00', order_id: Time.current.to_i, user: { - phone: '01000000000' + phone: '01000000000', + username: '홍길동', + email: 'test@bootpay.co.kr' } ) print response.data.to_json From 3ca894b601a8e118ef4455f071ffbb21fd716dc6 Mon Sep 17 00:00:00 2001 From: gosomi Date: Tue, 12 Apr 2022 14:36:30 +0900 Subject: [PATCH 028/133] =?UTF-8?q?=ED=8C=A8=ED=82=A4=EC=A7=80=EB=AA=85=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...rest-client-ruby.gemspec => bootpay-backend-ruby.gemspec | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename bootpay-rest-client-ruby.gemspec => bootpay-backend-ruby.gemspec (82%) diff --git a/bootpay-rest-client-ruby.gemspec b/bootpay-backend-ruby.gemspec similarity index 82% rename from bootpay-rest-client-ruby.gemspec rename to bootpay-backend-ruby.gemspec index f874511..6016617 100644 --- a/bootpay-rest-client-ruby.gemspec +++ b/bootpay-backend-ruby.gemspec @@ -3,13 +3,13 @@ require_relative "lib/bootpay/version" Gem::Specification.new do |spec| - spec.name = "bootpay-rest-client-ruby" + spec.name = "bootpay-backend-ruby" spec.version = Bootpay::V2_VERSION spec.authors = ["gosomi"] spec.email = ["gosomi@bootpay.co.kr"] - spec.summary = "Bootpay Rest Client Version 2.0" - spec.description = "Bootpay Rest Client Version 2.0용입니다." + spec.summary = "Bootpay Ruby REST Client" + spec.description = "Bootpay REST API / Search One Receipt or Cancel Payment, Subscription Payment on REST API." spec.license = "MIT" # Specify which files should be added to the gem when it is released. # The `git ls-files -z` loads the files in the RubyGem that have been added into git. From cef3dee5a8c296ce4b2f794780cc87980e45a578 Mon Sep 17 00:00:00 2001 From: gosomi Date: Tue, 12 Apr 2022 14:37:37 +0900 Subject: [PATCH 029/133] =?UTF-8?q?=ED=8C=A8=ED=82=A4=EC=A7=80=EB=AA=85=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 97787ba..2c8bc92 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # Bootpay::Rest::Client -Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/bootpay/rest/client`. To experiment with that code, run `bin/console` for an interactive prompt. +Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library +into a gem. Put your Ruby code in the file `lib/bootpay/rest/client`. To experiment with that code, run `bin/console` +for an interactive prompt. TODO: Delete this and the text above, and describe your gem @@ -9,7 +11,7 @@ TODO: Delete this and the text above, and describe your gem Add this line to your application's Gemfile: ```ruby -gem 'bootpay-rest-client' +gem 'bootpay-backend-ruby' ``` And then execute: @@ -18,7 +20,7 @@ And then execute: Or install it yourself as: - $ gem install bootpay-rest-client + $ gem install bootpay-backend-ruby ## Usage @@ -26,13 +28,18 @@ TODO: Write usage instructions here ## Development -After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. +After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can +also run `bin/console` for an interactive prompt that will allow you to experiment. -To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org). +To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the +version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, +push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org). ## Contributing -Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/bootpay-rest-client. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/bootpay-rest-client/blob/master/CODE_OF_CONDUCT.md). +Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/bootpay-rest-client. This project +is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to +the [code of conduct](https://github.com/[USERNAME]/bootpay-rest-client/blob/master/CODE_OF_CONDUCT.md). ## License @@ -40,4 +47,6 @@ The gem is available as open source under the terms of the [MIT License](https:/ ## Code of Conduct -Everyone interacting in the Bootpay::Rest::Client project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/bootpay-rest-client/blob/master/CODE_OF_CONDUCT.md). +Everyone interacting in the Bootpay::Rest::Client project's codebases, issue trackers, chat rooms and mailing lists is +expected to follow +the [code of conduct](https://github.com/[USERNAME]/bootpay-rest-client/blob/master/CODE_OF_CONDUCT.md). From 4ebbb15d4e6fe82fb8a52ef6a35922029680eadc Mon Sep 17 00:00:00 2001 From: gosomi Date: Thu, 14 Apr 2022 14:23:56 +0900 Subject: [PATCH 030/133] =?UTF-8?q?=ED=8C=8C=EC=9D=BC=EB=AA=85=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/{bootpay-rest-client-ruby.rb => bootpay-backend-ruby.rb} | 0 lib/bootpay/concern/subscription.rb | 2 +- spec/bootpay/billing_key_spec.rb | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename lib/{bootpay-rest-client-ruby.rb => bootpay-backend-ruby.rb} (100%) diff --git a/lib/bootpay-rest-client-ruby.rb b/lib/bootpay-backend-ruby.rb similarity index 100% rename from lib/bootpay-rest-client-ruby.rb rename to lib/bootpay-backend-ruby.rb diff --git a/lib/bootpay/concern/subscription.rb b/lib/bootpay/concern/subscription.rb index e08e747..ed828da 100644 --- a/lib/bootpay/concern/subscription.rb +++ b/lib/bootpay/concern/subscription.rb @@ -5,7 +5,7 @@ module Bootpay::Concern::Subscription # 빌링키 결제 데이터 가져오기 # Comment by Gosomi # Date: 2021-11-01 - def subscribe_billing_key(receipt_id) + def lookup_subscribe_billing_key(receipt_id) request( method: :get, uri: "subscribe/billing_key/#{receipt_id}" diff --git a/spec/bootpay/billing_key_spec.rb b/spec/bootpay/billing_key_spec.rb index 1576da9..bcd42ac 100644 --- a/spec/bootpay/billing_key_spec.rb +++ b/spec/bootpay/billing_key_spec.rb @@ -8,7 +8,7 @@ mode: 'development' ) if api.request_access_token.success? - response = api.subscribe_billing_key( + response = api.lookup_subscribe_billing_key( "624e4f7c1fc19202e4746f91" ) print response.data.to_json From 27c400886be4b209924d2c7f516b03b1167c35f3 Mon Sep 17 00:00:00 2001 From: gosomi Date: Fri, 6 May 2022 14:51:03 +0900 Subject: [PATCH 031/133] =?UTF-8?q?=EC=9E=90=EB=8F=99=EA=B2=B0=EC=A0=9C=20?= =?UTF-8?q?=EC=98=88=EC=95=BD=20=EC=B7=A8=EC=86=8C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay/concern/subscription.rb | 33 +++++++++++++++++++ spec/bootpay/cancel_subscribe_reserve_spec.rb | 31 +++++++++++++++++ spec/bootpay/destroy_billing_key_spec.rb | 2 +- .../bootpay/subscribe_payment_reserve_spec.rb | 26 +++++++++++++++ spec/spec_helper.rb | 2 +- 5 files changed, 92 insertions(+), 2 deletions(-) create mode 100644 spec/bootpay/cancel_subscribe_reserve_spec.rb create mode 100644 spec/bootpay/subscribe_payment_reserve_spec.rb diff --git a/lib/bootpay/concern/subscription.rb b/lib/bootpay/concern/subscription.rb index ed828da..f6ca332 100644 --- a/lib/bootpay/concern/subscription.rb +++ b/lib/bootpay/concern/subscription.rb @@ -34,6 +34,39 @@ def request_subscribe_card_payment(billing_key:, order_name:, price:, tax_free: ) end + # 자동결제 예약 + # Comment by Gosomi + # Date: 2022-04-21 + def subscribe_payment_reserve(billing_key:, reserve_execute_at:, order_name:, price:, tax_free: 0, items: nil, order_id:, + metadata: {}, user: nil, feedback_url: nil, content_type: nil) + request( + uri: 'subscribe/payment/reserve', + payload: { + billing_key: billing_key, + reserve_execute_at: reserve_execute_at, + order_name: order_name, + order_id: order_id, + metadata: metadata, + price: price, + tax_free: tax_free, + items: items, + user: user, + feedback_url: feedback_url, + content_type: content_type + } + ) + end + + # 자동결제 예약 취소 + # Comment by Gosomi + # Date: 2022-04-21 + def cancel_subscribe_reserve(reserve_id) + request( + method: :delete, + uri: "subscribe/payment/reserve/#{reserve_id}" + ) + end + # 빌링키를 강제로 만료한다 # Comment by Gosomi # Date: 2021-11-04 diff --git a/spec/bootpay/cancel_subscribe_reserve_spec.rb b/spec/bootpay/cancel_subscribe_reserve_spec.rb new file mode 100644 index 0000000..edb3b58 --- /dev/null +++ b/spec/bootpay/cancel_subscribe_reserve_spec.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +RSpec.describe Bootpay::RestClient do + it "cancel subscribe reserve" do + api = Bootpay::RestClient.new( + application_id: '59bfc738e13f337dbd6ca48a', + private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', + mode: 'development' + ) + if api.request_access_token.success? + response = api.subscribe_payment_reserve( + billing_key: '623028630e019e036fe98478', + order_name: '테스트결제', + price: 1000, + order_id: Time.current.to_i, + user: { + phone: '01000000000', + username: '홍길동', + email: 'test@bootpay.co.kr' + }, + reserve_execute_at: (Time.current + 5.seconds).iso8601 + ) + puts response.data.to_json + if response.success? + puts "cancel reserve_id: #{response.data[:reserve_id]}" + cancel = api.cancel_subscribe_reserve(response.data[:reserve_id]) + puts cancel.data.to_json + end + end + end +end diff --git a/spec/bootpay/destroy_billing_key_spec.rb b/spec/bootpay/destroy_billing_key_spec.rb index a68c370..46903d0 100644 --- a/spec/bootpay/destroy_billing_key_spec.rb +++ b/spec/bootpay/destroy_billing_key_spec.rb @@ -9,7 +9,7 @@ ) if api.request_access_token.success? response = api.destroy_billing_key( - '6209e85b1fc19203127651cf' + '6257bafb1fc19202e47471f7:' ) print response.data.to_json end diff --git a/spec/bootpay/subscribe_payment_reserve_spec.rb b/spec/bootpay/subscribe_payment_reserve_spec.rb new file mode 100644 index 0000000..79d9de3 --- /dev/null +++ b/spec/bootpay/subscribe_payment_reserve_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +RSpec.describe Bootpay::RestClient do + it "billing key" do + api = Bootpay::RestClient.new( + application_id: '59bfc738e13f337dbd6ca48a', + private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', + mode: 'development' + ) + if api.request_access_token.success? + response = api.subscribe_payment_reserve( + billing_key: '6271d5431fc19202e5ef1fcd', + order_name: '테스트결제', + price: 1000, + order_id: Time.current.to_i, + user: { + phone: '01000000000', + username: '홍길동', + email: 'test@bootpay.co.kr' + }, + reserve_execute_at: (Time.current + 5.seconds).iso8601 + ) + print response.data.to_json + end + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 0207aca..b43ecdf 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require "bootpay-rest-client-ruby" +require "bootpay-backend-ruby" RSpec.configure do |config| # Enable flags like --only-failures and --next-failure From ab21fa7194226dd0316c01e3e0ab5e7a79f233ed Mon Sep 17 00:00:00 2001 From: gosomi Date: Fri, 17 Jun 2022 11:31:25 +0900 Subject: [PATCH 032/133] =?UTF-8?q?=EC=B7=A8=EC=86=8C=EC=8B=9C=20tax=20fre?= =?UTF-8?q?e=20=EB=B2=84=EA=B7=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay/concern/escrow.rb | 5 +++-- lib/bootpay/concern/payment.rb | 2 +- spec/bootpay/cancel_cash_receipt_spec.rb | 2 +- spec/bootpay/cancel_spec.rb | 9 +-------- spec/bootpay/receipt_payment_spec.rb | 2 +- spec/bootpay/request_cash_receipt_spec.rb | 4 ++-- spec/bootpay/shipping_start_spec.rb | 2 +- spec/bootpay/subscribe_card_payment_spec.rb | 2 +- spec/bootpay/subscribe_payment_reserve_spec.rb | 9 +++++++-- 9 files changed, 18 insertions(+), 19 deletions(-) diff --git a/lib/bootpay/concern/escrow.rb b/lib/bootpay/concern/escrow.rb index ce6c7e7..0627389 100644 --- a/lib/bootpay/concern/escrow.rb +++ b/lib/bootpay/concern/escrow.rb @@ -6,7 +6,7 @@ module Bootpay::Concern::Escrow # Comment by Gosomi # Date: 2021-12-14 def shipping_start(receipt_id:, tracking_number:, delivery_corp:, shipping_prepayment: true, - shipping_day: 5, user: nil) + shipping_day: 5, user: nil, company: {}) request( method: :put, uri: "escrow/shipping/start/#{receipt_id}", @@ -15,7 +15,8 @@ def shipping_start(receipt_id:, tracking_number:, delivery_corp:, shipping_prepa delivery_corp: delivery_corp, shipping_prepayment: shipping_prepayment, shipping_day: shipping_day, - user: user + user: user, + company: company } ) end diff --git a/lib/bootpay/concern/payment.rb b/lib/bootpay/concern/payment.rb index 45af37c..4dc3ea0 100644 --- a/lib/bootpay/concern/payment.rb +++ b/lib/bootpay/concern/payment.rb @@ -27,7 +27,7 @@ def confirm_payment(receipt_id) # 결제 취소 요청 # Comment by Gosomi # Date: 2021-05-21 - def cancel_payment(cancel_id: nil, receipt_id:, cancel_price: nil, cancel_tax_free: 0, cancel_username: '시스템', cancel_message: '결제취소', + def cancel_payment(cancel_id: nil, receipt_id:, cancel_price: nil, cancel_tax_free: nil, cancel_username: '시스템', cancel_message: '결제취소', refund: { bank_account: nil, bank_username: nil, bank_code: nil }, items: nil) request( uri: 'cancel', diff --git a/spec/bootpay/cancel_cash_receipt_spec.rb b/spec/bootpay/cancel_cash_receipt_spec.rb index 8fd5fa7..c577968 100644 --- a/spec/bootpay/cancel_cash_receipt_spec.rb +++ b/spec/bootpay/cancel_cash_receipt_spec.rb @@ -9,7 +9,7 @@ ) if api.request_access_token.success? response = api.cancel_cash_receipt( - receipt_id: '61baf1d91fc1920311e080c4', + receipt_id: '62983c341fc19202e97e16e5', cancel_username: 'test', cancel_message: 'test 취소' ) diff --git a/spec/bootpay/cancel_spec.rb b/spec/bootpay/cancel_spec.rb index 891f5b1..0a82cfc 100644 --- a/spec/bootpay/cancel_spec.rb +++ b/spec/bootpay/cancel_spec.rb @@ -13,14 +13,7 @@ cancel_price: 1000, cancel_username: 'test_user', cancel_message: 'test_message', - # items: [ - # { - # id: 'test_1', - # name: '테스트 아이템2', - # price: 500, - # qty: 1 - # } - # ] + ) print response.data.to_json end diff --git a/spec/bootpay/receipt_payment_spec.rb b/spec/bootpay/receipt_payment_spec.rb index 2890d3f..caf309e 100644 --- a/spec/bootpay/receipt_payment_spec.rb +++ b/spec/bootpay/receipt_payment_spec.rb @@ -9,7 +9,7 @@ ) if api.request_access_token.success? response = api.receipt_payment( - "61b009aaec81b4057e7f6ecd" + "62a818cf1fc19203154a8f2e" ) print response.data.to_json end diff --git a/spec/bootpay/request_cash_receipt_spec.rb b/spec/bootpay/request_cash_receipt_spec.rb index b36dc5c..dd5a16a 100644 --- a/spec/bootpay/request_cash_receipt_spec.rb +++ b/spec/bootpay/request_cash_receipt_spec.rb @@ -9,10 +9,10 @@ ) if api.request_access_token.success? response = api.request_cash_receipt( - pg: '이니시스', + pg: '토스', price: 1000, tax_free: 0, - order_name: '테스트', + order_name: '테스트', cash_receipt_type: '소득공제', user: { username: '부트페이', diff --git a/spec/bootpay/shipping_start_spec.rb b/spec/bootpay/shipping_start_spec.rb index 15e6c8e..a61974d 100644 --- a/spec/bootpay/shipping_start_spec.rb +++ b/spec/bootpay/shipping_start_spec.rb @@ -9,7 +9,7 @@ ) if api.request_access_token.success? response = api.shipping_start( - receipt_id: "61b9410b1fc192030c746b61", + receipt_id: "62a818cf1fc19203154a8f2e", tracking_number: '123456', delivery_corp: 'CJ대한통운', user: { diff --git a/spec/bootpay/subscribe_card_payment_spec.rb b/spec/bootpay/subscribe_card_payment_spec.rb index ad76e88..14a843c 100644 --- a/spec/bootpay/subscribe_card_payment_spec.rb +++ b/spec/bootpay/subscribe_card_payment_spec.rb @@ -9,7 +9,7 @@ ) if api.request_access_token.success? response = api.request_subscribe_card_payment( - billing_key: '623028630e019e036fe98478', + billing_key: '6295cd1d1fc19202e4e319b0', order_name: '테스트결제', price: 1000, card_quota: '00', diff --git a/spec/bootpay/subscribe_payment_reserve_spec.rb b/spec/bootpay/subscribe_payment_reserve_spec.rb index 79d9de3..b069329 100644 --- a/spec/bootpay/subscribe_payment_reserve_spec.rb +++ b/spec/bootpay/subscribe_payment_reserve_spec.rb @@ -7,9 +7,14 @@ private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', mode: 'development' ) + # api = Bootpay::RestClient.new( + # application_id: '59b731f084382614ebf72215', + # private_key: 'WwDv0UjfwFa04wYG0LJZZv1xwraQnlhnHE375n52X0U=' + # ) if api.request_access_token.success? response = api.subscribe_payment_reserve( - billing_key: '6271d5431fc19202e5ef1fcd', + # billing_key: '62820fa61fc19202e5ef240e', + billing_key: '628c0d0d1fc19202e5ef2866', order_name: '테스트결제', price: 1000, order_id: Time.current.to_i, @@ -18,7 +23,7 @@ username: '홍길동', email: 'test@bootpay.co.kr' }, - reserve_execute_at: (Time.current + 5.seconds).iso8601 + reserve_execute_at: (Time.current + 30.seconds).iso8601 ) print response.data.to_json end From b3771355d1a7896d4944bc47feb590e7456297cd Mon Sep 17 00:00:00 2001 From: ehowlsla Date: Wed, 22 Jun 2022 14:30:12 +0900 Subject: [PATCH 033/133] readme update --- CHANGELOG.md | 2 + README.md | 325 ++++++++++++++++-- bootpay-backend-ruby-2.0.0.gem | Bin 0 -> 12800 bytes lib/bootpay/concern/subscription.rb | 4 +- .../bootpay/subscribe_payment_reserve_spec.rb | 4 - 5 files changed, 300 insertions(+), 35 deletions(-) create mode 100644 CHANGELOG.md create mode 100644 bootpay-backend-ruby-2.0.0.gem diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..a2eafc9 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,2 @@ +### 2.0.0 +- v1 -> v2 update \ No newline at end of file diff --git a/README.md b/README.md index 2c8bc92..47798af 100644 --- a/README.md +++ b/README.md @@ -1,52 +1,319 @@ -# Bootpay::Rest::Client +# Bootpay Ruby Server Side Library -Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library -into a gem. Put your Ruby code in the file `lib/bootpay/rest/client`. To experiment with that code, run `bin/console` -for an interactive prompt. +부트페이 공식 Ruby 라이브러리 입니다 (서버사이드 용) -TODO: Delete this and the text above, and describe your gem +Ruby 언어로 작성된 어플리케이션, 프레임워크 등에서 사용가능합니다. -## Installation +* PG 결제창 연동은 클라이언트 라이브러리에서 수행됩니다. (Javascript, Android, iOS, React Native, Flutter 등) +* 결제 검증 및 취소, 빌링키 발급, 본인인증 등의 수행은 서버사이드에서 진행됩니다. (Java, PHP, Python, Ruby, Node.js, Go, ASP.NET 등) + + +## 기능 +1. (부트페이 통신을 위한) 토큰 발급 +2. 결제 단건 조회 +3. 결제 취소 (전액 취소 / 부분 취소) +4. 신용카드 자동결제 (빌링결제) + 4-1. 빌링키 발급 + 4-2. 발급된 빌링키로 결제 승인 요청 + 4-3. 발급된 빌링키로 결제 예약 요청 + 4-4. 발급된 빌링키로 결제 예약 - 취소 요청 + 4-5. 빌링키 삭제 + 4-6. 해당 결제건의 빌링키 조회 (빌링) +5. (생체인증, 비밀번호 결제를 위한) 구매자 토큰 발급 +6. 서버 승인 요청 +7. 본인 인증 결과 조회 + +## Gem으로 설치하기 -Add this line to your application's Gemfile: ```ruby gem 'bootpay-backend-ruby' ``` -And then execute: +Gemfile에 위 라인을 추가하고, 아래 라인으로 인스톨 합니다. +```ruby +$ bundle install +``` - $ bundle install -Or install it yourself as: +또는 아래 문장을 통해 바로 설치할 수 있습니다: +```ruby +$ gem install bootpay-backend-ruby +``` - $ gem install bootpay-backend-ruby +## 사용하기 -## Usage +```ruby -TODO: Write usage instructions here +require 'bootpay-backend-ruby' -## Development +@api = Bootpay::RestClient.new( + application_id: '5b8f6a4d396fa665fdc2b5ea', + private_key: 'rm6EYECr6aroQVG2ntW0A6LpWnkTgP4uQ3H18sDDUYw=', +) -After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can -also run `bin/console` for an interactive prompt that will allow you to experiment. +response = @api.request_access_token +if response.success? + puts response.data.to_json +end +``` +함수 단위의 샘플 코드는 [이곳](https://github.com/bootpay/backend-ruby/tree/2-x-development/spec/bootpay)을 참조하세요. -To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the -version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, -push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org). -## Contributing +## 1. (부트페이 통신을 위한) 토큰 발급 -Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/bootpay-rest-client. This project -is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to -the [code of conduct](https://github.com/[USERNAME]/bootpay-rest-client/blob/master/CODE_OF_CONDUCT.md). +부트페이와 서버간 통신을 하기 위해서는 부트페이 서버로부터 토큰을 발급받아야 합니다. +발급된 토큰은 30분간 유효하며, 최초 발급일로부터 30분이 지날 경우 토큰 발급 함수를 재호출 해주셔야 합니다. +```ruby +api = Bootpay::RestClient.new( + application_id: '59bfc738e13f337dbd6ca48a', + private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=' +) + +api.request_access_token.success? +``` -## License -The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT). +## 2. 결제 단건 조회 + 결제창 및 정기결제에서 승인/취소된 결제건에 대하여 올바른 결제건인지 서버간 통신으로 결제검증을 합니다. +```ruby +api = Bootpay::RestClient.new( + application_id: '59bfc738e13f337dbd6ca48a', + private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=' +) + +if api.request_access_token.success? + response = api.receipt_payment( + "62a818cf1fc19203154a8f2e" + ) + puts response.data.to_json +end +``` + + +## 3. 결제 취소 (전액 취소 / 부분 취소) +price를 지정하지 않으면 전액취소 됩니다. +* 휴대폰 결제의 경우 이월될 경우 이통사 정책상 취소되지 않습니다 +* 정산받으실 금액보다 취소금액이 클 경우 PG사 정책상 취소되지 않을 수 있습니다. 이때 PG사에 문의하시면 되겠습니다. +* 가상계좌의 경우 CMS 특약이 되어있지 않으면 취소되지 않습니다. 그러므로 결제 테스트시에는 가상계좌로 테스트 하지 않길 추천합니다. + +부분취는 카드로 결제된 건만 가능하며, 일부 PG사만 지원합니다. 요청시 price에 금액을 지정하시면 되겠습니다. +* (지원가능 PG사: 이니시스, kcp, 다날, 페이레터, 나이스페이, 카카오페이, 페이코) + +간혹 개발사에서 실수로 여러번 부분취소를 보내서 여러번 취소되는 경우가 있기때문에, 부트페이에서는 부분취소 중복 요청을 막기 위해 cancel_id 라는 필드를 추가했습니다. cancel_id를 지정하시면, 해당 건에 대해 중복 요청방지가 가능합니다. +```ruby +api = Bootpay::RestClient.new( + application_id: '59bfc738e13f337dbd6ca48a', + private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=' +) +if api.request_access_token.success? + response = api.cancel_payment( + receipt_id: "624a56111fc19202e4746df2", + cancel_price: 1000, + cancel_username: 'test_user', + cancel_message: 'test_message', + ) + puts response.data.to_json +end +``` + +## 4-1. 빌링키 발급 +REST API 방식으로 고객으로부터 카드 정보를 전달하여, PG사에게 빌링키를 발급받을 수 있습니다. +발급받은 빌링키를 저장하고 있다가, 원하는 시점, 원하는 금액에 결제 승인 요청하여 좀 더 자유로운 결제시나리오에 적용이 가능합니다. +* 비인증 정기결제(REST API) 방식을 지원하는 PG사만 사용 가능합니다. +```ruby +api = Bootpay::RestClient.new( + application_id: '59bfc738e13f337dbd6ca48a', + private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=' +) + +if api.request_access_token.success? + response = @api.request_subscribe_billing_key( + subscription_id: '1234', + pg: 'nicepay', + order_name: '테스트 결제', + card_no: '', # 값 할당 필요, 카드번호 + card_pw: '', # 값 할당 필요, 카드 비밀번호 2자리 + card_expire_year: '', # 값 할당 필요, 카드 유효기간 연도 2자리 + card_expire_month: '', # 값 할당 필요, 카드 유효기간 월 2자리 + card_identity_no: '' # 값 할당 필요, 카드 소유주 생년월일 + ) + puts response.data.to_json +end + +``` + +## 4-2. 발급된 빌링키로 결제 승인 요청 +발급된 빌링키로 원하는 시점에 원하는 금액으로 결제 승인 요청을 할 수 있습니다. 잔액이 부족하거나 도난 카드 등의 특별한 건이 아니면 PG사에서 결제를 바로 승인합니다. -## Code of Conduct +```ruby +api = Bootpay::RestClient.new( + application_id: '59bfc738e13f337dbd6ca48a', + private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=' +) +if api.request_access_token.success? + response = api.request_subscribe_card_payment( + billing_key: '6295cd1d1fc19202e4e319b0', + order_name: '테스트결제', + price: 1000, + card_quota: '00', + order_id: Time.current.to_i, + user: { + phone: '01000000000', + username: '홍길동', + email: 'test@bootpay.co.kr' + } + ) + puts response.data.to_json +end +``` +## 4-3. 발급된 빌링키로 결제 예약 요청 +원하는 시점에 4-1로 결제 승인 요청을 보내도 되지만, 빌링키 발급 이후에 바로 결제 예약 할 수 있습니다. (빌링키당 최대 5건) +```ruby +api = Bootpay::RestClient.new( + application_id: '59bfc738e13f337dbd6ca48a', + private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=' +) +if api.request_access_token.success? + response = api.subscribe_payment_reserve( + billing_key: '628c0d0d1fc19202e5ef2866', + order_name: '테스트결제', + price: 1000, + order_id: Time.current.to_i, + user: { + phone: '01000000000', + username: '홍길동', + email: 'test@bootpay.co.kr' + }, + reserve_execute_at: (Time.current + 30.seconds).iso8601 + ) + print response.data.to_json +end +``` +## 4-4. 발급된 빌링키로 결제 예약 - 취소 요청 +빌링키로 예약된 결제건을 취소합니다. +```ruby +api = Bootpay::RestClient.new( + application_id: '59bfc738e13f337dbd6ca48a', + private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=' +) +if api.request_access_token.success? + response = api.subscribe_payment_reserve( + billing_key: '623028630e019e036fe98478', + order_name: '테스트결제', + price: 1000, + order_id: Time.current.to_i, + user: { + phone: '01000000000', + username: '홍길동', + email: 'test@bootpay.co.kr' + }, + reserve_execute_at: (Time.current + 5.seconds).iso8601 + ) + puts response.data.to_json + if response.success? + puts "cancel reserve_id: #{response.data[:reserve_id]}" + cancel = api.cancel_subscribe_reserve(response.data[:reserve_id]) + puts cancel.data.to_json + end +end +``` +## 4-5. 빌링키 삭제 +발급된 빌링키로 더 이상 사용되지 않도록, 삭제 요청합니다. +```ruby +api = Bootpay::RestClient.new( + application_id: '59bfc738e13f337dbd6ca48a', + private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=' +) +if api.request_access_token.success? + response = api.destroy_billing_key( + '6257bafb1fc19202e47471f7:' + ) + print response.data.to_json +end +``` + +## 4-6. 해당 결제건의 빌링키 조회 (빌링) +```java +api = Bootpay::RestClient.new( + application_id: '59bfc738e13f337dbd6ca48a', + private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=' +) +if api.request_access_token.success? + response = api.lookup_subscribe_billing_key( + "624e4f7c1fc19202e4746f91" + ) + print response.data.to_json +end +``` + +## 5. (생체인증, 비밀번호 결제를 위한) 구매자 토큰 발급 +(부트페이 단독) 부트페이에서 제공하는 간편결제창, 생체인증 기반의 결제 사용을 위해서는 개발사에서 회원 고유번호를 관리해야하며, 해당 회원에 대한 사용자 토큰을 발급합니다. +이 토큰값을 기반으로 클라이언트에서 결제요청 하시면 되겠습니다. +```ruby +api = Bootpay::RestClient.new( + application_id: '59bfc738e13f337dbd6ca48a', + private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=' + ) +if api.request_access_token.success? + response = api.request_user_token( + user_id: 'gosomi1', + phone: '01012345678' + ) + print response.data.to_json +end +``` + +## 6. 서버 승인 요청 +결제승인 방식은 클라이언트 승인 방식과, 서버 승인 방식으로 총 2가지가 있습니다. + +클라이언트 승인 방식은 javascript나 native 등에서 confirm 함수에서 진행하는 일반적인 방법입니다만, 경우에 따라 서버 승인 방식이 필요할 수 있습니다. + +필요한 이유 +1. 100% 안정적인 결제 후 고객 안내를 위해 - 클라이언트에서 PG결제 진행 후 승인 완료될 때 onDone이 수행되지 않아 (인터넷 환경 등), 결제 이후 고객에게 안내하지 못할 수 있습니다 +2. 단일 트랜잭션의 개념이 필요할 경우 - 재고파악이 중요한 커머스를 운영할 경우 트랜잭션 개념이 필요할 수 있겠으며, 이를 위해서는 서버 승인을 사용해야 합니다. + +```ruby +api = Bootpay::RestClient.new( + application_id: '59bfc738e13f337dbd6ca48a', + private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=' +) +if api.request_access_token.success? + response = api.confirm_payment( + "61d3d41b1fc19202e483320b" + ) + print response.data.to_json +end +``` + +## 7. 본인 인증 결과 조회 +다날 본인인증 후 결과값을 조회합니다. +다날 본인인증에서 통신사, 외국인여부, 전화번호 이 3가지 정보는 다날에 추가로 요청하셔야 받으실 수 있습니다. +```ruby +api = Bootpay::RestClient.new( + application_id: '59bfc738e13f337dbd6ca48a', + private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=' +) +if api.request_access_token.success? + response = api.certificate( + "624d2e531fc19202e4746f40" + ) + print response.data.to_json +end +``` + +## Example 프로젝트 + +[적용한 샘플 프로젝트](https://github.com/bootpay/backend-ruby-example)을 참조해주세요 + +## Documentation + +[부트페이 개발매뉴얼](https://docs.bootpay.co.kr/next/)을 참조해주세요 + +## 기술문의 + +[부트페이 홈페이지](https://www.bootpay.co.kr) 우측 하단 채팅을 통해 기술문의 주세요! + +## License -Everyone interacting in the Bootpay::Rest::Client project's codebases, issue trackers, chat rooms and mailing lists is -expected to follow -the [code of conduct](https://github.com/[USERNAME]/bootpay-rest-client/blob/master/CODE_OF_CONDUCT.md). +[MIT License](https://opensource.org/licenses/MIT). diff --git a/bootpay-backend-ruby-2.0.0.gem b/bootpay-backend-ruby-2.0.0.gem new file mode 100644 index 0000000000000000000000000000000000000000..d6e817919a5a61ea50862e5fbcf898a8fb56dd34 GIT binary patch literal 12800 zcmeHtWl*KTlI6wS-QC^Y8)+OGZQR}6FYfM*ySp{eI5gJKz{MJOclSH}c7M#o+lbvi zGrJQTFaP9Mk?~bzovJ#S6>%Ia+)d0)+)Y@md;$Me#{Sp1xw!%V@PF-}JqH&j4}gQ4 zlZTs!gNvJ+2f+Rh#|t25|F25uKhEpn=5FHpHzhA?3k&=I82G2}|5N;buI=9!_fN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%e2LzC$Z~MvUqfS959pR1z0Gci@y_mZ~ko5BYTd{3CKZ0aK;Yq+wqq{r~brf z3T)L=Q+Y!zwQs$8v13QKI%Kz5lS)mUNX6=vbrwTP5XcXUHcse65i8CS=*|3PtCRAH zd;CaG@Jk*oNdQrxdSR&Dr0J~AX7`;o!4|f|w2WvkbiIXv*?($6&h5B2A>d<%)S4=y>)zj$kxtoaD}85=kz1+{GvEue(i!%(H+{OML;MBi9-)sgL;i_=wkD?JKYY53SC5dQc}l}3YM z!_w|+N5k07wYO-{!|LSb$NuPLq808{6yjd3T+58;uXN9Bb7t<2T*#Yz36w9(SWH>4 zEI_ACtEJVTfCo);n8B1kEop>p)#|v2ZmYN^R8ch9iZ+?*GN1d06)R zmZwGTa7(bfP{B*<9kvP<3(jz8bM+A)MZ zG~!rZ5ja58mi=khNM#S-mHzl#W_+Jc)9n-y(&%(Us+!86x_2E%32m4bk_t1?%-Qr$ z*Y-JATS9xObQ1D{X^lDqQb{LYQ|D6gR9+t43Rw^! Date: Wed, 22 Jun 2022 14:30:43 +0900 Subject: [PATCH 034/133] readme update --- bootpay-backend-ruby-2.0.0.gem | Bin 12800 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 bootpay-backend-ruby-2.0.0.gem diff --git a/bootpay-backend-ruby-2.0.0.gem b/bootpay-backend-ruby-2.0.0.gem deleted file mode 100644 index d6e817919a5a61ea50862e5fbcf898a8fb56dd34..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12800 zcmeHtWl*KTlI6wS-QC^Y8)+OGZQR}6FYfM*ySp{eI5gJKz{MJOclSH}c7M#o+lbvi zGrJQTFaP9Mk?~bzovJ#S6>%Ia+)d0)+)Y@md;$Me#{Sp1xw!%V@PF-}JqH&j4}gQ4 zlZTs!gNvJ+2f+Rh#|t25|F25uKhEpn=5FHpHzhA?3k&=I82G2}|5N;buI=9!_fNn7 zcO8<&!UJeBn@u61&b5>hLG0)~ui9CL50Y~;(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{3CKZ0aK;Yq+wqq{r~brf z3T)L=Q+Y!zwQs$8v13QKI%Kz5lS)mUNX6=vbrwTP5XcXUHcse65i8CS=*|3PtCRAH zd;CaG@Jk*oNdQrxdSR&Dr0J~AX7`;o!4|f|w2WvkbiIXv*?($6&h5B2A>d<%)S4=y>)zj$kxtoaD}85=kz1+{GvEue(i!%(H+{OML;MBi9-)sgL;i_=wkD?JKYY53SC5dQc}l}3YM z!_w|+N5k07wYO-{!|LSb$NuPLq808{6yjd3T+58;uXN9Bb7t<2T*#Yz36w9(SWH>4 zEI_ACtEJVTfCo);n8B1kEop>p)#|v2ZmYN^R8ch9iZ+?*GN1d06)R zmZwGTa7(bfP{B*<9kvP<3(jz8bM+A)MZ zG~!rZ5ja58mi=khNM#S-mHzl#W_+Jc)9n-y(&%(Us+!86x_2E%32m4bk_t1?%-Qr$ z*Y-JATS9xObQ1D{X^lDqQb{LYQ|D6gR9+t43Rw^! Date: Wed, 22 Jun 2022 14:36:11 +0900 Subject: [PATCH 035/133] - readme update and republish --- .gitignore | 3 ++- CHANGELOG.md | 3 +++ bootpay-backend-ruby.gemspec | 2 +- lib/bootpay/version.rb | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index de71961..ab53c2c 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ .rspec_status *.idea *.iml +*.gem Gemfile.lock /spec/bootpay/request_rest_billing_key_spec.rb -.DS_Store \ No newline at end of file +.DS_Store diff --git a/CHANGELOG.md b/CHANGELOG.md index a2eafc9..f92aaef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,2 +1,5 @@ +### 2.0.1 +- readme update and republish + ### 2.0.0 - v1 -> v2 update \ No newline at end of file diff --git a/bootpay-backend-ruby.gemspec b/bootpay-backend-ruby.gemspec index 6016617..5a213c1 100644 --- a/bootpay-backend-ruby.gemspec +++ b/bootpay-backend-ruby.gemspec @@ -9,7 +9,7 @@ Gem::Specification.new do |spec| spec.email = ["gosomi@bootpay.co.kr"] spec.summary = "Bootpay Ruby REST Client" - spec.description = "Bootpay REST API / Search One Receipt or Cancel Payment, Subscription Payment on REST API." + spec.description = "부트페이 공식 Ruby 서버사이드 모듈입니다. 결제조회, 취소, 빌링키 결제시 사용됩니다." spec.license = "MIT" # Specify which files should be added to the gem when it is released. # The `git ls-files -z` loads the files in the RubyGem that have been added into git. diff --git a/lib/bootpay/version.rb b/lib/bootpay/version.rb index 7b9eb11..6e3f41f 100644 --- a/lib/bootpay/version.rb +++ b/lib/bootpay/version.rb @@ -1,4 +1,4 @@ # frozen_string_literal: true module Bootpay - V2_VERSION = "2.0.0" + V2_VERSION = "2.0.1" end \ No newline at end of file From 6c34f751a3e35c1d463d9e485df6214b3692c36d Mon Sep 17 00:00:00 2001 From: ehowlsla Date: Wed, 22 Jun 2022 14:43:12 +0900 Subject: [PATCH 036/133] - readme update and republish --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 47798af..6b87750 100644 --- a/README.md +++ b/README.md @@ -13,12 +13,19 @@ Ruby 언어로 작성된 어플리케이션, 프레임워크 등에서 사용가 2. 결제 단건 조회 3. 결제 취소 (전액 취소 / 부분 취소) 4. 신용카드 자동결제 (빌링결제) + 4-1. 빌링키 발급 + 4-2. 발급된 빌링키로 결제 승인 요청 + 4-3. 발급된 빌링키로 결제 예약 요청 + 4-4. 발급된 빌링키로 결제 예약 - 취소 요청 + 4-5. 빌링키 삭제 + 4-6. 해당 결제건의 빌링키 조회 (빌링) + 5. (생체인증, 비밀번호 결제를 위한) 구매자 토큰 발급 6. 서버 승인 요청 7. 본인 인증 결과 조회 From 358020a8d40fe6bc48c1d3addc1e1e6d003c47e1 Mon Sep 17 00:00:00 2001 From: ehowlsla Date: Wed, 22 Jun 2022 14:44:06 +0900 Subject: [PATCH 037/133] - readme update and republish --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6b87750..dbddb24 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Ruby 언어로 작성된 어플리케이션, 프레임워크 등에서 사용가 4-5. 빌링키 삭제 - 4-6. 해당 결제건의 빌링키 조회 (빌링) + 4-6. 해당 결제건의 빌링키 조회 5. (생체인증, 비밀번호 결제를 위한) 구매자 토큰 발급 6. 서버 승인 요청 From c8d63de6ef5079abd4b76a9c512d2e231b365274 Mon Sep 17 00:00:00 2001 From: ehowlsla Date: Wed, 22 Jun 2022 17:36:29 +0900 Subject: [PATCH 038/133] readme update --- README.md | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index dbddb24..744aa1d 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,7 @@ Ruby 언어로 작성된 어플리케이션, 프레임워크 등에서 사용가 5. (생체인증, 비밀번호 결제를 위한) 구매자 토큰 발급 6. 서버 승인 요청 7. 본인 인증 결과 조회 +8. (에스크로 이용시) PG사로 배송정보 보내기 ## Gem으로 설치하기 @@ -82,7 +83,7 @@ api.request_access_token.success? ## 2. 결제 단건 조회 - 결제창 및 정기결제에서 승인/취소된 결제건에 대하여 올바른 결제건인지 서버간 통신으로 결제검증을 합니다. + 승인/취소된 결제건을 조회합니다. 위변조된 결제인지 검증하기 위해 사용됩니다. ```ruby api = Bootpay::RestClient.new( application_id: '59bfc738e13f337dbd6ca48a', @@ -125,7 +126,7 @@ end ``` ## 4-1. 빌링키 발급 -REST API 방식으로 고객으로부터 카드 정보를 전달하여, PG사에게 빌링키를 발급받을 수 있습니다. +REST API 방식으로 고객의 카드 정보를 전달하여, PG사로부터 빌링키를 발급받을 수 있습니다. (부트페이에서는 PG사의 빌링키를 개발사에게 전달하지 않고, 부트페이가 내부적으로 발급한 빌링키를 전달합니다) 발급받은 빌링키를 저장하고 있다가, 원하는 시점, 원하는 금액에 결제 승인 요청하여 좀 더 자유로운 결제시나리오에 적용이 가능합니다. * 비인증 정기결제(REST API) 방식을 지원하는 PG사만 사용 가능합니다. ```ruby @@ -175,7 +176,7 @@ if api.request_access_token.success? end ``` ## 4-3. 발급된 빌링키로 결제 예약 요청 -원하는 시점에 4-1로 결제 승인 요청을 보내도 되지만, 빌링키 발급 이후에 바로 결제 예약 할 수 있습니다. (빌링키당 최대 5건) +원하는 시점에 4-1로 결제 승인 요청을 보내도 되지만, 빌링키 발급 이후에 바로 결제 예약 할 수 있습니다. (빌링키당 최대 10건) ```ruby api = Bootpay::RestClient.new( application_id: '59bfc738e13f337dbd6ca48a', @@ -226,7 +227,7 @@ if api.request_access_token.success? end ``` ## 4-5. 빌링키 삭제 -발급된 빌링키로 더 이상 사용되지 않도록, 삭제 요청합니다. +발급된 빌링키가 더 이상 사용되지 않도록, 삭제 요청합니다. ```ruby api = Bootpay::RestClient.new( application_id: '59bfc738e13f337dbd6ca48a', @@ -241,6 +242,7 @@ end ``` ## 4-6. 해당 결제건의 빌링키 조회 (빌링) +해당 결제건이 어떤 빌링키로 결제되었는지 조회합니다. ```java api = Bootpay::RestClient.new( application_id: '59bfc738e13f337dbd6ca48a', @@ -255,7 +257,7 @@ end ``` ## 5. (생체인증, 비밀번호 결제를 위한) 구매자 토큰 발급 -(부트페이 단독) 부트페이에서 제공하는 간편결제창, 생체인증 기반의 결제 사용을 위해서는 개발사에서 회원 고유번호를 관리해야하며, 해당 회원에 대한 사용자 토큰을 발급합니다. +부트페이에서 제공하는 간편결제창, 생체인증 기반의 결제 사용을 위해서는 개발사에서 회원 고유번호를 관리해야하며, 해당 회원에 대한 사용자 토큰을 발급합니다. 이 토큰값을 기반으로 클라이언트에서 결제요청 하시면 되겠습니다. ```ruby api = Bootpay::RestClient.new( @@ -309,6 +311,32 @@ if api.request_access_token.success? end ``` + +## 8. (에스크로 이용시) PG사로 배송정보 보내기 +다날 본인인증 후 결과값을 조회합니다. +다날 본인인증에서 통신사, 외국인여부, 전화번호 이 3가지 정보는 다날에 추가로 요청하셔야 받으실 수 있습니다. +```ruby +api = Bootpay::RestClient.new( + application_id: '59bfc738e13f337dbd6ca48a', + private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', + mode: 'development' +) +if api.request_access_token.success? + response = api.shipping_start( + receipt_id: "62a818cf1fc19203154a8f2e", + tracking_number: '123456', + delivery_corp: 'CJ대한통운', + user: { + username: '강훈', + phone: '01095735114', + address: '경기도 화성시 동탄기흥로 277번길 59', + zipcode: '08490' + } + ) + print response.data.to_json +end +``` + ## Example 프로젝트 [적용한 샘플 프로젝트](https://github.com/bootpay/backend-ruby-example)을 참조해주세요 From 5ee5a0208f458b118f7f9514f25980e138136cac Mon Sep 17 00:00:00 2001 From: ehowlsla Date: Thu, 23 Jun 2022 09:52:27 +0900 Subject: [PATCH 039/133] readme update --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 744aa1d..1f5c910 100644 --- a/README.md +++ b/README.md @@ -313,8 +313,9 @@ end ## 8. (에스크로 이용시) PG사로 배송정보 보내기 -다날 본인인증 후 결과값을 조회합니다. -다날 본인인증에서 통신사, 외국인여부, 전화번호 이 3가지 정보는 다날에 추가로 요청하셔야 받으실 수 있습니다. +현금 거래에 한해 구매자의 안전거래를 보장하는 방법으로, 판매자와 구매자의 온라인 전자상거래가 원활하게 이루어질 수 있도록 중계해주는 매매보호서비스입니다. 국내법에 따라 전자상거래에서 반드시 적용이 되어 있어야합니다. PG에서도 에스크로 결제를 지원하며, 에스크로 결제 사용을 원하시면 PG사 가맹시에 에스크로결제를 미리 얘기하고나서 진행을 하시는 것이 수월합니다. + +PG사로 배송정보( 이니시스, KCP만 지원 )를 보내서 에스크로 상태를 변경하는 API 입니다. ```ruby api = Bootpay::RestClient.new( application_id: '59bfc738e13f337dbd6ca48a', From 4ea1186811b9749962320b8820210a2f002f36d6 Mon Sep 17 00:00:00 2001 From: ehowlsla Date: Thu, 23 Jun 2022 13:37:55 +0900 Subject: [PATCH 040/133] readme update --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1f5c910..73db330 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Ruby 언어로 작성된 어플리케이션, 프레임워크 등에서 사용가 4-5. 빌링키 삭제 - 4-6. 해당 결제건의 빌링키 조회 + 4-6. 4-6. 빌링키 조회 5. (생체인증, 비밀번호 결제를 위한) 구매자 토큰 발급 6. 서버 승인 요청 @@ -241,8 +241,8 @@ if api.request_access_token.success? end ``` -## 4-6. 해당 결제건의 빌링키 조회 (빌링) -해당 결제건이 어떤 빌링키로 결제되었는지 조회합니다. +## 4-6. 빌링키 조회 +(빌링키 발급 완료시 리턴받았던 receipt_id에 한정) 어떤 빌링키였는지 조회합니다. ```java api = Bootpay::RestClient.new( application_id: '59bfc738e13f337dbd6ca48a', From 8f50b544326ebb159e5314beded39d1da595ae3f Mon Sep 17 00:00:00 2001 From: ehowlsla Date: Thu, 23 Jun 2022 13:53:37 +0900 Subject: [PATCH 041/133] readme update --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 73db330..feccf06 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Ruby 언어로 작성된 어플리케이션, 프레임워크 등에서 사용가 4-5. 빌링키 삭제 - 4-6. 4-6. 빌링키 조회 + 4-6. 빌링키 조회 5. (생체인증, 비밀번호 결제를 위한) 구매자 토큰 발급 6. 서버 승인 요청 @@ -243,7 +243,7 @@ end ## 4-6. 빌링키 조회 (빌링키 발급 완료시 리턴받았던 receipt_id에 한정) 어떤 빌링키였는지 조회합니다. -```java +```ruby api = Bootpay::RestClient.new( application_id: '59bfc738e13f337dbd6ca48a', private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=' From e3e6587d16135abaf819af32cb8b522f8a9906a2 Mon Sep 17 00:00:00 2001 From: gosomi Date: Thu, 7 Jul 2022 21:50:44 +0900 Subject: [PATCH 042/133] =?UTF-8?q?gitignore=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + spec/bootpay/cancel_spec.rb | 15 ++++++++++----- spec/bootpay/receipt_payment_spec.rb | 13 +++++++++---- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index de71961..bb12394 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,5 @@ *.iml Gemfile.lock /spec/bootpay/request_rest_billing_key_spec.rb +/spec/bootpay/__stage_test_unit_spec.rb .DS_Store \ No newline at end of file diff --git a/spec/bootpay/cancel_spec.rb b/spec/bootpay/cancel_spec.rb index 0a82cfc..4af3da4 100644 --- a/spec/bootpay/cancel_spec.rb +++ b/spec/bootpay/cancel_spec.rb @@ -2,18 +2,23 @@ RSpec.describe Bootpay::RestClient do it "cancel payment" do + # api = Bootpay::RestClient.new( + # application_id: '59bfc738e13f337dbd6ca48a', + # private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', + # mode: 'development' + # ) api = Bootpay::RestClient.new( - application_id: '59bfc738e13f337dbd6ca48a', - private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', - mode: 'development' + application_id: '59b731f084382614ebf72215', + private_key: 'WwDv0UjfwFa04wYG0LJZZv1xwraQnlhnHE375n52X0U=', + # mode: 'development' ) if api.request_access_token.success? response = api.cancel_payment( - receipt_id: "624a56111fc19202e4746df2", + receipt_id: "62b1c34e778102001f4a4fa8", cancel_price: 1000, + cancel_tax_free: 0, cancel_username: 'test_user', cancel_message: 'test_message', - ) print response.data.to_json end diff --git a/spec/bootpay/receipt_payment_spec.rb b/spec/bootpay/receipt_payment_spec.rb index caf309e..1ec652b 100644 --- a/spec/bootpay/receipt_payment_spec.rb +++ b/spec/bootpay/receipt_payment_spec.rb @@ -2,14 +2,19 @@ RSpec.describe Bootpay::RestClient do it "receipt payment data" do + # api = Bootpay::RestClient.new( + # application_id: '59bfc738e13f337dbd6ca48a', + # private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', + # mode: 'development' + # ) api = Bootpay::RestClient.new( - application_id: '59bfc738e13f337dbd6ca48a', - private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', - mode: 'development' + application_id: '59b731f084382614ebf72215', + private_key: 'WwDv0UjfwFa04wYG0LJZZv1xwraQnlhnHE375n52X0U=', + mode: 'stage' ) if api.request_access_token.success? response = api.receipt_payment( - "62a818cf1fc19203154a8f2e" + "62c6d202aa1d9d0016009fc2" ) print response.data.to_json end From 5cdbcd1c8233ae1bddc374db257d91a4a2e30a49 Mon Sep 17 00:00:00 2001 From: gosomi Date: Tue, 19 Jul 2022 11:47:08 +0900 Subject: [PATCH 043/133] =?UTF-8?q?=EB=B0=B0=EC=86=A1=20=EC=8B=9C=EC=9E=91?= =?UTF-8?q?=20API=EC=97=90=EC=84=9C=20redirect=5Furl=20=EC=B6=94=EA=B0=80?= =?UTF-8?q?=EB=A1=9C=20=EB=B0=9B=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay/concern/escrow.rb | 5 +++-- spec/bootpay/shipping_start_spec.rb | 11 ++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/bootpay/concern/escrow.rb b/lib/bootpay/concern/escrow.rb index 0627389..fc2ea7c 100644 --- a/lib/bootpay/concern/escrow.rb +++ b/lib/bootpay/concern/escrow.rb @@ -6,7 +6,7 @@ module Bootpay::Concern::Escrow # Comment by Gosomi # Date: 2021-12-14 def shipping_start(receipt_id:, tracking_number:, delivery_corp:, shipping_prepayment: true, - shipping_day: 5, user: nil, company: {}) + shipping_day: 5, user: nil, company: {}, redirect_url: nil) request( method: :put, uri: "escrow/shipping/start/#{receipt_id}", @@ -16,7 +16,8 @@ def shipping_start(receipt_id:, tracking_number:, delivery_corp:, shipping_prepa shipping_prepayment: shipping_prepayment, shipping_day: shipping_day, user: user, - company: company + company: company, + redirect_url: redirect_url } ) end diff --git a/spec/bootpay/shipping_start_spec.rb b/spec/bootpay/shipping_start_spec.rb index a61974d..63f95f5 100644 --- a/spec/bootpay/shipping_start_spec.rb +++ b/spec/bootpay/shipping_start_spec.rb @@ -9,14 +9,15 @@ ) if api.request_access_token.success? response = api.shipping_start( - receipt_id: "62a818cf1fc19203154a8f2e", + receipt_id: "62d61a831fc192036b7c7c5f", tracking_number: '123456', delivery_corp: 'CJ대한통운', + redirect_url: 'https://dev-api.bootpay.co.kr/callback', user: { - username: '강훈', - phone: '01095735114', - address: '경기도 화성시 동탄기흥로 277번길 59', - zipcode: '08490' + username: '부트페이', + phone: '01000000000', + address: '서울특별시 구로구 디지털로 26길 61', + zipcode: '08882' } ) print response.data.to_json From ce5875c75a67c37bc5d23e1f57c6a078cf656028 Mon Sep 17 00:00:00 2001 From: gosomi Date: Tue, 19 Jul 2022 19:11:58 +0900 Subject: [PATCH 044/133] =?UTF-8?q?escrow=20=EB=B2=84=EA=B7=B8=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spec/bootpay/receipt_payment_spec.rb | 2 +- spec/bootpay/shipping_start_spec.rb | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/spec/bootpay/receipt_payment_spec.rb b/spec/bootpay/receipt_payment_spec.rb index 1ec652b..9408b4e 100644 --- a/spec/bootpay/receipt_payment_spec.rb +++ b/spec/bootpay/receipt_payment_spec.rb @@ -14,7 +14,7 @@ ) if api.request_access_token.success? response = api.receipt_payment( - "62c6d202aa1d9d0016009fc2" + "62d653d7cfa2e90016ba38c3" ) print response.data.to_json end diff --git a/spec/bootpay/shipping_start_spec.rb b/spec/bootpay/shipping_start_spec.rb index 63f95f5..e96a95c 100644 --- a/spec/bootpay/shipping_start_spec.rb +++ b/spec/bootpay/shipping_start_spec.rb @@ -9,11 +9,11 @@ ) if api.request_access_token.success? response = api.shipping_start( - receipt_id: "62d61a831fc192036b7c7c5f", - tracking_number: '123456', - delivery_corp: 'CJ대한통운', - redirect_url: 'https://dev-api.bootpay.co.kr/callback', - user: { + receipt_id: "62d682921fc192036b919a80", + tracking_number: '123456', + delivery_corp: 'CJ대한통운', + redirect_url: 'https://dev-api.bootpay.co.kr/callback', + user: { username: '부트페이', phone: '01000000000', address: '서울특별시 구로구 디지털로 26길 61', From aee97430a0185fe8226972cd594af9e2fe4f16f0 Mon Sep 17 00:00:00 2001 From: gosomi Date: Mon, 25 Jul 2022 11:06:37 +0900 Subject: [PATCH 045/133] =?UTF-8?q?=ED=98=84=EA=B8=88=EC=98=81=EC=88=98?= =?UTF-8?q?=EC=A6=9D=20=EB=B0=9C=ED=96=89=20=EC=B7=A8=EC=86=8C=20API=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + lib/bootpay/concern/cash_receipt.rb | 35 ++++++++++++++++++++ spec/bootpay/cancel_spec.rb | 6 ++-- spec/bootpay/cash_cancel_on_receipt_spec.rb | 19 +++++++++++ spec/bootpay/cash_publish_on_receipt_spec.rb | 21 ++++++++++++ spec/bootpay/request_cash_receipt_spec.rb | 4 +-- spec/bootpay/shipping_start_spec.rb | 2 +- spec/bootpay/subscribe_card_payment_spec.rb | 4 +-- 8 files changed, 84 insertions(+), 8 deletions(-) create mode 100644 spec/bootpay/cash_cancel_on_receipt_spec.rb create mode 100644 spec/bootpay/cash_publish_on_receipt_spec.rb diff --git a/.gitignore b/.gitignore index bb12394..22acf77 100644 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,5 @@ Gemfile.lock /spec/bootpay/request_rest_billing_key_spec.rb /spec/bootpay/__stage_test_unit_spec.rb +/spec/bootpay/__development_test_unit_spec.rb .DS_Store \ No newline at end of file diff --git a/lib/bootpay/concern/cash_receipt.rb b/lib/bootpay/concern/cash_receipt.rb index 524c13f..5c73fef 100644 --- a/lib/bootpay/concern/cash_receipt.rb +++ b/lib/bootpay/concern/cash_receipt.rb @@ -41,5 +41,40 @@ def cancel_cash_receipt(receipt_id:, cancel_username:, cancel_message:) } ) end + + # 결제된 계좌이체/가상계좌 결제건중 누락된 현금영수증을 발행해주는 API + # Comment by Gosomi + # Date: 2022-07-21 + def cash_publish_on_receipt(receipt_id:, username:, email:, phone:, identity_no:, currency: 'WON', cash_receipt_type: '소득공제') + request( + method: :post, + uri: "request/receipt/cash/publish", + payload: { + receipt_id: receipt_id, + username: username, + email: email, + phone: phone, + identity_no: identity_no, + currency: currency, + cash_receipt_type: cash_receipt_type + } + ) + end + + # 결제에 포함된 현금영수증 취소 + # Comment by Gosomi + # Date: 2022-07-21 + def cash_cancel_on_receipt(receipt_id:, cancel_username:, cancel_message:) + request( + method: :delete, + uri: "request/receipt/cash/cancel/#{receipt_id}", + headers: { + params: { + cancel_username: cancel_username, + cancel_message: cancel_message + } + } + ) + end end end \ No newline at end of file diff --git a/spec/bootpay/cancel_spec.rb b/spec/bootpay/cancel_spec.rb index 4af3da4..d5b1fe8 100644 --- a/spec/bootpay/cancel_spec.rb +++ b/spec/bootpay/cancel_spec.rb @@ -10,12 +10,12 @@ api = Bootpay::RestClient.new( application_id: '59b731f084382614ebf72215', private_key: 'WwDv0UjfwFa04wYG0LJZZv1xwraQnlhnHE375n52X0U=', - # mode: 'development' + mode: 'stage' ) if api.request_access_token.success? response = api.cancel_payment( - receipt_id: "62b1c34e778102001f4a4fa8", - cancel_price: 1000, + receipt_id: "62ddd3c556d0c60016969657", + cancel_price: 1111, cancel_tax_free: 0, cancel_username: 'test_user', cancel_message: 'test_message', diff --git a/spec/bootpay/cash_cancel_on_receipt_spec.rb b/spec/bootpay/cash_cancel_on_receipt_spec.rb new file mode 100644 index 0000000..ee4f9bd --- /dev/null +++ b/spec/bootpay/cash_cancel_on_receipt_spec.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +RSpec.describe Bootpay::RestClient do + it "certificate authentication" do + api = Bootpay::RestClient.new( + application_id: '59bfc738e13f337dbd6ca48a', + private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', + mode: 'development' + ) + if api.request_access_token.success? + response = api.cash_cancel_on_receipt( + receipt_id: "62d911ee1fc192036b1b3b5e", + cancel_username: '테스트', + cancel_message: '테스트취소' + ) + print response.data.to_json + end + end +end diff --git a/spec/bootpay/cash_publish_on_receipt_spec.rb b/spec/bootpay/cash_publish_on_receipt_spec.rb new file mode 100644 index 0000000..a447855 --- /dev/null +++ b/spec/bootpay/cash_publish_on_receipt_spec.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +RSpec.describe Bootpay::RestClient do + it "certificate authentication" do + api = Bootpay::RestClient.new( + application_id: '59bfc738e13f337dbd6ca48a', + private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', + mode: 'development' + ) + if api.request_access_token.success? + response = api.cash_publish_on_receipt( + receipt_id: "62d911ee1fc192036b1b3b5e", + username: '테스트', + email: 'test@bootpay.co.kr', + phone: '01000000000', + identity_no: '01000000000' + ) + print response.data.to_json + end + end +end diff --git a/spec/bootpay/request_cash_receipt_spec.rb b/spec/bootpay/request_cash_receipt_spec.rb index dd5a16a..04cb164 100644 --- a/spec/bootpay/request_cash_receipt_spec.rb +++ b/spec/bootpay/request_cash_receipt_spec.rb @@ -16,10 +16,10 @@ cash_receipt_type: '소득공제', user: { username: '부트페이', - phone: '01095735114', + phone: '01000000000', email: 'aqure84@naver.com' }, - identity_no: '01095735114', + identity_no: '0100000000', purchased_at: Time.current.strftime('%Y-%m-%d %H:%M:%S'), order_id: Time.current.to_f ) diff --git a/spec/bootpay/shipping_start_spec.rb b/spec/bootpay/shipping_start_spec.rb index e96a95c..a6c4f5a 100644 --- a/spec/bootpay/shipping_start_spec.rb +++ b/spec/bootpay/shipping_start_spec.rb @@ -9,7 +9,7 @@ ) if api.request_access_token.success? response = api.shipping_start( - receipt_id: "62d682921fc192036b919a80", + receipt_id: "62d7bafe1fc192036b919aa2", tracking_number: '123456', delivery_corp: 'CJ대한통운', redirect_url: 'https://dev-api.bootpay.co.kr/callback', diff --git a/spec/bootpay/subscribe_card_payment_spec.rb b/spec/bootpay/subscribe_card_payment_spec.rb index 14a843c..b73e68e 100644 --- a/spec/bootpay/subscribe_card_payment_spec.rb +++ b/spec/bootpay/subscribe_card_payment_spec.rb @@ -9,9 +9,9 @@ ) if api.request_access_token.success? response = api.request_subscribe_card_payment( - billing_key: '6295cd1d1fc19202e4e319b0', + billing_key: '62d903671fc192036b1b3b56', order_name: '테스트결제', - price: 1000, + price: 10000, card_quota: '00', order_id: Time.current.to_i, user: { From e6ae9013ea7eeb26b7e7f54381131a54481530bd Mon Sep 17 00:00:00 2001 From: gosomi Date: Fri, 29 Jul 2022 08:34:40 +0900 Subject: [PATCH 046/133] =?UTF-8?q?sdk=20version=20=EA=B8=B0=EB=A1=9D=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay-backend-ruby.rb | 2 ++ lib/bootpay/concern/cash_receipt.rb | 10 +++++----- lib/bootpay/concern/rest.rb | 7 ++++--- spec/bootpay/cash_cancel_on_receipt_spec.rb | 4 ++-- spec/bootpay/cash_publish_on_receipt_spec.rb | 5 +++-- 5 files changed, 16 insertions(+), 12 deletions(-) diff --git a/lib/bootpay-backend-ruby.rb b/lib/bootpay-backend-ruby.rb index 7ccf926..57f7988 100644 --- a/lib/bootpay-backend-ruby.rb +++ b/lib/bootpay-backend-ruby.rb @@ -17,6 +17,8 @@ class RestClient production: 'https://api.bootpay.co.kr/v2' }.freeze + SDK_VERSION = '4.2.0' + def initialize(application_id:, private_key:, mode: 'production') @application_id = application_id @private_key = private_key diff --git a/lib/bootpay/concern/cash_receipt.rb b/lib/bootpay/concern/cash_receipt.rb index 5c73fef..a283173 100644 --- a/lib/bootpay/concern/cash_receipt.rb +++ b/lib/bootpay/concern/cash_receipt.rb @@ -45,11 +45,11 @@ def cancel_cash_receipt(receipt_id:, cancel_username:, cancel_message:) # 결제된 계좌이체/가상계좌 결제건중 누락된 현금영수증을 발행해주는 API # Comment by Gosomi # Date: 2022-07-21 - def cash_publish_on_receipt(receipt_id:, username:, email:, phone:, identity_no:, currency: 'WON', cash_receipt_type: '소득공제') + def cash_receipt_publish_on_receipt(receipt_id:, username:, email:, phone:, identity_no:, currency: 'WON', cash_receipt_type: '소득공제') request( - method: :post, - uri: "request/receipt/cash/publish", - payload: { + method: :post, + uri: "request/receipt/cash/publish", + payload: { receipt_id: receipt_id, username: username, email: email, @@ -64,7 +64,7 @@ def cash_publish_on_receipt(receipt_id:, username:, email:, phone:, identity_no: # 결제에 포함된 현금영수증 취소 # Comment by Gosomi # Date: 2022-07-21 - def cash_cancel_on_receipt(receipt_id:, cancel_username:, cancel_message:) + def cash_receipt_cancel_on_receipt(receipt_id:, cancel_username:, cancel_message:) request( method: :delete, uri: "request/receipt/cash/cancel/#{receipt_id}", diff --git a/lib/bootpay/concern/rest.rb b/lib/bootpay/concern/rest.rb index 7844caa..fbcea7a 100644 --- a/lib/bootpay/concern/rest.rb +++ b/lib/bootpay/concern/rest.rb @@ -10,9 +10,10 @@ module Bootpay::Concern::Rest def request(method: :post, uri:, payload: {}, headers: {}) response = HTTP.headers( { - Authorization: "Bearer #{@token}", - content_type: 'application/json', - accept: 'application/json' + Authorization: "Bearer #{@token}", + content_type: 'application/json', + accept: 'application/json', + bootpay_api_version: Bootpay::RestClient::SDK_VERSION }.merge!(headers).compact ).send( method.to_sym, diff --git a/spec/bootpay/cash_cancel_on_receipt_spec.rb b/spec/bootpay/cash_cancel_on_receipt_spec.rb index ee4f9bd..edd97ba 100644 --- a/spec/bootpay/cash_cancel_on_receipt_spec.rb +++ b/spec/bootpay/cash_cancel_on_receipt_spec.rb @@ -8,8 +8,8 @@ mode: 'development' ) if api.request_access_token.success? - response = api.cash_cancel_on_receipt( - receipt_id: "62d911ee1fc192036b1b3b5e", + response = api.cash_receipt_cancel_on_receipt( + receipt_id: "62e24a641fc192036b1b3cf9", cancel_username: '테스트', cancel_message: '테스트취소' ) diff --git a/spec/bootpay/cash_publish_on_receipt_spec.rb b/spec/bootpay/cash_publish_on_receipt_spec.rb index a447855..4e5e34b 100644 --- a/spec/bootpay/cash_publish_on_receipt_spec.rb +++ b/spec/bootpay/cash_publish_on_receipt_spec.rb @@ -8,14 +8,15 @@ mode: 'development' ) if api.request_access_token.success? - response = api.cash_publish_on_receipt( - receipt_id: "62d911ee1fc192036b1b3b5e", + response = api.cash_receipt_publish_on_receipt( + receipt_id: "62e24a641fc192036b1b3cf9", username: '테스트', email: 'test@bootpay.co.kr', phone: '01000000000', identity_no: '01000000000' ) print response.data.to_json + print Time.now end end end From d1e910bddbf7dc1441d43b04240be2b01cd2b112 Mon Sep 17 00:00:00 2001 From: gosomi Date: Fri, 29 Jul 2022 08:38:23 +0900 Subject: [PATCH 047/133] =?UTF-8?q?sdk=20version=20=EC=84=A4=EC=A0=95=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay-backend-ruby.rb | 9 +++++++++ lib/bootpay/concern/rest.rb | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/bootpay-backend-ruby.rb b/lib/bootpay-backend-ruby.rb index 57f7988..b7dd131 100644 --- a/lib/bootpay-backend-ruby.rb +++ b/lib/bootpay-backend-ruby.rb @@ -24,7 +24,16 @@ def initialize(application_id:, private_key:, mode: 'production') @private_key = private_key @mode = mode.presence || 'production' @token = nil + @api_version = SDK_VERSION raise ArgumentError, "개발환경 mode는 development, stage, production 중에서 선택이 가능합니다." if API[@mode.to_sym].blank? end + + # API 버전을 설정한다 + # Comment by Gosomi + # Date: 2022-07-29 + def set_api_version(version) + raise ArgumentError, 'API Version은 4.0.0 이상만 설정이 가능합니다.' if version < '4.0.0' + @api_version = version + end end end diff --git a/lib/bootpay/concern/rest.rb b/lib/bootpay/concern/rest.rb index fbcea7a..ce6e98a 100644 --- a/lib/bootpay/concern/rest.rb +++ b/lib/bootpay/concern/rest.rb @@ -13,7 +13,7 @@ def request(method: :post, uri:, payload: {}, headers: {}) Authorization: "Bearer #{@token}", content_type: 'application/json', accept: 'application/json', - bootpay_api_version: Bootpay::RestClient::SDK_VERSION + bootpay_api_version: @api_version }.merge!(headers).compact ).send( method.to_sym, From d12e62bc9713c25d70fbabdd19a83a440f0db09e Mon Sep 17 00:00:00 2001 From: gosomi Date: Fri, 29 Jul 2022 08:52:42 +0900 Subject: [PATCH 048/133] =?UTF-8?q?backend=20sdk=20version=20=EA=B8=B0?= =?UTF-8?q?=EB=A1=9D=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay/concern/rest.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/bootpay/concern/rest.rb b/lib/bootpay/concern/rest.rb index ce6e98a..a064fa1 100644 --- a/lib/bootpay/concern/rest.rb +++ b/lib/bootpay/concern/rest.rb @@ -13,7 +13,8 @@ def request(method: :post, uri:, payload: {}, headers: {}) Authorization: "Bearer #{@token}", content_type: 'application/json', accept: 'application/json', - bootpay_api_version: @api_version + bootpay_api_version: @api_version, + bootpay_sdk_version: "backend-ruby-#{Bootpay::V2_VERSION}" }.merge!(headers).compact ).send( method.to_sym, From d1f42af237a8070cad9c92fbb380152889b12e6e Mon Sep 17 00:00:00 2001 From: gosomi Date: Fri, 29 Jul 2022 08:52:50 +0900 Subject: [PATCH 049/133] =?UTF-8?q?2.0.2=20=EB=A1=9C=20=EB=B2=84=EC=A0=84?= =?UTF-8?q?=20=EC=97=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bootpay/version.rb b/lib/bootpay/version.rb index 6e3f41f..ffd65b2 100644 --- a/lib/bootpay/version.rb +++ b/lib/bootpay/version.rb @@ -1,4 +1,4 @@ # frozen_string_literal: true module Bootpay - V2_VERSION = "2.0.1" + V2_VERSION = "2.0.2" end \ No newline at end of file From 663baabd63169ad1255c6d36b3291620b851dfed Mon Sep 17 00:00:00 2001 From: gosomi Date: Fri, 29 Jul 2022 12:33:22 +0900 Subject: [PATCH 050/133] =?UTF-8?q?sdk=20type=20=EB=A1=9C=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay/concern/rest.rb | 3 ++- spec/bootpay/cash_cancel_on_receipt_spec.rb | 2 +- spec/bootpay/cash_publish_on_receipt_spec.rb | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/bootpay/concern/rest.rb b/lib/bootpay/concern/rest.rb index a064fa1..ff4d514 100644 --- a/lib/bootpay/concern/rest.rb +++ b/lib/bootpay/concern/rest.rb @@ -14,7 +14,8 @@ def request(method: :post, uri:, payload: {}, headers: {}) content_type: 'application/json', accept: 'application/json', bootpay_api_version: @api_version, - bootpay_sdk_version: "backend-ruby-#{Bootpay::V2_VERSION}" + bootpay_sdk_version: Bootpay::V2_VERSION, + bootpay_sdk_type: '300' }.merge!(headers).compact ).send( method.to_sym, diff --git a/spec/bootpay/cash_cancel_on_receipt_spec.rb b/spec/bootpay/cash_cancel_on_receipt_spec.rb index edd97ba..8d8c709 100644 --- a/spec/bootpay/cash_cancel_on_receipt_spec.rb +++ b/spec/bootpay/cash_cancel_on_receipt_spec.rb @@ -9,7 +9,7 @@ ) if api.request_access_token.success? response = api.cash_receipt_cancel_on_receipt( - receipt_id: "62e24a641fc192036b1b3cf9", + receipt_id: "62e32b3f1fc192036e8db942", cancel_username: '테스트', cancel_message: '테스트취소' ) diff --git a/spec/bootpay/cash_publish_on_receipt_spec.rb b/spec/bootpay/cash_publish_on_receipt_spec.rb index 4e5e34b..fbb5854 100644 --- a/spec/bootpay/cash_publish_on_receipt_spec.rb +++ b/spec/bootpay/cash_publish_on_receipt_spec.rb @@ -9,7 +9,7 @@ ) if api.request_access_token.success? response = api.cash_receipt_publish_on_receipt( - receipt_id: "62e24a641fc192036b1b3cf9", + receipt_id: "62e32b3f1fc192036e8db942", username: '테스트', email: 'test@bootpay.co.kr', phone: '01000000000', From 600f666503bfc1ebeabe78cc45769ba736e56a1d Mon Sep 17 00:00:00 2001 From: gosomi Date: Tue, 9 Aug 2022 16:43:53 +0900 Subject: [PATCH 051/133] =?UTF-8?q?=ED=98=84=EA=B8=88=EC=98=81=EC=88=98?= =?UTF-8?q?=EC=A6=9D=20=EB=B3=84=EA=B1=B4=20=EB=B0=9C=ED=96=89=20test=20sp?= =?UTF-8?q?ec=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spec/bootpay/request_cash_receipt_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/bootpay/request_cash_receipt_spec.rb b/spec/bootpay/request_cash_receipt_spec.rb index 04cb164..4efd776 100644 --- a/spec/bootpay/request_cash_receipt_spec.rb +++ b/spec/bootpay/request_cash_receipt_spec.rb @@ -17,7 +17,7 @@ user: { username: '부트페이', phone: '01000000000', - email: 'aqure84@naver.com' + email: 'bootpay@bootpay.co.kr' }, identity_no: '0100000000', purchased_at: Time.current.strftime('%Y-%m-%d %H:%M:%S'), From 244cb1333c60d23b34e1a55c9e2c6debb35b3efa Mon Sep 17 00:00:00 2001 From: gosomi Date: Fri, 19 Aug 2022 14:36:40 +0900 Subject: [PATCH 052/133] =?UTF-8?q?=EA=B0=80=EB=A7=B9=EC=A0=90=20=EA=B2=B0?= =?UTF-8?q?=EC=A0=9C=20=EA=B0=80=EB=8A=A5=20=EB=82=B4=EC=97=AD=20=EB=A6=AC?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=EA=B0=80=EC=A0=B8=EC=98=A4=EA=B8=B0=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EC=99=84=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay/concern.rb | 2 ++ lib/bootpay/concern/seller.rb | 15 +++++++++++++++ spec/bootpay/cancel_cash_receipt_spec.rb | 2 +- spec/bootpay/certificate_spec.rb | 2 +- spec/bootpay/confirm_payment_spec.rb | 11 ++++++++--- spec/bootpay/seller_payment_method_spec.rb | 15 +++++++++++++++ spec/bootpay/subscribe_payment_reserve_spec.rb | 11 ++++++++--- 7 files changed, 50 insertions(+), 8 deletions(-) create mode 100644 lib/bootpay/concern/seller.rb create mode 100644 spec/bootpay/seller_payment_method_spec.rb diff --git a/lib/bootpay/concern.rb b/lib/bootpay/concern.rb index 6887d06..3d78f85 100644 --- a/lib/bootpay/concern.rb +++ b/lib/bootpay/concern.rb @@ -8,6 +8,7 @@ module Concern require_relative 'concern/reseller' require_relative 'concern/rest' require_relative 'concern/sdk' + require_relative 'concern/seller' require_relative 'concern/subscription' require_relative 'concern/token' require_relative 'concern/user_token' @@ -21,6 +22,7 @@ module Concern include Reseller include Rest include Sdk + include Seller include Subscription include Token include UserToken diff --git a/lib/bootpay/concern/seller.rb b/lib/bootpay/concern/seller.rb new file mode 100644 index 0000000..b9aee63 --- /dev/null +++ b/lib/bootpay/concern/seller.rb @@ -0,0 +1,15 @@ +module Bootpay::Concern::Seller + extend ActiveSupport::Concern + + included do + # 현재 사용가능한 결제수단 목록 보기 + # Comment by Gosomi + # Date: 2022-08-19 + def lookup_payment_methods + request( + uri: 'seller/payment/method', + method: :get + ) + end + end +end \ No newline at end of file diff --git a/spec/bootpay/cancel_cash_receipt_spec.rb b/spec/bootpay/cancel_cash_receipt_spec.rb index c577968..6115c28 100644 --- a/spec/bootpay/cancel_cash_receipt_spec.rb +++ b/spec/bootpay/cancel_cash_receipt_spec.rb @@ -9,7 +9,7 @@ ) if api.request_access_token.success? response = api.cancel_cash_receipt( - receipt_id: '62983c341fc19202e97e16e5', + receipt_id: '62f356871fc192036f9f4ae2', cancel_username: 'test', cancel_message: 'test 취소' ) diff --git a/spec/bootpay/certificate_spec.rb b/spec/bootpay/certificate_spec.rb index b0a4982..8b2de71 100644 --- a/spec/bootpay/certificate_spec.rb +++ b/spec/bootpay/certificate_spec.rb @@ -9,7 +9,7 @@ ) if api.request_access_token.success? response = api.certificate( - "624d2e531fc19202e4746f40" + "62f4f3471fc192036f9f4bfd" ) print response.data.to_json end diff --git a/spec/bootpay/confirm_payment_spec.rb b/spec/bootpay/confirm_payment_spec.rb index 90edea3..cb9ffd2 100644 --- a/spec/bootpay/confirm_payment_spec.rb +++ b/spec/bootpay/confirm_payment_spec.rb @@ -2,10 +2,15 @@ RSpec.describe Bootpay::RestClient do it "confirm payment" do + # api = Bootpay::RestClient.new( + # application_id: '59bfc738e13f337dbd6ca48a', + # private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', + # mode: 'development' + # ) api = Bootpay::RestClient.new( - application_id: '59bfc738e13f337dbd6ca48a', - private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', - mode: 'development' + application_id: '59b731f084382614ebf72215', + private_key: 'WwDv0UjfwFa04wYG0LJZZv1xwraQnlhnHE375n52X0U=', + mode: 'stage' ) if api.request_access_token.success? response = api.confirm_payment( diff --git a/spec/bootpay/seller_payment_method_spec.rb b/spec/bootpay/seller_payment_method_spec.rb new file mode 100644 index 0000000..00387a8 --- /dev/null +++ b/spec/bootpay/seller_payment_method_spec.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +RSpec.describe Bootpay::RestClient do + it "seller lookup payment" do + api = Bootpay::RestClient.new( + application_id: '59bfc738e13f337dbd6ca48a', + private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', + mode: 'development' + ) + if api.request_access_token.success? + response = api.lookup_payment_methods + print response.data.to_json + end + end +end diff --git a/spec/bootpay/subscribe_payment_reserve_spec.rb b/spec/bootpay/subscribe_payment_reserve_spec.rb index 54dd786..3391d1c 100644 --- a/spec/bootpay/subscribe_payment_reserve_spec.rb +++ b/spec/bootpay/subscribe_payment_reserve_spec.rb @@ -7,19 +7,24 @@ private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', mode: 'development' ) + # api = Bootpay::RestClient.new( + # application_id: '59b731f084382614ebf72215', + # private_key: 'WwDv0UjfwFa04wYG0LJZZv1xwraQnlhnHE375n52X0U=', + # mode: 'stage' + # ) if api.request_access_token.success? response = api.subscribe_payment_reserve( # billing_key: '62820fa61fc19202e5ef240e', - billing_key: '628c0d0d1fc19202e5ef2866', + billing_key: '62d903671fc192036b1b3b56', order_name: '테스트결제', - price: 1000, + price: 100, order_id: Time.current.to_i, user: { phone: '01000000000', username: '홍길동', email: 'test@bootpay.co.kr' }, - reserve_execute_at: (Time.current + 30.seconds).iso8601 + reserve_execute_at: (Time.current + 5000.seconds).iso8601 ) print response.data.to_json end From 49911860097be737aa4cee42a91683070cf988b8 Mon Sep 17 00:00:00 2001 From: gosomi Date: Fri, 4 Nov 2022 15:33:42 +0900 Subject: [PATCH 053/133] =?UTF-8?q?=EB=B3=B8=EC=9D=B8=EC=9D=B8=EC=A6=9D=20?= =?UTF-8?q?REST=20API=20=ED=85=8C=EC=8A=A4=ED=8A=B8=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EB=B0=8F=20=EC=98=88=EC=A0=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay/concern/authenticate.rb | 52 +++++++++++++++++++ .../confirm_authentication_rest_spec.rb | 23 ++++++++ .../realarm_authentication_spec.rb | 20 +++++++ .../request_authentication_rest_spec.rb | 31 +++++++++++ spec/bootpay/billing_key_spec.rb | 15 ++++-- spec/bootpay/cancel_cash_receipt_spec.rb | 13 +++-- spec/bootpay/cancel_spec.rb | 4 +- spec/bootpay/certificate_spec.rb | 14 +++-- spec/bootpay/destroy_billing_key_spec.rb | 2 +- spec/bootpay/notification_spec.rb | 22 ++++++++ spec/bootpay/receipt_payment_spec.rb | 18 +++---- spec/bootpay/request_cash_receipt_spec.rb | 13 +++-- spec/bootpay/subscribe_card_payment_spec.rb | 23 ++++---- 13 files changed, 211 insertions(+), 39 deletions(-) create mode 100644 spec/bootpay/authenticate/confirm_authentication_rest_spec.rb create mode 100644 spec/bootpay/authenticate/realarm_authentication_spec.rb create mode 100644 spec/bootpay/authenticate/request_authentication_rest_spec.rb create mode 100644 spec/bootpay/notification_spec.rb diff --git a/lib/bootpay/concern/authenticate.rb b/lib/bootpay/concern/authenticate.rb index 1c76493..94bf803 100644 --- a/lib/bootpay/concern/authenticate.rb +++ b/lib/bootpay/concern/authenticate.rb @@ -11,5 +11,57 @@ def certificate(receipt_id) uri: "certificate/#{receipt_id}" ) end + + # REST API로 본인인증 요청하기 + # Comment by Gosomi + # Date: 2022-11-02 + def request_authentication(pg:, method:, username:, identity_no:, carrier:, phone:, site_url:, + authenticate_type: 'sms', order_name: '', authentication_id: '', extra: {}, user: {}) + request( + method: :post, + uri: 'request/authentication', + payload: { + pg: pg, + method: method, + username: username, + identity_no: identity_no, + carrier: carrier, + phone: phone, + site_url: site_url, + authenticate_type: authenticate_type, + order_name: order_name, + authentication_id: authentication_id, + extra: extra, + user: user + } + ) + end + + # 본인인증 승인결과를 가져온다 + # Comment by Gosomi + # Date: 2022-11-03 + def confirm_authentication(receipt_id:, otp: nil) + request( + method: :post, + uri: 'authenticate/confirm', + payload: { + receipt_id: receipt_id, + otp: otp + } + ) + end + + # 다시 SMS/알람 보내기 + # Comment by Gosomi + # Date: 2022-11-03 + def realarm_authentication(receipt_id) + request( + method: :post, + uri: 'authenticate/realarm', + payload: { + receipt_id: receipt_id + } + ) + end end end \ No newline at end of file diff --git a/spec/bootpay/authenticate/confirm_authentication_rest_spec.rb b/spec/bootpay/authenticate/confirm_authentication_rest_spec.rb new file mode 100644 index 0000000..7fec3ff --- /dev/null +++ b/spec/bootpay/authenticate/confirm_authentication_rest_spec.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +RSpec.describe Bootpay::RestClient do + it "request authentication" do + api = Bootpay::RestClient.new( + application_id: '59bfc738e13f337dbd6ca48a', + private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', + mode: 'development' + ) + # api = Bootpay::RestClient.new( + # application_id: '62d60a39e38c3000235afe63', + # private_key: 'Nuu09hRbQ+8EmEfLEu1HeaLwsZd38BJmtwhLa1pxI24=', + # mode: 'stage' + # ) + if api.request_access_token.success? + response = api.confirm_authentication( + receipt_id: '63634d161fc19203724b3ac6', + otp: '953673', + ) + print response.data.to_json + end + end +end diff --git a/spec/bootpay/authenticate/realarm_authentication_spec.rb b/spec/bootpay/authenticate/realarm_authentication_spec.rb new file mode 100644 index 0000000..1725acf --- /dev/null +++ b/spec/bootpay/authenticate/realarm_authentication_spec.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +RSpec.describe Bootpay::RestClient do + it "request authentication" do + api = Bootpay::RestClient.new( + application_id: '59bfc738e13f337dbd6ca48a', + private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', + mode: 'development' + ) + # api = Bootpay::RestClient.new( + # application_id: '62d60a39e38c3000235afe63', + # private_key: 'Nuu09hRbQ+8EmEfLEu1HeaLwsZd38BJmtwhLa1pxI24=', + # mode: 'stage' + # ) + if api.request_access_token.success? + response = api.realarm_authentication('63647ea31fc1920373e6d8f3') + print response.data.to_json + end + end +end diff --git a/spec/bootpay/authenticate/request_authentication_rest_spec.rb b/spec/bootpay/authenticate/request_authentication_rest_spec.rb new file mode 100644 index 0000000..f227f6e --- /dev/null +++ b/spec/bootpay/authenticate/request_authentication_rest_spec.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +RSpec.describe Bootpay::RestClient do + it "request authentication" do + api = Bootpay::RestClient.new( + application_id: '59bfc738e13f337dbd6ca48a', + private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', + mode: 'development' + ) + # api = Bootpay::RestClient.new( + # application_id: '62d60a39e38c3000235afe63', + # private_key: 'Nuu09hRbQ+8EmEfLEu1HeaLwsZd38BJmtwhLa1pxI24=', + # mode: 'stage' + # ) + if api.request_access_token.success? + response = api.request_authentication( + pg: '다날', + method: '본인인증', + username: '강훈', + identity_no: '8410251', + carrier: 'SKT', + phone: '01095735114', + site_url: 'https://www.bootpay.co.kr', + order_name: '본인인증하기 ', + authentication_id: Time.now.to_i.to_s, + authenticate_type: 'sms' + ) + print response.data.to_json + end + end +end diff --git a/spec/bootpay/billing_key_spec.rb b/spec/bootpay/billing_key_spec.rb index bcd42ac..3f0ca10 100644 --- a/spec/bootpay/billing_key_spec.rb +++ b/spec/bootpay/billing_key_spec.rb @@ -2,14 +2,19 @@ RSpec.describe Bootpay::RestClient do it "billing key" do - api = Bootpay::RestClient.new( - application_id: '59bfc738e13f337dbd6ca48a', - private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', - mode: 'development' + # api = Bootpay::RestClient.new( + # application_id: '59bfc738e13f337dbd6ca48a', + # private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', + # mode: 'development' + # ) + api = Bootpay::RestClient.new( + application_id: '59b731f084382614ebf72215', + private_key: 'WwDv0UjfwFa04wYG0LJZZv1xwraQnlhnHE375n52X0U=', + mode: 'stage' ) if api.request_access_token.success? response = api.lookup_subscribe_billing_key( - "624e4f7c1fc19202e4746f91" + "633f69a3d01c7e002a4c75ea" ) print response.data.to_json end diff --git a/spec/bootpay/cancel_cash_receipt_spec.rb b/spec/bootpay/cancel_cash_receipt_spec.rb index 6115c28..b6ebaeb 100644 --- a/spec/bootpay/cancel_cash_receipt_spec.rb +++ b/spec/bootpay/cancel_cash_receipt_spec.rb @@ -2,14 +2,19 @@ RSpec.describe Bootpay::RestClient do it "cancel cash receipt" do + # api = Bootpay::RestClient.new( + # application_id: '59bfc738e13f337dbd6ca48a', + # private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', + # mode: 'development' + # ) api = Bootpay::RestClient.new( - application_id: '59bfc738e13f337dbd6ca48a', - private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', - mode: 'development' + application_id: '59b731f084382614ebf72215', + private_key: 'WwDv0UjfwFa04wYG0LJZZv1xwraQnlhnHE375n52X0U=', + mode: 'stage' ) if api.request_access_token.success? response = api.cancel_cash_receipt( - receipt_id: '62f356871fc192036f9f4ae2', + receipt_id: '6327ad0743c9be001679f5e7', cancel_username: 'test', cancel_message: 'test 취소' ) diff --git a/spec/bootpay/cancel_spec.rb b/spec/bootpay/cancel_spec.rb index d5b1fe8..76f794b 100644 --- a/spec/bootpay/cancel_spec.rb +++ b/spec/bootpay/cancel_spec.rb @@ -14,9 +14,7 @@ ) if api.request_access_token.success? response = api.cancel_payment( - receipt_id: "62ddd3c556d0c60016969657", - cancel_price: 1111, - cancel_tax_free: 0, + receipt_id: "6327ab8143c9be001679f5d2", cancel_username: 'test_user', cancel_message: 'test_message', ) diff --git a/spec/bootpay/certificate_spec.rb b/spec/bootpay/certificate_spec.rb index 8b2de71..aaf58f6 100644 --- a/spec/bootpay/certificate_spec.rb +++ b/spec/bootpay/certificate_spec.rb @@ -2,14 +2,20 @@ RSpec.describe Bootpay::RestClient do it "certificate authentication" do + # api = Bootpay::RestClient.new( + # application_id: '5c5cf060396fa678c275875a', + # private_key: 'WaS7S2Lb44K5uE7OtCpsTIN/bTneH4fWnILpPStkCNo=', + # mode: 'production' + # ) + api = Bootpay::RestClient.new( - application_id: '59bfc738e13f337dbd6ca48a', - private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', - mode: 'development' + application_id: '59b731f084382614ebf72215', + private_key: 'WwDv0UjfwFa04wYG0LJZZv1xwraQnlhnHE375n52X0U=', + mode: 'stage' ) if api.request_access_token.success? response = api.certificate( - "62f4f3471fc192036f9f4bfd" + "6327aaf743c9be001679f5cf" ) print response.data.to_json end diff --git a/spec/bootpay/destroy_billing_key_spec.rb b/spec/bootpay/destroy_billing_key_spec.rb index 46903d0..dc19304 100644 --- a/spec/bootpay/destroy_billing_key_spec.rb +++ b/spec/bootpay/destroy_billing_key_spec.rb @@ -9,7 +9,7 @@ ) if api.request_access_token.success? response = api.destroy_billing_key( - '6257bafb1fc19202e47471f7:' + '633b7d0e0e019e039c9e2110' ) print response.data.to_json end diff --git a/spec/bootpay/notification_spec.rb b/spec/bootpay/notification_spec.rb new file mode 100644 index 0000000..cb9ffd2 --- /dev/null +++ b/spec/bootpay/notification_spec.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +RSpec.describe Bootpay::RestClient do + it "confirm payment" do + # api = Bootpay::RestClient.new( + # application_id: '59bfc738e13f337dbd6ca48a', + # private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', + # mode: 'development' + # ) + api = Bootpay::RestClient.new( + application_id: '59b731f084382614ebf72215', + private_key: 'WwDv0UjfwFa04wYG0LJZZv1xwraQnlhnHE375n52X0U=', + mode: 'stage' + ) + if api.request_access_token.success? + response = api.confirm_payment( + "61d3d41b1fc19202e483320b" + ) + print response.data.to_json + end + end +end diff --git a/spec/bootpay/receipt_payment_spec.rb b/spec/bootpay/receipt_payment_spec.rb index 9408b4e..1bdaa28 100644 --- a/spec/bootpay/receipt_payment_spec.rb +++ b/spec/bootpay/receipt_payment_spec.rb @@ -2,19 +2,19 @@ RSpec.describe Bootpay::RestClient do it "receipt payment data" do - # api = Bootpay::RestClient.new( - # application_id: '59bfc738e13f337dbd6ca48a', - # private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', - # mode: 'development' - # ) api = Bootpay::RestClient.new( - application_id: '59b731f084382614ebf72215', - private_key: 'WwDv0UjfwFa04wYG0LJZZv1xwraQnlhnHE375n52X0U=', - mode: 'stage' + application_id: '59bfc738e13f337dbd6ca48a', + private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', + mode: 'development' ) + # api = Bootpay::RestClient.new( + # application_id: '62d60a39e38c3000235afe63', + # private_key: 'Nuu09hRbQ+8EmEfLEu1HeaLwsZd38BJmtwhLa1pxI24=', + # mode: 'stage' + # ) if api.request_access_token.success? response = api.receipt_payment( - "62d653d7cfa2e90016ba38c3" + "632439131fc192036bac6308" ) print response.data.to_json end diff --git a/spec/bootpay/request_cash_receipt_spec.rb b/spec/bootpay/request_cash_receipt_spec.rb index 4efd776..fc20bd4 100644 --- a/spec/bootpay/request_cash_receipt_spec.rb +++ b/spec/bootpay/request_cash_receipt_spec.rb @@ -2,14 +2,19 @@ RSpec.describe Bootpay::RestClient do it "request cash receipt" do + # api = Bootpay::RestClient.new( + # application_id: '59bfc738e13f337dbd6ca48a', + # private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', + # mode: 'development' + # ) api = Bootpay::RestClient.new( - application_id: '59bfc738e13f337dbd6ca48a', - private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', - mode: 'development' + application_id: '59b731f084382614ebf72215', + private_key: 'WwDv0UjfwFa04wYG0LJZZv1xwraQnlhnHE375n52X0U=', + mode: 'stage' ) if api.request_access_token.success? response = api.request_cash_receipt( - pg: '토스', + pg: '나이스페이', price: 1000, tax_free: 0, order_name: '테스트', diff --git a/spec/bootpay/subscribe_card_payment_spec.rb b/spec/bootpay/subscribe_card_payment_spec.rb index b73e68e..39eb30b 100644 --- a/spec/bootpay/subscribe_card_payment_spec.rb +++ b/spec/bootpay/subscribe_card_payment_spec.rb @@ -2,22 +2,27 @@ RSpec.describe Bootpay::RestClient do it "billing key" do + # api = Bootpay::RestClient.new( + # application_id: '59bfc738e13f337dbd6ca48a', + # private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', + # mode: 'development' + # ) api = Bootpay::RestClient.new( - application_id: '59bfc738e13f337dbd6ca48a', - private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', - mode: 'development' + application_id: '59b731f084382614ebf72215', + private_key: 'WwDv0UjfwFa04wYG0LJZZv1xwraQnlhnHE375n52X0U=', + mode: 'production' ) if api.request_access_token.success? response = api.request_subscribe_card_payment( - billing_key: '62d903671fc192036b1b3b56', - order_name: '테스트결제', - price: 10000, + billing_key: '633f69ccd01c7e001a282fd4', + order_name: '테스트결제', + price: 100, card_quota: '00', order_id: Time.current.to_i, - user: { - phone: '01000000000', + user: { + phone: '01000000000', username: '홍길동', - email: 'test@bootpay.co.kr' + email: 'test@bootpay.co.kr' } ) print response.data.to_json From b25dd13999fc21c7b950ca5e58c63a719f9ef44d Mon Sep 17 00:00:00 2001 From: gosomi Date: Wed, 8 Mar 2023 09:50:34 +0900 Subject: [PATCH 054/133] =?UTF-8?q?=EC=98=88=EC=95=BD=EA=B2=B0=EC=A0=9C=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay/concern/subscription.rb | 20 ++++++++++++++++++++ lib/bootpay/version.rb | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/lib/bootpay/concern/subscription.rb b/lib/bootpay/concern/subscription.rb index 8f97ecb..a7d45f3 100644 --- a/lib/bootpay/concern/subscription.rb +++ b/lib/bootpay/concern/subscription.rb @@ -57,6 +57,26 @@ def subscribe_payment_reserve(billing_key:, reserve_execute_at:, order_name:, pr ) end + # 예약결제 조회 기능 + # Comment by Gosomi + # Date: 2023-03-08 + def subscribe_payment_reserve_lookup(reserve_id) + request( + method: :get, + uri: "subscribe/payment/reserve/#{reserve_id}" + ) + end + + # 자동결제 조회하기 + # Comment by Gosomi + # Date: 2023-02-24 + def subscribe_lookup(reserve_id) + request( + method: :get, + uri: "subscribe/payment/reserve/#{reserve_id}" + ) + end + # 자동결제 예약 취소 # Comment by Gosomi # Date: 2022-04-21 diff --git a/lib/bootpay/version.rb b/lib/bootpay/version.rb index ffd65b2..9678d1b 100644 --- a/lib/bootpay/version.rb +++ b/lib/bootpay/version.rb @@ -1,4 +1,4 @@ # frozen_string_literal: true module Bootpay - V2_VERSION = "2.0.2" + V2_VERSION = "2.0.3" end \ No newline at end of file From 77906d587b7f791273919efe5241814b9ac00fdf Mon Sep 17 00:00:00 2001 From: gosomi Date: Tue, 28 Mar 2023 16:23:59 +0900 Subject: [PATCH 055/133] =?UTF-8?q?=EC=A0=95=EA=B8=B0=EA=B2=B0=EC=A0=9C=20?= =?UTF-8?q?metadata=20=EB=B3=B4=EB=82=B4=EA=B8=B0=20=EA=B8=B0=EB=8A=A5=20r?= =?UTF-8?q?est=20api=20=EA=B2=B0=EC=A0=9C=20=EC=9A=94=EC=B2=AD=20=ED=9B=84?= =?UTF-8?q?=20URL=20=EB=B0=9B=EA=B8=B0=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay/concern/payment.rb | 32 +++++++++++++++++++++++++++++ lib/bootpay/concern/subscription.rb | 3 ++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/lib/bootpay/concern/payment.rb b/lib/bootpay/concern/payment.rb index 4dc3ea0..e5556c9 100644 --- a/lib/bootpay/concern/payment.rb +++ b/lib/bootpay/concern/payment.rb @@ -44,5 +44,37 @@ def cancel_payment(cancel_id: nil, receipt_id:, cancel_price: nil, cancel_tax_fr }.compact ) end + + # REST API로 결제 요청하기 + # Comment by Gosomi + # Date: 2023-03-28 + def request_payment(pg:, method: nil, price:, tax_free: 0, order_name:, order_id:, user_token: nil, uuid: nil, sk: nil, + ti: 0, tk: nil, items: [], extra: {}, user: {}, agent: nil) + rand_uuid = SecureRandom.uuid + request( + uri: 'request/payment', + payload: + { + pg: pg, + method: method, + price: price, + tax_free: tax_free, + order_name: order_name, + order_id: order_id, + user_token: user_token, + uuid: uuid.presence || rand_uuid, + sk: sk.presence || "#{rand_uuid}-#{Time.current.to_i}", + ti: ti, + tk: tk.presence || "#{rand_uuid}-#{Time.current.to_i}", + items: items, + extra: extra, + user: user, + __agent: agent, + ver: Bootpay::RestClient::SDK_VERSION, + sdk_version: Bootpay::V2_VERSION + } + ) + + end end end \ No newline at end of file diff --git a/lib/bootpay/concern/subscription.rb b/lib/bootpay/concern/subscription.rb index a7d45f3..bcf3b82 100644 --- a/lib/bootpay/concern/subscription.rb +++ b/lib/bootpay/concern/subscription.rb @@ -16,11 +16,12 @@ def lookup_subscribe_billing_key(receipt_id) # Comment by Gosomi # Date: 2021-11-02 def request_subscribe_card_payment(billing_key:, order_name:, price:, tax_free: 0, card_quota: '00', - card_interest: nil, order_id:, items: [], user: {}, extra: {}) + card_interest: nil, order_id:, items: [], user: {}, extra: {}, metadata: {}) request( uri: 'subscribe/payment', payload: { billing_key: billing_key, + metadata: metadata, order_name: order_name, price: price, tax_free: tax_free, From e151e2b890b03f0e8ab74f76b4ac754ae08dea07 Mon Sep 17 00:00:00 2001 From: gosomi Date: Thu, 13 Apr 2023 12:47:00 +0900 Subject: [PATCH 056/133] =?UTF-8?q?platform=20application=20id=20=EC=A0=84?= =?UTF-8?q?=EC=86=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay/concern/payment.rb | 37 +++++++++++++++++----------------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/lib/bootpay/concern/payment.rb b/lib/bootpay/concern/payment.rb index e5556c9..ab9e4c1 100644 --- a/lib/bootpay/concern/payment.rb +++ b/lib/bootpay/concern/payment.rb @@ -48,30 +48,31 @@ def cancel_payment(cancel_id: nil, receipt_id:, cancel_price: nil, cancel_tax_fr # REST API로 결제 요청하기 # Comment by Gosomi # Date: 2023-03-28 - def request_payment(pg:, method: nil, price:, tax_free: 0, order_name:, order_id:, user_token: nil, uuid: nil, sk: nil, + def request_payment(platform_application_id:, pg:, method: nil, price:, tax_free: 0, order_name:, order_id:, user_token: nil, uuid: nil, sk: nil, ti: 0, tk: nil, items: [], extra: {}, user: {}, agent: nil) rand_uuid = SecureRandom.uuid request( uri: 'request/payment', payload: { - pg: pg, - method: method, - price: price, - tax_free: tax_free, - order_name: order_name, - order_id: order_id, - user_token: user_token, - uuid: uuid.presence || rand_uuid, - sk: sk.presence || "#{rand_uuid}-#{Time.current.to_i}", - ti: ti, - tk: tk.presence || "#{rand_uuid}-#{Time.current.to_i}", - items: items, - extra: extra, - user: user, - __agent: agent, - ver: Bootpay::RestClient::SDK_VERSION, - sdk_version: Bootpay::V2_VERSION + platform_application_id: platform_application_id, + pg: pg, + method: method, + price: price, + tax_free: tax_free, + order_name: order_name, + order_id: order_id, + user_token: user_token, + uuid: uuid.presence || rand_uuid, + sk: sk.presence || "#{rand_uuid}-#{Time.current.to_i}", + ti: ti, + tk: tk.presence || "#{rand_uuid}-#{Time.current.to_i}", + items: items, + extra: extra, + user: user, + __agent: agent, + ver: Bootpay::RestClient::SDK_VERSION, + sdk_version: Bootpay::V2_VERSION } ) From 8e819947e5db0468055968d93f83c5a26da7d37e Mon Sep 17 00:00:00 2001 From: gosomi Date: Thu, 13 Apr 2023 15:12:04 +0900 Subject: [PATCH 057/133] =?UTF-8?q?lookup=20user=20data=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay/concern/payment.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/bootpay/concern/payment.rb b/lib/bootpay/concern/payment.rb index ab9e4c1..2cf5a73 100644 --- a/lib/bootpay/concern/payment.rb +++ b/lib/bootpay/concern/payment.rb @@ -5,10 +5,10 @@ module Bootpay::Concern::Payment # 결제 정보 가져오기 # Comment by Gosomi # Date: 2021-12-08 - def receipt_payment(receipt_id) + def receipt_payment(receipt_id, lookup_user_data = false) request( method: :get, - uri: "receipt/#{receipt_id}" + uri: "receipt/#{receipt_id}?lookup_user_data=#{lookup_user_data}", ) end From 4884d71360b8faa2065dfd1f6bf856c428c8adc6 Mon Sep 17 00:00:00 2001 From: gosomi Date: Fri, 26 May 2023 16:39:29 +0900 Subject: [PATCH 058/133] =?UTF-8?q?api=20url=20=EB=B3=80=EA=B2=BD=20?= =?UTF-8?q?=EA=B0=80=EB=8A=A5=ED=95=98=EB=8F=84=EB=A1=9D=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay-backend-ruby.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/bootpay-backend-ruby.rb b/lib/bootpay-backend-ruby.rb index b7dd131..f1caf50 100644 --- a/lib/bootpay-backend-ruby.rb +++ b/lib/bootpay-backend-ruby.rb @@ -15,7 +15,7 @@ class RestClient development: 'https://dev-api.bootpay.co.kr/v2', stage: 'https://stage-api.bootpay.co.kr/v2', production: 'https://api.bootpay.co.kr/v2' - }.freeze + } SDK_VERSION = '4.2.0' @@ -28,6 +28,13 @@ def initialize(application_id:, private_key:, mode: 'production') raise ArgumentError, "개발환경 mode는 development, stage, production 중에서 선택이 가능합니다." if API[@mode.to_sym].blank? end + # API URL을 변경 + # Comment by GOSOMI + # @date: 2023-05-26 + def set_api_url(url) + API[@mode.to_sym] = url + end + # API 버전을 설정한다 # Comment by Gosomi # Date: 2022-07-29 From 7ab10624edc0f654454b2974f00835dd66141d27 Mon Sep 17 00:00:00 2001 From: gosomi Date: Fri, 26 May 2023 16:40:22 +0900 Subject: [PATCH 059/133] =?UTF-8?q?version=20=EB=B3=80=EA=B2=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay-backend-ruby.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bootpay-backend-ruby.rb b/lib/bootpay-backend-ruby.rb index f1caf50..182b126 100644 --- a/lib/bootpay-backend-ruby.rb +++ b/lib/bootpay-backend-ruby.rb @@ -17,7 +17,7 @@ class RestClient production: 'https://api.bootpay.co.kr/v2' } - SDK_VERSION = '4.2.0' + SDK_VERSION = '4.2.1' def initialize(application_id:, private_key:, mode: 'production') @application_id = application_id From b7d34c921e22776d84084b21436eafa90a3fe3a6 Mon Sep 17 00:00:00 2001 From: gosomi Date: Sat, 27 Jan 2024 06:11:50 +0900 Subject: [PATCH 060/133] =?UTF-8?q?order=5Fid=EB=A1=9C=20=EA=B2=B0?= =?UTF-8?q?=EC=A0=9C=EB=82=B4=EC=97=AD=20=EC=A1=B0=ED=9A=8C=20API=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20=EA=B3=84=EC=A2=8C=EC=9E=90=EB=8F=99?= =?UTF-8?q?=EC=9D=B4=EC=B2=B4=20API=20ARS=20=EB=8F=99=EC=9D=98=20=EC=9A=94?= =?UTF-8?q?=EC=B2=AD=20=EB=B0=8F=20=EC=8A=B9=EC=9D=B8=20=EC=99=84=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay/concern/payment.rb | 36 ++++++++++++++++++++ lib/bootpay/concern/subscription.rb | 53 +++++++++++++++++++++++++++++ 2 files changed, 89 insertions(+) diff --git a/lib/bootpay/concern/payment.rb b/lib/bootpay/concern/payment.rb index 2cf5a73..58c7613 100644 --- a/lib/bootpay/concern/payment.rb +++ b/lib/bootpay/concern/payment.rb @@ -12,6 +12,16 @@ def receipt_payment(receipt_id, lookup_user_data = false) ) end + # OrderId로 결제 정보 조회하기 + # Comment by GOSOMI + # @date: 2024-01-27 + def lookup_order_id(order_id) + request( + method: :get, + uri: "lookup/order/#{order_id}", + ) + end + # 결제 승인처리 # Comment by Gosomi # Date: 2022-01-04 @@ -75,7 +85,33 @@ def request_payment(platform_application_id:, pg:, method: nil, price:, tax_free sdk_version: Bootpay::V2_VERSION } ) + end + # 가상계좌 bulk 발급 요청 + # Comment by GOSOMI + # @date: 2023-08-08 + def request_virtual_account_bulk(pg:, order_id:, order_name:, currency: 'KRW', price:, tax_free: nil, bank_code:, bank_account:, + bank_username:, cash_receipt_type: nil, identity_no: nil, user: {}, metadata: {}, extra: {}) + request( + uri: 'request/virtual-account/bulk', + payload: + { + pg: pg, + order_id: order_id, + order_name: order_name, + currency: currency, + price: price, + tax_free: tax_free, + bank_code: bank_code, + bank_account: bank_account, + bank_username: bank_username, + cash_receipt_type: cash_receipt_type, + identity_no: identity_no, + user: user, + metadata: metadata, + extra: extra + }.compact + ) end end end \ No newline at end of file diff --git a/lib/bootpay/concern/subscription.rb b/lib/bootpay/concern/subscription.rb index bcf3b82..bd3c30b 100644 --- a/lib/bootpay/concern/subscription.rb +++ b/lib/bootpay/concern/subscription.rb @@ -123,6 +123,49 @@ def request_subscribe_billing_key(pg:, order_name:, price: nil, tax_free: nil, s ) end + # 빌링키 발급 요청하기 + # Comment by GOSOMI + # @date: 2024-01-26 + def request_subscribe_automatic_transfer_billing_key(pg:, order_name:, price: nil, tax_free: nil, subscription_id:, + extra: {}, user: {}, metadata: {}, auth_type: 'ARS', username:, + bank_name:, bank_account:, identity_no:, cash_receipt_type: 1, + cash_receipt_number: nil, phone:) + request( + uri: 'request/subscribe/automatic-transfer', + payload: { + pg: pg, + order_name: order_name, + subscription_id: subscription_id, + price: price, + tax_free: tax_free, + extra: extra, + user: user, + metadata: metadata, + auth_type: auth_type, + username: username, + bank_name: bank_name, + bank_account: bank_account, + identity_no: identity_no, + cash_receipt_type: cash_receipt_type, + cash_receipt_number: cash_receipt_number, + phone: phone + } + ) + end + + # ARS나 본인인증 이후 빌링키 발급 + # Comment by GOSOMI + # @date: 2024-01-26 + def publish_automatic_transfer_billing_key(receipt_id:) + request( + method: :post, + uri: "request/subscribe/automatic-transfer/publish", + payload: { + receipt_id: receipt_id + } + ) + end + # 정기결제를 계속해서 진행한다 # Comment by Gosomi # Date: 2022-01-18 @@ -132,5 +175,15 @@ def request_subscribe_on_continue(receipt_id) uri: "request/subscribe/#{receipt_id}" ) end + + # 빌링키로 조회하는 기능을 만든다 + # Comment by GOSOMI + # @date: 2023-09-14 + def lookup_billing_key(billing_key) + request( + method: :get, + uri: "billing_key/#{billing_key}" + ) + end end end \ No newline at end of file From 619dfc147a3d2748314b13df86fdae153ddfe4b5 Mon Sep 17 00:00:00 2001 From: gosomi Date: Fri, 16 Feb 2024 18:12:05 +0900 Subject: [PATCH 061/133] =?UTF-8?q?HTTP=20STATUS=20=EC=84=B1=EA=B3=B5?= =?UTF-8?q?=EC=B2=98=EB=A6=AC=EB=A5=BC=20200=20OK=EB=A1=9C=20=ED=95=9C?= =?UTF-8?q?=EC=A0=95=ED=95=98=EB=8F=84=EB=A1=9D=20=EB=B3=80=EA=B2=BD=20?= =?UTF-8?q?=EA=B0=80=EB=A7=B9=EC=A0=90=20=EC=83=9D=EC=84=B1=20API=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay/concern/reseller.rb | 32 ++++++++++++++++++++++++++++++-- lib/bootpay/concern/rest.rb | 2 +- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/lib/bootpay/concern/reseller.rb b/lib/bootpay/concern/reseller.rb index 10092bc..c4d7184 100644 --- a/lib/bootpay/concern/reseller.rb +++ b/lib/bootpay/concern/reseller.rb @@ -6,7 +6,8 @@ module Bootpay::Concern::Reseller # Comment by Gosomi # Date: 2022-01-05 def create_seller(company_alias:, company_name:, email: nil, regist_no: nil, owner_name: nil, - phone: nil, zip: nil, address1: nil, address2: nil) + phone: nil, zip: nil, address1: nil, address2: nil, app_name: nil, primary_key:, resources: nil, + send_email: false) request( uri: 'reseller/seller', payload: { @@ -18,7 +19,34 @@ def create_seller(company_alias:, company_name:, email: nil, regist_no: nil, own phone: phone, zip: zip, address1: address1, - address2: address2 + address2: address2, + app_name: app_name, + primary_key: primary_key, + resources: resources, + send_email: send_email + } + ) + end + + # 테스트로 생성한 계정을 모두 삭제한다 + # Comment by GOSOMI + # @date: 2023-10-11 + def test_destroy_provider(provider_id) + request( + uri: "reseller/test/seller/#{provider_id}", + method: :delete + ) + end + + # Resource 정보를 갱신한다 + # Comment by GOSOMI + # @date: 2023-10-12 + def update_seller_payment_resources(app_id:, resources:) + request( + uri: "reseller/seller/app/resource/#{app_id}", + method: :put, + payload: { + resources: resources } ) end diff --git a/lib/bootpay/concern/rest.rb b/lib/bootpay/concern/rest.rb index ff4d514..1a2612a 100644 --- a/lib/bootpay/concern/rest.rb +++ b/lib/bootpay/concern/rest.rb @@ -23,7 +23,7 @@ def request(method: :post, uri:, payload: {}, headers: {}) json: payload ) Bootpay::Response.new( - response.status.success?, + response.status.to_i == 200, JSON.parse(response.body.to_s, symbolize_names: true) ) rescue Exception => e From 3ede996ca814c297bc990316b63d241630eee739 Mon Sep 17 00:00:00 2001 From: gosomi Date: Thu, 29 Feb 2024 15:39:17 +0900 Subject: [PATCH 062/133] =?UTF-8?q?cash=5Freceipt=5Fidentity=5Fno=20?= =?UTF-8?q?=ED=8C=8C=EB=9D=BC=EB=A9=94=ED=84=B0=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay/concern/subscription.rb | 34 ++++++++++++++--------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/lib/bootpay/concern/subscription.rb b/lib/bootpay/concern/subscription.rb index bd3c30b..ad6e469 100644 --- a/lib/bootpay/concern/subscription.rb +++ b/lib/bootpay/concern/subscription.rb @@ -129,26 +129,26 @@ def request_subscribe_billing_key(pg:, order_name:, price: nil, tax_free: nil, s def request_subscribe_automatic_transfer_billing_key(pg:, order_name:, price: nil, tax_free: nil, subscription_id:, extra: {}, user: {}, metadata: {}, auth_type: 'ARS', username:, bank_name:, bank_account:, identity_no:, cash_receipt_type: 1, - cash_receipt_number: nil, phone:) + cash_receipt_identity_no: nil, phone:) request( uri: 'request/subscribe/automatic-transfer', payload: { - pg: pg, - order_name: order_name, - subscription_id: subscription_id, - price: price, - tax_free: tax_free, - extra: extra, - user: user, - metadata: metadata, - auth_type: auth_type, - username: username, - bank_name: bank_name, - bank_account: bank_account, - identity_no: identity_no, - cash_receipt_type: cash_receipt_type, - cash_receipt_number: cash_receipt_number, - phone: phone + pg: pg, + order_name: order_name, + subscription_id: subscription_id, + price: price, + tax_free: tax_free, + extra: extra, + user: user, + metadata: metadata, + auth_type: auth_type, + username: username, + bank_name: bank_name, + bank_account: bank_account, + identity_no: identity_no, + cash_receipt_type: cash_receipt_type, + cash_receipt_identity_no: cash_receipt_identity_no, + phone: phone } ) end From b6392a0a6504b9ba49ef45c2f396fa6d1ad3d570 Mon Sep 17 00:00:00 2001 From: gosomi Date: Thu, 2 May 2024 09:33:46 +0900 Subject: [PATCH 063/133] =?UTF-8?q?=EC=B7=A8=EC=86=8C=20=EC=9A=94=EC=B2=AD?= =?UTF-8?q?=EC=9E=90=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay/concern/payment.rb | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/bootpay/concern/payment.rb b/lib/bootpay/concern/payment.rb index 58c7613..fc637bb 100644 --- a/lib/bootpay/concern/payment.rb +++ b/lib/bootpay/concern/payment.rb @@ -38,19 +38,20 @@ def confirm_payment(receipt_id) # Comment by Gosomi # Date: 2021-05-21 def cancel_payment(cancel_id: nil, receipt_id:, cancel_price: nil, cancel_tax_free: nil, cancel_username: '시스템', cancel_message: '결제취소', - refund: { bank_account: nil, bank_username: nil, bank_code: nil }, items: nil) + cancel_requester: '관리자', refund: { bank_account: nil, bank_username: nil, bank_code: nil }, items: nil) request( uri: 'cancel', payload: { - cancel_id: cancel_id.presence || SecureRandom.uuid, - receipt_id: receipt_id, - cancel_price: cancel_price, - cancel_tax_free: cancel_tax_free, - cancel_username: cancel_username, - cancel_message: cancel_message, - refund: refund, - items: items + cancel_id: cancel_id.presence || SecureRandom.uuid, + receipt_id: receipt_id, + cancel_price: cancel_price, + cancel_tax_free: cancel_tax_free, + cancel_username: cancel_username, + cancel_message: cancel_message, + cancel_requester: cancel_requester, + refund: refund, + items: items }.compact ) end From 28cf66b9f788ce91824e128d7303e32339740403 Mon Sep 17 00:00:00 2001 From: gosomi Date: Fri, 3 May 2024 10:00:06 +0900 Subject: [PATCH 064/133] =?UTF-8?q?2.0.4=20=EB=B0=B0=ED=8F=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bootpay/version.rb b/lib/bootpay/version.rb index 9678d1b..ff5d70c 100644 --- a/lib/bootpay/version.rb +++ b/lib/bootpay/version.rb @@ -1,4 +1,4 @@ # frozen_string_literal: true module Bootpay - V2_VERSION = "2.0.3" + V2_VERSION = "2.0.4" end \ No newline at end of file From f40afde8e5201e28ddba74c0cd8d7e4df952d35e Mon Sep 17 00:00:00 2001 From: rupy1014 Date: Wed, 29 May 2024 17:48:16 +0900 Subject: [PATCH 065/133] =?UTF-8?q?-=20=EB=B9=8C=EB=A7=81=EA=B2=B0?= =?UTF-8?q?=EC=A0=9C=20api=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 4 ++ lib/bootpay/concern/subscription.rb | 32 +++++++++++- lib/bootpay/version.rb | 2 +- spec/bootpay/request_token_spec.rb | 7 ++- .../subscribe_automatic_transfer_spec.rb | 50 +++++++++++++++++++ spec/bootpay/subscribe_payment_spec.rb | 31 ++++++++++++ 6 files changed, 121 insertions(+), 5 deletions(-) create mode 100644 spec/bootpay/subscribe_automatic_transfer_spec.rb create mode 100644 spec/bootpay/subscribe_payment_spec.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index f92aaef..81acf4b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +### 2.0.4 +- 빌링결제 api 추가 +- 계좌 빌링 결제 api 추가 + ### 2.0.1 - readme update and republish diff --git a/lib/bootpay/concern/subscription.rb b/lib/bootpay/concern/subscription.rb index ad6e469..7a9d7c2 100644 --- a/lib/bootpay/concern/subscription.rb +++ b/lib/bootpay/concern/subscription.rb @@ -15,7 +15,7 @@ def lookup_subscribe_billing_key(receipt_id) # 빌링키로 결제 요청하기 # Comment by Gosomi # Date: 2021-11-02 - def request_subscribe_card_payment(billing_key:, order_name:, price:, tax_free: 0, card_quota: '00', + def request_subscribe_card_payment(billing_key:, order_name:, price:, tax_free: 0, card_quota: '00', feedback_url: nil, content_type: nil, card_interest: nil, order_id:, items: [], user: {}, extra: {}, metadata: {}) request( uri: 'subscribe/payment', @@ -30,11 +30,39 @@ def request_subscribe_card_payment(billing_key:, order_name:, price:, tax_free: order_id: order_id, items: items, user: user, - extra: extra + extra: extra, + feedback_url: feedback_url, + content_type: content_type } ) end + # 빌링키로 결제 요청하기 + # Comment by ehowlsla + # Date: 2024-05-29 + def request_subscribe_payment(billing_key:, order_name:, price:, tax_free: 0, card_quota: '00', feedback_url: nil, content_type: nil, + card_interest: nil, order_id:, items: [], user: {}, extra: {}, metadata: {}) + request( + uri: 'subscribe/payment', + payload: { + billing_key: billing_key, + metadata: metadata, + order_name: order_name, + price: price, + tax_free: tax_free, + card_quota: card_quota, + card_interest: card_interest, + order_id: order_id, + items: items, + user: user, + extra: extra, + feedback_url: feedback_url, + content_type: content_type + } + ) + end + + # 자동결제 예약 # Comment by Gosomi # Date: 2022-04-21 diff --git a/lib/bootpay/version.rb b/lib/bootpay/version.rb index 9678d1b..ff5d70c 100644 --- a/lib/bootpay/version.rb +++ b/lib/bootpay/version.rb @@ -1,4 +1,4 @@ # frozen_string_literal: true module Bootpay - V2_VERSION = "2.0.3" + V2_VERSION = "2.0.4" end \ No newline at end of file diff --git a/spec/bootpay/request_token_spec.rb b/spec/bootpay/request_token_spec.rb index 0f1c35e..14c45c7 100644 --- a/spec/bootpay/request_token_spec.rb +++ b/spec/bootpay/request_token_spec.rb @@ -3,9 +3,12 @@ RSpec.describe Bootpay::RestClient do it "request token" do api = Bootpay::RestClient.new( - application_id: '59bfc738e13f337dbd6ca48a', - private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', + # application_id: '59bfc738e13f337dbd6ca48a', + # private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', # mode: 'development' + application_id: '65af4990ca8deb00600454bd', + private_key: 'br4IYUBxEE0HnSkwp2e53jD/Cf8RMjzfmopx0gUsr9I=', + mode: 'development' ) response = api.request_access_token print response.data.to_json diff --git a/spec/bootpay/subscribe_automatic_transfer_spec.rb b/spec/bootpay/subscribe_automatic_transfer_spec.rb new file mode 100644 index 0000000..6b9b6ca --- /dev/null +++ b/spec/bootpay/subscribe_automatic_transfer_spec.rb @@ -0,0 +1,50 @@ +# frozen_string_literal: true + +RSpec.describe Bootpay::RestClient do + it "billing key" do + # api = Bootpay::RestClient.new( + # application_id: '59bfc738e13f337dbd6ca48a', + # private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', + # mode: 'development' + # ) + api = Bootpay::RestClient.new( + application_id: '59b731f084382614ebf72215', + private_key: 'WwDv0UjfwFa04wYG0LJZZv1xwraQnlhnHE375n52X0U=', + mode: 'production' + ) + if api.request_access_token.success? + # res1 = api.request_subscribe_automatic_transfer_billing_key( + # pg: 'nicepay', + # order_name: '테스트 결제', + # price: 100, + # tax_free: 0, + # subscription_id: Time.current.to_i, + # username: '윤태섭', + # user: { + # phone: '01040334678', + # username: '윤태섭', + # email: 'ehowlsla@bootpay.co.kr' + # }, + # bank_name: '국민', + # bank_account: '67560101092472', + # identity_no: '8610141038021', + # cash_receipt_identity_no: '01040334678', + # phone: '01040334678', + # ) + # print res1.data.to_json + # + # # {"receipt_id":"662065c244772e8816f0cbfa","order_id":"1713399234","price":100,"tax_free":0,"cancelled_price":0,"cancelled_tax_free":0,"order_name":"테스트 결제","company_name":"주) 부트페이","gateway_url":"https://gw.bootpay.co.kr","metadata":{},"sandbox":true,"pg":"나이스페이먼츠","method":"계좌자동이체","method_symbol":"automatic_transfer_rest","method_origin_symbol":"automatic_transfer_rest","requested_at":"2024-04-18T09:13:54+09:00","status_locale":"자동결제빌링키발급이전","currency":"KRW","status":41} + # + # + # + res2 = api.publish_automatic_transfer_billing_key(receipt_id: res1.data[:receipt_id]) + print "\n\n" + res2.data.to_json + # {"receipt_id":"66206779c5aa1f83acf0cd81","subscription_id":"1713399673","gateway_url":"https://gw.bootpay.co.kr","metadata":{},"pg":"나이스페이먼츠","method":"계좌자동이체","method_symbol":"automatic_transfer_rest","method_origin":"계좌자동이체","method_origin_symbol":"automatic_transfer_rest","published_at":"2024-04-18T09:21:14+09:00","requested_at":"2024-04-18", "status_locale":"빌링키발급완료","status":11,"receipt_data":{"receipt_id":"6620677a433dd52127ced6fb","order_id":"1713399673","price":100,"tax_free":0,"cancelled_price":0,"cancelled_tax_free":0,"order_name":"테스트 결제","company_name":"주) 부트페이","gateway_url":"https://gw.bootpay.co.kr","metadata":{},"sandbox":true,"pg":"나이스페이먼츠","method":"계좌이체","m_origin":"계좌자동이체","method_origin_symbol":"automatic_transfer_rest","purchased_at":"2024-04-18T09:21:14+09:00","requested_at":"2024-04-18T09:21:13+09:00","status_locale":"결제완료","currency":"KRW","receipt_url":"https://door.bootpay.co.kr/receipt/a1BibVBkUlF5T2gvTXU5ajVVTndEQXVPclJDZjhBRitsRGs9LS05S040RGV6%0AR24wOVd1dzdPLS1ROTdSZG56TExXMHRhOHl5NTFXOGtRPT0%3D%0A","status":1,"bank_data":{"tid":"4092114073","bank_code":"004","bank_name":"국민","bank_account":"0000000000000000","bank_username":"윤태*"}},"billing_key":"6620677a433dd52127ced6fc","billing_data":{"bank_name":"국민","bank_code":"004","bank_account":"0000000000000000","username":"윤태*"},"billing_expire_at":"2099-12-31T23:59:59+09:00"} + + # res3 = api.request_subscribe_on_continue('66206779c5aa1f83acf0cd81') + # print res3.data.to_json + # {"error_code":"SUBSCRIBE_PUBLISH_NOT_READY","message":"빌링키 발급 대기 상태가 아닙니다."} + + end + end +end diff --git a/spec/bootpay/subscribe_payment_spec.rb b/spec/bootpay/subscribe_payment_spec.rb new file mode 100644 index 0000000..c908514 --- /dev/null +++ b/spec/bootpay/subscribe_payment_spec.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +RSpec.describe Bootpay::RestClient do + it "billing key" do + # api = Bootpay::RestClient.new( + # application_id: '59bfc738e13f337dbd6ca48a', + # private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', + # mode: 'development' + # ) + api = Bootpay::RestClient.new( + application_id: '5b8f6a4d396fa665fdc2b5ea', + private_key: 'rm6EYECr6aroQVG2ntW0A6LpWnkTgP4uQ3H18sDDUYw=', + mode: 'production' + ) + if api.request_access_token.success? + response = api.request_subscribe_card_payment( + billing_key: '66542dfb4d18d5fc7b43e1b6', + order_name: '테스트결제', + price: 100, + card_quota: '00', + order_id: Time.current.to_i, + user: { + phone: '01000000000', + username: '홍길동', + email: 'test@bootpay.co.kr' + } + ) + print response.data.to_json + end + end +end From f0a12202e2f95b990072805880bb001826360f3e Mon Sep 17 00:00:00 2001 From: rupy1014 Date: Wed, 29 May 2024 17:54:11 +0900 Subject: [PATCH 066/133] =?UTF-8?q?=EB=B9=8C=EB=A7=81=EA=B2=B0=EC=A0=9C=20?= =?UTF-8?q?api=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 2 +- lib/bootpay/version.rb | 2 +- .../subscribe_automatic_transfer_spec.rb | 48 ++++++++----------- 3 files changed, 22 insertions(+), 30 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 81acf4b..db4fbcc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -### 2.0.4 +### 2.0.5 - 빌링결제 api 추가 - 계좌 빌링 결제 api 추가 diff --git a/lib/bootpay/version.rb b/lib/bootpay/version.rb index ff5d70c..8f9a93f 100644 --- a/lib/bootpay/version.rb +++ b/lib/bootpay/version.rb @@ -1,4 +1,4 @@ # frozen_string_literal: true module Bootpay - V2_VERSION = "2.0.4" + V2_VERSION = "2.0.5" end \ No newline at end of file diff --git a/spec/bootpay/subscribe_automatic_transfer_spec.rb b/spec/bootpay/subscribe_automatic_transfer_spec.rb index 6b9b6ca..53fb0ee 100644 --- a/spec/bootpay/subscribe_automatic_transfer_spec.rb +++ b/spec/bootpay/subscribe_automatic_transfer_spec.rb @@ -13,37 +13,29 @@ mode: 'production' ) if api.request_access_token.success? - # res1 = api.request_subscribe_automatic_transfer_billing_key( - # pg: 'nicepay', - # order_name: '테스트 결제', - # price: 100, - # tax_free: 0, - # subscription_id: Time.current.to_i, - # username: '윤태섭', - # user: { - # phone: '01040334678', - # username: '윤태섭', - # email: 'ehowlsla@bootpay.co.kr' - # }, - # bank_name: '국민', - # bank_account: '67560101092472', - # identity_no: '8610141038021', - # cash_receipt_identity_no: '01040334678', - # phone: '01040334678', - # ) - # print res1.data.to_json - # - # # {"receipt_id":"662065c244772e8816f0cbfa","order_id":"1713399234","price":100,"tax_free":0,"cancelled_price":0,"cancelled_tax_free":0,"order_name":"테스트 결제","company_name":"주) 부트페이","gateway_url":"https://gw.bootpay.co.kr","metadata":{},"sandbox":true,"pg":"나이스페이먼츠","method":"계좌자동이체","method_symbol":"automatic_transfer_rest","method_origin_symbol":"automatic_transfer_rest","requested_at":"2024-04-18T09:13:54+09:00","status_locale":"자동결제빌링키발급이전","currency":"KRW","status":41} - # - # - # + res1 = api.request_subscribe_automatic_transfer_billing_key( + pg: 'nicepay', + order_name: '테스트 결제', + price: 100, + tax_free: 0, + subscription_id: Time.current.to_i, + username: '홍길동', + user: { + phone: '01012341234', + username: '홍길동', + email: 'test@bootpay.co.kr' + }, + bank_name: '국민', + bank_account: '675123412342472', + identity_no: '901014', + cash_receipt_identity_no: '01012341234', + phone: '01012341234', + ) + print res1.data.to_json + res2 = api.publish_automatic_transfer_billing_key(receipt_id: res1.data[:receipt_id]) print "\n\n" + res2.data.to_json - # {"receipt_id":"66206779c5aa1f83acf0cd81","subscription_id":"1713399673","gateway_url":"https://gw.bootpay.co.kr","metadata":{},"pg":"나이스페이먼츠","method":"계좌자동이체","method_symbol":"automatic_transfer_rest","method_origin":"계좌자동이체","method_origin_symbol":"automatic_transfer_rest","published_at":"2024-04-18T09:21:14+09:00","requested_at":"2024-04-18", "status_locale":"빌링키발급완료","status":11,"receipt_data":{"receipt_id":"6620677a433dd52127ced6fb","order_id":"1713399673","price":100,"tax_free":0,"cancelled_price":0,"cancelled_tax_free":0,"order_name":"테스트 결제","company_name":"주) 부트페이","gateway_url":"https://gw.bootpay.co.kr","metadata":{},"sandbox":true,"pg":"나이스페이먼츠","method":"계좌이체","m_origin":"계좌자동이체","method_origin_symbol":"automatic_transfer_rest","purchased_at":"2024-04-18T09:21:14+09:00","requested_at":"2024-04-18T09:21:13+09:00","status_locale":"결제완료","currency":"KRW","receipt_url":"https://door.bootpay.co.kr/receipt/a1BibVBkUlF5T2gvTXU5ajVVTndEQXVPclJDZjhBRitsRGs9LS05S040RGV6%0AR24wOVd1dzdPLS1ROTdSZG56TExXMHRhOHl5NTFXOGtRPT0%3D%0A","status":1,"bank_data":{"tid":"4092114073","bank_code":"004","bank_name":"국민","bank_account":"0000000000000000","bank_username":"윤태*"}},"billing_key":"6620677a433dd52127ced6fc","billing_data":{"bank_name":"국민","bank_code":"004","bank_account":"0000000000000000","username":"윤태*"},"billing_expire_at":"2099-12-31T23:59:59+09:00"} - # res3 = api.request_subscribe_on_continue('66206779c5aa1f83acf0cd81') - # print res3.data.to_json - # {"error_code":"SUBSCRIBE_PUBLISH_NOT_READY","message":"빌링키 발급 대기 상태가 아닙니다."} end end From 8e18318ba7c716a0ab007023f3d72defb14cda3b Mon Sep 17 00:00:00 2001 From: gosomi Date: Thu, 27 Jun 2024 16:48:21 +0900 Subject: [PATCH 067/133] =?UTF-8?q?=EB=82=B4=EB=B6=80=EC=9A=A9=20=EC=84=9C?= =?UTF-8?q?=EB=B9=84=EC=8A=A4=20=EC=A7=80=EA=B0=91=20=EA=B0=80=EC=A0=B8?= =?UTF-8?q?=EC=98=A4=EB=8A=94=20API=20=EC=B6=94=EA=B0=80=20version=202.1.0?= =?UTF-8?q?=20=EC=9C=BC=EB=A1=9C=20=EC=97=85=EB=8D=B0=EC=9D=B4=ED=8A=B8=20?= =?UTF-8?q?SDK=5FVERSION=205.0.0=EB=B2=84=EC=A0=84=EC=9C=BC=EB=A1=9C=20?= =?UTF-8?q?=EC=97=85=EA=B7=B8=EB=A0=88=EC=9D=B4=EB=93=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay-backend-ruby.rb | 2 +- lib/bootpay/concern.rb | 2 ++ lib/bootpay/concern/service.rb | 15 +++++++++++++++ lib/bootpay/version.rb | 2 +- 4 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 lib/bootpay/concern/service.rb diff --git a/lib/bootpay-backend-ruby.rb b/lib/bootpay-backend-ruby.rb index 182b126..252a313 100644 --- a/lib/bootpay-backend-ruby.rb +++ b/lib/bootpay-backend-ruby.rb @@ -17,7 +17,7 @@ class RestClient production: 'https://api.bootpay.co.kr/v2' } - SDK_VERSION = '4.2.1' + SDK_VERSION = '5.0.0' def initialize(application_id:, private_key:, mode: 'production') @application_id = application_id diff --git a/lib/bootpay/concern.rb b/lib/bootpay/concern.rb index 3d78f85..c3a335e 100644 --- a/lib/bootpay/concern.rb +++ b/lib/bootpay/concern.rb @@ -9,6 +9,7 @@ module Concern require_relative 'concern/rest' require_relative 'concern/sdk' require_relative 'concern/seller' + require_relative 'concern/service' require_relative 'concern/subscription' require_relative 'concern/token' require_relative 'concern/user_token' @@ -23,6 +24,7 @@ module Concern include Rest include Sdk include Seller + include Service include Subscription include Token include UserToken diff --git a/lib/bootpay/concern/service.rb b/lib/bootpay/concern/service.rb new file mode 100644 index 0000000..b357dd0 --- /dev/null +++ b/lib/bootpay/concern/service.rb @@ -0,0 +1,15 @@ +module Bootpay::Concern::Service + extend ActiveSupport::Concern + + included do + # 등록된 Wallet 정보를 가져온다 + # Comment by GOSOMI + # @date: 2024-06-27 + def lookup_service_wallets + request( + uri: 'seller/service/wallet', + method: :get + ) + end + end +end \ No newline at end of file diff --git a/lib/bootpay/version.rb b/lib/bootpay/version.rb index 8f9a93f..7abff3c 100644 --- a/lib/bootpay/version.rb +++ b/lib/bootpay/version.rb @@ -1,4 +1,4 @@ # frozen_string_literal: true module Bootpay - V2_VERSION = "2.0.5" + V2_VERSION = "2.1.0" end \ No newline at end of file From 1690af9e833efd8878ad80c5653ec14ff34d68e9 Mon Sep 17 00:00:00 2001 From: gosomi Date: Tue, 9 Jul 2024 10:42:08 +0900 Subject: [PATCH 068/133] =?UTF-8?q?=ED=9A=8C=EC=9B=90=EC=A0=95=EB=B3=B4=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C=20API=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay/concern/reseller.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/bootpay/concern/reseller.rb b/lib/bootpay/concern/reseller.rb index c4d7184..e8a7811 100644 --- a/lib/bootpay/concern/reseller.rb +++ b/lib/bootpay/concern/reseller.rb @@ -28,6 +28,16 @@ def create_seller(company_alias:, company_name:, email: nil, regist_no: nil, own ) end + # 가맹점 정보를 조회한다 + # Comment by GOSOMI + # @date: 2024-07-09 + def lookup_seller(provider_id) + request( + method: :get, + uri: "reseller/seller/#{provider_id}", + ) + end + # 테스트로 생성한 계정을 모두 삭제한다 # Comment by GOSOMI # @date: 2023-10-11 From a53d69632f4dd90211790d93ffa00aa01bb1fbf9 Mon Sep 17 00:00:00 2001 From: rupy1014 Date: Fri, 19 Jul 2024 09:50:24 +0900 Subject: [PATCH 069/133] readme update --- README.md | 125 +++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 90 insertions(+), 35 deletions(-) diff --git a/README.md b/README.md index feccf06..1bb1e93 100644 --- a/README.md +++ b/README.md @@ -8,28 +8,33 @@ Ruby 언어로 작성된 어플리케이션, 프레임워크 등에서 사용가 * 결제 검증 및 취소, 빌링키 발급, 본인인증 등의 수행은 서버사이드에서 진행됩니다. (Java, PHP, Python, Ruby, Node.js, Go, ASP.NET 등) -## 기능 -1. (부트페이 통신을 위한) 토큰 발급 -2. 결제 단건 조회 -3. 결제 취소 (전액 취소 / 부분 취소) -4. 신용카드 자동결제 (빌링결제) +## 목차 +- [사용하기](#사용하기) + - [1. 토큰 발급](#1-토큰-발급) + - [2. 결제 단건 조회](#2-결제-단건-조회) + - [3. 결제 취소 (전액 취소 / 부분 취소)](#3-결제-취소-전액-취소--부분-취소) + - [4. 자동/빌링/정기 결제](#4-자동빌링정기-결제) + - [4-1. 카드 빌링키 발급](#4-1-카드-빌링키-발급) + - [4-2. 계좌 빌링키 발급](#4-2-계좌-빌링키-발급) + - [4-3. 결제 요청하기](#4-3-결제-요청하기) + - [4-4. 결제 예약하기](#4-4-결제-예약하기) + - [4-5. 예약 조회하기](#4-5-예약-조회하기) + - [4-6. 예약 취소하기](#4-6-예약-취소하기) + - [4-7. 빌링키 삭제하기](#4-7-빌링키-삭제하기) + - [4-8. 빌링키 조회하기](#4-8-빌링키-조회하기) + - [5. 회원 토큰 발급요청](#5-회원-토큰-발급요청) + - [6. 서버 승인 요청](#6-서버-승인-요청) + - [7. 본인 인증 결과 조회](#7-본인-인증-결과-조회) + - [8. 에스크로 이용시 PG사로 배송정보 보내기](#8-에스크로-이용시-pg사로-배송정보-보내기) + - [9-1. 현금영수증 발행하기](#9-1-현금영수증-발행하기) + - [9-2. 현금영수증 발행 취소](#9-2-현금영수증-발행-취소) + - [9-3. 별건 현금영수증 발행](#9-3-별건-현금영수증-발행) + - [9-4. 별건 현금영수증 발행 취소](#9-4-별건-현금영수증-발행-취소) +- [Example 프로젝트](#example-프로젝트) +- [Documentation](#documentation) +- [기술문의](#기술문의) +- [License](#license) - 4-1. 빌링키 발급 - - 4-2. 발급된 빌링키로 결제 승인 요청 - - 4-3. 발급된 빌링키로 결제 예약 요청 - - 4-4. 발급된 빌링키로 결제 예약 - 취소 요청 - - 4-5. 빌링키 삭제 - - 4-6. 빌링키 조회 - -5. (생체인증, 비밀번호 결제를 위한) 구매자 토큰 발급 -6. 서버 승인 요청 -7. 본인 인증 결과 조회 -8. (에스크로 이용시) PG사로 배송정보 보내기 ## Gem으로 설치하기 @@ -68,7 +73,7 @@ end 함수 단위의 샘플 코드는 [이곳](https://github.com/bootpay/backend-ruby/tree/2-x-development/spec/bootpay)을 참조하세요. -## 1. (부트페이 통신을 위한) 토큰 발급 +## 1. 토큰 발급 부트페이와 서버간 통신을 하기 위해서는 부트페이 서버로부터 토큰을 발급받아야 합니다. 발급된 토큰은 30분간 유효하며, 최초 발급일로부터 30분이 지날 경우 토큰 발급 함수를 재호출 해주셔야 합니다. @@ -125,7 +130,7 @@ if api.request_access_token.success? end ``` -## 4-1. 빌링키 발급 +## 4-1. 카드 빌링키 발급 REST API 방식으로 고객의 카드 정보를 전달하여, PG사로부터 빌링키를 발급받을 수 있습니다. (부트페이에서는 PG사의 빌링키를 개발사에게 전달하지 않고, 부트페이가 내부적으로 발급한 빌링키를 전달합니다) 발급받은 빌링키를 저장하고 있다가, 원하는 시점, 원하는 금액에 결제 승인 요청하여 좀 더 자유로운 결제시나리오에 적용이 가능합니다. * 비인증 정기결제(REST API) 방식을 지원하는 PG사만 사용 가능합니다. @@ -151,7 +156,40 @@ end ``` -## 4-2. 발급된 빌링키로 결제 승인 요청 + +## 4-2. 계좌 빌링키 발급 +REST API 방식으로 고객의 계좌 정보를 전달하여, PG사에게 빌링키 발급을 요청합니다. 요청 후 빌링키가 바로 발급되진 않고, 출금동의 확인 절차까지 진행해야 빌링키가 발급됩니다. +먼저 빌링키를 요청합니다. +```ruby +res1 = api.request_subscribe_automatic_transfer_billing_key( + pg: 'nicepay', + order_name: '테스트 결제', + price: 100, + tax_free: 0, + subscription_id: Time.current.to_i, + username: '홍길동', + user: { + phone: '01012341234', + username: '홍길동', + email: 'test@bootpay.co.kr' + }, + bank_name: '국민', + bank_account: '675123412342472', + identity_no: '901014', + cash_receipt_identity_no: '01012341234', + phone: '01012341234', + ) + print res1.data.to_json +``` +이후 빌링키 발급 요청시 응답받은 receipt_id로, 출금 동의 확인을 요청합니다. + +```ruby +res2 = api.publish_automatic_transfer_billing_key(receipt_id: res1.data[:receipt_id]) +print "\n\n" + res2.data.to_json +``` + + +## 4-3. 결제 요청하기 발급된 빌링키로 원하는 시점에 원하는 금액으로 결제 승인 요청을 할 수 있습니다. 잔액이 부족하거나 도난 카드 등의 특별한 건이 아니면 PG사에서 결제를 바로 승인합니다. ```ruby @@ -175,7 +213,7 @@ if api.request_access_token.success? puts response.data.to_json end ``` -## 4-3. 발급된 빌링키로 결제 예약 요청 +## 4-4. 결제 예약하기 원하는 시점에 4-1로 결제 승인 요청을 보내도 되지만, 빌링키 발급 이후에 바로 결제 예약 할 수 있습니다. (빌링키당 최대 10건) ```ruby api = Bootpay::RestClient.new( @@ -198,8 +236,24 @@ if api.request_access_token.success? print response.data.to_json end ``` -## 4-4. 발급된 빌링키로 결제 예약 - 취소 요청 -빌링키로 예약된 결제건을 취소합니다. + +## 4-5. 예약 조회하기 +예약시 응답받은 reserveId로 예약된 건을 조회합니다. +```ruby +api = Bootpay::RestClient.new( + application_id: '59bfc738e13f337dbd6ca48a', + private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=' +) +if api.request_access_token.success? + reserve_id = "628c0d0d1fc19202e5ef2866" + response = api.subscribe_payment_reserve_lookup(reserve_id) + print response.data.to_json +``` + + + +## 4-6. 예약 취소하기 +예약시 응답받은 reserveId로 예약된 건을 취소합니다. ```ruby api = Bootpay::RestClient.new( application_id: '59bfc738e13f337dbd6ca48a', @@ -226,8 +280,8 @@ if api.request_access_token.success? end end ``` -## 4-5. 빌링키 삭제 -발급된 빌링키가 더 이상 사용되지 않도록, 삭제 요청합니다. +## 4-7. 빌링키 삭제하기 +발급된 빌링키를 삭제합니다. 삭제하더라도 예약된 결제건은 취소되지 않습니다. 예약된 결제건 취소를 원하시면 예약 취소하기를 요청하셔야 합니다. ```ruby api = Bootpay::RestClient.new( application_id: '59bfc738e13f337dbd6ca48a', @@ -241,8 +295,9 @@ if api.request_access_token.success? end ``` -## 4-6. 빌링키 조회 -(빌링키 발급 완료시 리턴받았던 receipt_id에 한정) 어떤 빌링키였는지 조회합니다. +## 4-8. 빌링키 조회하기 +클라이언트에서 빌링키 발급시, 보안상 클라이언트 이벤트에 빌링키를 전달해주지 않습니다. 그러므로 이 API를 통해 조회해야 합니다. +다음은 빌링키 발급 요청했던 receiptId 로 빌링키를 조회합니다. ```ruby api = Bootpay::RestClient.new( application_id: '59bfc738e13f337dbd6ca48a', @@ -256,9 +311,9 @@ if api.request_access_token.success? end ``` -## 5. (생체인증, 비밀번호 결제를 위한) 구매자 토큰 발급 -부트페이에서 제공하는 간편결제창, 생체인증 기반의 결제 사용을 위해서는 개발사에서 회원 고유번호를 관리해야하며, 해당 회원에 대한 사용자 토큰을 발급합니다. -이 토큰값을 기반으로 클라이언트에서 결제요청 하시면 되겠습니다. +## 5. 회원 토큰 발급요청 +ㅇㅇ페이 사용을 위해 가맹점 회원의 토큰을 발급합니다. 가맹점은 회원의 고유번호를 관리해야합니다. +이 토큰값을 기반으로 클라이언트에서 결제요청(payload.user_token) 하시면 되겠습니다. ```ruby api = Bootpay::RestClient.new( application_id: '59bfc738e13f337dbd6ca48a', @@ -344,7 +399,7 @@ end ## Documentation -[부트페이 개발매뉴얼](https://docs.bootpay.co.kr/next/)을 참조해주세요 +[부트페이 개발매뉴얼](https://developer.bootpay.co.kr/)을 참조해주세요 ## 기술문의 From a3f8df595ce0a4eca803dcf75fda4ca84e055916 Mon Sep 17 00:00:00 2001 From: gosomi Date: Mon, 22 Jul 2024 10:31:42 +0900 Subject: [PATCH 070/133] =?UTF-8?q?=EC=9C=84=EC=A0=AF=20=ED=8F=AC=ED=95=A8?= =?UTF-8?q?=20=EA=B2=B0=EC=A0=9C=20=EC=9A=94=EC=B2=AD=20=EA=B4=80=EB=A0=A8?= =?UTF-8?q?=20=ED=8C=8C=EB=9D=BC=EB=A9=94=ED=84=B0=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay/concern/payment.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/bootpay/concern/payment.rb b/lib/bootpay/concern/payment.rb index fc637bb..d41b3cd 100644 --- a/lib/bootpay/concern/payment.rb +++ b/lib/bootpay/concern/payment.rb @@ -60,7 +60,7 @@ def cancel_payment(cancel_id: nil, receipt_id:, cancel_price: nil, cancel_tax_fr # Comment by Gosomi # Date: 2023-03-28 def request_payment(platform_application_id:, pg:, method: nil, price:, tax_free: 0, order_name:, order_id:, user_token: nil, uuid: nil, sk: nil, - ti: 0, tk: nil, items: [], extra: {}, user: {}, agent: nil) + ti: 0, tk: nil, items: [], extra: {}, user: {}, agent: nil, commerce_keys: nil, wallet_id: nil, terms: [], widget_key: nil, widget_sandbox: false) rand_uuid = SecureRandom.uuid request( uri: 'request/payment', @@ -74,6 +74,11 @@ def request_payment(platform_application_id:, pg:, method: nil, price:, tax_free order_name: order_name, order_id: order_id, user_token: user_token, + wallet_id: wallet_id, + commerce_keys: commerce_keys, + terms: terms, + widget_key: widget_key, + widget_sandbox: widget_sandbox, uuid: uuid.presence || rand_uuid, sk: sk.presence || "#{rand_uuid}-#{Time.current.to_i}", ti: ti, From b5e51e5ac47f2d5ed6f820f76863d267cc0c5132 Mon Sep 17 00:00:00 2001 From: gosomi Date: Mon, 22 Jul 2024 12:43:13 +0900 Subject: [PATCH 071/133] =?UTF-8?q?redirect=5Furl=20=ED=8C=8C=EB=9D=BC?= =?UTF-8?q?=EB=A9=94=ED=84=B0=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay/concern/payment.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/bootpay/concern/payment.rb b/lib/bootpay/concern/payment.rb index d41b3cd..9534142 100644 --- a/lib/bootpay/concern/payment.rb +++ b/lib/bootpay/concern/payment.rb @@ -60,7 +60,8 @@ def cancel_payment(cancel_id: nil, receipt_id:, cancel_price: nil, cancel_tax_fr # Comment by Gosomi # Date: 2023-03-28 def request_payment(platform_application_id:, pg:, method: nil, price:, tax_free: 0, order_name:, order_id:, user_token: nil, uuid: nil, sk: nil, - ti: 0, tk: nil, items: [], extra: {}, user: {}, agent: nil, commerce_keys: nil, wallet_id: nil, terms: [], widget_key: nil, widget_sandbox: false) + ti: 0, tk: nil, items: [], extra: {}, user: {}, agent: nil, commerce_keys: nil, wallet_id: nil, terms: [], widget_key: nil, widget_sandbox: false, + redirect_url: nil) rand_uuid = SecureRandom.uuid request( uri: 'request/payment', @@ -77,6 +78,7 @@ def request_payment(platform_application_id:, pg:, method: nil, price:, tax_free wallet_id: wallet_id, commerce_keys: commerce_keys, terms: terms, + redirect_url: redirect_url, widget_key: widget_key, widget_sandbox: widget_sandbox, uuid: uuid.presence || rand_uuid, From 2f1f3fa6d6defe82a55905ee82109987d8727c5b Mon Sep 17 00:00:00 2001 From: gosomi Date: Mon, 22 Jul 2024 13:06:48 +0900 Subject: [PATCH 072/133] =?UTF-8?q?=ED=8C=8C=EB=9D=BC=EB=A9=94=ED=84=B0=20?= =?UTF-8?q?=EC=98=A4=ED=83=80=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay/concern/payment.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/bootpay/concern/payment.rb b/lib/bootpay/concern/payment.rb index 9534142..fbf6278 100644 --- a/lib/bootpay/concern/payment.rb +++ b/lib/bootpay/concern/payment.rb @@ -60,7 +60,7 @@ def cancel_payment(cancel_id: nil, receipt_id:, cancel_price: nil, cancel_tax_fr # Comment by Gosomi # Date: 2023-03-28 def request_payment(platform_application_id:, pg:, method: nil, price:, tax_free: 0, order_name:, order_id:, user_token: nil, uuid: nil, sk: nil, - ti: 0, tk: nil, items: [], extra: {}, user: {}, agent: nil, commerce_keys: nil, wallet_id: nil, terms: [], widget_key: nil, widget_sandbox: false, + ti: 0, tk: nil, items: [], extra: {}, user: {}, agent: nil, commission_keys: nil, wallet_id: nil, terms: [], widget_key: nil, widget_sandbox: false, redirect_url: nil) rand_uuid = SecureRandom.uuid request( @@ -76,7 +76,7 @@ def request_payment(platform_application_id:, pg:, method: nil, price:, tax_free order_id: order_id, user_token: user_token, wallet_id: wallet_id, - commerce_keys: commerce_keys, + commission_keys: commission_keys, terms: terms, redirect_url: redirect_url, widget_key: widget_key, From 875e50293831926d9676cab0b2b41d1332803b1c Mon Sep 17 00:00:00 2001 From: gosomi Date: Wed, 28 Aug 2024 09:43:57 +0900 Subject: [PATCH 073/133] =?UTF-8?q?=EC=A0=95=EA=B8=B0=EA=B2=B0=EC=A0=9C=20?= =?UTF-8?q?=EA=B3=84=EC=A2=8C=EC=9D=B4=EC=B2=B4=20=EA=B4=80=EB=A0=A8=20?= =?UTF-8?q?=ED=95=A8=EC=88=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay/concern/cash_receipt.rb | 7 +++++-- lib/bootpay/concern/subscription.rb | 7 +++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/bootpay/concern/cash_receipt.rb b/lib/bootpay/concern/cash_receipt.rb index a283173..317a540 100644 --- a/lib/bootpay/concern/cash_receipt.rb +++ b/lib/bootpay/concern/cash_receipt.rb @@ -45,18 +45,21 @@ def cancel_cash_receipt(receipt_id:, cancel_username:, cancel_message:) # 결제된 계좌이체/가상계좌 결제건중 누락된 현금영수증을 발행해주는 API # Comment by Gosomi # Date: 2022-07-21 - def cash_receipt_publish_on_receipt(receipt_id:, username:, email:, phone:, identity_no:, currency: 'WON', cash_receipt_type: '소득공제') + def cash_receipt_publish_on_receipt(receipt_id:, username:, email:, phone:, identity_no:, currency: 'WON', + cash_receipt_type: '소득공제', pg: nil, test_production: false) request( method: :post, uri: "request/receipt/cash/publish", payload: { + pg: pg, receipt_id: receipt_id, username: username, email: email, phone: phone, identity_no: identity_no, currency: currency, - cash_receipt_type: cash_receipt_type + cash_receipt_type: cash_receipt_type, + test_production: test_production } ) end diff --git a/lib/bootpay/concern/subscription.rb b/lib/bootpay/concern/subscription.rb index 7a9d7c2..d488b98 100644 --- a/lib/bootpay/concern/subscription.rb +++ b/lib/bootpay/concern/subscription.rb @@ -204,6 +204,13 @@ def request_subscribe_on_continue(receipt_id) ) end + def request_subscribe_automatic_transfer_on_continue(receipt_id) + request( + method: :put, + uri: "request/subscribe/automatic-transfer/#{receipt_id}" + ) + end + # 빌링키로 조회하는 기능을 만든다 # Comment by GOSOMI # @date: 2023-09-14 From 6e1a085bcd7bf4290daa9b951a4a0c894b9806d2 Mon Sep 17 00:00:00 2001 From: gosomi Date: Wed, 12 Feb 2025 13:44:46 +0900 Subject: [PATCH 074/133] =?UTF-8?q?=EC=A7=80=EA=B0=91=20=EA=B2=B0=EC=A0=9C?= =?UTF-8?q?=20API=20=EC=B6=94=EA=B0=80=20=EC=99=84=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 +- lib/bootpay/concern.rb | 2 ++ lib/bootpay/concern/wallet.rb | 27 +++++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 lib/bootpay/concern/wallet.rb diff --git a/.gitignore b/.gitignore index 49d2226..902cefd 100644 --- a/.gitignore +++ b/.gitignore @@ -13,7 +13,7 @@ *.iml *.gem Gemfile.lock -/spec/bootpay/request_rest_billing_key_spec.rb +/spec/bootpay/card_billing/request_rest_billing_key_spec.rb /spec/bootpay/__stage_test_unit_spec.rb /spec/bootpay/__development_test_unit_spec.rb .DS_Store \ No newline at end of file diff --git a/lib/bootpay/concern.rb b/lib/bootpay/concern.rb index c3a335e..6cf48e9 100644 --- a/lib/bootpay/concern.rb +++ b/lib/bootpay/concern.rb @@ -13,6 +13,7 @@ module Concern require_relative 'concern/subscription' require_relative 'concern/token' require_relative 'concern/user_token' + require_relative 'concern/wallet' require_relative 'concern/webhook' include Authenticate @@ -28,6 +29,7 @@ module Concern include Subscription include Token include UserToken + include Wallet include Webhook end end \ No newline at end of file diff --git a/lib/bootpay/concern/wallet.rb b/lib/bootpay/concern/wallet.rb new file mode 100644 index 0000000..3995f96 --- /dev/null +++ b/lib/bootpay/concern/wallet.rb @@ -0,0 +1,27 @@ +module Bootpay::Concern::Wallet + extend ActiveSupport::Concern + + included do + # 설정된 wallet 기준으로 결제를 진행한다 + def request_wallet_payment(user_id:, order_name:, price:, tax_free: 0, webhook_url: nil, content_type: nil, order_id:, + items: [], user: {}, extra: {}, metadata: {}, sandbox: false) + request( + uri: 'wallet/payment', + payload: { + user_id: user_id, + order_name: order_name, + price: price, + tax_free: tax_free, + webhook_url: webhook_url, + content_type: content_type, + order_id: order_id, + items: items, + user: user, + extra: extra, + metadata: metadata, + sandbox: sandbox + } + ) + end + end +end \ No newline at end of file From 89d476311af015a4085b5c0fe479997f9421686a Mon Sep 17 00:00:00 2001 From: gosomi Date: Fri, 14 Feb 2025 09:20:15 +0900 Subject: [PATCH 075/133] =?UTF-8?q?request=20get=20parameters=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20=EC=A7=80=EA=B0=91=20=EB=82=B4=EC=97=AD=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=20API=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay/concern/rest.rb | 5 +++-- lib/bootpay/concern/wallet.rb | 16 +++++++++++++++- lib/bootpay/version.rb | 2 +- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/lib/bootpay/concern/rest.rb b/lib/bootpay/concern/rest.rb index 1a2612a..abb0f4b 100644 --- a/lib/bootpay/concern/rest.rb +++ b/lib/bootpay/concern/rest.rb @@ -7,7 +7,7 @@ module Bootpay::Concern::Rest # HTTP Request 기본 Method # Comment by Gosomi # Date: 2021-05-21 - def request(method: :post, uri:, payload: {}, headers: {}) + def request(method: :post, uri:, payload: {}, headers: {}, params: nil) response = HTTP.headers( { Authorization: "Bearer #{@token}", @@ -20,7 +20,8 @@ def request(method: :post, uri:, payload: {}, headers: {}) ).send( method.to_sym, [Bootpay::RestClient::API[@mode.to_sym], uri].join('/'), - json: payload + json: payload, + params: params ) Bootpay::Response.new( response.status.to_i == 200, diff --git a/lib/bootpay/concern/wallet.rb b/lib/bootpay/concern/wallet.rb index 3995f96..86294f2 100644 --- a/lib/bootpay/concern/wallet.rb +++ b/lib/bootpay/concern/wallet.rb @@ -4,7 +4,7 @@ module Bootpay::Concern::Wallet included do # 설정된 wallet 기준으로 결제를 진행한다 def request_wallet_payment(user_id:, order_name:, price:, tax_free: 0, webhook_url: nil, content_type: nil, order_id:, - items: [], user: {}, extra: {}, metadata: {}, sandbox: false) + items: [], user: {}, extra: {}, metadata: {}, sandbox: false) request( uri: 'wallet/payment', payload: { @@ -23,5 +23,19 @@ def request_wallet_payment(user_id:, order_name:, price:, tax_free: 0, webhook_u } ) end + + # 등록된 회원의 지갑 정보를 가져온다 + # Comment by GOSOMI + # @date: 2025-02-13 + def user_wallets(user_id:, sandbox:) + request( + uri: 'wallet', + method: :get, + params: { + user_id: user_id, + sandbox: sandbox + } + ) + end end end \ No newline at end of file diff --git a/lib/bootpay/version.rb b/lib/bootpay/version.rb index 7abff3c..fed86f2 100644 --- a/lib/bootpay/version.rb +++ b/lib/bootpay/version.rb @@ -1,4 +1,4 @@ # frozen_string_literal: true module Bootpay - V2_VERSION = "2.1.0" + V2_VERSION = "2.1.1" end \ No newline at end of file From 86413939f1a7fcf9140f2bf8badfb6e9131a0f5c Mon Sep 17 00:00:00 2001 From: rupy1014 Date: Fri, 14 Feb 2025 17:23:23 +0900 Subject: [PATCH 076/133] spec update --- .../bootpay/subscribe_payment_reserve_spec.rb | 10 ++++---- spec/bootpay/subscribe_payment_spec.rb | 2 +- spec/bootpay/user_wallets_spec.rb | 23 +++++++++++++++++++ 3 files changed, 29 insertions(+), 6 deletions(-) create mode 100644 spec/bootpay/user_wallets_spec.rb diff --git a/spec/bootpay/subscribe_payment_reserve_spec.rb b/spec/bootpay/subscribe_payment_reserve_spec.rb index 3391d1c..e44abfc 100644 --- a/spec/bootpay/subscribe_payment_reserve_spec.rb +++ b/spec/bootpay/subscribe_payment_reserve_spec.rb @@ -3,9 +3,9 @@ RSpec.describe Bootpay::RestClient do it "billing key" do api = Bootpay::RestClient.new( - application_id: '59bfc738e13f337dbd6ca48a', - private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', - mode: 'development' + application_id: '5b8f6a4d396fa665fdc2b5ea', + private_key: 'rm6EYECr6aroQVG2ntW0A6LpWnkTgP4uQ3H18sDDUYw=', + mode: 'production' ) # api = Bootpay::RestClient.new( # application_id: '59b731f084382614ebf72215', @@ -15,7 +15,7 @@ if api.request_access_token.success? response = api.subscribe_payment_reserve( # billing_key: '62820fa61fc19202e5ef240e', - billing_key: '62d903671fc192036b1b3b56', + billing_key: '66f9da41e1afdbe0495e6526', order_name: '테스트결제', price: 100, order_id: Time.current.to_i, @@ -24,7 +24,7 @@ username: '홍길동', email: 'test@bootpay.co.kr' }, - reserve_execute_at: (Time.current + 5000.seconds).iso8601 + reserve_execute_at: (Time.current + 5.seconds).iso8601 ) print response.data.to_json end diff --git a/spec/bootpay/subscribe_payment_spec.rb b/spec/bootpay/subscribe_payment_spec.rb index c908514..0692513 100644 --- a/spec/bootpay/subscribe_payment_spec.rb +++ b/spec/bootpay/subscribe_payment_spec.rb @@ -14,7 +14,7 @@ ) if api.request_access_token.success? response = api.request_subscribe_card_payment( - billing_key: '66542dfb4d18d5fc7b43e1b6', + billing_key: '66f9da41e1afdbe0495e6526', order_name: '테스트결제', price: 100, card_quota: '00', diff --git a/spec/bootpay/user_wallets_spec.rb b/spec/bootpay/user_wallets_spec.rb new file mode 100644 index 0000000..f6a3d9c --- /dev/null +++ b/spec/bootpay/user_wallets_spec.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +RSpec.describe Bootpay::RestClient do + it "billing key" do + # api = Bootpay::RestClient.new( + # application_id: '59bfc738e13f337dbd6ca48a', + # private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', + # mode: 'development' + # ) + api = Bootpay::RestClient.new( + application_id: '5b8f6a4d396fa665fdc2b5ea', + private_key: 'rm6EYECr6aroQVG2ntW0A6LpWnkTgP4uQ3H18sDDUYw=', + mode: 'production' + ) + if api.request_access_token.success? + response = api.user_wallets( + user_id: 'bootpay', + sandbox: true + ) + print response.data.to_json + end + end +end From 78ca613d7846f91a4e8a3ef2fc565095aabd3d8c Mon Sep 17 00:00:00 2001 From: rupy1014 Date: Wed, 26 Mar 2025 17:10:28 +0900 Subject: [PATCH 077/133] store, storage api added --- bootpay-backend-ruby.gemspec | 2 +- .../bootpay-rest-client.rb} | 4 +- lib/{ => bootpay}/response.rb | 0 .../bootpay-storage-rest-client.rb | 46 +++++++++ lib/bootpay_storage/concern.rb | 10 ++ lib/bootpay_storage/concern/image.rb | 19 ++++ lib/bootpay_storage/concern/rest.rb | 88 ++++++++++++++++++ lib/bootpay_storage/concern/token.rb | 9 ++ lib/bootpay_storage/response.rb | 14 +++ .../bootpay-store-rest-client.rb | 46 +++++++++ lib/bootpay_store/concern.rb | 35 +++++++ lib/bootpay_store/concern/rest.rb | 38 ++++++++ lib/bootpay_store/concern/token.rb | 24 +++++ lib/bootpay_store/response.rb | 14 +++ lib/{bootpay => }/version.rb | 2 +- spec/bootpay/rest/client_spec.rb | 2 +- spec/bootpay_storage/image_spec.rb | 27 ++++++ spec/bootpay_store/token_spec.rb | 13 +++ spec/fixtures/logo.png | Bin 0 -> 25210 bytes spec/spec_helper.rb | 4 +- 20 files changed, 391 insertions(+), 6 deletions(-) rename lib/{bootpay-backend-ruby.rb => bootpay/bootpay-rest-client.rb} (94%) rename lib/{ => bootpay}/response.rb (100%) create mode 100644 lib/bootpay_storage/bootpay-storage-rest-client.rb create mode 100644 lib/bootpay_storage/concern.rb create mode 100644 lib/bootpay_storage/concern/image.rb create mode 100644 lib/bootpay_storage/concern/rest.rb create mode 100644 lib/bootpay_storage/concern/token.rb create mode 100644 lib/bootpay_storage/response.rb create mode 100644 lib/bootpay_store/bootpay-store-rest-client.rb create mode 100644 lib/bootpay_store/concern.rb create mode 100644 lib/bootpay_store/concern/rest.rb create mode 100644 lib/bootpay_store/concern/token.rb create mode 100644 lib/bootpay_store/response.rb rename lib/{bootpay => }/version.rb (67%) create mode 100644 spec/bootpay_storage/image_spec.rb create mode 100644 spec/bootpay_store/token_spec.rb create mode 100644 spec/fixtures/logo.png diff --git a/bootpay-backend-ruby.gemspec b/bootpay-backend-ruby.gemspec index 5a213c1..abf2d08 100644 --- a/bootpay-backend-ruby.gemspec +++ b/bootpay-backend-ruby.gemspec @@ -1,6 +1,6 @@ # frozen_string_literal: true -require_relative "lib/bootpay/version" +require_relative "lib/version" Gem::Specification.new do |spec| spec.name = "bootpay-backend-ruby" diff --git a/lib/bootpay-backend-ruby.rb b/lib/bootpay/bootpay-rest-client.rb similarity index 94% rename from lib/bootpay-backend-ruby.rb rename to lib/bootpay/bootpay-rest-client.rb index 252a313..07f4986 100644 --- a/lib/bootpay-backend-ruby.rb +++ b/lib/bootpay/bootpay-rest-client.rb @@ -3,8 +3,8 @@ require 'active_support/all' require 'http' require_relative 'response' -require_relative 'bootpay/version' -require_relative 'bootpay/concern' +require_relative '../version' +require_relative 'concern' module Bootpay class RestClient diff --git a/lib/response.rb b/lib/bootpay/response.rb similarity index 100% rename from lib/response.rb rename to lib/bootpay/response.rb diff --git a/lib/bootpay_storage/bootpay-storage-rest-client.rb b/lib/bootpay_storage/bootpay-storage-rest-client.rb new file mode 100644 index 0000000..2ef7e82 --- /dev/null +++ b/lib/bootpay_storage/bootpay-storage-rest-client.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +require 'active_support/all' +require 'http' +require_relative 'response' +require_relative '../version' +require_relative 'concern' + +module BootpayStorage + class RestClient + include Concern + + API = + { + development: 'https://dev-s.bootapi.com/api/v1', + stage: 'https://stage-s.bootapi.com/api/v1', + production: 'https://s.bootapi.com/api/v1', + } + + SDK_VERSION = '5.0.0' + + def initialize(server_key:, private_key:, mode: 'production') + @server_key = server_key + @private_key = private_key + @mode = mode.presence || 'production' + @token = nil + @api_version = SDK_VERSION + raise ArgumentError, "개발환경 mode는 development, stage, production 중에서 선택이 가능합니다." if API[@mode.to_sym].blank? + end + + # API URL을 변경 + # Comment by GOSOMI + # @date: 2023-05-26 + def set_api_url(url) + API[@mode.to_sym] = url + end + + # API 버전을 설정한다 + # Comment by Gosomi + # Date: 2022-07-29 + def set_api_version(version) + raise ArgumentError, 'API Version은 4.0.0 이상만 설정이 가능합니다.' if version < '4.0.0' + @api_version = version + end + end +end diff --git a/lib/bootpay_storage/concern.rb b/lib/bootpay_storage/concern.rb new file mode 100644 index 0000000..ab04914 --- /dev/null +++ b/lib/bootpay_storage/concern.rb @@ -0,0 +1,10 @@ +module BootpayStorage + module Concern + require_relative 'concern/rest' + require_relative 'concern/token' + require_relative 'concern/image' + include Rest + include Image + include Token + end +end \ No newline at end of file diff --git a/lib/bootpay_storage/concern/image.rb b/lib/bootpay_storage/concern/image.rb new file mode 100644 index 0000000..4792a63 --- /dev/null +++ b/lib/bootpay_storage/concern/image.rb @@ -0,0 +1,19 @@ +module BootpayStorage::Concern::Image + extend ActiveSupport::Concern + + included do + + + # REST API로 본인인증 요청하기 + # Comment by Gosomi + # Date: 2022-11-02 + def image_upload(image_data:, image_name:) + upload( + uri: 'images', + image_data: image_data, + image_name: image_name + ) + end + + end +end \ No newline at end of file diff --git a/lib/bootpay_storage/concern/rest.rb b/lib/bootpay_storage/concern/rest.rb new file mode 100644 index 0000000..743c395 --- /dev/null +++ b/lib/bootpay_storage/concern/rest.rb @@ -0,0 +1,88 @@ +module BootpayStorage::Concern::Rest + extend ActiveSupport::Concern + + included do + private + + # HTTP Request 기본 Method + # Comment by Gosomi + # Date: 2021-05-21 + def request(method: :post, uri:, payload: {}, headers: {}, params: nil) + response = HTTP.headers( + { + Authorization: "Bearer #{@token}", + content_type: 'application/json', + accept: 'application/json', + bootpay_api_version: @api_version, + bootpay_sdk_version: Bootpay::V2_VERSION, + bootpay_sdk_type: '300' + }.merge!(headers).compact + ).send( + method.to_sym, + [BootpayStorage::RestClient::API[@mode.to_sym], uri].join('/'), + json: payload, + params: params + ) + BootpayStorage::Response.new( + response.status.to_i == 200, + JSON.parse(response.body.to_s, symbolize_names: true) + ) + rescue Exception => e + BootpayStorage::Response.new( + false, + message: "부트페이 API 서버와의 통신이 실패하였습니다. 오류 메세지: #{e.message}", + backtrace: e.backtrace.join("\n") + ) + end + + # Multipart 파일 전송 Method + # Comment by Gosomi + # Date: 2025-03-25 + def upload(uri:, image_data:, image_name:, headers: {}, params: nil) + + # puts [BootpayStorage::RestClient::API[@mode.to_sym], uri].join('/') + + # 파일 객체 생성 + file = HTTP::FormData::File.new(image_data, filename: image_name) + + # HTTP 요청 + response = HTTP.headers( + { + Authorization: "Bearer #{@token}", + accept: 'application/json', + bootpay_api_version: @api_version, + bootpay_sdk_version: Bootpay::V2_VERSION, + bootpay_sdk_type: '300' + }.merge!(headers).compact + ).post( + [BootpayStorage::RestClient::API[@mode.to_sym], uri].join('/'), + form: { images: [file] }, + params: params + ) + + # 응답 상태와 바디 출력 + puts "Response Status: #{response.status}" + puts "Response Body: #{response.body.to_s}" + + # JSON 파싱 시도 + parsed_response = begin + JSON.parse(response.body.to_s, symbolize_names: true) + rescue JSON::ParserError => e + { error: "응답 파싱 실패: #{e.message}", body: response.body.to_s } + end + + # 응답 처리 + BootpayStorage::Response.new( + response.status.to_i == 200, + parsed_response + ) + rescue Exception => e + BootpayStorage::Response.new( + false, + message: "파일 업로드 실패: #{e.message}", + backtrace: e.backtrace.join("\n") + ) + end + + end +end \ No newline at end of file diff --git a/lib/bootpay_storage/concern/token.rb b/lib/bootpay_storage/concern/token.rb new file mode 100644 index 0000000..1dbc5e6 --- /dev/null +++ b/lib/bootpay_storage/concern/token.rb @@ -0,0 +1,9 @@ +module BootpayStorage::Concern::Token + extend ActiveSupport::Concern + + included do + def set_token(token) + @token = token + end + end +end \ No newline at end of file diff --git a/lib/bootpay_storage/response.rb b/lib/bootpay_storage/response.rb new file mode 100644 index 0000000..5a67f74 --- /dev/null +++ b/lib/bootpay_storage/response.rb @@ -0,0 +1,14 @@ +module BootpayStorage + class Response + attr_reader :data + + def initialize(success = true, data = {}) + @success = success + @data = data + end + + def success? + @success + end + end +end \ No newline at end of file diff --git a/lib/bootpay_store/bootpay-store-rest-client.rb b/lib/bootpay_store/bootpay-store-rest-client.rb new file mode 100644 index 0000000..b346253 --- /dev/null +++ b/lib/bootpay_store/bootpay-store-rest-client.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +require 'active_support/all' +require 'http' +require_relative 'response' +require_relative '../version' +require_relative 'concern' + +module BootpayStore + class RestClient + include Concern + + API = + { + development: 'https://dev-api.bootapi.com/v1', + stage: 'https://stage-api.bootapi.com/v1', + production: 'https://api.bootapi.com/v1' + } + + SDK_VERSION = '5.0.0' + + def initialize(server_key:, private_key:, mode: 'production') + @server_key = server_key + @private_key = private_key + @mode = mode.presence || 'production' + @token = nil + @api_version = SDK_VERSION + raise ArgumentError, "개발환경 mode는 development, stage, production 중에서 선택이 가능합니다." if API[@mode.to_sym].blank? + end + + # API URL을 변경 + # Comment by GOSOMI + # @date: 2023-05-26 + def set_api_url(url) + API[@mode.to_sym] = url + end + + # API 버전을 설정한다 + # Comment by Gosomi + # Date: 2022-07-29 + def set_api_version(version) + raise ArgumentError, 'API Version은 4.0.0 이상만 설정이 가능합니다.' if version < '4.0.0' + @api_version = version + end + end +end diff --git a/lib/bootpay_store/concern.rb b/lib/bootpay_store/concern.rb new file mode 100644 index 0000000..2f28d6e --- /dev/null +++ b/lib/bootpay_store/concern.rb @@ -0,0 +1,35 @@ +module BootpayStore + module Concern + # require_relative 'concern/authenticate' + # require_relative 'concern/cash_receipt' + # require_relative 'concern/easy' + # require_relative 'concern/escrow' + # require_relative 'concern/payment' + # require_relative 'concern/reseller' + require_relative 'concern/rest' + # require_relative 'concern/sdk' + # require_relative 'concern/seller' + # require_relative 'concern/service' + # require_relative 'concern/subscription' + require_relative 'concern/token' + # require_relative 'concern/user_token' + # require_relative 'concern/wallet' + # require_relative 'concern/webhook' + # + # include Authenticate + # include CashReceipt + # include Easy + # include Escrow + # include Payment + # include Reseller + include Rest + # include Sdk + # include Seller + # include Service + # include Subscription + include Token + # include UserToken + # include Wallet + # include Webhook + end +end \ No newline at end of file diff --git a/lib/bootpay_store/concern/rest.rb b/lib/bootpay_store/concern/rest.rb new file mode 100644 index 0000000..9570915 --- /dev/null +++ b/lib/bootpay_store/concern/rest.rb @@ -0,0 +1,38 @@ +module BootpayStore::Concern::Rest + extend ActiveSupport::Concern + + included do + private + + # HTTP Request 기본 Method + # Comment by Gosomi + # Date: 2021-05-21 + def request(method: :post, uri:, payload: {}, headers: {}, params: nil) + response = HTTP.headers( + { + Authorization: "Bearer #{@token}", + content_type: 'application/json', + accept: 'application/json', + bootpay_api_version: @api_version, + bootpay_sdk_version: Bootpay::V2_VERSION, + bootpay_sdk_type: '300' + }.merge!(headers).compact + ).send( + method.to_sym, + [BootpayStore::RestClient::API[@mode.to_sym], uri].join('/'), + json: payload, + params: params + ) + BootpayStore::Response.new( + response.status.to_i == 200, + JSON.parse(response.body.to_s, symbolize_names: true) + ) + rescue Exception => e + BootpayStore::Response.new( + false, + message: "부트페이 API 서버와의 통신이 실패하였습니다. 오류 메세지: #{e.message}", + backtrace: e.backtrace.join("\n") + ) + end + end +end \ No newline at end of file diff --git a/lib/bootpay_store/concern/token.rb b/lib/bootpay_store/concern/token.rb new file mode 100644 index 0000000..7afb269 --- /dev/null +++ b/lib/bootpay_store/concern/token.rb @@ -0,0 +1,24 @@ +module BootpayStore::Concern::Token + extend ActiveSupport::Concern + + included do + # Access Token을 요청한다 + # Comment by Gosomi + # Date: 2021-05-21 + def request_access_token + response = request( + uri: 'token', + payload: { + server_key: @server_key, + private_key: @private_key + } + ) + @token = response.data[:access_token] if response.success? + response + end + + def set_token(token) + @token = token + end + end +end \ No newline at end of file diff --git a/lib/bootpay_store/response.rb b/lib/bootpay_store/response.rb new file mode 100644 index 0000000..f73e537 --- /dev/null +++ b/lib/bootpay_store/response.rb @@ -0,0 +1,14 @@ +module BootpayStore + class Response + attr_reader :data + + def initialize(success = true, data = {}) + @success = success + @data = data + end + + def success? + @success + end + end +end \ No newline at end of file diff --git a/lib/bootpay/version.rb b/lib/version.rb similarity index 67% rename from lib/bootpay/version.rb rename to lib/version.rb index fed86f2..661bb34 100644 --- a/lib/bootpay/version.rb +++ b/lib/version.rb @@ -1,4 +1,4 @@ # frozen_string_literal: true module Bootpay - V2_VERSION = "2.1.1" + V2_VERSION = "3.0.0" end \ No newline at end of file diff --git a/spec/bootpay/rest/client_spec.rb b/spec/bootpay/rest/client_spec.rb index 3bc3747..b48e86c 100644 --- a/spec/bootpay/rest/client_spec.rb +++ b/spec/bootpay/rest/client_spec.rb @@ -2,7 +2,7 @@ RSpec.describe Bootpay::Rest::Client do it "has a version number" do - expect(Bootpay::Rest::Client::V2_VERSION).not_to be nil + expect(Bootpay::V2_VERSION).not_to be nil end it "does something useful" do diff --git a/spec/bootpay_storage/image_spec.rb b/spec/bootpay_storage/image_spec.rb new file mode 100644 index 0000000..93b5099 --- /dev/null +++ b/spec/bootpay_storage/image_spec.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +RSpec.describe BootpayStorage::RestClient do + let(:image_path) { File.expand_path('../fixtures/logo.png', __dir__) } + + it "image" do + commerce_api = BootpayStore::RestClient.new( + server_key: '67c92fb8d01640bb9859c612', + private_key: 'ugaqkJ8/Yd2HHjM+W1TF6FZQPTmvx1rny5OIrMqcpTY=', + mode: 'development' + ) + res = commerce_api.request_access_token + + api = BootpayStorage::RestClient.new( + server_key: '67c92fb8d01640bb9859c612', + private_key: 'ugaqkJ8/Yd2HHjM+W1TF6FZQPTmvx1rny5OIrMqcpTY=', + mode: 'development' + ) + api.set_token(res.data[:access_token]) + file = File.open(image_path) + + response = api.image_upload(image_data: file, image_name: 'logo.png') + file.close + + print response.data.to_json + end +end diff --git a/spec/bootpay_store/token_spec.rb b/spec/bootpay_store/token_spec.rb new file mode 100644 index 0000000..f276552 --- /dev/null +++ b/spec/bootpay_store/token_spec.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +RSpec.describe BootpayStore::RestClient do + it "token" do + api = BootpayStore::RestClient.new( + server_key: '67c92fb8d01640bb9859c612', + private_key: 'ugaqkJ8/Yd2HHjM+W1TF6FZQPTmvx1rny5OIrMqcpTY=', + mode: 'development' + ) + response = api.request_access_token + print response.data.to_json + end +end diff --git a/spec/fixtures/logo.png b/spec/fixtures/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..061c17c5714aed482d12488c79ae7338bdc8bd7f GIT binary patch literal 25210 zcmZ^K2Ut^0w{EBbfq}OAA)|xeI=AC!i-l19=DpWU^ZU6uPs%KA?v;hDDhQBu% zDLy7R@>e+ikDHC6qL!_qilT#^gR_pKnYo3Mjf_B~(YoEH`Bi&R zDg?yJA`+@NI(*}UlQsWsWuccOUv*Nv$zh)N__Up9b@@)%^_uh@OG92dIyurP0dLNx zN%2)%!{-uTPIJz6tXx9VT+oIXW-UhkV?y3v2{CG|c|S*MmOuIjXXt#fEHBCd-?+N0 z-8>jNn$rx?SFim*Go@*m*e{s)A%jrI=hA2_vnz$^a(?tt1S1_TCNv%vMm~3+P1u@m z@e8i5r^9bVFjG1s{$1Khg5L0r_d(Uqz=hI>p1{OU79~IZC+9N9bQ9ZHHeU3a(Q-3< z(t3d;CRy;g7>SgR6mZrx)e?*%1a~VvyGdK#dN7!6c1y&G?9oPawacbAb;)@b47PJ8 z3Fg=jnVx=31WnJ59m7t;i5Zvx_8V#sU#e_mAFn!N&dG(62!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SX ztGEU?xvX^NnliHDMlmLq_IXGcvm~OYbWDe3>b4|&wXTw5q-6L}f!@r5;JL*_gb@Xc zKB$7s0vo#vr%Tl@Rn;4MhsyeT90>b32}$P4x6a7jkDzy!NwYZjgA2BTIpK-8$Q1*~ z;i@thcln*~a$mJ4DbYpz-V4T%M{4XFhpcQ1z!MX~D(xW>qc5pGhE;a;_zo+Z3Q3ld z-Ry7b?RNORL8kH8$pR))J1cL$LrgJIMoIccrL;Gq(rs8YO`;S1x!5l;C$EFM(P)vO zXM@rQ?lvci+X)E$D=w@joKr9Qwd1lB0+1_W+wccl(&l9{z>RJBF$+ z+^0A+N#@mRYicm65GoVK1P_2&@OsM z_6`~h36+S_sLbmy9}gW{oE`C(EbbN#rDo3#p^nr5ILimELh_l7xj*mJuCy8prTBb= z6#CR*3uM+hxwlmdrhecVz#3_9R8=z;=>CSsbiBCuG|ZDATO62@AQ!Xtj^dVYpHf>4 XW$g;TpY{9qV}Kh5=K9sTu223CrH^a0 literal 0 HcmV?d00001 diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index b43ecdf..0422cf9 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true -require "bootpay-backend-ruby" +require "bootpay/bootpay-rest-client" +require "bootpay_store/bootpay-store-rest-client" +require "bootpay_storage/bootpay-storage-rest-client" RSpec.configure do |config| # Enable flags like --only-failures and --next-failure From 71720dfe0cdd5e657975ca81c52061f8fef15ceb Mon Sep 17 00:00:00 2001 From: rupy1014 Date: Wed, 26 Mar 2025 17:23:37 +0900 Subject: [PATCH 078/133] alpha versio update --- lib/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/version.rb b/lib/version.rb index 661bb34..ce7aa21 100644 --- a/lib/version.rb +++ b/lib/version.rb @@ -1,4 +1,4 @@ # frozen_string_literal: true module Bootpay - V2_VERSION = "3.0.0" + V2_VERSION = "3.0.0-alpha.1" end \ No newline at end of file From e0a14eea7beb939315148d8058e418bfa6cc5944 Mon Sep 17 00:00:00 2001 From: rupy1014 Date: Thu, 27 Mar 2025 09:58:04 +0900 Subject: [PATCH 079/133] image upload api interface update --- lib/bootpay_storage/concern/image.rb | 5 +-- lib/bootpay_storage/concern/rest.rb | 65 +++++++++++++++++++++++----- lib/version.rb | 2 +- spec/bootpay_storage/image_spec.rb | 2 +- 4 files changed, 58 insertions(+), 16 deletions(-) diff --git a/lib/bootpay_storage/concern/image.rb b/lib/bootpay_storage/concern/image.rb index 4792a63..6b495e8 100644 --- a/lib/bootpay_storage/concern/image.rb +++ b/lib/bootpay_storage/concern/image.rb @@ -7,11 +7,10 @@ module BootpayStorage::Concern::Image # REST API로 본인인증 요청하기 # Comment by Gosomi # Date: 2022-11-02 - def image_upload(image_data:, image_name:) + def image_upload(images:) upload( uri: 'images', - image_data: image_data, - image_name: image_name + images: images ) end diff --git a/lib/bootpay_storage/concern/rest.rb b/lib/bootpay_storage/concern/rest.rb index 743c395..c492c6a 100644 --- a/lib/bootpay_storage/concern/rest.rb +++ b/lib/bootpay_storage/concern/rest.rb @@ -38,12 +38,12 @@ def request(method: :post, uri:, payload: {}, headers: {}, params: nil) # Multipart 파일 전송 Method # Comment by Gosomi # Date: 2025-03-25 - def upload(uri:, image_data:, image_name:, headers: {}, params: nil) - - # puts [BootpayStorage::RestClient::API[@mode.to_sym], uri].join('/') - - # 파일 객체 생성 - file = HTTP::FormData::File.new(image_data, filename: image_name) + def upload(uri:, images:, headers: {}, params: nil) + # 이미지 데이터를 배열로 받음 + files = images.each_with_index.map do |data, index| + filename = "image_#{Time.now.to_i}_#{index}.jpg" + HTTP::FormData::File.new(data, filename: filename) + end # HTTP 요청 response = HTTP.headers( @@ -56,14 +56,10 @@ def upload(uri:, image_data:, image_name:, headers: {}, params: nil) }.merge!(headers).compact ).post( [BootpayStorage::RestClient::API[@mode.to_sym], uri].join('/'), - form: { images: [file] }, + form: { images: files }, params: params ) - # 응답 상태와 바디 출력 - puts "Response Status: #{response.status}" - puts "Response Body: #{response.body.to_s}" - # JSON 파싱 시도 parsed_response = begin JSON.parse(response.body.to_s, symbolize_names: true) @@ -84,5 +80,52 @@ def upload(uri:, image_data:, image_name:, headers: {}, params: nil) ) end + + # def upload(uri:, image_data:, image_name:, headers: {}, params: nil) + # + # # puts [BootpayStorage::RestClient::API[@mode.to_sym], uri].join('/') + # + # # 파일 객체 생성 + # file = HTTP::FormData::File.new(image_data, filename: image_name) + # + # # HTTP 요청 + # response = HTTP.headers( + # { + # Authorization: "Bearer #{@token}", + # accept: 'application/json', + # bootpay_api_version: @api_version, + # bootpay_sdk_version: Bootpay::V2_VERSION, + # bootpay_sdk_type: '300' + # }.merge!(headers).compact + # ).post( + # [BootpayStorage::RestClient::API[@mode.to_sym], uri].join('/'), + # form: { images: [file] }, + # params: params + # ) + # + # # 응답 상태와 바디 출력 + # puts "Response Status: #{response.status}" + # puts "Response Body: #{response.body.to_s}" + # + # # JSON 파싱 시도 + # parsed_response = begin + # JSON.parse(response.body.to_s, symbolize_names: true) + # rescue JSON::ParserError => e + # { error: "응답 파싱 실패: #{e.message}", body: response.body.to_s } + # end + # + # # 응답 처리 + # BootpayStorage::Response.new( + # response.status.to_i == 200, + # parsed_response + # ) + # rescue Exception => e + # BootpayStorage::Response.new( + # false, + # message: "파일 업로드 실패: #{e.message}", + # backtrace: e.backtrace.join("\n") + # ) + # end + end end \ No newline at end of file diff --git a/lib/version.rb b/lib/version.rb index ce7aa21..bdcb1f3 100644 --- a/lib/version.rb +++ b/lib/version.rb @@ -1,4 +1,4 @@ # frozen_string_literal: true module Bootpay - V2_VERSION = "3.0.0-alpha.1" + V2_VERSION = "3.0.0-alpha.2" end \ No newline at end of file diff --git a/spec/bootpay_storage/image_spec.rb b/spec/bootpay_storage/image_spec.rb index 93b5099..ed08809 100644 --- a/spec/bootpay_storage/image_spec.rb +++ b/spec/bootpay_storage/image_spec.rb @@ -19,7 +19,7 @@ api.set_token(res.data[:access_token]) file = File.open(image_path) - response = api.image_upload(image_data: file, image_name: 'logo.png') + response = api.image_upload(images: [file]) file.close print response.data.to_json From a9de00e541e5abf2aacb0a0a74b30df1828f5bb1 Mon Sep 17 00:00:00 2001 From: rupy1014 Date: Thu, 27 Mar 2025 10:43:10 +0900 Subject: [PATCH 080/133] interface added --- CHANGELOG.md | 4 ++++ lib/bootpay-backend-ruby.rb | 4 ++++ lib/version.rb | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 lib/bootpay-backend-ruby.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index db4fbcc..5c4a548 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +### 3.0.0 +- store api 추가 +- 내부용 storage api 추가 + ### 2.0.5 - 빌링결제 api 추가 - 계좌 빌링 결제 api 추가 diff --git a/lib/bootpay-backend-ruby.rb b/lib/bootpay-backend-ruby.rb new file mode 100644 index 0000000..2a093e7 --- /dev/null +++ b/lib/bootpay-backend-ruby.rb @@ -0,0 +1,4 @@ +# lib/bootpay.rb +require_relative "bootpay/bootpay-rest-client" +require_relative "bootpay_storage/bootpay-storage-rest-client" +require_relative "bootpay_store/bootpay-store-rest-client" diff --git a/lib/version.rb b/lib/version.rb index bdcb1f3..ecb7cd3 100644 --- a/lib/version.rb +++ b/lib/version.rb @@ -1,4 +1,4 @@ # frozen_string_literal: true module Bootpay - V2_VERSION = "3.0.0-alpha.2" + V2_VERSION = "3.0.0-alpha.3" end \ No newline at end of file From cddc88e8b2ed52a307997a4397862185afa077b5 Mon Sep 17 00:00:00 2001 From: rupy1014 Date: Thu, 27 Mar 2025 11:14:33 +0900 Subject: [PATCH 081/133] spec update --- spec/bootpay_store/token_spec.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/spec/bootpay_store/token_spec.rb b/spec/bootpay_store/token_spec.rb index f276552..3636ec2 100644 --- a/spec/bootpay_store/token_spec.rb +++ b/spec/bootpay_store/token_spec.rb @@ -8,6 +8,10 @@ mode: 'development' ) response = api.request_access_token - print response.data.to_json + # print response.data.to_json + json = JSON.parse(response.data.to_json) + puts json + puts json['access_token'] + # print response.data.to_json end end From 6c47c64e177591703753e348744a9c3d33d37c43 Mon Sep 17 00:00:00 2001 From: gosomi Date: Fri, 25 Apr 2025 17:46:07 +0900 Subject: [PATCH 082/133] =?UTF-8?q?store=20=EC=BD=94=EB=93=9C=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay/concern/wallet.rb | 2 +- .../bootpay-store-rest-client.rb | 10 ++--- lib/bootpay_store/concern.rb | 32 +++----------- lib/bootpay_store/concern/payment.rb | 42 +++++++++++++++++++ lib/bootpay_store/concern/supervisor.rb | 31 ++++++++++++++ lib/bootpay_store/concern/token.rb | 2 +- 6 files changed, 85 insertions(+), 34 deletions(-) create mode 100644 lib/bootpay_store/concern/payment.rb create mode 100644 lib/bootpay_store/concern/supervisor.rb diff --git a/lib/bootpay/concern/wallet.rb b/lib/bootpay/concern/wallet.rb index 86294f2..82b01c9 100644 --- a/lib/bootpay/concern/wallet.rb +++ b/lib/bootpay/concern/wallet.rb @@ -27,7 +27,7 @@ def request_wallet_payment(user_id:, order_name:, price:, tax_free: 0, webhook_u # 등록된 회원의 지갑 정보를 가져온다 # Comment by GOSOMI # @date: 2025-02-13 - def user_wallets(user_id:, sandbox:) + def user_wallets(user_id:, sandbox: false) request( uri: 'wallet', method: :get, diff --git a/lib/bootpay_store/bootpay-store-rest-client.rb b/lib/bootpay_store/bootpay-store-rest-client.rb index b346253..6e97eec 100644 --- a/lib/bootpay_store/bootpay-store-rest-client.rb +++ b/lib/bootpay_store/bootpay-store-rest-client.rb @@ -20,11 +20,11 @@ class RestClient SDK_VERSION = '5.0.0' def initialize(server_key:, private_key:, mode: 'production') - @server_key = server_key - @private_key = private_key - @mode = mode.presence || 'production' - @token = nil - @api_version = SDK_VERSION + @server_key = server_key + @private_key = private_key + @mode = mode.presence || 'production' + @token = nil + @api_version = SDK_VERSION raise ArgumentError, "개발환경 mode는 development, stage, production 중에서 선택이 가능합니다." if API[@mode.to_sym].blank? end diff --git a/lib/bootpay_store/concern.rb b/lib/bootpay_store/concern.rb index 2f28d6e..4fd8b67 100644 --- a/lib/bootpay_store/concern.rb +++ b/lib/bootpay_store/concern.rb @@ -1,35 +1,13 @@ module BootpayStore module Concern - # require_relative 'concern/authenticate' - # require_relative 'concern/cash_receipt' - # require_relative 'concern/easy' - # require_relative 'concern/escrow' - # require_relative 'concern/payment' - # require_relative 'concern/reseller' + require_relative 'concern/payment' require_relative 'concern/rest' - # require_relative 'concern/sdk' - # require_relative 'concern/seller' - # require_relative 'concern/service' - # require_relative 'concern/subscription' + require_relative 'concern/supervisor' require_relative 'concern/token' - # require_relative 'concern/user_token' - # require_relative 'concern/wallet' - # require_relative 'concern/webhook' - # - # include Authenticate - # include CashReceipt - # include Easy - # include Escrow - # include Payment - # include Reseller + + include Payment include Rest - # include Sdk - # include Seller - # include Service - # include Subscription + include Supervisor include Token - # include UserToken - # include Wallet - # include Webhook end end \ No newline at end of file diff --git a/lib/bootpay_store/concern/payment.rb b/lib/bootpay_store/concern/payment.rb new file mode 100644 index 0000000..fcb1554 --- /dev/null +++ b/lib/bootpay_store/concern/payment.rb @@ -0,0 +1,42 @@ +module BootpayStore::Concern::Payment + extend ActiveSupport::Concern + + included do + # 주문 취소 + # Comment by GOSOMI + # @date: 2025-04-04 + def request_order_cancel(idempotency_key: nil, cancel_id: nil, order_number:, cancel_products: nil, cancel_price: nil, + cancel_tax_free_price: 0, cancel_requester: '시스템', cancel_message: '요청취소', cancel_immediately: false) + request( + uri: 'order/cancel', + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + }, + payload: + { + order_number: order_number, + request_cancel_parameters: { + cancel_id: cancel_id, + cancel_products: cancel_products, + cancel_price: cancel_price, + cancel_tax_free_price: cancel_tax_free_price, + cancel_requester: cancel_requester, + cancel_message: cancel_message, + cancel_immediately: cancel_immediately + }.compact + }.compact + ) + end + + # 주문 취소 요청을 철회한다 + def request_order_cancel_revoke(idempotency_key: nil, order_cancellation_request_id:) + request( + uri: "order/cancel/#{order_cancellation_request_id}", + method: :delete, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid + } + ) + end + end +end \ No newline at end of file diff --git a/lib/bootpay_store/concern/supervisor.rb b/lib/bootpay_store/concern/supervisor.rb new file mode 100644 index 0000000..3441378 --- /dev/null +++ b/lib/bootpay_store/concern/supervisor.rb @@ -0,0 +1,31 @@ +module BootpayStore::Concern::Supervisor + extend ActiveSupport::Concern + + included do + # 주문 취소 + # Comment by GOSOMI + # @date: 2025-04-04 + def supervisor_request_order_cancel(idempotency_key: nil, cancel_id: nil, order_number:, cancel_products: nil, cancel_price: nil, + cancel_tax_free_price: 0, cancel_requester: '시스템', cancel_message: '요청취소', cancel_immediately: false) + request( + uri: 'role/supervisor/order/cancel', + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + }, + payload: + { + order_number: order_number, + request_cancel_parameters: { + cancel_id: cancel_id, + cancel_products: cancel_products, + cancel_price: cancel_price, + cancel_tax_free_price: cancel_tax_free_price, + cancel_requester: cancel_requester, + cancel_message: cancel_message, + cancel_immediately: cancel_immediately + }.compact + }.compact + ) + end + end +end \ No newline at end of file diff --git a/lib/bootpay_store/concern/token.rb b/lib/bootpay_store/concern/token.rb index 7afb269..8e5c42f 100644 --- a/lib/bootpay_store/concern/token.rb +++ b/lib/bootpay_store/concern/token.rb @@ -7,7 +7,7 @@ module BootpayStore::Concern::Token # Date: 2021-05-21 def request_access_token response = request( - uri: 'token', + uri: 'request/token', payload: { server_key: @server_key, private_key: @private_key From b8ea1f69244333becd15a6ecef7d13b2b1e2b7c4 Mon Sep 17 00:00:00 2001 From: gosomi Date: Fri, 25 Apr 2025 18:43:03 +0900 Subject: [PATCH 083/133] =?UTF-8?q?=ED=9A=8C=EC=9B=90=20external=20login?= =?UTF-8?q?=20api=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay_store/concern.rb | 2 ++ lib/bootpay_store/concern/user.rb | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 lib/bootpay_store/concern/user.rb diff --git a/lib/bootpay_store/concern.rb b/lib/bootpay_store/concern.rb index 4fd8b67..13615d7 100644 --- a/lib/bootpay_store/concern.rb +++ b/lib/bootpay_store/concern.rb @@ -4,10 +4,12 @@ module Concern require_relative 'concern/rest' require_relative 'concern/supervisor' require_relative 'concern/token' + require_relative 'concern/user' include Payment include Rest include Supervisor include Token + include User end end \ No newline at end of file diff --git a/lib/bootpay_store/concern/user.rb b/lib/bootpay_store/concern/user.rb new file mode 100644 index 0000000..c5b1a49 --- /dev/null +++ b/lib/bootpay_store/concern/user.rb @@ -0,0 +1,21 @@ +module BootpayStore::Concern::User + extend ActiveSupport::Concern + + included do + # UserId로 로그인을 시도한다 + # Comment by GOSOMI + # @date: 2025-04-25 + def login_by_user_id(user_id:, idempotency_key: nil) + request( + uri: "users/login/token", + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + }, + payload: + { + user_id: user_id + } + ) + end + end +end \ No newline at end of file From df4cd281e99d5e815680247214b1eeaa49a0e9be Mon Sep 17 00:00:00 2001 From: gosomi Date: Mon, 12 May 2025 08:31:04 +0900 Subject: [PATCH 084/133] =?UTF-8?q?order=20=EA=B2=B0=EC=A0=9C=20=EC=B7=A8?= =?UTF-8?q?=EC=86=8C=20=ED=8C=8C=EB=9D=BC=EB=A9=94=ED=84=B0=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay_store/concern/payment.rb | 18 ++++++++++-------- lib/bootpay_store/concern/supervisor.rb | 18 ++++++++++-------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/lib/bootpay_store/concern/payment.rb b/lib/bootpay_store/concern/payment.rb index fcb1554..fde2d97 100644 --- a/lib/bootpay_store/concern/payment.rb +++ b/lib/bootpay_store/concern/payment.rb @@ -6,7 +6,8 @@ module BootpayStore::Concern::Payment # Comment by GOSOMI # @date: 2025-04-04 def request_order_cancel(idempotency_key: nil, cancel_id: nil, order_number:, cancel_products: nil, cancel_price: nil, - cancel_tax_free_price: 0, cancel_requester: '시스템', cancel_message: '요청취소', cancel_immediately: false) + cancel_tax_free_price: 0, cancel_requester: '시스템', cancel_message: '요청취소', cancel_immediately: false, + cancel_order_subscription_bills: nil) request( uri: 'order/cancel', headers: { @@ -16,13 +17,14 @@ def request_order_cancel(idempotency_key: nil, cancel_id: nil, order_number:, ca { order_number: order_number, request_cancel_parameters: { - cancel_id: cancel_id, - cancel_products: cancel_products, - cancel_price: cancel_price, - cancel_tax_free_price: cancel_tax_free_price, - cancel_requester: cancel_requester, - cancel_message: cancel_message, - cancel_immediately: cancel_immediately + cancel_id: cancel_id, + cancel_products: cancel_products, + cancel_order_subscription_bills: cancel_order_subscription_bills, + cancel_price: cancel_price, + cancel_tax_free_price: cancel_tax_free_price, + cancel_requester: cancel_requester, + cancel_message: cancel_message, + cancel_immediately: cancel_immediately }.compact }.compact ) diff --git a/lib/bootpay_store/concern/supervisor.rb b/lib/bootpay_store/concern/supervisor.rb index 3441378..16a7d17 100644 --- a/lib/bootpay_store/concern/supervisor.rb +++ b/lib/bootpay_store/concern/supervisor.rb @@ -6,7 +6,8 @@ module BootpayStore::Concern::Supervisor # Comment by GOSOMI # @date: 2025-04-04 def supervisor_request_order_cancel(idempotency_key: nil, cancel_id: nil, order_number:, cancel_products: nil, cancel_price: nil, - cancel_tax_free_price: 0, cancel_requester: '시스템', cancel_message: '요청취소', cancel_immediately: false) + cancel_tax_free_price: 0, cancel_requester: '시스템', cancel_message: '요청취소', cancel_immediately: false, + cancel_order_subscription_bills: nil) request( uri: 'role/supervisor/order/cancel', headers: { @@ -16,13 +17,14 @@ def supervisor_request_order_cancel(idempotency_key: nil, cancel_id: nil, order_ { order_number: order_number, request_cancel_parameters: { - cancel_id: cancel_id, - cancel_products: cancel_products, - cancel_price: cancel_price, - cancel_tax_free_price: cancel_tax_free_price, - cancel_requester: cancel_requester, - cancel_message: cancel_message, - cancel_immediately: cancel_immediately + cancel_id: cancel_id, + cancel_products: cancel_products, + cancel_order_subscription_bills: cancel_order_subscription_bills, + cancel_price: cancel_price, + cancel_tax_free_price: cancel_tax_free_price, + cancel_requester: cancel_requester, + cancel_message: cancel_message, + cancel_immediately: cancel_immediately }.compact }.compact ) From d493ba5a9a3ca3495b57652a16f53b5d3b4e9b9f Mon Sep 17 00:00:00 2001 From: gosomi Date: Wed, 21 May 2025 10:39:09 +0900 Subject: [PATCH 085/133] =?UTF-8?q?=EA=B2=B0=EC=A0=9C=20=EC=B7=A8=EC=86=8C?= =?UTF-8?q?=20=EC=9A=94=EC=B2=AD=20=EC=8A=B9=EC=9D=B8=20API=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay_store/concern/payment.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/bootpay_store/concern/payment.rb b/lib/bootpay_store/concern/payment.rb index fde2d97..561d8f6 100644 --- a/lib/bootpay_store/concern/payment.rb +++ b/lib/bootpay_store/concern/payment.rb @@ -40,5 +40,16 @@ def request_order_cancel_revoke(idempotency_key: nil, order_cancellation_request } ) end + + # 주문 취소 요청을 승인처리 한다 + def approve_order_cancel(idempotency_key: nil, order_cancellation_request_id:) + request( + uri: "order/cancel/#{order_cancellation_request_id}/approve", + method: :put, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid + } + ) + end end end \ No newline at end of file From 9ed1bbc6aeb779605ae3a45c802c930c56e945fb Mon Sep 17 00:00:00 2001 From: gosomi Date: Wed, 21 May 2025 11:15:24 +0900 Subject: [PATCH 086/133] =?UTF-8?q?post=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay_store/concern/payment.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bootpay_store/concern/payment.rb b/lib/bootpay_store/concern/payment.rb index 561d8f6..9d8dc69 100644 --- a/lib/bootpay_store/concern/payment.rb +++ b/lib/bootpay_store/concern/payment.rb @@ -45,7 +45,7 @@ def request_order_cancel_revoke(idempotency_key: nil, order_cancellation_request def approve_order_cancel(idempotency_key: nil, order_cancellation_request_id:) request( uri: "order/cancel/#{order_cancellation_request_id}/approve", - method: :put, + method: :post, headers: { 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid } From 751463f4d3d51c65755d8a1c0da325d9fbed0b37 Mon Sep 17 00:00:00 2001 From: gosomi Date: Wed, 21 May 2025 11:35:11 +0900 Subject: [PATCH 087/133] =?UTF-8?q?order=5Fcancellation=5Frequest=5Fhistor?= =?UTF-8?q?y=5Fid=20=ED=8C=8C=EB=9D=BC=EB=A9=94=ED=84=B0=20=EB=AA=85=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay_store/concern/payment.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/bootpay_store/concern/payment.rb b/lib/bootpay_store/concern/payment.rb index 9d8dc69..dad7bda 100644 --- a/lib/bootpay_store/concern/payment.rb +++ b/lib/bootpay_store/concern/payment.rb @@ -42,9 +42,9 @@ def request_order_cancel_revoke(idempotency_key: nil, order_cancellation_request end # 주문 취소 요청을 승인처리 한다 - def approve_order_cancel(idempotency_key: nil, order_cancellation_request_id:) + def approve_order_cancel(idempotency_key: nil, order_cancellation_request_history_id:) request( - uri: "order/cancel/#{order_cancellation_request_id}/approve", + uri: "order/cancel/#{order_cancellation_request_history_id}/approve", method: :post, headers: { 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid From 1e208a1aeffa4a91a1072f24237080c1d35d6973 Mon Sep 17 00:00:00 2001 From: gosomi Date: Thu, 22 May 2025 19:36:47 +0900 Subject: [PATCH 088/133] =?UTF-8?q?REST=20API=EB=A1=9C=20=EB=B3=B8?= =?UTF-8?q?=EC=9D=B8=EC=9D=B8=EC=A6=9D=20=EC=9A=94=EC=B2=AD=EC=8B=9C=20cli?= =?UTF-8?q?ent=20ip=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay/concern/authenticate.rb | 36 +++++++++++++++-------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/lib/bootpay/concern/authenticate.rb b/lib/bootpay/concern/authenticate.rb index 94bf803..fc78487 100644 --- a/lib/bootpay/concern/authenticate.rb +++ b/lib/bootpay/concern/authenticate.rb @@ -16,24 +16,26 @@ def certificate(receipt_id) # Comment by Gosomi # Date: 2022-11-02 def request_authentication(pg:, method:, username:, identity_no:, carrier:, phone:, site_url:, - authenticate_type: 'sms', order_name: '', authentication_id: '', extra: {}, user: {}) + authenticate_type: 'sms', order_name: '', authentication_id: '', extra: {}, user: {}, client_ip: nil) request( - method: :post, - uri: 'request/authentication', - payload: { - pg: pg, - method: method, - username: username, - identity_no: identity_no, - carrier: carrier, - phone: phone, - site_url: site_url, - authenticate_type: authenticate_type, - order_name: order_name, - authentication_id: authentication_id, - extra: extra, - user: user - } + method: :post, + uri: 'request/authentication', + payload: + { + pg: pg, + method: method, + username: username, + identity_no: identity_no, + carrier: carrier, + phone: phone, + site_url: site_url, + authenticate_type: authenticate_type, + order_name: order_name, + authentication_id: authentication_id, + extra: extra, + user: user, + client_ip: client_ip + }.compact ) end From 968b7799ea647f24d7f0798fd94385480523742a Mon Sep 17 00:00:00 2001 From: rupy1014 Date: Thu, 5 Jun 2025 17:15:49 +0900 Subject: [PATCH 089/133] =?UTF-8?q?order=5Fcancel=20reject,=20apporve=20?= =?UTF-8?q?=EA=B2=BD=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay_store/concern/payment.rb | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/lib/bootpay_store/concern/payment.rb b/lib/bootpay_store/concern/payment.rb index dad7bda..f7c8797 100644 --- a/lib/bootpay_store/concern/payment.rb +++ b/lib/bootpay_store/concern/payment.rb @@ -31,24 +31,43 @@ def request_order_cancel(idempotency_key: nil, cancel_id: nil, order_number:, ca end # 주문 취소 요청을 철회한다 - def request_order_cancel_revoke(idempotency_key: nil, order_cancellation_request_id:) + # def request_order_cancel_revoke(idempotency_key: nil, order_cancellation_request_id:) + # request( + # uri: "order/cancel/#{order_cancellation_request_id}", + # method: :delete, + # headers: { + # 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid + # } + # ) + # end + + # (관리자) + # 주문 취소 요청을 반려처리 한다 + def reject_order_cancel(idempotency_key: nil, order_cancellation_request_id:, message: nil) request( uri: "order/cancel/#{order_cancellation_request_id}", method: :delete, headers: { 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid - } + }, + payload: { + message: message + }.compact ) end + # (관리자) # 주문 취소 요청을 승인처리 한다 - def approve_order_cancel(idempotency_key: nil, order_cancellation_request_history_id:) + def approve_order_cancel(idempotency_key: nil, order_cancellation_request_history_id:, message: nil) request( uri: "order/cancel/#{order_cancellation_request_history_id}/approve", method: :post, headers: { 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid - } + }, + payload: { + message: message + }.compact ) end end From 86a8cc805d2781abfc0874cd78e91ac00a3152d4 Mon Sep 17 00:00:00 2001 From: rupy1014 Date: Thu, 5 Jun 2025 17:18:25 +0900 Subject: [PATCH 090/133] =?UTF-8?q?order=5Fcancel=20reject,=20apporve=20?= =?UTF-8?q?=EA=B2=BD=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay_store/concern/payment.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/bootpay_store/concern/payment.rb b/lib/bootpay_store/concern/payment.rb index f7c8797..7dc525f 100644 --- a/lib/bootpay_store/concern/payment.rb +++ b/lib/bootpay_store/concern/payment.rb @@ -45,8 +45,8 @@ def request_order_cancel(idempotency_key: nil, cancel_id: nil, order_number:, ca # 주문 취소 요청을 반려처리 한다 def reject_order_cancel(idempotency_key: nil, order_cancellation_request_id:, message: nil) request( - uri: "order/cancel/#{order_cancellation_request_id}", - method: :delete, + uri: "order/cancel/#{order_cancellation_request_id}/reject", + method: :put, headers: { 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid }, @@ -61,7 +61,7 @@ def reject_order_cancel(idempotency_key: nil, order_cancellation_request_id:, me def approve_order_cancel(idempotency_key: nil, order_cancellation_request_history_id:, message: nil) request( uri: "order/cancel/#{order_cancellation_request_history_id}/approve", - method: :post, + method: :put, headers: { 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid }, From d1f228e6b423214216df30eb36975e94439bd25c Mon Sep 17 00:00:00 2001 From: gosomi Date: Wed, 11 Jun 2025 13:53:43 +0900 Subject: [PATCH 091/133] =?UTF-8?q?rest=20api=20=ED=86=A0=ED=81=B0=20?= =?UTF-8?q?=EA=B0=80=EC=A0=B8=EC=98=A4=EA=B8=B0=20=EA=B8=B0=EB=8A=A5=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay_store/bootpay-store-rest-client.rb | 6 +++--- lib/bootpay_store/concern/token.rb | 5 ++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/bootpay_store/bootpay-store-rest-client.rb b/lib/bootpay_store/bootpay-store-rest-client.rb index 6e97eec..f68aff2 100644 --- a/lib/bootpay_store/bootpay-store-rest-client.rb +++ b/lib/bootpay_store/bootpay-store-rest-client.rb @@ -19,9 +19,9 @@ class RestClient SDK_VERSION = '5.0.0' - def initialize(server_key:, private_key:, mode: 'production') - @server_key = server_key - @private_key = private_key + def initialize(client_key: nil, private_key: nil, server_key: nil, secret_key: nil, mode: 'production') + @client_key = server_key.presence || client_key + @secret_key = private_key.presence || secret_key @mode = mode.presence || 'production' @token = nil @api_version = SDK_VERSION diff --git a/lib/bootpay_store/concern/token.rb b/lib/bootpay_store/concern/token.rb index 8e5c42f..37c65cf 100644 --- a/lib/bootpay_store/concern/token.rb +++ b/lib/bootpay_store/concern/token.rb @@ -8,9 +8,8 @@ module BootpayStore::Concern::Token def request_access_token response = request( uri: 'request/token', - payload: { - server_key: @server_key, - private_key: @private_key + headers: { + Authorization: "Basic #{Base64.strict_encode64("#{@client_key}:#{@secret_key}")}" } ) @token = response.data[:access_token] if response.success? From 923ae073ac2b1d74947cf7a34f623143ee766170 Mon Sep 17 00:00:00 2001 From: gosomi Date: Wed, 11 Jun 2025 14:37:21 +0900 Subject: [PATCH 092/133] =?UTF-8?q?authorization=20header=EB=A5=BC=20token?= =?UTF-8?q?=20=EA=B0=92=EC=9D=B4=20=EC=97=86=EC=9C=BC=EB=A9=B4=20=EC=95=88?= =?UTF-8?q?=EB=B3=B4=EB=82=B4=EB=8F=84=EB=A1=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay/concern/rest.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bootpay/concern/rest.rb b/lib/bootpay/concern/rest.rb index abb0f4b..406bc16 100644 --- a/lib/bootpay/concern/rest.rb +++ b/lib/bootpay/concern/rest.rb @@ -10,7 +10,7 @@ module Bootpay::Concern::Rest def request(method: :post, uri:, payload: {}, headers: {}, params: nil) response = HTTP.headers( { - Authorization: "Bearer #{@token}", + Authorization: ("Bearer #{@token}" if @token.present?), content_type: 'application/json', accept: 'application/json', bootpay_api_version: @api_version, From 8f90b6f66f051ad917f3a6ff67af0b160b492e12 Mon Sep 17 00:00:00 2001 From: gosomi Date: Thu, 12 Jun 2025 11:45:58 +0900 Subject: [PATCH 093/133] =?UTF-8?q?supervisor=20=EC=B7=A8=EC=86=8C=20URL?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay_store/concern/supervisor.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bootpay_store/concern/supervisor.rb b/lib/bootpay_store/concern/supervisor.rb index 16a7d17..7e3e606 100644 --- a/lib/bootpay_store/concern/supervisor.rb +++ b/lib/bootpay_store/concern/supervisor.rb @@ -9,7 +9,7 @@ def supervisor_request_order_cancel(idempotency_key: nil, cancel_id: nil, order_ cancel_tax_free_price: 0, cancel_requester: '시스템', cancel_message: '요청취소', cancel_immediately: false, cancel_order_subscription_bills: nil) request( - uri: 'role/supervisor/order/cancel', + uri: 'supervisor/order/cancel', headers: { 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, }, From 20288d374a264b7ffe78709a59b41c500556f92a Mon Sep 17 00:00:00 2001 From: gosomi Date: Wed, 18 Jun 2025 09:17:16 +0900 Subject: [PATCH 094/133] =?UTF-8?q?user=20=EC=A1=B0=ED=9A=8C=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile | 2 +- .../bootpay-store-rest-client.rb | 1 + lib/bootpay_store/concern/payment.rb | 9 +- lib/bootpay_store/concern/supervisor.rb | 3 +- lib/bootpay_store/concern/user.rb | 85 +++++++++++++++++++ .../order/cancel/cancel_bill_spec.rb | 37 ++++++++ .../order/cancel/cancel_price_only_spec.rb | 22 +++++ .../order/cancel/cancel_product_spec.rb | 28 ++++++ .../cancel/cancel_request_revoke_spec.rb | 20 +++++ spec/bootpay_store/order/cancel_spec.rb | 18 ++++ .../supervisor/order/cancel_spec.rb | 18 ++++ spec/bootpay_store/token_spec.rb | 21 +++-- spec/bootpay_store/user/lookup_user_spec.rb | 18 ++++ spec/bootpay_store/user/sign_in_spec.rb | 23 +++++ spec/bootpay_store/user/user_id_login_spec.rb | 18 ++++ spec/bootpay_store/user/users_spec.rb | 24 ++++++ spec/thread_test_spec.rb | 18 ++++ 17 files changed, 350 insertions(+), 15 deletions(-) create mode 100644 spec/bootpay_store/order/cancel/cancel_bill_spec.rb create mode 100644 spec/bootpay_store/order/cancel/cancel_price_only_spec.rb create mode 100644 spec/bootpay_store/order/cancel/cancel_product_spec.rb create mode 100644 spec/bootpay_store/order/cancel/cancel_request_revoke_spec.rb create mode 100644 spec/bootpay_store/order/cancel_spec.rb create mode 100644 spec/bootpay_store/supervisor/order/cancel_spec.rb create mode 100644 spec/bootpay_store/user/lookup_user_spec.rb create mode 100644 spec/bootpay_store/user/sign_in_spec.rb create mode 100644 spec/bootpay_store/user/user_id_login_spec.rb create mode 100644 spec/bootpay_store/user/users_spec.rb create mode 100644 spec/thread_test_spec.rb diff --git a/Gemfile b/Gemfile index eba9392..000b816 100644 --- a/Gemfile +++ b/Gemfile @@ -7,4 +7,4 @@ gemspec gem "rake", "~> 13.0" -gem "rspec", "~> 3.0" +gem "rspec", "~> 3.0" \ No newline at end of file diff --git a/lib/bootpay_store/bootpay-store-rest-client.rb b/lib/bootpay_store/bootpay-store-rest-client.rb index f68aff2..96da199 100644 --- a/lib/bootpay_store/bootpay-store-rest-client.rb +++ b/lib/bootpay_store/bootpay-store-rest-client.rb @@ -2,6 +2,7 @@ require 'active_support/all' require 'http' +require 'base64' require_relative 'response' require_relative '../version' require_relative 'concern' diff --git a/lib/bootpay_store/concern/payment.rb b/lib/bootpay_store/concern/payment.rb index 7dc525f..dd3050a 100644 --- a/lib/bootpay_store/concern/payment.rb +++ b/lib/bootpay_store/concern/payment.rb @@ -12,6 +12,7 @@ def request_order_cancel(idempotency_key: nil, cancel_id: nil, order_number:, ca uri: 'order/cancel', headers: { 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'user' }, payload: { @@ -51,8 +52,8 @@ def reject_order_cancel(idempotency_key: nil, order_cancellation_request_id:, me 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid }, payload: { - message: message - }.compact + message: message + }.compact ) end @@ -66,8 +67,8 @@ def approve_order_cancel(idempotency_key: nil, order_cancellation_request_histor 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid }, payload: { - message: message - }.compact + message: message + }.compact ) end end diff --git a/lib/bootpay_store/concern/supervisor.rb b/lib/bootpay_store/concern/supervisor.rb index 7e3e606..d2dfa83 100644 --- a/lib/bootpay_store/concern/supervisor.rb +++ b/lib/bootpay_store/concern/supervisor.rb @@ -9,9 +9,10 @@ def supervisor_request_order_cancel(idempotency_key: nil, cancel_id: nil, order_ cancel_tax_free_price: 0, cancel_requester: '시스템', cancel_message: '요청취소', cancel_immediately: false, cancel_order_subscription_bills: nil) request( - uri: 'supervisor/order/cancel', + uri: 'order/cancel', headers: { 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'supervisor' }, payload: { diff --git a/lib/bootpay_store/concern/user.rb b/lib/bootpay_store/concern/user.rb index c5b1a49..adab484 100644 --- a/lib/bootpay_store/concern/user.rb +++ b/lib/bootpay_store/concern/user.rb @@ -10,6 +10,7 @@ def login_by_user_id(user_id:, idempotency_key: nil) uri: "users/login/token", headers: { 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'user' }, payload: { @@ -17,5 +18,89 @@ def login_by_user_id(user_id:, idempotency_key: nil) } ) end + + # 회원 목록 정보를 가져온다 + # Comment by GOSOMI + # @date: 2025-06-16 + def users(member_type: nil, keyword: nil, page: 1, limit: 20, idempotency_key: nil) + request( + uri: 'users', + method: :get, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'user' + }, + params: + { + member_type: member_type, + keyword: keyword, + page: page, + limit: limit + }.compact + ) + end + + # 회원정보를 조회한다 + # Comment by GOSOMI + # @date: 2025-06-16 + def lookup_user(user_id:, idempotency_key: nil) + request( + uri: "user/users/#{user_id}", + method: :get, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + } + ) + end + + # 회원가입 + # Comment by GOSOMI + # @date: 2025-06-16 + def external_user_sign_in(ex_uid:, user_group_id:, is_group_admin:, + name:, phone:, email:, tel:, nickname:, comment:, + gender:, birth:, individual_extension:, login_id:, login_email:, login_pw:, + join_at:) + request( + uri: 'user/user/join', + method: :post, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'user' + }, + payload: + { + ex_uid: ex_uid, + user_group_id: user_group_id, + is_group_admin: is_group_admin, + name: name, + phone: phone, + email: email, + tel: tel, + nickname: nickname, + comment: comment, + gender: gender, + birth: birth, + individual_extension: individual_extension, + login_id: login_id, + login_email: login_email, + login_pw: login_pw, + join_at: join_at + }.compact + ) + end + + # 회원 탈퇴 + # Comment by GOSOMI + # @date: 2025-06-16 + def withdraw(user_id:, idempotency_key: nil) + request( + uri: "user/users/#{user_id}", + method: :delete, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'user' + } + ) + end end end \ No newline at end of file diff --git a/spec/bootpay_store/order/cancel/cancel_bill_spec.rb b/spec/bootpay_store/order/cancel/cancel_bill_spec.rb new file mode 100644 index 0000000..92204f5 --- /dev/null +++ b/spec/bootpay_store/order/cancel/cancel_bill_spec.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +RSpec.describe BootpayStore::RestClient do + it "order cancel bill" do + api = BootpayStore::RestClient.new( + server_key: '644642d87ae4e600391a7cd3', + private_key: 'tnNiygbEITl62dmDr9zf3uJFMFtT+R3AuB2eEnDqR4M=', + mode: 'development' + ) + token = api.request_access_token + if token.success? + response = api.request_order_cancel( + order_number: '25051972298187324135', + cancel_order_subscription_bills: [ + { + order_subscription_bill_id: '682ab449978ad361d56817c0', + cancel_quantity: 1 + } + ], + cancel_immediately: false + ) + response = api.request_order_cancel( + order_number: '25051972298187324135', + cancel_order_subscription_bills: [ + { + order_subscription_bill_id: '682ab44f978ad361d56817c8', + cancel_quantity: 1 + } + ], + cancel_immediately: false + ) + puts response.data.to_json + else + puts token.data + end + end +end diff --git a/spec/bootpay_store/order/cancel/cancel_price_only_spec.rb b/spec/bootpay_store/order/cancel/cancel_price_only_spec.rb new file mode 100644 index 0000000..31cc14c --- /dev/null +++ b/spec/bootpay_store/order/cancel/cancel_price_only_spec.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +RSpec.describe BootpayStore::RestClient do + it "order cancel price only" do + api = BootpayStore::RestClient.new( + server_key: '644642d87ae4e600391a7cd3', + private_key: 'tnNiygbEITl62dmDr9zf3uJFMFtT+R3AuB2eEnDqR4M=', + mode: 'development' + ) + token = api.request_access_token + if token.success? + response = api.request_order_cancel( + order_number: '25041526449271573094', + cancel_immediately: true + # cancel_price: 8500 + ) + puts response.data.to_json + else + puts token.data + end + end +end diff --git a/spec/bootpay_store/order/cancel/cancel_product_spec.rb b/spec/bootpay_store/order/cancel/cancel_product_spec.rb new file mode 100644 index 0000000..c97c42a --- /dev/null +++ b/spec/bootpay_store/order/cancel/cancel_product_spec.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +RSpec.describe BootpayStore::RestClient do + it "order cancel product" do + api = BootpayStore::RestClient.new( + server_key: '644642d87ae4e600391a7cd3', + private_key: 'tnNiygbEITl62dmDr9zf3uJFMFtT+R3AuB2eEnDqR4M=', + mode: 'development' + ) + token = api.request_access_token + if token.success? + response = api.request_order_cancel( + order_number: '25041415037360150093', + cancel_products: [ + { + product_id: '6709c58f7975188b6e6fce93', + product_option_id: '67f5b8e9b0baf4514ad93e31', + cancel_quantity: 1 + } + ], + cancel_immediately: true + ) + puts response.data.to_json + else + puts token.data + end + end +end diff --git a/spec/bootpay_store/order/cancel/cancel_request_revoke_spec.rb b/spec/bootpay_store/order/cancel/cancel_request_revoke_spec.rb new file mode 100644 index 0000000..72ff290 --- /dev/null +++ b/spec/bootpay_store/order/cancel/cancel_request_revoke_spec.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +RSpec.describe BootpayStore::RestClient do + it "order cancel product" do + api = BootpayStore::RestClient.new( + server_key: '644642d87ae4e600391a7cd3', + private_key: 'tnNiygbEITl62dmDr9zf3uJFMFtT+R3AuB2eEnDqR4M=', + mode: 'development' + ) + token = api.request_access_token + if token.success? + response = api.request_order_cancel_revoke( + order_cancellation_request_id: '67f8967429ef1f27072deee9' + ) + puts response.data.to_json + else + puts token.data + end + end +end diff --git a/spec/bootpay_store/order/cancel_spec.rb b/spec/bootpay_store/order/cancel_spec.rb new file mode 100644 index 0000000..6e603c5 --- /dev/null +++ b/spec/bootpay_store/order/cancel_spec.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +RSpec.describe BootpayStore::RestClient do + it "order cancel" do + api = BootpayStore::RestClient.new( + client_key: 'QIzXk4M3EeD-6B1GTfmGHA', + secret_key: 'vRle44QfyBj7nzJlBbeebqkbtlJVRTS2DQa9Adpz3d8=', + mode: 'development' + ) + token = api.request_access_token + if token.success? + response = api.order_cancel(order_id: Time.current.to_i) + puts response.data + else + puts token.data + end + end +end diff --git a/spec/bootpay_store/supervisor/order/cancel_spec.rb b/spec/bootpay_store/supervisor/order/cancel_spec.rb new file mode 100644 index 0000000..9370d9a --- /dev/null +++ b/spec/bootpay_store/supervisor/order/cancel_spec.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +RSpec.describe BootpayStore::RestClient do + it "order cancel" do + api = BootpayStore::RestClient.new( + client_key: 'QIzXk4M3EeD-6B1GTfmGHA', + secret_key: 'vRle44QfyBj7nzJlBbeebqkbtlJVRTS2DQa9Adpz3d8=', + mode: 'development' + ) + token = api.request_access_token + if token.success? + response = api.supervisor_request_order_cancel(order_number: Time.current.to_i) + puts response.data + else + puts token.data + end + end +end diff --git a/spec/bootpay_store/token_spec.rb b/spec/bootpay_store/token_spec.rb index 3636ec2..7846aa3 100644 --- a/spec/bootpay_store/token_spec.rb +++ b/spec/bootpay_store/token_spec.rb @@ -2,16 +2,19 @@ RSpec.describe BootpayStore::RestClient do it "token" do - api = BootpayStore::RestClient.new( - server_key: '67c92fb8d01640bb9859c612', - private_key: 'ugaqkJ8/Yd2HHjM+W1TF6FZQPTmvx1rny5OIrMqcpTY=', - mode: 'development' + # api = BootpayStore::RestClient.new( + # server_key: '67c92fb8d01640bb9859c612', + # private_key: 'ugaqkJ8/Yd2HHjM+W1TF6FZQPTmvx1rny5OIrMqcpTY=', + # mode: 'development' + # ) + api = BootpayStore::RestClient.new( + client_key: 'QIzXk4M3EeD-6B1GTfmGHA', + secret_key: 'vRle44QfyBj7nzJlBbeebqkbtlJVRTS2DQa9Adpz3d8=', + mode: 'development' ) response = api.request_access_token - # print response.data.to_json - json = JSON.parse(response.data.to_json) - puts json - puts json['access_token'] - # print response.data.to_json + puts response.data + + "f32b56e3cba4de2c2a9819cf0bde00729e7772bae46e4d7c681e14f95cf5814a" end end diff --git a/spec/bootpay_store/user/lookup_user_spec.rb b/spec/bootpay_store/user/lookup_user_spec.rb new file mode 100644 index 0000000..ff22629 --- /dev/null +++ b/spec/bootpay_store/user/lookup_user_spec.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +RSpec.describe BootpayStore::RestClient do + it "lookup user" do + api = BootpayStore::RestClient.new( + client_key: 'QIzXk4M3EeD-6B1GTfmGHA', + secret_key: 'vRle44QfyBj7nzJlBbeebqkbtlJVRTS2DQa9Adpz3d8=', + mode: 'development' + ) + token = api.request_access_token + if token.success? + response = api.lookup_user('6763ce2b817af6a00e0fbfbd') + puts response.data.to_json + else + puts token.data + end + end +end diff --git a/spec/bootpay_store/user/sign_in_spec.rb b/spec/bootpay_store/user/sign_in_spec.rb new file mode 100644 index 0000000..2849c45 --- /dev/null +++ b/spec/bootpay_store/user/sign_in_spec.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +RSpec.describe BootpayStore::RestClient do + it "sign in" do + api = BootpayStore::RestClient.new( + client_key: 'QIzXk4M3EeD-6B1GTfmGHA', + secret_key: 'vRle44QfyBj7nzJlBbeebqkbtlJVRTS2DQa9Adpz3d8=', + mode: 'development' + ) + token = api.request_access_token + if token.success? + response = api.sign_in( + name: 'test', + email: 'test@bootpay.co.kr', + phone: '01012345678', + + ) + puts response.data.to_json + else + puts token.data + end + end +end diff --git a/spec/bootpay_store/user/user_id_login_spec.rb b/spec/bootpay_store/user/user_id_login_spec.rb new file mode 100644 index 0000000..4c5dde9 --- /dev/null +++ b/spec/bootpay_store/user/user_id_login_spec.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +RSpec.describe BootpayStore::RestClient do + it "user login" do + api = BootpayStore::RestClient.new( + client_key: 'QIzXk4M3EeD-6B1GTfmGHA', + secret_key: 'vRle44QfyBj7nzJlBbeebqkbtlJVRTS2DQa9Adpz3d8=', + mode: 'development' + ) + token = api.request_access_token + if token.success? + response = api.login_by_user_id(user_id: '6763ce2b817af6a00e0fbfbd') + puts response.data + else + puts token.data + end + end +end diff --git a/spec/bootpay_store/user/users_spec.rb b/spec/bootpay_store/user/users_spec.rb new file mode 100644 index 0000000..a0f2269 --- /dev/null +++ b/spec/bootpay_store/user/users_spec.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +RSpec.describe BootpayStore::RestClient do + it "users" do + # api = BootpayStore::RestClient.new( + # client_key: 'QIzXk4M3EeD-6B1GTfmGHA', + # secret_key: 'vRle44QfyBj7nzJlBbeebqkbtlJVRTS2DQa9Adpz3d8=', + # mode: 'development' + # ) + + api = BootpayStore::RestClient.new( + client_key: 'PFPsUXTj9A7ySxJSQ0w01g', + secret_key: '4QoNzXcjT_H4brpq0AgM8ETtrBTFhabo3gmU_DJ148E=', + mode: 'stage' + ) + token = api.request_access_token + if token.success? + response = api.users + puts response.data.to_json + else + puts token.data + end + end +end diff --git a/spec/thread_test_spec.rb b/spec/thread_test_spec.rb new file mode 100644 index 0000000..b8e62c8 --- /dev/null +++ b/spec/thread_test_spec.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +RSpec.describe Bootpay::RestClient do + it "thread test" do + threads = [] + 3000.times do |i| + threads << Thread.new do + puts "thread #{i} start" + loop do + response = HTTP.get('http://192.168.55.76:10000') + puts "status: #{response.status.to_i}, headers: #{response.headers.map { |k, v| [k, v].join('=') }.join(', ')}" + sleep(2) + end + end + end + threads.each { |thr| thr.join } + end +end From 11ea99d9d4bb9254cfa8324e45a543b3e2fc0534 Mon Sep 17 00:00:00 2001 From: gosomi Date: Wed, 18 Jun 2025 13:37:35 +0900 Subject: [PATCH 095/133] =?UTF-8?q?spec=20=ED=8C=8C=EC=9D=BC=20=EB=AA=A8?= =?UTF-8?q?=EB=91=90=20=EC=82=AC=EA=B2=A2=20bootpay=20store=20spec=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + lib/bootpay_store/concern/user.rb | 66 ++++++++++++++++++- .../confirm_authentication_rest_spec.rb | 23 ------- .../realarm_authentication_spec.rb | 20 ------ .../request_authentication_rest_spec.rb | 31 --------- spec/bootpay/billing_key_spec.rb | 22 ------- spec/bootpay/cancel_cash_receipt_spec.rb | 24 ------- spec/bootpay/cancel_spec.rb | 24 ------- spec/bootpay/cancel_subscribe_reserve_spec.rb | 31 --------- spec/bootpay/cash_cancel_on_receipt_spec.rb | 19 ------ spec/bootpay/cash_publish_on_receipt_spec.rb | 22 ------- spec/bootpay/certificate_spec.rb | 23 ------- spec/bootpay/confirm_payment_spec.rb | 22 ------- spec/bootpay/destroy_billing_key_spec.rb | 17 ----- spec/bootpay/notification_spec.rb | 22 ------- spec/bootpay/receipt_payment_spec.rb | 22 ------- spec/bootpay/request_cash_receipt_spec.rb | 34 ---------- spec/bootpay/request_token_spec.rb | 16 ----- spec/bootpay/request_user_token_spec.rb | 17 ----- .../reseller_create_seller_app_spec.rb | 21 ------ spec/bootpay/reseller_create_seller_spec.rb | 22 ------- spec/bootpay/reseller_member_invite_spec.rb | 29 -------- spec/bootpay/rest/client_spec.rb | 11 ---- spec/bootpay/sdk_regist_biometric_spec.rb | 26 -------- spec/bootpay/sdk_wallet_spec.rb | 21 ------ spec/bootpay/seller_payment_method_spec.rb | 15 ----- spec/bootpay/shipping_start_spec.rb | 26 -------- .../subscribe_automatic_transfer_spec.rb | 42 ------------ spec/bootpay/subscribe_card_payment_spec.rb | 31 --------- .../bootpay/subscribe_payment_reserve_spec.rb | 32 --------- spec/bootpay/subscribe_payment_spec.rb | 31 --------- spec/bootpay/user_wallets_spec.rb | 23 ------- spec/bootpay_store/user/email_exist_spec.rb | 20 ++++++ .../user/group_business_number_exist_spec.rb | 20 ++++++ spec/bootpay_store/user/id_exist_spec.rb | 20 ++++++ spec/bootpay_store/user/phone_exist_spec.rb | 20 ++++++ 36 files changed, 144 insertions(+), 722 deletions(-) delete mode 100644 spec/bootpay/authenticate/confirm_authentication_rest_spec.rb delete mode 100644 spec/bootpay/authenticate/realarm_authentication_spec.rb delete mode 100644 spec/bootpay/authenticate/request_authentication_rest_spec.rb delete mode 100644 spec/bootpay/billing_key_spec.rb delete mode 100644 spec/bootpay/cancel_cash_receipt_spec.rb delete mode 100644 spec/bootpay/cancel_spec.rb delete mode 100644 spec/bootpay/cancel_subscribe_reserve_spec.rb delete mode 100644 spec/bootpay/cash_cancel_on_receipt_spec.rb delete mode 100644 spec/bootpay/cash_publish_on_receipt_spec.rb delete mode 100644 spec/bootpay/certificate_spec.rb delete mode 100644 spec/bootpay/confirm_payment_spec.rb delete mode 100644 spec/bootpay/destroy_billing_key_spec.rb delete mode 100644 spec/bootpay/notification_spec.rb delete mode 100644 spec/bootpay/receipt_payment_spec.rb delete mode 100644 spec/bootpay/request_cash_receipt_spec.rb delete mode 100644 spec/bootpay/request_token_spec.rb delete mode 100644 spec/bootpay/request_user_token_spec.rb delete mode 100644 spec/bootpay/reseller_create_seller_app_spec.rb delete mode 100644 spec/bootpay/reseller_create_seller_spec.rb delete mode 100644 spec/bootpay/reseller_member_invite_spec.rb delete mode 100644 spec/bootpay/rest/client_spec.rb delete mode 100644 spec/bootpay/sdk_regist_biometric_spec.rb delete mode 100644 spec/bootpay/sdk_wallet_spec.rb delete mode 100644 spec/bootpay/seller_payment_method_spec.rb delete mode 100644 spec/bootpay/shipping_start_spec.rb delete mode 100644 spec/bootpay/subscribe_automatic_transfer_spec.rb delete mode 100644 spec/bootpay/subscribe_card_payment_spec.rb delete mode 100644 spec/bootpay/subscribe_payment_reserve_spec.rb delete mode 100644 spec/bootpay/subscribe_payment_spec.rb delete mode 100644 spec/bootpay/user_wallets_spec.rb create mode 100644 spec/bootpay_store/user/email_exist_spec.rb create mode 100644 spec/bootpay_store/user/group_business_number_exist_spec.rb create mode 100644 spec/bootpay_store/user/id_exist_spec.rb create mode 100644 spec/bootpay_store/user/phone_exist_spec.rb diff --git a/.gitignore b/.gitignore index 902cefd..16ba5b2 100644 --- a/.gitignore +++ b/.gitignore @@ -16,4 +16,5 @@ Gemfile.lock /spec/bootpay/card_billing/request_rest_billing_key_spec.rb /spec/bootpay/__stage_test_unit_spec.rb /spec/bootpay/__development_test_unit_spec.rb +/spec/bootpay/ .DS_Store \ No newline at end of file diff --git a/lib/bootpay_store/concern/user.rb b/lib/bootpay_store/concern/user.rb index adab484..b8d0513 100644 --- a/lib/bootpay_store/concern/user.rb +++ b/lib/bootpay_store/concern/user.rb @@ -45,7 +45,7 @@ def users(member_type: nil, keyword: nil, page: 1, limit: 20, idempotency_key: n # @date: 2025-06-16 def lookup_user(user_id:, idempotency_key: nil) request( - uri: "user/users/#{user_id}", + uri: "users/#{user_id}", method: :get, headers: { 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, @@ -61,7 +61,7 @@ def external_user_sign_in(ex_uid:, user_group_id:, is_group_admin:, gender:, birth:, individual_extension:, login_id:, login_email:, login_pw:, join_at:) request( - uri: 'user/user/join', + uri: 'users/join', method: :post, headers: { 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, @@ -94,7 +94,7 @@ def external_user_sign_in(ex_uid:, user_group_id:, is_group_admin:, # @date: 2025-06-16 def withdraw(user_id:, idempotency_key: nil) request( - uri: "user/users/#{user_id}", + uri: "users/#{user_id}", method: :delete, headers: { 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, @@ -102,5 +102,65 @@ def withdraw(user_id:, idempotency_key: nil) } ) end + + # 이메일 중복검사 + # Comment by GOSOMI + # @date: 2025-06-18 + def email_exist(email:, idempotency_key: nil) + request( + uri: 'users/join/email-exist', + method: :get, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'user' + }, + params: { pk: email } + ) + end + + # ID 중복검사 + # Comment by GOSOMI + # @date: 2025-06-18 + def id_exist(id:, idempotency_key: nil) + request( + uri: 'users/join/id-exist', + method: :get, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'user' + }, + params: { pk: id } + ) + end + + # 전화번호 중복검사 + # Comment by GOSOMI + # @date: 2025-06-18 + def phone_exist(phone:, idempotency_key: nil) + request( + uri: 'users/join/phone-exist', + method: :get, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'user' + }, + params: { pk: phone } + ) + end + + # 그룹 사업자 번호 중복검사 + # Comment by GOSOMI + # @date: 2025-06-18 + def group_business_number_exist(business_number:, idempotency: nil) + request( + uri: 'users/join/group-business-number-exist', + method: :get, + headers: { + 'Idempotency-Key' => idempotency.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'user' + }, + params: { pk: business_number } + ) + end end end \ No newline at end of file diff --git a/spec/bootpay/authenticate/confirm_authentication_rest_spec.rb b/spec/bootpay/authenticate/confirm_authentication_rest_spec.rb deleted file mode 100644 index 7fec3ff..0000000 --- a/spec/bootpay/authenticate/confirm_authentication_rest_spec.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe Bootpay::RestClient do - it "request authentication" do - api = Bootpay::RestClient.new( - application_id: '59bfc738e13f337dbd6ca48a', - private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', - mode: 'development' - ) - # api = Bootpay::RestClient.new( - # application_id: '62d60a39e38c3000235afe63', - # private_key: 'Nuu09hRbQ+8EmEfLEu1HeaLwsZd38BJmtwhLa1pxI24=', - # mode: 'stage' - # ) - if api.request_access_token.success? - response = api.confirm_authentication( - receipt_id: '63634d161fc19203724b3ac6', - otp: '953673', - ) - print response.data.to_json - end - end -end diff --git a/spec/bootpay/authenticate/realarm_authentication_spec.rb b/spec/bootpay/authenticate/realarm_authentication_spec.rb deleted file mode 100644 index 1725acf..0000000 --- a/spec/bootpay/authenticate/realarm_authentication_spec.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe Bootpay::RestClient do - it "request authentication" do - api = Bootpay::RestClient.new( - application_id: '59bfc738e13f337dbd6ca48a', - private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', - mode: 'development' - ) - # api = Bootpay::RestClient.new( - # application_id: '62d60a39e38c3000235afe63', - # private_key: 'Nuu09hRbQ+8EmEfLEu1HeaLwsZd38BJmtwhLa1pxI24=', - # mode: 'stage' - # ) - if api.request_access_token.success? - response = api.realarm_authentication('63647ea31fc1920373e6d8f3') - print response.data.to_json - end - end -end diff --git a/spec/bootpay/authenticate/request_authentication_rest_spec.rb b/spec/bootpay/authenticate/request_authentication_rest_spec.rb deleted file mode 100644 index f227f6e..0000000 --- a/spec/bootpay/authenticate/request_authentication_rest_spec.rb +++ /dev/null @@ -1,31 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe Bootpay::RestClient do - it "request authentication" do - api = Bootpay::RestClient.new( - application_id: '59bfc738e13f337dbd6ca48a', - private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', - mode: 'development' - ) - # api = Bootpay::RestClient.new( - # application_id: '62d60a39e38c3000235afe63', - # private_key: 'Nuu09hRbQ+8EmEfLEu1HeaLwsZd38BJmtwhLa1pxI24=', - # mode: 'stage' - # ) - if api.request_access_token.success? - response = api.request_authentication( - pg: '다날', - method: '본인인증', - username: '강훈', - identity_no: '8410251', - carrier: 'SKT', - phone: '01095735114', - site_url: 'https://www.bootpay.co.kr', - order_name: '본인인증하기 ', - authentication_id: Time.now.to_i.to_s, - authenticate_type: 'sms' - ) - print response.data.to_json - end - end -end diff --git a/spec/bootpay/billing_key_spec.rb b/spec/bootpay/billing_key_spec.rb deleted file mode 100644 index 3f0ca10..0000000 --- a/spec/bootpay/billing_key_spec.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe Bootpay::RestClient do - it "billing key" do - # api = Bootpay::RestClient.new( - # application_id: '59bfc738e13f337dbd6ca48a', - # private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', - # mode: 'development' - # ) - api = Bootpay::RestClient.new( - application_id: '59b731f084382614ebf72215', - private_key: 'WwDv0UjfwFa04wYG0LJZZv1xwraQnlhnHE375n52X0U=', - mode: 'stage' - ) - if api.request_access_token.success? - response = api.lookup_subscribe_billing_key( - "633f69a3d01c7e002a4c75ea" - ) - print response.data.to_json - end - end -end diff --git a/spec/bootpay/cancel_cash_receipt_spec.rb b/spec/bootpay/cancel_cash_receipt_spec.rb deleted file mode 100644 index b6ebaeb..0000000 --- a/spec/bootpay/cancel_cash_receipt_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe Bootpay::RestClient do - it "cancel cash receipt" do - # api = Bootpay::RestClient.new( - # application_id: '59bfc738e13f337dbd6ca48a', - # private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', - # mode: 'development' - # ) - api = Bootpay::RestClient.new( - application_id: '59b731f084382614ebf72215', - private_key: 'WwDv0UjfwFa04wYG0LJZZv1xwraQnlhnHE375n52X0U=', - mode: 'stage' - ) - if api.request_access_token.success? - response = api.cancel_cash_receipt( - receipt_id: '6327ad0743c9be001679f5e7', - cancel_username: 'test', - cancel_message: 'test 취소' - ) - print response.data.to_json - end - end -end diff --git a/spec/bootpay/cancel_spec.rb b/spec/bootpay/cancel_spec.rb deleted file mode 100644 index 76f794b..0000000 --- a/spec/bootpay/cancel_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe Bootpay::RestClient do - it "cancel payment" do - # api = Bootpay::RestClient.new( - # application_id: '59bfc738e13f337dbd6ca48a', - # private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', - # mode: 'development' - # ) - api = Bootpay::RestClient.new( - application_id: '59b731f084382614ebf72215', - private_key: 'WwDv0UjfwFa04wYG0LJZZv1xwraQnlhnHE375n52X0U=', - mode: 'stage' - ) - if api.request_access_token.success? - response = api.cancel_payment( - receipt_id: "6327ab8143c9be001679f5d2", - cancel_username: 'test_user', - cancel_message: 'test_message', - ) - print response.data.to_json - end - end -end diff --git a/spec/bootpay/cancel_subscribe_reserve_spec.rb b/spec/bootpay/cancel_subscribe_reserve_spec.rb deleted file mode 100644 index edb3b58..0000000 --- a/spec/bootpay/cancel_subscribe_reserve_spec.rb +++ /dev/null @@ -1,31 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe Bootpay::RestClient do - it "cancel subscribe reserve" do - api = Bootpay::RestClient.new( - application_id: '59bfc738e13f337dbd6ca48a', - private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', - mode: 'development' - ) - if api.request_access_token.success? - response = api.subscribe_payment_reserve( - billing_key: '623028630e019e036fe98478', - order_name: '테스트결제', - price: 1000, - order_id: Time.current.to_i, - user: { - phone: '01000000000', - username: '홍길동', - email: 'test@bootpay.co.kr' - }, - reserve_execute_at: (Time.current + 5.seconds).iso8601 - ) - puts response.data.to_json - if response.success? - puts "cancel reserve_id: #{response.data[:reserve_id]}" - cancel = api.cancel_subscribe_reserve(response.data[:reserve_id]) - puts cancel.data.to_json - end - end - end -end diff --git a/spec/bootpay/cash_cancel_on_receipt_spec.rb b/spec/bootpay/cash_cancel_on_receipt_spec.rb deleted file mode 100644 index 8d8c709..0000000 --- a/spec/bootpay/cash_cancel_on_receipt_spec.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe Bootpay::RestClient do - it "certificate authentication" do - api = Bootpay::RestClient.new( - application_id: '59bfc738e13f337dbd6ca48a', - private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', - mode: 'development' - ) - if api.request_access_token.success? - response = api.cash_receipt_cancel_on_receipt( - receipt_id: "62e32b3f1fc192036e8db942", - cancel_username: '테스트', - cancel_message: '테스트취소' - ) - print response.data.to_json - end - end -end diff --git a/spec/bootpay/cash_publish_on_receipt_spec.rb b/spec/bootpay/cash_publish_on_receipt_spec.rb deleted file mode 100644 index fbb5854..0000000 --- a/spec/bootpay/cash_publish_on_receipt_spec.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe Bootpay::RestClient do - it "certificate authentication" do - api = Bootpay::RestClient.new( - application_id: '59bfc738e13f337dbd6ca48a', - private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', - mode: 'development' - ) - if api.request_access_token.success? - response = api.cash_receipt_publish_on_receipt( - receipt_id: "62e32b3f1fc192036e8db942", - username: '테스트', - email: 'test@bootpay.co.kr', - phone: '01000000000', - identity_no: '01000000000' - ) - print response.data.to_json - print Time.now - end - end -end diff --git a/spec/bootpay/certificate_spec.rb b/spec/bootpay/certificate_spec.rb deleted file mode 100644 index aaf58f6..0000000 --- a/spec/bootpay/certificate_spec.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe Bootpay::RestClient do - it "certificate authentication" do - # api = Bootpay::RestClient.new( - # application_id: '5c5cf060396fa678c275875a', - # private_key: 'WaS7S2Lb44K5uE7OtCpsTIN/bTneH4fWnILpPStkCNo=', - # mode: 'production' - # ) - - api = Bootpay::RestClient.new( - application_id: '59b731f084382614ebf72215', - private_key: 'WwDv0UjfwFa04wYG0LJZZv1xwraQnlhnHE375n52X0U=', - mode: 'stage' - ) - if api.request_access_token.success? - response = api.certificate( - "6327aaf743c9be001679f5cf" - ) - print response.data.to_json - end - end -end diff --git a/spec/bootpay/confirm_payment_spec.rb b/spec/bootpay/confirm_payment_spec.rb deleted file mode 100644 index cb9ffd2..0000000 --- a/spec/bootpay/confirm_payment_spec.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe Bootpay::RestClient do - it "confirm payment" do - # api = Bootpay::RestClient.new( - # application_id: '59bfc738e13f337dbd6ca48a', - # private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', - # mode: 'development' - # ) - api = Bootpay::RestClient.new( - application_id: '59b731f084382614ebf72215', - private_key: 'WwDv0UjfwFa04wYG0LJZZv1xwraQnlhnHE375n52X0U=', - mode: 'stage' - ) - if api.request_access_token.success? - response = api.confirm_payment( - "61d3d41b1fc19202e483320b" - ) - print response.data.to_json - end - end -end diff --git a/spec/bootpay/destroy_billing_key_spec.rb b/spec/bootpay/destroy_billing_key_spec.rb deleted file mode 100644 index dc19304..0000000 --- a/spec/bootpay/destroy_billing_key_spec.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe Bootpay::RestClient do - it "destroy billing key" do - api = Bootpay::RestClient.new( - application_id: '59bfc738e13f337dbd6ca48a', - private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', - mode: 'development' - ) - if api.request_access_token.success? - response = api.destroy_billing_key( - '633b7d0e0e019e039c9e2110' - ) - print response.data.to_json - end - end -end diff --git a/spec/bootpay/notification_spec.rb b/spec/bootpay/notification_spec.rb deleted file mode 100644 index cb9ffd2..0000000 --- a/spec/bootpay/notification_spec.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe Bootpay::RestClient do - it "confirm payment" do - # api = Bootpay::RestClient.new( - # application_id: '59bfc738e13f337dbd6ca48a', - # private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', - # mode: 'development' - # ) - api = Bootpay::RestClient.new( - application_id: '59b731f084382614ebf72215', - private_key: 'WwDv0UjfwFa04wYG0LJZZv1xwraQnlhnHE375n52X0U=', - mode: 'stage' - ) - if api.request_access_token.success? - response = api.confirm_payment( - "61d3d41b1fc19202e483320b" - ) - print response.data.to_json - end - end -end diff --git a/spec/bootpay/receipt_payment_spec.rb b/spec/bootpay/receipt_payment_spec.rb deleted file mode 100644 index 1bdaa28..0000000 --- a/spec/bootpay/receipt_payment_spec.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe Bootpay::RestClient do - it "receipt payment data" do - api = Bootpay::RestClient.new( - application_id: '59bfc738e13f337dbd6ca48a', - private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', - mode: 'development' - ) - # api = Bootpay::RestClient.new( - # application_id: '62d60a39e38c3000235afe63', - # private_key: 'Nuu09hRbQ+8EmEfLEu1HeaLwsZd38BJmtwhLa1pxI24=', - # mode: 'stage' - # ) - if api.request_access_token.success? - response = api.receipt_payment( - "632439131fc192036bac6308" - ) - print response.data.to_json - end - end -end diff --git a/spec/bootpay/request_cash_receipt_spec.rb b/spec/bootpay/request_cash_receipt_spec.rb deleted file mode 100644 index fc20bd4..0000000 --- a/spec/bootpay/request_cash_receipt_spec.rb +++ /dev/null @@ -1,34 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe Bootpay::RestClient do - it "request cash receipt" do - # api = Bootpay::RestClient.new( - # application_id: '59bfc738e13f337dbd6ca48a', - # private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', - # mode: 'development' - # ) - api = Bootpay::RestClient.new( - application_id: '59b731f084382614ebf72215', - private_key: 'WwDv0UjfwFa04wYG0LJZZv1xwraQnlhnHE375n52X0U=', - mode: 'stage' - ) - if api.request_access_token.success? - response = api.request_cash_receipt( - pg: '나이스페이', - price: 1000, - tax_free: 0, - order_name: '테스트', - cash_receipt_type: '소득공제', - user: { - username: '부트페이', - phone: '01000000000', - email: 'bootpay@bootpay.co.kr' - }, - identity_no: '0100000000', - purchased_at: Time.current.strftime('%Y-%m-%d %H:%M:%S'), - order_id: Time.current.to_f - ) - print response.data.to_json - end - end -end diff --git a/spec/bootpay/request_token_spec.rb b/spec/bootpay/request_token_spec.rb deleted file mode 100644 index 14c45c7..0000000 --- a/spec/bootpay/request_token_spec.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe Bootpay::RestClient do - it "request token" do - api = Bootpay::RestClient.new( - # application_id: '59bfc738e13f337dbd6ca48a', - # private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', - # mode: 'development' - application_id: '65af4990ca8deb00600454bd', - private_key: 'br4IYUBxEE0HnSkwp2e53jD/Cf8RMjzfmopx0gUsr9I=', - mode: 'development' - ) - response = api.request_access_token - print response.data.to_json - end -end diff --git a/spec/bootpay/request_user_token_spec.rb b/spec/bootpay/request_user_token_spec.rb deleted file mode 100644 index df3b69a..0000000 --- a/spec/bootpay/request_user_token_spec.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe Bootpay::RestClient do - it "request user token" do - api = Bootpay::RestClient.new( - application_id: '59bfc738e13f337dbd6ca48a', - private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', - mode: 'development' - ) - if api.request_access_token.success? - response = api.request_user_token( - user_id: 'gosomi1' - ) - print response.data.to_json - end - end -end diff --git a/spec/bootpay/reseller_create_seller_app_spec.rb b/spec/bootpay/reseller_create_seller_app_spec.rb deleted file mode 100644 index d04c38c..0000000 --- a/spec/bootpay/reseller_create_seller_app_spec.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe Bootpay::RestClient do - it "create seller app" do - api = Bootpay::RestClient.new( - application_id: '61d4d60b367997009490429d', - private_key: 'USsMUaEBBb66H+g6r8z5ZZaWECnrldhszGWiNRfVjdU=', - mode: 'development' - ) - r = api.request_access_token - if r.success? - response = api.create_seller_app( - provider_id: '61d7828e1fc19202e52d1865', - name: '생성된 봇 앱2' - ) - print response.data.to_json - else - print r.data.to_json - end - end -end diff --git a/spec/bootpay/reseller_create_seller_spec.rb b/spec/bootpay/reseller_create_seller_spec.rb deleted file mode 100644 index e645447..0000000 --- a/spec/bootpay/reseller_create_seller_spec.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe Bootpay::RestClient do - it "create seller start" do - api = Bootpay::RestClient.new( - application_id: '61d4d60b367997009490429d', - private_key: 'USsMUaEBBb66H+g6r8z5ZZaWECnrldhszGWiNRfVjdU=', - mode: 'development' - ) - r = api.request_access_token - if r.success? - response = api.create_seller( - company_alias: '회사 Alias', - company_name: '회사명', - email: 'gosomi@bootpay.com' - ) - print response.data.to_json - else - print r.data.to_json - end - end -end diff --git a/spec/bootpay/reseller_member_invite_spec.rb b/spec/bootpay/reseller_member_invite_spec.rb deleted file mode 100644 index 9888e2e..0000000 --- a/spec/bootpay/reseller_member_invite_spec.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe Bootpay::RestClient do - it "member invite" do - api = Bootpay::RestClient.new( - application_id: '61d4d60b367997009490429d', - private_key: 'USsMUaEBBb66H+g6r8z5ZZaWECnrldhszGWiNRfVjdU=', - mode: 'development' - ) - r = api.request_access_token - if r.success? - # response = api.member_invite( - # email: 'aqure84@naver.com', - # app_id: '61dfbccf1fc192039249ca6b', - # level: '관리자', - # invite_type: '프로젝트' - # ) - response = api.member_invite( - email: 'gosomi@bootpay.co.kr', - provider_id: '61d7828e1fc19202e52d1865', - level: '관리자', - invite_type: '팀' - ) - print response.data.to_json - else - print r.data.to_json - end - end -end diff --git a/spec/bootpay/rest/client_spec.rb b/spec/bootpay/rest/client_spec.rb deleted file mode 100644 index b48e86c..0000000 --- a/spec/bootpay/rest/client_spec.rb +++ /dev/null @@ -1,11 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe Bootpay::Rest::Client do - it "has a version number" do - expect(Bootpay::V2_VERSION).not_to be nil - end - - it "does something useful" do - expect(false).to eq(true) - end -end diff --git a/spec/bootpay/sdk_regist_biometric_spec.rb b/spec/bootpay/sdk_regist_biometric_spec.rb deleted file mode 100644 index 2b820c1..0000000 --- a/spec/bootpay/sdk_regist_biometric_spec.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe Bootpay::RestClient do - it "regist biometic" do - api = Bootpay::RestClient.new( - application_id: '59bfc738e13f337dbd6ca48a', - private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', - mode: 'development' - ) - if api.request_access_token.success? - response = api.request_user_token( - user_id: 'gosomi1' - ) - user_token = response.data[:user_token] - if response.success? - response = api.regist_biometric_authenticate( - user_token: user_token, - os: 'ios', - token: '621330b613612600925627b2', - uuid: 'test-uuid' - ) - print response.data.to_json - end - end - end -end diff --git a/spec/bootpay/sdk_wallet_spec.rb b/spec/bootpay/sdk_wallet_spec.rb deleted file mode 100644 index 2a6f412..0000000 --- a/spec/bootpay/sdk_wallet_spec.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe Bootpay::RestClient do - it "get wallets" do - api = Bootpay::RestClient.new( - application_id: '59bfc738e13f337dbd6ca48a', - private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', - mode: 'development' - ) - if api.request_access_token.success? - response = api.request_user_token( - user_id: 'gosomi1' - ) - user_token = response.data[:user_token] - if response.success? - response = api.wallets(user_token) - print response.data.to_json - end - end - end -end diff --git a/spec/bootpay/seller_payment_method_spec.rb b/spec/bootpay/seller_payment_method_spec.rb deleted file mode 100644 index 00387a8..0000000 --- a/spec/bootpay/seller_payment_method_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe Bootpay::RestClient do - it "seller lookup payment" do - api = Bootpay::RestClient.new( - application_id: '59bfc738e13f337dbd6ca48a', - private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', - mode: 'development' - ) - if api.request_access_token.success? - response = api.lookup_payment_methods - print response.data.to_json - end - end -end diff --git a/spec/bootpay/shipping_start_spec.rb b/spec/bootpay/shipping_start_spec.rb deleted file mode 100644 index a6c4f5a..0000000 --- a/spec/bootpay/shipping_start_spec.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe Bootpay::RestClient do - it "shipping start" do - api = Bootpay::RestClient.new( - application_id: '59bfc738e13f337dbd6ca48a', - private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', - mode: 'development' - ) - if api.request_access_token.success? - response = api.shipping_start( - receipt_id: "62d7bafe1fc192036b919aa2", - tracking_number: '123456', - delivery_corp: 'CJ대한통운', - redirect_url: 'https://dev-api.bootpay.co.kr/callback', - user: { - username: '부트페이', - phone: '01000000000', - address: '서울특별시 구로구 디지털로 26길 61', - zipcode: '08882' - } - ) - print response.data.to_json - end - end -end diff --git a/spec/bootpay/subscribe_automatic_transfer_spec.rb b/spec/bootpay/subscribe_automatic_transfer_spec.rb deleted file mode 100644 index 53fb0ee..0000000 --- a/spec/bootpay/subscribe_automatic_transfer_spec.rb +++ /dev/null @@ -1,42 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe Bootpay::RestClient do - it "billing key" do - # api = Bootpay::RestClient.new( - # application_id: '59bfc738e13f337dbd6ca48a', - # private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', - # mode: 'development' - # ) - api = Bootpay::RestClient.new( - application_id: '59b731f084382614ebf72215', - private_key: 'WwDv0UjfwFa04wYG0LJZZv1xwraQnlhnHE375n52X0U=', - mode: 'production' - ) - if api.request_access_token.success? - res1 = api.request_subscribe_automatic_transfer_billing_key( - pg: 'nicepay', - order_name: '테스트 결제', - price: 100, - tax_free: 0, - subscription_id: Time.current.to_i, - username: '홍길동', - user: { - phone: '01012341234', - username: '홍길동', - email: 'test@bootpay.co.kr' - }, - bank_name: '국민', - bank_account: '675123412342472', - identity_no: '901014', - cash_receipt_identity_no: '01012341234', - phone: '01012341234', - ) - print res1.data.to_json - - res2 = api.publish_automatic_transfer_billing_key(receipt_id: res1.data[:receipt_id]) - print "\n\n" + res2.data.to_json - - - end - end -end diff --git a/spec/bootpay/subscribe_card_payment_spec.rb b/spec/bootpay/subscribe_card_payment_spec.rb deleted file mode 100644 index 39eb30b..0000000 --- a/spec/bootpay/subscribe_card_payment_spec.rb +++ /dev/null @@ -1,31 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe Bootpay::RestClient do - it "billing key" do - # api = Bootpay::RestClient.new( - # application_id: '59bfc738e13f337dbd6ca48a', - # private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', - # mode: 'development' - # ) - api = Bootpay::RestClient.new( - application_id: '59b731f084382614ebf72215', - private_key: 'WwDv0UjfwFa04wYG0LJZZv1xwraQnlhnHE375n52X0U=', - mode: 'production' - ) - if api.request_access_token.success? - response = api.request_subscribe_card_payment( - billing_key: '633f69ccd01c7e001a282fd4', - order_name: '테스트결제', - price: 100, - card_quota: '00', - order_id: Time.current.to_i, - user: { - phone: '01000000000', - username: '홍길동', - email: 'test@bootpay.co.kr' - } - ) - print response.data.to_json - end - end -end diff --git a/spec/bootpay/subscribe_payment_reserve_spec.rb b/spec/bootpay/subscribe_payment_reserve_spec.rb deleted file mode 100644 index e44abfc..0000000 --- a/spec/bootpay/subscribe_payment_reserve_spec.rb +++ /dev/null @@ -1,32 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe Bootpay::RestClient do - it "billing key" do - api = Bootpay::RestClient.new( - application_id: '5b8f6a4d396fa665fdc2b5ea', - private_key: 'rm6EYECr6aroQVG2ntW0A6LpWnkTgP4uQ3H18sDDUYw=', - mode: 'production' - ) - # api = Bootpay::RestClient.new( - # application_id: '59b731f084382614ebf72215', - # private_key: 'WwDv0UjfwFa04wYG0LJZZv1xwraQnlhnHE375n52X0U=', - # mode: 'stage' - # ) - if api.request_access_token.success? - response = api.subscribe_payment_reserve( - # billing_key: '62820fa61fc19202e5ef240e', - billing_key: '66f9da41e1afdbe0495e6526', - order_name: '테스트결제', - price: 100, - order_id: Time.current.to_i, - user: { - phone: '01000000000', - username: '홍길동', - email: 'test@bootpay.co.kr' - }, - reserve_execute_at: (Time.current + 5.seconds).iso8601 - ) - print response.data.to_json - end - end -end diff --git a/spec/bootpay/subscribe_payment_spec.rb b/spec/bootpay/subscribe_payment_spec.rb deleted file mode 100644 index 0692513..0000000 --- a/spec/bootpay/subscribe_payment_spec.rb +++ /dev/null @@ -1,31 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe Bootpay::RestClient do - it "billing key" do - # api = Bootpay::RestClient.new( - # application_id: '59bfc738e13f337dbd6ca48a', - # private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', - # mode: 'development' - # ) - api = Bootpay::RestClient.new( - application_id: '5b8f6a4d396fa665fdc2b5ea', - private_key: 'rm6EYECr6aroQVG2ntW0A6LpWnkTgP4uQ3H18sDDUYw=', - mode: 'production' - ) - if api.request_access_token.success? - response = api.request_subscribe_card_payment( - billing_key: '66f9da41e1afdbe0495e6526', - order_name: '테스트결제', - price: 100, - card_quota: '00', - order_id: Time.current.to_i, - user: { - phone: '01000000000', - username: '홍길동', - email: 'test@bootpay.co.kr' - } - ) - print response.data.to_json - end - end -end diff --git a/spec/bootpay/user_wallets_spec.rb b/spec/bootpay/user_wallets_spec.rb deleted file mode 100644 index f6a3d9c..0000000 --- a/spec/bootpay/user_wallets_spec.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe Bootpay::RestClient do - it "billing key" do - # api = Bootpay::RestClient.new( - # application_id: '59bfc738e13f337dbd6ca48a', - # private_key: 'pDc0NwlkEX3aSaHTp/PPL/i8vn5E/CqRChgyEp/gHD0=', - # mode: 'development' - # ) - api = Bootpay::RestClient.new( - application_id: '5b8f6a4d396fa665fdc2b5ea', - private_key: 'rm6EYECr6aroQVG2ntW0A6LpWnkTgP4uQ3H18sDDUYw=', - mode: 'production' - ) - if api.request_access_token.success? - response = api.user_wallets( - user_id: 'bootpay', - sandbox: true - ) - print response.data.to_json - end - end -end diff --git a/spec/bootpay_store/user/email_exist_spec.rb b/spec/bootpay_store/user/email_exist_spec.rb new file mode 100644 index 0000000..5d86860 --- /dev/null +++ b/spec/bootpay_store/user/email_exist_spec.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +RSpec.describe BootpayStore::RestClient do + it "email exist" do + api = BootpayStore::RestClient.new( + client_key: 'QIzXk4M3EeD-6B1GTfmGHA', + secret_key: 'vRle44QfyBj7nzJlBbeebqkbtlJVRTS2DQa9Adpz3d8=', + mode: 'development' + ) + token = api.request_access_token + if token.success? + response = api.email_exist( + email: 'bootpay@bootpay.co.kr' + ) + puts response.data.to_json + else + puts token.data + end + end +end diff --git a/spec/bootpay_store/user/group_business_number_exist_spec.rb b/spec/bootpay_store/user/group_business_number_exist_spec.rb new file mode 100644 index 0000000..f32389f --- /dev/null +++ b/spec/bootpay_store/user/group_business_number_exist_spec.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +RSpec.describe BootpayStore::RestClient do + it "business number exist" do + api = BootpayStore::RestClient.new( + client_key: 'QIzXk4M3EeD-6B1GTfmGHA', + secret_key: 'vRle44QfyBj7nzJlBbeebqkbtlJVRTS2DQa9Adpz3d8=', + mode: 'development' + ) + token = api.request_access_token + if token.success? + response = api.group_business_number_exist( + business_number: '1234567890' # 사업자등록번호를 입력하세요 + ) + puts response.data.to_json + else + puts token.data + end + end +end diff --git a/spec/bootpay_store/user/id_exist_spec.rb b/spec/bootpay_store/user/id_exist_spec.rb new file mode 100644 index 0000000..c9b1248 --- /dev/null +++ b/spec/bootpay_store/user/id_exist_spec.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +RSpec.describe BootpayStore::RestClient do + it "id exist" do + api = BootpayStore::RestClient.new( + client_key: 'QIzXk4M3EeD-6B1GTfmGHA', + secret_key: 'vRle44QfyBj7nzJlBbeebqkbtlJVRTS2DQa9Adpz3d8=', + mode: 'development' + ) + token = api.request_access_token + if token.success? + response = api.id_exist( + id: 'bootpay' + ) + puts response.data.to_json + else + puts token.data + end + end +end diff --git a/spec/bootpay_store/user/phone_exist_spec.rb b/spec/bootpay_store/user/phone_exist_spec.rb new file mode 100644 index 0000000..a747beb --- /dev/null +++ b/spec/bootpay_store/user/phone_exist_spec.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +RSpec.describe BootpayStore::RestClient do + it "phone exist" do + api = BootpayStore::RestClient.new( + client_key: 'QIzXk4M3EeD-6B1GTfmGHA', + secret_key: 'vRle44QfyBj7nzJlBbeebqkbtlJVRTS2DQa9Adpz3d8=', + mode: 'development' + ) + token = api.request_access_token + if token.success? + response = api.phone_exist( + phone: '01000000000' # 전화번호를 입력하세요 (예: 01000000000, 010-0000-0000, 010 0000 0000 등) + ) + puts response.data.to_json + else + puts token.data + end + end +end From c3227b695e61ca8661fa91509c8e59a85b067bc3 Mon Sep 17 00:00:00 2001 From: gosomi Date: Thu, 19 Jun 2025 17:42:09 +0900 Subject: [PATCH 096/133] =?UTF-8?q?=EA=B7=B8=EB=A3=B9/=ED=9A=8C=EC=9B=90?= =?UTF-8?q?=20=EA=B4=80=EB=A6=AC=20API=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay_store/concern.rb | 2 + lib/bootpay_store/concern/user_group.rb | 174 ++++++++++++++++++ .../user_group/add_user_from_group_spec.rb | 22 +++ .../user_group/create_user_group_spec.rb | 25 +++ .../user_group/delete_user_from_group_spec.rb | 22 +++ .../user_group/delete_user_group_spec.rb | 21 +++ .../user_group/update_user_group_spec.rb | 24 +++ .../user_group/user_group_detail_spec.rb | 18 ++ .../user_group/user_groups_spec.rb | 18 ++ 9 files changed, 326 insertions(+) create mode 100644 lib/bootpay_store/concern/user_group.rb create mode 100644 spec/bootpay_store/user_group/add_user_from_group_spec.rb create mode 100644 spec/bootpay_store/user_group/create_user_group_spec.rb create mode 100644 spec/bootpay_store/user_group/delete_user_from_group_spec.rb create mode 100644 spec/bootpay_store/user_group/delete_user_group_spec.rb create mode 100644 spec/bootpay_store/user_group/update_user_group_spec.rb create mode 100644 spec/bootpay_store/user_group/user_group_detail_spec.rb create mode 100644 spec/bootpay_store/user_group/user_groups_spec.rb diff --git a/lib/bootpay_store/concern.rb b/lib/bootpay_store/concern.rb index 13615d7..c4a4173 100644 --- a/lib/bootpay_store/concern.rb +++ b/lib/bootpay_store/concern.rb @@ -5,11 +5,13 @@ module Concern require_relative 'concern/supervisor' require_relative 'concern/token' require_relative 'concern/user' + require_relative 'concern/user_group' include Payment include Rest include Supervisor include Token include User + include UserGroup end end \ No newline at end of file diff --git a/lib/bootpay_store/concern/user_group.rb b/lib/bootpay_store/concern/user_group.rb new file mode 100644 index 0000000..63d75e3 --- /dev/null +++ b/lib/bootpay_store/concern/user_group.rb @@ -0,0 +1,174 @@ +module BootpayStore::Concern::UserGroup + extend ActiveSupport::Concern + + included do + # 등록된 User Group 정보를 가져온다 + # Comment by GOSOMI + # @date: 2025-06-18 + def user_groups(keyword: nil, page: 1, limit: 20, corporate_type: 2, idempotency_key: nil) + request( + uri: 'user-groups', + method: :get, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'user' + }, + params: + { + keyword: keyword, + page: page, + limit: limit, + corporate_type: corporate_type + }.compact + ) + end + + # user group 정보를 가져온다 + # Comment by GOSOMI + # @date: 2025-06-18 + def lookup_user_group(user_group_id:, idempotency_key: nil) + request( + uri: "user-groups/#{user_group_id}", + method: :get, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'user' + } + ) + end + + # 새로운 User Group을 생성한다 + # Comment by GOSOMI + # @date: 2025-06-18 + def create_user_group(uid: nil, phone: nil, email: nil, address: nil, address_detail: nil, zipcode: nil, + corporate_type: nil, bank: nil, bank_code: nil, company_name: nil, business_number: nil, + registration_number: nil, business_type: nil, business_category: nil, ceo_name: nil, auth_company: nil, + manager_name: nil, manager_phone: nil, manager_email: nil, pccc: nil, use_subscription_aggregate_transaction: nil, + subscription_month_day: nil, subscription_week_day: nil, purchase_limit: nil, subscribed_limit: nil, + limit_message: nil, idempotency_key: nil) + request( + uri: 'user-groups', + method: :post, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'user' + }, + payload: + { + uid: uid, + phone: phone, + email: email, + address: address, + address_detail: address_detail, + corporate_type: corporate_type, + bank: bank, + bank_code: bank_code, + zipcode: zipcode, + company_name: company_name, + business_number: business_number, + registration_number: registration_number, + business_type: business_type, + business_category: business_category, + ceo_name: ceo_name, + auth_company: auth_company, + manager_name: manager_name, + manager_phone: manager_phone, + manager_email: manager_email, + pccc: pccc, + use_subscription_aggregate_transaction: use_subscription_aggregate_transaction, + subscription_month_day: subscription_month_day, + subscription_week_day: subscription_week_day, + purchase_limit: purchase_limit, + subscribed_limit: subscribed_limit, + limit_message: limit_message + }.compact + ) + end + + # UserGroup 정보를 갱신한다 + # Comment by GOSOMI + # @date: 2025-06-18 + def update_user_group(user_group_id:, phone: nil, email: nil, address: nil, address_detail: nil, zipcode: nil, + corporate_type: nil, bank: nil, bank_code: nil, company_name: nil, business_number: nil, + registration_number: nil, business_type: nil, business_category: nil, ceo_name: nil, auth_company: nil, + manager_name: nil, manager_phone: nil, manager_email: nil, pccc: nil, use_subscription_aggregate_transaction: nil, + subscription_month_day: nil, subscription_week_day: nil, purchase_limit: nil, subscribed_limit: nil, + limit_message: nil, idempotency_key: nil) + request( + uri: "user-groups/#{user_group_id}", + method: :put, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'user' + }, + payload: + { + phone: phone, + email: email, + address: address, + address_detail: address_detail, + corporate_type: corporate_type, + bank: bank, + bank_code: bank_code, + zipcode: zipcode, + company_name: company_name, + business_number: business_number, + registration_number: registration_number, + business_type: business_type, + business_category: business_category, + ceo_name: ceo_name, + auth_company: auth_company, + manager_name: manager_name, + manager_phone: manager_phone, + manager_email: manager_email, + pccc: pccc, + use_subscription_aggregate_transaction: use_subscription_aggregate_transaction, + subscription_month_day: subscription_month_day, + subscription_week_day: subscription_week_day, + purchase_limit: purchase_limit, + subscribed_limit: subscribed_limit, + limit_message: limit_message + }.compact + ) + end + + # UserGroup 정보를 삭제한다 + # Comment by GOSOMI + # @date: 2025-06-19 + def delete_user_group(user_group_id:, idempotency_key: nil) + request( + uri: "user-groups/#{user_group_id}", + method: :delete, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'user' + } + ) + end + + # 사용자 그룹에 사용자를 추가한다 + def add_user_to_group(user_group_id:, user_id:, idempotency_key: nil) + request( + uri: "user-groups/#{user_group_id}/user", + method: :post, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'manager' + }, + payload: { user_id: user_id } + ) + end + + # 사용자 그룹에서 사용자를 제거한다 + def delete_user_from_group(user_group_id:, user_id:, idempotency_key: nil) + request( + uri: "user-groups/#{user_group_id}/user/#{user_id}", + method: :delete, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'manager' + } + ) + end + end +end \ No newline at end of file diff --git a/spec/bootpay_store/user_group/add_user_from_group_spec.rb b/spec/bootpay_store/user_group/add_user_from_group_spec.rb new file mode 100644 index 0000000..2067378 --- /dev/null +++ b/spec/bootpay_store/user_group/add_user_from_group_spec.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +RSpec.describe BootpayStore::RestClient do + it "add user group" do + api = BootpayStore::RestClient.new( + client_key: 'QIzXk4M3EeD-6B1GTfmGHA', + secret_key: 'vRle44QfyBj7nzJlBbeebqkbtlJVRTS2DQa9Adpz3d8=', + mode: 'development' + ) + token = api.request_access_token + if token.success? + response = api.add_user_to_group( + user_group_id: '6763758e817af6a00e0fbf62', + user_id: '6763ce2b817af6a00e0fbfbd' + ) + puts response.data.to_json + # 68526e43ecd1ce82158b6b1d + else + puts token.data + end + end +end diff --git a/spec/bootpay_store/user_group/create_user_group_spec.rb b/spec/bootpay_store/user_group/create_user_group_spec.rb new file mode 100644 index 0000000..be18185 --- /dev/null +++ b/spec/bootpay_store/user_group/create_user_group_spec.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +RSpec.describe BootpayStore::RestClient do + it "update user group" do + api = BootpayStore::RestClient.new( + client_key: 'QIzXk4M3EeD-6B1GTfmGHA', + secret_key: 'vRle44QfyBj7nzJlBbeebqkbtlJVRTS2DQa9Adpz3d8=', + mode: 'development' + ) + token = api.request_access_token + if token.success? + response = api.create_user_group( + uid: 'bootpay-test', + company_name: '부트페이1', + business_number: '1234567890', + manager_name: '윤태섭', + ceo_name: '윤태섭' + ) + puts response.data.to_json + # 68526e43ecd1ce82158b6b1d + else + puts token.data + end + end +end diff --git a/spec/bootpay_store/user_group/delete_user_from_group_spec.rb b/spec/bootpay_store/user_group/delete_user_from_group_spec.rb new file mode 100644 index 0000000..c601061 --- /dev/null +++ b/spec/bootpay_store/user_group/delete_user_from_group_spec.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +RSpec.describe BootpayStore::RestClient do + it "delete user group" do + api = BootpayStore::RestClient.new( + client_key: 'QIzXk4M3EeD-6B1GTfmGHA', + secret_key: 'vRle44QfyBj7nzJlBbeebqkbtlJVRTS2DQa9Adpz3d8=', + mode: 'development' + ) + token = api.request_access_token + if token.success? + response = api.delete_user_from_group( + user_group_id: '6763758e817af6a00e0fbf62', + user_id: '6763ce2b817af6a00e0fbfbd' + ) + puts response.data.to_json + # 68526e43ecd1ce82158b6b1d + else + puts token.data + end + end +end diff --git a/spec/bootpay_store/user_group/delete_user_group_spec.rb b/spec/bootpay_store/user_group/delete_user_group_spec.rb new file mode 100644 index 0000000..09c6065 --- /dev/null +++ b/spec/bootpay_store/user_group/delete_user_group_spec.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +RSpec.describe BootpayStore::RestClient do + it "delete user group" do + api = BootpayStore::RestClient.new( + client_key: 'QIzXk4M3EeD-6B1GTfmGHA', + secret_key: 'vRle44QfyBj7nzJlBbeebqkbtlJVRTS2DQa9Adpz3d8=', + mode: 'development' + ) + token = api.request_access_token + if token.success? + response = api.delete_user_group( + user_group_id: '68526e43ecd1ce82158b6b1d' + ) + puts response.data.to_json + # 68526e43ecd1ce82158b6b1d + else + puts token.data + end + end +end diff --git a/spec/bootpay_store/user_group/update_user_group_spec.rb b/spec/bootpay_store/user_group/update_user_group_spec.rb new file mode 100644 index 0000000..1a65a87 --- /dev/null +++ b/spec/bootpay_store/user_group/update_user_group_spec.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +RSpec.describe BootpayStore::RestClient do + it "update user group" do + api = BootpayStore::RestClient.new( + client_key: 'QIzXk4M3EeD-6B1GTfmGHA', + secret_key: 'vRle44QfyBj7nzJlBbeebqkbtlJVRTS2DQa9Adpz3d8=', + mode: 'development' + ) + token = api.request_access_token + if token.success? + response = api.update_user_group( + user_group_id: '6763ce2b817af6a00e0fbfbe', + company_name: '부트페이1', + business_number: '1234567890', + manager_name: '윤태섭', + ceo_name: '윤태섭' + ) + puts response.data.to_json + else + puts token.data + end + end +end diff --git a/spec/bootpay_store/user_group/user_group_detail_spec.rb b/spec/bootpay_store/user_group/user_group_detail_spec.rb new file mode 100644 index 0000000..8f7f955 --- /dev/null +++ b/spec/bootpay_store/user_group/user_group_detail_spec.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +RSpec.describe BootpayStore::RestClient do + it "user group detail" do + api = BootpayStore::RestClient.new( + client_key: 'QIzXk4M3EeD-6B1GTfmGHA', + secret_key: 'vRle44QfyBj7nzJlBbeebqkbtlJVRTS2DQa9Adpz3d8=', + mode: 'development' + ) + token = api.request_access_token + if token.success? + response = api.lookup_user_group(user_group_id: '68526e43ecd1ce82158b6b1d') + puts response.data.to_json + else + puts token.data + end + end +end diff --git a/spec/bootpay_store/user_group/user_groups_spec.rb b/spec/bootpay_store/user_group/user_groups_spec.rb new file mode 100644 index 0000000..cf6b113 --- /dev/null +++ b/spec/bootpay_store/user_group/user_groups_spec.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +RSpec.describe BootpayStore::RestClient do + it "user groups" do + api = BootpayStore::RestClient.new( + client_key: 'QIzXk4M3EeD-6B1GTfmGHA', + secret_key: 'vRle44QfyBj7nzJlBbeebqkbtlJVRTS2DQa9Adpz3d8=', + mode: 'development' + ) + token = api.request_access_token + if token.success? + response = api.user_groups + puts response.data.to_json + else + puts token.data + end + end +end From fef2632f69ff3d0d23d7af29dfdc68366a5020ea Mon Sep 17 00:00:00 2001 From: gosomi Date: Mon, 7 Jul 2025 20:10:59 +0900 Subject: [PATCH 097/133] =?UTF-8?q?SDK=20version=205.2=EB=A1=9C=20=20?= =?UTF-8?q?=EC=97=85=EB=8D=B0=EC=9D=B4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay/bootpay-rest-client.rb | 2 +- lib/bootpay/concern/subscription.rb | 30 ++----------- lib/bootpay/concern/wallet.rb | 29 ++---------- lib/bootpay_store/concern.rb | 4 ++ lib/bootpay_store/concern/order.rb | 44 +++++++++++++++++++ .../concern/order_subscription.rb | 41 +++++++++++++++++ lib/bootpay_store/concern/payment.rb | 6 ++- spec/bootpay_store/order/order_detail_spec.rb | 24 ++++++++++ spec/bootpay_store/order/orders_spec.rb | 24 ++++++++++ .../order_subscription_detail_spec.rb | 24 ++++++++++ .../order_subscriptions_spec.rb | 24 ++++++++++ 11 files changed, 197 insertions(+), 55 deletions(-) create mode 100644 lib/bootpay_store/concern/order.rb create mode 100644 lib/bootpay_store/concern/order_subscription.rb create mode 100644 spec/bootpay_store/order/order_detail_spec.rb create mode 100644 spec/bootpay_store/order/orders_spec.rb create mode 100644 spec/bootpay_store/order_subscription/order_subscription_detail_spec.rb create mode 100644 spec/bootpay_store/order_subscription/order_subscriptions_spec.rb diff --git a/lib/bootpay/bootpay-rest-client.rb b/lib/bootpay/bootpay-rest-client.rb index 07f4986..e5ce8eb 100644 --- a/lib/bootpay/bootpay-rest-client.rb +++ b/lib/bootpay/bootpay-rest-client.rb @@ -17,7 +17,7 @@ class RestClient production: 'https://api.bootpay.co.kr/v2' } - SDK_VERSION = '5.0.0' + SDK_VERSION = '5.2.0' def initialize(application_id:, private_key:, mode: 'production') @application_id = application_id diff --git a/lib/bootpay/concern/subscription.rb b/lib/bootpay/concern/subscription.rb index d488b98..8696b29 100644 --- a/lib/bootpay/concern/subscription.rb +++ b/lib/bootpay/concern/subscription.rb @@ -12,36 +12,11 @@ def lookup_subscribe_billing_key(receipt_id) ) end - # 빌링키로 결제 요청하기 - # Comment by Gosomi - # Date: 2021-11-02 - def request_subscribe_card_payment(billing_key:, order_name:, price:, tax_free: 0, card_quota: '00', feedback_url: nil, content_type: nil, - card_interest: nil, order_id:, items: [], user: {}, extra: {}, metadata: {}) - request( - uri: 'subscribe/payment', - payload: { - billing_key: billing_key, - metadata: metadata, - order_name: order_name, - price: price, - tax_free: tax_free, - card_quota: card_quota, - card_interest: card_interest, - order_id: order_id, - items: items, - user: user, - extra: extra, - feedback_url: feedback_url, - content_type: content_type - } - ) - end - # 빌링키로 결제 요청하기 # Comment by ehowlsla # Date: 2024-05-29 def request_subscribe_payment(billing_key:, order_name:, price:, tax_free: 0, card_quota: '00', feedback_url: nil, content_type: nil, - card_interest: nil, order_id:, items: [], user: {}, extra: {}, metadata: {}) + card_interest: nil, order_id:, items: [], user: {}, extra: {}, metadata: {}) request( uri: 'subscribe/payment', payload: { @@ -62,7 +37,6 @@ def request_subscribe_payment(billing_key:, order_name:, price:, tax_free: 0, ca ) end - # 자동결제 예약 # Comment by Gosomi # Date: 2022-04-21 @@ -181,6 +155,8 @@ def request_subscribe_automatic_transfer_billing_key(pg:, order_name:, price: ni ) end + alias_method :request_subscribe_card_payment, :request_subscribe_payment + # ARS나 본인인증 이후 빌링키 발급 # Comment by GOSOMI # @date: 2024-01-26 diff --git a/lib/bootpay/concern/wallet.rb b/lib/bootpay/concern/wallet.rb index 82b01c9..0e0747a 100644 --- a/lib/bootpay/concern/wallet.rb +++ b/lib/bootpay/concern/wallet.rb @@ -2,38 +2,17 @@ module Bootpay::Concern::Wallet extend ActiveSupport::Concern included do - # 설정된 wallet 기준으로 결제를 진행한다 - def request_wallet_payment(user_id:, order_name:, price:, tax_free: 0, webhook_url: nil, content_type: nil, order_id:, - items: [], user: {}, extra: {}, metadata: {}, sandbox: false) - request( - uri: 'wallet/payment', - payload: { - user_id: user_id, - order_name: order_name, - price: price, - tax_free: tax_free, - webhook_url: webhook_url, - content_type: content_type, - order_id: order_id, - items: items, - user: user, - extra: extra, - metadata: metadata, - sandbox: sandbox - } - ) - end - # 등록된 회원의 지갑 정보를 가져온다 # Comment by GOSOMI # @date: 2025-02-13 - def user_wallets(user_id:, sandbox: false) + def user_wallets(user_id:, widget_key: nil, sandbox: false) request( uri: 'wallet', method: :get, params: { - user_id: user_id, - sandbox: sandbox + user_id: user_id, + widget_key: widget_key, + sandbox: sandbox } ) end diff --git a/lib/bootpay_store/concern.rb b/lib/bootpay_store/concern.rb index c4a4173..17922fa 100644 --- a/lib/bootpay_store/concern.rb +++ b/lib/bootpay_store/concern.rb @@ -1,5 +1,7 @@ module BootpayStore module Concern + require_relative 'concern/order' + require_relative 'concern/order_subscription' require_relative 'concern/payment' require_relative 'concern/rest' require_relative 'concern/supervisor' @@ -7,6 +9,8 @@ module Concern require_relative 'concern/user' require_relative 'concern/user_group' + include Order + include OrderSubscription include Payment include Rest include Supervisor diff --git a/lib/bootpay_store/concern/order.rb b/lib/bootpay_store/concern/order.rb new file mode 100644 index 0000000..c0234b1 --- /dev/null +++ b/lib/bootpay_store/concern/order.rb @@ -0,0 +1,44 @@ +module BootpayStore::Concern::Order + extend ActiveSupport::Concern + + included do + # 주문 목록을 조회한다 + # Comment by GOSOMI + # @date: 2025-06-19 + def orders(status: [], payment_status: [], keyword: nil, page: 1, cs_type: nil, search_date_from: nil, search_date_to: nil, + user_id: nil, user_group_id: nil, idempotency_key: nil) + request( + uri: 'orders', + method: :get, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'user' + }, + params: + { + status: status.join(','), + payment_status: payment_status.join(','), + keyword: keyword, + cs_type: cs_type, + search_date_from: search_date_from, + search_date_to: search_date_to, + page: page, + user_id: user_id, + user_group_id: user_group_id + }.compact + ) + end + + # 주문 상세를 조회한다 + def order_detail(order_id:, idempotency_key: nil) + request( + uri: "orders/#{order_id}", + method: :get, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'user' + } + ) + end + end +end \ No newline at end of file diff --git a/lib/bootpay_store/concern/order_subscription.rb b/lib/bootpay_store/concern/order_subscription.rb new file mode 100644 index 0000000..fe7c588 --- /dev/null +++ b/lib/bootpay_store/concern/order_subscription.rb @@ -0,0 +1,41 @@ +module BootpayStore::Concern::OrderSubscription + extend ActiveSupport::Concern + included do + # 계약된 구독정보를 가져온다 + # Comment by GOSOMI + # @date: 2025-06-20 + def order_subscriptions(page: 1, keyword: nil, search_date_from: nil, search_date_to: nil, + request_type: nil, user_group_id: nil, status: nil, user_id: nil, idempotency_key: nil) + request( + uri: 'order_subscriptions', + method: :get, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'user' + }, + params: { + page: page, + keyword: keyword, + search_date_from: search_date_from, + search_date_to: search_date_to, + request_type: request_type, + user_group_id: user_group_id, + status: status, + user_id: user_id + }.compact + ) + end + + # 구독 상세를 조회한다 + def order_subscription_detail(order_subscription_id:, idempotency_key: nil) + request( + uri: "order_subscriptions/#{order_subscription_id}", + method: :get, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'user' + } + ) + end + end +end \ No newline at end of file diff --git a/lib/bootpay_store/concern/payment.rb b/lib/bootpay_store/concern/payment.rb index dd3050a..03829c7 100644 --- a/lib/bootpay_store/concern/payment.rb +++ b/lib/bootpay_store/concern/payment.rb @@ -49,7 +49,8 @@ def reject_order_cancel(idempotency_key: nil, order_cancellation_request_id:, me uri: "order/cancel/#{order_cancellation_request_id}/reject", method: :put, headers: { - 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'supervisor' }, payload: { message: message @@ -64,7 +65,8 @@ def approve_order_cancel(idempotency_key: nil, order_cancellation_request_histor uri: "order/cancel/#{order_cancellation_request_history_id}/approve", method: :put, headers: { - 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'supervisor' }, payload: { message: message diff --git a/spec/bootpay_store/order/order_detail_spec.rb b/spec/bootpay_store/order/order_detail_spec.rb new file mode 100644 index 0000000..f9553fd --- /dev/null +++ b/spec/bootpay_store/order/order_detail_spec.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +RSpec.describe BootpayStore::RestClient do + it "orders" do + api = BootpayStore::RestClient.new( + client_key: 'QIzXk4M3EeD-6B1GTfmGHA', + secret_key: 'vRle44QfyBj7nzJlBbeebqkbtlJVRTS2DQa9Adpz3d8=', + mode: 'development' + ) + + # api = BootpayStore::RestClient.new( + # client_key: 'PFPsUXTj9A7ySxJSQ0w01g', + # secret_key: '4QoNzXcjT_H4brpq0AgM8ETtrBTFhabo3gmU_DJ148E=', + # mode: 'stage' + # ) + token = api.request_access_token + if token.success? + response = api.order_detail(order_id: '685425f81c872444f161f00c') + puts response.data.to_json + else + puts token.data + end + end +end diff --git a/spec/bootpay_store/order/orders_spec.rb b/spec/bootpay_store/order/orders_spec.rb new file mode 100644 index 0000000..c4e1d3e --- /dev/null +++ b/spec/bootpay_store/order/orders_spec.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +RSpec.describe BootpayStore::RestClient do + it "orders" do + api = BootpayStore::RestClient.new( + client_key: 'QIzXk4M3EeD-6B1GTfmGHA', + secret_key: 'vRle44QfyBj7nzJlBbeebqkbtlJVRTS2DQa9Adpz3d8=', + mode: 'development' + ) + + # api = BootpayStore::RestClient.new( + # client_key: 'PFPsUXTj9A7ySxJSQ0w01g', + # secret_key: '4QoNzXcjT_H4brpq0AgM8ETtrBTFhabo3gmU_DJ148E=', + # mode: 'stage' + # ) + token = api.request_access_token + if token.success? + response = api.orders + puts response.data.to_json + else + puts token.data + end + end +end diff --git a/spec/bootpay_store/order_subscription/order_subscription_detail_spec.rb b/spec/bootpay_store/order_subscription/order_subscription_detail_spec.rb new file mode 100644 index 0000000..d1a12e3 --- /dev/null +++ b/spec/bootpay_store/order_subscription/order_subscription_detail_spec.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +RSpec.describe BootpayStore::RestClient do + it "order_subscriptions" do + api = BootpayStore::RestClient.new( + client_key: 'QIzXk4M3EeD-6B1GTfmGHA', + secret_key: 'vRle44QfyBj7nzJlBbeebqkbtlJVRTS2DQa9Adpz3d8=', + mode: 'development' + ) + + # api = BootpayStore::RestClient.new( + # client_key: 'PFPsUXTj9A7ySxJSQ0w01g', + # secret_key: '4QoNzXcjT_H4brpq0AgM8ETtrBTFhabo3gmU_DJ148E=', + # mode: 'stage' + # ) + token = api.request_access_token + if token.success? + response = api.order_subscription_detail(order_subscription_id: '64b0f1c3d4e2f00001a2b3c4') + puts response.data.to_json + else + puts token.data + end + end +end diff --git a/spec/bootpay_store/order_subscription/order_subscriptions_spec.rb b/spec/bootpay_store/order_subscription/order_subscriptions_spec.rb new file mode 100644 index 0000000..a03dda4 --- /dev/null +++ b/spec/bootpay_store/order_subscription/order_subscriptions_spec.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +RSpec.describe BootpayStore::RestClient do + it "order_subscriptions" do + api = BootpayStore::RestClient.new( + client_key: 'QIzXk4M3EeD-6B1GTfmGHA', + secret_key: 'vRle44QfyBj7nzJlBbeebqkbtlJVRTS2DQa9Adpz3d8=', + mode: 'development' + ) + + # api = BootpayStore::RestClient.new( + # client_key: 'PFPsUXTj9A7ySxJSQ0w01g', + # secret_key: '4QoNzXcjT_H4brpq0AgM8ETtrBTFhabo3gmU_DJ148E=', + # mode: 'stage' + # ) + token = api.request_access_token + if token.success? + response = api.order_subscriptions + puts response.data.to_json + else + puts token.data + end + end +end From 387e9bb755191f31668b5a454aa71b4e3153d414 Mon Sep 17 00:00:00 2001 From: gosomi Date: Tue, 15 Jul 2025 16:06:24 +0900 Subject: [PATCH 098/133] =?UTF-8?q?=EB=B9=8C=EB=A7=81=ED=82=A4=20=EA=B2=B0?= =?UTF-8?q?=EC=A0=9C=20=EB=B0=8F=20=EC=A7=80=EA=B0=91=ED=82=A4=20=EA=B2=B0?= =?UTF-8?q?=EC=A0=9C=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay/concern/subscription.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/bootpay/concern/subscription.rb b/lib/bootpay/concern/subscription.rb index 8696b29..522f80f 100644 --- a/lib/bootpay/concern/subscription.rb +++ b/lib/bootpay/concern/subscription.rb @@ -15,11 +15,12 @@ def lookup_subscribe_billing_key(receipt_id) # 빌링키로 결제 요청하기 # Comment by ehowlsla # Date: 2024-05-29 - def request_subscribe_payment(billing_key:, order_name:, price:, tax_free: 0, card_quota: '00', feedback_url: nil, content_type: nil, + def request_subscribe_payment(wallet_key: nil, billing_key: nil, order_name:, price:, tax_free: 0, card_quota: '00', feedback_url: nil, content_type: nil, card_interest: nil, order_id:, items: [], user: {}, extra: {}, metadata: {}) request( uri: 'subscribe/payment', payload: { + wallet_key: wallet_key, billing_key: billing_key, metadata: metadata, order_name: order_name, From 41c6d87061810a60a223d65215723e13e0d734c1 Mon Sep 17 00:00:00 2001 From: rupy1014 Date: Thu, 17 Jul 2025 16:34:14 +0900 Subject: [PATCH 099/133] csv file upload added --- lib/bootpay_storage/concern/csv.rb | 18 ++++++++++++ lib/bootpay_storage/concern/rest.rb | 45 +++++++++++++++++++++++++++++ lib/bootpay_store/concern/user.rb | 2 +- 3 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 lib/bootpay_storage/concern/csv.rb diff --git a/lib/bootpay_storage/concern/csv.rb b/lib/bootpay_storage/concern/csv.rb new file mode 100644 index 0000000..a2934a1 --- /dev/null +++ b/lib/bootpay_storage/concern/csv.rb @@ -0,0 +1,18 @@ +module BootpayStorage::Concern::Csv + extend ActiveSupport::Concern + + included do + + + # csv 파일 업로드 - 마이그레이션 할 때 사용 + # Comment by ehowlsla + # Date: 2025-07-17 + def csv_file_upload(files:) + csv_upload( + uri: 'csvs', + files: files + ) + end + + end +end \ No newline at end of file diff --git a/lib/bootpay_storage/concern/rest.rb b/lib/bootpay_storage/concern/rest.rb index c492c6a..20395b7 100644 --- a/lib/bootpay_storage/concern/rest.rb +++ b/lib/bootpay_storage/concern/rest.rb @@ -80,6 +80,51 @@ def upload(uri:, images:, headers: {}, params: nil) ) end + # csv Multipart 파일 전송 Method + # Comment by ehowlsla + # Date: 2025-07-17 + def csv_upload(uri:, files:, headers: {}, params: nil) + # 이미지 데이터를 배열로 받음 + files = files.each_with_index.map do |data, index| + filename = "csv_#{Time.now.to_i}_#{index}.csv" + HTTP::FormData::File.new(data, filename: filename) + end + + # HTTP 요청 + response = HTTP.headers( + { + Authorization: "Bearer #{@token}", + accept: 'application/json', + bootpay_api_version: @api_version, + bootpay_sdk_version: Bootpay::V2_VERSION, + bootpay_sdk_type: '300' + }.merge!(headers).compact + ).post( + [BootpayStorage::RestClient::API[@mode.to_sym], uri].join('/'), + form: { images: files }, + params: params + ) + + # JSON 파싱 시도 + parsed_response = begin + JSON.parse(response.body.to_s, symbolize_names: true) + rescue JSON::ParserError => e + { error: "응답 파싱 실패: #{e.message}", body: response.body.to_s } + end + + # 응답 처리 + BootpayStorage::Response.new( + response.status.to_i == 200, + parsed_response + ) + rescue Exception => e + BootpayStorage::Response.new( + false, + message: "파일 업로드 실패: #{e.message}", + backtrace: e.backtrace.join("\n") + ) + end + # def upload(uri:, image_data:, image_name:, headers: {}, params: nil) # diff --git a/lib/bootpay_store/concern/user.rb b/lib/bootpay_store/concern/user.rb index b8d0513..91ed1af 100644 --- a/lib/bootpay_store/concern/user.rb +++ b/lib/bootpay_store/concern/user.rb @@ -7,7 +7,7 @@ module BootpayStore::Concern::User # @date: 2025-04-25 def login_by_user_id(user_id:, idempotency_key: nil) request( - uri: "users/login/token", + uri: "user/users/login/token", headers: { 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, 'Bootpay-Role' => 'user' From 9878137e6ab16f5c14bb2d58a4a0c795c84df438 Mon Sep 17 00:00:00 2001 From: rupy1014 Date: Thu, 17 Jul 2025 17:59:20 +0900 Subject: [PATCH 100/133] csv added --- lib/bootpay_storage/concern.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/bootpay_storage/concern.rb b/lib/bootpay_storage/concern.rb index ab04914..b992d0b 100644 --- a/lib/bootpay_storage/concern.rb +++ b/lib/bootpay_storage/concern.rb @@ -6,5 +6,6 @@ module Concern include Rest include Image include Token + include Csv end end \ No newline at end of file From 504fd755561d26112af31a3feb41e2bd73c7dfb1 Mon Sep 17 00:00:00 2001 From: rupy1014 Date: Thu, 17 Jul 2025 18:09:32 +0900 Subject: [PATCH 101/133] csv required added --- lib/bootpay_storage/concern.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/bootpay_storage/concern.rb b/lib/bootpay_storage/concern.rb index b992d0b..b385345 100644 --- a/lib/bootpay_storage/concern.rb +++ b/lib/bootpay_storage/concern.rb @@ -3,6 +3,7 @@ module Concern require_relative 'concern/rest' require_relative 'concern/token' require_relative 'concern/image' + require_relative 'concern/csv' include Rest include Image include Token From e1fc109b8d6fa8f741647d484b7511ae240dd22c Mon Sep 17 00:00:00 2001 From: gosomi Date: Fri, 8 Aug 2025 09:44:22 +0900 Subject: [PATCH 102/133] =?UTF-8?q?=EC=9C=84=EC=A0=AF=20=ED=82=A4=20?= =?UTF-8?q?=EC=A0=95=EB=B3=B4=EA=B0=80=20=EC=9E=88=EC=9D=84=20=EA=B2=BD?= =?UTF-8?q?=EC=9A=B0=20widget=EC=9C=BC=EB=A1=9C=20=EA=B0=84=EC=A3=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay/concern/payment.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/bootpay/concern/payment.rb b/lib/bootpay/concern/payment.rb index fbf6278..a864fe3 100644 --- a/lib/bootpay/concern/payment.rb +++ b/lib/bootpay/concern/payment.rb @@ -79,6 +79,7 @@ def request_payment(platform_application_id:, pg:, method: nil, price:, tax_free commission_keys: commission_keys, terms: terms, redirect_url: redirect_url, + widget: widget_key.present? ? 1 : 0, widget_key: widget_key, widget_sandbox: widget_sandbox, uuid: uuid.presence || rand_uuid, From 5285ab276108d7a1753e8ea17547faba4e3f54b1 Mon Sep 17 00:00:00 2001 From: gosomi Date: Wed, 20 Aug 2025 14:11:55 +0900 Subject: [PATCH 103/133] =?UTF-8?q?=EA=B2=BD=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay_store/concern/user.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bootpay_store/concern/user.rb b/lib/bootpay_store/concern/user.rb index 91ed1af..b8d0513 100644 --- a/lib/bootpay_store/concern/user.rb +++ b/lib/bootpay_store/concern/user.rb @@ -7,7 +7,7 @@ module BootpayStore::Concern::User # @date: 2025-04-25 def login_by_user_id(user_id:, idempotency_key: nil) request( - uri: "user/users/login/token", + uri: "users/login/token", headers: { 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, 'Bootpay-Role' => 'user' From 2fcf44bc937e3089e0cf21304dc1228023e9c6dd Mon Sep 17 00:00:00 2001 From: rupy1014 Date: Thu, 20 Nov 2025 14:04:33 +0900 Subject: [PATCH 104/133] =?UTF-8?q?=EA=B5=AC=EB=8F=85=20=EC=8A=B9=EC=9D=B8?= =?UTF-8?q?,=20=EA=B1=B0=EC=A0=88=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay_store/concern/supervisor.rb | 47 +++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/lib/bootpay_store/concern/supervisor.rb b/lib/bootpay_store/concern/supervisor.rb index d2dfa83..613fb76 100644 --- a/lib/bootpay_store/concern/supervisor.rb +++ b/lib/bootpay_store/concern/supervisor.rb @@ -30,5 +30,52 @@ def supervisor_request_order_cancel(idempotency_key: nil, cancel_id: nil, order_ }.compact ) end + + + + # 구독 단건 관리자 승인 + # 관리자 승인일 경우 bill 생성 후 (선불이면) 결제를 진행해야함 + # Comment by ehowlsla + # @date: 2025-11-19 + def supervisor_request_order_subscription_approve(idempotency_key: nil, order_subscription_id:, approval_status:, reason: nil) + request( + uri: "order_subscriptions/approve", + method: :put, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'supervisor' + }, + payload: + { + order_subscription_id: order_subscription_id, + approval_status: approval_status, + reason: reason + }.compact + ) + end + + + # 구독 단건 승인 거절 + # 요청된 구독건에 대해 거절 처리 + # 만약 생성된 bill 이 있다면 함께 취소 처리 + # Comment by ehowlsla + # @date: 2025-11-9 + def supervisor_request_order_subscription_reject(idempotency_key: nil, order_subscription_id:, approval_status:, reason: nil) + request( + uri: "order_subscriptions/reject", + method: :put, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'supervisor' + }, + payload: + { + order_subscription_id: order_subscription_id, + approval_status: approval_status, + reason: reason + }.compact + ) + end + end end \ No newline at end of file From 9b6bec3b118d7222e9e6a5ffc6c81155de14dacc Mon Sep 17 00:00:00 2001 From: rupy1014 Date: Thu, 20 Nov 2025 15:29:05 +0900 Subject: [PATCH 105/133] uri update --- lib/bootpay_store/concern/supervisor.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/bootpay_store/concern/supervisor.rb b/lib/bootpay_store/concern/supervisor.rb index 613fb76..d85d0ac 100644 --- a/lib/bootpay_store/concern/supervisor.rb +++ b/lib/bootpay_store/concern/supervisor.rb @@ -39,7 +39,7 @@ def supervisor_request_order_cancel(idempotency_key: nil, cancel_id: nil, order_ # @date: 2025-11-19 def supervisor_request_order_subscription_approve(idempotency_key: nil, order_subscription_id:, approval_status:, reason: nil) request( - uri: "order_subscriptions/approve", + uri: "order_subscriptions/#{order_subscription_id}/approve", method: :put, headers: { 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, @@ -47,7 +47,6 @@ def supervisor_request_order_subscription_approve(idempotency_key: nil, order_su }, payload: { - order_subscription_id: order_subscription_id, approval_status: approval_status, reason: reason }.compact @@ -62,7 +61,7 @@ def supervisor_request_order_subscription_approve(idempotency_key: nil, order_su # @date: 2025-11-9 def supervisor_request_order_subscription_reject(idempotency_key: nil, order_subscription_id:, approval_status:, reason: nil) request( - uri: "order_subscriptions/reject", + uri: "order_subscriptions/#{order_subscription_id}/reject", method: :put, headers: { 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, @@ -70,7 +69,6 @@ def supervisor_request_order_subscription_reject(idempotency_key: nil, order_sub }, payload: { - order_subscription_id: order_subscription_id, approval_status: approval_status, reason: reason }.compact From 1224b40ea73ffb07ebc61923a0fb8d181ba04097 Mon Sep 17 00:00:00 2001 From: rupy1014 Date: Fri, 21 Nov 2025 10:41:52 +0900 Subject: [PATCH 106/133] bill cancel added --- lib/bootpay_store/concern/supervisor.rb | 32 +++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/lib/bootpay_store/concern/supervisor.rb b/lib/bootpay_store/concern/supervisor.rb index d85d0ac..858a3cf 100644 --- a/lib/bootpay_store/concern/supervisor.rb +++ b/lib/bootpay_store/concern/supervisor.rb @@ -31,6 +31,38 @@ def supervisor_request_order_cancel(idempotency_key: nil, cancel_id: nil, order_ ) end + # bill 주문 취소 + # 전체취소 하거나, 부분취소할 수 있다. + # 부분취소는 상품으로하거나 금액으로 할 수 있는데, 상품으로 취소되면 배송비 등이 자동 계산되지만, 금액으로 취소는 환불개념이라 자동계산 되지 않는다. + # Comment by ehowlsla + # @date: 2025-04-04 + def supervisor_request_order_subscription_bill_cancel(idempotency_key: nil, cancel_id: nil, order_subscription_bill_id:, cancel_products: [], cancel_price: nil, + cancel_tax_free_price: nil, cancel_requester: '시스템', cancel_message: '요청취소') + + request( + uri: 'order_subscriptions/bill/cancel', + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'supervisor' + }, + payload: + { + order_number: order_number, + request_cancel_parameters: { + cancel_id: cancel_id, + cancel_products: cancel_products, + cancel_order_subscription_bills: cancel_order_subscription_bills, + cancel_price: cancel_price, + cancel_tax_free_price: cancel_tax_free_price, + cancel_requester: cancel_requester, + cancel_message: cancel_message, + cancel_immediately: cancel_immediately + }.compact + }.compact + ) + + end + # 구독 단건 관리자 승인 From 1d3d31ffe4ca85babd372d97ae23d0e501fd3ef6 Mon Sep 17 00:00:00 2001 From: rupy1014 Date: Fri, 21 Nov 2025 11:48:57 +0900 Subject: [PATCH 107/133] bug fixed --- lib/bootpay_store/concern/supervisor.rb | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/lib/bootpay_store/concern/supervisor.rb b/lib/bootpay_store/concern/supervisor.rb index 858a3cf..933f44e 100644 --- a/lib/bootpay_store/concern/supervisor.rb +++ b/lib/bootpay_store/concern/supervisor.rb @@ -37,7 +37,7 @@ def supervisor_request_order_cancel(idempotency_key: nil, cancel_id: nil, order_ # Comment by ehowlsla # @date: 2025-04-04 def supervisor_request_order_subscription_bill_cancel(idempotency_key: nil, cancel_id: nil, order_subscription_bill_id:, cancel_products: [], cancel_price: nil, - cancel_tax_free_price: nil, cancel_requester: '시스템', cancel_message: '요청취소') + cancel_tax_free_price: nil, cancel_requester: '시스템', cancel_message: '요청취소', cancel_immediately: false) request( uri: 'order_subscriptions/bill/cancel', @@ -47,17 +47,14 @@ def supervisor_request_order_subscription_bill_cancel(idempotency_key: nil, canc }, payload: { - order_number: order_number, - request_cancel_parameters: { - cancel_id: cancel_id, - cancel_products: cancel_products, - cancel_order_subscription_bills: cancel_order_subscription_bills, - cancel_price: cancel_price, - cancel_tax_free_price: cancel_tax_free_price, - cancel_requester: cancel_requester, - cancel_message: cancel_message, - cancel_immediately: cancel_immediately - }.compact + order_subscription_bill_id: order_subscription_bill_id, + cancel_id: cancel_id, + cancel_products: cancel_products, + cancel_price: cancel_price, + cancel_tax_free_price: cancel_tax_free_price, + cancel_requester: cancel_requester, + cancel_message: cancel_message, + cancel_immediately: cancel_immediately }.compact ) From ba71065683ec5d90efee7786c9f820dd8fa9f312 Mon Sep 17 00:00:00 2001 From: gosomi Date: Wed, 26 Nov 2025 10:22:56 +0900 Subject: [PATCH 108/133] =?UTF-8?q?=EC=B2=AD=EA=B5=AC=EC=84=9C=20=EA=B2=B0?= =?UTF-8?q?=EC=A0=9C=20=EC=9A=94=EC=B2=AD=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay_store/concern.rb | 4 + lib/bootpay_store/concern/invoice.rb | 41 +++++++++ lib/bootpay_store/concern/order.rb | 21 ++++- lib/bootpay_store/concern/product.rb | 18 ++++ lib/bootpay_store/concern/user.rb | 10 +-- .../request_invoice_normal_product_spec.rb | 50 +++++++++++ .../invoice/request_invoice_price_spec.rb | 41 +++++++++ ...quest_invoice_subscription_product_spec.rb | 84 +++++++++++++++++++ .../request_invoice_usage_product_spec.rb | 49 +++++++++++ spec/bootpay_store/order/confirm_spec.rb | 20 +++++ spec/bootpay_store/order/order_detail_spec.rb | 2 +- spec/bootpay_store/product/lookup_spec.rb | 18 ++++ 12 files changed, 350 insertions(+), 8 deletions(-) create mode 100644 lib/bootpay_store/concern/invoice.rb create mode 100644 lib/bootpay_store/concern/product.rb create mode 100644 spec/bootpay_store/invoice/request_invoice_normal_product_spec.rb create mode 100644 spec/bootpay_store/invoice/request_invoice_price_spec.rb create mode 100644 spec/bootpay_store/invoice/request_invoice_subscription_product_spec.rb create mode 100644 spec/bootpay_store/invoice/request_invoice_usage_product_spec.rb create mode 100644 spec/bootpay_store/order/confirm_spec.rb create mode 100644 spec/bootpay_store/product/lookup_spec.rb diff --git a/lib/bootpay_store/concern.rb b/lib/bootpay_store/concern.rb index 17922fa..f6608bd 100644 --- a/lib/bootpay_store/concern.rb +++ b/lib/bootpay_store/concern.rb @@ -1,17 +1,21 @@ module BootpayStore module Concern + require_relative 'concern/invoice' require_relative 'concern/order' require_relative 'concern/order_subscription' require_relative 'concern/payment' + require_relative 'concern/product' require_relative 'concern/rest' require_relative 'concern/supervisor' require_relative 'concern/token' require_relative 'concern/user' require_relative 'concern/user_group' + include Invoice include Order include OrderSubscription include Payment + include Product include Rest include Supervisor include Token diff --git a/lib/bootpay_store/concern/invoice.rb b/lib/bootpay_store/concern/invoice.rb new file mode 100644 index 0000000..89da65b --- /dev/null +++ b/lib/bootpay_store/concern/invoice.rb @@ -0,0 +1,41 @@ +module BootpayStore::Concern::Invoice + extend ActiveSupport::Concern + + included do + # 청구서를 생성한다 + # Comment by GOSOMI + # @date: 2025-10-03 + def create_invoice(idempotency_key: nil, name:, memo:, user: {}, products: [], price:, tax_free_price: 0, delivery_price: 0, + redirect_url: nil, request_id: nil, use_notification: false, use_auto_login: false, expired_at: nil, metadata: {}, + webhook_url: nil, header_content_type: 'application/json', usage_api_url: nil, extra: {}) + request( + uri: 'invoices', + method: :post, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'user' + }, + payload: + { + name: name, + memo: memo, + user: user, + products: products, + price: price, + tax_free_price: tax_free_price, + delivery_price: delivery_price, + redirect_url: redirect_url, + request_id: request_id, + use_notification: use_notification, + use_auto_login: use_auto_login, + expired_at: expired_at, + metadata: metadata, + webhook_url: webhook_url, + header_content_type: header_content_type, + usage_api_url: usage_api_url, + extra: extra + }.compact + ) + end + end +end \ No newline at end of file diff --git a/lib/bootpay_store/concern/order.rb b/lib/bootpay_store/concern/order.rb index c0234b1..95625a9 100644 --- a/lib/bootpay_store/concern/order.rb +++ b/lib/bootpay_store/concern/order.rb @@ -30,9 +30,9 @@ def orders(status: [], payment_status: [], keyword: nil, page: 1, cs_type: nil, end # 주문 상세를 조회한다 - def order_detail(order_id:, idempotency_key: nil) + def order_detail(order_number:, idempotency_key: nil) request( - uri: "orders/#{order_id}", + uri: "orders/#{order_number}", method: :get, headers: { 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, @@ -40,5 +40,22 @@ def order_detail(order_id:, idempotency_key: nil) } ) end + + # 주문 결제 승인 + # Comment by GOSOMI + # @date: 2025-10-28 + def order_confirm(order_number:, idempotency_key: nil) + request( + uri: 'order/confirm', + method: :post, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'user' + }, + payload: { + order_number: order_number + } + ) + end end end \ No newline at end of file diff --git a/lib/bootpay_store/concern/product.rb b/lib/bootpay_store/concern/product.rb new file mode 100644 index 0000000..506f64b --- /dev/null +++ b/lib/bootpay_store/concern/product.rb @@ -0,0 +1,18 @@ +module BootpayStore::Concern::Product + extend ActiveSupport::Concern + + included do + # 상품 정보를 가져온다 + # Comment by GOSOMI + # @date: 2025-10-10 + def lookup_product(product_id:, idempotency_key: nil) + request( + uri: "products/#{product_id}", + method: :get, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + } + ) + end + end +end diff --git a/lib/bootpay_store/concern/user.rb b/lib/bootpay_store/concern/user.rb index b8d0513..daf1441 100644 --- a/lib/bootpay_store/concern/user.rb +++ b/lib/bootpay_store/concern/user.rb @@ -56,10 +56,10 @@ def lookup_user(user_id:, idempotency_key: nil) # 회원가입 # Comment by GOSOMI # @date: 2025-06-16 - def external_user_sign_in(ex_uid:, user_group_id:, is_group_admin:, - name:, phone:, email:, tel:, nickname:, comment:, - gender:, birth:, individual_extension:, login_id:, login_email:, login_pw:, - join_at:) + def external_user_sign_in(idempotency_key: nil, uid:, user_group_id: nil, is_group_admin: false, + name:, phone:, email:, tel: nil, nickname: nil, comment: nil, + gender: nil, birth: nil, individual_extension: nil, login_id:, login_email:, + login_pw: nil, join_at: nil) request( uri: 'users/join', method: :post, @@ -69,7 +69,7 @@ def external_user_sign_in(ex_uid:, user_group_id:, is_group_admin:, }, payload: { - ex_uid: ex_uid, + uid: uid, user_group_id: user_group_id, is_group_admin: is_group_admin, name: name, diff --git a/spec/bootpay_store/invoice/request_invoice_normal_product_spec.rb b/spec/bootpay_store/invoice/request_invoice_normal_product_spec.rb new file mode 100644 index 0000000..ddafc87 --- /dev/null +++ b/spec/bootpay_store/invoice/request_invoice_normal_product_spec.rb @@ -0,0 +1,50 @@ +RSpec.describe BootpayStore::RestClient do + it "invoice request normal product" do + user_id = 'gosomi85@bootpay.co.kr' + api = BootpayStore::RestClient.new( + client_key: 'QIzXk4M3EeD-6B1GTfmGHA', + secret_key: 'vRle44QfyBj7nzJlBbeebqkbtlJVRTS2DQa9Adpz3d8=', + mode: 'development' + ) + token = api.request_access_token + if token.success? + user_exist = api.id_exist( + id: 'gosomi85' + ) + unless user_exist.data[:exist] + user_create = api.external_user_sign_in( + uid: user_id, + name: '테스트 사용자', + email: user_id, + login_id: 'gosomi85', + login_email: user_id, + phone: '010000000000', + is_group_admin: true, + ) + puts user_create.data + end + response = api.create_invoice( + name: '테스트 청구서', + memo: '테스트 청구서 상세 메모', + user: { + user_id: 'gosomi85' + }, + products: [ + { + product_id: '66fa14954eac568eab4fc2d0', + product_option_id: '68ede8c675febc5627363fb2', + duration: 24, + quantity: 1, + } + ], + price: 1000, + redirect_url: 'https://example.com', + use_auto_login: true, + request_id: 'test1', + expired_at: (Time.current + 7.days).strftime('%Y-%m-%d 00:00:00'), + metadata: { custom_key: 'custom_value' } + ) + puts JSON.pretty_generate(response.data) + end + end +end \ No newline at end of file diff --git a/spec/bootpay_store/invoice/request_invoice_price_spec.rb b/spec/bootpay_store/invoice/request_invoice_price_spec.rb new file mode 100644 index 0000000..21f0703 --- /dev/null +++ b/spec/bootpay_store/invoice/request_invoice_price_spec.rb @@ -0,0 +1,41 @@ +RSpec.describe BootpayStore::RestClient do + it "invoice request price only product" do + user_id = 'gosomi85@bootpay.co.kr' + api = BootpayStore::RestClient.new( + client_key: 'QIzXk4M3EeD-6B1GTfmGHA', + secret_key: 'vRle44QfyBj7nzJlBbeebqkbtlJVRTS2DQa9Adpz3d8=', + mode: 'development' + ) + token = api.request_access_token + if token.success? + user_exist = api.id_exist( + id: 'gosomi85' + ) + unless user_exist.data[:exist] + user_create = api.external_user_sign_in( + uid: user_id, + name: '테스트 사용자', + email: user_id, + login_id: 'gosomi85', + login_email: user_id, + phone: '010000000000', + is_group_admin: true, + ) + puts user_create.data + end + response = api.create_invoice( + name: '테스트 청구서', + memo: '테스트 청구서 상세 메모', + user: { + user_id: 'gosomi85' + }, + price: 3000, + redirect_url: 'https://example.com', + request_id: 'test1', + expired_at: (Time.current + 7.days).strftime('%Y-%m-%d 00:00:00'), + metadata: { custom_key: 'custom_value' } + ) + puts JSON.pretty_generate(response.data) + end + end +end \ No newline at end of file diff --git a/spec/bootpay_store/invoice/request_invoice_subscription_product_spec.rb b/spec/bootpay_store/invoice/request_invoice_subscription_product_spec.rb new file mode 100644 index 0000000..a9dd161 --- /dev/null +++ b/spec/bootpay_store/invoice/request_invoice_subscription_product_spec.rb @@ -0,0 +1,84 @@ +RSpec.describe BootpayStore::RestClient do + it "invoice request normal product" do + user_id = 'gosomi85@bootpay.co.kr' + api = BootpayStore::RestClient.new( + client_key: 'QIzXk4M3EeD-6B1GTfmGHA', + secret_key: 'vRle44QfyBj7nzJlBbeebqkbtlJVRTS2DQa9Adpz3d8=', + mode: 'development' + ) + token = api.request_access_token + if token.success? + user_exist = api.id_exist( + id: 'gosomi85' + ) + unless user_exist.data[:exist] + user_create = api.external_user_sign_in( + uid: user_id, + name: '테스트 사용자', + email: user_id, + login_id: 'gosomi85', + login_email: user_id, + phone: '010000000000', + is_group_admin: true, + ) + puts user_create.data + end + response = api.create_invoice( + name: '과금 청구서', + memo: '과금 청구서입니다', + user: { + user_id: 'gosomi85' + }, + products: [ + { + product_id: '66fa14954eac568eab4fc2d0', + product_option_id: '68ede8c675febc5627363fb2', + duration: 24, + quantity: 1, + price_adjustments: [ + { + price_adjustment_id: 'test1', + start_at: '2025-09-20 00:00:00', + end_at: '2025-12-30 23:59:59', + name: '첫 구매 할인 프로모션', + cycles: [ + { + duration: 1, + adjustment_type: 'discount_percent', + name: '첫달 할인', + value: 20, + min_value: 100, + max_value: 500 + }, + { + duration: 2, + adjustment_type: 'discount_price', + name: '둘째달 할인', + value: 100 + }, + { + duration: 1, + name: '도입비', + adjustment_type: 'setup_fee', + value: 500 + } + ] + } + ] + } + ], + price: 1000, + redirect_url: 'https://example.com', + use_auto_login: true, + request_id: 'test1', + expired_at: (Time.current + 7.days).strftime('%Y-%m-%d 00:00:00'), + metadata: { custom_key: 'custom_value' }, + extra: { + separately_confirmed: false, + create_order_immediately: true + } + ) + puts JSON.pretty_generate(response.data) + end + end +end \ No newline at end of file diff --git a/spec/bootpay_store/invoice/request_invoice_usage_product_spec.rb b/spec/bootpay_store/invoice/request_invoice_usage_product_spec.rb new file mode 100644 index 0000000..d711238 --- /dev/null +++ b/spec/bootpay_store/invoice/request_invoice_usage_product_spec.rb @@ -0,0 +1,49 @@ +RSpec.describe BootpayStore::RestClient do + it "invoice request normal product" do + user_id = 'gosomi85@bootpay.co.kr' + api = BootpayStore::RestClient.new( + client_key: 'QIzXk4M3EeD-6B1GTfmGHA', + secret_key: 'vRle44QfyBj7nzJlBbeebqkbtlJVRTS2DQa9Adpz3d8=', + mode: 'development' + ) + token = api.request_access_token + if token.success? + user_exist = api.id_exist( + id: 'gosomi85' + ) + unless user_exist.data[:exist] + user_create = api.external_user_sign_in( + uid: user_id, + name: '테스트 사용자', + email: user_id, + login_id: 'gosomi85', + login_email: user_id, + phone: '010000000000', + is_group_admin: true, + ) + puts user_create.data + end + response = api.create_invoice( + name: '과금 청구서', + memo: '과금 청구서입니다', + user: { + user_id: 'gosomi85' + }, + products: [ + { + product_id: '68dcee4c5614185fea14a0b7', + quantity: 1, + } + ], + price: 1000, + redirect_url: 'https://example.com', + usage_api_url: 'https://dev-api.bootapi.com/v1/billing/usage', + use_auto_login: true, + request_id: 'test1', + expired_at: (Time.current + 7.days).strftime('%Y-%m-%d 00:00:00'), + metadata: { custom_key: 'custom_value' } + ) + puts JSON.pretty_generate(response.data) + end + end +end \ No newline at end of file diff --git a/spec/bootpay_store/order/confirm_spec.rb b/spec/bootpay_store/order/confirm_spec.rb new file mode 100644 index 0000000..86d0193 --- /dev/null +++ b/spec/bootpay_store/order/confirm_spec.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +RSpec.describe BootpayStore::RestClient do + it "order confirm" do + api = BootpayStore::RestClient.new( + client_key: 'QIzXk4M3EeD-6B1GTfmGHA', + secret_key: 'vRle44QfyBj7nzJlBbeebqkbtlJVRTS2DQa9Adpz3d8=', + mode: 'development' + ) + token = api.request_access_token + if token.success? + response = api.order_confirm( + order_number: "25110364369576065094" + ) + puts response.data.to_json + else + puts token.data + end + end +end diff --git a/spec/bootpay_store/order/order_detail_spec.rb b/spec/bootpay_store/order/order_detail_spec.rb index f9553fd..db998fb 100644 --- a/spec/bootpay_store/order/order_detail_spec.rb +++ b/spec/bootpay_store/order/order_detail_spec.rb @@ -15,7 +15,7 @@ # ) token = api.request_access_token if token.success? - response = api.order_detail(order_id: '685425f81c872444f161f00c') + response = api.order_detail(order_number: "25102941848506519161") puts response.data.to_json else puts token.data diff --git a/spec/bootpay_store/product/lookup_spec.rb b/spec/bootpay_store/product/lookup_spec.rb new file mode 100644 index 0000000..5796eaa --- /dev/null +++ b/spec/bootpay_store/product/lookup_spec.rb @@ -0,0 +1,18 @@ +RSpec.describe BootpayStore::RestClient do + it "lookup product" do + api = BootpayStore::RestClient.new( + client_key: 'QIzXk4M3EeD-6B1GTfmGHA', + secret_key: 'vRle44QfyBj7nzJlBbeebqkbtlJVRTS2DQa9Adpz3d8=', + mode: 'development' + ) + token = api.request_access_token + if token.success? + response = api.lookup_product( + product_id: '66fa14954eac568eab4fc2d0' + ) + puts JSON.pretty_generate(response.data) + else + puts token.data + end + end +end \ No newline at end of file From 85e51b4bf57155fb9963d4c610d91160e41f95b3 Mon Sep 17 00:00:00 2001 From: gosomi Date: Wed, 26 Nov 2025 10:25:50 +0900 Subject: [PATCH 109/133] =?UTF-8?q?=EA=B8=88=EC=95=A1=EB=8F=84=20=EC=84=A0?= =?UTF-8?q?=ED=83=9D=EC=9C=BC=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay_store/concern/invoice.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bootpay_store/concern/invoice.rb b/lib/bootpay_store/concern/invoice.rb index 89da65b..4159bdc 100644 --- a/lib/bootpay_store/concern/invoice.rb +++ b/lib/bootpay_store/concern/invoice.rb @@ -5,7 +5,7 @@ module BootpayStore::Concern::Invoice # 청구서를 생성한다 # Comment by GOSOMI # @date: 2025-10-03 - def create_invoice(idempotency_key: nil, name:, memo:, user: {}, products: [], price:, tax_free_price: 0, delivery_price: 0, + def create_invoice(idempotency_key: nil, name:, memo: nil, user: {}, products: [], price: 0, tax_free_price: 0, delivery_price: 0, redirect_url: nil, request_id: nil, use_notification: false, use_auto_login: false, expired_at: nil, metadata: {}, webhook_url: nil, header_content_type: 'application/json', usage_api_url: nil, extra: {}) request( From 5b6d75f3668d35e63285b815d5749f8a9a8ecb1f Mon Sep 17 00:00:00 2001 From: gosomi Date: Wed, 26 Nov 2025 11:00:23 +0900 Subject: [PATCH 110/133] =?UTF-8?q?sdk=20=EC=97=AC=EB=B6=80=20=EC=84=A0?= =?UTF-8?q?=ED=83=9D=20=EA=B0=80=EB=8A=A5=ED=95=98=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay_store/concern/invoice.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/bootpay_store/concern/invoice.rb b/lib/bootpay_store/concern/invoice.rb index 4159bdc..553a754 100644 --- a/lib/bootpay_store/concern/invoice.rb +++ b/lib/bootpay_store/concern/invoice.rb @@ -5,7 +5,7 @@ module BootpayStore::Concern::Invoice # 청구서를 생성한다 # Comment by GOSOMI # @date: 2025-10-03 - def create_invoice(idempotency_key: nil, name:, memo: nil, user: {}, products: [], price: 0, tax_free_price: 0, delivery_price: 0, + def create_invoice(idempotency_key: nil, sdk: false, name:, memo: nil, user: {}, products: [], price: 0, tax_free_price: 0, delivery_price: 0, redirect_url: nil, request_id: nil, use_notification: false, use_auto_login: false, expired_at: nil, metadata: {}, webhook_url: nil, header_content_type: 'application/json', usage_api_url: nil, extra: {}) request( @@ -17,6 +17,7 @@ def create_invoice(idempotency_key: nil, name:, memo: nil, user: {}, products: [ }, payload: { + sdk: sdk, name: name, memo: memo, user: user, From 5dfd40900b846445fcc0a9784580f5aa7f5ec925 Mon Sep 17 00:00:00 2001 From: rupy1014 Date: Wed, 3 Dec 2025 13:17:41 +0900 Subject: [PATCH 111/133] test.md added --- spec/test.md | 106 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 spec/test.md diff --git a/spec/test.md b/spec/test.md new file mode 100644 index 0000000..c153955 --- /dev/null +++ b/spec/test.md @@ -0,0 +1,106 @@ +# Ruby SDK 테스트 실행 가이드 + +## 환경 설정 + +`spec/spec_helper.rb` 파일에서 환경을 설정합니다: + +```ruby +# 'development' 또는 'production'으로 설정 +CURRENT_ENV = 'production' +``` + +## 테스트 실행 + +### 전체 테스트 실행 +```bash +cd /Users/taesupyoon/bootpay/server/sdk/ruby +bundle exec rspec spec/bootpay/pg/ +``` + +### 개별 테스트 실행 +```bash +# 토큰 발급 +bundle exec rspec spec/bootpay/pg/request_token_spec.rb + +# 결제 조회 +bundle exec rspec spec/bootpay/pg/receipt_payment_spec.rb + +# 결제 승인 +bundle exec rspec spec/bootpay/pg/confirm_payment_spec.rb + +# 결제 취소 +bundle exec rspec spec/bootpay/pg/cancel_spec.rb + +# 본인인증 조회 +bundle exec rspec spec/bootpay/pg/certificate_spec.rb + +# 빌링키 조회 +bundle exec rspec spec/bootpay/pg/billing_key_spec.rb + +# 빌링키 삭제 +bundle exec rspec spec/bootpay/pg/destroy_billing_key_spec.rb + +# 정기결제 실행 +bundle exec rspec spec/bootpay/pg/subscribe_card_payment_spec.rb + +# 예약 결제 +bundle exec rspec spec/bootpay/pg/subscribe_payment_reserve_spec.rb + +# 예약 결제 취소 +bundle exec rspec spec/bootpay/pg/cancel_subscribe_reserve_spec.rb + +# 결제건 현금영수증 발행 +bundle exec rspec spec/bootpay/pg/cash_publish_on_receipt_spec.rb + +# 결제건 현금영수증 취소 +bundle exec rspec spec/bootpay/pg/cash_cancel_on_receipt_spec.rb + +# 현금영수증 발행 +bundle exec rspec spec/bootpay/pg/request_cash_receipt_spec.rb + +# 현금영수증 취소 +bundle exec rspec spec/bootpay/pg/cancel_cash_receipt_spec.rb + +# 에스크로 배송시작 +bundle exec rspec spec/bootpay/pg/shipping_start_spec.rb + +# 사용자 토큰 발급 +bundle exec rspec spec/bootpay/pg/request_user_token_spec.rb +``` + +## 테스트 데이터 + +`spec/spec_helper.rb`에서 `TEST_DATA` 상수를 통해 테스트 데이터를 관리합니다: + +```ruby +TEST_DATA = { + receipt_id: '628b2206d01c7e00209b6087', + receipt_id_confirm: '62876963d01c7e00209b6028', + receipt_id_cash: '62e0f11f1fc192036b1b3c92', + receipt_id_escrow: '628ae7ffd01c7e001e9b6066', + receipt_id_billing: '62c7ccebcf9f6d001b3adcd4', + receipt_id_transfer: '66541bc4ca4517e69343e24c', + billing_key: '628b2644d01c7e00209b6092', + billing_key_2: '66542dfb4d18d5fc7b43e1b6', + reserve_id: '6490149ca575b40024f0b70d', + reserve_id_2: '628b316cd01c7e00219b6081', + user_id: '1234', + certificate_receipt_id: '61b009aaec81b4057e7f6ecd' +} +``` + +## 폴더 구조 + +``` +spec/ +├── spec_helper.rb # 설정 및 헬퍼 함수 +├── test.md # 테스트 가이드 +└── bootpay/ + ├── pg/ # PG API 테스트 + │ ├── request_token_spec.rb + │ ├── receipt_payment_spec.rb + │ ├── confirm_payment_spec.rb + │ └── ... + ├── authenticate/ # 인증 관련 테스트 + └── rest/ # REST 관련 테스트 +``` From 15e63443ff0f6d98b7a51691cffc37c00f1c4256 Mon Sep 17 00:00:00 2001 From: gosomi Date: Mon, 8 Dec 2025 17:17:43 +0900 Subject: [PATCH 112/133] =?UTF-8?q?checkout=EC=9C=BC=EB=A1=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay_store/concern/invoice.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/bootpay_store/concern/invoice.rb b/lib/bootpay_store/concern/invoice.rb index 553a754..8daa508 100644 --- a/lib/bootpay_store/concern/invoice.rb +++ b/lib/bootpay_store/concern/invoice.rb @@ -5,9 +5,9 @@ module BootpayStore::Concern::Invoice # 청구서를 생성한다 # Comment by GOSOMI # @date: 2025-10-03 - def create_invoice(idempotency_key: nil, sdk: false, name:, memo: nil, user: {}, products: [], price: 0, tax_free_price: 0, delivery_price: 0, - redirect_url: nil, request_id: nil, use_notification: false, use_auto_login: false, expired_at: nil, metadata: {}, - webhook_url: nil, header_content_type: 'application/json', usage_api_url: nil, extra: {}) + def request_checkout(idempotency_key: nil, name:, memo: nil, user: {}, products: [], price: 0, tax_free_price: 0, delivery_price: 0, + redirect_url: nil, request_id: nil, use_notification: false, use_auto_login: false, expired_at: nil, metadata: {}, + webhook_url: nil, header_content_type: 'application/json', usage_api_url: nil, extra: {}) request( uri: 'invoices', method: :post, @@ -17,7 +17,6 @@ def create_invoice(idempotency_key: nil, sdk: false, name:, memo: nil, user: {}, }, payload: { - sdk: sdk, name: name, memo: memo, user: user, @@ -38,5 +37,7 @@ def create_invoice(idempotency_key: nil, sdk: false, name:, memo: nil, user: {}, }.compact ) end + + alias :create_invoice :request_checkout end end \ No newline at end of file From 3b3c57d2d2c7262ff95e88816d91907aef420be8 Mon Sep 17 00:00:00 2001 From: gosomi Date: Mon, 8 Dec 2025 17:46:22 +0900 Subject: [PATCH 113/133] =?UTF-8?q?sdk=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay_store/concern/invoice.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/bootpay_store/concern/invoice.rb b/lib/bootpay_store/concern/invoice.rb index 8daa508..df06654 100644 --- a/lib/bootpay_store/concern/invoice.rb +++ b/lib/bootpay_store/concern/invoice.rb @@ -5,7 +5,7 @@ module BootpayStore::Concern::Invoice # 청구서를 생성한다 # Comment by GOSOMI # @date: 2025-10-03 - def request_checkout(idempotency_key: nil, name:, memo: nil, user: {}, products: [], price: 0, tax_free_price: 0, delivery_price: 0, + def request_checkout(sdk: false, idempotency_key: nil, name:, memo: nil, user: {}, products: [], price: 0, tax_free_price: 0, delivery_price: 0, redirect_url: nil, request_id: nil, use_notification: false, use_auto_login: false, expired_at: nil, metadata: {}, webhook_url: nil, header_content_type: 'application/json', usage_api_url: nil, extra: {}) request( @@ -17,6 +17,7 @@ def request_checkout(idempotency_key: nil, name:, memo: nil, user: {}, products: }, payload: { + sdk: sdk, name: name, memo: memo, user: user, From 9693e78fb4daf3a74e8302655728d18794f262c7 Mon Sep 17 00:00:00 2001 From: gosomi Date: Wed, 24 Dec 2025 18:09:52 +0900 Subject: [PATCH 114/133] =?UTF-8?q?password=20=EA=B2=80=EC=A6=9D=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay/concern/sdk.rb | 16 ++++++++ .../request_invoice_normal_product_spec.rb | 40 ++++++++++--------- 2 files changed, 38 insertions(+), 18 deletions(-) diff --git a/lib/bootpay/concern/sdk.rb b/lib/bootpay/concern/sdk.rb index 4eaf424..cf270bd 100644 --- a/lib/bootpay/concern/sdk.rb +++ b/lib/bootpay/concern/sdk.rb @@ -32,5 +32,21 @@ def regist_biometric_authenticate(os:, token:, user_token:, uuid:) } ) end + + # Validate Password Token + # Comment by GOSOMI + # @date: 2025-12-24 + def validate_password_token(token:, user_token:) + request( + method: :post, + uri: 'sdk/password-token', + headers: { + 'Bootpay-User-Token': user_token + }, + payload: { + token: token + } + ) + end end end \ No newline at end of file diff --git a/spec/bootpay_store/invoice/request_invoice_normal_product_spec.rb b/spec/bootpay_store/invoice/request_invoice_normal_product_spec.rb index ddafc87..20cc70a 100644 --- a/spec/bootpay_store/invoice/request_invoice_normal_product_spec.rb +++ b/spec/bootpay_store/invoice/request_invoice_normal_product_spec.rb @@ -24,25 +24,29 @@ puts user_create.data end response = api.create_invoice( - name: '테스트 청구서', - memo: '테스트 청구서 상세 메모', - user: { - user_id: 'gosomi85' + name: '테스트 청구서', + memo: '테스트 청구서 상세 메모', + user: { + membership_type: 'guest', + name: '부트페이', + user_id: 'test123', + phone: '01095735114' }, - products: [ - { - product_id: '66fa14954eac568eab4fc2d0', - product_option_id: '68ede8c675febc5627363fb2', - duration: 24, - quantity: 1, - } - ], - price: 1000, - redirect_url: 'https://example.com', - use_auto_login: true, - request_id: 'test1', - expired_at: (Time.current + 7.days).strftime('%Y-%m-%d 00:00:00'), - metadata: { custom_key: 'custom_value' } + products: [ + { + product_id: '66fa14954eac568eab4fc2d0', + product_option_id: '68ede8c675febc5627363fb2', + duration: 24, + quantity: 1, + } + ], + price: 1000, + redirect_url: 'https://example.com', + use_auto_login: true, + request_id: 'test1', + use_notification: true, + expired_at: (Time.current + 7.days).strftime('%Y-%m-%d 00:00:00'), + metadata: { custom_key: 'custom_value' } ) puts JSON.pretty_generate(response.data) end From a5575827afff84a71142d6a9f8438e61200929b2 Mon Sep 17 00:00:00 2001 From: gosomi Date: Tue, 6 Jan 2026 15:24:21 +0900 Subject: [PATCH 115/133] =?UTF-8?q?login=5Fby=5Fuser=5Fid=20=ED=8C=8C?= =?UTF-8?q?=EB=9D=BC=EB=A9=94=ED=84=B0=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay_store/concern/user.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/bootpay_store/concern/user.rb b/lib/bootpay_store/concern/user.rb index daf1441..6d57031 100644 --- a/lib/bootpay_store/concern/user.rb +++ b/lib/bootpay_store/concern/user.rb @@ -5,7 +5,7 @@ module BootpayStore::Concern::User # UserId로 로그인을 시도한다 # Comment by GOSOMI # @date: 2025-04-25 - def login_by_user_id(user_id:, idempotency_key: nil) + def login_by_user_id(user_id:, membership_type: 'member', corporate_type: 'individual' idempotency_key: nil) request( uri: "users/login/token", headers: { @@ -14,7 +14,9 @@ def login_by_user_id(user_id:, idempotency_key: nil) }, payload: { - user_id: user_id + user_id: user_id, + membership_type: membership_type, + corporate_type: corporate_type } ) end From 8e841dde945e0c4efe75db7fd3105ffdff9090ee Mon Sep 17 00:00:00 2001 From: gosomi Date: Tue, 6 Jan 2026 15:25:16 +0900 Subject: [PATCH 116/133] =?UTF-8?q?=EB=B2=84=EA=B7=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay_store/concern/user.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bootpay_store/concern/user.rb b/lib/bootpay_store/concern/user.rb index 6d57031..6c28113 100644 --- a/lib/bootpay_store/concern/user.rb +++ b/lib/bootpay_store/concern/user.rb @@ -5,7 +5,7 @@ module BootpayStore::Concern::User # UserId로 로그인을 시도한다 # Comment by GOSOMI # @date: 2025-04-25 - def login_by_user_id(user_id:, membership_type: 'member', corporate_type: 'individual' idempotency_key: nil) + def login_by_user_id(user_id:, membership_type: 'member', corporate_type: 'individual', idempotency_key: nil) request( uri: "users/login/token", headers: { From 32e677832223bfa813054ac7141fec2fe3013db4 Mon Sep 17 00:00:00 2001 From: alfredhot Date: Fri, 9 Jan 2026 18:56:28 +0900 Subject: [PATCH 117/133] =?UTF-8?q?=EC=A3=BC=EB=AC=B8=20=EA=B0=95=EC=A0=9C?= =?UTF-8?q?=20=EC=B7=A8=EC=86=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay_store/concern/supervisor.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/bootpay_store/concern/supervisor.rb b/lib/bootpay_store/concern/supervisor.rb index 933f44e..a2dca71 100644 --- a/lib/bootpay_store/concern/supervisor.rb +++ b/lib/bootpay_store/concern/supervisor.rb @@ -5,9 +5,10 @@ module BootpayStore::Concern::Supervisor # 주문 취소 # Comment by GOSOMI # @date: 2025-04-04 + # param force: 결제취소 실패시 주문을 강제로 취소 상태로 변경 def supervisor_request_order_cancel(idempotency_key: nil, cancel_id: nil, order_number:, cancel_products: nil, cancel_price: nil, cancel_tax_free_price: 0, cancel_requester: '시스템', cancel_message: '요청취소', cancel_immediately: false, - cancel_order_subscription_bills: nil) + cancel_order_subscription_bills: nil, force: false) request( uri: 'order/cancel', headers: { @@ -25,7 +26,8 @@ def supervisor_request_order_cancel(idempotency_key: nil, cancel_id: nil, order_ cancel_tax_free_price: cancel_tax_free_price, cancel_requester: cancel_requester, cancel_message: cancel_message, - cancel_immediately: cancel_immediately + cancel_immediately: cancel_immediately, + force: force }.compact }.compact ) From ca556739822f1dec6efa1408db5cdc75212a8742 Mon Sep 17 00:00:00 2001 From: gosomi Date: Tue, 27 Jan 2026 11:47:38 +0900 Subject: [PATCH 118/133] =?UTF-8?q?termination=5Ffee=20=ED=8C=8C=EB=9D=BC?= =?UTF-8?q?=EB=A9=94=ED=84=B0=EB=AA=85=20=EC=A1=B0=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay_store/concern/supervisor.rb | 96 +++++++++++++++---- .../order_subscription_approve_spec.rb | 26 +++++ .../order_subscription_pause_spec.rb | 28 ++++++ .../order_subscription_reject_spec.rb | 26 +++++ .../order_subscription_resume_spec.rb | 26 +++++ .../order_subscription_terminate_spec.rb | 26 +++++ 6 files changed, 209 insertions(+), 19 deletions(-) create mode 100644 spec/bootpay_store/order_subscription/order_subscription_approve_spec.rb create mode 100644 spec/bootpay_store/order_subscription/order_subscription_pause_spec.rb create mode 100644 spec/bootpay_store/order_subscription/order_subscription_reject_spec.rb create mode 100644 spec/bootpay_store/order_subscription/order_subscription_resume_spec.rb create mode 100644 spec/bootpay_store/order_subscription/order_subscription_terminate_spec.rb diff --git a/lib/bootpay_store/concern/supervisor.rb b/lib/bootpay_store/concern/supervisor.rb index 933f44e..0b10a46 100644 --- a/lib/bootpay_store/concern/supervisor.rb +++ b/lib/bootpay_store/concern/supervisor.rb @@ -37,7 +37,7 @@ def supervisor_request_order_cancel(idempotency_key: nil, cancel_id: nil, order_ # Comment by ehowlsla # @date: 2025-04-04 def supervisor_request_order_subscription_bill_cancel(idempotency_key: nil, cancel_id: nil, order_subscription_bill_id:, cancel_products: [], cancel_price: nil, - cancel_tax_free_price: nil, cancel_requester: '시스템', cancel_message: '요청취소', cancel_immediately: false) + cancel_tax_free_price: nil, cancel_requester: '시스템', cancel_message: '요청취소', cancel_immediately: false) request( uri: 'order_subscriptions/bill/cancel', @@ -48,25 +48,23 @@ def supervisor_request_order_subscription_bill_cancel(idempotency_key: nil, canc payload: { order_subscription_bill_id: order_subscription_bill_id, - cancel_id: cancel_id, - cancel_products: cancel_products, - cancel_price: cancel_price, - cancel_tax_free_price: cancel_tax_free_price, - cancel_requester: cancel_requester, - cancel_message: cancel_message, - cancel_immediately: cancel_immediately + cancel_id: cancel_id, + cancel_products: cancel_products, + cancel_price: cancel_price, + cancel_tax_free_price: cancel_tax_free_price, + cancel_requester: cancel_requester, + cancel_message: cancel_message, + cancel_immediately: cancel_immediately }.compact ) end - - # 구독 단건 관리자 승인 # 관리자 승인일 경우 bill 생성 후 (선불이면) 결제를 진행해야함 # Comment by ehowlsla # @date: 2025-11-19 - def supervisor_request_order_subscription_approve(idempotency_key: nil, order_subscription_id:, approval_status:, reason: nil) + def supervisor_request_order_subscription_approve(idempotency_key: nil, order_subscription_id:, reason: nil) request( uri: "order_subscriptions/#{order_subscription_id}/approve", method: :put, @@ -75,20 +73,18 @@ def supervisor_request_order_subscription_approve(idempotency_key: nil, order_su 'Bootpay-Role' => 'supervisor' }, payload: - { - approval_status: approval_status, - reason: reason - }.compact + { + reason: reason + }.compact ) end - # 구독 단건 승인 거절 # 요청된 구독건에 대해 거절 처리 # 만약 생성된 bill 이 있다면 함께 취소 처리 # Comment by ehowlsla # @date: 2025-11-9 - def supervisor_request_order_subscription_reject(idempotency_key: nil, order_subscription_id:, approval_status:, reason: nil) + def supervisor_request_order_subscription_reject(idempotency_key: nil, order_subscription_id:, reason: nil) request( uri: "order_subscriptions/#{order_subscription_id}/reject", method: :put, @@ -98,11 +94,73 @@ def supervisor_request_order_subscription_reject(idempotency_key: nil, order_sub }, payload: { - approval_status: approval_status, - reason: reason + reason: reason + }.compact + ) + end + + # 구독 해지 실행 + # Comment by GOSOMI + # @date: 2026-01-21 + def supervisor_request_order_subscription_terminate(idempotency_key: nil, order_subscription_id:, reason: nil, + termination_fee: nil, last_bill_refund_price: nil, final_fee: nil, + service_end_at: nil, cancel_date: nil) + request( + uri: "order_subscriptions/#{order_subscription_id}/terminate", + method: :put, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'supervisor' + }, + payload: + { + reason: reason, + termination_fee: termination_fee, + last_bill_refund_price: last_bill_refund_price, + final_fee: final_fee, + service_end_at: service_end_at, + cancel_date: cancel_date }.compact ) end + # 구독 멈춤 + # Comment by GOSOMI + # @date: 2026-01-22 + def supervisor_request_order_subscription_pause(idempotency_key: nil, order_subscription_id:, reason: nil, + paused_at:, expected_resume_at: nil) + request( + uri: "order_subscriptions/#{order_subscription_id}/pause", + method: :put, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'supervisor' + }, + payload: + { + reason: reason, + paused_at: paused_at, + expected_resume_at: expected_resume_at + }.compact + ) + end + + # 구독 재개 + # Comment by GOSOMI + # @date: 2026-01-22 + def supervisor_request_order_subscription_resume(idempotency_key: nil, order_subscription_id:, reason: nil) + request( + uri: "order_subscriptions/#{order_subscription_id}/resume", + method: :put, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'supervisor' + }, + payload: + { + reason: reason + }.compact + ) + end end end \ No newline at end of file diff --git a/spec/bootpay_store/order_subscription/order_subscription_approve_spec.rb b/spec/bootpay_store/order_subscription/order_subscription_approve_spec.rb new file mode 100644 index 0000000..cff9411 --- /dev/null +++ b/spec/bootpay_store/order_subscription/order_subscription_approve_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +RSpec.describe BootpayStore::RestClient do + it "order_subscriptions" do + api = BootpayStore::RestClient.new( + client_key: 'QIzXk4M3EeD-6B1GTfmGHA', + secret_key: 'vRle44QfyBj7nzJlBbeebqkbtlJVRTS2DQa9Adpz3d8=', + mode: 'development' + ) + + # api = BootpayStore::RestClient.new( + # client_key: 'PFPsUXTj9A7ySxJSQ0w01g', + # secret_key: '4QoNzXcjT_H4brpq0AgM8ETtrBTFhabo3gmU_DJ148E=', + # mode: 'stage' + # ) + token = api.request_access_token + if token.success? + response = api.supervisor_request_order_subscription_approve( + order_subscription_id: '69718e5c5854363bb96c9ad3' + ) + puts response.data.to_json + else + puts token.data + end + end +end diff --git a/spec/bootpay_store/order_subscription/order_subscription_pause_spec.rb b/spec/bootpay_store/order_subscription/order_subscription_pause_spec.rb new file mode 100644 index 0000000..168d1fd --- /dev/null +++ b/spec/bootpay_store/order_subscription/order_subscription_pause_spec.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +RSpec.describe BootpayStore::RestClient do + it "order_subscriptions" do + api = BootpayStore::RestClient.new( + client_key: 'QIzXk4M3EeD-6B1GTfmGHA', + secret_key: 'vRle44QfyBj7nzJlBbeebqkbtlJVRTS2DQa9Adpz3d8=', + mode: 'development' + ) + + # api = BootpayStore::RestClient.new( + # client_key: 'PFPsUXTj9A7ySxJSQ0w01g', + # secret_key: '4QoNzXcjT_H4brpq0AgM8ETtrBTFhabo3gmU_DJ148E=', + # mode: 'stage' + # ) + token = api.request_access_token + if token.success? + response = api.supervisor_request_order_subscription_pause( + order_subscription_id: '6973336e4346c992dc19ed61', + paused_at: Time.current.strftime('%Y-%m-%d %H:%M:%S'), + expected_resume_at: (Time.current + 20.seconds).strftime('%Y-%m-%d %H:%M:%S') + ) + puts response.data.to_json + else + puts token.data + end + end +end diff --git a/spec/bootpay_store/order_subscription/order_subscription_reject_spec.rb b/spec/bootpay_store/order_subscription/order_subscription_reject_spec.rb new file mode 100644 index 0000000..1dd1831 --- /dev/null +++ b/spec/bootpay_store/order_subscription/order_subscription_reject_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +RSpec.describe BootpayStore::RestClient do + it "order_subscriptions rejected" do + api = BootpayStore::RestClient.new( + client_key: 'QIzXk4M3EeD-6B1GTfmGHA', + secret_key: 'vRle44QfyBj7nzJlBbeebqkbtlJVRTS2DQa9Adpz3d8=', + mode: 'development' + ) + + # api = BootpayStore::RestClient.new( + # client_key: 'PFPsUXTj9A7ySxJSQ0w01g', + # secret_key: '4QoNzXcjT_H4brpq0AgM8ETtrBTFhabo3gmU_DJ148E=', + # mode: 'stage' + # ) + token = api.request_access_token + if token.success? + response = api.supervisor_request_order_subscription_reject( + order_subscription_id: '697050d25854363bb96c9a64' + ) + puts response.data.to_json + else + puts token.data + end + end +end diff --git a/spec/bootpay_store/order_subscription/order_subscription_resume_spec.rb b/spec/bootpay_store/order_subscription/order_subscription_resume_spec.rb new file mode 100644 index 0000000..cc7774e --- /dev/null +++ b/spec/bootpay_store/order_subscription/order_subscription_resume_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +RSpec.describe BootpayStore::RestClient do + it "order_subscriptions" do + api = BootpayStore::RestClient.new( + client_key: 'QIzXk4M3EeD-6B1GTfmGHA', + secret_key: 'vRle44QfyBj7nzJlBbeebqkbtlJVRTS2DQa9Adpz3d8=', + mode: 'development' + ) + + # api = BootpayStore::RestClient.new( + # client_key: 'PFPsUXTj9A7ySxJSQ0w01g', + # secret_key: '4QoNzXcjT_H4brpq0AgM8ETtrBTFhabo3gmU_DJ148E=', + # mode: 'stage' + # ) + token = api.request_access_token + if token.success? + response = api.supervisor_request_order_subscription_resume( + order_subscription_id: '6973336e4346c992dc19ed61' + ) + puts response.data.to_json + else + puts token.data + end + end +end diff --git a/spec/bootpay_store/order_subscription/order_subscription_terminate_spec.rb b/spec/bootpay_store/order_subscription/order_subscription_terminate_spec.rb new file mode 100644 index 0000000..676dc5b --- /dev/null +++ b/spec/bootpay_store/order_subscription/order_subscription_terminate_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +RSpec.describe BootpayStore::RestClient do + it "order_subscriptions rejected" do + api = BootpayStore::RestClient.new( + client_key: 'QIzXk4M3EeD-6B1GTfmGHA', + secret_key: 'vRle44QfyBj7nzJlBbeebqkbtlJVRTS2DQa9Adpz3d8=', + mode: 'development' + ) + + # api = BootpayStore::RestClient.new( + # client_key: 'PFPsUXTj9A7ySxJSQ0w01g', + # secret_key: '4QoNzXcjT_H4brpq0AgM8ETtrBTFhabo3gmU_DJ148E=', + # mode: 'stage' + # ) + token = api.request_access_token + if token.success? + response = api.supervisor_request_order_subscription_terminate( + order_subscription_id: '69701b495854363bb96c998a' + ) + puts response.data.to_json + else + puts token.data + end + end +end From 324bfcf09ddc96305e213c4d07b66ef952c5447d Mon Sep 17 00:00:00 2001 From: gosomi Date: Mon, 23 Feb 2026 17:37:43 +0900 Subject: [PATCH 119/133] =?UTF-8?q?basic=20authenticate=20=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20request=20access=20token=EC=9D=80=20deprecated=20?= =?UTF-8?q?=EC=B2=98=EB=A6=AC=20=EB=90=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay_store/concern/rest.rb | 9 +++++++- lib/bootpay_store/concern/token.rb | 1 + .../order_subscription_terminate_spec.rb | 22 +++++++++++-------- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/lib/bootpay_store/concern/rest.rb b/lib/bootpay_store/concern/rest.rb index 9570915..fd7c4da 100644 --- a/lib/bootpay_store/concern/rest.rb +++ b/lib/bootpay_store/concern/rest.rb @@ -10,7 +10,7 @@ module BootpayStore::Concern::Rest def request(method: :post, uri:, payload: {}, headers: {}, params: nil) response = HTTP.headers( { - Authorization: "Bearer #{@token}", + Authorization: @token.present? ? "Bearer #{@token}" : "Basic #{basic_authentification}", content_type: 'application/json', accept: 'application/json', bootpay_api_version: @api_version, @@ -34,5 +34,12 @@ def request(method: :post, uri:, payload: {}, headers: {}, params: nil) backtrace: e.backtrace.join("\n") ) end + + # basic authenticate 추가 + # Comment by GOSOMI + # @date: 2026-02-20 + def basic_authentification + @token = Base64.strict_encode64("#{@client_key}:#{@secret_key}") + end end end \ No newline at end of file diff --git a/lib/bootpay_store/concern/token.rb b/lib/bootpay_store/concern/token.rb index 37c65cf..3509e4a 100644 --- a/lib/bootpay_store/concern/token.rb +++ b/lib/bootpay_store/concern/token.rb @@ -5,6 +5,7 @@ module BootpayStore::Concern::Token # Access Token을 요청한다 # Comment by Gosomi # Date: 2021-05-21 + # @deprecated def request_access_token response = request( uri: 'request/token', diff --git a/spec/bootpay_store/order_subscription/order_subscription_terminate_spec.rb b/spec/bootpay_store/order_subscription/order_subscription_terminate_spec.rb index 676dc5b..fd1d298 100644 --- a/spec/bootpay_store/order_subscription/order_subscription_terminate_spec.rb +++ b/spec/bootpay_store/order_subscription/order_subscription_terminate_spec.rb @@ -13,14 +13,18 @@ # secret_key: '4QoNzXcjT_H4brpq0AgM8ETtrBTFhabo3gmU_DJ148E=', # mode: 'stage' # ) - token = api.request_access_token - if token.success? - response = api.supervisor_request_order_subscription_terminate( - order_subscription_id: '69701b495854363bb96c998a' - ) - puts response.data.to_json - else - puts token.data - end + # token = api.request_access_token + # if token.success? + # response = api.supervisor_request_order_subscription_terminate( + # order_subscription_id: '69701b495854363bb96c998a' + # ) + # puts response.data.to_json + # else + # puts token.data + # end + response = api.supervisor_request_order_subscription_terminate( + order_subscription_id: '69701b495854363bb96c998a' + ) + puts response.data.to_json end end From fa04950989ef36777ce133be4bdb7367a29ec1ce Mon Sep 17 00:00:00 2001 From: openclaw-bot Date: Mon, 23 Feb 2026 19:16:35 +0900 Subject: [PATCH 120/133] test: add basic-auth product info smoke test code --- tests_basic_auth_product_info.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tests_basic_auth_product_info.rb diff --git a/tests_basic_auth_product_info.rb b/tests_basic_auth_product_info.rb new file mode 100644 index 0000000..d981448 --- /dev/null +++ b/tests_basic_auth_product_info.rb @@ -0,0 +1,21 @@ +require 'base64' +require 'json' +require 'http' + +client_key = ENV['BP_CLIENT_KEY'] || 'QIzXk4M3EeD-6B1GTfmGHA' +secret_key = ENV['BP_SECRET_KEY'] || 'vRle44QfyBj7nzJlBbeebqkbtlJVRTS2DQa9Adpz3d8=' +base_url = ENV['BP_BASE_URL'] || 'https://dev-api.bootapi.com/v1' + +basic = Base64.strict_encode64("#{client_key}:#{secret_key}") +response = HTTP.headers( + 'Authorization' => "Basic #{basic}", + 'Accept' => 'application/json', + 'Content-Type' => 'application/json', + 'bootpay_api_version' => '5.0.0', + 'bootpay_sdk_version' => '5.0.0', + 'bootpay_sdk_type' => '300' +).get("#{base_url}/products?page=1&limit=1") + +body = response.to_s +puts({ status: response.code.to_i, ok: response.code.to_i == 200, preview: body[0, 500] }.to_json) +exit(1) unless response.code.to_i == 200 From 087f95e10fe8b78ce10116baa6de43851a3807e5 Mon Sep 17 00:00:00 2001 From: gosomi Date: Mon, 23 Feb 2026 19:25:12 +0900 Subject: [PATCH 121/133] =?UTF-8?q?=EC=83=88=EB=A1=9C=EC=9A=B4=20=ED=95=A8?= =?UTF-8?q?=EC=88=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay_store/concern.rb | 4 +- lib/bootpay_store/concern/product.rb | 35 +++++++++++ lib/bootpay_store/concern/store.rb | 31 ++++++++++ lib/bootpay_store/concern/user.rb | 91 +++++++++++++++++++++++++++- 4 files changed, 159 insertions(+), 2 deletions(-) create mode 100644 lib/bootpay_store/concern/store.rb diff --git a/lib/bootpay_store/concern.rb b/lib/bootpay_store/concern.rb index f6608bd..caa24ce 100644 --- a/lib/bootpay_store/concern.rb +++ b/lib/bootpay_store/concern.rb @@ -10,6 +10,7 @@ module Concern require_relative 'concern/token' require_relative 'concern/user' require_relative 'concern/user_group' + require_relative 'concern/store' include Invoice include Order @@ -21,5 +22,6 @@ module Concern include Token include User include UserGroup + include Store end -end \ No newline at end of file +end diff --git a/lib/bootpay_store/concern/product.rb b/lib/bootpay_store/concern/product.rb index 506f64b..9da6d39 100644 --- a/lib/bootpay_store/concern/product.rb +++ b/lib/bootpay_store/concern/product.rb @@ -2,6 +2,41 @@ module BootpayStore::Concern::Product extend ActiveSupport::Concern included do + # 상품 목록을 조회한다 (V1 Mall API) + # Comment by Codex + # @date: 2026-02-23 + def products(page: 1, limit: 20, category_id: nil, sort: nil, keyword: nil, user_jwt: nil, idempotency_key: nil) + request( + uri: 'products', + method: :get, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-User-JWT' => user_jwt + }.compact, + params: { + page: page, + limit: limit, + category_id: category_id, + sort: sort, + keyword: keyword + }.compact + ) + end + + # 상품 상세를 조회한다 (V1 Mall API) + # Comment by Codex + # @date: 2026-02-23 + def product_detail(product_id:, user_jwt: nil, idempotency_key: nil) + request( + uri: "products/#{product_id}", + method: :get, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-User-JWT' => user_jwt + }.compact + ) + end + # 상품 정보를 가져온다 # Comment by GOSOMI # @date: 2025-10-10 diff --git a/lib/bootpay_store/concern/store.rb b/lib/bootpay_store/concern/store.rb new file mode 100644 index 0000000..6c05f97 --- /dev/null +++ b/lib/bootpay_store/concern/store.rb @@ -0,0 +1,31 @@ +module BootpayStore::Concern::Store + extend ActiveSupport::Concern + + included do + # 가맹점 기본 정보를 조회한다 (/v1/store) + # Comment by Codex + # @date: 2026-02-23 + def store(idempotency_key: nil) + request( + uri: 'store', + method: :get, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid + } + ) + end + + # 가맹점 상세 정보를 조회한다 (/v1/store/detail) + # Comment by Codex + # @date: 2026-02-23 + def store_detail(idempotency_key: nil) + request( + uri: 'store/detail', + method: :get, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid + } + ) + end + end +end diff --git a/lib/bootpay_store/concern/user.rb b/lib/bootpay_store/concern/user.rb index 6c28113..9e896a1 100644 --- a/lib/bootpay_store/concern/user.rb +++ b/lib/bootpay_store/concern/user.rb @@ -2,6 +2,95 @@ module BootpayStore::Concern::User extend ActiveSupport::Concern included do + # 회원 로그인 (V1 Mall API) + # Comment by Codex + # @date: 2026-02-23 + def user_login(login_id:, password:, corporate_type: 0, idempotency_key: nil) + request( + uri: 'user/login', + method: :post, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid + }, + payload: { + login_id: login_id, + password: password, + corporate_type: corporate_type + }.compact + ) + end + + # 회원 세션 조회 (V1 Mall API) + # Comment by Codex + # @date: 2026-02-23 + def user_session(user_jwt: nil, idempotency_key: nil) + request( + uri: 'user/session', + method: :get, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-User-JWT' => user_jwt + }.compact + ) + end + + # 회원 로그아웃 (V1 Mall API) + # Comment by Codex + # @date: 2026-02-23 + def user_logout(user_jwt:, idempotency_key: nil) + request( + uri: 'user/session', + method: :delete, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-User-JWT' => user_jwt + } + ) + end + + # 회원가입 (V1 Mall API) + # Comment by Codex + # @date: 2026-02-23 + def user_join(login_id:, password:, name:, email: nil, phone: nil, nickname: nil, gender: nil, birth: nil, corporate_type: 0, + group: nil, idempotency_key: nil) + request( + uri: 'user/join', + method: :post, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid + }, + payload: { + login_id: login_id, + password: password, + name: name, + email: email, + phone: phone, + nickname: nickname, + gender: gender, + birth: birth, + corporate_type: corporate_type, + group: group + }.compact + ) + end + + # 회원가입 중복 확인 (V1 Mall API) + # type: email-exist, id-exist, phone-exist, group-business-number-exist + # Comment by Codex + # @date: 2026-02-23 + def user_join_check(type:, pk:, idempotency_key: nil) + request( + uri: "user/join/#{type}", + method: :get, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid + }, + params: { + pk: pk + } + ) + end + # UserId로 로그인을 시도한다 # Comment by GOSOMI # @date: 2025-04-25 @@ -165,4 +254,4 @@ def group_business_number_exist(business_number:, idempotency: nil) ) end end -end \ No newline at end of file +end From 6071b2771e3a29db35711a60a2522c4d534de7e9 Mon Sep 17 00:00:00 2001 From: gosomi Date: Mon, 23 Feb 2026 19:29:02 +0900 Subject: [PATCH 122/133] =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay_store/concern/user.rb | 44 +++++++++++++++---------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/lib/bootpay_store/concern/user.rb b/lib/bootpay_store/concern/user.rb index 9e896a1..038a80a 100644 --- a/lib/bootpay_store/concern/user.rb +++ b/lib/bootpay_store/concern/user.rb @@ -13,10 +13,10 @@ def user_login(login_id:, password:, corporate_type: 0, idempotency_key: nil) 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid }, payload: { - login_id: login_id, - password: password, - corporate_type: corporate_type - }.compact + login_id: login_id, + password: password, + corporate_type: corporate_type + }.compact ) end @@ -28,9 +28,9 @@ def user_session(user_jwt: nil, idempotency_key: nil) uri: 'user/session', method: :get, headers: { - 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, - 'Bootpay-User-JWT' => user_jwt - }.compact + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-User-JWT' => user_jwt + }.compact ) end @@ -42,7 +42,7 @@ def user_logout(user_jwt:, idempotency_key: nil) uri: 'user/session', method: :delete, headers: { - 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, 'Bootpay-User-JWT' => user_jwt } ) @@ -60,17 +60,17 @@ def user_join(login_id:, password:, name:, email: nil, phone: nil, nickname: nil 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid }, payload: { - login_id: login_id, - password: password, - name: name, - email: email, - phone: phone, - nickname: nickname, - gender: gender, - birth: birth, - corporate_type: corporate_type, - group: group - }.compact + login_id: login_id, + password: password, + name: name, + email: email, + phone: phone, + nickname: nickname, + gender: gender, + birth: birth, + corporate_type: corporate_type, + group: group + }.compact ) end @@ -80,12 +80,12 @@ def user_join(login_id:, password:, name:, email: nil, phone: nil, nickname: nil # @date: 2026-02-23 def user_join_check(type:, pk:, idempotency_key: nil) request( - uri: "user/join/#{type}", - method: :get, + uri: "user/join/#{type}", + method: :get, headers: { 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid }, - params: { + params: { pk: pk } ) From cb1892648250b61cdb3e2f5ee8c380b804e69894 Mon Sep 17 00:00:00 2001 From: gosomi Date: Mon, 23 Feb 2026 19:49:45 +0900 Subject: [PATCH 123/133] =?UTF-8?q?=ED=95=A8=EC=88=98=EB=AA=85=EC=9D=84=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay_store/concern/store.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/bootpay_store/concern/store.rb b/lib/bootpay_store/concern/store.rb index 6c05f97..f08ccbf 100644 --- a/lib/bootpay_store/concern/store.rb +++ b/lib/bootpay_store/concern/store.rb @@ -5,7 +5,7 @@ module BootpayStore::Concern::Store # 가맹점 기본 정보를 조회한다 (/v1/store) # Comment by Codex # @date: 2026-02-23 - def store(idempotency_key: nil) + def get_store(idempotency_key: nil) request( uri: 'store', method: :get, @@ -18,7 +18,7 @@ def store(idempotency_key: nil) # 가맹점 상세 정보를 조회한다 (/v1/store/detail) # Comment by Codex # @date: 2026-02-23 - def store_detail(idempotency_key: nil) + def get_store_detail(idempotency_key: nil) request( uri: 'store/detail', method: :get, From 3a61c3f03874908ecdbee8d9c548181264cafdc1 Mon Sep 17 00:00:00 2001 From: alfredhot Date: Thu, 5 Mar 2026 11:23:29 +0900 Subject: [PATCH 124/133] =?UTF-8?q?=EC=9B=B9=ED=9B=85=20=ED=85=8C=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay_store/concern.rb | 2 ++ lib/bootpay_store/concern/webhook.rb | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 lib/bootpay_store/concern/webhook.rb diff --git a/lib/bootpay_store/concern.rb b/lib/bootpay_store/concern.rb index caa24ce..76e9cf9 100644 --- a/lib/bootpay_store/concern.rb +++ b/lib/bootpay_store/concern.rb @@ -11,6 +11,7 @@ module Concern require_relative 'concern/user' require_relative 'concern/user_group' require_relative 'concern/store' + require_relative 'concern/webhook' include Invoice include Order @@ -23,5 +24,6 @@ module Concern include User include UserGroup include Store + include Webhook end end diff --git a/lib/bootpay_store/concern/webhook.rb b/lib/bootpay_store/concern/webhook.rb new file mode 100644 index 0000000..5f10686 --- /dev/null +++ b/lib/bootpay_store/concern/webhook.rb @@ -0,0 +1,17 @@ +module BootpayStore::Concern::Webhook + extend ActiveSupport::Concern + + included do + # 테스트 웹훅을 발송한다 (POST /v1/test-webhooks) + # @comment_by Claude (alfred) + # @date: 26-03-05 + def send_test_webhook(header_content_type: nil) + request( + uri: 'webhook/test', + payload: { + header_content_type: header_content_type + }.compact + ) + end + end +end From 70b74d3cc6b3b6b5cd58cceb5a7ccadedbc37309 Mon Sep 17 00:00:00 2001 From: gosomi Date: Fri, 3 Jul 2026 11:36:37 +0900 Subject: [PATCH 125/133] =?UTF-8?q?=EC=9A=B0=EC=84=A0=EC=88=9C=EC=9C=84=20?= =?UTF-8?q?=EB=B9=8C=EB=A7=81=ED=82=A4=20=EC=A1=B0=ED=9A=8C=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay/concern/subscription.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/bootpay/concern/subscription.rb b/lib/bootpay/concern/subscription.rb index 522f80f..54493fa 100644 --- a/lib/bootpay/concern/subscription.rb +++ b/lib/bootpay/concern/subscription.rb @@ -197,5 +197,15 @@ def lookup_billing_key(billing_key) uri: "billing_key/#{billing_key}" ) end + + # 우선순위 빌링키 조회기능 추가 + # Comment by GOSOMI + # @date: 2026-07-03 + def lookup_sequential_billing_key(widget_key:, billing_key:) + request( + method: :get, + uri: "subscribe/sequential_billing_key/#{billing_key}?widget_key=#{widget_key}" + ) + end end end \ No newline at end of file From acb40ca766de4c428d6b8f6219e4564b2b6ff07c Mon Sep 17 00:00:00 2001 From: gosomi Date: Fri, 3 Jul 2026 13:14:00 +0900 Subject: [PATCH 126/133] =?UTF-8?q?user=5Fid=EB=A5=BC=20=EC=B6=94=EA=B0=80?= =?UTF-8?q?=EB=A1=9C=20=EB=B3=B4=EB=82=B4=EC=84=9C=20=EC=A1=B0=ED=9A=8C?= =?UTF-8?q?=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay/concern/subscription.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/bootpay/concern/subscription.rb b/lib/bootpay/concern/subscription.rb index 54493fa..f16dc2d 100644 --- a/lib/bootpay/concern/subscription.rb +++ b/lib/bootpay/concern/subscription.rb @@ -201,10 +201,10 @@ def lookup_billing_key(billing_key) # 우선순위 빌링키 조회기능 추가 # Comment by GOSOMI # @date: 2026-07-03 - def lookup_sequential_billing_key(widget_key:, billing_key:) + def lookup_sequential_billing_key(widget_key:, billing_key:, user_id:) request( method: :get, - uri: "subscribe/sequential_billing_key/#{billing_key}?widget_key=#{widget_key}" + uri: "subscribe/sequential_billing_key/#{billing_key}?widget_key=#{widget_key}&user_id=#{user_id}" ) end end From fa93a9d19b251c83b9c1142d93d3ef989fb9da38 Mon Sep 17 00:00:00 2001 From: gosomi Date: Fri, 3 Jul 2026 14:39:22 +0900 Subject: [PATCH 127/133] =?UTF-8?q?addressable=20=EC=9D=98=EC=A1=B4?= =?UTF-8?q?=EC=84=B1=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bootpay-backend-ruby.gemspec | 1 + 1 file changed, 1 insertion(+) diff --git a/bootpay-backend-ruby.gemspec b/bootpay-backend-ruby.gemspec index abf2d08..74f8e7f 100644 --- a/bootpay-backend-ruby.gemspec +++ b/bootpay-backend-ruby.gemspec @@ -23,6 +23,7 @@ Gem::Specification.new do |spec| # Uncomment to register a new dependency of your gem spec.add_dependency "activesupport" spec.add_dependency "http" + spec.add_dependency "addressable" # For more information and examples about making a new gem, checkout our # guide at: https://bundler.io/guides/creating_gem.html From 2933a30d7ca8858aa2a8cbeaf0782a1d143918a7 Mon Sep 17 00:00:00 2001 From: gosomi Date: Thu, 23 Jul 2026 20:28:15 +0900 Subject: [PATCH 128/133] =?UTF-8?q?charge=20key=20=EA=B2=B0=EC=A0=9C=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay_store/concern/supervisor.rb | 43 +++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/lib/bootpay_store/concern/supervisor.rb b/lib/bootpay_store/concern/supervisor.rb index cd0f1c2..3362f30 100644 --- a/lib/bootpay_store/concern/supervisor.rb +++ b/lib/bootpay_store/concern/supervisor.rb @@ -164,5 +164,48 @@ def supervisor_request_order_subscription_resume(idempotency_key: nil, order_sub }.compact ) end + + # 수시결제(온디맨드) charge_key 즉시 결제 + # charge_key는 body로만 전송한다 (URL/query 금지 — 액세스 로그 노출 방지) + # Comment by GOSOMI + # @date: 2026-07-23 + def supervisor_request_order_subscription_charge(idempotency_key: nil, charge_key:, price:, + tax_free_price: nil, user: nil, metadata: nil) + request( + uri: 'order_subscriptions/charge', + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'supervisor' + }, + payload: + { + charge_key: charge_key, + price: price, + tax_free_price: tax_free_price, + user: user, + metadata: metadata + }.compact + ) + end + + # 수시결제(온디맨드) charge_key 해지 + # 해지 이후 해당 키로의 재결제는 불가능하다 + # Comment by GOSOMI + # @date: 2026-07-23 + def supervisor_request_order_subscription_charge_revoke(idempotency_key: nil, charge_key:, user: nil) + request( + uri: 'order_subscriptions/charge', + method: :delete, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'supervisor' + }, + payload: + { + charge_key: charge_key, + user: user + }.compact + ) + end end end \ No newline at end of file From 65585a15baf546822ed4a405f1a2b8322c180d44 Mon Sep 17 00:00:00 2001 From: gosomi Date: Fri, 24 Jul 2026 00:54:35 +0900 Subject: [PATCH 129/133] =?UTF-8?q?=EB=B2=84=EA=B7=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay_store/concern/rest.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bootpay_store/concern/rest.rb b/lib/bootpay_store/concern/rest.rb index fd7c4da..a517691 100644 --- a/lib/bootpay_store/concern/rest.rb +++ b/lib/bootpay_store/concern/rest.rb @@ -39,7 +39,7 @@ def request(method: :post, uri:, payload: {}, headers: {}, params: nil) # Comment by GOSOMI # @date: 2026-02-20 def basic_authentification - @token = Base64.strict_encode64("#{@client_key}:#{@secret_key}") + Base64.strict_encode64("#{@client_key}:#{@secret_key}") end end end \ No newline at end of file From 16d00e2ec59a02f6197b44f51269fd7ed69804d8 Mon Sep 17 00:00:00 2001 From: alfredhot Date: Thu, 30 Jul 2026 09:23:34 +0900 Subject: [PATCH 130/133] =?UTF-8?q?storage=20=EC=9D=B4=EB=AF=B8=EC=A7=80?= =?UTF-8?q?=20=EC=82=AD=EC=A0=9C=20API=20=EC=B6=94=EA=B0=80=20(image=5Fdes?= =?UTF-8?q?troy)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay_storage/concern/image.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/bootpay_storage/concern/image.rb b/lib/bootpay_storage/concern/image.rb index 6b495e8..c6b8dba 100644 --- a/lib/bootpay_storage/concern/image.rb +++ b/lib/bootpay_storage/concern/image.rb @@ -14,5 +14,17 @@ def image_upload(images:) ) end + # 업로드한 이미지를 URL 로 삭제한다. + # 업로드 응답이 URL 만 돌려주므로(내부 식별자 미노출) 삭제도 URL 을 키로 받는다. + # Comment by Claude (alfred) + # @date: 2026-07-28 + def image_destroy(url:) + request( + method: :delete, + uri: 'images/by_url', + payload: { url: url } + ) + end + end end \ No newline at end of file From 9ca04b6a1baaf61e66bd588721a23b6cdc8ca744 Mon Sep 17 00:00:00 2001 From: Bootpay SDK Bot Date: Fri, 14 Aug 2026 05:29:45 +0000 Subject: [PATCH 131/133] =?UTF-8?q?sync:=20817dbe80=20=EB=B2=84=EA=B7=B8?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Source: git.bootpay.co.kr/bootpay-sdk/backend-ruby@817dbe804b30af68817b912c2fde28b787040ff2 --- lib/bootpay/bootpay-rest-client.rb | 9 +- lib/bootpay/concern/payment.rb | 2 +- lib/bootpay/concern/rest.rb | 20 +- lib/bootpay/concern/token.rb | 13 + lib/bootpay_store/concern.rb | 2 + lib/bootpay_store/concern/mall_setting.rb | 385 ++++++++++++++++++ .../mall_setting/get_mall_setting_spec.rb | 13 + .../mall_setting/update_mall_setting_spec.rb | 28 ++ spec/bootpay_store/order/order_detail_spec.rb | 2 +- 9 files changed, 469 insertions(+), 5 deletions(-) create mode 100644 lib/bootpay_store/concern/mall_setting.rb create mode 100644 spec/bootpay_store/mall_setting/get_mall_setting_spec.rb create mode 100644 spec/bootpay_store/mall_setting/update_mall_setting_spec.rb diff --git a/lib/bootpay/bootpay-rest-client.rb b/lib/bootpay/bootpay-rest-client.rb index e5ce8eb..52b5df5 100644 --- a/lib/bootpay/bootpay-rest-client.rb +++ b/lib/bootpay/bootpay-rest-client.rb @@ -10,6 +10,8 @@ module Bootpay class RestClient include Concern + attr_accessor :application_id, :private_key, :client_key, :secret_key, :use_client_key, :mode, :token, :api_version + API = { development: 'https://dev-api.bootpay.co.kr/v2', @@ -17,11 +19,14 @@ class RestClient production: 'https://api.bootpay.co.kr/v2' } - SDK_VERSION = '5.2.0' + SDK_VERSION = '5.3.0' - def initialize(application_id:, private_key:, mode: 'production') + def initialize(application_id: nil, private_key: nil, client_key: nil, secret_key: nil, mode: 'production') @application_id = application_id @private_key = private_key + @client_key = client_key + @secret_key = secret_key + @use_client_key = client_key.present? @mode = mode.presence || 'production' @token = nil @api_version = SDK_VERSION diff --git a/lib/bootpay/concern/payment.rb b/lib/bootpay/concern/payment.rb index a864fe3..638df21 100644 --- a/lib/bootpay/concern/payment.rb +++ b/lib/bootpay/concern/payment.rb @@ -59,7 +59,7 @@ def cancel_payment(cancel_id: nil, receipt_id:, cancel_price: nil, cancel_tax_fr # REST API로 결제 요청하기 # Comment by Gosomi # Date: 2023-03-28 - def request_payment(platform_application_id:, pg:, method: nil, price:, tax_free: 0, order_name:, order_id:, user_token: nil, uuid: nil, sk: nil, + 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, ti: 0, tk: nil, items: [], extra: {}, user: {}, agent: nil, commission_keys: nil, wallet_id: nil, terms: [], widget_key: nil, widget_sandbox: false, redirect_url: nil) rand_uuid = SecureRandom.uuid diff --git a/lib/bootpay/concern/rest.rb b/lib/bootpay/concern/rest.rb index 406bc16..e305fa7 100644 --- a/lib/bootpay/concern/rest.rb +++ b/lib/bootpay/concern/rest.rb @@ -10,7 +10,7 @@ module Bootpay::Concern::Rest def request(method: :post, uri:, payload: {}, headers: {}, params: nil) response = HTTP.headers( { - Authorization: ("Bearer #{@token}" if @token.present?), + Authorization: authotization_header, content_type: 'application/json', accept: 'application/json', bootpay_api_version: @api_version, @@ -34,5 +34,23 @@ def request(method: :post, uri:, payload: {}, headers: {}, params: nil) backtrace: e.backtrace.join("\n") ) end + + # Authorize Header + # Comment by GOSOMI + # @date: 2026-03-11 + def authotization_header + if @use_client_key + "Basic #{basic_authentification}" + else + "Bearer #{@token}" if @token.present? + end + end + + # basic_authentification + # Comment by GOSOMI + # @date: 2026-03-11 + def basic_authentification + @token = Base64.strict_encode64("#{@client_key}:#{@secret_key}") + end end end \ No newline at end of file diff --git a/lib/bootpay/concern/token.rb b/lib/bootpay/concern/token.rb index 4b8d8c5..573c191 100644 --- a/lib/bootpay/concern/token.rb +++ b/lib/bootpay/concern/token.rb @@ -16,5 +16,18 @@ def request_access_token @token = response.data[:access_token] if response.success? response end + + # 둘다 겸하는 경우 우회함수 + # Comment by GOSOMI + # @date: 2026-03-11 + def basic_or_request_access_token + if @use_client_key + Object.new.tap do |o| + o.define_singleton_method(:success?) { true } + end + else + request_access_token + end + end end end \ No newline at end of file diff --git a/lib/bootpay_store/concern.rb b/lib/bootpay_store/concern.rb index 76e9cf9..77f2240 100644 --- a/lib/bootpay_store/concern.rb +++ b/lib/bootpay_store/concern.rb @@ -1,6 +1,7 @@ module BootpayStore module Concern require_relative 'concern/invoice' + require_relative 'concern/mall_setting' require_relative 'concern/order' require_relative 'concern/order_subscription' require_relative 'concern/payment' @@ -14,6 +15,7 @@ module Concern require_relative 'concern/webhook' include Invoice + include MallSetting include Order include OrderSubscription include Payment diff --git a/lib/bootpay_store/concern/mall_setting.rb b/lib/bootpay_store/concern/mall_setting.rb new file mode 100644 index 0000000..461cf5d --- /dev/null +++ b/lib/bootpay_store/concern/mall_setting.rb @@ -0,0 +1,385 @@ +module BootpayStore::Concern::MallSetting + extend ActiveSupport::Concern + + included do + # 몰 설정 조회 (GET /v1/mall-setting) + # supervisor scope 토큰 전용 + # Comment by Claude + # @date: 2026-05-04 + def get_mall_setting(idempotency_key: nil) + request( + uri: 'mall-setting', + method: :get, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'supervisor' + } + ) + end + + # 몰 설정 수정 (PUT /v1/mall-setting) + # supervisor scope 토큰 전용 + # 요청 바디는 flatten 형식이며 전달된 값(non-nil)만 서버로 전송된다. + # Comment by Claude + # @date: 2026-05-04 + # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Metrics/ParameterLists + def update_mall_setting(idempotency_key: nil, + normal_widget_key: nil, + subscription_widget_key: nil, + seller_name: nil, + seller_name_en: nil, + biz_email: nil, + biz_tel: nil, + biz_fax: nil, + registration_no: nil, + corp_reg_no: nil, + mail_order_sales_number: nil, + owner_name: nil, + zip: nil, + addr_1: nil, + addr_2: nil, + privacy_name: nil, + privacy_email: nil, + name: nil, + description: nil, + status: nil, + invoice_title: nil, + use_logo: nil, + logo: nil, + use_favicon: nil, + favicon: nil, + use_open_graph: nil, + og_image: nil, + use_signature: nil, + signature: nil, + use_operation_time: nil, + customer_service_center_operation_time: nil, + rest_start_hour: nil, + rest_start_minute: nil, + rest_end_hour: nil, + rest_end_minute: nil, + rest_day: nil, + hosting_service: nil, + use_non_member_order: nil, + use_age_accept_19: nil, + use_age_accept_14: nil, + use_age_accept_parent_name: nil, + use_age_accept_parent_birth: nil, + use_age_accept_parent_email: nil, + use_membership_collect_phone: nil, + use_membership_collect_tel: nil, + use_membership_collect_email: nil, + use_membership_collect_address: nil, + use_membership_collect_bank: nil, + use_membership_collect_birth: nil, + use_membership_collect_gender: nil, + use_membership_collect_interest: nil, + membership_collect_interest_number: nil, + use_membership_collect_customs: nil, + use_membership_collect_nickname: nil, + use_membership_collect_recommend_id: nil, + recommend_id_point_to: nil, + recommend_id_point_from: nil, + use_membership_collect_business: nil, + use_membership_collect_register: nil, + membership_only_business: nil, + use_corporate_department: nil, + sub_group_type: nil, + use_corporate_signup_approval: nil, + corporate_email_domains: nil, + use_corporate_auto_approve: nil, + use_corporate_invite_only: nil, + use_member_info_phone: nil, + use_member_info_tel: nil, + use_member_info_email: nil, + use_member_info_address: nil, + use_member_info_bank: nil, + use_member_info_birth: nil, + use_member_info_gender: nil, + use_member_info_customs: nil, + use_member_info_nickname: nil, + use_member_info_register: nil, + orderer_collect_phone: nil, + orderer_collect_tel: nil, + orderer_collect_email: nil, + order_prefix: nil, + use_order_cancel: nil, + use_oder_cancel_approval: nil, + order_cancel_reasons: nil, + order_cancel_reason_required_type: nil, + order_cancel_request_message: nil, + order_cancel_done_message: nil, + use_general_membership: nil, + general_membership_duplication: nil, + use_certification: nil, + certification_type: nil, + general_membership_id_type: nil, + use_membership_duplication_email: nil, + use_membership_duplication_phone: nil, + use_social_membership: nil, + social_membership_type: nil, + use_point: nil, + use_point_transaction: nil, + point_display_name: nil, + point_min_balance: nil, + point_not_condition: nil, + point_condition: nil, + use_point_max_rate: nil, + point_max_rate: nil, + use_point_max_amount: nil, + point_max_amount: nil, + point_rate: nil, + point_calc_type1: nil, + point_calc_type2: nil, + use_point_advance_discount: nil, + point_advance_discount_rate: nil, + use_point_expire: nil, + point_expire_type: nil, + point_issue_event_type: nil, + point_issue_delay_days: nil, + use_open_market: nil, + use_product_approval: nil, + use_product_review: nil, + use_product_review_point: nil, + product_review_point: nil, + product_review_photo_point: nil, + use_product_review_answer: nil, + use_product_review_auto_answer: nil, + product_review_auto_answer_minute: nil, + product_review_auto_answer_text: nil, + use_product_qna: nil, + product_qna_member_auth: nil, + use_product_qna_answer_option: nil, + use_notice: nil, + use_qna: nil, + use_faq: nil, + use_chat_support: nil, + chat_support_type: nil, + chat_support_key: nil, + use_dormant: nil, + dormant_year: nil, + dormant_restore: nil, + use_withdrawal: nil, + use_withdrawal_guide_message: nil, + use_withdrawal_guide_message_after: nil, + withdrawal_guide_message_after: nil, + use_withdrawal_auto: nil, + withdrawal_auto_year: nil, + use_subscription_aggregate_transaction: nil, + subscription_month_day: nil, + subscription_week_day: nil, + use_limit: nil, + limit_month_purchase: nil, + limit_week_purchase: nil, + use_limit_payment: nil, + use_limit_message: nil, + terms_of_service: nil, + terms_of_privacy_policy: nil, + terms_of_privacy_collect: nil, + terms_of_privacy_third: nil, + payment_timeout: nil, + product_sort_type: nil, + mall_theme_type: nil, + catalog_display_type: nil, + catalog_headline: nil, + catalog_bg_color: nil, + catalog_view_type_pc: nil, + catalog_view_type_mobile: nil, + catalog_product_sort_type: nil, + use_cart: nil, + cart_storage_period: nil, + cart_max_limit: nil, + cart_add_action: nil, + cart_direct_purchase: nil, + cart_option_change: nil, + cart_discount_display: nil, + use_wishlist: nil, + wishlist_max_limit: nil, + cart_wishlist_display: nil) + request( + uri: 'mall-setting', + method: :put, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'supervisor' + }, + payload: + { + normal_widget_key: normal_widget_key, + subscription_widget_key: subscription_widget_key, + seller_name: seller_name, + seller_name_en: seller_name_en, + biz_email: biz_email, + biz_tel: biz_tel, + biz_fax: biz_fax, + registration_no: registration_no, + corp_reg_no: corp_reg_no, + mail_order_sales_number: mail_order_sales_number, + owner_name: owner_name, + zip: zip, + addr_1: addr_1, + addr_2: addr_2, + privacy_name: privacy_name, + privacy_email: privacy_email, + name: name, + description: description, + status: status, + invoice_title: invoice_title, + use_logo: use_logo, + logo: logo, + use_favicon: use_favicon, + favicon: favicon, + use_open_graph: use_open_graph, + og_image: og_image, + use_signature: use_signature, + signature: signature, + use_operation_time: use_operation_time, + customer_service_center_operation_time: customer_service_center_operation_time, + rest_start_hour: rest_start_hour, + rest_start_minute: rest_start_minute, + rest_end_hour: rest_end_hour, + rest_end_minute: rest_end_minute, + rest_day: rest_day, + hosting_service: hosting_service, + use_non_member_order: use_non_member_order, + use_age_accept_19: use_age_accept_19, + use_age_accept_14: use_age_accept_14, + use_age_accept_parent_name: use_age_accept_parent_name, + use_age_accept_parent_birth: use_age_accept_parent_birth, + use_age_accept_parent_email: use_age_accept_parent_email, + use_membership_collect_phone: use_membership_collect_phone, + use_membership_collect_tel: use_membership_collect_tel, + use_membership_collect_email: use_membership_collect_email, + use_membership_collect_address: use_membership_collect_address, + use_membership_collect_bank: use_membership_collect_bank, + use_membership_collect_birth: use_membership_collect_birth, + use_membership_collect_gender: use_membership_collect_gender, + use_membership_collect_interest: use_membership_collect_interest, + membership_collect_interest_number: membership_collect_interest_number, + use_membership_collect_customs: use_membership_collect_customs, + use_membership_collect_nickname: use_membership_collect_nickname, + use_membership_collect_recommend_id: use_membership_collect_recommend_id, + recommend_id_point_to: recommend_id_point_to, + recommend_id_point_from: recommend_id_point_from, + use_membership_collect_business: use_membership_collect_business, + use_membership_collect_register: use_membership_collect_register, + membership_only_business: membership_only_business, + use_corporate_department: use_corporate_department, + sub_group_type: sub_group_type, + use_corporate_signup_approval: use_corporate_signup_approval, + corporate_email_domains: corporate_email_domains, + use_corporate_auto_approve: use_corporate_auto_approve, + use_corporate_invite_only: use_corporate_invite_only, + use_member_info_phone: use_member_info_phone, + use_member_info_tel: use_member_info_tel, + use_member_info_email: use_member_info_email, + use_member_info_address: use_member_info_address, + use_member_info_bank: use_member_info_bank, + use_member_info_birth: use_member_info_birth, + use_member_info_gender: use_member_info_gender, + use_member_info_customs: use_member_info_customs, + use_member_info_nickname: use_member_info_nickname, + use_member_info_register: use_member_info_register, + orderer_collect_phone: orderer_collect_phone, + orderer_collect_tel: orderer_collect_tel, + orderer_collect_email: orderer_collect_email, + order_prefix: order_prefix, + use_order_cancel: use_order_cancel, + use_oder_cancel_approval: use_oder_cancel_approval, + order_cancel_reasons: order_cancel_reasons, + order_cancel_reason_required_type: order_cancel_reason_required_type, + order_cancel_request_message: order_cancel_request_message, + order_cancel_done_message: order_cancel_done_message, + use_general_membership: use_general_membership, + general_membership_duplication: general_membership_duplication, + use_certification: use_certification, + certification_type: certification_type, + general_membership_id_type: general_membership_id_type, + use_membership_duplication_email: use_membership_duplication_email, + use_membership_duplication_phone: use_membership_duplication_phone, + use_social_membership: use_social_membership, + social_membership_type: social_membership_type, + use_point: use_point, + use_point_transaction: use_point_transaction, + point_display_name: point_display_name, + point_min_balance: point_min_balance, + point_not_condition: point_not_condition, + point_condition: point_condition, + use_point_max_rate: use_point_max_rate, + point_max_rate: point_max_rate, + use_point_max_amount: use_point_max_amount, + point_max_amount: point_max_amount, + point_rate: point_rate, + point_calc_type1: point_calc_type1, + point_calc_type2: point_calc_type2, + use_point_advance_discount: use_point_advance_discount, + point_advance_discount_rate: point_advance_discount_rate, + use_point_expire: use_point_expire, + point_expire_type: point_expire_type, + point_issue_event_type: point_issue_event_type, + point_issue_delay_days: point_issue_delay_days, + use_open_market: use_open_market, + use_product_approval: use_product_approval, + use_product_review: use_product_review, + use_product_review_point: use_product_review_point, + product_review_point: product_review_point, + product_review_photo_point: product_review_photo_point, + use_product_review_answer: use_product_review_answer, + use_product_review_auto_answer: use_product_review_auto_answer, + product_review_auto_answer_minute: product_review_auto_answer_minute, + product_review_auto_answer_text: product_review_auto_answer_text, + use_product_qna: use_product_qna, + product_qna_member_auth: product_qna_member_auth, + use_product_qna_answer_option: use_product_qna_answer_option, + use_notice: use_notice, + use_qna: use_qna, + use_faq: use_faq, + use_chat_support: use_chat_support, + chat_support_type: chat_support_type, + chat_support_key: chat_support_key, + use_dormant: use_dormant, + dormant_year: dormant_year, + dormant_restore: dormant_restore, + use_withdrawal: use_withdrawal, + use_withdrawal_guide_message: use_withdrawal_guide_message, + use_withdrawal_guide_message_after: use_withdrawal_guide_message_after, + withdrawal_guide_message_after: withdrawal_guide_message_after, + use_withdrawal_auto: use_withdrawal_auto, + withdrawal_auto_year: withdrawal_auto_year, + use_subscription_aggregate_transaction: use_subscription_aggregate_transaction, + subscription_month_day: subscription_month_day, + subscription_week_day: subscription_week_day, + use_limit: use_limit, + limit_month_purchase: limit_month_purchase, + limit_week_purchase: limit_week_purchase, + use_limit_payment: use_limit_payment, + use_limit_message: use_limit_message, + terms_of_service: terms_of_service, + terms_of_privacy_policy: terms_of_privacy_policy, + terms_of_privacy_collect: terms_of_privacy_collect, + terms_of_privacy_third: terms_of_privacy_third, + payment_timeout: payment_timeout, + product_sort_type: product_sort_type, + mall_theme_type: mall_theme_type, + catalog_display_type: catalog_display_type, + catalog_headline: catalog_headline, + catalog_bg_color: catalog_bg_color, + catalog_view_type_pc: catalog_view_type_pc, + catalog_view_type_mobile: catalog_view_type_mobile, + catalog_product_sort_type: catalog_product_sort_type, + use_cart: use_cart, + cart_storage_period: cart_storage_period, + cart_max_limit: cart_max_limit, + cart_add_action: cart_add_action, + cart_direct_purchase: cart_direct_purchase, + cart_option_change: cart_option_change, + cart_discount_display: cart_discount_display, + use_wishlist: use_wishlist, + wishlist_max_limit: wishlist_max_limit, + cart_wishlist_display: cart_wishlist_display + }.compact + ) + end + # rubocop:enable Metrics/MethodLength, Metrics/AbcSize, Metrics/ParameterLists + end +end diff --git a/spec/bootpay_store/mall_setting/get_mall_setting_spec.rb b/spec/bootpay_store/mall_setting/get_mall_setting_spec.rb new file mode 100644 index 0000000..a5bb956 --- /dev/null +++ b/spec/bootpay_store/mall_setting/get_mall_setting_spec.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +RSpec.describe BootpayStore::RestClient do + it "get mall setting" do + api = BootpayStore::RestClient.new( + client_key: 'QIzXk4M3EeD-6B1GTfmGHA', + secret_key: 'vRle44QfyBj7nzJlBbeebqkbtlJVRTS2DQa9Adpz3d8=', + mode: 'development' + ) + response = api.get_mall_setting + puts response.data.to_json + end +end diff --git a/spec/bootpay_store/mall_setting/update_mall_setting_spec.rb b/spec/bootpay_store/mall_setting/update_mall_setting_spec.rb new file mode 100644 index 0000000..2294e2b --- /dev/null +++ b/spec/bootpay_store/mall_setting/update_mall_setting_spec.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +RSpec.describe BootpayStore::RestClient do + it "update mall setting" do + api = BootpayStore::RestClient.new( + client_key: 'QIzXk4M3EeD-6B1GTfmGHA', + secret_key: 'vRle44QfyBj7nzJlBbeebqkbtlJVRTS2DQa9Adpz3d8=', + mode: 'development' + ) + response = api.update_mall_setting( + name: '부트페이 테스트 몰', + description: '부트페이 SDK 테스트로 갱신된 몰 설명', + use_notice: true, + use_qna: true, + use_faq: true, + customer_service_center_operation_time: { + mon: { use: true, start_hour: 9, start_minute: 0, end_hour: 18, end_minute: 0 }, + tue: { use: true, start_hour: 9, start_minute: 0, end_hour: 18, end_minute: 0 }, + wed: { use: true, start_hour: 9, start_minute: 0, end_hour: 18, end_minute: 0 }, + thu: { use: true, start_hour: 9, start_minute: 0, end_hour: 18, end_minute: 0 }, + fri: { use: true, start_hour: 9, start_minute: 0, end_hour: 18, end_minute: 0 }, + sat: { use: false, start_hour: 0, start_minute: 0, end_hour: 0, end_minute: 0 }, + sun: { use: false, start_hour: 0, start_minute: 0, end_hour: 0, end_minute: 0 } + } + ) + puts response.data.to_json + end +end diff --git a/spec/bootpay_store/order/order_detail_spec.rb b/spec/bootpay_store/order/order_detail_spec.rb index db998fb..28f18bf 100644 --- a/spec/bootpay_store/order/order_detail_spec.rb +++ b/spec/bootpay_store/order/order_detail_spec.rb @@ -15,7 +15,7 @@ # ) token = api.request_access_token if token.success? - response = api.order_detail(order_number: "25102941848506519161") + response = api.order_detail(order_number: "26071438549224114186") puts response.data.to_json else puts token.data From e4939680024a29e79672eee8c9521bff1e08ba92 Mon Sep 17 00:00:00 2001 From: alfredhot Date: Tue, 18 Aug 2026 17:34:04 +0900 Subject: [PATCH 132/133] =?UTF-8?q?=20=EC=BB=A4=EB=A8=B8=EC=8A=A4=20API=20?= =?UTF-8?q?27=EC=A2=85=20=EC=B6=94=EA=B0=80=20+=20=EC=A3=BD=EC=9D=80=20?= =?UTF-8?q?=EA=B2=BD=EB=A1=9C=205=EA=B1=B4=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 매뉴얼(commerce.bootpay.ai)이 문서화했지만 SDK에 없던 호출을 채우고, 존재하지 않는 경로로 요청하던 메서드를 bin/rails routes 정본에 맞춰 고친다. 죽은 경로 5건 (기존 404) - user_login·user_session·user_logout·user_join·user_join_check 가 단수 `user/…` 로 요청했으나 commerce-api v1 에는 복수 `users/…` 만 있다. - 기능이 겹치는 user_join(↔external_user_sign_in)·user_join_check(↔*_exist)는 제거하지 않고 겹치는 이유를 각 메서드 주석에 남겼다. 신규 27종 - 상품 쓰기 4종 + multipart 전송 계층(post_multipart) 신설 content_type 을 명시하지 않아 boundary 를 보존한다 (Node SDK 가 본문을 null 로 보내던 인터셉터 함정 회피) - 청구서 조회·발송 3종 / 회원 수정·uid 중복확인·그룹 한도·정산주기 4종 - 주문취소 목록·철회 2종 / 구독 계약변경·조정항목·빌 5종 - 구독 요청 9종 (requests/ing 6 + order-subscription-requests 3) requests/ing 중 resume 만 PUT 이다 (routes 확인 후 주석 명시) 승인/반려는 별도 액션이 아니라 update(approval:) 하나로 처리된다 인자 보정 - orders·order_subscriptions 에 limit 추가 (서버는 이미 받고 있었다) - products 의 keyword 는 서버 미지원임을 주석으로 명시, 인자는 하위호환 유지 - approve_order_cancel 인자명을 order_cancellation_request_id 로 통일 (구 이름 order_cancellation_request_history_id 도 계속 허용) --- lib/bootpay_store/concern/invoice.rb | 58 ++++ lib/bootpay_store/concern/order.rb | 8 +- .../concern/order_subscription.rb | 326 +++++++++++++++++- lib/bootpay_store/concern/payment.rb | 46 ++- lib/bootpay_store/concern/product.rb | 115 ++++++ lib/bootpay_store/concern/rest.rb | 48 +++ lib/bootpay_store/concern/user.rb | 80 ++++- lib/bootpay_store/concern/user_group.rb | 47 +++ 8 files changed, 715 insertions(+), 13 deletions(-) diff --git a/lib/bootpay_store/concern/invoice.rb b/lib/bootpay_store/concern/invoice.rb index df06654..44c221d 100644 --- a/lib/bootpay_store/concern/invoice.rb +++ b/lib/bootpay_store/concern/invoice.rb @@ -40,5 +40,63 @@ def request_checkout(sdk: false, idempotency_key: nil, name:, memo: nil, user: { end alias :create_invoice :request_checkout + + # 청구서 목록을 조회한다 (GET /v1/invoices) + # @comment_by Claude (alfred) + # @date: 26-08-14 + # 응답은 { list: [...], count: N } 구조다 ({ items, total } 아님 — Node SDK 타입선언이 틀렸던 지점). + # 서버 기본 limit 은 24. + def invoice_list(page: 1, limit: 24, keyword: nil, cs_type: nil, user_id: nil, + product_type: nil, css_at: nil, cse_at: nil, idempotency_key: nil) + request( + uri: 'invoices', + method: :get, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'user' + }, + params: { + page: page, + limit: limit, + keyword: keyword, + cs_type: cs_type, + user_id: user_id, + product_type: product_type, + css_at: css_at, + cse_at: cse_at + }.compact + ) + end + + # 청구서 상세를 조회한다 (GET /v1/invoices/:id) + # @comment_by Claude (alfred) + # @date: 26-08-14 + def invoice_detail(invoice_id:, idempotency_key: nil) + request( + uri: "invoices/#{invoice_id}", + method: :get, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'user' + } + ) + end + + # 청구서를 재안내한다 (POST /v1/invoices/:id/notify) + # @comment_by Claude (alfred) + # @date: 26-08-14 + # send_types 미전달 시 서버가 빈 배열로 처리한다. + # ⚠️ 실제 고객에게 알림이 발송되므로 테스트 호출 주의. + def invoice_notify(invoice_id:, send_types: nil, idempotency_key: nil) + request( + uri: "invoices/#{invoice_id}/notify", + method: :post, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'user' + }, + payload: { send_types: send_types }.compact + ) + end end end \ No newline at end of file diff --git a/lib/bootpay_store/concern/order.rb b/lib/bootpay_store/concern/order.rb index 95625a9..896a394 100644 --- a/lib/bootpay_store/concern/order.rb +++ b/lib/bootpay_store/concern/order.rb @@ -5,7 +5,12 @@ module BootpayStore::Concern::Order # 주문 목록을 조회한다 # Comment by GOSOMI # @date: 2025-06-19 - def orders(status: [], payment_status: [], keyword: nil, page: 1, cs_type: nil, search_date_from: nil, search_date_to: nil, + # @date: 26-08-14 limit 인자 추가. + # 서버가 limit 을 20 으로 하드코딩하고 있었는데 params[:limit] 수용(기본 20 · 최대 50)으로 바뀌었다. + # 50 초과를 보내도 서버가 50 으로 클램프한다. + # ⚠️ 날짜 키는 search_date_from/to. 서버는 css_at/cse_at 도 별칭으로 받지만 SDK 는 정식 키만 쓴다. + def orders(status: [], payment_status: [], keyword: nil, page: 1, limit: 20, cs_type: nil, + search_date_from: nil, search_date_to: nil, user_id: nil, user_group_id: nil, idempotency_key: nil) request( uri: 'orders', @@ -23,6 +28,7 @@ def orders(status: [], payment_status: [], keyword: nil, page: 1, cs_type: nil, search_date_from: search_date_from, search_date_to: search_date_to, page: page, + limit: limit, user_id: user_id, user_group_id: user_group_id }.compact diff --git a/lib/bootpay_store/concern/order_subscription.rb b/lib/bootpay_store/concern/order_subscription.rb index fe7c588..82e3600 100644 --- a/lib/bootpay_store/concern/order_subscription.rb +++ b/lib/bootpay_store/concern/order_subscription.rb @@ -4,7 +4,11 @@ module BootpayStore::Concern::OrderSubscription # 계약된 구독정보를 가져온다 # Comment by GOSOMI # @date: 2025-06-20 - def order_subscriptions(page: 1, keyword: nil, search_date_from: nil, search_date_to: nil, + # @date: 26-08-14 limit 인자 추가. 서버(v1/order_subscriptions_controller#index)는 + # `params[:limit].presence || 20` 으로 이미 받고 있었는데 SDK 가 안 보내고 있었다. + # 기본값 20 은 서버 기본과 같아 기존 호출 결과가 바뀌지 않는다. + # ⚠️ 날짜 키는 search_date_from/to (또는 s_at/e_at). orders 의 css_at/cse_at 와 다르다. + def order_subscriptions(page: 1, limit: 20, keyword: nil, search_date_from: nil, search_date_to: nil, request_type: nil, user_group_id: nil, status: nil, user_id: nil, idempotency_key: nil) request( uri: 'order_subscriptions', @@ -15,6 +19,7 @@ def order_subscriptions(page: 1, keyword: nil, search_date_from: nil, search_dat }, params: { page: page, + limit: limit, keyword: keyword, search_date_from: search_date_from, search_date_to: search_date_to, @@ -37,5 +42,324 @@ def order_subscription_detail(order_subscription_id:, idempotency_key: nil) } ) end + + # ───────────────────────────────────────────────────────────── + # 구독 계약변경 · 조정항목 · 빌 조회 (@comment_by Claude (alfred) / @date: 26-08-14) + # ───────────────────────────────────────────────────────────── + + # 구독 계약 내용을 변경한다 (PUT /v1/order_subscriptions/:id) + # 바뀐 값만 보내면 된다 (나머지는 서버가 그대로 유지). + def order_subscription_update(order_subscription_id:, product_id: nil, product_option_id: nil, + order_name: nil, total_subscription_duration: nil, quantity: nil, + address_id: nil, username: nil, phone: nil, email: nil, + use_free_trial: nil, free_trial_day: nil, + service_start_at: nil, service_end_at: nil, idempotency_key: nil) + request( + uri: "order_subscriptions/#{order_subscription_id}", + method: :put, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'supervisor' + }, + payload: { + product_id: product_id, + product_option_id: product_option_id, + order_name: order_name, + total_subscription_duration: total_subscription_duration, + quantity: quantity, + address_id: address_id, + username: username, + phone: phone, + email: email, + use_free_trial: use_free_trial, + free_trial_day: free_trial_day, + service_start_at: service_start_at, + service_end_at: service_end_at + }.compact + ) + end + + # 가감산 조정항목을 추가한다 (POST /v1/order_subscriptions/:id/adjustments) + # ⚠️ /adjustments 한 경로에 POST·PUT·DELETE 세 동사가 걸려 있다. method 를 반드시 명시할 것. + # type 미전달 시 서버가 price>0 이면 SETUP_PRICE, 아니면 PERIOD_DISCOUNT 로 자동 판정한다. + def order_subscription_adjustment_create(order_subscription_id:, name: nil, price: 0, duration: 1, + tax_free_price: 0, type: nil, idempotency_key: nil) + request( + uri: "order_subscriptions/#{order_subscription_id}/adjustments", + method: :post, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'supervisor' + }, + payload: { + name: name, + price: price, + duration: duration, + tax_free_price: tax_free_price, + type: type + }.compact + ) + end + + # 특정 회차의 조정항목을 통째로 교체한다 (PUT /v1/order_subscriptions/:id/adjustments) + # adjustments 는 배열. 서버는 duration(회차) 단위로 갈아끼운다. + def order_subscription_adjustment_update(order_subscription_id:, duration: 1, adjustments: [], + idempotency_key: nil) + request( + uri: "order_subscriptions/#{order_subscription_id}/adjustments", + method: :put, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'supervisor' + }, + payload: { + duration: duration, + adjustments: adjustments + }.compact + ) + end + + # 조정항목을 삭제한다 (DELETE /v1/order_subscriptions/:id/adjustments) + def order_subscription_adjustment_delete(order_subscription_id:, order_subscription_adjustment_id:, + idempotency_key: nil) + request( + uri: "order_subscriptions/#{order_subscription_id}/adjustments", + method: :delete, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'supervisor' + }, + payload: { order_subscription_adjustment_id: order_subscription_adjustment_id } + ) + end + + # 구독 빌(회차) 목록을 조회한다 (GET /v1/order_subscription_bills) + # ⚠️ 경로가 order_subscription_bills — 언더스코어다 (하이픈 아님). + def order_subscription_bill_list(order_subscription_id: nil, page: 1, limit: 20, status: nil, + idempotency_key: nil) + request( + uri: 'order_subscription_bills', + method: :get, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'user' + }, + params: { + order_subscription_id: order_subscription_id, + page: page, + limit: limit, + status: status + }.compact + ) + end + + # ───────────────────────────────────────────────────────────── + # 구독 진행중 요청 (requests/ing) (@comment_by Claude (alfred) / @date: 26-08-14) + # + # ⚠️ 동사가 제각각이다. routes 정본 기준: + # pause · purchase · termination · transfer → POST + # resume → PUT ← 이것만 다르다 + # calculate_termination_fee → GET + # "오타겠지" 하며 resume 을 POST 로 바꾸지 말 것. + # + # ⚠️ supervisor_request_order_subscription_* (PUT order_subscriptions/:id/*) 와는 다른 라우트다. + # 이쪽은 구매자가 "요청"을 올리는 면, 저쪽은 관리자가 즉시 실행하는 면. + # ───────────────────────────────────────────────────────────── + + # 구독 일시중지 요청 (POST /v1/order_subscriptions/requests/ing/pause) + def order_subscription_requests_ing_pause(order_subscription_id:, reason: nil, paused_at: nil, + expected_resume_at: nil, idempotency_key: nil) + request( + uri: 'order_subscriptions/requests/ing/pause', + method: :post, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'user' + }, + payload: { + order_subscription_id: order_subscription_id, + reason: reason, + paused_at: paused_at, + expected_resume_at: expected_resume_at + }.compact + ) + end + + # 구독 재개 요청 (PUT /v1/order_subscriptions/requests/ing/resume) + # ⚠️ requests/ing 계열 중 유일하게 PUT 이다. + def order_subscription_requests_ing_resume(order_subscription_id:, reason: nil, idempotency_key: nil) + request( + uri: 'order_subscriptions/requests/ing/resume', + method: :put, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'user' + }, + payload: { + order_subscription_id: order_subscription_id, + reason: reason + }.compact + ) + end + + # 중도인수 요청 (POST /v1/order_subscriptions/requests/ing/purchase) + def order_subscription_requests_ing_purchase(order_subscription_id:, price: nil, tax_free_price: nil, + reason: nil, idempotency_key: nil) + request( + uri: 'order_subscriptions/requests/ing/purchase', + method: :post, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'user' + }, + payload: { + order_subscription_id: order_subscription_id, + price: price, + tax_free_price: tax_free_price, + reason: reason + }.compact + ) + end + + # 중도해지 요청 (POST /v1/order_subscriptions/requests/ing/termination) + def order_subscription_requests_ing_termination(order_subscription_id:, order_number: nil, reason: nil, + termination_fee: nil, last_bill_refund_price: nil, + final_fee: nil, service_end_at: nil, idempotency_key: nil) + request( + uri: 'order_subscriptions/requests/ing/termination', + method: :post, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'user' + }, + payload: { + order_subscription_id: order_subscription_id, + order_number: order_number, + reason: reason, + termination_fee: termination_fee, + last_bill_refund_price: last_bill_refund_price, + final_fee: final_fee, + service_end_at: service_end_at + }.compact + ) + end + + # 구독 이전/승계 요청 (POST /v1/order_subscriptions/requests/ing/transfer) + def order_subscription_requests_ing_transfer(order_subscription_id:, new_user_id: nil, new_username: nil, + new_user_email: nil, new_user_phone: nil, new_user_address: nil, + wallet_id: nil, reason: nil, idempotency_key: nil) + request( + uri: 'order_subscriptions/requests/ing/transfer', + method: :post, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'user' + }, + payload: { + order_subscription_id: order_subscription_id, + new_user_id: new_user_id, + new_username: new_username, + new_user_email: new_user_email, + new_user_phone: new_user_phone, + new_user_address: new_user_address, + wallet_id: wallet_id, + reason: reason + }.compact + ) + end + + # 중도해지 수수료 사전계산 (GET /v1/order_subscriptions/requests/ing/calculate_termination_fee) + # 해지 요청 전에 얼마가 나오는지 미리 보여줄 때 쓴다. + def order_subscription_calculate_termination_fee(order_subscription_id:, order_number: nil, + idempotency_key: nil) + request( + uri: 'order_subscriptions/requests/ing/calculate_termination_fee', + method: :get, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'user' + }, + params: { + order_subscription_id: order_subscription_id, + order_number: order_number + }.compact + ) + end + + # ───────────────────────────────────────────────────────────── + # 구독 요청 리소스 (order-subscription-requests) ⚠️ 하이픈 경로 + # 하이픈 경로는 order-subscription-requests 와 user-groups 둘뿐이다. + # order_subscriptions · order_subscription_bills 는 언더스코어 — 복사해 고칠 때 가장 흔히 틀리는 지점. + # ───────────────────────────────────────────────────────────── + + # 구독 변경요청 목록 (GET /v1/order-subscription-requests) + # project_id 를 주면 supervisor 모드(프로젝트 전체 검색), 없으면 본인 요청만. + def order_subscription_request_list(project_id: nil, order_subscription_id: nil, page: 1, limit: 20, + keyword: nil, s_at: nil, e_at: nil, status: nil, + request_type: nil, user_id: nil, user_group_id: nil, + idempotency_key: nil) + request( + uri: 'order-subscription-requests', + method: :get, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => project_id.present? ? 'supervisor' : 'user' + }, + params: { + project_id: project_id, + order_subscription_id: order_subscription_id, + page: page, + limit: limit, + keyword: keyword, + s_at: s_at, + e_at: e_at, + status: status, + request_type: request_type, + user_id: user_id, + user_group_id: user_group_id + }.compact + ) + end + + # 구독 변경요청 상세 (GET /v1/order-subscription-requests/:id) + def order_subscription_request_detail(request_history_id:, project_id: nil, idempotency_key: nil) + request( + uri: "order-subscription-requests/#{request_history_id}", + method: :get, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => project_id.present? ? 'supervisor' : 'user' + }, + params: { project_id: project_id }.compact + ) + end + + # 구독 변경요청 승인/반려 (PUT /v1/order-subscription-requests/:id) + # ⚠️ 승인과 반려는 별도 액션이 아니다. 라우트는 index/show/update 셋뿐이고 + # approval: 'approve' | 'reject' 파라미터로 갈린다. + # 서버가 params[:action] 을 Rails 예약어로 쓰기 때문에 키 이름이 approval 이다. + def order_subscription_request_update(request_history_id:, approval:, reason: nil, + price: nil, tax_free_price: nil, termination_fee: nil, + last_bill_refund_price: nil, final_fee: nil, service_end_at: nil, + idempotency_key: nil) + request( + uri: "order-subscription-requests/#{request_history_id}", + method: :put, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'supervisor' + }, + payload: { + approval: approval, + reason: reason, + price: price, + tax_free_price: tax_free_price, + termination_fee: termination_fee, + last_bill_refund_price: last_bill_refund_price, + final_fee: final_fee, + service_end_at: service_end_at + }.compact + ) + end end end \ No newline at end of file diff --git a/lib/bootpay_store/concern/payment.rb b/lib/bootpay_store/concern/payment.rb index 03829c7..40115ad 100644 --- a/lib/bootpay_store/concern/payment.rb +++ b/lib/bootpay_store/concern/payment.rb @@ -60,9 +60,14 @@ def reject_order_cancel(idempotency_key: nil, order_cancellation_request_id:, me # (관리자) # 주문 취소 요청을 승인처리 한다 - def approve_order_cancel(idempotency_key: nil, order_cancellation_request_history_id:, message: nil) + # @date: 26-08-14 인자명 통일 — 서버(v1/order/cancel_controller)는 approve/reject/withdraw 셋 다 + # params[:id] 를 order_cancellation_request_id 로 동일하게 취급한다. reject 와 이름이 달라 다른 값처럼 + # 보였던 문제를 order_cancellation_request_id: 로 맞춘다. 구 이름도 계속 받는다(하위호환). + def approve_order_cancel(idempotency_key: nil, order_cancellation_request_id: nil, + order_cancellation_request_history_id: nil, message: nil) + cancellation_id = order_cancellation_request_id.presence || order_cancellation_request_history_id request( - uri: "order/cancel/#{order_cancellation_request_history_id}/approve", + uri: "order/cancel/#{cancellation_id}/approve", method: :put, headers: { 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, @@ -73,5 +78,42 @@ def approve_order_cancel(idempotency_key: nil, order_cancellation_request_histor }.compact ) end + + # 주문 취소 요청 내역을 조회한다 (GET /v1/order/cancel) + # @comment_by Claude (alfred) + # @date: 26-08-14 + # order_number 또는 order_id 로 필터. 둘 다 없으면 전체. + # approve/reject/withdraw 에 넘길 :id 를 여기서 얻는다 — 이게 없어서 승인/반려가 사실상 쓸 수 없었다. + def order_cancel_list(order_number: nil, order_id: nil, idempotency_key: nil) + request( + uri: 'order/cancel', + method: :get, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'user' + }, + params: { + order_number: order_number, + order_id: order_id + }.compact + ) + end + + # (구매자) 주문 취소 요청을 철회한다 (PUT /v1/order/cancel/:id/withdraw) + # @comment_by Claude (alfred) + # @date: 26-08-14 + # ⚠️ 주석 처리된 request_order_cancel_revoke(DELETE order/cancel/:id) 와 다른 라우트다. + # 서버에는 destroy(DELETE :id)와 withdraw(PUT :id/withdraw)가 둘 다 있고 같은 모델 메서드를 부른다. + # 매뉴얼이 문서화한 쪽은 withdraw 이므로 이쪽을 쓴다. + def order_cancel_withdraw(order_cancellation_request_id:, idempotency_key: nil) + request( + uri: "order/cancel/#{order_cancellation_request_id}/withdraw", + method: :put, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'user' + } + ) + end end end \ No newline at end of file diff --git a/lib/bootpay_store/concern/product.rb b/lib/bootpay_store/concern/product.rb index 9da6d39..d165d5a 100644 --- a/lib/bootpay_store/concern/product.rb +++ b/lib/bootpay_store/concern/product.rb @@ -5,6 +5,9 @@ module BootpayStore::Concern::Product # 상품 목록을 조회한다 (V1 Mall API) # Comment by Codex # @date: 2026-02-23 + # @date: 26-08-14 ⚠️ keyword 는 서버(v1/products_controller#index)가 읽지 않는다. + # 컨트롤러는 page/limit/category_id/ex_uid/sort 만 사용 — keyword 를 보내도 조용히 무시된다. + # 하위호환 때문에 인자는 남겨두되, 검색이 필요하면 서버 지원 추가가 선행되어야 한다. def products(page: 1, limit: 20, category_id: nil, sort: nil, keyword: nil, user_jwt: nil, idempotency_key: nil) request( uri: 'products', @@ -40,6 +43,8 @@ def product_detail(product_id:, user_jwt: nil, idempotency_key: nil) # 상품 정보를 가져온다 # Comment by GOSOMI # @date: 2025-10-10 + # @date: 26-08-14 product_detail 과 uri·동작이 같다(차이는 user_jwt 인자 유무). + # 중복이지만 기존 사용자가 있을 수 있어 제거하지 않는다 — 신규 코드는 product_detail 을 쓸 것. def lookup_product(product_id:, idempotency_key: nil) request( uri: "products/#{product_id}", @@ -49,5 +54,115 @@ def lookup_product(product_id:, idempotency_key: nil) } ) end + + # 상품을 등록한다 (POST /v1/products) + # @comment_by Claude (alfred) + # @date: 26-08-14 + # images 가 있으면 multipart, 없으면 JSON 으로 보낸다. + # 컨트롤러가 읽는 필드는 _product_params 참조 — 여기 명시하지 않은 값도 attrs 로 그대로 전달된다. + def product_create(name:, display_price: nil, desc: nil, content: nil, category_id: nil, + type: nil, stock: nil, status_sale: nil, status_display: nil, + use_subscription: nil, subscription_setting_id: nil, + images: nil, save_by: nil, idempotency_key: nil, **attrs) + payload = { + name: name, + display_price: display_price, + desc: desc, + content: content, + category_id: category_id, + type: type, + stock: stock, + status_sale: status_sale, + status_display: status_display, + use_subscription: use_subscription, + subscription_setting_id: subscription_setting_id, + save_by: save_by + }.merge(attrs).compact + + headers = { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'manager' + } + + if images.present? + form = payload.each_with_object({}) { |(k, v), h| h[k.to_s] = multipart_value(v) } + Array(images).each_with_index { |image, i| form["images[#{i}]"] = multipart_file(image) } + post_multipart(uri: 'products', form: form, headers: headers) + else + request(uri: 'products', method: :post, headers: headers, payload: payload) + end + end + + # 상품을 수정한다 (PUT /v1/products/:id) + # @comment_by Claude (alfred) + # @date: 26-08-14 + # 바뀐 값만 보내면 된다. category_id 는 키 존재 여부로 '해제 의사'를 판별하므로 주의. + def product_update(product_id:, name: nil, display_price: nil, desc: nil, content: nil, + category_id: nil, stock: nil, status_sale: nil, status_display: nil, + save_by: nil, idempotency_key: nil, **attrs) + request( + uri: "products/#{product_id}", + method: :put, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'manager' + }, + payload: { + name: name, + display_price: display_price, + desc: desc, + content: content, + category_id: category_id, + stock: stock, + status_sale: status_sale, + status_display: status_display, + save_by: save_by + }.merge(attrs).compact + ) + end + + # 상품을 삭제한다 (DELETE /v1/products/:id) + # @comment_by Claude (alfred) + # @date: 26-08-14 + def product_delete(product_id:, idempotency_key: nil) + request( + uri: "products/#{product_id}", + method: :delete, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'manager' + } + ) + end + + # 상품 판매/노출 상태를 변경한다 (PUT /v1/products/:id/status) + # @comment_by Claude (alfred) + # @date: 26-08-14 + # 컨트롤러 _status_params 기준. 재고(stock)는 여기가 아니라 product_update 로 바꾼다. + def product_status(product_id:, status_sale: nil, status_display: nil, status_frozen: nil, + status_review: nil, use_display_period: nil, display_start_at: nil, display_end_at: nil, + use_sale_period: nil, sale_start_at: nil, sale_end_at: nil, + idempotency_key: nil, **attrs) + request( + uri: "products/#{product_id}/status", + method: :put, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'manager' + }, + payload: { + status_sale: status_sale, + status_display: status_display, + status_frozen: status_frozen, + status_review: status_review, + use_display_period: use_display_period, + display_start_at: display_start_at, + display_end_at: display_end_at, + use_sale_period: use_sale_period, + sale_start_at: sale_start_at, + sale_end_at: sale_end_at + }.merge(attrs).compact + ) + end end end diff --git a/lib/bootpay_store/concern/rest.rb b/lib/bootpay_store/concern/rest.rb index a517691..126a90f 100644 --- a/lib/bootpay_store/concern/rest.rb +++ b/lib/bootpay_store/concern/rest.rb @@ -35,6 +35,54 @@ def request(method: :post, uri:, payload: {}, headers: {}, params: nil) ) end + # multipart/form-data 전송 (파일 업로드용) + # @comment_by Claude (alfred) + # @date: 26-08-14 + # ⚠️ content_type 을 명시하지 않는다. 명시하면 HTTP.rb 가 붙이는 boundary 가 사라져 본문이 깨진다. + # (Node SDK 는 인터셉터가 Content-Type 을 덮어써 본문이 null 로 전송되는 버그가 있다 — 같은 함정) + # 기존 request 는 json: 고정이라 손대지 않고 별도 메서드로 둔다. + def post_multipart(uri:, form: {}, headers: {}) + response = HTTP.headers( + { + Authorization: @token.present? ? "Bearer #{@token}" : "Basic #{basic_authentification}", + accept: 'application/json', + bootpay_api_version: @api_version, + bootpay_sdk_version: Bootpay::V2_VERSION, + bootpay_sdk_type: '300' + }.merge!(headers).compact + ).post( + [BootpayStore::RestClient::API[@mode.to_sym], uri].join('/'), + form: form + ) + BootpayStore::Response.new( + response.status.to_i == 200, + JSON.parse(response.body.to_s, symbolize_names: true) + ) + rescue Exception => e + BootpayStore::Response.new( + false, + message: "부트페이 API 서버와의 통신이 실패하였습니다. 오류 메세지: #{e.message}", + backtrace: e.backtrace.join("\n") + ) + end + + # multipart form 값 정규화 — 파일은 FormData::File 로, 나머지는 문자열로. + # 파일은 경로(String)·IO·HTTP::FormData::File 셋 다 받는다. + # @comment_by Claude (alfred) + # @date: 26-08-14 + def multipart_file(value) + return value if value.is_a?(HTTP::FormData::File) + HTTP::FormData::File.new(value) + end + + def multipart_value(value) + case value + when Array, Hash then value.to_json + when TrueClass, FalseClass then value.to_s + else value.to_s + end + end + # basic authenticate 추가 # Comment by GOSOMI # @date: 2026-02-20 diff --git a/lib/bootpay_store/concern/user.rb b/lib/bootpay_store/concern/user.rb index 038a80a..8cb5de3 100644 --- a/lib/bootpay_store/concern/user.rb +++ b/lib/bootpay_store/concern/user.rb @@ -2,12 +2,15 @@ module BootpayStore::Concern::User extend ActiveSupport::Concern included do - # 회원 로그인 (V1 Mall API) + # 회원 로그인 (V1 API) # Comment by Codex # @date: 2026-02-23 + # @date: 26-08-14 uri 'user/login' → 'users/session' 로 정정. + # v1 에는 단수 user/* 라우트가 없다(bin/rails routes 844줄 전수 확인). 로그인은 POST /v1/users/session (v1/users/sessions#create). + # /mall/user/login 은 스토어프론트 스코프라 서버사이드 SDK(base=/v1)와 무관하다. def user_login(login_id:, password:, corporate_type: 0, idempotency_key: nil) request( - uri: 'user/login', + uri: 'users/session', method: :post, headers: { 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid @@ -23,9 +26,10 @@ def user_login(login_id:, password:, corporate_type: 0, idempotency_key: nil) # 회원 세션 조회 (V1 Mall API) # Comment by Codex # @date: 2026-02-23 + # @date: 26-08-14 uri 'user/session' → 'users/session' 로 정정 (GET /v1/users/session). def user_session(user_jwt: nil, idempotency_key: nil) request( - uri: 'user/session', + uri: 'users/session', method: :get, headers: { 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, @@ -37,9 +41,10 @@ def user_session(user_jwt: nil, idempotency_key: nil) # 회원 로그아웃 (V1 Mall API) # Comment by Codex # @date: 2026-02-23 + # @date: 26-08-14 uri 'user/session' → 'users/session' 로 정정 (DELETE /v1/users/session). def user_logout(user_jwt:, idempotency_key: nil) request( - uri: 'user/session', + uri: 'users/session', method: :delete, headers: { 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, @@ -48,13 +53,17 @@ def user_logout(user_jwt:, idempotency_key: nil) ) end - # 회원가입 (V1 Mall API) + # 회원가입 (V1 API) — 일반 회원가입용 # Comment by Codex # @date: 2026-02-23 + # @date: 26-08-14 uri 'user/join' → 'users/join' 로 정정 (POST /v1/users/join). + # ⚠️ external_user_sign_in 과 같은 엔드포인트를 부른다. 중복이 아니라 용도가 다르다 — + # 이쪽은 password/corporate_type/group 을 쓰는 일반 회원가입, 저쪽은 uid/login_email/login_pw 를 쓰는 외부 uid 연동 가입이다. + # 서버가 파라미터 조합으로 분기하므로 둘 다 유지한다(26-08-14 사용자 결정). 매뉴얼 customer/register.md 는 external_user_sign_in 에 대응. def user_join(login_id:, password:, name:, email: nil, phone: nil, nickname: nil, gender: nil, birth: nil, corporate_type: 0, group: nil, idempotency_key: nil) request( - uri: 'user/join', + uri: 'users/join', method: :post, headers: { 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid @@ -74,13 +83,16 @@ def user_join(login_id:, password:, name:, email: nil, phone: nil, nickname: nil ) end - # 회원가입 중복 확인 (V1 Mall API) - # type: email-exist, id-exist, phone-exist, group-business-number-exist + # 회원가입 중복 확인 (V1 API) — key 를 인자로 받는 일반형 + # type: email-exist, id-exist, phone-exist, uid-exist, group-business-number-exist # Comment by Codex # @date: 2026-02-23 + # @date: 26-08-14 uri 'user/join/#{type}' → 'users/join/#{type}' 로 정정 (GET /v1/users/join/:id). + # ⚠️ email_exist·id_exist·phone_exist·uid_exist·group_business_number_exist 전용형 5종과 기능이 겹치지만 둘 다 유지한다(26-08-14 사용자 결정). + # 일반형은 서버에 새 key 가 생겨도 SDK 수정 없이 쓸 수 있고, 매뉴얼 customer/check-exist.md 가 key/value 형태를 안내하므로 이쪽에 대응한다. def user_join_check(type:, pk:, idempotency_key: nil) request( - uri: "user/join/#{type}", + uri: "users/join/#{type}", method: :get, headers: { 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid @@ -253,5 +265,55 @@ def group_business_number_exist(business_number:, idempotency: nil) params: { pk: business_number } ) end + + # 외부 uid(ex_uid) 중복검사 (GET /v1/users/join/uid-exist) + # @comment_by Claude (alfred) + # @date: 26-08-14 + # email/id/phone/group-business-number 전용형과 같은 패턴. 이걸로 *_exist 계열이 5종 완성된다. + def uid_exist(uid:, idempotency_key: nil) + request( + uri: 'users/join/uid-exist', + method: :get, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'user' + }, + params: { pk: uid } + ) + end + + # 회원 정보를 수정한다 (PUT /v1/users/:id) + # @comment_by Claude (alfred) + # @date: 26-08-14 + # 컨트롤러 build_user_params 기준. 사업자 정보는 group: { company_name:, business_number:, registration_number: } 로 중첩 전달. + # 바뀐 값만 보내면 된다. + def user_update(user_id:, login_id: nil, login_pw: nil, name: nil, phone: nil, email: nil, + tel: nil, nickname: nil, bank_username: nil, bank_account: nil, bank_code: nil, + comment: nil, gender: nil, birth: nil, group: nil, idempotency_key: nil, **attrs) + request( + uri: "users/#{user_id}", + method: :put, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'user' + }, + payload: { + login_id: login_id, + login_pw: login_pw, + name: name, + phone: phone, + email: email, + tel: tel, + nickname: nickname, + bank_username: bank_username, + bank_account: bank_account, + bank_code: bank_code, + comment: comment, + gender: gender, + birth: birth, + group: group + }.merge(attrs).compact + ) + end end end diff --git a/lib/bootpay_store/concern/user_group.rb b/lib/bootpay_store/concern/user_group.rb index 63d75e3..520afef 100644 --- a/lib/bootpay_store/concern/user_group.rb +++ b/lib/bootpay_store/concern/user_group.rb @@ -170,5 +170,52 @@ def delete_user_from_group(user_group_id:, user_id:, idempotency_key: nil) } ) end + + # 그룹 구매한도를 설정한다 (PUT /v1/user-groups/:id/limit) + # @comment_by Claude (alfred) + # @date: 26-08-14 + # ⚠️ update_user_group 으로는 한도가 절대 반영되지 않는다. + # user_groups_controller#update 가 use_limit/limit_message/limit_month_purchase/limit_week_purchase 를 + # params.except! 로 명시적으로 제거하기 때문 — 한도는 이 전용 라우트로만 바뀐다. + # 서버 scope: manager:limit + def user_group_limit(user_group_id:, use_limit: nil, limit_month_purchase: nil, + limit_week_purchase: nil, limit_message: nil, idempotency_key: nil) + request( + uri: "user-groups/#{user_group_id}/limit", + method: :put, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'manager' + }, + payload: { + use_limit: use_limit, + limit_month_purchase: limit_month_purchase, + limit_week_purchase: limit_week_purchase, + limit_message: limit_message + }.compact + ) + end + + # 그룹 구독 합산청구(정산주기) 설정을 변경한다 (PUT /v1/user-groups/:id/aggregate-transaction) + # @comment_by Claude (alfred) + # @date: 26-08-14 + # update_user_group 에도 같은 이름의 인자가 있지만 서버는 이 전용 라우트에서만 처리한다. + def user_group_aggregate_transaction(user_group_id:, use_subscription_aggregate_transaction: nil, + subscription_month_day: nil, subscription_week_day: nil, + idempotency_key: nil) + request( + uri: "user-groups/#{user_group_id}/aggregate-transaction", + method: :put, + headers: { + 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid, + 'Bootpay-Role' => 'manager' + }, + payload: { + use_subscription_aggregate_transaction: use_subscription_aggregate_transaction, + subscription_month_day: subscription_month_day, + subscription_week_day: subscription_week_day + }.compact + ) + end end end \ No newline at end of file From 7662e9bcf8aa890d33b18ed69e165d77ea57c759 Mon Sep 17 00:00:00 2001 From: alfredhot Date: Tue, 18 Aug 2026 17:37:45 +0900 Subject: [PATCH 133/133] =?UTF-8?q?login=20api=20url=20=ED=8B=80=EB=A6=B0?= =?UTF-8?q?=EA=B2=83=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bootpay_store/concern/user.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/bootpay_store/concern/user.rb b/lib/bootpay_store/concern/user.rb index 8cb5de3..9c2459e 100644 --- a/lib/bootpay_store/concern/user.rb +++ b/lib/bootpay_store/concern/user.rb @@ -5,12 +5,15 @@ module BootpayStore::Concern::User # 회원 로그인 (V1 API) # Comment by Codex # @date: 2026-02-23 - # @date: 26-08-14 uri 'user/login' → 'users/session' 로 정정. - # v1 에는 단수 user/* 라우트가 없다(bin/rails routes 844줄 전수 확인). 로그인은 POST /v1/users/session (v1/users/sessions#create). + # @date: 26-08-14 uri 'user/login' → 'users/login' 로 정정. + # v1 에는 단수 user/* 라우트가 없다(bin/rails routes 전수 확인). 로그인은 POST /v1/users/login (v1/users/login#create). + # ⚠️ POST /v1/users/session 은 resource :session 이 만들어낸 라우트일 뿐 sessions_controller 에 create 액션이 없다. + # 라우트 존재만 보고 그리로 보내면 안 된다 — show(GET)/destroy(DELETE) 만 정의돼 있다. + # ⚠️ 서버(LoginService)는 login_id·password 만 읽는다. corporate_type 은 전달돼도 무시된다. # /mall/user/login 은 스토어프론트 스코프라 서버사이드 SDK(base=/v1)와 무관하다. def user_login(login_id:, password:, corporate_type: 0, idempotency_key: nil) request( - uri: 'users/session', + uri: 'users/login', method: :post, headers: { 'Idempotency-Key' => idempotency_key.presence || SecureRandom.uuid