From dea58226ec0f58cbb38e40045f8067b1c3ae6a78 Mon Sep 17 00:00:00 2001 From: SDK Distribution Bot Date: Wed, 9 Sep 2026 06:55:06 +0000 Subject: [PATCH] feat: Update SDK from generator (2026-09-09 06:54:49 UTC) --- README.md | 5 +- docs/Api/CheckoutSessionsApi.md | 64 +++++ docs/Model/SetupFlowCancelRequest.md | 2 +- lib/Api/CheckoutSessionsApi.php | 335 ++++++++++++++++++++++ lib/Configuration.php | 6 +- lib/Model/SetupFlowCancelRequest.php | 46 ++- lib/Model/SetupFlowCancellationReason.php | 1 + test/Api/CheckoutSessionsApiTest.php | 12 + 8 files changed, 460 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 8216da2..7978d6f 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ A PHP client library for the PAY.JP v2 API. This SDK provides a convenient way t This PHP package 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.PhpClientCodegen` @@ -81,6 +81,7 @@ Class | Method | HTTP request | Description *BalancesApi* | [**getAllBalances**](docs/Api/BalancesApi.md#getallbalances) | **GET** /v2/balances | Get All Balances *BalancesApi* | [**getBalance**](docs/Api/BalancesApi.md#getbalance) | **GET** /v2/balances/{balance_id} | Get Balance *CheckoutSessionsApi* | [**createCheckoutSession**](docs/Api/CheckoutSessionsApi.md#createcheckoutsession) | **POST** /v2/checkout/sessions | Create Checkout Session +*CheckoutSessionsApi* | [**expireCheckoutSession**](docs/Api/CheckoutSessionsApi.md#expirecheckoutsession) | **POST** /v2/checkout/sessions/{checkout_session_id}/expire | Expire Checkout Session *CheckoutSessionsApi* | [**getAllCheckoutSessionLineItems**](docs/Api/CheckoutSessionsApi.md#getallcheckoutsessionlineitems) | **GET** /v2/checkout/sessions/{checkout_session_id}/line_items | Get All Checkout Session Line Items *CheckoutSessionsApi* | [**getAllCheckoutSessions**](docs/Api/CheckoutSessionsApi.md#getallcheckoutsessions) | **GET** /v2/checkout/sessions | Get All Checkout Sessions *CheckoutSessionsApi* | [**getCheckoutSession**](docs/Api/CheckoutSessionsApi.md#getcheckoutsession) | **GET** /v2/checkout/sessions/{checkout_session_id} | Get Checkout Session @@ -308,6 +309,6 @@ vendor/bin/phpunit This PHP package 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.PhpClientCodegen` diff --git a/docs/Api/CheckoutSessionsApi.md b/docs/Api/CheckoutSessionsApi.md index f3f4554..35852a8 100644 --- a/docs/Api/CheckoutSessionsApi.md +++ b/docs/Api/CheckoutSessionsApi.md @@ -5,6 +5,7 @@ All URIs are relative to https://api.pay.jp, except if the operation defines ano | Method | HTTP request | Description | | ------------- | ------------- | ------------- | | [**createCheckoutSession()**](CheckoutSessionsApi.md#createCheckoutSession) | **POST** /v2/checkout/sessions | Create Checkout Session | +| [**expireCheckoutSession()**](CheckoutSessionsApi.md#expireCheckoutSession) | **POST** /v2/checkout/sessions/{checkout_session_id}/expire | Expire Checkout Session | | [**getAllCheckoutSessionLineItems()**](CheckoutSessionsApi.md#getAllCheckoutSessionLineItems) | **GET** /v2/checkout/sessions/{checkout_session_id}/line_items | Get All Checkout Session Line Items | | [**getAllCheckoutSessions()**](CheckoutSessionsApi.md#getAllCheckoutSessions) | **GET** /v2/checkout/sessions | Get All Checkout Sessions | | [**getCheckoutSession()**](CheckoutSessionsApi.md#getCheckoutSession) | **GET** /v2/checkout/sessions/{checkout_session_id} | Get Checkout Session | @@ -74,6 +75,69 @@ try { [[Back to Model list]](../../README.md#models) [[Back to README]](../../README.md) +## `expireCheckoutSession()` + +```php +expireCheckoutSession($checkoutSessionId): \PAYJPV2\Model\CheckoutSessionDetailsResponse +``` + +Expire Checkout Session + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure Bearer authorization: HTTPBearer +$config = PAYJPV2\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new PAYJPV2\Api\CheckoutSessionsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$checkoutSessionId = 'checkoutSessionId_example'; // string + +try { + $result = $apiInstance->expireCheckoutSession($checkoutSessionId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling CheckoutSessionsApi->expireCheckoutSession: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **checkoutSessionId** | **string**| | | + +### Return type + +[**\PAYJPV2\Model\CheckoutSessionDetailsResponse**](../Model/CheckoutSessionDetailsResponse.md) + +### Authorization + +[HTTPBasic](../../README.md#HTTPBasic), [HTTPBearer](../../README.md#HTTPBearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json`, `application/problem+json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + ## `getAllCheckoutSessionLineItems()` ```php diff --git a/docs/Model/SetupFlowCancelRequest.md b/docs/Model/SetupFlowCancelRequest.md index b09e338..ba0b60e 100644 --- a/docs/Model/SetupFlowCancelRequest.md +++ b/docs/Model/SetupFlowCancelRequest.md @@ -4,6 +4,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**cancellationReason** | [**\PAYJPV2\Model\SetupFlowCancellationReason**](SetupFlowCancellationReason.md) | この SetupFlow のキャンセル理由。 | 値 | |:---| | **abandoned**: 顧客が SetupFlow を完了しなかった場合。 | | **requested_by_customer**: 顧客がキャンセルを要求した場合。 | | **duplicate**: 支払い方法が重複している場合。 | | [optional] +**cancellationReason** | **string** | この SetupFlow のキャンセル理由。 | 値 | |:---| | **abandoned**: 顧客が SetupFlow を完了しなかった場合。 | | **requested_by_customer**: 顧客がキャンセルを要求した場合。 | | **duplicate**: 支払い方法が重複している場合。 | | [optional] [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/lib/Api/CheckoutSessionsApi.php b/lib/Api/CheckoutSessionsApi.php index 5abe90a..71ce748 100644 --- a/lib/Api/CheckoutSessionsApi.php +++ b/lib/Api/CheckoutSessionsApi.php @@ -77,6 +77,9 @@ class CheckoutSessionsApi 'createCheckoutSession' => [ 'application/json', ], + 'expireCheckoutSession' => [ + 'application/json', + ], 'getAllCheckoutSessionLineItems' => [ 'application/json', ], @@ -453,6 +456,338 @@ public function createCheckoutSessionRequest($checkoutSessionCreateRequest, ?str ); } + /** + * Operation expireCheckoutSession + * + * Expire Checkout Session + * + * @param string $checkoutSessionId checkoutSessionId (required) + * @param string|null $idempotencyKey Idempotency key for the request + * + * @throws \PAYJPV2\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \PAYJPV2\Model\CheckoutSessionDetailsResponse|\PAYJPV2\Model\ErrorResponse|\PAYJPV2\Model\ErrorResponse|\PAYJPV2\Model\ErrorResponse + */ + public function expireCheckoutSession($checkoutSessionId, ?string $idempotencyKey = null) + { + list($response) = $this->expireCheckoutSessionWithHttpInfo($checkoutSessionId, $idempotencyKey); + + return $response; + } + + /** + * Operation expireCheckoutSessionWithHttpInfo + * + * Expire Checkout Session + * + * @param string $checkoutSessionId (required) + * @param string|null $idempotencyKey Idempotency key for the request + * + * @throws \PAYJPV2\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \PAYJPV2\Model\CheckoutSessionDetailsResponse|\PAYJPV2\Model\ErrorResponse|\PAYJPV2\Model\ErrorResponse|\PAYJPV2\Model\ErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function expireCheckoutSessionWithHttpInfo($checkoutSessionId, ?string $idempotencyKey = null) + { + $request = $this->expireCheckoutSessionRequest($checkoutSessionId, $idempotencyKey); + + try { + $options = $this->createHttpClientOption(); + + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch ($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\PAYJPV2\Model\CheckoutSessionDetailsResponse', + $request, + $response, + ); + case 422: + return $this->handleResponseWithDataType( + '\PAYJPV2\Model\ErrorResponse', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\PAYJPV2\Model\ErrorResponse', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\PAYJPV2\Model\ErrorResponse', + $request, + $response, + ); + } + + + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\PAYJPV2\Model\CheckoutSessionDetailsResponse', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\PAYJPV2\Model\CheckoutSessionDetailsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + + throw $e; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\PAYJPV2\Model\ErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\PAYJPV2\Model\ErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\PAYJPV2\Model\ErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + + throw $e; + } + + + throw $e; + } + } + + /** + * Operation expireCheckoutSessionAsync + * + * Expire Checkout Session + * + * @param string $checkoutSessionId (required) + * @param string|null $idempotencyKey Idempotency key for the request + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function expireCheckoutSessionAsync($checkoutSessionId, ?string $idempotencyKey = null) + { + return $this->expireCheckoutSessionAsyncWithHttpInfo($checkoutSessionId, $idempotencyKey) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation expireCheckoutSessionAsyncWithHttpInfo + * + * Expire Checkout Session + * + * @param string $checkoutSessionId (required) + * @param string|null $idempotencyKey Idempotency key for the request + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function expireCheckoutSessionAsyncWithHttpInfo($checkoutSessionId, ?string $idempotencyKey = null) + { + $returnType = '\PAYJPV2\Model\CheckoutSessionDetailsResponse'; + $request = $this->expireCheckoutSessionRequest($checkoutSessionId, $idempotencyKey); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders(), + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'expireCheckoutSession' + * + * @param string $checkoutSessionId (required) + * @param string|null $idempotencyKey Idempotency key for the request + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function expireCheckoutSessionRequest($checkoutSessionId, ?string $idempotencyKey = null) + { + + // verify the required parameter 'checkoutSessionId' is set + if ($checkoutSessionId === null || (is_array($checkoutSessionId) && count($checkoutSessionId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $checkoutSessionId when calling expireCheckoutSession' + ); + } + + + $resourcePath = '/v2/checkout/sessions/{checkout_session_id}/expire'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // idempotency key + if ($idempotencyKey !== null) { + $headerParams['Idempotency-Key'] = $idempotencyKey; + } + + + + // path params + if ($checkoutSessionId !== null) { + $resourcePath = str_replace( + '{' . 'checkout_session_id' . '}', + ObjectSerializer::toPathValue($checkoutSessionId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'application/problem+json', ], + 'application/json', + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem, + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (! empty($this->config->getUsername()) || ! (empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + // this endpoint requires Bearer authentication (access token) + if (! empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + $defaultHeaders['X-Payjp-Client-User-Agent'] = Configuration::buildClientUserAgent(); + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + /** * Operation getAllCheckoutSessionLineItems * diff --git a/lib/Configuration.php b/lib/Configuration.php index 73030f9..1ed9a48 100644 --- a/lib/Configuration.php +++ b/lib/Configuration.php @@ -101,7 +101,7 @@ class Configuration * * @var string */ - protected $userAgent = 'payjp/payjpv2 PHPBindings/1.1.0'; + protected $userAgent = 'payjp/payjpv2 PHPBindings/1.2.0'; /** * Debug switch (default set to false) @@ -339,7 +339,7 @@ public function getUserAgent(): string public static function buildClientUserAgent(): string { $uaInfo = [ - 'bindings_version' => '1.1.0', + 'bindings_version' => '1.2.0', 'lang' => 'php', 'lang_version' => PHP_VERSION, 'publisher' => 'payjp', @@ -458,7 +458,7 @@ public static function toDebugReport() $report .= ' OS: ' . php_uname() . PHP_EOL; $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL; $report .= ' The version of the OpenAPI document: 2.0.0' . PHP_EOL; - $report .= ' SDK Package Version: 1.1.0' . PHP_EOL; + $report .= ' SDK Package Version: 1.2.0' . PHP_EOL; $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; return $report; diff --git a/lib/Model/SetupFlowCancelRequest.php b/lib/Model/SetupFlowCancelRequest.php index c0e6976..3560055 100644 --- a/lib/Model/SetupFlowCancelRequest.php +++ b/lib/Model/SetupFlowCancelRequest.php @@ -58,7 +58,7 @@ class SetupFlowCancelRequest implements ModelInterface, ArrayAccess, \JsonSerial * @var string[] */ protected static $openAPITypes = [ - 'cancellationReason' => '\PAYJPV2\Model\SetupFlowCancellationReason', + 'cancellationReason' => 'string', ]; /** @@ -229,6 +229,23 @@ public function getModelName() return self::$openAPIModelName; } + public const CANCELLATION_REASON_ABANDONED = 'abandoned'; + public const CANCELLATION_REASON_DUPLICATE = 'duplicate'; + public const CANCELLATION_REASON_REQUESTED_BY_CUSTOMER = 'requested_by_customer'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCancellationReasonAllowableValues() + { + return [ + self::CANCELLATION_REASON_ABANDONED, + self::CANCELLATION_REASON_DUPLICATE, + self::CANCELLATION_REASON_REQUESTED_BY_CUSTOMER, + ]; + } /** * Associative array for storing property values @@ -275,6 +292,15 @@ public function listInvalidProperties() { $invalidProperties = []; + $allowedValues = $this->getCancellationReasonAllowableValues(); + if (! is_null($this->container['cancellationReason']) && ! in_array($this->container['cancellationReason'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'cancellationReason', must be one of '%s'", + $this->container['cancellationReason'], + implode("', '", $allowedValues) + ); + } + return $invalidProperties; } @@ -293,9 +319,9 @@ public function valid() /** * Gets cancellationReason * - * @return \PAYJPV2\Model\SetupFlowCancellationReason|null + * @return string|null */ - public function getCancellationReason(): ?\PAYJPV2\Model\SetupFlowCancellationReason + public function getCancellationReason(): ?string { return $this->container['cancellationReason']; } @@ -303,15 +329,25 @@ public function getCancellationReason(): ?\PAYJPV2\Model\SetupFlowCancellationRe /** * Sets cancellationReason * - * @param \PAYJPV2\Model\SetupFlowCancellationReason|null $cancellationReason この SetupFlow のキャンセル理由。 | 値 | |:---| | **abandoned**: 顧客が SetupFlow を完了しなかった場合。 | | **requested_by_customer**: 顧客がキャンセルを要求した場合。 | | **duplicate**: 支払い方法が重複している場合。 | + * @param string|null $cancellationReason この SetupFlow のキャンセル理由。 | 値 | |:---| | **abandoned**: 顧客が SetupFlow を完了しなかった場合。 | | **requested_by_customer**: 顧客がキャンセルを要求した場合。 | | **duplicate**: 支払い方法が重複している場合。 | * * @return self */ - public function setCancellationReason(?\PAYJPV2\Model\SetupFlowCancellationReason $cancellationReason): self + public function setCancellationReason(?string $cancellationReason): self { if (is_null($cancellationReason)) { throw new \InvalidArgumentException('non-nullable cancellationReason cannot be null'); } + $allowedValues = $this->getCancellationReasonAllowableValues(); + if (! in_array($cancellationReason, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'cancellationReason', must be one of '%s'", + $cancellationReason, + implode("', '", $allowedValues) + ) + ); + } $this->container['cancellationReason'] = $cancellationReason; return $this; diff --git a/lib/Model/SetupFlowCancellationReason.php b/lib/Model/SetupFlowCancellationReason.php index 16e3ad2..1f51498 100644 --- a/lib/Model/SetupFlowCancellationReason.php +++ b/lib/Model/SetupFlowCancellationReason.php @@ -41,6 +41,7 @@ enum SetupFlowCancellationReason: string { case ABANDONED = 'abandoned'; case DUPLICATE = 'duplicate'; + case EXPIRED = 'expired'; case REQUESTED_BY_CUSTOMER = 'requested_by_customer'; /** diff --git a/test/Api/CheckoutSessionsApiTest.php b/test/Api/CheckoutSessionsApiTest.php index ca933f4..fc99f06 100644 --- a/test/Api/CheckoutSessionsApiTest.php +++ b/test/Api/CheckoutSessionsApiTest.php @@ -80,6 +80,18 @@ public function testCreateCheckoutSession() self::markTestIncomplete('Not implemented'); } + /** + * Test case for expireCheckoutSession + * + * Expire Checkout Session. + * + */ + public function testExpireCheckoutSession() + { + // TODO: implement + self::markTestIncomplete('Not implemented'); + } + /** * Test case for getAllCheckoutSessionLineItems *