diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ca1e3b4..35b9a8f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,48 +1,26 @@ -name: Release +name: release on: - push: - tags: - - 'v*' + release: + types: [published] jobs: - release: + test: runs-on: ubuntu-latest + permissions: + contents: read steps: - - uses: actions/checkout@v4 - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: '8.1' - extensions: curl, json, mbstring - - - name: Install dependencies - run: composer install --no-dev --optimize-autoloader - - - name: Run tests - run: | - composer install --dev - vendor/bin/phpunit - - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref }} - release_name: Release ${{ github.ref }} - draft: false - prerelease: false - body: | - ## Changes + - uses: actions/checkout@v4 - See the [CHANGELOG](CHANGELOG.md) for details. + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: "8.1" + extensions: curl, json, mbstring - ## Installation + - name: Install dependencies + run: composer install --dev - ```bash - composer require payjp/payjpv2-php:${{ github.ref_name }} - ``` \ No newline at end of file + - name: Run tests + run: vendor/bin/phpunit diff --git a/README.md b/README.md index 37e9cd9..4614f1e 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.0.4` +- Package version: `1.0.5` - Generator version: `7.14.0` - Build package: `org.openapitools.codegen.languages.PhpClientCodegen` @@ -93,6 +93,8 @@ Class | Method | HTTP request | Description *CustomersApi* | [**updateCustomer**](docs/Api/CustomersApi.md#updatecustomer) | **POST** /v2/customers/{customer_id} | Update Customer *EventsApi* | [**getAllEvents**](docs/Api/EventsApi.md#getallevents) | **GET** /v2/events | Get All Events *EventsApi* | [**getEvent**](docs/Api/EventsApi.md#getevent) | **GET** /v2/events/{event_id} | Get Event +*PaymentDisputesApi* | [**getAllPaymentDisputes**](docs/Api/PaymentDisputesApi.md#getallpaymentdisputes) | **GET** /v2/payment_disputes | Get All Payment Disputes +*PaymentDisputesApi* | [**getPaymentDispute**](docs/Api/PaymentDisputesApi.md#getpaymentdispute) | **GET** /v2/payment_disputes/{payment_dispute_id} | Get Payment Dispute *PaymentFlowsApi* | [**cancelPaymentFlow**](docs/Api/PaymentFlowsApi.md#cancelpaymentflow) | **POST** /v2/payment_flows/{payment_flow_id}/cancel | Cancel Payment Flow *PaymentFlowsApi* | [**capturePaymentFlow**](docs/Api/PaymentFlowsApi.md#capturepaymentflow) | **POST** /v2/payment_flows/{payment_flow_id}/capture | Capture Payment Flow *PaymentFlowsApi* | [**confirmPaymentFlow**](docs/Api/PaymentFlowsApi.md#confirmpaymentflow) | **POST** /v2/payment_flows/{payment_flow_id}/confirm | Confirm Payment Flow @@ -180,6 +182,10 @@ Class | Method | HTTP request | Description - [Locale](docs/Model/Locale.md) - [MetadataValue](docs/Model/MetadataValue.md) - [PayPayConfigRequest](docs/Model/PayPayConfigRequest.md) +- [PaymentDisputeListResponse](docs/Model/PaymentDisputeListResponse.md) +- [PaymentDisputeReason](docs/Model/PaymentDisputeReason.md) +- [PaymentDisputeResponse](docs/Model/PaymentDisputeResponse.md) +- [PaymentDisputeStatus](docs/Model/PaymentDisputeStatus.md) - [PaymentFlowCancelRequest](docs/Model/PaymentFlowCancelRequest.md) - [PaymentFlowCancellationReason](docs/Model/PaymentFlowCancellationReason.md) - [PaymentFlowCaptureRequest](docs/Model/PaymentFlowCaptureRequest.md) @@ -300,6 +306,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.0.4` +- Package version: `1.0.5` - Generator version: `7.14.0` - Build package: `org.openapitools.codegen.languages.PhpClientCodegen` diff --git a/docs/Api/PaymentDisputesApi.md b/docs/Api/PaymentDisputesApi.md new file mode 100644 index 0000000..555ef9a --- /dev/null +++ b/docs/Api/PaymentDisputesApi.md @@ -0,0 +1,143 @@ +# PAYJPV2\PaymentDisputesApi + +All URIs are relative to https://api.pay.jp, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**getAllPaymentDisputes()**](PaymentDisputesApi.md#getAllPaymentDisputes) | **GET** /v2/payment_disputes | Get All Payment Disputes | +| [**getPaymentDispute()**](PaymentDisputesApi.md#getPaymentDispute) | **GET** /v2/payment_disputes/{payment_dispute_id} | Get Payment Dispute | + + +## `getAllPaymentDisputes()` + +```php +getAllPaymentDisputes($limit, $startingAfter, $endingBefore, $paymentFlowId, $status): \PAYJPV2\Model\PaymentDisputeListResponse +``` + +Get All Payment Disputes + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure Bearer authorization: HTTPBearer +$config = PAYJPV2\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new PAYJPV2\Api\PaymentDisputesApi( + // 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 +); +$limit = 10; // int | 取得するデータの最大件数 +$startingAfter = 'startingAfter_example'; // string | このIDより後のデータを取得 +$endingBefore = 'endingBefore_example'; // string | このIDより前のデータを取得 +$paymentFlowId = 'paymentFlowId_example'; // string | 取得する payment_dispute に紐づく payment_flow の ID +$status = array(new \PAYJPV2\Model\\PAYJPV2\Model\PaymentDisputeStatus()); // \PAYJPV2\Model\PaymentDisputeStatus[] | 取得する payment_dispute のステータス。複数指定可能 + +try { + $result = $apiInstance->getAllPaymentDisputes($limit, $startingAfter, $endingBefore, $paymentFlowId, $status); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PaymentDisputesApi->getAllPaymentDisputes: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **limit** | **int**| 取得するデータの最大件数 | [optional] [default to 10] | +| **startingAfter** | **string**| このIDより後のデータを取得 | [optional] | +| **endingBefore** | **string**| このIDより前のデータを取得 | [optional] | +| **paymentFlowId** | **string**| 取得する payment_dispute に紐づく payment_flow の ID | [optional] | +| **status** | [**\PAYJPV2\Model\PaymentDisputeStatus[]**](../Model/\PAYJPV2\Model\PaymentDisputeStatus.md)| 取得する payment_dispute のステータス。複数指定可能 | [optional] | + +### Return type + +[**\PAYJPV2\Model\PaymentDisputeListResponse**](../Model/PaymentDisputeListResponse.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) + +## `getPaymentDispute()` + +```php +getPaymentDispute($paymentDisputeId): \PAYJPV2\Model\PaymentDisputeResponse +``` + +Get Payment Dispute + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure Bearer authorization: HTTPBearer +$config = PAYJPV2\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new PAYJPV2\Api\PaymentDisputesApi( + // 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 +); +$paymentDisputeId = 'paymentDisputeId_example'; // string + +try { + $result = $apiInstance->getPaymentDispute($paymentDisputeId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PaymentDisputesApi->getPaymentDispute: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **paymentDisputeId** | **string**| | | + +### Return type + +[**\PAYJPV2\Model\PaymentDisputeResponse**](../Model/PaymentDisputeResponse.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) diff --git a/docs/Model/CheckoutSessionLineItemDataResponse.md b/docs/Model/CheckoutSessionLineItemDataResponse.md index e5801db..9b97965 100644 --- a/docs/Model/CheckoutSessionLineItemDataResponse.md +++ b/docs/Model/CheckoutSessionLineItemDataResponse.md @@ -10,7 +10,7 @@ Name | Type | Description | Notes **amountTax** | **int** | 税額 | **amountTotal** | **int** | 割引と税金が適用された後のすべての商品の合計金額 | **currency** | [**\PAYJPV2\Model\Currency**](Currency.md) | 価格の通貨。現在は `jpy` のみサポートしています。 | -**description** | **string** | 説明 | +**description** | **string** | | **price** | [**\PAYJPV2\Model\PriceDetailsResponse**](PriceDetailsResponse.md) | 料金情報 | **quantity** | **int** | 数量 | diff --git a/docs/Model/PaymentDisputeListResponse.md b/docs/Model/PaymentDisputeListResponse.md new file mode 100644 index 0000000..65f348c --- /dev/null +++ b/docs/Model/PaymentDisputeListResponse.md @@ -0,0 +1,12 @@ +# # PaymentDisputeListResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | | [optional] [default to 'list'] +**url** | **string** | リスト取得URL | +**hasMore** | **bool** | 次のページがあるかどうか | +**data** | [**\PAYJPV2\Model\PaymentDisputeResponse[]**](PaymentDisputeResponse.md) | PaymentDispute リスト | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/PaymentDisputeReason.md b/docs/Model/PaymentDisputeReason.md new file mode 100644 index 0000000..fb4216a --- /dev/null +++ b/docs/Model/PaymentDisputeReason.md @@ -0,0 +1,8 @@ +# # PaymentDisputeReason + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/PaymentDisputeResponse.md b/docs/Model/PaymentDisputeResponse.md new file mode 100644 index 0000000..66c6870 --- /dev/null +++ b/docs/Model/PaymentDisputeResponse.md @@ -0,0 +1,21 @@ +# # PaymentDisputeResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | | [optional] [default to 'payment_dispute'] +**id** | **string** | PaymentDispute ID | +**livemode** | **bool** | 本番環境かどうか | +**paymentFlowId** | **string** | 関連する PaymentFlow の ID | +**amount** | **int** | 金額 | +**currency** | [**\PAYJPV2\Model\Currency**](Currency.md) | 通貨コード (ISO 4217) | +**status** | [**\PAYJPV2\Model\PaymentDisputeStatus**](PaymentDisputeStatus.md) | disputeのステータス | 値 | |:---| | **pre_warning_needs_response**: 利用照会 | | **warning_needs_response**: 配送保留 | | **warning_needs_refund**: 配送停止 | | **warning_under_review**: 加盟店回答済 | | **needs_response**: チャージバック | | **under_review**: 反証済 | | **lost**: チャージバック受入 | | **cancel**: 取下げ | | +**reason** | [**\PAYJPV2\Model\PaymentDisputeReason**](PaymentDisputeReason.md) | | +**dueBy** | **\DateTime** | | +**paymentMethodType** | [**\PAYJPV2\Model\PaymentMethodTypes**](PaymentMethodTypes.md) | 支払い方法の種類 | +**metadata** | [**array**](MetadataValue.md) | メタデータ | +**createdAt** | **\DateTime** | 作成日時 (UTC, ISO 8601 形式) | +**updatedAt** | **\DateTime** | 更新日時 (UTC, ISO 8601 形式) | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/PaymentDisputeStatus.md b/docs/Model/PaymentDisputeStatus.md new file mode 100644 index 0000000..d9096f7 --- /dev/null +++ b/docs/Model/PaymentDisputeStatus.md @@ -0,0 +1,8 @@ +# # PaymentDisputeStatus + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/PaymentFlowConfirmRequest.md b/docs/Model/PaymentFlowConfirmRequest.md index d340142..929a44b 100644 --- a/docs/Model/PaymentFlowConfirmRequest.md +++ b/docs/Model/PaymentFlowConfirmRequest.md @@ -7,7 +7,7 @@ Name | Type | Description | Notes **paymentMethodId** | **string** | 支払い方法 ID。customer_id の指定が必須です。Customer が所持する PaymentMethod のみ指定できます。payment_method_id を指定せず、Customer に default_payment_method_id が設定されている場合はそちらが自動でセットされます。 | [optional] **paymentMethodOptions** | [**\PAYJPV2\Model\PaymentFlowPaymentMethodOptionsRequest**](PaymentFlowPaymentMethodOptionsRequest.md) | この PaymentFlow 固有の支払い方法の設定 | [optional] **paymentMethodTypes** | [**\PAYJPV2\Model\PaymentMethodTypes[]**](PaymentMethodTypes.md) | この PaymentFlow で使用できる支払い方法の種類のリスト。指定しない場合は、PAY.JP は支払い方法の設定から利用可能な支払い方法を動的に表示します。 | [optional] -**captureMethod** | [**\PAYJPV2\Model\CaptureMethod**](CaptureMethod.md) | 支払いの確定方法を指定します。 | 値 | |:---| | **automatic**: (デフォルト) 顧客が支払いを承認すると、自動的に確定させます。 | | **manual**: 顧客が支払いを承認すると一旦確定を保留し、後で Capture API を使用して確定します。(すべての支払い方法がこれをサポートしているわけではありません)。 | | [optional] +**captureMethod** | [**\PAYJPV2\Model\CaptureMethod**](CaptureMethod.md) | 支払いの確定方法を指定します。 | 値 | |:---| | **automatic**: (デフォルト) 顧客が支払いを承認すると、自動的に確定させます。 | | **manual**: 顧客が支払いを承認すると一旦確定を保留し、後で Payment Flow の Capture API を使用して確定します。(すべての支払い方法がこれをサポートしているわけではありません)。 | | [optional] **returnUrl** | **string** | 顧客が支払いを完了後かキャンセルした後にリダイレクトされる URL。アプリにリダイレクトしたい場合は URI Scheme を指定できます。 | [optional] **description** | **string** | オブジェクトにセットする任意の文字列。ユーザーには表示されません。 | [optional] diff --git a/docs/Model/PaymentFlowCreateRequest.md b/docs/Model/PaymentFlowCreateRequest.md index 763d4d4..f228dcf 100644 --- a/docs/Model/PaymentFlowCreateRequest.md +++ b/docs/Model/PaymentFlowCreateRequest.md @@ -10,7 +10,7 @@ Name | Type | Description | Notes **paymentMethodOptions** | [**\PAYJPV2\Model\PaymentFlowPaymentMethodOptionsRequest**](PaymentFlowPaymentMethodOptionsRequest.md) | この PaymentFlow 固有の支払い方法の設定 | [optional] **paymentMethodTypes** | [**\PAYJPV2\Model\PaymentMethodTypes[]**](PaymentMethodTypes.md) | この PaymentFlow で使用できる支払い方法の種類のリスト。指定しない場合は、PAY.JP は支払い方法の設定から利用可能な支払い方法を動的に表示します。 | [optional] **currency** | [**\PAYJPV2\Model\Currency**](Currency.md) | 価格の通貨。現在は `jpy` のみサポートしています。 | -**captureMethod** | [**\PAYJPV2\Model\CaptureMethod**](CaptureMethod.md) | 支払いの確定方法を指定します。 | 値 | |:---| | **automatic**: (デフォルト) 顧客が支払いを承認すると、自動的に確定させます。 | | **manual**: 顧客が支払いを承認すると一旦確定を保留し、後で Capture API を使用して確定します。(すべての支払い方法がこれをサポートしているわけではありません)。 | | [optional] +**captureMethod** | [**\PAYJPV2\Model\CaptureMethod**](CaptureMethod.md) | 支払いの確定方法を指定します。 | 値 | |:---| | **automatic**: (デフォルト) 顧客が支払いを承認すると、自動的に確定させます。 | | **manual**: 顧客が支払いを承認すると一旦確定を保留し、後で Payment Flow の Capture API を使用して確定します。(すべての支払い方法がこれをサポートしているわけではありません)。 | | [optional] **confirm** | **bool** | 「true」に設定すると、この PaymentFlow を直ちに確定しようと試みます。 | [optional] [default to false] **returnUrl** | **string** | 顧客が支払いを完了後かキャンセルした後にリダイレクトされる URL。アプリにリダイレクトしたい場合は URI Scheme を指定できます。confirm=true の場合のみ指定できます。 | [optional] **description** | **string** | オブジェクトにセットする任意の文字列。ユーザーには表示されません。 | [optional] diff --git a/docs/Model/PaymentFlowDataRequest.md b/docs/Model/PaymentFlowDataRequest.md index b8ed4c8..67082a8 100644 --- a/docs/Model/PaymentFlowDataRequest.md +++ b/docs/Model/PaymentFlowDataRequest.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**captureMethod** | [**\PAYJPV2\Model\CaptureMethod**](CaptureMethod.md) | 支払いの確定方法を指定します。 | 指定できる値 | |:---| | **automatic**: 顧客が支払いを承認すると自動的に確定します。 | | **manual**: 顧客が支払いを承認すると一旦確定を保留し、後で Capture API を使用して確定します。(すべての支払い方法がこれをサポートしているわけではありません)。 | | [optional] +**captureMethod** | [**\PAYJPV2\Model\CaptureMethod**](CaptureMethod.md) | 支払いの確定方法を指定します。 | 指定できる値 | |:---| | **automatic**: 顧客が支払いを承認すると自動的に確定します。 | | **manual**: 顧客が支払いを承認すると一旦確定を保留し、後で Payment Flow の Capture API を使用して確定します。(すべての支払い方法がこれをサポートしているわけではありません)。 | | [optional] **metadata** | [**array**](MetadataValue.md) | キーバリューの任意のデータを格納できます。20件まで登録可能で、空文字列を指定するとそのキーを削除できます。<a href=\"https://docs.pay.jp/v2/guide/developers/metadata\">詳細はメタデータのドキュメントを参照してください。</a> | [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/PaymentDisputesApi.php b/lib/Api/PaymentDisputesApi.php new file mode 100644 index 0000000..c3ff296 --- /dev/null +++ b/lib/Api/PaymentDisputesApi.php @@ -0,0 +1,887 @@ + [ + 'application/json', + ], + 'getPaymentDispute' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation getAllPaymentDisputes + * + * Get All Payment Disputes + * + * @param int|null $limit 取得するデータの最大件数 (optional, default to 10) + * @param string|null $startingAfter このIDより後のデータを取得 (optional) + * @param string|null $endingBefore このIDより前のデータを取得 (optional) + * @param string|null $paymentFlowId 取得する payment_dispute に紐づく payment_flow の ID (optional) + * @param \PAYJPV2\Model\PaymentDisputeStatus[]|null $status 取得する payment_dispute のステータス。複数指定可能 (optional) + * @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\PaymentDisputeListResponse|\PAYJPV2\Model\ErrorResponse|\PAYJPV2\Model\ErrorResponse + */ + public function getAllPaymentDisputes($limit = 10, $startingAfter = null, $endingBefore = null, $paymentFlowId = null, $status = null, ?string $idempotencyKey = null) + { + list($response) = $this->getAllPaymentDisputesWithHttpInfo($limit, $startingAfter, $endingBefore, $paymentFlowId, $status, $idempotencyKey); + + return $response; + } + + /** + * Operation getAllPaymentDisputesWithHttpInfo + * + * Get All Payment Disputes + * + * @param int|null $limit 取得するデータの最大件数 (optional, default to 10) + * @param string|null $startingAfter このIDより後のデータを取得 (optional) + * @param string|null $endingBefore このIDより前のデータを取得 (optional) + * @param string|null $paymentFlowId 取得する payment_dispute に紐づく payment_flow の ID (optional) + * @param \PAYJPV2\Model\PaymentDisputeStatus[]|null $status 取得する payment_dispute のステータス。複数指定可能 (optional) + * @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\PaymentDisputeListResponse|\PAYJPV2\Model\ErrorResponse|\PAYJPV2\Model\ErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function getAllPaymentDisputesWithHttpInfo($limit = 10, $startingAfter = null, $endingBefore = null, $paymentFlowId = null, $status = null, ?string $idempotencyKey = null) + { + $request = $this->getAllPaymentDisputesRequest($limit, $startingAfter, $endingBefore, $paymentFlowId, $status, $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\PaymentDisputeListResponse', + $request, + $response, + ); + case 422: + 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\PaymentDisputeListResponse', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\PAYJPV2\Model\PaymentDisputeListResponse', + $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 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\PAYJPV2\Model\ErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + + throw $e; + } + + + throw $e; + } + } + + /** + * Operation getAllPaymentDisputesAsync + * + * Get All Payment Disputes + * + * @param int|null $limit 取得するデータの最大件数 (optional, default to 10) + * @param string|null $startingAfter このIDより後のデータを取得 (optional) + * @param string|null $endingBefore このIDより前のデータを取得 (optional) + * @param string|null $paymentFlowId 取得する payment_dispute に紐づく payment_flow の ID (optional) + * @param \PAYJPV2\Model\PaymentDisputeStatus[]|null $status 取得する payment_dispute のステータス。複数指定可能 (optional) + * @param string|null $idempotencyKey Idempotency key for the request + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAllPaymentDisputesAsync($limit = 10, $startingAfter = null, $endingBefore = null, $paymentFlowId = null, $status = null, ?string $idempotencyKey = null) + { + return $this->getAllPaymentDisputesAsyncWithHttpInfo($limit, $startingAfter, $endingBefore, $paymentFlowId, $status, $idempotencyKey) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getAllPaymentDisputesAsyncWithHttpInfo + * + * Get All Payment Disputes + * + * @param int|null $limit 取得するデータの最大件数 (optional, default to 10) + * @param string|null $startingAfter このIDより後のデータを取得 (optional) + * @param string|null $endingBefore このIDより前のデータを取得 (optional) + * @param string|null $paymentFlowId 取得する payment_dispute に紐づく payment_flow の ID (optional) + * @param \PAYJPV2\Model\PaymentDisputeStatus[]|null $status 取得する payment_dispute のステータス。複数指定可能 (optional) + * @param string|null $idempotencyKey Idempotency key for the request + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAllPaymentDisputesAsyncWithHttpInfo($limit = 10, $startingAfter = null, $endingBefore = null, $paymentFlowId = null, $status = null, ?string $idempotencyKey = null) + { + $returnType = '\PAYJPV2\Model\PaymentDisputeListResponse'; + $request = $this->getAllPaymentDisputesRequest($limit, $startingAfter, $endingBefore, $paymentFlowId, $status, $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 'getAllPaymentDisputes' + * + * @param int|null $limit 取得するデータの最大件数 (optional, default to 10) + * @param string|null $startingAfter このIDより後のデータを取得 (optional) + * @param string|null $endingBefore このIDより前のデータを取得 (optional) + * @param string|null $paymentFlowId 取得する payment_dispute に紐づく payment_flow の ID (optional) + * @param \PAYJPV2\Model\PaymentDisputeStatus[]|null $status 取得する payment_dispute のステータス。複数指定可能 (optional) + * @param string|null $idempotencyKey Idempotency key for the request + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getAllPaymentDisputesRequest($limit = 10, $startingAfter = null, $endingBefore = null, $paymentFlowId = null, $status = null, ?string $idempotencyKey = null) + { + + if ($limit !== null && $limit > 100) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling PaymentDisputesApi.getAllPaymentDisputes, must be smaller than or equal to 100.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling PaymentDisputesApi.getAllPaymentDisputes, must be bigger than or equal to 1.'); + } + + + + + + + $resourcePath = '/v2/payment_disputes'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // idempotency key + if ($idempotencyKey !== null) { + $headerParams['Idempotency-Key'] = $idempotencyKey; + } + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $startingAfter, + 'starting_after', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $endingBefore, + 'ending_before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $paymentFlowId, + 'payment_flow_id', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $status, + 'status', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getPaymentDispute + * + * Get Payment Dispute + * + * @param string $paymentDisputeId paymentDisputeId (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\PaymentDisputeResponse|\PAYJPV2\Model\ErrorResponse|\PAYJPV2\Model\ErrorResponse + */ + public function getPaymentDispute($paymentDisputeId, ?string $idempotencyKey = null) + { + list($response) = $this->getPaymentDisputeWithHttpInfo($paymentDisputeId, $idempotencyKey); + + return $response; + } + + /** + * Operation getPaymentDisputeWithHttpInfo + * + * Get Payment Dispute + * + * @param string $paymentDisputeId (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\PaymentDisputeResponse|\PAYJPV2\Model\ErrorResponse|\PAYJPV2\Model\ErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function getPaymentDisputeWithHttpInfo($paymentDisputeId, ?string $idempotencyKey = null) + { + $request = $this->getPaymentDisputeRequest($paymentDisputeId, $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\PaymentDisputeResponse', + $request, + $response, + ); + case 422: + return $this->handleResponseWithDataType( + '\PAYJPV2\Model\ErrorResponse', + $request, + $response, + ); + case 404: + 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\PaymentDisputeResponse', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\PAYJPV2\Model\PaymentDisputeResponse', + $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; + } + + + throw $e; + } + } + + /** + * Operation getPaymentDisputeAsync + * + * Get Payment Dispute + * + * @param string $paymentDisputeId (required) + * @param string|null $idempotencyKey Idempotency key for the request + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getPaymentDisputeAsync($paymentDisputeId, ?string $idempotencyKey = null) + { + return $this->getPaymentDisputeAsyncWithHttpInfo($paymentDisputeId, $idempotencyKey) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getPaymentDisputeAsyncWithHttpInfo + * + * Get Payment Dispute + * + * @param string $paymentDisputeId (required) + * @param string|null $idempotencyKey Idempotency key for the request + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getPaymentDisputeAsyncWithHttpInfo($paymentDisputeId, ?string $idempotencyKey = null) + { + $returnType = '\PAYJPV2\Model\PaymentDisputeResponse'; + $request = $this->getPaymentDisputeRequest($paymentDisputeId, $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 'getPaymentDispute' + * + * @param string $paymentDisputeId (required) + * @param string|null $idempotencyKey Idempotency key for the request + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getPaymentDisputeRequest($paymentDisputeId, ?string $idempotencyKey = null) + { + + // verify the required parameter 'paymentDisputeId' is set + if ($paymentDisputeId === null || (is_array($paymentDisputeId) && count($paymentDisputeId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $paymentDisputeId when calling getPaymentDispute' + ); + } + + + $resourcePath = '/v2/payment_disputes/{payment_dispute_id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // idempotency key + if ($idempotencyKey !== null) { + $headerParams['Idempotency-Key'] = $idempotencyKey; + } + + + + // path params + if ($paymentDisputeId !== null) { + $resourcePath = str_replace( + '{' . 'payment_dispute_id' . '}', + ObjectSerializer::toPathValue($paymentDisputeId), + $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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (! $options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } + + private function handleResponseWithDataType( + string $dataType, + RequestInterface $request, + ResponseInterface $response + ): array { + if ($dataType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($dataType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $dataType, []), + $response->getStatusCode(), + $response->getHeaders(), + ]; + } + + private function responseWithinRangeCode( + string $rangeCode, + int $statusCode + ): bool { + $left = (int) ($rangeCode[0].'00'); + $right = (int) ($rangeCode[0].'99'); + + return $statusCode >= $left && $statusCode <= $right; + } +} diff --git a/lib/Configuration.php b/lib/Configuration.php index 7eaf0a1..00d2324 100644 --- a/lib/Configuration.php +++ b/lib/Configuration.php @@ -101,7 +101,7 @@ class Configuration * * @var string */ - protected $userAgent = 'payjp/payjpv2 PHPBindings/1.0.4'; + protected $userAgent = 'payjp/payjpv2 PHPBindings/1.0.5'; /** * Debug switch (default set to false) @@ -339,7 +339,7 @@ public function getUserAgent(): string public static function buildClientUserAgent(): string { $uaInfo = [ - 'bindings_version' => '1.0.4', + 'bindings_version' => '1.0.5', '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.0.4' . PHP_EOL; + $report .= ' SDK Package Version: 1.0.5' . PHP_EOL; $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; return $report; diff --git a/lib/Model/CheckoutSessionLineItemDataResponse.php b/lib/Model/CheckoutSessionLineItemDataResponse.php index 1777665..2b8194f 100644 --- a/lib/Model/CheckoutSessionLineItemDataResponse.php +++ b/lib/Model/CheckoutSessionLineItemDataResponse.php @@ -100,7 +100,7 @@ class CheckoutSessionLineItemDataResponse implements ModelInterface, ArrayAccess 'amountTax' => false, 'amountTotal' => false, 'currency' => false, - 'description' => false, + 'description' => true, 'price' => false, 'quantity' => false, ]; @@ -588,28 +588,31 @@ public function setCurrency(\PAYJPV2\Model\Currency $currency): self /** * Gets description * - * @return string + * @return string|null */ - public function getDescription(): string + public function getDescription(): ?string { - if ($this->container['description'] === null) { - throw new \LogicException('Property "description" is required but has not been set.'); - } - return $this->container['description']; } /** * Sets description * - * @param string $description 説明 + * @param string|null $description description * * @return self */ - public function setDescription(string $description): self + public function setDescription(?string $description): self { if (is_null($description)) { - throw new \InvalidArgumentException('non-nullable description cannot be null'); + array_push($this->openAPINullablesSetToNull, 'description'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('description', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } } $this->container['description'] = $description; diff --git a/lib/Model/PaymentDisputeListResponse.php b/lib/Model/PaymentDisputeListResponse.php new file mode 100644 index 0000000..3384feb --- /dev/null +++ b/lib/Model/PaymentDisputeListResponse.php @@ -0,0 +1,564 @@ + + */ +class PaymentDisputeListResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PaymentDisputeListResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'url' => 'string', + 'hasMore' => 'bool', + 'data' => '\PAYJPV2\Model\PaymentDisputeResponse[]', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'url' => null, + 'hasMore' => null, + 'data' => null, + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'object' => false, + 'url' => false, + 'hasMore' => false, + 'data' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'object' => 'object', + 'url' => 'url', + 'hasMore' => 'has_more', + 'data' => 'data', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'url' => 'setUrl', + 'hasMore' => 'setHasMore', + 'data' => 'setData', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'url' => 'getUrl', + 'hasMore' => 'getHasMore', + 'data' => 'getData', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const OBJECT__LIST = 'list'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT__LIST, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('object', $data ?? [], 'list'); + $this->setIfExists('url', $data ?? [], null); + $this->setIfExists('hasMore', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getObjectAllowableValues(); + if (! is_null($this->container['object']) && ! in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['url'] === null) { + $invalidProperties[] = "'url' can't be null"; + } + if ($this->container['hasMore'] === null) { + $invalidProperties[] = "'hasMore' can't be null"; + } + if ($this->container['data'] === null) { + $invalidProperties[] = "'data' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets object + * + * @return string|null + */ + public function getObject(): ?string + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object object + * + * @return self + */ + public function setObject(?string $object): self + { + if (is_null($object)) { + throw new \InvalidArgumentException('non-nullable object cannot be null'); + } + $allowedValues = $this->getObjectAllowableValues(); + if (! in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets url + * + * @return string + */ + public function getUrl(): string + { + if ($this->container['url'] === null) { + throw new \LogicException('Property "url" is required but has not been set.'); + } + + return $this->container['url']; + } + + /** + * Sets url + * + * @param string $url リスト取得URL + * + * @return self + */ + public function setUrl(string $url): self + { + if (is_null($url)) { + throw new \InvalidArgumentException('non-nullable url cannot be null'); + } + $this->container['url'] = $url; + + return $this; + } + + /** + * Gets hasMore + * + * @return bool + */ + public function getHasMore(): bool + { + if ($this->container['hasMore'] === null) { + throw new \LogicException('Property "hasMore" is required but has not been set.'); + } + + return $this->container['hasMore']; + } + + /** + * Sets hasMore + * + * @param bool $hasMore 次のページがあるかどうか + * + * @return self + */ + public function setHasMore(bool $hasMore): self + { + if (is_null($hasMore)) { + throw new \InvalidArgumentException('non-nullable hasMore cannot be null'); + } + $this->container['hasMore'] = $hasMore; + + return $this; + } + + /** + * Gets data + * + * @return \PAYJPV2\Model\PaymentDisputeResponse[] + */ + public function getData(): array + { + if ($this->container['data'] === null) { + throw new \LogicException('Property "data" is required but has not been set.'); + } + + return $this->container['data']; + } + + /** + * Sets data + * + * @param \PAYJPV2\Model\PaymentDisputeResponse[] $data PaymentDispute リスト + * + * @return self + */ + public function setData(array $data): self + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} diff --git a/lib/Model/PaymentDisputeReason.php b/lib/Model/PaymentDisputeReason.php new file mode 100644 index 0000000..acffe86 --- /dev/null +++ b/lib/Model/PaymentDisputeReason.php @@ -0,0 +1,66 @@ + + */ +class PaymentDisputeResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PaymentDisputeResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'id' => 'string', + 'livemode' => 'bool', + 'paymentFlowId' => 'string', + 'amount' => 'int', + 'currency' => '\PAYJPV2\Model\Currency', + 'status' => '\PAYJPV2\Model\PaymentDisputeStatus', + 'reason' => '\PAYJPV2\Model\PaymentDisputeReason', + 'dueBy' => '\DateTime', + 'paymentMethodType' => '\PAYJPV2\Model\PaymentMethodTypes', + 'metadata' => 'array', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'id' => null, + 'livemode' => null, + 'paymentFlowId' => null, + 'amount' => null, + 'currency' => null, + 'status' => null, + 'reason' => null, + 'dueBy' => 'date-time', + 'paymentMethodType' => null, + 'metadata' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'object' => false, + 'id' => false, + 'livemode' => false, + 'paymentFlowId' => false, + 'amount' => false, + 'currency' => false, + 'status' => false, + 'reason' => true, + 'dueBy' => true, + 'paymentMethodType' => false, + 'metadata' => false, + 'createdAt' => false, + 'updatedAt' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'object' => 'object', + 'id' => 'id', + 'livemode' => 'livemode', + 'paymentFlowId' => 'payment_flow_id', + 'amount' => 'amount', + 'currency' => 'currency', + 'status' => 'status', + 'reason' => 'reason', + 'dueBy' => 'due_by', + 'paymentMethodType' => 'payment_method_type', + 'metadata' => 'metadata', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'id' => 'setId', + 'livemode' => 'setLivemode', + 'paymentFlowId' => 'setPaymentFlowId', + 'amount' => 'setAmount', + 'currency' => 'setCurrency', + 'status' => 'setStatus', + 'reason' => 'setReason', + 'dueBy' => 'setDueBy', + 'paymentMethodType' => 'setPaymentMethodType', + 'metadata' => 'setMetadata', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'id' => 'getId', + 'livemode' => 'getLivemode', + 'paymentFlowId' => 'getPaymentFlowId', + 'amount' => 'getAmount', + 'currency' => 'getCurrency', + 'status' => 'getStatus', + 'reason' => 'getReason', + 'dueBy' => 'getDueBy', + 'paymentMethodType' => 'getPaymentMethodType', + 'metadata' => 'getMetadata', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const OBJECT_PAYMENT_DISPUTE = 'payment_dispute'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_PAYMENT_DISPUTE, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('object', $data ?? [], 'payment_dispute'); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('livemode', $data ?? [], null); + $this->setIfExists('paymentFlowId', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('reason', $data ?? [], null); + $this->setIfExists('dueBy', $data ?? [], null); + $this->setIfExists('paymentMethodType', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getObjectAllowableValues(); + if (! is_null($this->container['object']) && ! in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['livemode'] === null) { + $invalidProperties[] = "'livemode' can't be null"; + } + if ($this->container['paymentFlowId'] === null) { + $invalidProperties[] = "'paymentFlowId' can't be null"; + } + if ($this->container['amount'] === null) { + $invalidProperties[] = "'amount' can't be null"; + } + if ($this->container['currency'] === null) { + $invalidProperties[] = "'currency' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + if ($this->container['reason'] === null) { + $invalidProperties[] = "'reason' can't be null"; + } + if ($this->container['dueBy'] === null) { + $invalidProperties[] = "'dueBy' can't be null"; + } + if ($this->container['paymentMethodType'] === null) { + $invalidProperties[] = "'paymentMethodType' can't be null"; + } + if ($this->container['metadata'] === null) { + $invalidProperties[] = "'metadata' can't be null"; + } + if ($this->container['createdAt'] === null) { + $invalidProperties[] = "'createdAt' can't be null"; + } + if ($this->container['updatedAt'] === null) { + $invalidProperties[] = "'updatedAt' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets object + * + * @return string|null + */ + public function getObject(): ?string + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object object + * + * @return self + */ + public function setObject(?string $object): self + { + if (is_null($object)) { + throw new \InvalidArgumentException('non-nullable object cannot be null'); + } + $allowedValues = $this->getObjectAllowableValues(); + if (! in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets id + * + * @return string + */ + public function getId(): string + { + if ($this->container['id'] === null) { + throw new \LogicException('Property "id" is required but has not been set.'); + } + + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id PaymentDispute ID + * + * @return self + */ + public function setId(string $id): self + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets livemode + * + * @return bool + */ + public function getLivemode(): bool + { + if ($this->container['livemode'] === null) { + throw new \LogicException('Property "livemode" is required but has not been set.'); + } + + return $this->container['livemode']; + } + + /** + * Sets livemode + * + * @param bool $livemode 本番環境かどうか + * + * @return self + */ + public function setLivemode(bool $livemode): self + { + if (is_null($livemode)) { + throw new \InvalidArgumentException('non-nullable livemode cannot be null'); + } + $this->container['livemode'] = $livemode; + + return $this; + } + + /** + * Gets paymentFlowId + * + * @return string + */ + public function getPaymentFlowId(): string + { + if ($this->container['paymentFlowId'] === null) { + throw new \LogicException('Property "paymentFlowId" is required but has not been set.'); + } + + return $this->container['paymentFlowId']; + } + + /** + * Sets paymentFlowId + * + * @param string $paymentFlowId 関連する PaymentFlow の ID + * + * @return self + */ + public function setPaymentFlowId(string $paymentFlowId): self + { + if (is_null($paymentFlowId)) { + throw new \InvalidArgumentException('non-nullable paymentFlowId cannot be null'); + } + $this->container['paymentFlowId'] = $paymentFlowId; + + return $this; + } + + /** + * Gets amount + * + * @return int + */ + public function getAmount(): int + { + if ($this->container['amount'] === null) { + throw new \LogicException('Property "amount" is required but has not been set.'); + } + + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int $amount 金額 + * + * @return self + */ + public function setAmount(int $amount): self + { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets currency + * + * @return \PAYJPV2\Model\Currency + */ + public function getCurrency(): \PAYJPV2\Model\Currency + { + if ($this->container['currency'] === null) { + throw new \LogicException('Property "currency" is required but has not been set.'); + } + + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param \PAYJPV2\Model\Currency $currency 通貨コード (ISO 4217) + * + * @return self + */ + public function setCurrency(\PAYJPV2\Model\Currency $currency): self + { + if (is_null($currency)) { + throw new \InvalidArgumentException('non-nullable currency cannot be null'); + } + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets status + * + * @return \PAYJPV2\Model\PaymentDisputeStatus + */ + public function getStatus(): \PAYJPV2\Model\PaymentDisputeStatus + { + if ($this->container['status'] === null) { + throw new \LogicException('Property "status" is required but has not been set.'); + } + + return $this->container['status']; + } + + /** + * Sets status + * + * @param \PAYJPV2\Model\PaymentDisputeStatus $status disputeのステータス | 値 | |:---| | **pre_warning_needs_response**: 利用照会 | | **warning_needs_response**: 配送保留 | | **warning_needs_refund**: 配送停止 | | **warning_under_review**: 加盟店回答済 | | **needs_response**: チャージバック | | **under_review**: 反証済 | | **lost**: チャージバック受入 | | **cancel**: 取下げ | + * + * @return self + */ + public function setStatus(\PAYJPV2\Model\PaymentDisputeStatus $status): self + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets reason + * + * @return \PAYJPV2\Model\PaymentDisputeReason|null + */ + public function getReason(): ?\PAYJPV2\Model\PaymentDisputeReason + { + return $this->container['reason']; + } + + /** + * Sets reason + * + * @param \PAYJPV2\Model\PaymentDisputeReason|null $reason reason + * + * @return self + */ + public function setReason(?\PAYJPV2\Model\PaymentDisputeReason $reason): self + { + if (is_null($reason)) { + array_push($this->openAPINullablesSetToNull, 'reason'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('reason', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['reason'] = $reason; + + return $this; + } + + /** + * Gets dueBy + * + * @return \DateTime|null + */ + public function getDueBy(): ?\DateTime + { + return $this->container['dueBy']; + } + + /** + * Sets dueBy + * + * @param \DateTime|null $dueBy dueBy + * + * @return self + */ + public function setDueBy(?\DateTime $dueBy): self + { + if (is_null($dueBy)) { + array_push($this->openAPINullablesSetToNull, 'dueBy'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('dueBy', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['dueBy'] = $dueBy; + + return $this; + } + + /** + * Gets paymentMethodType + * + * @return \PAYJPV2\Model\PaymentMethodTypes + */ + public function getPaymentMethodType(): \PAYJPV2\Model\PaymentMethodTypes + { + if ($this->container['paymentMethodType'] === null) { + throw new \LogicException('Property "paymentMethodType" is required but has not been set.'); + } + + return $this->container['paymentMethodType']; + } + + /** + * Sets paymentMethodType + * + * @param \PAYJPV2\Model\PaymentMethodTypes $paymentMethodType 支払い方法の種類 + * + * @return self + */ + public function setPaymentMethodType(\PAYJPV2\Model\PaymentMethodTypes $paymentMethodType): self + { + if (is_null($paymentMethodType)) { + throw new \InvalidArgumentException('non-nullable paymentMethodType cannot be null'); + } + $this->container['paymentMethodType'] = $paymentMethodType; + + return $this; + } + + /** + * Gets metadata + * + * @return array + */ + public function getMetadata(): array + { + if ($this->container['metadata'] === null) { + throw new \LogicException('Property "metadata" is required but has not been set.'); + } + + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param array $metadata メタデータ + * + * @return self + */ + public function setMetadata(array $metadata): self + { + if (is_null($metadata)) { + throw new \InvalidArgumentException('non-nullable metadata cannot be null'); + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime + */ + public function getCreatedAt(): \DateTime + { + if ($this->container['createdAt'] === null) { + throw new \LogicException('Property "createdAt" is required but has not been set.'); + } + + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime $createdAt 作成日時 (UTC, ISO 8601 形式) + * + * @return self + */ + public function setCreatedAt(\DateTime $createdAt): self + { + if (is_null($createdAt)) { + throw new \InvalidArgumentException('non-nullable createdAt cannot be null'); + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime + */ + public function getUpdatedAt(): \DateTime + { + if ($this->container['updatedAt'] === null) { + throw new \LogicException('Property "updatedAt" is required but has not been set.'); + } + + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime $updatedAt 更新日時 (UTC, ISO 8601 形式) + * + * @return self + */ + public function setUpdatedAt(\DateTime $updatedAt): self + { + if (is_null($updatedAt)) { + throw new \InvalidArgumentException('non-nullable updatedAt cannot be null'); + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} diff --git a/lib/Model/PaymentDisputeStatus.php b/lib/Model/PaymentDisputeStatus.php new file mode 100644 index 0000000..9a16128 --- /dev/null +++ b/lib/Model/PaymentDisputeStatus.php @@ -0,0 +1,59 @@ +container['percentage'] === null) { $invalidProperties[] = "'percentage' can't be null"; } + if (($this->container['percentage'] > 100.0)) { + $invalidProperties[] = "invalid value for 'percentage', must be smaller than or equal to 100.0."; + } + + if (($this->container['percentage'] < 0.0)) { + $invalidProperties[] = "invalid value for 'percentage', must be bigger than or equal to 0.0."; + } return $invalidProperties; } @@ -430,6 +437,14 @@ public function setPercentage(float $percentage): self if (is_null($percentage)) { throw new \InvalidArgumentException('non-nullable percentage cannot be null'); } + + if (($percentage > 100.0)) { + throw new \InvalidArgumentException('invalid value for $percentage when calling TaxRateCreateRequest., must be smaller than or equal to 100.0.'); + } + if (($percentage < 0.0)) { + throw new \InvalidArgumentException('invalid value for $percentage when calling TaxRateCreateRequest., must be bigger than or equal to 0.0.'); + } + $this->container['percentage'] = $percentage; return $this; diff --git a/test/Api/PaymentDisputesApiTest.php b/test/Api/PaymentDisputesApiTest.php new file mode 100644 index 0000000..e3e9ea1 --- /dev/null +++ b/test/Api/PaymentDisputesApiTest.php @@ -0,0 +1,94 @@ +