From 58c8ceb459b4db70c89dacc8bcaba86aa3086036 Mon Sep 17 00:00:00 2001 From: SDK Distribution Bot Date: Mon, 14 Sep 2026 05:23:26 +0000 Subject: [PATCH] feat: Update SDK from generator (2026-09-14) --- Gemfile.lock | 2 +- README.md | 5 +- docs/CheckoutSessionsApi.md | 70 +++++++++++++++++++ docs/SetupFlowCancelRequest.md | 2 +- lib/payjpv2/api/checkout_sessions_api.rb | 60 ++++++++++++++++ lib/payjpv2/models/line_item_request.rb | 14 ++++ .../models/setup_flow_cancel_request.rb | 2 +- .../models/setup_flow_cancellation_reason.rb | 3 +- lib/payjpv2/version.rb | 2 +- spec/api/checkout_sessions_api_spec.rb | 33 +++++++++ 10 files changed, 186 insertions(+), 7 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 1533f79..648d7ba 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - payjpv2 (1.1.0) + payjpv2 (1.2.0) typhoeus (~> 1.0, >= 1.0.1) GEM diff --git a/README.md b/README.md index 25e115b..698bee4 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ A Ruby client library for the PAY.JP v2 API. This SDK provides a convenient way This Ruby gem is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: - API version: 2.0.0 -- Package version: 1.1.0 +- Package version: 1.2.0 - Generator version: 7.14.0 - Build package: org.openapitools.codegen.languages.RubyClientCodegen @@ -26,7 +26,7 @@ gem install payjpv2 Add this line to your application's Gemfile: ```ruby -gem 'payjpv2', '~> 1.1.0' +gem 'payjpv2', '~> 1.2.0' ``` Then execute: @@ -196,6 +196,7 @@ Class | Method | HTTP request | Description *PAYJPv2::BalancesApi* | [**get_all_balances**](docs/BalancesApi.md#get_all_balances) | **GET** /v2/balances | Get All Balances *PAYJPv2::BalancesApi* | [**get_balance**](docs/BalancesApi.md#get_balance) | **GET** /v2/balances/{balance_id} | Get Balance *PAYJPv2::CheckoutSessionsApi* | [**create_checkout_session**](docs/CheckoutSessionsApi.md#create_checkout_session) | **POST** /v2/checkout/sessions | Create Checkout Session +*PAYJPv2::CheckoutSessionsApi* | [**expire_checkout_session**](docs/CheckoutSessionsApi.md#expire_checkout_session) | **POST** /v2/checkout/sessions/{checkout_session_id}/expire | Expire Checkout Session *PAYJPv2::CheckoutSessionsApi* | [**get_all_checkout_session_line_items**](docs/CheckoutSessionsApi.md#get_all_checkout_session_line_items) | **GET** /v2/checkout/sessions/{checkout_session_id}/line_items | Get All Checkout Session Line Items *PAYJPv2::CheckoutSessionsApi* | [**get_all_checkout_sessions**](docs/CheckoutSessionsApi.md#get_all_checkout_sessions) | **GET** /v2/checkout/sessions | Get All Checkout Sessions *PAYJPv2::CheckoutSessionsApi* | [**get_checkout_session**](docs/CheckoutSessionsApi.md#get_checkout_session) | **GET** /v2/checkout/sessions/{checkout_session_id} | Get Checkout Session diff --git a/docs/CheckoutSessionsApi.md b/docs/CheckoutSessionsApi.md index 5dd4480..5052fd4 100644 --- a/docs/CheckoutSessionsApi.md +++ b/docs/CheckoutSessionsApi.md @@ -5,6 +5,7 @@ All URIs are relative to *http://localhost* | Method | HTTP request | Description | | ------ | ------------ | ----------- | | [**create_checkout_session**](CheckoutSessionsApi.md#create_checkout_session) | **POST** /v2/checkout/sessions | Create Checkout Session | +| [**expire_checkout_session**](CheckoutSessionsApi.md#expire_checkout_session) | **POST** /v2/checkout/sessions/{checkout_session_id}/expire | Expire Checkout Session | | [**get_all_checkout_session_line_items**](CheckoutSessionsApi.md#get_all_checkout_session_line_items) | **GET** /v2/checkout/sessions/{checkout_session_id}/line_items | Get All Checkout Session Line Items | | [**get_all_checkout_sessions**](CheckoutSessionsApi.md#get_all_checkout_sessions) | **GET** /v2/checkout/sessions | Get All Checkout Sessions | | [**get_checkout_session**](CheckoutSessionsApi.md#get_checkout_session) | **GET** /v2/checkout/sessions/{checkout_session_id} | Get Checkout Session | @@ -80,6 +81,75 @@ end - **Accept**: application/json, application/problem+json +## expire_checkout_session + +> expire_checkout_session(checkout_session_id) + +Expire Checkout Session + +### Examples + +```ruby +require 'time' +require 'payjpv2' +# setup authorization +PAYJPv2.configure do |config| + # Configure HTTP basic authorization: HTTPBasic + config.username = 'YOUR USERNAME' + config.password = 'YOUR PASSWORD' + + # Configure Bearer authorization: HTTPBearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = PAYJPv2::CheckoutSessionsApi.new +checkout_session_id = 'checkout_session_id_example' # String | + +begin + # Expire Checkout Session + result = api_instance.expire_checkout_session(checkout_session_id) + p result +rescue PAYJPv2::ApiError => e + puts "Error when calling CheckoutSessionsApi->expire_checkout_session: #{e}" +end +``` + +#### Using the include_http_info option + +To get response data along with status code and headers, use the `include_http_info: true` option. + +```ruby +begin + # Expire Checkout Session + data, status_code, headers = api_instance.expire_checkout_session(checkout_session_id, { include_http_info: true }) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue PAYJPv2::ApiError => e + puts "Error when calling CheckoutSessionsApi->expire_checkout_session: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **checkout_session_id** | **String** | | | + +### Return type + +[**CheckoutSessionDetailsResponse**](CheckoutSessionDetailsResponse.md) + +### Authorization + +[HTTPBasic](../README.md#HTTPBasic), [HTTPBearer](../README.md#HTTPBearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json, application/problem+json + + ## get_all_checkout_session_line_items > get_all_checkout_session_line_items(checkout_session_id, opts) diff --git a/docs/SetupFlowCancelRequest.md b/docs/SetupFlowCancelRequest.md index 73de094..dbf631e 100644 --- a/docs/SetupFlowCancelRequest.md +++ b/docs/SetupFlowCancelRequest.md @@ -4,7 +4,7 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **cancellation_reason** | [**SetupFlowCancellationReason**](SetupFlowCancellationReason.md) | この SetupFlow のキャンセル理由。 | 値 | |:---| | **abandoned**: 顧客が SetupFlow を完了しなかった場合。 | | **requested_by_customer**: 顧客がキャンセルを要求した場合。 | | **duplicate**: 支払い方法が重複している場合。 | | [optional] | +| **cancellation_reason** | [**SetupFlowCancellationReason**](SetupFlowCancellationReason.md) | この SetupFlow のキャンセル理由。 | 値 | |:---| | **abandoned**: 顧客が SetupFlow を完了しなかった場合。 | | **requested_by_customer**: 顧客がキャンセルを要求した場合。 | | **duplicate**: 支払い方法が重複している場合。 | `expired` はシステムが自動的に設定する値のため、リクエストでは指定できません。 | [optional] | ## Example diff --git a/lib/payjpv2/api/checkout_sessions_api.rb b/lib/payjpv2/api/checkout_sessions_api.rb index fb20114..2e982ed 100644 --- a/lib/payjpv2/api/checkout_sessions_api.rb +++ b/lib/payjpv2/api/checkout_sessions_api.rb @@ -84,6 +84,66 @@ def create_checkout_session(checkout_session_create_request, opts = {}) end end + # Expire Checkout Session + # @param checkout_session_id [String] + # @param [Hash] opts the optional parameters + # @option opts [String] :idempotency_key Idempotency key for the request + # @option opts [Boolean] :include_http_info If true, returns [data, status_code, headers] instead of just data + # @return [CheckoutSessionDetailsResponse, Array] Returns data or [data, status_code, headers] if include_http_info is true + def expire_checkout_session(checkout_session_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CheckoutSessionsApi.expire_checkout_session ...' + end + # verify the required parameter 'checkout_session_id' is set + if @api_client.config.client_side_validation && checkout_session_id.nil? + raise ArgumentError, "Missing the required parameter 'checkout_session_id' when calling CheckoutSessionsApi.expire_checkout_session" + end + # resource path + local_var_path = '/v2/checkout/sessions/{checkout_session_id}/expire'.sub('{' + 'checkout_session_id' + '}', CGI.escape(checkout_session_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + header_params['Idempotency-Key'] = opts[:idempotency_key] if opts[:idempotency_key] + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/problem+json']) unless header_params['Accept'] + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'CheckoutSessionDetailsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['HTTPBasic', 'HTTPBearer'] + + new_options = opts.merge( + :operation => :"CheckoutSessionsApi.expire_checkout_session", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: CheckoutSessionsApi#expire_checkout_session\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + + if opts[:include_http_info] + [data, status_code, headers] + else + data + end + end + # Get All Checkout Session Line Items # @param checkout_session_id [String] # @param [Hash] opts the optional parameters diff --git a/lib/payjpv2/models/line_item_request.rb b/lib/payjpv2/models/line_item_request.rb index 6018ede..eae3d05 100644 --- a/lib/payjpv2/models/line_item_request.rb +++ b/lib/payjpv2/models/line_item_request.rb @@ -110,6 +110,20 @@ def quantity=(quantity) @quantity = quantity end + # Custom attribute writer method with validation + # @param [Object] tax_rates Value to be assigned + def tax_rates=(tax_rates) + if tax_rates.nil? + raise ArgumentError, 'tax_rates cannot be nil' + end + + if tax_rates.length > 1 + raise ArgumentError, 'invalid value for "tax_rates", number of items must be less than or equal to 1.' + end + + @tax_rates = tax_rates + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/payjpv2/models/setup_flow_cancel_request.rb b/lib/payjpv2/models/setup_flow_cancel_request.rb index fb1f0ba..805d0dd 100644 --- a/lib/payjpv2/models/setup_flow_cancel_request.rb +++ b/lib/payjpv2/models/setup_flow_cancel_request.rb @@ -15,7 +15,7 @@ module PAYJPv2 class SetupFlowCancelRequest - # この SetupFlow のキャンセル理由。 | 値 | |:---| | **abandoned**: 顧客が SetupFlow を完了しなかった場合。 | | **requested_by_customer**: 顧客がキャンセルを要求した場合。 | | **duplicate**: 支払い方法が重複している場合。 | + # この SetupFlow のキャンセル理由。 | 値 | |:---| | **abandoned**: 顧客が SetupFlow を完了しなかった場合。 | | **requested_by_customer**: 顧客がキャンセルを要求した場合。 | | **duplicate**: 支払い方法が重複している場合。 | `expired` はシステムが自動的に設定する値のため、リクエストでは指定できません。 attr_accessor :cancellation_reason class EnumAttributeValidator diff --git a/lib/payjpv2/models/setup_flow_cancellation_reason.rb b/lib/payjpv2/models/setup_flow_cancellation_reason.rb index a277ae1..07d979b 100644 --- a/lib/payjpv2/models/setup_flow_cancellation_reason.rb +++ b/lib/payjpv2/models/setup_flow_cancellation_reason.rb @@ -17,10 +17,11 @@ module PAYJPv2 class SetupFlowCancellationReason ABANDONED = "abandoned".freeze DUPLICATE = "duplicate".freeze + EXPIRED = "expired".freeze REQUESTED_BY_CUSTOMER = "requested_by_customer".freeze def self.all_vars - @all_vars ||= [ABANDONED, DUPLICATE, REQUESTED_BY_CUSTOMER].freeze + @all_vars ||= [ABANDONED, DUPLICATE, EXPIRED, REQUESTED_BY_CUSTOMER].freeze end # Builds the enum from string diff --git a/lib/payjpv2/version.rb b/lib/payjpv2/version.rb index cd457e3..da8179c 100644 --- a/lib/payjpv2/version.rb +++ b/lib/payjpv2/version.rb @@ -11,5 +11,5 @@ =end module PAYJPv2 - VERSION = '1.1.0' + VERSION = '1.2.0' end diff --git a/spec/api/checkout_sessions_api_spec.rb b/spec/api/checkout_sessions_api_spec.rb index ea3fbea..cef9dea 100644 --- a/spec/api/checkout_sessions_api_spec.rb +++ b/spec/api/checkout_sessions_api_spec.rb @@ -65,6 +65,39 @@ end end + # unit tests for expire_checkout_session + # Expire Checkout Session + # @param checkout_session_id + # @param [Hash] opts the optional parameters + # @return [CheckoutSessionDetailsResponse] + describe 'expire_checkout_session test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + + describe 'with mocked api_client' do + let(:mock_data) { double('data') } + let(:mock_status) { 200 } + let(:mock_headers) { { 'Content-Type' => 'application/json' } } + + before do + @api_instance.api_client.config.client_side_validation = false + allow(@api_instance.api_client).to receive(:call_api) + .and_return([mock_data, mock_status, mock_headers]) + end + + it 'returns data only by default' do + result = @api_instance.expire_checkout_session(nil) + expect(result).to eq(mock_data) + end + + it 'returns [data, status, headers] with include_http_info: true' do + result = @api_instance.expire_checkout_session(nil, include_http_info: true) + expect(result).to eq([mock_data, mock_status, mock_headers]) + end + end + end + # unit tests for get_all_checkout_session_line_items # Get All Checkout Session Line Items # @param checkout_session_id