diff --git a/.github/workflows/build-production.yaml b/.github/workflows/build-production.yaml new file mode 100644 index 0000000..244a2f3 --- /dev/null +++ b/.github/workflows/build-production.yaml @@ -0,0 +1,46 @@ +name: Build & Push (production) + +on: + push: + tags: 'v[0-9]+.[0-9]+.[0-9]+' + +concurrency: + group: ${{ github.workflow }} + +jobs: + build_auto_generators: + uses: dojo-engineering/github-workflows/.github/workflows/remote-payments-dotnet-basic.yaml@main + with: + area: + cloudsdk_container_cluster: production-remotepayments + cloudsdk_core_project: firefly-prod-2018 + dockerfile_path: ./build/Dockerfile + namespace: Dojo.AutoGenerators + runner: ubuntu-latest + sha: ${{ github.sha }} + enable_settingsutil: false + disable_docker_build: true + disable_deployment: true + docker-only: true + nuget-package-build-and-push-only: true + service_account_key_path: firefly-dev-2018/remotepayments-nexus-key + secrets: + container_pull_key: ${{ secrets.GH_CONTAINERS_PULLER_KEY }} + build_openapi_generator: + uses: dojo-engineering/github-workflows/.github/workflows/remote-payments-dotnet-basic.yaml@main + with: + area: + cloudsdk_container_cluster: production-remotepayments + cloudsdk_core_project: firefly-prod-2018 + dockerfile_path: ./build/Dockerfile + namespace: Dojo.OpenApiGenerator + runner: ubuntu-latest + sha: ${{ github.sha }} + enable_settingsutil: false + disable_docker_build: true + disable_deployment: true + docker-only: true + nuget-package-build-and-push-only: true + service_account_key_path: firefly-dev-2018/remotepayments-nexus-key + secrets: + container_pull_key: ${{ secrets.GH_CONTAINERS_PULLER_KEY }} diff --git a/.github/workflows/build-staging.yaml b/.github/workflows/build-staging.yaml new file mode 100644 index 0000000..4de4005 --- /dev/null +++ b/.github/workflows/build-staging.yaml @@ -0,0 +1,54 @@ +name: Build (staging) + +on: + push: + branches: + - 'main' + - 'master' + - 'bugfix/*' + - 'feature/*' + - 'hotfix/*' + - 'release/*' + - 'task/*' + - 'migration/*' + +concurrency: + group: ${{ github.workflow }} + +jobs: + build_auto_generators: + uses: dojo-engineering/github-workflows/.github/workflows/remote-payments-dotnet-basic.yaml@main + with: + area: + cloudsdk_container_cluster: staging-remotepayments + cloudsdk_core_project: firefly-staging-2018 + dockerfile_path: ./build/Dockerfile + namespace: Dojo.AutoGenerators + runner: ubuntu-latest + sha: ${{ github.sha }} + enable_settingsutil: false + disable_docker_build: true + disable_deployment: true + docker-only: true + nuget-package-build-and-push-only: false + service_account_key_path: firefly-dev-2018/remotepayments-nexus-key + secrets: + container_pull_key: ${{ secrets.GH_CONTAINERS_PULLER_KEY }} + build_openapi_generator: + uses: dojo-engineering/github-workflows/.github/workflows/remote-payments-dotnet-basic.yaml@main + with: + area: + cloudsdk_container_cluster: staging-remotepayments + cloudsdk_core_project: firefly-staging-2018 + dockerfile_path: ./build/Dockerfile + namespace: Dojo.OpenApiGenerator + runner: ubuntu-latest + sha: ${{ github.sha }} + enable_settingsutil: false + disable_docker_build: true + disable_deployment: true + docker-only: true + nuget-package-build-and-push-only: false + service_account_key_path: firefly-dev-2018/remotepayments-nexus-key + secrets: + container_pull_key: ${{ secrets.GH_CONTAINERS_PULLER_KEY }} diff --git a/Dojo.AutoGenerators/AutoExceptionGenerator.cs b/Dojo.AutoGenerators/AutoExceptionGenerator.cs index 8d6f6c9..6d77546 100644 --- a/Dojo.AutoGenerators/AutoExceptionGenerator.cs +++ b/Dojo.AutoGenerators/AutoExceptionGenerator.cs @@ -66,10 +66,6 @@ public partial class {classDefinition.Name}{baseTypeDefinition} public {classDefinition.Name}(string message, Exception innerException) : base(message, innerException) {{ }} - - protected {classDefinition.Name}(SerializationInfo info, StreamingContext context) : base(info, context) - {{ - }} }} }} "); diff --git a/Dojo.AutoGenerators/Dojo.AutoGenerators.csproj b/Dojo.AutoGenerators/Dojo.AutoGenerators.csproj index eb37687..4b6ca14 100644 --- a/Dojo.AutoGenerators/Dojo.AutoGenerators.csproj +++ b/Dojo.AutoGenerators/Dojo.AutoGenerators.csproj @@ -34,9 +34,9 @@ - - - + + + diff --git a/Dojo.Generators.Core/Dojo.Generators.Core.csproj b/Dojo.Generators.Core/Dojo.Generators.Core.csproj index 97a52de..c640aaa 100644 --- a/Dojo.Generators.Core/Dojo.Generators.Core.csproj +++ b/Dojo.Generators.Core/Dojo.Generators.Core.csproj @@ -11,11 +11,11 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/Dojo.Generators.Tests/AutoExceptionTests.cs b/Dojo.Generators.Tests/AutoExceptionTests.cs index 7c03cc3..edb745a 100644 --- a/Dojo.Generators.Tests/AutoExceptionTests.cs +++ b/Dojo.Generators.Tests/AutoExceptionTests.cs @@ -42,10 +42,6 @@ public TestException(string message) : base(message) public TestException(string message, Exception innerException) : base(message, innerException) {{ }} - - protected TestException(SerializationInfo info, StreamingContext context) : base(info, context) - {{ - }} }} }}"; // Act diff --git a/Dojo.Generators.sln b/Dojo.Generators.sln index 4d66e4b..e82ef36 100644 --- a/Dojo.Generators.sln +++ b/Dojo.Generators.sln @@ -20,11 +20,21 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{B31EDD61-3FF0-44D0-92D3-1E1B2ADFF4B7}" ProjectSection(SolutionItems) = preProject build\cloudbuild.yaml = build\cloudbuild.yaml + build\cloudbuild-build-only.yaml = build\cloudbuild-build-only.yaml build\Dockerfile = build\Dockerfile + build\Dockerfile_build = build\Dockerfile_build build\publish.sh = build\publish.sh build\writeversion.sh = build\writeversion.sh EndProjectSection EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{C0B68B54-F557-4B6A-A0E8-02326DF16469}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{12A8E779-D8A6-44CA-8AFE-EBD9E8896DDD}" + ProjectSection(SolutionItems) = preProject + .github\workflows\build-production.yaml = .github\workflows\build-production.yaml + .github\workflows\build-staging.yaml = .github\workflows\build-staging.yaml + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -123,6 +133,9 @@ Global GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {12A8E779-D8A6-44CA-8AFE-EBD9E8896DDD} = {C0B68B54-F557-4B6A-A0E8-02326DF16469} + EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {9B312A09-A819-40F8-9F16-2B6228EB001A} EndGlobalSection diff --git a/Dojo.OpenApiGenerator.TestWebApi/Controllers/HelloWorldCustomController.cs b/Dojo.OpenApiGenerator.TestWebApi/Controllers/HelloWorldCustomController.cs index a3763fe..75b0881 100644 --- a/Dojo.OpenApiGenerator.TestWebApi/Controllers/HelloWorldCustomController.cs +++ b/Dojo.OpenApiGenerator.TestWebApi/Controllers/HelloWorldCustomController.cs @@ -1,10 +1,12 @@ -using System.ComponentModel.DataAnnotations; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; using System.Threading.Tasks; using Dojo.OpenApiGenerator.TestWebApi.Generated.Controllers.V1; using Dojo.OpenApiGenerator.TestWebApi.Generated.Models; using Dojo.OpenApiGenerator.TestWebApi.Services; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.ModelBinding; +using System.Threading; namespace Dojo.OpenApiGenerator.TestWebApi.Controllers { @@ -18,19 +20,29 @@ public HelloWorldCustomController(IHelloWorldService helloWorldService) } public override Task> - HelloFromSourceActionAsync([FromQuery, BindRequired, MaxLength(5)] System.String message, [FromRoute, BindRequired] System.Int64 number) + HelloFromSourceActionAsync([FromQuery, BindRequired, MaxLength(5)] System.String message, [FromRoute, BindRequired] System.Int64 number, CancellationToken cancellationToken) { - return base.HelloFromSourceActionAsync(message, number); + return base.HelloFromSourceActionAsync(message, number, cancellationToken); } - protected override async Task> HelloFromSourceAsync(string message, long number) + protected override async Task> HelloFromSourceAsync(string message, long number, CancellationToken cancellationToken) { - return Ok(await _helloWorldService.HelloFromSourceAsync(number)); + return Ok(await _helloWorldService.HelloFromSourceAsync(number, cancellationToken)); } - protected override async Task> GetHelloGenerated2Async() + protected override async Task> GetHelloGenerated2Async(CancellationToken cancellationToken) { - return Ok(await _helloWorldService.HelloGenerated2Async()); + return Ok(await _helloWorldService.HelloGenerated2Async(cancellationToken)); + } + + protected override Task> GetHelloGeneratePostArrayAsync(CancellationToken cancellationToken) + { + throw new System.NotImplementedException(); + } + + protected override Task>> PostHelloGeneratePostArrayAsync(IEnumerable helloFromSources, CancellationToken cancellationToken) + { + throw new System.NotImplementedException(); } } } diff --git a/Dojo.OpenApiGenerator.TestWebApi/OpenApiSchemas/hello-source-generators-api.json b/Dojo.OpenApiGenerator.TestWebApi/OpenApiSchemas/hello-source-generators-api.json index 810d50b..e44e2ed 100644 --- a/Dojo.OpenApiGenerator.TestWebApi/OpenApiSchemas/hello-source-generators-api.json +++ b/Dojo.OpenApiGenerator.TestWebApi/OpenApiSchemas/hello-source-generators-api.json @@ -92,6 +92,56 @@ "write" ] } + }, + "/hello-generate-post-array": { + "get": { + "summary": "Your GET endpoint", + "tags": [], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HelloFromSourceItems" + } + } + } + } + }, + "operationId": "get-hello-generate-post-array" + }, + "post": { + "summary": "", + "operationId": "post-hello-generate-post-array", + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/HelloFromSource" + } + } + } + } + } + }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/HelloFromSource" + } + } + } + } + } + } } }, "components": { @@ -135,6 +185,16 @@ "Salut", "Buna" ] + }, + "HelloFromSourceItems": { + "title": "HelloFromSourceItems", + "x-stoplight": { + "id": "d63g7y1xtilld" + }, + "type": "array", + "items": { + "$ref": "#/components/schemas/HelloFromSource" + } } }, "responses": {} diff --git a/Dojo.OpenApiGenerator.TestWebApi/OpenApiSchemas/payment-intents/payment-intents.json.disabled b/Dojo.OpenApiGenerator.TestWebApi/OpenApiSchemas/payment-intents/payment-intents.json.disabled deleted file mode 100644 index 912ad0f..0000000 --- a/Dojo.OpenApiGenerator.TestWebApi/OpenApiSchemas/payment-intents/payment-intents.json.disabled +++ /dev/null @@ -1,2498 +0,0 @@ -{ - "x-generator": "NSwag v13.15.7.0 (NJsonSchema v10.6.7.0 (Newtonsoft.Json v13.0.0.0))", - "openapi": "3.0.0", - "info": { - "title": "PaymentIntents", - "version": "2022-04-07" - }, - "servers": [ - { - "url": "http://localhost:5000" - } - ], - "paths": { - "/api/payment-intents/{paymentIntentId}/captures": { - "post": { - "tags": [ - "Captures" - ], - "operationId": "Captures_Create", - "parameters": [ - { - "name": "account-id", - "x-originalName": "accountId", - "in": "header", - "schema": { - "type": "string", - "maxLength": 50, - "nullable": true - }, - "x-position": 1 - }, - { - "name": "paymentIntentId", - "in": "path", - "required": true, - "schema": { - "type": "string", - "nullable": true - }, - "x-position": 2 - }, - { - "name": "version", - "in": "header", - "required": true, - "schema": { - "type": "string", - "nullable": true - }, - "x-position": 4 - } - ], - "requestBody": { - "x-name": "request", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateCaptureRequest" - } - } - }, - "required": true, - "x-position": 3 - }, - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Capture" - } - } - } - }, - "400": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "401": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "404": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "409": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "500": { - "description": "" - } - } - } - }, - "/api/connecte-credentials": { - "get": { - "tags": [ - "ConnecteCredentials" - ], - "operationId": "ConnecteCredentials_Get", - "parameters": [ - { - "name": "locationId", - "in": "query", - "schema": { - "type": "string", - "maxLength": 50, - "nullable": true - }, - "x-position": 1 - }, - { - "name": "remoteId", - "in": "query", - "schema": { - "type": "string", - "maxLength": 50, - "nullable": true - }, - "x-position": 2 - }, - { - "name": "version", - "in": "header", - "required": true, - "schema": { - "type": "string", - "nullable": true - }, - "x-position": 3 - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ExternalAuthResponse" - } - } - } - }, - "400": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "404": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "500": { - "description": "" - }, - "401": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - } - } - } - }, - "/api/connecte_credentials": { - "get": { - "tags": [ - "ConnecteCredentials" - ], - "operationId": "ConnecteCredentials_ObsoleteGet", - "parameters": [ - { - "name": "locationId", - "in": "query", - "schema": { - "type": "string", - "nullable": true - }, - "x-position": 1 - }, - { - "name": "remoteId", - "in": "query", - "schema": { - "type": "string", - "nullable": true - }, - "x-position": 2 - }, - { - "name": "version", - "in": "header", - "required": true, - "schema": { - "type": "string", - "nullable": true - }, - "x-position": 3 - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ExternalAuthResponse" - } - } - } - }, - "400": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "404": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "500": { - "description": "" - }, - "401": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - } - }, - "deprecated": true - } - }, - "/api/payment-intents/{paymentIntentId}/reversal": { - "post": { - "tags": [ - "Reversal" - ], - "operationId": "Reversal_Create", - "parameters": [ - { - "name": "account-id", - "x-originalName": "accountId", - "in": "header", - "schema": { - "type": "string", - "maxLength": 50, - "nullable": true - }, - "x-position": 1 - }, - { - "name": "paymentIntentId", - "in": "path", - "required": true, - "schema": { - "type": "string", - "nullable": true - }, - "x-position": 2 - }, - { - "name": "version", - "in": "header", - "required": true, - "schema": { - "type": "string", - "nullable": true - }, - "x-position": 3 - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Reversal" - } - } - } - }, - "400": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "401": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "409": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "500": { - "description": "" - } - } - } - }, - "/api/payment-intents/search": { - "post": { - "tags": [ - "PaymentIntents" - ], - "operationId": "PaymentIntents_Search", - "parameters": [ - { - "name": "account-id", - "x-originalName": "accountId", - "in": "header", - "required": true, - "schema": { - "type": "string", - "maxLength": 50, - "nullable": true - }, - "x-position": 1 - }, - { - "name": "location-id", - "x-originalName": "locationId", - "in": "header", - "schema": { - "type": "string", - "maxLength": 50, - "nullable": true - }, - "x-position": 2 - }, - { - "name": "version", - "in": "header", - "required": true, - "schema": { - "type": "string", - "nullable": true - }, - "x-position": 4 - } - ], - "requestBody": { - "x-name": "request", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/SearchPaymentIntentRequest" - } - } - }, - "required": true, - "x-position": 3 - }, - "responses": { - "400": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "401": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "500": { - "description": "" - }, - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/PagedPaymentIntent" - } - } - } - } - } - } - }, - "/api/payment-intents/{paymentIntentId}": { - "get": { - "tags": [ - "PaymentIntents" - ], - "operationId": "PaymentIntents_Get", - "parameters": [ - { - "name": "account-id", - "x-originalName": "accountId", - "in": "header", - "schema": { - "type": "string", - "maxLength": 50, - "nullable": true - }, - "x-position": 1 - }, - { - "name": "paymentIntentId", - "in": "path", - "required": true, - "schema": { - "type": "string", - "nullable": true - }, - "x-position": 2 - }, - { - "name": "refreshClientSessionSecret", - "in": "query", - "schema": { - "type": "boolean", - "default": false, - "nullable": true - }, - "x-position": 3 - }, - { - "name": "version", - "in": "header", - "required": true, - "schema": { - "type": "string", - "nullable": true - }, - "x-position": 4 - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/PaymentIntent" - } - } - } - }, - "400": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "401": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "404": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "500": { - "description": "" - } - } - }, - "delete": { - "tags": [ - "PaymentIntents" - ], - "operationId": "PaymentIntents_Delete", - "parameters": [ - { - "name": "account-id", - "x-originalName": "accountId", - "in": "header", - "schema": { - "type": "string", - "maxLength": 50, - "nullable": true - }, - "x-position": 1 - }, - { - "name": "paymentIntentId", - "in": "path", - "required": true, - "schema": { - "type": "string", - "nullable": true - }, - "x-position": 2 - }, - { - "name": "version", - "in": "header", - "required": true, - "schema": { - "type": "string", - "nullable": true - }, - "x-position": 3 - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/PaymentIntent" - } - } - } - }, - "400": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "401": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "404": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "500": { - "description": "" - } - } - } - }, - "/api/payment-intents": { - "post": { - "tags": [ - "PaymentIntents" - ], - "operationId": "PaymentIntents_CreatePaymentIntent", - "parameters": [ - { - "name": "account-id", - "x-originalName": "accountId", - "in": "header", - "required": true, - "schema": { - "type": "string", - "maxLength": 50, - "nullable": true - }, - "x-position": 1 - }, - { - "name": "location-id", - "x-originalName": "locationId", - "in": "header", - "schema": { - "type": "string", - "maxLength": 50, - "nullable": true - }, - "x-position": 2 - }, - { - "name": "version", - "in": "header", - "required": true, - "schema": { - "type": "string", - "nullable": true - }, - "x-position": 4 - } - ], - "requestBody": { - "x-name": "createPaymentIntentRequest", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreatePaymentIntentRequest" - } - } - }, - "required": true, - "x-position": 3 - }, - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/PaymentIntent" - } - } - } - }, - "400": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "401": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "500": { - "description": "" - } - } - } - }, - "/api/payment-intents/{paymentIntentId}/refresh-client-session-secret": { - "post": { - "tags": [ - "PaymentIntents" - ], - "operationId": "PaymentIntents_RefreshPaymentIntentToken", - "parameters": [ - { - "name": "paymentIntentId", - "in": "path", - "required": true, - "schema": { - "type": "string", - "nullable": true - }, - "x-position": 1 - }, - { - "name": "version", - "in": "header", - "required": true, - "schema": { - "type": "string", - "nullable": true - }, - "x-position": 2 - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/PaymentIntent" - } - } - } - }, - "400": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "401": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "500": { - "description": "" - } - } - } - }, - "/api/payment-intents/{paymentIntentId}/tips-amount": { - "post": { - "tags": [ - "PaymentIntents" - ], - "operationId": "PaymentIntents_SetTipsAmount", - "parameters": [ - { - "name": "account-id", - "x-originalName": "accountId", - "in": "header", - "schema": { - "type": "string", - "maxLength": 50, - "nullable": true - }, - "x-position": 1 - }, - { - "name": "paymentIntentId", - "in": "path", - "required": true, - "schema": { - "type": "string", - "nullable": true - }, - "x-position": 2 - }, - { - "name": "version", - "in": "header", - "required": true, - "schema": { - "type": "string", - "nullable": true - }, - "x-position": 4 - } - ], - "requestBody": { - "x-name": "request", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/SetTipsAmountRequest" - } - } - }, - "required": true, - "x-position": 3 - }, - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/PaymentIntent" - } - } - } - }, - "400": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "401": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "404": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "405": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "500": { - "description": "" - } - } - } - }, - "/api/payment-intents/{paymentIntentId}/amount": { - "post": { - "tags": [ - "PaymentIntents" - ], - "operationId": "PaymentIntents_SetCustomAmount", - "parameters": [ - { - "name": "account-id", - "x-originalName": "accountId", - "in": "header", - "schema": { - "type": "string", - "maxLength": 50, - "nullable": true - }, - "x-position": 1 - }, - { - "name": "paymentIntentId", - "in": "path", - "required": true, - "schema": { - "type": "string", - "nullable": true - }, - "x-position": 2 - }, - { - "name": "version", - "in": "header", - "required": true, - "schema": { - "type": "string", - "nullable": true - }, - "x-position": 4 - } - ], - "requestBody": { - "x-name": "request", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/SetAmountRequest" - } - } - }, - "required": true, - "x-position": 3 - }, - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/PaymentIntent" - } - } - } - }, - "400": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "401": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "404": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "405": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "500": { - "description": "" - } - } - } - }, - "/api/payment-intents/{paymentIntentId}/status": { - "get": { - "tags": [ - "PaymentIntents" - ], - "operationId": "PaymentIntents_GetPaymentIntentStatus", - "parameters": [ - { - "name": "account-id", - "x-originalName": "accountId", - "in": "header", - "schema": { - "type": "string", - "maxLength": 50, - "nullable": true - }, - "x-position": 1 - }, - { - "name": "paymentIntentId", - "in": "path", - "required": true, - "schema": { - "type": "string", - "nullable": true - }, - "x-position": 2 - }, - { - "name": "version", - "in": "header", - "required": true, - "schema": { - "type": "string", - "nullable": true - }, - "x-position": 3 - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/PaymentIntent" - } - } - } - }, - "400": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "401": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "500": { - "description": "" - } - } - } - }, - "/api/payment-intents/refunds/{refundId}": { - "get": { - "tags": [ - "PaymentIntents" - ], - "operationId": "PaymentIntents_GetRefundById", - "parameters": [ - { - "name": "account-id", - "x-originalName": "accountId", - "in": "header", - "schema": { - "type": "string", - "maxLength": 50, - "nullable": true - }, - "x-position": 1 - }, - { - "name": "refundId", - "in": "path", - "required": true, - "schema": { - "type": "string", - "maxLength": 50, - "nullable": true - }, - "x-position": 2 - }, - { - "name": "version", - "in": "header", - "required": true, - "schema": { - "type": "string", - "nullable": true - }, - "x-position": 3 - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Refund" - } - } - } - }, - "400": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "401": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "500": { - "description": "" - } - } - } - }, - "/api/payment-intents/{paymentIntentId}/receipt": { - "post": { - "tags": [ - "PaymentIntents" - ], - "operationId": "PaymentIntents_SendEmailReceipt", - "parameters": [ - { - "name": "paymentIntentId", - "in": "path", - "required": true, - "schema": { - "type": "string", - "nullable": true - }, - "x-position": 1 - }, - { - "name": "version", - "in": "header", - "required": true, - "schema": { - "type": "string", - "nullable": true - }, - "x-position": 3 - } - ], - "requestBody": { - "x-name": "sendEmailReceiptRequest", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/SendEmailReceiptRequest" - } - } - }, - "required": true, - "x-position": 2 - }, - "responses": { - "204": { - "description": "" - }, - "400": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "401": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "404": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "500": { - "description": "" - } - } - } - }, - "/api/payment-intents/{paymentIntentId}/refunds": { - "post": { - "tags": [ - "Refunds" - ], - "operationId": "Refunds_Create", - "parameters": [ - { - "name": "account-id", - "x-originalName": "accountId", - "in": "header", - "schema": { - "type": "string", - "maxLength": 50, - "nullable": true - }, - "x-position": 1 - }, - { - "name": "paymentIntentId", - "in": "path", - "required": true, - "schema": { - "type": "string", - "nullable": true - }, - "x-position": 2 - }, - { - "name": "IdempotencyKey", - "x-originalName": "idempotencyKey", - "in": "header", - "schema": { - "type": "string", - "maxLength": 100, - "nullable": true - }, - "x-position": 3 - }, - { - "name": "version", - "in": "header", - "required": true, - "schema": { - "type": "string", - "nullable": true - }, - "x-position": 5 - } - ], - "requestBody": { - "x-name": "createRefundRequest", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateRefundRequest" - } - } - }, - "required": true, - "x-position": 4 - }, - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Refund" - } - } - } - }, - "400": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "500": { - "description": "" - }, - "401": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Capture": { - "type": "object", - "additionalProperties": false, - "properties": { - "message": { - "type": "string", - "nullable": true - }, - "captureId": { - "type": "string", - "nullable": true - } - } - }, - "ProblemDetails": { - "type": "object", - "additionalProperties": { - "nullable": true - }, - "properties": { - "type": { - "type": "string", - "nullable": true - }, - "title": { - "type": "string", - "nullable": true - }, - "status": { - "type": "integer", - "format": "int32", - "nullable": true - }, - "detail": { - "type": "string", - "nullable": true - }, - "instance": { - "type": "string", - "nullable": true - }, - "extensions": { - "type": "object", - "additionalProperties": {} - } - } - }, - "CreateCaptureRequest": { - "type": "object", - "additionalProperties": false, - "required": [ - "amount" - ], - "properties": { - "amount": { - "type": "integer", - "format": "int64" - } - } - }, - "ExternalAuthResponse": { - "type": "object", - "additionalProperties": false, - "properties": { - "jwtToken": { - "type": "string", - "nullable": true - }, - "gatewayUsername": { - "type": "string", - "nullable": true - } - } - }, - "Reversal": { - "type": "object", - "additionalProperties": false, - "properties": { - "message": { - "type": "string", - "nullable": true - }, - "reversalId": { - "type": "string", - "nullable": true - } - } - }, - "PagedPaymentIntent": { - "allOf": [ - { - "$ref": "#/components/schemas/PagedResultOfPaymentIntent" - }, - { - "type": "object", - "additionalProperties": false - } - ] - }, - "PagedResultOfPaymentIntent": { - "type": "object", - "additionalProperties": false, - "properties": { - "data": { - "type": "array", - "nullable": true, - "items": { - "$ref": "#/components/schemas/PaymentIntent" - } - }, - "before": { - "type": "string", - "nullable": true - }, - "after": { - "type": "string", - "nullable": true - } - } - }, - "PaymentIntent": { - "type": "object", - "additionalProperties": false, - "properties": { - "id": { - "type": "string", - "nullable": true - }, - "captureMode": { - "$ref": "#/components/schemas/CaptureMode" - }, - "transactionSource": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/TransactionSource" - } - ] - }, - "clientSessionSecret": { - "type": "string", - "nullable": true - }, - "clientSessionSecretExpirationDate": { - "type": "string", - "format": "date-time" - }, - "paymentDetails": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/PaymentDetails" - } - ] - }, - "status": { - "$ref": "#/components/schemas/PaymentIntentStatus" - }, - "paymentMethods": { - "type": "array", - "nullable": true, - "items": { - "$ref": "#/components/schemas/PaymentMethod" - } - }, - "amount": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/Money" - } - ] - }, - "tipsAmount": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/Money" - } - ] - }, - "requestedAmount": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/Money" - } - ] - }, - "totalAmount": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/Money" - } - ] - }, - "refundedAmount": { - "type": "integer", - "format": "int64" - }, - "customer": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/Customer" - } - ] - }, - "requestSecurity": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/RequestSecurity" - } - ] - }, - "billingAddress": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/Address" - } - ] - }, - "shippingDetails": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/ShippingDetails" - } - ] - }, - "createdAt": { - "type": "string", - "format": "date-time" - }, - "updatedAt": { - "type": "string", - "format": "date-time" - }, - "reference": { - "type": "string", - "nullable": true - }, - "description": { - "type": "string", - "nullable": true - }, - "subtotalLineItems": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/Money" - } - ] - }, - "itemLines": { - "type": "array", - "nullable": true, - "items": { - "$ref": "#/components/schemas/ItemLine" - } - }, - "taxLines": { - "type": "array", - "nullable": true, - "items": { - "$ref": "#/components/schemas/TaxLine" - } - }, - "actionLink": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/ActionLink" - } - ] - }, - "config": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/PaymentIntentConfig" - } - ] - }, - "paymentSource": { - "type": "string", - "nullable": true - }, - "metadata": { - "type": "object", - "nullable": true, - "additionalProperties": { - "type": "string" - } - }, - "paymentEvents": { - "type": "array", - "nullable": true, - "items": { - "$ref": "#/components/schemas/PaymentStatusResponse" - } - } - } - }, - "CaptureMode": { - "type": "string", - "description": "", - "x-enumNames": [ - "Auto", - "Manual" - ], - "enum": [ - "Auto", - "Manual" - ] - }, - "TransactionSource": { - "type": "string", - "description": "", - "x-enumNames": [ - "MOTO" - ], - "enum": [ - "MOTO" - ] - }, - "PaymentDetails": { - "type": "object", - "additionalProperties": false, - "properties": { - "transactionDateTime": { - "type": "string", - "nullable": true - }, - "message": { - "type": "string", - "nullable": true - }, - "authCode": { - "type": "string", - "nullable": true - }, - "cardNumber": { - "type": "string", - "nullable": true - }, - "cardName": { - "type": "string", - "nullable": true - }, - "expiryDate": { - "type": "string", - "nullable": true - }, - "cardType": { - "type": "string", - "nullable": true - } - } - }, - "PaymentIntentStatus": { - "type": "string", - "description": "", - "x-enumNames": [ - "Created", - "Authorized", - "Captured", - "Reversed", - "Refunded", - "Canceled" - ], - "enum": [ - "Created", - "Authorized", - "Captured", - "Reversed", - "Refunded", - "Canceled" - ] - }, - "PaymentMethod": { - "type": "string", - "description": "", - "x-enumNames": [ - "Card", - "Wallet" - ], - "enum": [ - "Card", - "Wallet" - ] - }, - "Money": { - "type": "object", - "additionalProperties": false, - "required": [ - "value", - "currencyCode" - ], - "properties": { - "value": { - "type": "integer", - "format": "int64" - }, - "currencyCode": { - "type": "string", - "maxLength": 10, - "minLength": 0 - } - } - }, - "Customer": { - "type": "object", - "additionalProperties": false, - "properties": { - "emailAddress": { - "type": "string", - "maxLength": 254, - "nullable": true - }, - "phoneNumber": { - "type": "string", - "maxLength": 50, - "nullable": true - } - } - }, - "RequestSecurity": { - "type": "object", - "additionalProperties": false, - "properties": { - "userAgent": { - "type": "string", - "maxLength": 300, - "nullable": true - }, - "ipAddress": { - "type": "string", - "maxLength": 70, - "nullable": true - }, - "device": { - "type": "string", - "maxLength": 120, - "nullable": true - } - } - }, - "Address": { - "type": "object", - "additionalProperties": false, - "required": [ - "countryCode" - ], - "properties": { - "address1": { - "type": "string", - "maxLength": 100, - "nullable": true - }, - "address2": { - "type": "string", - "maxLength": 100, - "nullable": true - }, - "address3": { - "type": "string", - "maxLength": 100, - "nullable": true - }, - "address4": { - "type": "string", - "maxLength": 100, - "nullable": true - }, - "city": { - "type": "string", - "maxLength": 100, - "nullable": true - }, - "state": { - "type": "string", - "maxLength": 100, - "nullable": true - }, - "postcode": { - "type": "string", - "maxLength": 50, - "nullable": true - }, - "countryCode": { - "type": "string", - "maxLength": 10 - }, - "locality": { - "type": "string", - "maxLength": 100, - "nullable": true - }, - "county": { - "type": "string", - "maxLength": 100, - "nullable": true - } - } - }, - "ShippingDetails": { - "type": "object", - "additionalProperties": false, - "properties": { - "name": { - "type": "string", - "maxLength": 100, - "nullable": true - }, - "deliveryNotes": { - "type": "string", - "maxLength": 1024, - "nullable": true - }, - "address": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/Address" - } - ] - } - } - }, - "ItemLine": { - "type": "object", - "additionalProperties": false, - "properties": { - "id": { - "type": "string", - "maxLength": 60, - "nullable": true - }, - "quantity": { - "type": "integer", - "format": "int32" - }, - "caption": { - "type": "string", - "maxLength": 100, - "nullable": true - }, - "amountTotal": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/Money" - } - ] - } - } - }, - "TaxLine": { - "type": "object", - "additionalProperties": false, - "properties": { - "id": { - "type": "string", - "maxLength": 60, - "nullable": true - }, - "caption": { - "type": "string", - "maxLength": 100, - "nullable": true - }, - "subCaption": { - "type": "string", - "maxLength": 100, - "nullable": true - }, - "amountTotal": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/Money" - } - ] - } - } - }, - "ActionLink": { - "type": "object", - "additionalProperties": false, - "required": [ - "url", - "label" - ], - "properties": { - "url": { - "type": "string", - "format": "uri", - "minLength": 1 - }, - "action": { - "$ref": "#/components/schemas/ActionType" - }, - "label": { - "type": "string", - "maxLength": 60, - "minLength": 1 - }, - "fileName": { - "type": "string", - "maxLength": 256, - "nullable": true - } - } - }, - "ActionType": { - "type": "string", - "description": "", - "x-enumNames": [ - "OpenLink", - "DownloadFile" - ], - "enum": [ - "OpenLink", - "DownloadFile" - ] - }, - "PaymentIntentConfig": { - "allOf": [ - { - "$ref": "#/components/schemas/PaymentIntentConfigBase" - }, - { - "type": "object", - "additionalProperties": false, - "properties": { - "tradingName": { - "type": "string", - "nullable": true - } - } - } - ] - }, - "PaymentIntentConfigBase": { - "type": "object", - "x-abstract": true, - "additionalProperties": false, - "properties": { - "title": { - "type": "string", - "maxLength": 100, - "nullable": true - }, - "redirectUrl": { - "type": "string", - "format": "uri", - "nullable": true - }, - "cancelUrl": { - "type": "string", - "format": "uri", - "nullable": true - }, - "customerEmail": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/PaymentIntentConfigCustomerEmail" - } - ] - }, - "details": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/PaymentIntentConfigDetails" - } - ] - }, - "billingAddress": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/PaymentIntentConfigBillingAddress" - } - ] - }, - "shippingDetails": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/PaymentIntentConfigShippingDetails" - } - ] - }, - "payment": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/PaymentConfigDetails" - } - ] - }, - "branding": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/PaymentIntentConfigBranding" - } - ] - } - } - }, - "PaymentIntentConfigCustomerEmail": { - "type": "object", - "additionalProperties": false, - "properties": { - "collectionRequired": { - "type": "boolean" - } - } - }, - "PaymentIntentConfigDetails": { - "type": "object", - "additionalProperties": false, - "properties": { - "showTotal": { - "type": "boolean" - }, - "showReference": { - "type": "boolean" - } - } - }, - "PaymentIntentConfigBillingAddress": { - "type": "object", - "additionalProperties": false, - "properties": { - "collectionRequired": { - "type": "boolean" - } - } - }, - "PaymentIntentConfigShippingDetails": { - "type": "object", - "additionalProperties": false, - "properties": { - "collectionRequired": { - "type": "boolean" - } - } - }, - "PaymentConfigDetails": { - "type": "object", - "additionalProperties": false, - "properties": { - "customAmountAllowed": { - "type": "boolean" - }, - "tipsAllowed": { - "type": "boolean" - } - } - }, - "PaymentIntentConfigBranding": { - "type": "object", - "additionalProperties": false, - "properties": { - "logoUrl": { - "type": "string", - "maxLength": 2048, - "nullable": true - }, - "faviconUrl": { - "type": "string", - "maxLength": 2048, - "nullable": true - } - } - }, - "PaymentStatusResponse": { - "type": "object", - "additionalProperties": false, - "properties": { - "transactionDateTime": { - "type": "string", - "nullable": true - }, - "eventType": { - "$ref": "#/components/schemas/EventType" - }, - "authCode": { - "type": "string", - "nullable": true - }, - "cardNumber": { - "type": "string", - "nullable": true - }, - "expiryDate": { - "type": "string", - "nullable": true - }, - "cardType": { - "type": "string", - "nullable": true - }, - "cardholderName": { - "type": "string", - "nullable": true - } - } - }, - "EventType": { - "type": "string", - "description": "", - "x-enumNames": [ - "Created", - "Authorized", - "Captured", - "Reversed", - "Refunded", - "Canceled", - "AuthChallenged", - "Declined", - "ManualAuthReady", - "Error", - "Unknown" - ], - "enum": [ - "Created", - "Authorized", - "Captured", - "Reversed", - "Refunded", - "Canceled", - "AuthChallenged", - "Declined", - "ManualAuthReady", - "Error", - "Unknown" - ] - }, - "SearchPaymentIntentRequest": { - "type": "object", - "additionalProperties": false, - "properties": { - "paymentSource": { - "type": "string", - "maxLength": 60, - "nullable": true - }, - "statuses": { - "type": "array", - "nullable": true, - "items": { - "$ref": "#/components/schemas/PaymentIntentStatus" - } - }, - "startDate": { - "type": "string", - "format": "date-time", - "nullable": true - }, - "endDate": { - "type": "string", - "format": "date-time", - "nullable": true - }, - "cursor": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/Cursor" - } - ] - } - } - }, - "Cursor": { - "type": "object", - "additionalProperties": false, - "properties": { - "limit": { - "type": "integer", - "format": "int32" - }, - "before": { - "type": "string", - "nullable": true - }, - "after": { - "type": "string", - "nullable": true - } - } - }, - "CreatePaymentIntentRequest": { - "type": "object", - "additionalProperties": false, - "required": [ - "amount", - "reference" - ], - "properties": { - "captureMode": { - "$ref": "#/components/schemas/CaptureMode" - }, - "amount": { - "$ref": "#/components/schemas/Money" - }, - "tipsAmount": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/Money" - } - ] - }, - "reference": { - "type": "string", - "maxLength": 60, - "minLength": 1 - }, - "description": { - "type": "string", - "maxLength": 4096, - "nullable": true - }, - "customer": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/Customer" - } - ] - }, - "billingAddress": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/Address" - } - ] - }, - "shippingDetails": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/ShippingDetails" - } - ] - }, - "transactionSource": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/TransactionSource" - } - ] - }, - "config": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/PaymentIntentConfigRequest" - } - ] - }, - "requestSecurity": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/RequestSecurity" - } - ] - }, - "itemLines": { - "type": "array", - "nullable": true, - "items": { - "$ref": "#/components/schemas/ItemLine" - } - }, - "taxLines": { - "type": "array", - "nullable": true, - "items": { - "$ref": "#/components/schemas/TaxLine" - } - }, - "paymentMethods": { - "type": "array", - "nullable": true, - "items": { - "$ref": "#/components/schemas/PaymentMethod" - } - }, - "actionLink": { - "nullable": true, - "oneOf": [ - { - "$ref": "#/components/schemas/ActionLink" - } - ] - }, - "autoExpireAction": { - "$ref": "#/components/schemas/AutoExpireAction" - }, - "autoExpireAt": { - "type": "string", - "format": "date-time" - }, - "paymentSource": { - "type": "string", - "maxLength": 60, - "nullable": true - }, - "metadata": { - "type": "object", - "nullable": true, - "additionalProperties": { - "type": "string" - } - } - } - }, - "PaymentIntentConfigRequest": { - "allOf": [ - { - "$ref": "#/components/schemas/PaymentIntentConfigBase" - }, - { - "type": "object", - "additionalProperties": false - } - ] - }, - "AutoExpireAction": { - "type": "string", - "description": "", - "x-enumNames": [ - "Release", - "Capture" - ], - "enum": [ - "Release", - "Capture" - ] - }, - "SetTipsAmountRequest": { - "type": "object", - "additionalProperties": false, - "required": [ - "tipsAmount" - ], - "properties": { - "tipsAmount": { - "$ref": "#/components/schemas/Money" - } - } - }, - "SetAmountRequest": { - "type": "object", - "additionalProperties": false, - "required": [ - "amount" - ], - "properties": { - "amount": { - "$ref": "#/components/schemas/Money" - } - } - }, - "Refund": { - "type": "object", - "additionalProperties": false, - "properties": { - "paymentIntentId": { - "type": "string", - "nullable": true - }, - "refundId": { - "type": "string", - "nullable": true - }, - "refundReason": { - "type": "string", - "nullable": true - }, - "notes": { - "type": "string", - "nullable": true - } - } - }, - "SendEmailReceiptRequest": { - "type": "object", - "additionalProperties": false, - "required": [ - "emails" - ], - "properties": { - "emails": { - "type": "array", - "items": { - "type": "string" - } - } - } - }, - "CreateRefundRequest": { - "type": "object", - "additionalProperties": false, - "required": [ - "amount" - ], - "properties": { - "amount": { - "type": "integer", - "format": "int64" - }, - "previousTransactionId": { - "type": "string", - "maxLength": 100, - "nullable": true - }, - "refundReason": { - "type": "string", - "maxLength": 1024, - "nullable": true - }, - "notes": { - "type": "string", - "maxLength": 4096, - "nullable": true - } - } - } - } - } -} \ No newline at end of file diff --git a/Dojo.OpenApiGenerator.TestWebApi/Services/HelloWorldService.cs b/Dojo.OpenApiGenerator.TestWebApi/Services/HelloWorldService.cs index 7f00417..887b784 100644 --- a/Dojo.OpenApiGenerator.TestWebApi/Services/HelloWorldService.cs +++ b/Dojo.OpenApiGenerator.TestWebApi/Services/HelloWorldService.cs @@ -1,4 +1,5 @@ using System; +using System.Threading; using System.Threading.Tasks; using Dojo.Generators.Abstractions; using Dojo.OpenApiGenerator.TestWebApi.Exceptions; @@ -9,7 +10,7 @@ namespace Dojo.OpenApiGenerator.TestWebApi.Services [AutoInterface] public partial class HelloWorldService { - public Task HelloFromSourceAsync(long number) + public Task HelloFromSourceAsync(long number, CancellationToken cancellationToken) { var result = GetHelloFromSourceGeneratedApiModel(number); @@ -21,7 +22,7 @@ public partial class HelloWorldService return Task.FromResult(result); } - public Task HelloGenerated2Async() + public Task HelloGenerated2Async(CancellationToken cancellationToken) { return Task.FromResult("Hello Generated 3"); } diff --git a/Dojo.OpenApiGenerator/AutoApiGenerator.cs b/Dojo.OpenApiGenerator/AutoApiGenerator.cs index d3afe53..6a88c2b 100644 --- a/Dojo.OpenApiGenerator/AutoApiGenerator.cs +++ b/Dojo.OpenApiGenerator/AutoApiGenerator.cs @@ -47,11 +47,11 @@ public void Initialize(GeneratorInitializationContext context) //#if DEBUG // if (!Debugger.IsAttached) // { -// Debugger.Launch(); +// Debugger.Launch(); // } //#endif -// Debug.WriteLine("Initialize code generator"); +// Debug.WriteLine("Initialize code generator"); } public void Execute(GeneratorExecutionContext context) diff --git a/Dojo.OpenApiGenerator/CodeTemplates/AbstractControllerTemplate.mustache b/Dojo.OpenApiGenerator/CodeTemplates/AbstractControllerTemplate.mustache index 1801267..937b322 100644 --- a/Dojo.OpenApiGenerator/CodeTemplates/AbstractControllerTemplate.mustache +++ b/Dojo.OpenApiGenerator/CodeTemplates/AbstractControllerTemplate.mustache @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; +using System.Threading; using System.Threading.Tasks; using System.CodeDom.Compiler; using System.ComponentModel.DataAnnotations; diff --git a/Dojo.OpenApiGenerator/Dojo.OpenApiGenerator.csproj b/Dojo.OpenApiGenerator/Dojo.OpenApiGenerator.csproj index 60269fc..d00cc2e 100644 --- a/Dojo.OpenApiGenerator/Dojo.OpenApiGenerator.csproj +++ b/Dojo.OpenApiGenerator/Dojo.OpenApiGenerator.csproj @@ -70,6 +70,11 @@ + + + + + $(GetTargetPathDependsOn);GetDependencyTargetPaths diff --git a/Dojo.OpenApiGenerator/Models/ApiControllerAction.cs b/Dojo.OpenApiGenerator/Models/ApiControllerAction.cs index ade24ba..5bdf6a8 100644 --- a/Dojo.OpenApiGenerator/Models/ApiControllerAction.cs +++ b/Dojo.OpenApiGenerator/Models/ApiControllerAction.cs @@ -173,13 +173,14 @@ private IEnumerable GetUnsuccessfulResponses() private string GetInputActionParametersString() { + var actionParameterBuilder = new StringBuilder(); + if (!HasAnyParameters && !HasRequestBody) { - return null; + AppendCancellationTokenParameterSignature(actionParameterBuilder); + return actionParameterBuilder.ToString(); } - var actionParameterBuilder = new StringBuilder(); - if (HasRequestBody) { actionParameterBuilder.Append( @@ -196,6 +197,7 @@ private string GetInputActionParametersString() if (!parametersWithoutVersion.Any()) { + AppendCancellationTokenParameterSignature(actionParameterBuilder); return actionParameterBuilder.ToString(); } @@ -223,6 +225,8 @@ private string GetInputActionParametersString() TryAppendParameterDefaultValue(apiParameter, actionParameterBuilder); } + AppendCancellationTokenParameterSignature(actionParameterBuilder); + return actionParameterBuilder.ToString(); } @@ -234,12 +238,14 @@ private bool ExcludeVersionParameter(ApiParameterBase apiParameter) private string GetInputServiceCallParametersString() { + var builder = new StringBuilder(); + if (!HasAnyParameters && !HasRequestBody) { - return null; + AppendCancellationTokenParameter(builder); + return builder.ToString(); } - var builder = new StringBuilder(); var index = 0; var parametersWithoutVersion = AllParameters @@ -268,17 +274,22 @@ private string GetInputServiceCallParametersString() builder.Append(RequestBody.SourceCodeName); } + AppendCancellationTokenParameter(builder); + return builder.ToString(); } private string GetInputServiceParametersString() { + var builder = new StringBuilder(); + if (!HasAnyParameters && !HasRequestBody) { - return null; + AppendCancellationTokenParameterSignature(builder); + return builder.ToString(); } - var builder = new StringBuilder(); + var index = 0; var parametersWithoutVersion = AllParameters .Where(p => !ExcludeVersionParameter(p)) @@ -310,6 +321,8 @@ private string GetInputServiceParametersString() builder.Append(RequestBody.SourceCodeName); } + AppendCancellationTokenParameterSignature(builder); + return builder.ToString(); } @@ -474,5 +487,11 @@ private static string GetParameterSignature(string constraints, string typeFullN { return $"{constraints} {typeFullName} {parameterName}"; } + + private static void AppendCancellationTokenParameterSignature(StringBuilder builder) + => builder.Append(builder.Length > 0 ? $"{InputParametersSeparator}CancellationToken cancellationToken" : "CancellationToken cancellationToken"); + + private static void AppendCancellationTokenParameter(StringBuilder builder) + => builder.Append(builder.Length > 0 ? $"{InputParametersSeparator}cancellationToken" : "cancellationToken"); } } diff --git a/Dojo.OpenApiGenerator/Models/ApiModel.cs b/Dojo.OpenApiGenerator/Models/ApiModel.cs index 9be0d7d..83f25cf 100644 --- a/Dojo.OpenApiGenerator/Models/ApiModel.cs +++ b/Dojo.OpenApiGenerator/Models/ApiModel.cs @@ -40,10 +40,16 @@ public ApiModel( } } - public ApiModel(OpenApiSchema openApiSchema, IDictionary apiModels, string apiFileName) : base(openApiSchema, apiModels, apiFileName, string.Empty) + public ApiModel(OpenApiSchema openApiSchema, IDictionary apiModels, string apiFileName, string name = null) : base(openApiSchema, apiModels, apiFileName, string.Empty) { + if (!string.IsNullOrWhiteSpace(name)) + { + Name = name; + } + if (IsBuiltInType) { + ResolveType(openApiSchema); } } diff --git a/Dojo.OpenApiGenerator/Models/ApiModelBase.cs b/Dojo.OpenApiGenerator/Models/ApiModelBase.cs index 42a2837..9222cab 100644 --- a/Dojo.OpenApiGenerator/Models/ApiModelBase.cs +++ b/Dojo.OpenApiGenerator/Models/ApiModelBase.cs @@ -28,9 +28,9 @@ internal abstract class ApiModelBase : BaseGeneratedCodeModel public IList InnerTypes { get; private set; } public string Version { get; set; } public string SourceCodeVersion { get; set; } - public ApiModel BaseModel => ApiModels[BaseModelReference]; + public ApiModel BaseModel => !string.IsNullOrWhiteSpace(BaseModelReference) ? ApiModels[BaseModelReference] : null; public bool IsReferenceType { get; } - public ApiModel ReferenceModel => ApiModels[ModelReference]; + public ApiModel ReferenceModel => !string.IsNullOrWhiteSpace(ModelReference) ? ApiModels[ModelReference] : null; public object DefaultValue { get; private set; } public bool IsNullable { get; private set; } public int? MaxLength { get; } @@ -129,6 +129,13 @@ private void ResolveArray(OpenApiSchema openApiSchema) { var arrayItemType = new ApiModel(openApiSchema.Items, ApiModels, ApiFileName); + if (string.IsNullOrWhiteSpace(Name)) + { + var typeName = arrayItemType.IsBuiltInType ? arrayItemType.TypeName : arrayItemType.Name ?? arrayItemType.ReferenceModel?.Name; + var name = openApiSchema.Description ?? $"{typeName}s"; + Name = name; + } + InnerTypes = new List { arrayItemType diff --git a/TestApp/TestApp.csproj b/TestApp/TestApp.csproj index a65ae90..afe426b 100644 --- a/TestApp/TestApp.csproj +++ b/TestApp/TestApp.csproj @@ -22,6 +22,7 @@ analyzers + diff --git a/build/Dockerfile b/build/Dockerfile index 2dfecea..a78194c 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -8,7 +8,15 @@ RUN echo "Publishing $VERSION_SUFFIX to $NEXUS_URL" WORKDIR /src ADD . . RUN dotnet restore /src/Dojo.Generators.sln --configfile /src/NuGet.config -RUN dotnet build --no-restore /src/Dojo.Generators.sln -c Release + +RUN dotnet build --no-restore /src/Dojo.Generators.Core/Dojo.Generators.Core.csproj -c Release +RUN dotnet build --no-restore /src/Dojo.Generators.Abstractions/Dojo.Generators.Abstractions.csproj -c Release +RUN dotnet build --no-restore /src/Dojo.AutoGenerators/Dojo.AutoGenerators.csproj -c Release +RUN dotnet build --no-restore /src/Dojo.OpenApiGenerator/Dojo.OpenApiGenerator.csproj -c Release +#RUN dotnet build --no-restore /src/TestApp/TestApp.csproj -c Release +#RUN dotnet build --no-restore /src/Dojo.OpenApiGenerator.TestWebApi/Dojo.OpenApiGenerator.TestWebApi.csproj -c Release + +RUN dotnet build --no-restore /src/Dojo.Generators.Tests/Dojo.Generators.Tests.csproj -c Release RUN dotnet test --no-build /src/Dojo.Generators.Tests/Dojo.Generators.Tests.csproj -c Release RUN chmod +x /src/build/publish.sh diff --git a/build/Dockerfile_build b/build/Dockerfile_build new file mode 100644 index 0000000..5bb9578 --- /dev/null +++ b/build/Dockerfile_build @@ -0,0 +1,13 @@ +FROM mcr.microsoft.com/dotnet/sdk:6.0 as builder + +WORKDIR /src +ADD . . +RUN dotnet restore /src/Dojo.Generators.sln --configfile /src/NuGet.config +RUN dotnet build --no-restore /src/Dojo.Generators.Core/Dojo.Generators.Core.csproj -c Release +RUN dotnet build --no-restore /src/Dojo.Generators.Abstractions/Dojo.Generators.Abstractions.csproj -c Release +RUN dotnet build --no-restore /src/Dojo.AutoGenerators/Dojo.AutoGenerators.csproj -c Release +RUN dotnet build --no-restore /src/Dojo.OpenApiGenerator/Dojo.OpenApiGenerator.csproj -c Release +#RUN dotnet build --no-restore /src/TestApp/TestApp.csproj -c Release +#RUN dotnet build --no-restore /src/Dojo.OpenApiGenerator.TestWebApi/Dojo.OpenApiGenerator.TestWebApi.csproj -c Release +RUN dotnet build --no-restore /src/Dojo.Generators.Tests/Dojo.Generators.Tests.csproj -c Release +RUN dotnet test --no-build /src/Dojo.Generators.Tests/Dojo.Generators.Tests.csproj -c Release \ No newline at end of file diff --git a/build/cloudbuild-build-only.yaml b/build/cloudbuild-build-only.yaml new file mode 100644 index 0000000..ef8f67b --- /dev/null +++ b/build/cloudbuild-build-only.yaml @@ -0,0 +1,9 @@ +steps: + - name: gcr.io/cloud-builders/gsutil + id: 'nexus-nuget-config' + args: ["cp", "gs://firefly-devops-2018-configuration/NuGet.config", "."] + + - name: 'gcr.io/cloud-builders/docker' + id: 'build-and-test' + entrypoint: 'bash' + args: ['-c', 'docker build -f ./build/Dockerfile_build .'] \ No newline at end of file