diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index bb4f074..cd919b9 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,19 +1,19 @@ lockVersion: 2.0.0 id: 16ed6937-9038-4c34-a8b6-e4732948f250 management: - docChecksum: f165b9f63706338c45a9a3789dfb5d6a + docChecksum: e7882dd8869f79c086f107c4a91c4041 docVersion: 1.0.0 speakeasyVersion: 1.682.0 generationVersion: 2.791.1 - releaseVersion: 1.5.6 - configChecksum: fbf06f06cc705ea1b5cab7dab4aae861 + releaseVersion: 1.5.7 + configChecksum: bc5bd50215985b08648738069176b441 repoURL: https://github.com/gr4vy/gr4vy-php.git installationURL: https://github.com/gr4vy/gr4vy-php published: true persistentEdits: - generation_id: 006cf159-e2c3-4e8c-b43d-970415a5a85e - pristine_commit_hash: ba858711a7fdfee7d943932ba94a4b8e3b460e95 - pristine_tree_hash: 2d08e07c14622b2c8c05cfe18ab9638b740205b7 + generation_id: 88f919a3-44a1-41f5-bd2c-565eb57b9d92 + pristine_commit_hash: ab410af2f5c6fd6873e2040e82c1330a887155f5 + pristine_tree_hash: 45163a8d5a1babd561d191ac3df7fd6b101a0af1 features: php: constsAndDefaults: 0.2.0 @@ -1046,6 +1046,14 @@ trackedFiles: id: 4c27bc59f87e last_write_checksum: sha1:c1bc65f5b904b65386c12bfa9e2d26a9ff6fe89c pristine_git_object: 0d64e2dd29248868bc0b30744cff4498dfb51c0b + docs/ListTransactionActionsRequest.md: + id: 5328e0433fce + last_write_checksum: sha1:b6c25777eea54281b0c42cd5b00ff973874f9bde + pristine_git_object: a431d96c7d298db5bfaf3ac228c4b47aa2103566 + docs/ListTransactionActionsResponse.md: + id: f97152cb9a76 + last_write_checksum: sha1:6541e46d04ca83d20e1797b5af95fa035a4336c5 + pristine_git_object: 08a810ea8c514502621762858c2ca64b4ea7cdea docs/ListTransactionEventsRequest.md: id: ee1e4edf1013 last_write_checksum: sha1:0d031dc7981bcedc6852d71a78b652dbf6ea3053 @@ -1514,6 +1522,14 @@ trackedFiles: id: 330d2d285174 last_write_checksum: sha1:9a6a83080cc77684cfb0cb627aaeaec1de7d6226 pristine_git_object: 12391be58dc6e62963b1767032a4facd7d9b27d7 + docs/TransactionAction.md: + id: 2900fcefc2cd + last_write_checksum: sha1:75294119db6fdf846f306463ac6fcee0535fefcf + pristine_git_object: c706fdcf2d2bd5f0d87d20a78cfbd77c4b625bc0 + docs/TransactionActions.md: + id: 109ad01da636 + last_write_checksum: sha1:e9e3af4713a58aee1f44d5dca8fe853d9dbd6c7a + pristine_git_object: b9469937b3fb1a2d860e9dfb5eff71e260b407eb docs/TransactionBuyer.md: id: bf9c080ebca0 last_write_checksum: sha1:4f7ac3048c0d6cac5bbdfe3798201dde7990ca67 @@ -1778,6 +1794,10 @@ trackedFiles: id: 14d758019451 last_write_checksum: sha1:40330f21264353ae4fe3795264a8f26ec9d3f364 pristine_git_object: 5220c8009676a5d702816428ae5db5b5f2b01968 + docs/sdks/actions/README.md: + id: e229cf99e666 + last_write_checksum: sha1:13914515ed7a90a6ae4ab1f737835bae88312c6b + pristine_git_object: 001bbc46d6b35a34c38e2b9bca73dcb941ecafbc docs/sdks/all/README.md: id: 936653be5c4b last_write_checksum: sha1:7e356992c4c2a93ed031e2aeecd5c97aa7b68ffe @@ -1946,6 +1966,10 @@ trackedFiles: id: 7fe82af6bc98 last_write_checksum: sha1:08f71df3ef03e79d166c014167fe1e2126c9662d pristine_git_object: 0dc650553614a520a9f9b6cd12e9f7eeb8d9b661 + src/Actions.php: + id: 590076d9904e + last_write_checksum: sha1:06847f753521571352af8c4775c1d0ab5cbea957 + pristine_git_object: 39d2f7dad03ce2dc62a93de0d157dea086d14917 src/AddBuyerRequest.php: id: 61dd0ebcdff5 last_write_checksum: sha1:2508c4d7470384e0efdfd304e4c2636156a3b9c6 @@ -3030,6 +3054,14 @@ trackedFiles: id: d9c6f2c1bca2 last_write_checksum: sha1:d85535c761b7f54ef738ac59b63ab4fb4a9fa29d pristine_git_object: a21935145cb92f6f5e34277e7b10600de1488269 + src/ListTransactionActionsRequest.php: + id: 481ca7b60c92 + last_write_checksum: sha1:34f6004ad35df25681b46bb8db4067019654fecb + pristine_git_object: 3c6a9b66df157ee45ea3835937fc97e5a50dda81 + src/ListTransactionActionsResponse.php: + id: e8b0cde87058 + last_write_checksum: sha1:3f9249d1b38978edf6f19da29252edceba2199bb + pristine_git_object: 4c99740237bcee0f89b26bd2c130dfdc21a2506d src/ListTransactionEventsRequest.php: id: 4fad760b48ca last_write_checksum: sha1:b8f50fae86de5f77a9786ca139d5068a9b6dc1c5 @@ -3436,8 +3468,8 @@ trackedFiles: pristine_git_object: fb8e64f1afec3dd30a1c2bf6bb7d815735a56310 src/SDKConfiguration.php: id: 9d60ab0bec0b - last_write_checksum: sha1:c85efc4eff3a28470a19087e00be87817aee2d06 - pristine_git_object: 682ba8e163afad7332997b1b3189cdc43cde61ff + last_write_checksum: sha1:29da0a1836ecf3a954c04c664a3e730ae5f49560 + pristine_git_object: ee3dc085183d5fa9fd00fd1512435c50739215a1 src/Security.php: id: 07a9a9c51866 last_write_checksum: sha1:3269c1181e027ae914cfcb6964e32b238e280634 @@ -3526,6 +3558,14 @@ trackedFiles: id: fcc0c127e296 last_write_checksum: sha1:d3ef07b554ebcef1172983bbda06729c23a9e467 pristine_git_object: aeab61d49aa119687d692bd7a3c255ca7990c370 + src/TransactionAction.php: + id: a289b757a573 + last_write_checksum: sha1:55405df12c5c7241c39747b7dda9eba2ced6871e + pristine_git_object: dde0d1015a40d818b397bae4767f617916848d56 + src/TransactionActions.php: + id: 9e7f384e45a9 + last_write_checksum: sha1:5a84c25266ba1c8acc47ec1837e70d348db7f1f8 + pristine_git_object: 9adb0be69ce85465a29a98b649e345f49d2e076e src/TransactionBuyer.php: id: 48b476b823fd last_write_checksum: sha1:931ebccb3496ccbbe41bfd7c722be901bfbe6fc4 @@ -3604,8 +3644,8 @@ trackedFiles: pristine_git_object: 243b3c722c8ae49bb456d59ced264297b5cb553e src/Transactions.php: id: fb7274f4b525 - last_write_checksum: sha1:7922a67350761ea3d3c3582e1a182b6b8544a123 - pristine_git_object: ec9c8f6453f09be6fef2d69b2a76f395749c4a85 + last_write_checksum: sha1:7cb49f0f2d0d1e9bc7f665f1e4fd178ee105093c + pristine_git_object: 6b7f36b5e09bc6510c2ccd4dfeb60b49abacbfed src/TransactionsRefunds.php: id: b5ef579db238 last_write_checksum: sha1:c6744460d34c89fbf6d6f88eb13f166fa5e8632d @@ -7350,8 +7390,43 @@ examples: application/json: {"type": "error", "code": "bad_gateway", "status": 502, "message": "Request could not be processed"} "504": application/json: {"type": "error", "code": "gateway_timeout", "status": 504, "message": "Request could not be processed"} + list_transaction_actions: + speakeasy-default-list-transaction-actions: + parameters: + path: + transaction_id: "7099948d-7286-47e4-aad8-b68f7eb44591" + responses: + "200": + application/json: {"items": [{"type": "action", "id": "", "flow": "", "rule_id": "f133a3b7-e67e-4d83-bcd3-3e438fedf348", "created_at": "2013-07-16T19:23:00.000+00:00", "outcome": {"result": [{"instrument": "pan", "payment_service_id": "ce26a7d7-fec0-4d47-8efa-044a32b09bc6", "transformations": []}], "type": "card-routing", "version": 2}}]} + "400": + application/json: {"type": "error", "code": "bad_request", "status": 400, "message": "Request failed validation"} + "401": + application/json: {"type": "error", "code": "unauthorized", "status": 401, "message": "No valid API authentication found"} + "403": + application/json: {"type": "error", "code": "forbidden", "status": 403, "message": "Request failed validation"} + "404": + application/json: {"type": "error", "code": "not_found", "status": 404, "message": "The resource could not be found"} + "405": + application/json: {"type": "error", "code": "method_not_allowed", "status": 405, "message": "Method Not Allowed"} + "409": + application/json: {"type": "error", "code": "duplicate_record", "status": 409, "message": "Request failed validation"} + "422": + application/json: {} + "425": + application/json: {"type": "error", "code": "too_early", "status": 425, "message": "Request failed validation"} + "429": + application/json: {"type": "error", "code": "too_many_requests", "status": 429, "message": "Request failed validation"} + "500": + application/json: {"type": "error", "code": "server_error", "status": 500, "message": "Request could not be processed"} + "502": + application/json: {"type": "error", "code": "bad_gateway", "status": 502, "message": "Request could not be processed"} + "504": + application/json: {"type": "error", "code": "gateway_timeout", "status": 504, "message": "Request could not be processed"} examplesVersion: 1.0.2 generatedTests: {} +releaseNotes: | + ## Php SDK Changes: + * `sdk->transactions->actions->list()`: **Added** generatedFiles: - .gitattributes - USAGE.md diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 1c5622b..d3ed37e 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -27,7 +27,7 @@ generation: generateNewTests: false skipResponseBodyAssertions: false php: - version: 1.5.6 + version: 1.5.7 additionalDependencies: autoload: {} autoload-dev: {} diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index e1815f5..39a10b6 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -2,20 +2,20 @@ speakeasyVersion: 1.682.0 sources: openapi: sourceNamespace: openapi - sourceRevisionDigest: sha256:17dce8c2a5ab98ff487705be3fa52b4f620324a0e17d1ce17e217f5cf3710f73 - sourceBlobDigest: sha256:545fb042be39a80036f57f578ff8034f71a8545396072f8c860e7f5522cadbea + sourceRevisionDigest: sha256:01ae931aac746fadbdf20848aadd2a2add41d7c5fd53ace8095972666d8141de + sourceBlobDigest: sha256:0f61cc80083f74af21cb5d8bcaa96730356ff5b3d353ae433166a8bca4a5920a tags: - latest - - speakeasy-sdk-regen-1767785711 + - speakeasy-sdk-regen-1767805132 - 1.0.0 targets: php: source: openapi sourceNamespace: openapi - sourceRevisionDigest: sha256:17dce8c2a5ab98ff487705be3fa52b4f620324a0e17d1ce17e217f5cf3710f73 - sourceBlobDigest: sha256:545fb042be39a80036f57f578ff8034f71a8545396072f8c860e7f5522cadbea + sourceRevisionDigest: sha256:01ae931aac746fadbdf20848aadd2a2add41d7c5fd53ace8095972666d8141de + sourceBlobDigest: sha256:0f61cc80083f74af21cb5d8bcaa96730356ff5b3d353ae433166a8bca4a5920a codeSamplesNamespace: openapi-php-code-samples - codeSamplesRevisionDigest: sha256:872fc08bbddcc5dbde3a45e070287d893c760befc60cb0f1f594c262711d5383 + codeSamplesRevisionDigest: sha256:6ee76f420332c247f5679e03216a904e0cb75b5995d798caecbe4b19882d6bbe workflow: workflowVersion: 1.0.0 speakeasyVersion: latest diff --git a/README.md b/README.md index c23216c..b549f39 100644 --- a/README.md +++ b/README.md @@ -414,6 +414,10 @@ if ($response->accountUpdaterJob !== null) { * [cancel](docs/sdks/transactions/README.md#cancel) - Cancel transaction * [sync](docs/sdks/transactions/README.md#sync) - Sync transaction +#### [Transactions.Actions](docs/sdks/actions/README.md) + +* [list](docs/sdks/actions/README.md#list) - Get Flow actions for transaction + #### [Transactions.Events](docs/sdks/events/README.md) * [list](docs/sdks/events/README.md#list) - List transaction events diff --git a/RELEASES.md b/RELEASES.md index 096a945..f9b196c 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -918,4 +918,14 @@ Based on: ### Generated - [php v1.5.6] . ### Releases -- [Composer v1.5.6] https://packagist.org/packages/gr4vy/gr4vy-php#v1.5.6 - . \ No newline at end of file +- [Composer v1.5.6] https://packagist.org/packages/gr4vy/gr4vy-php#v1.5.6 - . + +## 2026-01-07 16:58:32 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.682.0 (2.791.1) https://github.com/speakeasy-api/speakeasy +### Generated +- [php v1.5.7] . +### Releases +- [Composer v1.5.7] https://packagist.org/packages/gr4vy/gr4vy-php#v1.5.7 - . \ No newline at end of file diff --git a/docs/ListTransactionActionsRequest.md b/docs/ListTransactionActionsRequest.md new file mode 100644 index 0000000..a431d96 --- /dev/null +++ b/docs/ListTransactionActionsRequest.md @@ -0,0 +1,9 @@ +# ListTransactionActionsRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | +| `transactionId` | *string* | :heavy_check_mark: | The ID of the transaction | 7099948d-7286-47e4-aad8-b68f7eb44591 | +| `merchantAccountId` | *?string* | :heavy_minus_sign: | The ID of the merchant account to use for this request. | default | \ No newline at end of file diff --git a/docs/ListTransactionActionsResponse.md b/docs/ListTransactionActionsResponse.md new file mode 100644 index 0000000..08a810e --- /dev/null +++ b/docs/ListTransactionActionsResponse.md @@ -0,0 +1,11 @@ +# ListTransactionActionsResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | +| `contentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [\Psr\Http\Message\ResponseInterface](https://www.php-fig.org/psr/psr-7/#33-psrhttpmessageresponseinterface) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `transactionActions` | [?TransactionActions](./TransactionActions.md) | :heavy_minus_sign: | Successful Response | \ No newline at end of file diff --git a/docs/TransactionAction.md b/docs/TransactionAction.md new file mode 100644 index 0000000..c706fdc --- /dev/null +++ b/docs/TransactionAction.md @@ -0,0 +1,13 @@ +# TransactionAction + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `type` | *?string* | :heavy_minus_sign: | Always `action`. | action | +| `id` | *string* | :heavy_check_mark: | N/A | | +| `flow` | *string* | :heavy_check_mark: | N/A | | +| `ruleId` | *string* | :heavy_check_mark: | The ID of the rule that triggered this action. | f133a3b7-e67e-4d83-bcd3-3e438fedf348 | +| `createdAt` | [\DateTime](https://www.php.net/manual/en/class.datetime.php) | :heavy_check_mark: | The date this action was created at. | 2013-07-16T19:23:00.000+00:00 | +| `outcome` | array | :heavy_check_mark: | The outcome of the action. | {
"result": [
{
"instrument": "pan",
"payment_service_id": "ce26a7d7-fec0-4d47-8efa-044a32b09bc6",
"transformations": []
}
],
"type": "card-routing",
"version": 2
} | \ No newline at end of file diff --git a/docs/TransactionActions.md b/docs/TransactionActions.md new file mode 100644 index 0000000..b946993 --- /dev/null +++ b/docs/TransactionActions.md @@ -0,0 +1,8 @@ +# TransactionActions + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | +| `items` | array<[TransactionAction](./TransactionAction.md)> | :heavy_check_mark: | The list of actions triggered for a transaction. | \ No newline at end of file diff --git a/docs/sdks/actions/README.md b/docs/sdks/actions/README.md new file mode 100644 index 0000000..001bbc4 --- /dev/null +++ b/docs/sdks/actions/README.md @@ -0,0 +1,68 @@ +# Transactions.Actions + +## Overview + +### Available Operations + +* [list](#list) - Get Flow actions for transaction + +## list + +Retrieve the list of Flow actions that have been triggered for a transaction. + +### Example Usage + + +```php +declare(strict_types=1); + +require 'vendor/autoload.php'; + +use Gr4vy; + +$sdk = Gr4vy\SDK::builder() + ->setMerchantAccountId('default') + ->setSecurity( + '' + ) + ->build(); + + + +$response = $sdk->transactions->actions->list( + transactionId: '7099948d-7286-47e4-aad8-b68f7eb44591' +); + +if ($response->transactionActions !== null) { + // handle response +} +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | +| `transactionId` | *string* | :heavy_check_mark: | The ID of the transaction | 7099948d-7286-47e4-aad8-b68f7eb44591 | +| `merchantAccountId` | *?string* | :heavy_minus_sign: | The ID of the merchant account to use for this request. | default | + +### Response + +**[?ListTransactionActionsResponse](../../ListTransactionActionsResponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| errors\Error400 | 400 | application/json | +| errors\Error401 | 401 | application/json | +| errors\Error403 | 403 | application/json | +| errors\Error404 | 404 | application/json | +| errors\Error405 | 405 | application/json | +| errors\Error409 | 409 | application/json | +| errors\HTTPValidationError | 422 | application/json | +| errors\Error425 | 425 | application/json | +| errors\Error429 | 429 | application/json | +| errors\Error500 | 500 | application/json | +| errors\Error502 | 502 | application/json | +| errors\Error504 | 504 | application/json | +| errors\APIException | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/src/Actions.php b/src/Actions.php new file mode 100644 index 0000000..39d2f7d --- /dev/null +++ b/src/Actions.php @@ -0,0 +1,274 @@ +sdkConfiguration = $sdkConfig; + } + /** + * @param string $baseUrl + * @param array $urlVariables + * + * @return string + */ + public function getUrl(string $baseUrl, array $urlVariables): string + { + $serverDetails = $this->sdkConfiguration->getServerDetails(); + + if ($baseUrl == null) { + $baseUrl = $serverDetails->baseUrl; + } + + if ($urlVariables == null) { + $urlVariables = $serverDetails->options; + } + + return Utils\Utils::templateUrl($baseUrl, $urlVariables); + } + + /** + * Get Flow actions for transaction + * + * Retrieve the list of Flow actions that have been triggered for a transaction. + * + * @param string $transactionId + * @param ?string $merchantAccountId + * @return ListTransactionActionsResponse + * @throws \Gr4vy\errors\APIException + */ + public function list(string $transactionId, ?string $merchantAccountId = null, ?Options $options = null): ListTransactionActionsResponse + { + $retryConfig = null; + if ($options) { + $retryConfig = $options->retryConfig; + } + if ($retryConfig === null && $this->sdkConfiguration->retryConfig) { + $retryConfig = $this->sdkConfiguration->retryConfig; + } else { + $retryConfig = new Retry\RetryConfigBackoff( + initialIntervalMs: 200, + maxIntervalMs: 200, + exponent: 1, + maxElapsedTimeMs: 1000, + retryConnectionErrors: true, + ); + } + $retryCodes = null; + if ($options) { + $retryCodes = $options->retryCodes; + } + if ($retryCodes === null) { + $retryCodes = [ + '5XX', + ]; + } + $request = new ListTransactionActionsRequest( + transactionId: $transactionId, + merchantAccountId: $merchantAccountId, + ); + $baseUrl = $this->sdkConfiguration->getTemplatedServerUrl(); + $url = Utils\Utils::generateUrl($baseUrl, '/transactions/{transaction_id}/actions', ListTransactionActionsRequest::class, $request, $this->sdkConfiguration->globals); + $urlOverride = null; + $httpOptions = ['http_errors' => false]; + $httpOptions = array_merge_recursive($httpOptions, Utils\Utils::getHeaders($request, $this->sdkConfiguration->globals)); + if (! array_key_exists('headers', $httpOptions)) { + $httpOptions['headers'] = []; + } + $httpOptions['headers']['Accept'] = 'application/json'; + $httpOptions['headers']['user-agent'] = $this->sdkConfiguration->userAgent; + $httpRequest = new \GuzzleHttp\Psr7\Request('GET', $url); + $hookContext = new HookContext($this->sdkConfiguration, $baseUrl, 'list_transaction_actions', null, $this->sdkConfiguration->securitySource); + $httpRequest = $this->sdkConfiguration->hooks->beforeRequest(new Hooks\BeforeRequestContext($hookContext), $httpRequest); + $httpOptions = Utils\Utils::convertHeadersToOptions($httpRequest, $httpOptions); + $httpRequest = Utils\Utils::removeHeaders($httpRequest); + try { + $httpResponse = RetryUtils::retryWrapper(fn () => $this->sdkConfiguration->client->send($httpRequest, $httpOptions), $retryConfig, $retryCodes); + } catch (\GuzzleHttp\Exception\GuzzleException $error) { + $res = $this->sdkConfiguration->hooks->afterError(new Hooks\AfterErrorContext($hookContext), null, $error); + $httpResponse = $res; + } + $contentType = $httpResponse->getHeader('Content-Type')[0] ?? ''; + + $statusCode = $httpResponse->getStatusCode(); + if (Utils\Utils::matchStatusCodes($statusCode, ['400', '401', '403', '404', '405', '409', '422', '425', '429', '4XX', '500', '502', '504', '5XX'])) { + $res = $this->sdkConfiguration->hooks->afterError(new Hooks\AfterErrorContext($hookContext), $httpResponse, null); + $httpResponse = $res; + } + if (Utils\Utils::matchStatusCodes($statusCode, ['200'])) { + if (Utils\Utils::matchContentType($contentType, 'application/json')) { + $httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse); + + $serializer = Utils\JSON::createSerializer(); + $responseData = (string) $httpResponse->getBody(); + $obj = $serializer->deserialize($responseData, '\Gr4vy\TransactionActions', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); + $response = new ListTransactionActionsResponse( + statusCode: $statusCode, + contentType: $contentType, + rawResponse: $httpResponse, + transactionActions: $obj); + + return $response; + } else { + throw new \Gr4vy\errors\APIException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse); + } + } elseif (Utils\Utils::matchStatusCodes($statusCode, ['400'])) { + if (Utils\Utils::matchContentType($contentType, 'application/json')) { + $httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse); + + $serializer = Utils\JSON::createSerializer(); + $responseData = (string) $httpResponse->getBody(); + $obj = $serializer->deserialize($responseData, '\Gr4vy\errors\Error400', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); + throw $obj->toException(); + } else { + throw new \Gr4vy\errors\APIException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse); + } + } elseif (Utils\Utils::matchStatusCodes($statusCode, ['401'])) { + if (Utils\Utils::matchContentType($contentType, 'application/json')) { + $httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse); + + $serializer = Utils\JSON::createSerializer(); + $responseData = (string) $httpResponse->getBody(); + $obj = $serializer->deserialize($responseData, '\Gr4vy\errors\Error401', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); + throw $obj->toException(); + } else { + throw new \Gr4vy\errors\APIException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse); + } + } elseif (Utils\Utils::matchStatusCodes($statusCode, ['403'])) { + if (Utils\Utils::matchContentType($contentType, 'application/json')) { + $httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse); + + $serializer = Utils\JSON::createSerializer(); + $responseData = (string) $httpResponse->getBody(); + $obj = $serializer->deserialize($responseData, '\Gr4vy\errors\Error403', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); + throw $obj->toException(); + } else { + throw new \Gr4vy\errors\APIException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse); + } + } elseif (Utils\Utils::matchStatusCodes($statusCode, ['404'])) { + if (Utils\Utils::matchContentType($contentType, 'application/json')) { + $httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse); + + $serializer = Utils\JSON::createSerializer(); + $responseData = (string) $httpResponse->getBody(); + $obj = $serializer->deserialize($responseData, '\Gr4vy\errors\Error404', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); + throw $obj->toException(); + } else { + throw new \Gr4vy\errors\APIException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse); + } + } elseif (Utils\Utils::matchStatusCodes($statusCode, ['405'])) { + if (Utils\Utils::matchContentType($contentType, 'application/json')) { + $httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse); + + $serializer = Utils\JSON::createSerializer(); + $responseData = (string) $httpResponse->getBody(); + $obj = $serializer->deserialize($responseData, '\Gr4vy\errors\Error405', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); + throw $obj->toException(); + } else { + throw new \Gr4vy\errors\APIException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse); + } + } elseif (Utils\Utils::matchStatusCodes($statusCode, ['409'])) { + if (Utils\Utils::matchContentType($contentType, 'application/json')) { + $httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse); + + $serializer = Utils\JSON::createSerializer(); + $responseData = (string) $httpResponse->getBody(); + $obj = $serializer->deserialize($responseData, '\Gr4vy\errors\Error409', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); + throw $obj->toException(); + } else { + throw new \Gr4vy\errors\APIException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse); + } + } elseif (Utils\Utils::matchStatusCodes($statusCode, ['422'])) { + if (Utils\Utils::matchContentType($contentType, 'application/json')) { + $httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse); + + $serializer = Utils\JSON::createSerializer(); + $responseData = (string) $httpResponse->getBody(); + $obj = $serializer->deserialize($responseData, '\Gr4vy\errors\HTTPValidationError', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); + throw $obj->toException(); + } else { + throw new \Gr4vy\errors\APIException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse); + } + } elseif (Utils\Utils::matchStatusCodes($statusCode, ['425'])) { + if (Utils\Utils::matchContentType($contentType, 'application/json')) { + $httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse); + + $serializer = Utils\JSON::createSerializer(); + $responseData = (string) $httpResponse->getBody(); + $obj = $serializer->deserialize($responseData, '\Gr4vy\errors\Error425', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); + throw $obj->toException(); + } else { + throw new \Gr4vy\errors\APIException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse); + } + } elseif (Utils\Utils::matchStatusCodes($statusCode, ['429'])) { + if (Utils\Utils::matchContentType($contentType, 'application/json')) { + $httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse); + + $serializer = Utils\JSON::createSerializer(); + $responseData = (string) $httpResponse->getBody(); + $obj = $serializer->deserialize($responseData, '\Gr4vy\errors\Error429', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); + throw $obj->toException(); + } else { + throw new \Gr4vy\errors\APIException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse); + } + } elseif (Utils\Utils::matchStatusCodes($statusCode, ['500'])) { + if (Utils\Utils::matchContentType($contentType, 'application/json')) { + $httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse); + + $serializer = Utils\JSON::createSerializer(); + $responseData = (string) $httpResponse->getBody(); + $obj = $serializer->deserialize($responseData, '\Gr4vy\errors\Error500', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); + throw $obj->toException(); + } else { + throw new \Gr4vy\errors\APIException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse); + } + } elseif (Utils\Utils::matchStatusCodes($statusCode, ['502'])) { + if (Utils\Utils::matchContentType($contentType, 'application/json')) { + $httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse); + + $serializer = Utils\JSON::createSerializer(); + $responseData = (string) $httpResponse->getBody(); + $obj = $serializer->deserialize($responseData, '\Gr4vy\errors\Error502', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); + throw $obj->toException(); + } else { + throw new \Gr4vy\errors\APIException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse); + } + } elseif (Utils\Utils::matchStatusCodes($statusCode, ['504'])) { + if (Utils\Utils::matchContentType($contentType, 'application/json')) { + $httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse); + + $serializer = Utils\JSON::createSerializer(); + $responseData = (string) $httpResponse->getBody(); + $obj = $serializer->deserialize($responseData, '\Gr4vy\errors\Error504', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); + throw $obj->toException(); + } else { + throw new \Gr4vy\errors\APIException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse); + } + } elseif (Utils\Utils::matchStatusCodes($statusCode, ['4XX'])) { + throw new \Gr4vy\errors\APIException('API error occurred', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse); + } elseif (Utils\Utils::matchStatusCodes($statusCode, ['5XX'])) { + throw new \Gr4vy\errors\APIException('API error occurred', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse); + } else { + throw new \Gr4vy\errors\APIException('Unknown status code received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse); + } + } + +} \ No newline at end of file diff --git a/src/ListTransactionActionsRequest.php b/src/ListTransactionActionsRequest.php new file mode 100644 index 0000000..3c6a9b6 --- /dev/null +++ b/src/ListTransactionActionsRequest.php @@ -0,0 +1,40 @@ +transactionId = $transactionId; + $this->merchantAccountId = $merchantAccountId; + } +} \ No newline at end of file diff --git a/src/ListTransactionActionsResponse.php b/src/ListTransactionActionsResponse.php new file mode 100644 index 0000000..4c99740 --- /dev/null +++ b/src/ListTransactionActionsResponse.php @@ -0,0 +1,56 @@ +contentType = $contentType; + $this->statusCode = $statusCode; + $this->rawResponse = $rawResponse; + $this->transactionActions = $transactionActions; + } +} \ No newline at end of file diff --git a/src/SDKConfiguration.php b/src/SDKConfiguration.php index 682ba8e..ee3dc08 100644 --- a/src/SDKConfiguration.php +++ b/src/SDKConfiguration.php @@ -33,11 +33,11 @@ class SDKConfiguration public string $openapiDocVersion = '1.0.0'; - public string $sdkVersion = '1.5.6'; + public string $sdkVersion = '1.5.7'; public string $genVersion = '2.791.1'; - public string $userAgent = 'speakeasy-sdk/php 1.5.6 2.791.1 1.0.0 gr4vy/gr4vy-php'; + public string $userAgent = 'speakeasy-sdk/php 1.5.7 2.791.1 1.0.0 gr4vy/gr4vy-php'; /** @var array>> */ public ?array $globals = [ 'parameters' => [], diff --git a/src/TransactionAction.php b/src/TransactionAction.php new file mode 100644 index 0000000..dde0d10 --- /dev/null +++ b/src/TransactionAction.php @@ -0,0 +1,80 @@ + $outcome + */ + #[\Speakeasy\Serializer\Annotation\SerializedName('outcome')] + #[\Speakeasy\Serializer\Annotation\Type('array')] + public array $outcome; + + /** + * Always `action`. + * + * @var ?string $type + */ + #[\Speakeasy\Serializer\Annotation\SerializedName('type')] + #[\Speakeasy\Serializer\Annotation\SkipWhenNull] + public ?string $type = null; + + /** + * @param string $id + * @param string $flow + * @param string $ruleId + * @param \DateTime $createdAt + * @param array $outcome + * @param ?string $type + * @phpstan-pure + */ + public function __construct(string $id, string $flow, string $ruleId, \DateTime $createdAt, array $outcome, ?string $type = 'action') + { + $this->id = $id; + $this->flow = $flow; + $this->ruleId = $ruleId; + $this->createdAt = $createdAt; + $this->outcome = $outcome; + $this->type = $type; + } +} \ No newline at end of file diff --git a/src/TransactionActions.php b/src/TransactionActions.php new file mode 100644 index 0000000..9adb0be --- /dev/null +++ b/src/TransactionActions.php @@ -0,0 +1,31 @@ + $items + */ + #[\Speakeasy\Serializer\Annotation\SerializedName('items')] + #[\Speakeasy\Serializer\Annotation\Type('array<\Gr4vy\TransactionAction>')] + public array $items; + + /** + * @param array $items + * @phpstan-pure + */ + public function __construct(array $items) + { + $this->items = $items; + } +} \ No newline at end of file diff --git a/src/Transactions.php b/src/Transactions.php index ec9c8f6..6b7f36b 100644 --- a/src/Transactions.php +++ b/src/Transactions.php @@ -19,6 +19,8 @@ class Transactions private SDKConfiguration $sdkConfiguration; public TransactionsRefunds $refunds; + public Actions $actions; + public Events $events; public TransactionsSettlements $settlements; @@ -30,6 +32,7 @@ public function __construct(public SDKConfiguration $sdkConfig) { $this->sdkConfiguration = $sdkConfig; $this->refunds = new TransactionsRefunds($this->sdkConfiguration); + $this->actions = new Actions($this->sdkConfiguration); $this->events = new Events($this->sdkConfiguration); $this->settlements = new TransactionsSettlements($this->sdkConfiguration); }