From 7f3927f450ab763ec37074abcbd939a0f29b031b Mon Sep 17 00:00:00 2001 From: "sumup-release-bot[bot]" <241716704+sumup-release-bot[bot]@users.noreply.github.com> Date: Wed, 25 Nov 2026 15:10:45 +0000 Subject: [PATCH 1/3] chore: synced local 'openapi.json' with remote 'specs/openapi31.json' --- openapi.json | 71 +++++++++++++++++++++++++--------------------------- 1 file changed, 34 insertions(+), 37 deletions(-) diff --git a/openapi.json b/openapi.json index a841579e..349895f6 100644 --- a/openapi.json +++ b/openapi.json @@ -1,4 +1,13 @@ { + "x-tagGroups": [ + { + "name": "Readers", + "tags": [ + "ReaderCheckouts", + "ReaderSettings" + ] + } + ], "openapi": "3.1.0", "info": { "title": "SumUp REST API", @@ -114,6 +123,16 @@ ], "x-displayName": "Sales" }, + { + "description": "Create, retrieve, and terminate payments on a card reader.", + "name": "ReaderCheckouts", + "x-displayName": "Checkouts" + }, + { + "description": "Retrieve and update card reader settings.", + "name": "ReaderSettings", + "x-displayName": "Settings" + }, { "name": "Tokens", "description": "Merchant tokens let your application accept card-present payments with SumUp SDKs that support token-based authentication. Use them when you want users to sign in to your application with your own authentication, then accept payments for a SumUp merchant account.\n\nCreate tokens on your backend using one of the [supported authentication methods](https://developer.sumup.com/api/authentication). Keep your authentication credentials on your backend. Return only the short-lived merchant token to your application and pass its `access_token` to the SDK.\n\nBefore returning a token, authenticate the user in your application and check that they can accept payments for the requested merchant account. A merchant token is limited to that account and the requested actions, and does not grant permissions beyond those of the identity that created it.\n\nTokens expire 15 minutes after creation. Use `expires_in` to determine the remaining lifetime and create a new token when needed. This endpoint does not return a refresh token. Treat merchant tokens as secrets: send them over HTTPS and keep them out of URLs, logs, and source code.", @@ -2365,8 +2384,7 @@ "amount": { "type": "integer", "description": "Amount to refund in minor units of the transaction's currency, for example `500` for EUR 5.00. It must be greater than zero and cannot exceed the amount eligible for a refund. Eligibility depends on the transaction and country/currency rules. If omitted, the system requests a full refund.", - "example": 500, - "minimum": 0 + "example": 500 } } }, @@ -6282,7 +6300,6 @@ "return_url": "https://example.com/sumup/webhook", "total_amount": { "currency": "EUR", - "minor_unit": 2, "value": 1500 } }, @@ -6420,10 +6437,10 @@ ], "summary": "Create a Reader Checkout", "tags": [ - "Readers" + "ReaderCheckouts" ], "x-codegen": { - "method_name": "create_checkout" + "method_name": "create" }, "x-permissions": [ "readers.checkouts.create" @@ -6674,10 +6691,10 @@ ], "summary": "Get Reader Settings", "tags": [ - "Readers" + "ReaderSettings" ], "x-codegen": { - "method_name": "get_reader_settings" + "method_name": "get" }, "x-permissions": [ "readers.checkouts.view" @@ -6837,10 +6854,10 @@ ], "summary": "Update Reader Settings", "tags": [ - "Readers" + "ReaderSettings" ], "x-codegen": { - "method_name": "update_reader_settings" + "method_name": "update" }, "x-permissions": [ "readers.checkouts.create" @@ -6988,10 +7005,10 @@ ], "summary": "Terminate a Reader Checkout", "tags": [ - "Readers" + "ReaderCheckouts" ], "x-codegen": { - "method_name": "terminate_checkout" + "method_name": "terminate" }, "x-permissions": [ "readers.checkouts.delete" @@ -7104,10 +7121,10 @@ ], "summary": "Get a Reader Checkout", "tags": [ - "Readers" + "ReaderCheckouts" ], "x-codegen": { - "method_name": "get_checkout" + "method_name": "get" }, "x-permissions": [ "readers.checkouts.view" @@ -9301,6 +9318,7 @@ "ALELO", "AMEX", "BANCOMAT", + "CARNET", "CONECS", "CUP", "DINERS", @@ -13015,7 +13033,6 @@ "status": "pending", "total_amount": { "currency": "EUR", - "minor_unit": 2, "value": 10000 }, "updated_at": "2026-07-07T20:42:18.117244Z", @@ -13099,10 +13116,9 @@ "type": "string" }, "total_amount": { - "description": "Amount structure.\n\nThe amount is represented as an integer value altogether with the currency and the minor unit.\n\nFor example, EUR 1.00 is represented as value 100 with minor unit of 2.\n", + "description": "The checkout amount. The value uses two decimal places, even for currencies\nsuch as CLP that use zero decimal places in the create request.\n\nFor example, EUR 10.00 is returned as `1000` and CLP 1000 as `100000`.\n", "example": { "currency": "EUR", - "minor_unit": 2, "value": 1000 }, "properties": { @@ -13111,12 +13127,6 @@ "example": "EUR", "type": "string" }, - "minor_unit": { - "description": "The minor units of the currency.\nIt represents the number of decimals of the currency. For the currencies CLP, COP and HUF, the minor unit is 0.\n", - "example": 2, - "minimum": 0, - "type": "integer" - }, "value": { "description": "Integer value of the amount.", "example": 1000, @@ -13126,10 +13136,8 @@ }, "required": [ "currency", - "minor_unit", "value" ], - "title": "Money", "type": "object" }, "updated_at": { @@ -13601,7 +13609,6 @@ "tip_timeout": 60, "total_amount": { "currency": "EUR", - "minor_unit": 2, "value": 5033 } }, @@ -13731,10 +13738,9 @@ "type": "integer" }, "total_amount": { - "description": "Amount structure.\n\nThe amount is represented as an integer value altogether with the currency and the minor unit.\n\nFor example, EUR 1.00 is represented as value 100 with minor unit of 2.\n", + "description": "Amount to charge in minor units. Use the decimal places for the currency.\nCLP, COP, and HUF use zero decimal places.\n\nFor example, send `1234` for EUR 12.34 or `1000` for CLP 1000.\n", "example": { "currency": "EUR", - "minor_unit": 2, "value": 1000 }, "properties": { @@ -13743,12 +13749,6 @@ "example": "EUR", "type": "string" }, - "minor_unit": { - "description": "The minor units of the currency.\nIt represents the number of decimals of the currency. For the currencies CLP, COP and HUF, the minor unit is 0.\n", - "example": 2, - "minimum": 0, - "type": "integer" - }, "value": { "description": "Integer value of the amount.", "example": 1000, @@ -13758,10 +13758,8 @@ }, "required": [ "currency", - "minor_unit", "value" ], - "title": "Money", "type": "object" } }, @@ -14106,8 +14104,7 @@ "amount": { "type": "integer", "description": "Amount to refund in minor units of the transaction's currency, for example `500` for EUR 5.00. It must be greater than zero and cannot exceed the amount eligible for a refund. Eligibility depends on the transaction and country/currency rules. If omitted, the system requests a full refund.", - "example": 500, - "minimum": 0 + "example": 500 } } }, From 57d253b663b9263107ea3517bc439a2a8a5efc92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matou=C5=A1=20Dzivjak?= Date: Wed, 25 Nov 2026 16:42:51 +0100 Subject: [PATCH 2/3] chore: restructure and fix --- README.md | 14 +- codegen/internal/generator/model.go | 29 +- codegen/internal/generator/render.go | 13 +- .../internal/generator/tag_hierarchy_test.go | 27 +- .../cardreader/CardReaderCheckoutExample.java | 10 +- .../sumup/sdk/clients/ReadersAsyncClient.java | 361 +----------------- .../com/sumup/sdk/clients/ReadersClient.java | 350 +---------------- .../checkouts/ReaderCheckoutsAsyncClient.java | 235 ++++++++++++ .../checkouts/ReaderCheckoutsClient.java | 226 +++++++++++ .../settings/ReaderSettingsAsyncClient.java | 162 ++++++++ .../settings/ReaderSettingsClient.java | 157 ++++++++ .../java/com/sumup/sdk/models/CardType.java | 1 + .../models/CreateReaderCheckoutRequest.java | 17 +- ...reateReaderCheckoutRequestTotalAmount.java | 64 ++++ .../models/GetReaderCheckoutResponseData.java | 18 +- ...ReaderCheckoutResponseDataTotalAmount.java | 65 ++++ src/main/java/com/sumup/sdk/models/Money.java | 85 ----- .../java/com/sumup/sdk/models/Money2.java | 85 ----- 18 files changed, 1035 insertions(+), 884 deletions(-) create mode 100644 src/main/java/com/sumup/sdk/clients/readers/checkouts/ReaderCheckoutsAsyncClient.java create mode 100644 src/main/java/com/sumup/sdk/clients/readers/checkouts/ReaderCheckoutsClient.java create mode 100644 src/main/java/com/sumup/sdk/clients/readers/settings/ReaderSettingsAsyncClient.java create mode 100644 src/main/java/com/sumup/sdk/clients/readers/settings/ReaderSettingsClient.java create mode 100644 src/main/java/com/sumup/sdk/models/CreateReaderCheckoutRequestTotalAmount.java create mode 100644 src/main/java/com/sumup/sdk/models/GetReaderCheckoutResponseDataTotalAmount.java delete mode 100644 src/main/java/com/sumup/sdk/models/Money.java delete mode 100644 src/main/java/com/sumup/sdk/models/Money2.java diff --git a/README.md b/README.md index e857606b..73567242 100644 --- a/README.md +++ b/README.md @@ -161,7 +161,7 @@ Synchronous example: ```java import com.sumup.sdk.SumUpClient; import com.sumup.sdk.models.CreateReaderCheckoutRequest; -import com.sumup.sdk.models.Money; +import com.sumup.sdk.models.CreateReaderCheckoutRequestTotalAmount; import java.util.Optional; import java.util.UUID; @@ -184,15 +184,14 @@ CreateReaderCheckoutRequest request = CreateReaderCheckoutRequest.builder() .description("sumup-java reader checkout " + UUID.randomUUID()) .totalAmount( - Money.builder() + CreateReaderCheckoutRequestTotalAmount.builder() .currency("EUR") - .minorUnit(2L) .value(1000L) // €10.00 .build()) .returnUrl("https://example.com/webhook") .build(); -client.readers().createCheckout(merchantCode, readerId, request); +client.readers().checkouts().create(merchantCode, readerId, request); System.out.println("Reader checkout created."); ``` @@ -201,7 +200,7 @@ Asynchronous example: ```java import com.sumup.sdk.SumUpAsyncClient; import com.sumup.sdk.models.CreateReaderCheckoutRequest; -import com.sumup.sdk.models.Money; +import com.sumup.sdk.models.CreateReaderCheckoutRequestTotalAmount; import java.util.Optional; import java.util.UUID; import java.util.concurrent.CompletableFuture; @@ -236,15 +235,14 @@ readerIdFuture CreateReaderCheckoutRequest.builder() .description("sumup-java reader checkout " + UUID.randomUUID()) .totalAmount( - Money.builder() + CreateReaderCheckoutRequestTotalAmount.builder() .currency("EUR") - .minorUnit(2L) .value(1000L) .build()) .returnUrl("https://example.com/webhook") .build(); - return client.readers().createCheckout(merchantCode, readerId, request); + return client.readers().checkouts().create(merchantCode, readerId, request); }) .thenAccept( response -> diff --git a/codegen/internal/generator/model.go b/codegen/internal/generator/model.go index 759a9f0b..b577724f 100644 --- a/codegen/internal/generator/model.go +++ b/codegen/internal/generator/model.go @@ -12,11 +12,10 @@ import ( // sdkModel represents the aggregate information needed to render the SDK. type sdkModel struct { - BasePackage string - ClientPackage string - ModelPackage string - Clients []clientModel - Schemas []schemaModel + BasePackage string + ModelPackage string + Clients []clientModel + Schemas []schemaModel } // clientModel encapsulates the data necessary to render a Java API client. @@ -36,6 +35,7 @@ type clientModel struct { type childClient struct { ClassName string AccessorName string + Package string } // operationModel stores the derived metadata for one OpenAPI operation. @@ -238,13 +238,19 @@ func buildModel(doc *v3.Document, params Params) (sdkModel, error) { for i := range clients { client := &clients[i] path := client.AccessorName + "()" + packageSuffix := client.AccessorName for ancestor := parents[client.TagName].tag; ancestor != ""; ancestor = parents[ancestor].tag { - path = byTag[ancestor].AccessorName + "()." + path + accessor := byTag[ancestor].AccessorName + path = accessor + "()." + path + packageSuffix = accessor + "." + packageSuffix } client.AccessPath = path if parent := byTag[parents[client.TagName].tag]; parent != nil { + client.Package += "." + strings.ToLower(packageSuffix) parent.Children = append(parent.Children, childClient{ - ClassName: client.ClassName, AccessorName: client.AccessorName, + ClassName: client.ClassName, + AccessorName: client.AccessorName, + Package: client.Package, }) } } @@ -253,11 +259,10 @@ func buildModel(doc *v3.Document, params Params) (sdkModel, error) { schemas = append(schemas, resolver.inlineSchemaModels(params)...) return sdkModel{ - BasePackage: params.BasePackage, - ClientPackage: params.clientPackage(), - ModelPackage: params.modelPackage(), - Clients: clients, - Schemas: schemas, + BasePackage: params.BasePackage, + ModelPackage: params.modelPackage(), + Clients: clients, + Schemas: schemas, }, nil } diff --git a/codegen/internal/generator/render.go b/codegen/internal/generator/render.go index 5fa3e86c..2efd8f56 100644 --- a/codegen/internal/generator/render.go +++ b/codegen/internal/generator/render.go @@ -33,12 +33,16 @@ func renderClients(model sdkModel, params Params) error { } for _, client := range model.Clients { + clientDir := filepath.Join(params.OutputDir, filepath.FromSlash(strings.ReplaceAll(client.Package, ".", "/"))) + if err := os.MkdirAll(clientDir, 0o755); err != nil { + return fmt.Errorf("create %s package directory: %w", client.Package, err) + } data := prepareClientTemplateData(client, client.ClassName, false) var buf bytes.Buffer if err := syncTmpl.Execute(&buf, data); err != nil { return fmt.Errorf("render client %s: %w", client.ClassName, err) } - target := filepath.Join(dir, client.ClassName+".java") + target := filepath.Join(clientDir, client.ClassName+".java") if err := os.WriteFile(target, buf.Bytes(), 0o644); err != nil { return fmt.Errorf("write client %s: %w", client.ClassName, err) } @@ -48,7 +52,7 @@ func renderClients(model sdkModel, params Params) error { if err := asyncTmpl.Execute(&buf, asyncData); err != nil { return fmt.Errorf("render async client %s: %w", asyncData.ClassName, err) } - asyncTarget := filepath.Join(dir, asyncData.ClassName+".java") + asyncTarget := filepath.Join(clientDir, asyncData.ClassName+".java") if err := os.WriteFile(asyncTarget, buf.Bytes(), 0o644); err != nil { return fmt.Errorf("write async client %s: %w", asyncData.ClassName, err) } @@ -194,6 +198,9 @@ func prepareClientTemplateData(client clientModel, className string, async bool) if async { importSet["java.util.concurrent.CompletableFuture"] = struct{}{} } + for _, child := range children { + importSet[child.Package+"."+child.ClassName] = struct{}{} + } operations := make([]operationTemplateData, 0, len(client.Methods)) var queryStructs []*parameterGroupModel @@ -355,7 +362,7 @@ func prepareSumUpClientData(model sdkModel, className string, async bool) map[st if async { clientClass = asyncClientClassName(clientClass) } - imports = append(imports, fmt.Sprintf("%s.%s", model.ClientPackage, clientClass)) + imports = append(imports, client.Package+"."+clientClass) clientInfos = append(clientInfos, map[string]string{ "ClassName": clientClass, "FieldName": client.FieldName, diff --git a/codegen/internal/generator/tag_hierarchy_test.go b/codegen/internal/generator/tag_hierarchy_test.go index 318c3384..bb30ab37 100644 --- a/codegen/internal/generator/tag_hierarchy_test.go +++ b/codegen/internal/generator/tag_hierarchy_test.go @@ -1,6 +1,9 @@ package generator import ( + "os" + "path/filepath" + "strings" "testing" "github.com/pb33f/libopenapi" @@ -42,7 +45,8 @@ components: {schemas: {}} t.Fatal(err) } - sdk, err := buildModel(&model.Model, Params{BasePackage: "com.sumup.sdk"}) + params := Params{BasePackage: "com.sumup.sdk", OutputDir: t.TempDir()} + sdk, err := buildModel(&model.Model, params) if err != nil { t.Fatal(err) } @@ -61,4 +65,25 @@ components: {schemas: {}} if len(sdk.Clients) != 2 { t.Fatalf("expected two clients, got %d", len(sdk.Clients)) } + if err := renderClients(sdk, params); err != nil { + t.Fatal(err) + } + root := filepath.Join(params.OutputDir, params.clientPackagePath()) + for _, variant := range []string{"Client", "AsyncClient"} { + childClass := "ReaderCheckouts" + variant + child, err := os.ReadFile(filepath.Join(root, "readers", "checkouts", childClass+".java")) + if err != nil { + t.Fatal(err) + } + if !strings.Contains(string(child), "package com.sumup.sdk.clients.readers.checkouts;") { + t.Errorf("%s declares the wrong package", childClass) + } + parent, err := os.ReadFile(filepath.Join(root, "Readers"+variant+".java")) + if err != nil { + t.Fatal(err) + } + if !strings.Contains(string(parent), "import com.sumup.sdk.clients.readers.checkouts."+childClass+";") { + t.Errorf("Readers%s does not import %s", variant, childClass) + } + } } diff --git a/examples/card-reader-checkout/src/main/java/com/sumup/examples/cardreader/CardReaderCheckoutExample.java b/examples/card-reader-checkout/src/main/java/com/sumup/examples/cardreader/CardReaderCheckoutExample.java index 15cf31bb..ad3ef97b 100644 --- a/examples/card-reader-checkout/src/main/java/com/sumup/examples/cardreader/CardReaderCheckoutExample.java +++ b/examples/card-reader-checkout/src/main/java/com/sumup/examples/cardreader/CardReaderCheckoutExample.java @@ -3,7 +3,7 @@ import com.sumup.sdk.SumUpClient; import com.sumup.sdk.core.ApiException; import com.sumup.sdk.models.CreateReaderCheckoutRequest; -import com.sumup.sdk.models.Money; +import com.sumup.sdk.models.CreateReaderCheckoutRequestTotalAmount; import java.util.Optional; import java.util.UUID; @@ -40,11 +40,15 @@ private static boolean createReaderCheckout( CreateReaderCheckoutRequest request = CreateReaderCheckoutRequest.builder() .description("sumup-java card reader checkout " + checkoutReference) - .totalAmount(Money.builder().currency("EUR").minorUnit(2L).value(1000L).build()) + .totalAmount( + CreateReaderCheckoutRequestTotalAmount.builder() + .currency("EUR") + .value(1000L) + .build()) .build(); try { - client.readers().createCheckout(merchantCode, readerId, request); + client.readers().checkouts().create(merchantCode, readerId, request); return true; } catch (ApiException ex) { System.err.printf( diff --git a/src/main/java/com/sumup/sdk/clients/ReadersAsyncClient.java b/src/main/java/com/sumup/sdk/clients/ReadersAsyncClient.java index 0b1e1046..84817361 100644 --- a/src/main/java/com/sumup/sdk/clients/ReadersAsyncClient.java +++ b/src/main/java/com/sumup/sdk/clients/ReadersAsyncClient.java @@ -2,6 +2,8 @@ package com.sumup.sdk.clients; import com.fasterxml.jackson.core.type.TypeReference; +import com.sumup.sdk.clients.readers.checkouts.ReaderCheckoutsAsyncClient; +import com.sumup.sdk.clients.readers.settings.ReaderSettingsAsyncClient; import com.sumup.sdk.core.ApiClient; import com.sumup.sdk.core.ApiException; import com.sumup.sdk.core.HttpMethod; @@ -19,6 +21,8 @@ */ public final class ReadersAsyncClient { private final ApiClient apiClient; + private final ReaderCheckoutsAsyncClient checkouts; + private final ReaderSettingsAsyncClient settings; /** * Creates a new ReadersAsyncClient instance backed by the provided ApiClient. @@ -27,6 +31,22 @@ public final class ReadersAsyncClient { */ public ReadersAsyncClient(ApiClient apiClient) { this.apiClient = Objects.requireNonNull(apiClient, "apiClient"); + this.checkouts = new ReaderCheckoutsAsyncClient(apiClient); + this.settings = new ReaderSettingsAsyncClient(apiClient); + } + + /** + * @return the checkouts client. + */ + public ReaderCheckoutsAsyncClient checkouts() { + return checkouts; + } + + /** + * @return the settings client. + */ + public ReaderSettingsAsyncClient settings() { + return settings; } /** @@ -84,85 +104,6 @@ public CompletableFuture create( requestOptions); } - /** - * Create a Reader Checkout - * - *

Creates a Checkout for a Reader. This process is asynchronous and the actual transaction may - * take some time to be started on the device. There are some caveats when using this endpoint: * - * The target device must be online, otherwise checkout won't be accepted * After the checkout is - * accepted, the system has 60 seconds to start the payment on the target device. During this - * time, any other checkout for the same device will be rejected. **Note**: If the target device - * is a Solo, it must be in version 3.3.24.3 or higher. Optionally include an `affiliate` object - * to attach integrator metadata to the payment. Provide both `app_id` and `key` when including - * this object. - * - *

Operation ID: CreateReaderCheckout - * - * @param merchantCode Merchant Code - * @param readerId The unique identifier of the Reader - * @param request A checkout initial attributes - *

Call the overload that accepts RequestOptions to customize headers, authorization, or - * request timeout. - * @return CompletableFuture resolved with com.sumup.sdk.models.CreateReaderCheckoutResponse - * parsed response. - * @throws ApiException if the SumUp API returns an error. - */ - public CompletableFuture createCheckout( - String merchantCode, - String readerId, - com.sumup.sdk.models.CreateReaderCheckoutRequest request) - throws ApiException { - return createCheckout(merchantCode, readerId, request, null); - } - - /** - * Create a Reader Checkout - * - *

Creates a Checkout for a Reader. This process is asynchronous and the actual transaction may - * take some time to be started on the device. There are some caveats when using this endpoint: * - * The target device must be online, otherwise checkout won't be accepted * After the checkout is - * accepted, the system has 60 seconds to start the payment on the target device. During this - * time, any other checkout for the same device will be rejected. **Note**: If the target device - * is a Solo, it must be in version 3.3.24.3 or higher. Optionally include an `affiliate` object - * to attach integrator metadata to the payment. Provide both `app_id` and `key` when including - * this object. - * - *

Operation ID: CreateReaderCheckout - * - * @param merchantCode Merchant Code - * @param readerId The unique identifier of the Reader - * @param request A checkout initial attributes - * @param requestOptions Request-specific overrides (headers, authorization, or timeout). Pass - * {@code null} to use client defaults. - * @return CompletableFuture resolved with com.sumup.sdk.models.CreateReaderCheckoutResponse - * parsed response. - * @throws ApiException if the SumUp API returns an error. - */ - public CompletableFuture createCheckout( - String merchantCode, - String readerId, - com.sumup.sdk.models.CreateReaderCheckoutRequest request, - RequestOptions requestOptions) - throws ApiException { - Objects.requireNonNull(merchantCode, "merchantCode"); - Objects.requireNonNull(readerId, "readerId"); - Objects.requireNonNull(request, "request"); - String path = "/v0.1/merchants/{merchant_code}/readers/{reader_id}/checkout"; - path = - path.replace( - "{merchant_code}", ApiClient.urlEncode(ApiClient.parameterValue(merchantCode))); - path = path.replace("{reader_id}", ApiClient.urlEncode(ApiClient.parameterValue(readerId))); - - return this.apiClient.sendAsync( - HttpMethod.POST, - path, - null, - null, - request, - new TypeReference() {}, - requestOptions); - } - /** * Create a Go Reader Payment * @@ -358,127 +299,6 @@ public CompletableFuture get( requestOptions); } - /** - * Get a Reader Checkout - * - *

Get a Checkout for a Reader. - * - *

Operation ID: GetReaderCheckout - * - * @param checkoutId The unique identifier of the Checkout - * @param merchantCode Merchant Code - * @param readerId The unique identifier of the Reader - *

Call the overload that accepts RequestOptions to customize headers, authorization, or - * request timeout. - * @return CompletableFuture resolved with com.sumup.sdk.models.GetReaderCheckoutResponse parsed - * response. - * @throws ApiException if the SumUp API returns an error. - */ - public CompletableFuture getCheckout( - String checkoutId, String merchantCode, String readerId) throws ApiException { - return getCheckout(checkoutId, merchantCode, readerId, null); - } - - /** - * Get a Reader Checkout - * - *

Get a Checkout for a Reader. - * - *

Operation ID: GetReaderCheckout - * - * @param checkoutId The unique identifier of the Checkout - * @param merchantCode Merchant Code - * @param readerId The unique identifier of the Reader - * @param requestOptions Request-specific overrides (headers, authorization, or timeout). Pass - * {@code null} to use client defaults. - * @return CompletableFuture resolved with com.sumup.sdk.models.GetReaderCheckoutResponse parsed - * response. - * @throws ApiException if the SumUp API returns an error. - */ - public CompletableFuture getCheckout( - String checkoutId, String merchantCode, String readerId, RequestOptions requestOptions) - throws ApiException { - Objects.requireNonNull(checkoutId, "checkoutId"); - Objects.requireNonNull(merchantCode, "merchantCode"); - Objects.requireNonNull(readerId, "readerId"); - String path = "/v0.1/merchants/{merchant_code}/readers/{reader_id}/checkout/{checkout_id}"; - path = path.replace("{checkout_id}", ApiClient.urlEncode(ApiClient.parameterValue(checkoutId))); - path = - path.replace( - "{merchant_code}", ApiClient.urlEncode(ApiClient.parameterValue(merchantCode))); - path = path.replace("{reader_id}", ApiClient.urlEncode(ApiClient.parameterValue(readerId))); - - return this.apiClient.sendAsync( - HttpMethod.GET, - path, - null, - null, - null, - new TypeReference() {}, - requestOptions); - } - - /** - * Get Reader Settings - * - *

Returns the menu lock settings for a Solo reader. For an online reader, returns the current - * settings. For an offline reader, returns the last saved settings, which may differ from its - * current configuration. Returns `404` if the reader is offline and no saved settings are - * available. The response may include the menu lock PIN. - * - *

Operation ID: GetReaderSettings - * - * @param merchantCode The merchant code of the account that owns the reader. - * @param readerId The unique identifier of the reader. - *

Call the overload that accepts RequestOptions to customize headers, authorization, or - * request timeout. - * @return CompletableFuture resolved with com.sumup.sdk.models.GetReaderSettingsResponse parsed - * response. - * @throws ApiException if the SumUp API returns an error. - */ - public CompletableFuture getReaderSettings( - String merchantCode, String readerId) throws ApiException { - return getReaderSettings(merchantCode, readerId, null); - } - - /** - * Get Reader Settings - * - *

Returns the menu lock settings for a Solo reader. For an online reader, returns the current - * settings. For an offline reader, returns the last saved settings, which may differ from its - * current configuration. Returns `404` if the reader is offline and no saved settings are - * available. The response may include the menu lock PIN. - * - *

Operation ID: GetReaderSettings - * - * @param merchantCode The merchant code of the account that owns the reader. - * @param readerId The unique identifier of the reader. - * @param requestOptions Request-specific overrides (headers, authorization, or timeout). Pass - * {@code null} to use client defaults. - * @return CompletableFuture resolved with com.sumup.sdk.models.GetReaderSettingsResponse parsed - * response. - * @throws ApiException if the SumUp API returns an error. - */ - public CompletableFuture getReaderSettings( - String merchantCode, String readerId, RequestOptions requestOptions) throws ApiException { - Objects.requireNonNull(merchantCode, "merchantCode"); - Objects.requireNonNull(readerId, "readerId"); - String path = "/v0.1/merchants/{merchant_code}/readers/{reader_id}/settings"; - path = - path.replace( - "{merchant_code}", ApiClient.urlEncode(ApiClient.parameterValue(merchantCode))); - path = path.replace("{reader_id}", ApiClient.urlEncode(ApiClient.parameterValue(readerId))); - - return this.apiClient.sendAsync( - HttpMethod.GET, - path, - null, - null, - null, - new TypeReference() {}, - requestOptions); - } - /** * Get a Reader Status * @@ -599,74 +419,6 @@ public CompletableFuture list( requestOptions); } - /** - * Terminate a Reader Checkout - * - *

Terminate a Reader Checkout stops the current transaction on the target device. This process - * is asynchronous and the actual termination may take some time to be performed on the device. - * There are some caveats when using this endpoint: * The target device must be online, otherwise - * terminate won't be accepted * The action will succeed only if the device is waiting for - * cardholder action: e.g: waiting for card, waiting for PIN, etc. * There is no confirmation of - * the termination. If a transaction is successfully terminated and `return_url` was provided on - * Checkout, the transaction status will be sent as `failed` to the provided URL. **Note**: If the - * target device is a Solo, it must be in version 3.3.28.0 or higher. - * - *

Operation ID: CreateReaderTerminate - * - * @param merchantCode Merchant Code - * @param readerId The unique identifier of the Reader - * @param request A checkout initial attributes - *

Call the overload that accepts RequestOptions to customize headers, authorization, or - * request timeout. - * @return CompletableFuture completed when the request finishes. - * @throws ApiException if the SumUp API returns an error. - */ - public CompletableFuture terminateCheckout( - String merchantCode, String readerId, java.util.Map request) - throws ApiException { - return terminateCheckout(merchantCode, readerId, request, null); - } - - /** - * Terminate a Reader Checkout - * - *

Terminate a Reader Checkout stops the current transaction on the target device. This process - * is asynchronous and the actual termination may take some time to be performed on the device. - * There are some caveats when using this endpoint: * The target device must be online, otherwise - * terminate won't be accepted * The action will succeed only if the device is waiting for - * cardholder action: e.g: waiting for card, waiting for PIN, etc. * There is no confirmation of - * the termination. If a transaction is successfully terminated and `return_url` was provided on - * Checkout, the transaction status will be sent as `failed` to the provided URL. **Note**: If the - * target device is a Solo, it must be in version 3.3.28.0 or higher. - * - *

Operation ID: CreateReaderTerminate - * - * @param merchantCode Merchant Code - * @param readerId The unique identifier of the Reader - * @param request A checkout initial attributes - * @param requestOptions Request-specific overrides (headers, authorization, or timeout). Pass - * {@code null} to use client defaults. - * @return CompletableFuture completed when the request finishes. - * @throws ApiException if the SumUp API returns an error. - */ - public CompletableFuture terminateCheckout( - String merchantCode, - String readerId, - java.util.Map request, - RequestOptions requestOptions) - throws ApiException { - Objects.requireNonNull(merchantCode, "merchantCode"); - Objects.requireNonNull(readerId, "readerId"); - String path = "/v0.1/merchants/{merchant_code}/readers/{reader_id}/terminate"; - path = - path.replace( - "{merchant_code}", ApiClient.urlEncode(ApiClient.parameterValue(merchantCode))); - path = path.replace("{reader_id}", ApiClient.urlEncode(ApiClient.parameterValue(readerId))); - - return this.apiClient.sendAsync( - HttpMethod.POST, path, null, null, request, null, requestOptions); - } - /** * Update a Reader * @@ -732,79 +484,6 @@ public CompletableFuture update( requestOptions); } - /** - * Update Reader Settings - * - *

Updates the menu lock settings for a Solo reader. The reader must be online. A successful - * response confirms that the reader applied the update. Include at least one of - * `menu_lock.enabled` or `menu_lock.passcode`. Omitted settings keep their current values. The - * response contains only the settings included in the request. When enabling menu lock for a - * reader without a PIN, include a four-digit PIN in `menu_lock.passcode` in the same request. - * - *

Operation ID: UpdateReaderSettings - * - * @param merchantCode The merchant code of the account that owns the reader. - * @param readerId The unique identifier of the reader. - * @param request Menu lock settings to update. - *

Call the overload that accepts RequestOptions to customize headers, authorization, or - * request timeout. - * @return CompletableFuture resolved with com.sumup.sdk.models.UpdateReaderSettingsResponse - * parsed response. - * @throws ApiException if the SumUp API returns an error. - */ - public CompletableFuture updateReaderSettings( - String merchantCode, - String readerId, - com.sumup.sdk.models.UpdateReaderSettingsRequest request) - throws ApiException { - return updateReaderSettings(merchantCode, readerId, request, null); - } - - /** - * Update Reader Settings - * - *

Updates the menu lock settings for a Solo reader. The reader must be online. A successful - * response confirms that the reader applied the update. Include at least one of - * `menu_lock.enabled` or `menu_lock.passcode`. Omitted settings keep their current values. The - * response contains only the settings included in the request. When enabling menu lock for a - * reader without a PIN, include a four-digit PIN in `menu_lock.passcode` in the same request. - * - *

Operation ID: UpdateReaderSettings - * - * @param merchantCode The merchant code of the account that owns the reader. - * @param readerId The unique identifier of the reader. - * @param request Menu lock settings to update. - * @param requestOptions Request-specific overrides (headers, authorization, or timeout). Pass - * {@code null} to use client defaults. - * @return CompletableFuture resolved with com.sumup.sdk.models.UpdateReaderSettingsResponse - * parsed response. - * @throws ApiException if the SumUp API returns an error. - */ - public CompletableFuture updateReaderSettings( - String merchantCode, - String readerId, - com.sumup.sdk.models.UpdateReaderSettingsRequest request, - RequestOptions requestOptions) - throws ApiException { - Objects.requireNonNull(merchantCode, "merchantCode"); - Objects.requireNonNull(readerId, "readerId"); - Objects.requireNonNull(request, "request"); - String path = "/v0.1/merchants/{merchant_code}/readers/{reader_id}/settings"; - path = - path.replace( - "{merchant_code}", ApiClient.urlEncode(ApiClient.parameterValue(merchantCode))); - path = path.replace("{reader_id}", ApiClient.urlEncode(ApiClient.parameterValue(readerId))); - - return this.apiClient.sendAsync( - HttpMethod.PATCH, - path, - null, - null, - request, - new TypeReference() {}, - requestOptions); - } - /** Optional header overrides for this request. */ public static final class GetReaderHeaders { private final Map values = new LinkedHashMap<>(); diff --git a/src/main/java/com/sumup/sdk/clients/ReadersClient.java b/src/main/java/com/sumup/sdk/clients/ReadersClient.java index 94c648ca..30222cfb 100644 --- a/src/main/java/com/sumup/sdk/clients/ReadersClient.java +++ b/src/main/java/com/sumup/sdk/clients/ReadersClient.java @@ -2,6 +2,8 @@ package com.sumup.sdk.clients; import com.fasterxml.jackson.core.type.TypeReference; +import com.sumup.sdk.clients.readers.checkouts.ReaderCheckoutsClient; +import com.sumup.sdk.clients.readers.settings.ReaderSettingsClient; import com.sumup.sdk.core.ApiClient; import com.sumup.sdk.core.ApiException; import com.sumup.sdk.core.HttpMethod; @@ -18,6 +20,8 @@ */ public final class ReadersClient { private final ApiClient apiClient; + private final ReaderCheckoutsClient checkouts; + private final ReaderSettingsClient settings; /** * Creates a new ReadersClient instance backed by the provided ApiClient. @@ -26,6 +30,22 @@ public final class ReadersClient { */ public ReadersClient(ApiClient apiClient) { this.apiClient = Objects.requireNonNull(apiClient, "apiClient"); + this.checkouts = new ReaderCheckoutsClient(apiClient); + this.settings = new ReaderSettingsClient(apiClient); + } + + /** + * @return the checkouts client. + */ + public ReaderCheckoutsClient checkouts() { + return checkouts; + } + + /** + * @return the settings client. + */ + public ReaderSettingsClient settings() { + return settings; } /** @@ -83,83 +103,6 @@ public com.sumup.sdk.models.Reader create( requestOptions); } - /** - * Create a Reader Checkout - * - *

Creates a Checkout for a Reader. This process is asynchronous and the actual transaction may - * take some time to be started on the device. There are some caveats when using this endpoint: * - * The target device must be online, otherwise checkout won't be accepted * After the checkout is - * accepted, the system has 60 seconds to start the payment on the target device. During this - * time, any other checkout for the same device will be rejected. **Note**: If the target device - * is a Solo, it must be in version 3.3.24.3 or higher. Optionally include an `affiliate` object - * to attach integrator metadata to the payment. Provide both `app_id` and `key` when including - * this object. - * - *

Operation ID: CreateReaderCheckout - * - * @param merchantCode Merchant Code - * @param readerId The unique identifier of the Reader - * @param request A checkout initial attributes - *

Call the overload that accepts RequestOptions to customize headers, authorization, or - * request timeout. - * @return com.sumup.sdk.models.CreateReaderCheckoutResponse parsed response. - * @throws ApiException if the SumUp API returns an error. - */ - public com.sumup.sdk.models.CreateReaderCheckoutResponse createCheckout( - String merchantCode, - String readerId, - com.sumup.sdk.models.CreateReaderCheckoutRequest request) - throws ApiException { - return createCheckout(merchantCode, readerId, request, null); - } - - /** - * Create a Reader Checkout - * - *

Creates a Checkout for a Reader. This process is asynchronous and the actual transaction may - * take some time to be started on the device. There are some caveats when using this endpoint: * - * The target device must be online, otherwise checkout won't be accepted * After the checkout is - * accepted, the system has 60 seconds to start the payment on the target device. During this - * time, any other checkout for the same device will be rejected. **Note**: If the target device - * is a Solo, it must be in version 3.3.24.3 or higher. Optionally include an `affiliate` object - * to attach integrator metadata to the payment. Provide both `app_id` and `key` when including - * this object. - * - *

Operation ID: CreateReaderCheckout - * - * @param merchantCode Merchant Code - * @param readerId The unique identifier of the Reader - * @param request A checkout initial attributes - * @param requestOptions Request-specific overrides (headers, authorization, or timeout). Pass - * {@code null} to use client defaults. - * @return com.sumup.sdk.models.CreateReaderCheckoutResponse parsed response. - * @throws ApiException if the SumUp API returns an error. - */ - public com.sumup.sdk.models.CreateReaderCheckoutResponse createCheckout( - String merchantCode, - String readerId, - com.sumup.sdk.models.CreateReaderCheckoutRequest request, - RequestOptions requestOptions) - throws ApiException { - Objects.requireNonNull(merchantCode, "merchantCode"); - Objects.requireNonNull(readerId, "readerId"); - Objects.requireNonNull(request, "request"); - String path = "/v0.1/merchants/{merchant_code}/readers/{reader_id}/checkout"; - path = - path.replace( - "{merchant_code}", ApiClient.urlEncode(ApiClient.parameterValue(merchantCode))); - path = path.replace("{reader_id}", ApiClient.urlEncode(ApiClient.parameterValue(readerId))); - - return this.apiClient.send( - HttpMethod.POST, - path, - null, - null, - request, - new TypeReference() {}, - requestOptions); - } - /** * Create a Go Reader Payment * @@ -349,123 +292,6 @@ public com.sumup.sdk.models.Reader get( requestOptions); } - /** - * Get a Reader Checkout - * - *

Get a Checkout for a Reader. - * - *

Operation ID: GetReaderCheckout - * - * @param checkoutId The unique identifier of the Checkout - * @param merchantCode Merchant Code - * @param readerId The unique identifier of the Reader - *

Call the overload that accepts RequestOptions to customize headers, authorization, or - * request timeout. - * @return com.sumup.sdk.models.GetReaderCheckoutResponse parsed response. - * @throws ApiException if the SumUp API returns an error. - */ - public com.sumup.sdk.models.GetReaderCheckoutResponse getCheckout( - String checkoutId, String merchantCode, String readerId) throws ApiException { - return getCheckout(checkoutId, merchantCode, readerId, null); - } - - /** - * Get a Reader Checkout - * - *

Get a Checkout for a Reader. - * - *

Operation ID: GetReaderCheckout - * - * @param checkoutId The unique identifier of the Checkout - * @param merchantCode Merchant Code - * @param readerId The unique identifier of the Reader - * @param requestOptions Request-specific overrides (headers, authorization, or timeout). Pass - * {@code null} to use client defaults. - * @return com.sumup.sdk.models.GetReaderCheckoutResponse parsed response. - * @throws ApiException if the SumUp API returns an error. - */ - public com.sumup.sdk.models.GetReaderCheckoutResponse getCheckout( - String checkoutId, String merchantCode, String readerId, RequestOptions requestOptions) - throws ApiException { - Objects.requireNonNull(checkoutId, "checkoutId"); - Objects.requireNonNull(merchantCode, "merchantCode"); - Objects.requireNonNull(readerId, "readerId"); - String path = "/v0.1/merchants/{merchant_code}/readers/{reader_id}/checkout/{checkout_id}"; - path = path.replace("{checkout_id}", ApiClient.urlEncode(ApiClient.parameterValue(checkoutId))); - path = - path.replace( - "{merchant_code}", ApiClient.urlEncode(ApiClient.parameterValue(merchantCode))); - path = path.replace("{reader_id}", ApiClient.urlEncode(ApiClient.parameterValue(readerId))); - - return this.apiClient.send( - HttpMethod.GET, - path, - null, - null, - null, - new TypeReference() {}, - requestOptions); - } - - /** - * Get Reader Settings - * - *

Returns the menu lock settings for a Solo reader. For an online reader, returns the current - * settings. For an offline reader, returns the last saved settings, which may differ from its - * current configuration. Returns `404` if the reader is offline and no saved settings are - * available. The response may include the menu lock PIN. - * - *

Operation ID: GetReaderSettings - * - * @param merchantCode The merchant code of the account that owns the reader. - * @param readerId The unique identifier of the reader. - *

Call the overload that accepts RequestOptions to customize headers, authorization, or - * request timeout. - * @return com.sumup.sdk.models.GetReaderSettingsResponse parsed response. - * @throws ApiException if the SumUp API returns an error. - */ - public com.sumup.sdk.models.GetReaderSettingsResponse getReaderSettings( - String merchantCode, String readerId) throws ApiException { - return getReaderSettings(merchantCode, readerId, null); - } - - /** - * Get Reader Settings - * - *

Returns the menu lock settings for a Solo reader. For an online reader, returns the current - * settings. For an offline reader, returns the last saved settings, which may differ from its - * current configuration. Returns `404` if the reader is offline and no saved settings are - * available. The response may include the menu lock PIN. - * - *

Operation ID: GetReaderSettings - * - * @param merchantCode The merchant code of the account that owns the reader. - * @param readerId The unique identifier of the reader. - * @param requestOptions Request-specific overrides (headers, authorization, or timeout). Pass - * {@code null} to use client defaults. - * @return com.sumup.sdk.models.GetReaderSettingsResponse parsed response. - * @throws ApiException if the SumUp API returns an error. - */ - public com.sumup.sdk.models.GetReaderSettingsResponse getReaderSettings( - String merchantCode, String readerId, RequestOptions requestOptions) throws ApiException { - Objects.requireNonNull(merchantCode, "merchantCode"); - Objects.requireNonNull(readerId, "readerId"); - String path = "/v0.1/merchants/{merchant_code}/readers/{reader_id}/settings"; - path = - path.replace( - "{merchant_code}", ApiClient.urlEncode(ApiClient.parameterValue(merchantCode))); - path = path.replace("{reader_id}", ApiClient.urlEncode(ApiClient.parameterValue(readerId))); - - return this.apiClient.send( - HttpMethod.GET, - path, - null, - null, - null, - new TypeReference() {}, - requestOptions); - } - /** * Get a Reader Status * @@ -583,71 +409,6 @@ public com.sumup.sdk.models.ListReadersResponse list( requestOptions); } - /** - * Terminate a Reader Checkout - * - *

Terminate a Reader Checkout stops the current transaction on the target device. This process - * is asynchronous and the actual termination may take some time to be performed on the device. - * There are some caveats when using this endpoint: * The target device must be online, otherwise - * terminate won't be accepted * The action will succeed only if the device is waiting for - * cardholder action: e.g: waiting for card, waiting for PIN, etc. * There is no confirmation of - * the termination. If a transaction is successfully terminated and `return_url` was provided on - * Checkout, the transaction status will be sent as `failed` to the provided URL. **Note**: If the - * target device is a Solo, it must be in version 3.3.28.0 or higher. - * - *

Operation ID: CreateReaderTerminate - * - * @param merchantCode Merchant Code - * @param readerId The unique identifier of the Reader - * @param request A checkout initial attributes - *

Call the overload that accepts RequestOptions to customize headers, authorization, or - * request timeout. - * @throws ApiException if the SumUp API returns an error. - */ - public void terminateCheckout( - String merchantCode, String readerId, java.util.Map request) - throws ApiException { - terminateCheckout(merchantCode, readerId, request, null); - } - - /** - * Terminate a Reader Checkout - * - *

Terminate a Reader Checkout stops the current transaction on the target device. This process - * is asynchronous and the actual termination may take some time to be performed on the device. - * There are some caveats when using this endpoint: * The target device must be online, otherwise - * terminate won't be accepted * The action will succeed only if the device is waiting for - * cardholder action: e.g: waiting for card, waiting for PIN, etc. * There is no confirmation of - * the termination. If a transaction is successfully terminated and `return_url` was provided on - * Checkout, the transaction status will be sent as `failed` to the provided URL. **Note**: If the - * target device is a Solo, it must be in version 3.3.28.0 or higher. - * - *

Operation ID: CreateReaderTerminate - * - * @param merchantCode Merchant Code - * @param readerId The unique identifier of the Reader - * @param request A checkout initial attributes - * @param requestOptions Request-specific overrides (headers, authorization, or timeout). Pass - * {@code null} to use client defaults. - * @throws ApiException if the SumUp API returns an error. - */ - public void terminateCheckout( - String merchantCode, - String readerId, - java.util.Map request, - RequestOptions requestOptions) - throws ApiException { - Objects.requireNonNull(merchantCode, "merchantCode"); - Objects.requireNonNull(readerId, "readerId"); - String path = "/v0.1/merchants/{merchant_code}/readers/{reader_id}/terminate"; - path = - path.replace( - "{merchant_code}", ApiClient.urlEncode(ApiClient.parameterValue(merchantCode))); - path = path.replace("{reader_id}", ApiClient.urlEncode(ApiClient.parameterValue(readerId))); - - this.apiClient.send(HttpMethod.POST, path, null, null, request, null, requestOptions); - } - /** * Update a Reader * @@ -713,77 +474,6 @@ public com.sumup.sdk.models.Reader update( requestOptions); } - /** - * Update Reader Settings - * - *

Updates the menu lock settings for a Solo reader. The reader must be online. A successful - * response confirms that the reader applied the update. Include at least one of - * `menu_lock.enabled` or `menu_lock.passcode`. Omitted settings keep their current values. The - * response contains only the settings included in the request. When enabling menu lock for a - * reader without a PIN, include a four-digit PIN in `menu_lock.passcode` in the same request. - * - *

Operation ID: UpdateReaderSettings - * - * @param merchantCode The merchant code of the account that owns the reader. - * @param readerId The unique identifier of the reader. - * @param request Menu lock settings to update. - *

Call the overload that accepts RequestOptions to customize headers, authorization, or - * request timeout. - * @return com.sumup.sdk.models.UpdateReaderSettingsResponse parsed response. - * @throws ApiException if the SumUp API returns an error. - */ - public com.sumup.sdk.models.UpdateReaderSettingsResponse updateReaderSettings( - String merchantCode, - String readerId, - com.sumup.sdk.models.UpdateReaderSettingsRequest request) - throws ApiException { - return updateReaderSettings(merchantCode, readerId, request, null); - } - - /** - * Update Reader Settings - * - *

Updates the menu lock settings for a Solo reader. The reader must be online. A successful - * response confirms that the reader applied the update. Include at least one of - * `menu_lock.enabled` or `menu_lock.passcode`. Omitted settings keep their current values. The - * response contains only the settings included in the request. When enabling menu lock for a - * reader without a PIN, include a four-digit PIN in `menu_lock.passcode` in the same request. - * - *

Operation ID: UpdateReaderSettings - * - * @param merchantCode The merchant code of the account that owns the reader. - * @param readerId The unique identifier of the reader. - * @param request Menu lock settings to update. - * @param requestOptions Request-specific overrides (headers, authorization, or timeout). Pass - * {@code null} to use client defaults. - * @return com.sumup.sdk.models.UpdateReaderSettingsResponse parsed response. - * @throws ApiException if the SumUp API returns an error. - */ - public com.sumup.sdk.models.UpdateReaderSettingsResponse updateReaderSettings( - String merchantCode, - String readerId, - com.sumup.sdk.models.UpdateReaderSettingsRequest request, - RequestOptions requestOptions) - throws ApiException { - Objects.requireNonNull(merchantCode, "merchantCode"); - Objects.requireNonNull(readerId, "readerId"); - Objects.requireNonNull(request, "request"); - String path = "/v0.1/merchants/{merchant_code}/readers/{reader_id}/settings"; - path = - path.replace( - "{merchant_code}", ApiClient.urlEncode(ApiClient.parameterValue(merchantCode))); - path = path.replace("{reader_id}", ApiClient.urlEncode(ApiClient.parameterValue(readerId))); - - return this.apiClient.send( - HttpMethod.PATCH, - path, - null, - null, - request, - new TypeReference() {}, - requestOptions); - } - /** Optional header overrides for this request. */ public static final class GetReaderHeaders { private final Map values = new LinkedHashMap<>(); diff --git a/src/main/java/com/sumup/sdk/clients/readers/checkouts/ReaderCheckoutsAsyncClient.java b/src/main/java/com/sumup/sdk/clients/readers/checkouts/ReaderCheckoutsAsyncClient.java new file mode 100644 index 00000000..f170ae05 --- /dev/null +++ b/src/main/java/com/sumup/sdk/clients/readers/checkouts/ReaderCheckoutsAsyncClient.java @@ -0,0 +1,235 @@ +// Code generated by sumup-java/codegen. DO NOT EDIT. +package com.sumup.sdk.clients.readers.checkouts; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.sumup.sdk.core.ApiClient; +import com.sumup.sdk.core.ApiException; +import com.sumup.sdk.core.HttpMethod; +import com.sumup.sdk.core.RequestOptions; +import java.util.Objects; +import java.util.concurrent.CompletableFuture; + +/** + * Client for the "ReaderCheckouts" API group. + * + *

Create, retrieve, and terminate payments on a card reader. + */ +public final class ReaderCheckoutsAsyncClient { + private final ApiClient apiClient; + + /** + * Creates a new ReaderCheckoutsAsyncClient instance backed by the provided ApiClient. + * + * @param apiClient Configured API client used to send HTTP requests. + */ + public ReaderCheckoutsAsyncClient(ApiClient apiClient) { + this.apiClient = Objects.requireNonNull(apiClient, "apiClient"); + } + + /** + * Create a Reader Checkout + * + *

Creates a Checkout for a Reader. This process is asynchronous and the actual transaction may + * take some time to be started on the device. There are some caveats when using this endpoint: * + * The target device must be online, otherwise checkout won't be accepted * After the checkout is + * accepted, the system has 60 seconds to start the payment on the target device. During this + * time, any other checkout for the same device will be rejected. **Note**: If the target device + * is a Solo, it must be in version 3.3.24.3 or higher. Optionally include an `affiliate` object + * to attach integrator metadata to the payment. Provide both `app_id` and `key` when including + * this object. + * + *

Operation ID: CreateReaderCheckout + * + * @param merchantCode Merchant Code + * @param readerId The unique identifier of the Reader + * @param request A checkout initial attributes + *

Call the overload that accepts RequestOptions to customize headers, authorization, or + * request timeout. + * @return CompletableFuture resolved with com.sumup.sdk.models.CreateReaderCheckoutResponse + * parsed response. + * @throws ApiException if the SumUp API returns an error. + */ + public CompletableFuture create( + String merchantCode, + String readerId, + com.sumup.sdk.models.CreateReaderCheckoutRequest request) + throws ApiException { + return create(merchantCode, readerId, request, null); + } + + /** + * Create a Reader Checkout + * + *

Creates a Checkout for a Reader. This process is asynchronous and the actual transaction may + * take some time to be started on the device. There are some caveats when using this endpoint: * + * The target device must be online, otherwise checkout won't be accepted * After the checkout is + * accepted, the system has 60 seconds to start the payment on the target device. During this + * time, any other checkout for the same device will be rejected. **Note**: If the target device + * is a Solo, it must be in version 3.3.24.3 or higher. Optionally include an `affiliate` object + * to attach integrator metadata to the payment. Provide both `app_id` and `key` when including + * this object. + * + *

Operation ID: CreateReaderCheckout + * + * @param merchantCode Merchant Code + * @param readerId The unique identifier of the Reader + * @param request A checkout initial attributes + * @param requestOptions Request-specific overrides (headers, authorization, or timeout). Pass + * {@code null} to use client defaults. + * @return CompletableFuture resolved with com.sumup.sdk.models.CreateReaderCheckoutResponse + * parsed response. + * @throws ApiException if the SumUp API returns an error. + */ + public CompletableFuture create( + String merchantCode, + String readerId, + com.sumup.sdk.models.CreateReaderCheckoutRequest request, + RequestOptions requestOptions) + throws ApiException { + Objects.requireNonNull(merchantCode, "merchantCode"); + Objects.requireNonNull(readerId, "readerId"); + Objects.requireNonNull(request, "request"); + String path = "/v0.1/merchants/{merchant_code}/readers/{reader_id}/checkout"; + path = + path.replace( + "{merchant_code}", ApiClient.urlEncode(ApiClient.parameterValue(merchantCode))); + path = path.replace("{reader_id}", ApiClient.urlEncode(ApiClient.parameterValue(readerId))); + + return this.apiClient.sendAsync( + HttpMethod.POST, + path, + null, + null, + request, + new TypeReference() {}, + requestOptions); + } + + /** + * Get a Reader Checkout + * + *

Get a Checkout for a Reader. + * + *

Operation ID: GetReaderCheckout + * + * @param checkoutId The unique identifier of the Checkout + * @param merchantCode Merchant Code + * @param readerId The unique identifier of the Reader + *

Call the overload that accepts RequestOptions to customize headers, authorization, or + * request timeout. + * @return CompletableFuture resolved with com.sumup.sdk.models.GetReaderCheckoutResponse parsed + * response. + * @throws ApiException if the SumUp API returns an error. + */ + public CompletableFuture get( + String checkoutId, String merchantCode, String readerId) throws ApiException { + return get(checkoutId, merchantCode, readerId, null); + } + + /** + * Get a Reader Checkout + * + *

Get a Checkout for a Reader. + * + *

Operation ID: GetReaderCheckout + * + * @param checkoutId The unique identifier of the Checkout + * @param merchantCode Merchant Code + * @param readerId The unique identifier of the Reader + * @param requestOptions Request-specific overrides (headers, authorization, or timeout). Pass + * {@code null} to use client defaults. + * @return CompletableFuture resolved with com.sumup.sdk.models.GetReaderCheckoutResponse parsed + * response. + * @throws ApiException if the SumUp API returns an error. + */ + public CompletableFuture get( + String checkoutId, String merchantCode, String readerId, RequestOptions requestOptions) + throws ApiException { + Objects.requireNonNull(checkoutId, "checkoutId"); + Objects.requireNonNull(merchantCode, "merchantCode"); + Objects.requireNonNull(readerId, "readerId"); + String path = "/v0.1/merchants/{merchant_code}/readers/{reader_id}/checkout/{checkout_id}"; + path = path.replace("{checkout_id}", ApiClient.urlEncode(ApiClient.parameterValue(checkoutId))); + path = + path.replace( + "{merchant_code}", ApiClient.urlEncode(ApiClient.parameterValue(merchantCode))); + path = path.replace("{reader_id}", ApiClient.urlEncode(ApiClient.parameterValue(readerId))); + + return this.apiClient.sendAsync( + HttpMethod.GET, + path, + null, + null, + null, + new TypeReference() {}, + requestOptions); + } + + /** + * Terminate a Reader Checkout + * + *

Terminate a Reader Checkout stops the current transaction on the target device. This process + * is asynchronous and the actual termination may take some time to be performed on the device. + * There are some caveats when using this endpoint: * The target device must be online, otherwise + * terminate won't be accepted * The action will succeed only if the device is waiting for + * cardholder action: e.g: waiting for card, waiting for PIN, etc. * There is no confirmation of + * the termination. If a transaction is successfully terminated and `return_url` was provided on + * Checkout, the transaction status will be sent as `failed` to the provided URL. **Note**: If the + * target device is a Solo, it must be in version 3.3.28.0 or higher. + * + *

Operation ID: CreateReaderTerminate + * + * @param merchantCode Merchant Code + * @param readerId The unique identifier of the Reader + * @param request A checkout initial attributes + *

Call the overload that accepts RequestOptions to customize headers, authorization, or + * request timeout. + * @return CompletableFuture completed when the request finishes. + * @throws ApiException if the SumUp API returns an error. + */ + public CompletableFuture terminate( + String merchantCode, String readerId, java.util.Map request) + throws ApiException { + return terminate(merchantCode, readerId, request, null); + } + + /** + * Terminate a Reader Checkout + * + *

Terminate a Reader Checkout stops the current transaction on the target device. This process + * is asynchronous and the actual termination may take some time to be performed on the device. + * There are some caveats when using this endpoint: * The target device must be online, otherwise + * terminate won't be accepted * The action will succeed only if the device is waiting for + * cardholder action: e.g: waiting for card, waiting for PIN, etc. * There is no confirmation of + * the termination. If a transaction is successfully terminated and `return_url` was provided on + * Checkout, the transaction status will be sent as `failed` to the provided URL. **Note**: If the + * target device is a Solo, it must be in version 3.3.28.0 or higher. + * + *

Operation ID: CreateReaderTerminate + * + * @param merchantCode Merchant Code + * @param readerId The unique identifier of the Reader + * @param request A checkout initial attributes + * @param requestOptions Request-specific overrides (headers, authorization, or timeout). Pass + * {@code null} to use client defaults. + * @return CompletableFuture completed when the request finishes. + * @throws ApiException if the SumUp API returns an error. + */ + public CompletableFuture terminate( + String merchantCode, + String readerId, + java.util.Map request, + RequestOptions requestOptions) + throws ApiException { + Objects.requireNonNull(merchantCode, "merchantCode"); + Objects.requireNonNull(readerId, "readerId"); + String path = "/v0.1/merchants/{merchant_code}/readers/{reader_id}/terminate"; + path = + path.replace( + "{merchant_code}", ApiClient.urlEncode(ApiClient.parameterValue(merchantCode))); + path = path.replace("{reader_id}", ApiClient.urlEncode(ApiClient.parameterValue(readerId))); + + return this.apiClient.sendAsync( + HttpMethod.POST, path, null, null, request, null, requestOptions); + } +} diff --git a/src/main/java/com/sumup/sdk/clients/readers/checkouts/ReaderCheckoutsClient.java b/src/main/java/com/sumup/sdk/clients/readers/checkouts/ReaderCheckoutsClient.java new file mode 100644 index 00000000..671b5067 --- /dev/null +++ b/src/main/java/com/sumup/sdk/clients/readers/checkouts/ReaderCheckoutsClient.java @@ -0,0 +1,226 @@ +// Code generated by sumup-java/codegen. DO NOT EDIT. +package com.sumup.sdk.clients.readers.checkouts; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.sumup.sdk.core.ApiClient; +import com.sumup.sdk.core.ApiException; +import com.sumup.sdk.core.HttpMethod; +import com.sumup.sdk.core.RequestOptions; +import java.util.Objects; + +/** + * Client for the "ReaderCheckouts" API group. + * + *

Create, retrieve, and terminate payments on a card reader. + */ +public final class ReaderCheckoutsClient { + private final ApiClient apiClient; + + /** + * Creates a new ReaderCheckoutsClient instance backed by the provided ApiClient. + * + * @param apiClient Configured API client used to send HTTP requests. + */ + public ReaderCheckoutsClient(ApiClient apiClient) { + this.apiClient = Objects.requireNonNull(apiClient, "apiClient"); + } + + /** + * Create a Reader Checkout + * + *

Creates a Checkout for a Reader. This process is asynchronous and the actual transaction may + * take some time to be started on the device. There are some caveats when using this endpoint: * + * The target device must be online, otherwise checkout won't be accepted * After the checkout is + * accepted, the system has 60 seconds to start the payment on the target device. During this + * time, any other checkout for the same device will be rejected. **Note**: If the target device + * is a Solo, it must be in version 3.3.24.3 or higher. Optionally include an `affiliate` object + * to attach integrator metadata to the payment. Provide both `app_id` and `key` when including + * this object. + * + *

Operation ID: CreateReaderCheckout + * + * @param merchantCode Merchant Code + * @param readerId The unique identifier of the Reader + * @param request A checkout initial attributes + *

Call the overload that accepts RequestOptions to customize headers, authorization, or + * request timeout. + * @return com.sumup.sdk.models.CreateReaderCheckoutResponse parsed response. + * @throws ApiException if the SumUp API returns an error. + */ + public com.sumup.sdk.models.CreateReaderCheckoutResponse create( + String merchantCode, + String readerId, + com.sumup.sdk.models.CreateReaderCheckoutRequest request) + throws ApiException { + return create(merchantCode, readerId, request, null); + } + + /** + * Create a Reader Checkout + * + *

Creates a Checkout for a Reader. This process is asynchronous and the actual transaction may + * take some time to be started on the device. There are some caveats when using this endpoint: * + * The target device must be online, otherwise checkout won't be accepted * After the checkout is + * accepted, the system has 60 seconds to start the payment on the target device. During this + * time, any other checkout for the same device will be rejected. **Note**: If the target device + * is a Solo, it must be in version 3.3.24.3 or higher. Optionally include an `affiliate` object + * to attach integrator metadata to the payment. Provide both `app_id` and `key` when including + * this object. + * + *

Operation ID: CreateReaderCheckout + * + * @param merchantCode Merchant Code + * @param readerId The unique identifier of the Reader + * @param request A checkout initial attributes + * @param requestOptions Request-specific overrides (headers, authorization, or timeout). Pass + * {@code null} to use client defaults. + * @return com.sumup.sdk.models.CreateReaderCheckoutResponse parsed response. + * @throws ApiException if the SumUp API returns an error. + */ + public com.sumup.sdk.models.CreateReaderCheckoutResponse create( + String merchantCode, + String readerId, + com.sumup.sdk.models.CreateReaderCheckoutRequest request, + RequestOptions requestOptions) + throws ApiException { + Objects.requireNonNull(merchantCode, "merchantCode"); + Objects.requireNonNull(readerId, "readerId"); + Objects.requireNonNull(request, "request"); + String path = "/v0.1/merchants/{merchant_code}/readers/{reader_id}/checkout"; + path = + path.replace( + "{merchant_code}", ApiClient.urlEncode(ApiClient.parameterValue(merchantCode))); + path = path.replace("{reader_id}", ApiClient.urlEncode(ApiClient.parameterValue(readerId))); + + return this.apiClient.send( + HttpMethod.POST, + path, + null, + null, + request, + new TypeReference() {}, + requestOptions); + } + + /** + * Get a Reader Checkout + * + *

Get a Checkout for a Reader. + * + *

Operation ID: GetReaderCheckout + * + * @param checkoutId The unique identifier of the Checkout + * @param merchantCode Merchant Code + * @param readerId The unique identifier of the Reader + *

Call the overload that accepts RequestOptions to customize headers, authorization, or + * request timeout. + * @return com.sumup.sdk.models.GetReaderCheckoutResponse parsed response. + * @throws ApiException if the SumUp API returns an error. + */ + public com.sumup.sdk.models.GetReaderCheckoutResponse get( + String checkoutId, String merchantCode, String readerId) throws ApiException { + return get(checkoutId, merchantCode, readerId, null); + } + + /** + * Get a Reader Checkout + * + *

Get a Checkout for a Reader. + * + *

Operation ID: GetReaderCheckout + * + * @param checkoutId The unique identifier of the Checkout + * @param merchantCode Merchant Code + * @param readerId The unique identifier of the Reader + * @param requestOptions Request-specific overrides (headers, authorization, or timeout). Pass + * {@code null} to use client defaults. + * @return com.sumup.sdk.models.GetReaderCheckoutResponse parsed response. + * @throws ApiException if the SumUp API returns an error. + */ + public com.sumup.sdk.models.GetReaderCheckoutResponse get( + String checkoutId, String merchantCode, String readerId, RequestOptions requestOptions) + throws ApiException { + Objects.requireNonNull(checkoutId, "checkoutId"); + Objects.requireNonNull(merchantCode, "merchantCode"); + Objects.requireNonNull(readerId, "readerId"); + String path = "/v0.1/merchants/{merchant_code}/readers/{reader_id}/checkout/{checkout_id}"; + path = path.replace("{checkout_id}", ApiClient.urlEncode(ApiClient.parameterValue(checkoutId))); + path = + path.replace( + "{merchant_code}", ApiClient.urlEncode(ApiClient.parameterValue(merchantCode))); + path = path.replace("{reader_id}", ApiClient.urlEncode(ApiClient.parameterValue(readerId))); + + return this.apiClient.send( + HttpMethod.GET, + path, + null, + null, + null, + new TypeReference() {}, + requestOptions); + } + + /** + * Terminate a Reader Checkout + * + *

Terminate a Reader Checkout stops the current transaction on the target device. This process + * is asynchronous and the actual termination may take some time to be performed on the device. + * There are some caveats when using this endpoint: * The target device must be online, otherwise + * terminate won't be accepted * The action will succeed only if the device is waiting for + * cardholder action: e.g: waiting for card, waiting for PIN, etc. * There is no confirmation of + * the termination. If a transaction is successfully terminated and `return_url` was provided on + * Checkout, the transaction status will be sent as `failed` to the provided URL. **Note**: If the + * target device is a Solo, it must be in version 3.3.28.0 or higher. + * + *

Operation ID: CreateReaderTerminate + * + * @param merchantCode Merchant Code + * @param readerId The unique identifier of the Reader + * @param request A checkout initial attributes + *

Call the overload that accepts RequestOptions to customize headers, authorization, or + * request timeout. + * @throws ApiException if the SumUp API returns an error. + */ + public void terminate(String merchantCode, String readerId, java.util.Map request) + throws ApiException { + terminate(merchantCode, readerId, request, null); + } + + /** + * Terminate a Reader Checkout + * + *

Terminate a Reader Checkout stops the current transaction on the target device. This process + * is asynchronous and the actual termination may take some time to be performed on the device. + * There are some caveats when using this endpoint: * The target device must be online, otherwise + * terminate won't be accepted * The action will succeed only if the device is waiting for + * cardholder action: e.g: waiting for card, waiting for PIN, etc. * There is no confirmation of + * the termination. If a transaction is successfully terminated and `return_url` was provided on + * Checkout, the transaction status will be sent as `failed` to the provided URL. **Note**: If the + * target device is a Solo, it must be in version 3.3.28.0 or higher. + * + *

Operation ID: CreateReaderTerminate + * + * @param merchantCode Merchant Code + * @param readerId The unique identifier of the Reader + * @param request A checkout initial attributes + * @param requestOptions Request-specific overrides (headers, authorization, or timeout). Pass + * {@code null} to use client defaults. + * @throws ApiException if the SumUp API returns an error. + */ + public void terminate( + String merchantCode, + String readerId, + java.util.Map request, + RequestOptions requestOptions) + throws ApiException { + Objects.requireNonNull(merchantCode, "merchantCode"); + Objects.requireNonNull(readerId, "readerId"); + String path = "/v0.1/merchants/{merchant_code}/readers/{reader_id}/terminate"; + path = + path.replace( + "{merchant_code}", ApiClient.urlEncode(ApiClient.parameterValue(merchantCode))); + path = path.replace("{reader_id}", ApiClient.urlEncode(ApiClient.parameterValue(readerId))); + + this.apiClient.send(HttpMethod.POST, path, null, null, request, null, requestOptions); + } +} diff --git a/src/main/java/com/sumup/sdk/clients/readers/settings/ReaderSettingsAsyncClient.java b/src/main/java/com/sumup/sdk/clients/readers/settings/ReaderSettingsAsyncClient.java new file mode 100644 index 00000000..e6c86dc8 --- /dev/null +++ b/src/main/java/com/sumup/sdk/clients/readers/settings/ReaderSettingsAsyncClient.java @@ -0,0 +1,162 @@ +// Code generated by sumup-java/codegen. DO NOT EDIT. +package com.sumup.sdk.clients.readers.settings; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.sumup.sdk.core.ApiClient; +import com.sumup.sdk.core.ApiException; +import com.sumup.sdk.core.HttpMethod; +import com.sumup.sdk.core.RequestOptions; +import java.util.Objects; +import java.util.concurrent.CompletableFuture; + +/** + * Client for the "ReaderSettings" API group. + * + *

Retrieve and update card reader settings. + */ +public final class ReaderSettingsAsyncClient { + private final ApiClient apiClient; + + /** + * Creates a new ReaderSettingsAsyncClient instance backed by the provided ApiClient. + * + * @param apiClient Configured API client used to send HTTP requests. + */ + public ReaderSettingsAsyncClient(ApiClient apiClient) { + this.apiClient = Objects.requireNonNull(apiClient, "apiClient"); + } + + /** + * Get Reader Settings + * + *

Returns the menu lock settings for a Solo reader. For an online reader, returns the current + * settings. For an offline reader, returns the last saved settings, which may differ from its + * current configuration. Returns `404` if the reader is offline and no saved settings are + * available. The response may include the menu lock PIN. + * + *

Operation ID: GetReaderSettings + * + * @param merchantCode The merchant code of the account that owns the reader. + * @param readerId The unique identifier of the reader. + *

Call the overload that accepts RequestOptions to customize headers, authorization, or + * request timeout. + * @return CompletableFuture resolved with com.sumup.sdk.models.GetReaderSettingsResponse parsed + * response. + * @throws ApiException if the SumUp API returns an error. + */ + public CompletableFuture get( + String merchantCode, String readerId) throws ApiException { + return get(merchantCode, readerId, null); + } + + /** + * Get Reader Settings + * + *

Returns the menu lock settings for a Solo reader. For an online reader, returns the current + * settings. For an offline reader, returns the last saved settings, which may differ from its + * current configuration. Returns `404` if the reader is offline and no saved settings are + * available. The response may include the menu lock PIN. + * + *

Operation ID: GetReaderSettings + * + * @param merchantCode The merchant code of the account that owns the reader. + * @param readerId The unique identifier of the reader. + * @param requestOptions Request-specific overrides (headers, authorization, or timeout). Pass + * {@code null} to use client defaults. + * @return CompletableFuture resolved with com.sumup.sdk.models.GetReaderSettingsResponse parsed + * response. + * @throws ApiException if the SumUp API returns an error. + */ + public CompletableFuture get( + String merchantCode, String readerId, RequestOptions requestOptions) throws ApiException { + Objects.requireNonNull(merchantCode, "merchantCode"); + Objects.requireNonNull(readerId, "readerId"); + String path = "/v0.1/merchants/{merchant_code}/readers/{reader_id}/settings"; + path = + path.replace( + "{merchant_code}", ApiClient.urlEncode(ApiClient.parameterValue(merchantCode))); + path = path.replace("{reader_id}", ApiClient.urlEncode(ApiClient.parameterValue(readerId))); + + return this.apiClient.sendAsync( + HttpMethod.GET, + path, + null, + null, + null, + new TypeReference() {}, + requestOptions); + } + + /** + * Update Reader Settings + * + *

Updates the menu lock settings for a Solo reader. The reader must be online. A successful + * response confirms that the reader applied the update. Include at least one of + * `menu_lock.enabled` or `menu_lock.passcode`. Omitted settings keep their current values. The + * response contains only the settings included in the request. When enabling menu lock for a + * reader without a PIN, include a four-digit PIN in `menu_lock.passcode` in the same request. + * + *

Operation ID: UpdateReaderSettings + * + * @param merchantCode The merchant code of the account that owns the reader. + * @param readerId The unique identifier of the reader. + * @param request Menu lock settings to update. + *

Call the overload that accepts RequestOptions to customize headers, authorization, or + * request timeout. + * @return CompletableFuture resolved with com.sumup.sdk.models.UpdateReaderSettingsResponse + * parsed response. + * @throws ApiException if the SumUp API returns an error. + */ + public CompletableFuture update( + String merchantCode, + String readerId, + com.sumup.sdk.models.UpdateReaderSettingsRequest request) + throws ApiException { + return update(merchantCode, readerId, request, null); + } + + /** + * Update Reader Settings + * + *

Updates the menu lock settings for a Solo reader. The reader must be online. A successful + * response confirms that the reader applied the update. Include at least one of + * `menu_lock.enabled` or `menu_lock.passcode`. Omitted settings keep their current values. The + * response contains only the settings included in the request. When enabling menu lock for a + * reader without a PIN, include a four-digit PIN in `menu_lock.passcode` in the same request. + * + *

Operation ID: UpdateReaderSettings + * + * @param merchantCode The merchant code of the account that owns the reader. + * @param readerId The unique identifier of the reader. + * @param request Menu lock settings to update. + * @param requestOptions Request-specific overrides (headers, authorization, or timeout). Pass + * {@code null} to use client defaults. + * @return CompletableFuture resolved with com.sumup.sdk.models.UpdateReaderSettingsResponse + * parsed response. + * @throws ApiException if the SumUp API returns an error. + */ + public CompletableFuture update( + String merchantCode, + String readerId, + com.sumup.sdk.models.UpdateReaderSettingsRequest request, + RequestOptions requestOptions) + throws ApiException { + Objects.requireNonNull(merchantCode, "merchantCode"); + Objects.requireNonNull(readerId, "readerId"); + Objects.requireNonNull(request, "request"); + String path = "/v0.1/merchants/{merchant_code}/readers/{reader_id}/settings"; + path = + path.replace( + "{merchant_code}", ApiClient.urlEncode(ApiClient.parameterValue(merchantCode))); + path = path.replace("{reader_id}", ApiClient.urlEncode(ApiClient.parameterValue(readerId))); + + return this.apiClient.sendAsync( + HttpMethod.PATCH, + path, + null, + null, + request, + new TypeReference() {}, + requestOptions); + } +} diff --git a/src/main/java/com/sumup/sdk/clients/readers/settings/ReaderSettingsClient.java b/src/main/java/com/sumup/sdk/clients/readers/settings/ReaderSettingsClient.java new file mode 100644 index 00000000..1c7a10f5 --- /dev/null +++ b/src/main/java/com/sumup/sdk/clients/readers/settings/ReaderSettingsClient.java @@ -0,0 +1,157 @@ +// Code generated by sumup-java/codegen. DO NOT EDIT. +package com.sumup.sdk.clients.readers.settings; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.sumup.sdk.core.ApiClient; +import com.sumup.sdk.core.ApiException; +import com.sumup.sdk.core.HttpMethod; +import com.sumup.sdk.core.RequestOptions; +import java.util.Objects; + +/** + * Client for the "ReaderSettings" API group. + * + *

Retrieve and update card reader settings. + */ +public final class ReaderSettingsClient { + private final ApiClient apiClient; + + /** + * Creates a new ReaderSettingsClient instance backed by the provided ApiClient. + * + * @param apiClient Configured API client used to send HTTP requests. + */ + public ReaderSettingsClient(ApiClient apiClient) { + this.apiClient = Objects.requireNonNull(apiClient, "apiClient"); + } + + /** + * Get Reader Settings + * + *

Returns the menu lock settings for a Solo reader. For an online reader, returns the current + * settings. For an offline reader, returns the last saved settings, which may differ from its + * current configuration. Returns `404` if the reader is offline and no saved settings are + * available. The response may include the menu lock PIN. + * + *

Operation ID: GetReaderSettings + * + * @param merchantCode The merchant code of the account that owns the reader. + * @param readerId The unique identifier of the reader. + *

Call the overload that accepts RequestOptions to customize headers, authorization, or + * request timeout. + * @return com.sumup.sdk.models.GetReaderSettingsResponse parsed response. + * @throws ApiException if the SumUp API returns an error. + */ + public com.sumup.sdk.models.GetReaderSettingsResponse get(String merchantCode, String readerId) + throws ApiException { + return get(merchantCode, readerId, null); + } + + /** + * Get Reader Settings + * + *

Returns the menu lock settings for a Solo reader. For an online reader, returns the current + * settings. For an offline reader, returns the last saved settings, which may differ from its + * current configuration. Returns `404` if the reader is offline and no saved settings are + * available. The response may include the menu lock PIN. + * + *

Operation ID: GetReaderSettings + * + * @param merchantCode The merchant code of the account that owns the reader. + * @param readerId The unique identifier of the reader. + * @param requestOptions Request-specific overrides (headers, authorization, or timeout). Pass + * {@code null} to use client defaults. + * @return com.sumup.sdk.models.GetReaderSettingsResponse parsed response. + * @throws ApiException if the SumUp API returns an error. + */ + public com.sumup.sdk.models.GetReaderSettingsResponse get( + String merchantCode, String readerId, RequestOptions requestOptions) throws ApiException { + Objects.requireNonNull(merchantCode, "merchantCode"); + Objects.requireNonNull(readerId, "readerId"); + String path = "/v0.1/merchants/{merchant_code}/readers/{reader_id}/settings"; + path = + path.replace( + "{merchant_code}", ApiClient.urlEncode(ApiClient.parameterValue(merchantCode))); + path = path.replace("{reader_id}", ApiClient.urlEncode(ApiClient.parameterValue(readerId))); + + return this.apiClient.send( + HttpMethod.GET, + path, + null, + null, + null, + new TypeReference() {}, + requestOptions); + } + + /** + * Update Reader Settings + * + *

Updates the menu lock settings for a Solo reader. The reader must be online. A successful + * response confirms that the reader applied the update. Include at least one of + * `menu_lock.enabled` or `menu_lock.passcode`. Omitted settings keep their current values. The + * response contains only the settings included in the request. When enabling menu lock for a + * reader without a PIN, include a four-digit PIN in `menu_lock.passcode` in the same request. + * + *

Operation ID: UpdateReaderSettings + * + * @param merchantCode The merchant code of the account that owns the reader. + * @param readerId The unique identifier of the reader. + * @param request Menu lock settings to update. + *

Call the overload that accepts RequestOptions to customize headers, authorization, or + * request timeout. + * @return com.sumup.sdk.models.UpdateReaderSettingsResponse parsed response. + * @throws ApiException if the SumUp API returns an error. + */ + public com.sumup.sdk.models.UpdateReaderSettingsResponse update( + String merchantCode, + String readerId, + com.sumup.sdk.models.UpdateReaderSettingsRequest request) + throws ApiException { + return update(merchantCode, readerId, request, null); + } + + /** + * Update Reader Settings + * + *

Updates the menu lock settings for a Solo reader. The reader must be online. A successful + * response confirms that the reader applied the update. Include at least one of + * `menu_lock.enabled` or `menu_lock.passcode`. Omitted settings keep their current values. The + * response contains only the settings included in the request. When enabling menu lock for a + * reader without a PIN, include a four-digit PIN in `menu_lock.passcode` in the same request. + * + *

Operation ID: UpdateReaderSettings + * + * @param merchantCode The merchant code of the account that owns the reader. + * @param readerId The unique identifier of the reader. + * @param request Menu lock settings to update. + * @param requestOptions Request-specific overrides (headers, authorization, or timeout). Pass + * {@code null} to use client defaults. + * @return com.sumup.sdk.models.UpdateReaderSettingsResponse parsed response. + * @throws ApiException if the SumUp API returns an error. + */ + public com.sumup.sdk.models.UpdateReaderSettingsResponse update( + String merchantCode, + String readerId, + com.sumup.sdk.models.UpdateReaderSettingsRequest request, + RequestOptions requestOptions) + throws ApiException { + Objects.requireNonNull(merchantCode, "merchantCode"); + Objects.requireNonNull(readerId, "readerId"); + Objects.requireNonNull(request, "request"); + String path = "/v0.1/merchants/{merchant_code}/readers/{reader_id}/settings"; + path = + path.replace( + "{merchant_code}", ApiClient.urlEncode(ApiClient.parameterValue(merchantCode))); + path = path.replace("{reader_id}", ApiClient.urlEncode(ApiClient.parameterValue(readerId))); + + return this.apiClient.send( + HttpMethod.PATCH, + path, + null, + null, + request, + new TypeReference() {}, + requestOptions); + } +} diff --git a/src/main/java/com/sumup/sdk/models/CardType.java b/src/main/java/com/sumup/sdk/models/CardType.java index cfe1609a..17235c34 100644 --- a/src/main/java/com/sumup/sdk/models/CardType.java +++ b/src/main/java/com/sumup/sdk/models/CardType.java @@ -10,6 +10,7 @@ public final class CardType { public static final CardType ALELO = new CardType("ALELO"); public static final CardType AMEX = new CardType("AMEX"); public static final CardType BANCOMAT = new CardType("BANCOMAT"); + public static final CardType CARNET = new CardType("CARNET"); public static final CardType CONECS = new CardType("CONECS"); public static final CardType CUP = new CardType("CUP"); public static final CardType DINERS = new CardType("DINERS"); diff --git a/src/main/java/com/sumup/sdk/models/CreateReaderCheckoutRequest.java b/src/main/java/com/sumup/sdk/models/CreateReaderCheckoutRequest.java index c54a9963..eff1298c 100644 --- a/src/main/java/com/sumup/sdk/models/CreateReaderCheckoutRequest.java +++ b/src/main/java/com/sumup/sdk/models/CreateReaderCheckoutRequest.java @@ -60,10 +60,10 @@ public record CreateReaderCheckoutRequest( Long tipTimeout, /** - * Amount structure. The amount is represented as an integer value altogether with the currency - * and the minor unit. For example, EUR 1.00 is represented as value 100 with minor unit of 2. + * Amount to charge in minor units. Use the decimal places for the currency. CLP, COP, and HUF + * use zero decimal places. For example, send `1234` for EUR 12.34 or `1000` for CLP 1000. */ - com.sumup.sdk.models.Money totalAmount) { + com.sumup.sdk.models.CreateReaderCheckoutRequestTotalAmount totalAmount) { /** * Creates a builder for CreateReaderCheckoutRequest. * @@ -84,7 +84,7 @@ public static final class Builder { private String returnUrl; private java.util.List tipRates; private Long tipTimeout; - private com.sumup.sdk.models.Money totalAmount; + private com.sumup.sdk.models.CreateReaderCheckoutRequestTotalAmount totalAmount; private Builder() {} @@ -206,12 +206,13 @@ public Builder tipTimeout(Long tipTimeout) { /** * Sets the value for {@code totalAmount}. * - * @param totalAmount Amount structure. The amount is represented as an integer value altogether - * with the currency and the minor unit. For example, EUR 1.00 is represented as value 100 - * with minor unit of 2. + * @param totalAmount Amount to charge in minor units. Use the decimal places for the currency. + * CLP, COP, and HUF use zero decimal places. For example, send `1234` for EUR 12.34 or + * `1000` for CLP 1000. * @return This builder instance. */ - public Builder totalAmount(com.sumup.sdk.models.Money totalAmount) { + public Builder totalAmount( + com.sumup.sdk.models.CreateReaderCheckoutRequestTotalAmount totalAmount) { this.totalAmount = totalAmount; return this; } diff --git a/src/main/java/com/sumup/sdk/models/CreateReaderCheckoutRequestTotalAmount.java b/src/main/java/com/sumup/sdk/models/CreateReaderCheckoutRequestTotalAmount.java new file mode 100644 index 00000000..0c6452c5 --- /dev/null +++ b/src/main/java/com/sumup/sdk/models/CreateReaderCheckoutRequestTotalAmount.java @@ -0,0 +1,64 @@ +// Code generated by sumup-java/codegen. DO NOT EDIT. +package com.sumup.sdk.models; + +import java.util.Objects; + +/** + * Amount to charge in minor units. Use the decimal places for the currency. CLP, COP, and HUF use + * zero decimal places. For example, send `1234` for EUR 12.34 or `1000` for CLP 1000. + */ +public record CreateReaderCheckoutRequestTotalAmount( + /** Currency ISO 4217 code */ + String currency, + + /** Integer value of the amount. */ + Long value) { + /** + * Creates a builder for CreateReaderCheckoutRequestTotalAmount. + * + * @return Builder that constructs immutable CreateReaderCheckoutRequestTotalAmount instances. + */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for CreateReaderCheckoutRequestTotalAmount instances. */ + public static final class Builder { + private String currency; + private Long value; + + private Builder() {} + + /** + * Sets the value for {@code currency}. + * + * @param currency Currency ISO 4217 code + * @return This builder instance. + */ + public Builder currency(String currency) { + this.currency = currency; + return this; + } + + /** + * Sets the value for {@code value}. + * + * @param value Integer value of the amount. + * @return This builder instance. + */ + public Builder value(Long value) { + this.value = value; + return this; + } + + /** + * Builds an immutable CreateReaderCheckoutRequestTotalAmount instance. + * + * @return Immutable CreateReaderCheckoutRequestTotalAmount. + */ + public CreateReaderCheckoutRequestTotalAmount build() { + return new CreateReaderCheckoutRequestTotalAmount( + Objects.requireNonNull(currency, "currency"), Objects.requireNonNull(value, "value")); + } + } +} diff --git a/src/main/java/com/sumup/sdk/models/GetReaderCheckoutResponseData.java b/src/main/java/com/sumup/sdk/models/GetReaderCheckoutResponseData.java index 980d0c0e..a55ad4c3 100644 --- a/src/main/java/com/sumup/sdk/models/GetReaderCheckoutResponseData.java +++ b/src/main/java/com/sumup/sdk/models/GetReaderCheckoutResponseData.java @@ -38,10 +38,11 @@ public record GetReaderCheckoutResponseData( com.sumup.sdk.models.GetReaderCheckoutResponseDataStatus status, /** - * Amount structure. The amount is represented as an integer value altogether with the currency - * and the minor unit. For example, EUR 1.00 is represented as value 100 with minor unit of 2. + * The checkout amount. The value uses two decimal places, even for currencies such as CLP that + * use zero decimal places in the create request. For example, EUR 10.00 is returned as `1000` + * and CLP 1000 as `100000`. */ - com.sumup.sdk.models.Money2 totalAmount, + com.sumup.sdk.models.GetReaderCheckoutResponseDataTotalAmount totalAmount, /** Checkout last update timestamp */ java.time.OffsetDateTime updatedAt, @@ -72,7 +73,7 @@ public static final class Builder { private String readerFirmwareVersion; private String readerSerialNumber; private com.sumup.sdk.models.GetReaderCheckoutResponseDataStatus status; - private com.sumup.sdk.models.Money2 totalAmount; + private com.sumup.sdk.models.GetReaderCheckoutResponseDataTotalAmount totalAmount; private java.time.OffsetDateTime updatedAt; private java.time.OffsetDateTime validUntil; @@ -204,12 +205,13 @@ public Builder status(com.sumup.sdk.models.GetReaderCheckoutResponseDataStatus s /** * Sets the value for {@code totalAmount}. * - * @param totalAmount Amount structure. The amount is represented as an integer value altogether - * with the currency and the minor unit. For example, EUR 1.00 is represented as value 100 - * with minor unit of 2. + * @param totalAmount The checkout amount. The value uses two decimal places, even for + * currencies such as CLP that use zero decimal places in the create request. For example, + * EUR 10.00 is returned as `1000` and CLP 1000 as `100000`. * @return This builder instance. */ - public Builder totalAmount(com.sumup.sdk.models.Money2 totalAmount) { + public Builder totalAmount( + com.sumup.sdk.models.GetReaderCheckoutResponseDataTotalAmount totalAmount) { this.totalAmount = totalAmount; return this; } diff --git a/src/main/java/com/sumup/sdk/models/GetReaderCheckoutResponseDataTotalAmount.java b/src/main/java/com/sumup/sdk/models/GetReaderCheckoutResponseDataTotalAmount.java new file mode 100644 index 00000000..3eafdd4d --- /dev/null +++ b/src/main/java/com/sumup/sdk/models/GetReaderCheckoutResponseDataTotalAmount.java @@ -0,0 +1,65 @@ +// Code generated by sumup-java/codegen. DO NOT EDIT. +package com.sumup.sdk.models; + +import java.util.Objects; + +/** + * The checkout amount. The value uses two decimal places, even for currencies such as CLP that use + * zero decimal places in the create request. For example, EUR 10.00 is returned as `1000` and CLP + * 1000 as `100000`. + */ +public record GetReaderCheckoutResponseDataTotalAmount( + /** Currency ISO 4217 code */ + String currency, + + /** Integer value of the amount. */ + Long value) { + /** + * Creates a builder for GetReaderCheckoutResponseDataTotalAmount. + * + * @return Builder that constructs immutable GetReaderCheckoutResponseDataTotalAmount instances. + */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for GetReaderCheckoutResponseDataTotalAmount instances. */ + public static final class Builder { + private String currency; + private Long value; + + private Builder() {} + + /** + * Sets the value for {@code currency}. + * + * @param currency Currency ISO 4217 code + * @return This builder instance. + */ + public Builder currency(String currency) { + this.currency = currency; + return this; + } + + /** + * Sets the value for {@code value}. + * + * @param value Integer value of the amount. + * @return This builder instance. + */ + public Builder value(Long value) { + this.value = value; + return this; + } + + /** + * Builds an immutable GetReaderCheckoutResponseDataTotalAmount instance. + * + * @return Immutable GetReaderCheckoutResponseDataTotalAmount. + */ + public GetReaderCheckoutResponseDataTotalAmount build() { + return new GetReaderCheckoutResponseDataTotalAmount( + Objects.requireNonNull(currency, "currency"), Objects.requireNonNull(value, "value")); + } + } +} diff --git a/src/main/java/com/sumup/sdk/models/Money.java b/src/main/java/com/sumup/sdk/models/Money.java deleted file mode 100644 index 087816e0..00000000 --- a/src/main/java/com/sumup/sdk/models/Money.java +++ /dev/null @@ -1,85 +0,0 @@ -// Code generated by sumup-java/codegen. DO NOT EDIT. -package com.sumup.sdk.models; - -import java.util.Objects; - -/** - * Amount structure. The amount is represented as an integer value altogether with the currency and - * the minor unit. For example, EUR 1.00 is represented as value 100 with minor unit of 2. - */ -public record Money( - /** Currency ISO 4217 code */ - String currency, - - /** - * The minor units of the currency. It represents the number of decimals of the currency. For - * the currencies CLP, COP and HUF, the minor unit is 0. - */ - Long minorUnit, - - /** Integer value of the amount. */ - Long value) { - /** - * Creates a builder for Money. - * - * @return Builder that constructs immutable Money instances. - */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for Money instances. */ - public static final class Builder { - private String currency; - private Long minorUnit; - private Long value; - - private Builder() {} - - /** - * Sets the value for {@code currency}. - * - * @param currency Currency ISO 4217 code - * @return This builder instance. - */ - public Builder currency(String currency) { - this.currency = currency; - return this; - } - - /** - * Sets the value for {@code minorUnit}. - * - * @param minorUnit The minor units of the currency. It represents the number of decimals of the - * currency. For the currencies CLP, COP and HUF, the minor unit is 0. - * @return This builder instance. - */ - public Builder minorUnit(Long minorUnit) { - this.minorUnit = minorUnit; - return this; - } - - /** - * Sets the value for {@code value}. - * - * @param value Integer value of the amount. - * @return This builder instance. - */ - public Builder value(Long value) { - this.value = value; - return this; - } - - /** - * Builds an immutable Money instance. - * - * @return Immutable Money. - */ - public Money build() { - return new Money( - Objects.requireNonNull(currency, "currency"), - Objects.requireNonNull(minorUnit, "minorUnit"), - Objects.requireNonNull(value, "value")); - } - } -} diff --git a/src/main/java/com/sumup/sdk/models/Money2.java b/src/main/java/com/sumup/sdk/models/Money2.java deleted file mode 100644 index 09108fdc..00000000 --- a/src/main/java/com/sumup/sdk/models/Money2.java +++ /dev/null @@ -1,85 +0,0 @@ -// Code generated by sumup-java/codegen. DO NOT EDIT. -package com.sumup.sdk.models; - -import java.util.Objects; - -/** - * Amount structure. The amount is represented as an integer value altogether with the currency and - * the minor unit. For example, EUR 1.00 is represented as value 100 with minor unit of 2. - */ -public record Money2( - /** Currency ISO 4217 code */ - String currency, - - /** - * The minor units of the currency. It represents the number of decimals of the currency. For - * the currencies CLP, COP and HUF, the minor unit is 0. - */ - Long minorUnit, - - /** Integer value of the amount. */ - Long value) { - /** - * Creates a builder for Money2. - * - * @return Builder that constructs immutable Money2 instances. - */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for Money2 instances. */ - public static final class Builder { - private String currency; - private Long minorUnit; - private Long value; - - private Builder() {} - - /** - * Sets the value for {@code currency}. - * - * @param currency Currency ISO 4217 code - * @return This builder instance. - */ - public Builder currency(String currency) { - this.currency = currency; - return this; - } - - /** - * Sets the value for {@code minorUnit}. - * - * @param minorUnit The minor units of the currency. It represents the number of decimals of the - * currency. For the currencies CLP, COP and HUF, the minor unit is 0. - * @return This builder instance. - */ - public Builder minorUnit(Long minorUnit) { - this.minorUnit = minorUnit; - return this; - } - - /** - * Sets the value for {@code value}. - * - * @param value Integer value of the amount. - * @return This builder instance. - */ - public Builder value(Long value) { - this.value = value; - return this; - } - - /** - * Builds an immutable Money2 instance. - * - * @return Immutable Money2. - */ - public Money2 build() { - return new Money2( - Objects.requireNonNull(currency, "currency"), - Objects.requireNonNull(minorUnit, "minorUnit"), - Objects.requireNonNull(value, "value")); - } - } -} From b438dae3f57bc83b11669b88e899d190382969a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matou=C5=A1=20Dzivjak?= Date: Wed, 25 Nov 2026 16:51:50 +0100 Subject: [PATCH 3/3] chore: restructure some more --- README.md | 8 +- codegen/internal/generator/events.go | 31 ++++-- codegen/internal/generator/model.go | 17 ++- codegen/internal/generator/model_packages.go | 80 +++++++++++++ codegen/internal/generator/render.go | 6 +- .../internal/generator/schema_annotations.go | 105 +++++++++--------- codegen/internal/generator/tag_hierarchy.go | 9 ++ .../internal/generator/tag_hierarchy_test.go | 39 ++++++- codegen/internal/generator/types.go | 23 ++-- .../cardreader/CardReaderCheckoutExample.java | 4 +- .../checkouts/ReaderCheckoutsAsyncClient.java | 48 ++++---- .../checkouts/ReaderCheckoutsClient.java | 24 ++-- .../settings/ReaderSettingsAsyncClient.java | 48 ++++---- .../settings/ReaderSettingsClient.java | 26 ++--- .../{ => readers/checkouts}/Affiliate2.java | 2 +- .../checkouts}/CreateReaderCheckoutError.java | 9 +- .../CreateReaderCheckoutErrorErrors.java | 2 +- .../CreateReaderCheckoutRequest.java | 36 +++--- .../CreateReaderCheckoutRequestAade.java | 2 +- .../CreateReaderCheckoutRequestCardType.java | 2 +- ...reateReaderCheckoutRequestPaymentType.java | 2 +- ...reateReaderCheckoutRequestTotalAmount.java | 2 +- .../CreateReaderCheckoutResponse.java | 9 +- .../CreateReaderCheckoutResponseData.java | 2 +- ...eateReaderCheckoutUnprocessableEntity.java | 2 +- .../CreateReaderTerminateError.java | 9 +- .../CreateReaderTerminateErrorErrors.java | 2 +- ...ateReaderTerminateUnprocessableEntity.java | 2 +- .../checkouts}/GetReaderCheckoutResponse.java | 9 +- .../GetReaderCheckoutResponseData.java | 32 +++--- ...GetReaderCheckoutResponseDataCardType.java | 2 +- ...ReaderCheckoutResponseDataPaymentType.java | 2 +- .../GetReaderCheckoutResponseDataStatus.java | 2 +- ...ReaderCheckoutResponseDataTotalAmount.java | 2 +- .../settings}/GetReaderSettingsResponse.java | 9 +- .../GetReaderSettingsResponseData.java | 9 +- ...GetReaderSettingsResponseDataMenuLock.java | 2 +- .../settings}/UpdateReaderSettingsError.java | 9 +- .../UpdateReaderSettingsErrorErrors.java | 2 +- .../UpdateReaderSettingsRequest.java | 9 +- .../UpdateReaderSettingsRequestMenuLock.java | 2 +- .../UpdateReaderSettingsResponse.java | 9 +- .../UpdateReaderSettingsResponseData.java | 15 +-- ...ateReaderSettingsResponseDataMenuLock.java | 2 +- ...pdateReaderSettingsResponseDataStatus.java | 2 +- ...dateReaderSettingsUnprocessableEntity.java | 2 +- 46 files changed, 424 insertions(+), 248 deletions(-) create mode 100644 codegen/internal/generator/model_packages.go rename src/main/java/com/sumup/sdk/models/{ => readers/checkouts}/Affiliate2.java (98%) rename src/main/java/com/sumup/sdk/models/{ => readers/checkouts}/CreateReaderCheckoutError.java (76%) rename src/main/java/com/sumup/sdk/models/{ => readers/checkouts}/CreateReaderCheckoutErrorErrors.java (96%) rename src/main/java/com/sumup/sdk/models/{ => readers/checkouts}/CreateReaderCheckoutRequest.java (83%) rename src/main/java/com/sumup/sdk/models/{ => readers/checkouts}/CreateReaderCheckoutRequestAade.java (98%) rename src/main/java/com/sumup/sdk/models/{ => readers/checkouts}/CreateReaderCheckoutRequestCardType.java (97%) rename src/main/java/com/sumup/sdk/models/{ => readers/checkouts}/CreateReaderCheckoutRequestPaymentType.java (97%) rename src/main/java/com/sumup/sdk/models/{ => readers/checkouts}/CreateReaderCheckoutRequestTotalAmount.java (97%) rename src/main/java/com/sumup/sdk/models/{ => readers/checkouts}/CreateReaderCheckoutResponse.java (74%) rename src/main/java/com/sumup/sdk/models/{ => readers/checkouts}/CreateReaderCheckoutResponseData.java (97%) rename src/main/java/com/sumup/sdk/models/{ => readers/checkouts}/CreateReaderCheckoutUnprocessableEntity.java (96%) rename src/main/java/com/sumup/sdk/models/{ => readers/checkouts}/CreateReaderTerminateError.java (76%) rename src/main/java/com/sumup/sdk/models/{ => readers/checkouts}/CreateReaderTerminateErrorErrors.java (96%) rename src/main/java/com/sumup/sdk/models/{ => readers/checkouts}/CreateReaderTerminateUnprocessableEntity.java (96%) rename src/main/java/com/sumup/sdk/models/{ => readers/checkouts}/GetReaderCheckoutResponse.java (71%) rename src/main/java/com/sumup/sdk/models/{ => readers/checkouts}/GetReaderCheckoutResponseData.java (85%) rename src/main/java/com/sumup/sdk/models/{ => readers/checkouts}/GetReaderCheckoutResponseDataCardType.java (97%) rename src/main/java/com/sumup/sdk/models/{ => readers/checkouts}/GetReaderCheckoutResponseDataPaymentType.java (97%) rename src/main/java/com/sumup/sdk/models/{ => readers/checkouts}/GetReaderCheckoutResponseDataStatus.java (97%) rename src/main/java/com/sumup/sdk/models/{ => readers/checkouts}/GetReaderCheckoutResponseDataTotalAmount.java (97%) rename src/main/java/com/sumup/sdk/models/{ => readers/settings}/GetReaderSettingsResponse.java (73%) rename src/main/java/com/sumup/sdk/models/{ => readers/settings}/GetReaderSettingsResponseData.java (75%) rename src/main/java/com/sumup/sdk/models/{ => readers/settings}/GetReaderSettingsResponseDataMenuLock.java (97%) rename src/main/java/com/sumup/sdk/models/{ => readers/settings}/UpdateReaderSettingsError.java (75%) rename src/main/java/com/sumup/sdk/models/{ => readers/settings}/UpdateReaderSettingsErrorErrors.java (96%) rename src/main/java/com/sumup/sdk/models/{ => readers/settings}/UpdateReaderSettingsRequest.java (76%) rename src/main/java/com/sumup/sdk/models/{ => readers/settings}/UpdateReaderSettingsRequestMenuLock.java (97%) rename src/main/java/com/sumup/sdk/models/{ => readers/settings}/UpdateReaderSettingsResponse.java (75%) rename src/main/java/com/sumup/sdk/models/{ => readers/settings}/UpdateReaderSettingsResponseData.java (70%) rename src/main/java/com/sumup/sdk/models/{ => readers/settings}/UpdateReaderSettingsResponseDataMenuLock.java (97%) rename src/main/java/com/sumup/sdk/models/{ => readers/settings}/UpdateReaderSettingsResponseDataStatus.java (97%) rename src/main/java/com/sumup/sdk/models/{ => readers/settings}/UpdateReaderSettingsUnprocessableEntity.java (96%) diff --git a/README.md b/README.md index 73567242..5b8f1127 100644 --- a/README.md +++ b/README.md @@ -160,8 +160,8 @@ Synchronous example: ```java import com.sumup.sdk.SumUpClient; -import com.sumup.sdk.models.CreateReaderCheckoutRequest; -import com.sumup.sdk.models.CreateReaderCheckoutRequestTotalAmount; +import com.sumup.sdk.models.readers.checkouts.CreateReaderCheckoutRequest; +import com.sumup.sdk.models.readers.checkouts.CreateReaderCheckoutRequestTotalAmount; import java.util.Optional; import java.util.UUID; @@ -199,8 +199,8 @@ Asynchronous example: ```java import com.sumup.sdk.SumUpAsyncClient; -import com.sumup.sdk.models.CreateReaderCheckoutRequest; -import com.sumup.sdk.models.CreateReaderCheckoutRequestTotalAmount; +import com.sumup.sdk.models.readers.checkouts.CreateReaderCheckoutRequest; +import com.sumup.sdk.models.readers.checkouts.CreateReaderCheckoutRequestTotalAmount; import java.util.Optional; import java.util.UUID; import java.util.concurrent.CompletableFuture; diff --git a/codegen/internal/generator/events.go b/codegen/internal/generator/events.go index 63e8b0b2..c245d064 100644 --- a/codegen/internal/generator/events.go +++ b/codegen/internal/generator/events.go @@ -15,6 +15,23 @@ import ( type eventData struct{ Name, Type, TypeMember, Description, Model, Package string } +func eventObjectSchemaName(op *v3.Operation) (string, error) { + if op.Extensions == nil || op.Extensions.GetOrZero("x-object") == nil { + return "", fmt.Errorf("missing x-object") + } + var object struct { + Ref string `yaml:"$ref"` + } + if err := op.Extensions.GetOrZero("x-object").Decode(&object); err != nil { + return "", fmt.Errorf("decode object: %w", err) + } + name, ok := strings.CutPrefix(object.Ref, "#/components/schemas/") + if !ok || name == "" { + return "", fmt.Errorf("invalid object reference") + } + return name, nil +} + func renderEvents(doc *v3.Document, params Params) error { events := []eventData{} if doc.Webhooks != nil { @@ -23,17 +40,11 @@ func renderEvents(doc *v3.Document, params Params) error { continue } op := path.Post - var object struct { - Ref string `yaml:"$ref"` - } - if op.Extensions == nil || op.Extensions.GetOrZero("x-object") == nil { - return fmt.Errorf("event %s: missing x-object", eventType) - } - if err := op.Extensions.GetOrZero("x-object").Decode(&object); err != nil { - return fmt.Errorf("event %s: decode object: %w", eventType, err) + model, err := eventObjectSchemaName(op) + if err != nil { + return fmt.Errorf("event %s: %w", eventType, err) } - model := strings.TrimPrefix(object.Ref, "#/components/schemas/") - if model == object.Ref || doc.Components == nil || doc.Components.Schemas.GetOrZero(model) == nil || op.OperationId == "" { + if doc.Components == nil || doc.Components.Schemas.GetOrZero(model) == nil || op.OperationId == "" { return fmt.Errorf("event %s: invalid object reference or operation ID", eventType) } description := strings.NewReplacer("&", "&", "<", "<", ">", ">", "*/", "*/").Replace(op.Description) diff --git a/codegen/internal/generator/model.go b/codegen/internal/generator/model.go index b577724f..947eb195 100644 --- a/codegen/internal/generator/model.go +++ b/codegen/internal/generator/model.go @@ -144,7 +144,6 @@ const ( // used by renderers to generate source files. func buildModel(doc *v3.Document, params Params) (sdkModel, error) { normalizeSchemaAnnotations(doc) - resolver := newTypeResolver(doc, params) tagDescriptions := map[string][]string{} if doc.Tags != nil { for _, tag := range doc.Tags { @@ -159,6 +158,7 @@ func buildModel(doc *v3.Document, params Params) (sdkModel, error) { if err != nil { return sdkModel{}, err } + resolver := newTypeResolver(doc, params, collectModelPackages(doc, params, parents)) if doc.Paths != nil && doc.Paths.PathItems != nil && doc.Paths.PathItems.Len() > 0 { for path, item := range doc.Paths.PathItems.FromOldest() { if item == nil { @@ -238,15 +238,13 @@ func buildModel(doc *v3.Document, params Params) (sdkModel, error) { for i := range clients { client := &clients[i] path := client.AccessorName + "()" - packageSuffix := client.AccessorName for ancestor := parents[client.TagName].tag; ancestor != ""; ancestor = parents[ancestor].tag { accessor := byTag[ancestor].AccessorName path = accessor + "()." + path - packageSuffix = accessor + "." + packageSuffix } client.AccessPath = path if parent := byTag[parents[client.TagName].tag]; parent != nil { - client.Package += "." + strings.ToLower(packageSuffix) + client.Package += "." + resourcePackageSuffix(client.TagName, parents) parent.Children = append(parent.Children, childClient{ ClassName: client.ClassName, AccessorName: client.AccessorName, @@ -255,8 +253,8 @@ func buildModel(doc *v3.Document, params Params) (sdkModel, error) { } } - schemas := buildSchemas(doc, params, resolver) - schemas = append(schemas, resolver.inlineSchemaModels(params)...) + schemas := buildSchemas(doc, resolver) + schemas = append(schemas, resolver.inlineSchemaModels()...) return sdkModel{ BasePackage: params.BasePackage, @@ -604,7 +602,7 @@ func preferredSchema(content *orderedmap.Map[string, *v3.MediaType]) *base.Schem } // buildSchemas converts OpenAPI components into schemaModel instances. -func buildSchemas(doc *v3.Document, params Params, resolver *typeResolver) []schemaModel { +func buildSchemas(doc *v3.Document, resolver *typeResolver) []schemaModel { if doc.Components == nil || doc.Components.Schemas == nil || doc.Components.Schemas.Len() == 0 { return nil } @@ -621,6 +619,7 @@ func buildSchemas(doc *v3.Document, params Params, resolver *typeResolver) []sch continue } description := schemaDescription(ref) + pkg := resolver.modelPackage(ref.Schema()) if enumValues, ok := enumValuesForSchema(schemaFromProxy(ref)); ok { imports := sortedImports(map[string]struct{}{ "com.fasterxml.jackson.annotation.JsonCreator": {}, @@ -630,7 +629,7 @@ func buildSchemas(doc *v3.Document, params Params, resolver *typeResolver) []sch result = append(result, schemaModel{ Name: name, ClassName: pascalCase(name, ""), - Package: params.modelPackage(), + Package: pkg, DescriptionLines: splitComment(description), Imports: imports, IsEnum: true, @@ -649,7 +648,7 @@ func buildSchemas(doc *v3.Document, params Params, resolver *typeResolver) []sch model := schemaModel{ Name: name, ClassName: pascalCase(name, ""), - Package: params.modelPackage(), + Package: pkg, DescriptionLines: splitComment(description), Fields: fields, AdditionalProps: additionalProps, diff --git a/codegen/internal/generator/model_packages.go b/codegen/internal/generator/model_packages.go new file mode 100644 index 00000000..c99b8c51 --- /dev/null +++ b/codegen/internal/generator/model_packages.go @@ -0,0 +1,80 @@ +package generator + +import ( + "strings" + + "github.com/pb33f/libopenapi/datamodel/high/base" + v3 "github.com/pb33f/libopenapi/datamodel/high/v3" +) + +// collectModelPackages scopes models used by one subresource to that resource. +// Models used by multiple resources and runtime models stay in the base package. +func collectModelPackages(doc *v3.Document, params Params, parents map[string]resourceParent) map[*base.Schema]string { + if len(parents) == 0 { + return nil + } + shared := params.modelPackage() + packages := make(map[*base.Schema]string) + component := func(name string) *base.SchemaProxy { + if doc.Components == nil || doc.Components.Schemas == nil { + return nil + } + return doc.Components.Schemas.GetOrZero(name) + } + var visit func(*base.SchemaProxy, string) + visit = func(proxy *base.SchemaProxy, pkg string) { + schema := schemaFromProxy(proxy) + if schema == nil { + return + } + if previous := packages[schema]; previous != "" { + if previous == pkg || previous == shared { + return + } + pkg = shared + } + packages[schema] = pkg + if name, ok := strings.CutPrefix(proxy.GetReference(), "#/components/schemas/"); ok { + visit(component(name), pkg) + } + visitSchemaChildren(schema, func(child *base.SchemaProxy) { visit(child, pkg) }) + } + + // The handwritten transport and generated event types import these models. + for _, name := range []string{"Problem", "Event", "EventType", "EventObject"} { + visit(component(name), shared) + } + if doc.Paths != nil { + for _, item := range doc.Paths.PathItems.FromOldest() { + if item == nil { + continue + } + for _, op := range item.GetOperations().FromOldest() { + if op == nil { + continue + } + tag := firstTag(op.Tags) + pkg := shared + if parents[tag].tag != "" { + pkg += "." + resourcePackageSuffix(tag, parents) + } + claim := func(schema *base.SchemaProxy) { visit(schema, pkg) } + for _, param := range item.Parameters { + visitParameterSchemas(param, claim) + } + visitOperationSchemas(op, claim) + } + } + } + for _, item := range doc.Webhooks.FromOldest() { + if item == nil || item.Post == nil { + continue + } + op := item.Post + visitOperationSchemas(op, func(schema *base.SchemaProxy) { visit(schema, shared) }) + if name, err := eventObjectSchemaName(op); err == nil { + visit(component(name), shared) + } + } + return packages +} diff --git a/codegen/internal/generator/render.go b/codegen/internal/generator/render.go index 2efd8f56..fe999697 100644 --- a/codegen/internal/generator/render.go +++ b/codegen/internal/generator/render.go @@ -109,12 +109,16 @@ func renderModels(model sdkModel, params Params) error { } for _, schema := range model.Schemas { + modelDir := filepath.Join(params.OutputDir, filepath.FromSlash(strings.ReplaceAll(schema.Package, ".", "/"))) + if err := os.MkdirAll(modelDir, 0o755); err != nil { + return fmt.Errorf("create %s package directory: %w", schema.Package, err) + } data := prepareModelTemplateData(schema) var buf bytes.Buffer if err := tmpl.Execute(&buf, data); err != nil { return fmt.Errorf("render model %s: %w", schema.ClassName, err) } - target := filepath.Join(dir, schema.ClassName+".java") + target := filepath.Join(modelDir, schema.ClassName+".java") if err := os.WriteFile(target, buf.Bytes(), 0o644); err != nil { return fmt.Errorf("write model %s: %w", schema.ClassName, err) } diff --git a/codegen/internal/generator/schema_annotations.go b/codegen/internal/generator/schema_annotations.go index 2d0cd3fa..e4f5649b 100644 --- a/codegen/internal/generator/schema_annotations.go +++ b/codegen/internal/generator/schema_annotations.go @@ -42,24 +42,7 @@ func normalizeSchemaAnnotations(doc *v3.Document) { } } } - for _, child := range schema.Properties.FromOldest() { - visit(child) - } - if schema.Items != nil && schema.Items.IsA() { - visit(schema.Items.A) - } - if schema.AdditionalProperties != nil && schema.AdditionalProperties.IsA() { - visit(schema.AdditionalProperties.A) - } - for _, child := range schema.AllOf { - visit(child) - } - for _, child := range schema.AnyOf { - visit(child) - } - for _, child := range schema.OneOf { - visit(child) - } + visitSchemaChildren(schema, visit) if len(schema.AllOf) == 0 || !annotationOnlySchema(schema, true) { return } @@ -107,45 +90,15 @@ func normalizeSchemaAnnotations(doc *v3.Document) { visit(schema) } } - visitContent := func(content iter.Seq2[string, *v3.MediaType]) { - for _, media := range content { - if media != nil { - visit(media.Schema) - } - } - } - visitParameter := func(parameter *v3.Parameter) { - if parameter == nil { - return - } - visit(parameter.Schema) - visitContent(parameter.Content.FromOldest()) - } - visitResponse := func(response *v3.Response) { - if response != nil { - visitContent(response.Content.FromOldest()) - } - } visitPath := func(item *v3.PathItem) { if item == nil { return } for _, parameter := range item.Parameters { - visitParameter(parameter) + visitParameterSchemas(parameter, visit) } for _, operation := range item.GetOperations().FromOldest() { - for _, parameter := range operation.Parameters { - visitParameter(parameter) - } - if operation.RequestBody != nil { - visitContent(operation.RequestBody.Content.FromOldest()) - } - if operation.Responses != nil { - for _, response := range operation.Responses.Codes.FromOldest() { - visitResponse(response) - } - visitResponse(operation.Responses.Default) - } + visitOperationSchemas(operation, visit) } } if doc.Paths != nil { @@ -158,6 +111,58 @@ func normalizeSchemaAnnotations(doc *v3.Document) { } } +func visitSchemaChildren(schema *base.Schema, visit func(*base.SchemaProxy)) { + for _, child := range schema.Properties.FromOldest() { + visit(child) + } + if schema.Items != nil && schema.Items.IsA() { + visit(schema.Items.A) + } + if schema.AdditionalProperties != nil && schema.AdditionalProperties.IsA() { + visit(schema.AdditionalProperties.A) + } + for _, child := range slices.Concat(schema.AllOf, schema.AnyOf, schema.OneOf) { + visit(child) + } +} + +func visitMediaSchemas(content iter.Seq2[string, *v3.MediaType], visit func(*base.SchemaProxy)) { + for _, media := range content { + if media != nil { + visit(media.Schema) + } + } +} + +func visitParameterSchemas(parameter *v3.Parameter, visit func(*base.SchemaProxy)) { + if parameter != nil { + visit(parameter.Schema) + visitMediaSchemas(parameter.Content.FromOldest(), visit) + } +} + +func visitOperationSchemas(operation *v3.Operation, visit func(*base.SchemaProxy)) { + if operation == nil { + return + } + for _, parameter := range operation.Parameters { + visitParameterSchemas(parameter, visit) + } + if operation.RequestBody != nil { + visitMediaSchemas(operation.RequestBody.Content.FromOldest(), visit) + } + if operation.Responses != nil { + for _, response := range operation.Responses.Codes.FromOldest() { + if response != nil { + visitMediaSchemas(response.Content.FromOldest(), visit) + } + } + if response := operation.Responses.Default; response != nil { + visitMediaSchemas(response.Content.FromOldest(), visit) + } + } +} + func annotationOnlySchema(schema *base.Schema, allowAllOf bool) bool { if schema == nil || schema.GoLow() == nil || schema.GoLow().RootNode == nil { return false diff --git a/codegen/internal/generator/tag_hierarchy.go b/codegen/internal/generator/tag_hierarchy.go index bcc3751d..91ac2fdb 100644 --- a/codegen/internal/generator/tag_hierarchy.go +++ b/codegen/internal/generator/tag_hierarchy.go @@ -3,6 +3,7 @@ package generator import ( "cmp" "fmt" + "strings" v3 "github.com/pb33f/libopenapi/datamodel/high/v3" ) @@ -12,6 +13,14 @@ type resourceParent struct { label string } +func resourcePackageSuffix(tag string, parents map[string]resourceParent) string { + parent := parents[tag] + if parent.tag == "" { + return strings.ToLower(camelCase(tag, "client")) + } + return resourcePackageSuffix(parent.tag, parents) + "." + strings.ToLower(camelCase(parent.label, "client")) +} + func readResourceParents(doc *v3.Document) (map[string]resourceParent, error) { if doc.Extensions == nil { return nil, nil diff --git a/codegen/internal/generator/tag_hierarchy_test.go b/codegen/internal/generator/tag_hierarchy_test.go index bb30ab37..1ce6dffe 100644 --- a/codegen/internal/generator/tag_hierarchy_test.go +++ b/codegen/internal/generator/tag_hierarchy_test.go @@ -28,14 +28,33 @@ paths: operationId: ListReaders tags: [Readers] responses: - '204': {description: OK} + '200': + description: OK + content: + application/json: + schema: {$ref: '#/components/schemas/Shared'} post: operationId: CreateReaderCheckout tags: [ReaderCheckouts] x-codegen: {method_name: create} + requestBody: + content: + application/json: + schema: {$ref: '#/components/schemas/CheckoutRequest'} responses: '204': {description: OK} -components: {schemas: {}} +components: + schemas: + CheckoutRequest: + type: object + properties: + shared: {$ref: '#/components/schemas/Shared'} + details: + type: object + properties: {reference: {type: string}} + Shared: + type: object + properties: {id: {type: string}} `)) if err != nil { t.Fatal(err) @@ -78,6 +97,9 @@ components: {schemas: {}} if !strings.Contains(string(child), "package com.sumup.sdk.clients.readers.checkouts;") { t.Errorf("%s declares the wrong package", childClass) } + if !strings.Contains(string(child), "com.sumup.sdk.models.readers.checkouts.CheckoutRequest") { + t.Errorf("%s does not use the scoped request model", childClass) + } parent, err := os.ReadFile(filepath.Join(root, "Readers"+variant+".java")) if err != nil { t.Fatal(err) @@ -86,4 +108,17 @@ components: {schemas: {}} t.Errorf("Readers%s does not import %s", variant, childClass) } } + if err := renderModels(sdk, params); err != nil { + t.Fatal(err) + } + modelRoot := filepath.Join(params.OutputDir, params.modelPackagePath()) + request, err := os.ReadFile(filepath.Join(modelRoot, "readers", "checkouts", "CheckoutRequest.java")) + if err != nil { + t.Fatal(err) + } + for _, name := range []string{"com.sumup.sdk.models.Shared", "com.sumup.sdk.models.readers.checkouts.CheckoutRequestDetails"} { + if !strings.Contains(string(request), name) { + t.Errorf("checkout request does not reference %s", name) + } + } } diff --git a/codegen/internal/generator/types.go b/codegen/internal/generator/types.go index 09879c2a..41c1bd0e 100644 --- a/codegen/internal/generator/types.go +++ b/codegen/internal/generator/types.go @@ -27,17 +27,19 @@ type typeResolver struct { inlineTypes map[*base.Schema]string inlineSchemas []*inlineSchemaInfo inlineNameUsage map[string]int + modelPackages map[*base.Schema]string } // newTypeResolver returns a resolver that knows how to reference components and // captures inline schema names as it uncovers them. -func newTypeResolver(doc *v3.Document, params Params) *typeResolver { +func newTypeResolver(doc *v3.Document, params Params, packages map[*base.Schema]string) *typeResolver { resolver := &typeResolver{ params: params, schemaTypes: make(map[string]string), inlineTypes: make(map[*base.Schema]string), inlineSchemas: []*inlineSchemaInfo{}, inlineNameUsage: make(map[string]int), + modelPackages: packages, } if doc.Components != nil && doc.Components.Schemas != nil && doc.Components.Schemas.Len() > 0 { for name, ref := range doc.Components.Schemas.FromOldest() { @@ -45,13 +47,20 @@ func newTypeResolver(doc *v3.Document, params Params) *typeResolver { continue } className := pascalCase(name, "") - resolver.schemaTypes[name] = params.modelPackage() + "." + className + resolver.schemaTypes[name] = resolver.modelPackage(schemaFromProxy(ref)) + "." + className resolver.inlineNameUsage[className]++ } } return resolver } +func (r *typeResolver) modelPackage(schema *base.Schema) string { + if pkg := r.modelPackages[schema]; pkg != "" { + return pkg + } + return r.params.modelPackage() +} + // schemaClassName resolves a schema component name to the fully-qualified Java // class name, registering it as inline if the component does not exist. func (r *typeResolver) schemaClassName(name string) string { @@ -95,7 +104,7 @@ func (r *typeResolver) javaType(ref *base.SchemaProxy, context ...string) javaTy } if enumValues, ok := enumValuesForSchema(schema); ok && len(enumValues) > 0 { name := r.registerInlineSchema(schema, context) - fqn := r.params.modelPackage() + "." + name + fqn := r.modelPackage(schema) + "." + name return javaType{ Name: fqn, TypeRefExpr: fmt.Sprintf("new TypeReference<%s>() {}", fqn), @@ -235,7 +244,7 @@ func (r *typeResolver) genericList() javaType { // fully-qualified name for use in generated sources. func (r *typeResolver) inlineObjectType(schema *base.Schema, context []string) javaType { name := r.registerInlineSchema(schema, context) - fqn := r.params.modelPackage() + "." + name + fqn := r.modelPackage(schema) + "." + name return javaType{ Name: fqn, TypeRefExpr: fmt.Sprintf("new TypeReference<%s>() {}", fqn), @@ -343,7 +352,7 @@ func (r *typeResolver) genericMap() javaType { // inlineSchemaModels converts the inline schemas tracked by the resolver into // schemaModel values so the renderer can emit classes for them. -func (r *typeResolver) inlineSchemaModels(params Params) []schemaModel { +func (r *typeResolver) inlineSchemaModels() []schemaModel { var models []schemaModel for { added := false @@ -360,7 +369,7 @@ func (r *typeResolver) inlineSchemaModels(params Params) []schemaModel { models = append(models, schemaModel{ Name: info.className, ClassName: info.className, - Package: params.modelPackage(), + Package: r.modelPackage(info.schema), DescriptionLines: splitComment(info.description), Imports: imports, IsEnum: true, @@ -381,7 +390,7 @@ func (r *typeResolver) inlineSchemaModels(params Params) []schemaModel { models = append(models, schemaModel{ Name: info.className, ClassName: info.className, - Package: params.modelPackage(), + Package: r.modelPackage(info.schema), DescriptionLines: splitComment(info.description), Fields: fields, AdditionalProps: additionalProps, diff --git a/examples/card-reader-checkout/src/main/java/com/sumup/examples/cardreader/CardReaderCheckoutExample.java b/examples/card-reader-checkout/src/main/java/com/sumup/examples/cardreader/CardReaderCheckoutExample.java index ad3ef97b..5f8011cd 100644 --- a/examples/card-reader-checkout/src/main/java/com/sumup/examples/cardreader/CardReaderCheckoutExample.java +++ b/examples/card-reader-checkout/src/main/java/com/sumup/examples/cardreader/CardReaderCheckoutExample.java @@ -2,8 +2,8 @@ import com.sumup.sdk.SumUpClient; import com.sumup.sdk.core.ApiException; -import com.sumup.sdk.models.CreateReaderCheckoutRequest; -import com.sumup.sdk.models.CreateReaderCheckoutRequestTotalAmount; +import com.sumup.sdk.models.readers.checkouts.CreateReaderCheckoutRequest; +import com.sumup.sdk.models.readers.checkouts.CreateReaderCheckoutRequestTotalAmount; import java.util.Optional; import java.util.UUID; diff --git a/src/main/java/com/sumup/sdk/clients/readers/checkouts/ReaderCheckoutsAsyncClient.java b/src/main/java/com/sumup/sdk/clients/readers/checkouts/ReaderCheckoutsAsyncClient.java index f170ae05..6f9a64c2 100644 --- a/src/main/java/com/sumup/sdk/clients/readers/checkouts/ReaderCheckoutsAsyncClient.java +++ b/src/main/java/com/sumup/sdk/clients/readers/checkouts/ReaderCheckoutsAsyncClient.java @@ -45,15 +45,16 @@ public ReaderCheckoutsAsyncClient(ApiClient apiClient) { * @param request A checkout initial attributes *

Call the overload that accepts RequestOptions to customize headers, authorization, or * request timeout. - * @return CompletableFuture resolved with com.sumup.sdk.models.CreateReaderCheckoutResponse - * parsed response. + * @return CompletableFuture resolved with + * com.sumup.sdk.models.readers.checkouts.CreateReaderCheckoutResponse parsed response. * @throws ApiException if the SumUp API returns an error. */ - public CompletableFuture create( - String merchantCode, - String readerId, - com.sumup.sdk.models.CreateReaderCheckoutRequest request) - throws ApiException { + public CompletableFuture + create( + String merchantCode, + String readerId, + com.sumup.sdk.models.readers.checkouts.CreateReaderCheckoutRequest request) + throws ApiException { return create(merchantCode, readerId, request, null); } @@ -76,16 +77,17 @@ public CompletableFuture crea * @param request A checkout initial attributes * @param requestOptions Request-specific overrides (headers, authorization, or timeout). Pass * {@code null} to use client defaults. - * @return CompletableFuture resolved with com.sumup.sdk.models.CreateReaderCheckoutResponse - * parsed response. + * @return CompletableFuture resolved with + * com.sumup.sdk.models.readers.checkouts.CreateReaderCheckoutResponse parsed response. * @throws ApiException if the SumUp API returns an error. */ - public CompletableFuture create( - String merchantCode, - String readerId, - com.sumup.sdk.models.CreateReaderCheckoutRequest request, - RequestOptions requestOptions) - throws ApiException { + public CompletableFuture + create( + String merchantCode, + String readerId, + com.sumup.sdk.models.readers.checkouts.CreateReaderCheckoutRequest request, + RequestOptions requestOptions) + throws ApiException { Objects.requireNonNull(merchantCode, "merchantCode"); Objects.requireNonNull(readerId, "readerId"); Objects.requireNonNull(request, "request"); @@ -101,7 +103,7 @@ public CompletableFuture crea null, null, request, - new TypeReference() {}, + new TypeReference() {}, requestOptions); } @@ -117,11 +119,11 @@ public CompletableFuture crea * @param readerId The unique identifier of the Reader *

Call the overload that accepts RequestOptions to customize headers, authorization, or * request timeout. - * @return CompletableFuture resolved with com.sumup.sdk.models.GetReaderCheckoutResponse parsed - * response. + * @return CompletableFuture resolved with + * com.sumup.sdk.models.readers.checkouts.GetReaderCheckoutResponse parsed response. * @throws ApiException if the SumUp API returns an error. */ - public CompletableFuture get( + public CompletableFuture get( String checkoutId, String merchantCode, String readerId) throws ApiException { return get(checkoutId, merchantCode, readerId, null); } @@ -138,11 +140,11 @@ public CompletableFuture get( * @param readerId The unique identifier of the Reader * @param requestOptions Request-specific overrides (headers, authorization, or timeout). Pass * {@code null} to use client defaults. - * @return CompletableFuture resolved with com.sumup.sdk.models.GetReaderCheckoutResponse parsed - * response. + * @return CompletableFuture resolved with + * com.sumup.sdk.models.readers.checkouts.GetReaderCheckoutResponse parsed response. * @throws ApiException if the SumUp API returns an error. */ - public CompletableFuture get( + public CompletableFuture get( String checkoutId, String merchantCode, String readerId, RequestOptions requestOptions) throws ApiException { Objects.requireNonNull(checkoutId, "checkoutId"); @@ -161,7 +163,7 @@ public CompletableFuture get( null, null, null, - new TypeReference() {}, + new TypeReference() {}, requestOptions); } diff --git a/src/main/java/com/sumup/sdk/clients/readers/checkouts/ReaderCheckoutsClient.java b/src/main/java/com/sumup/sdk/clients/readers/checkouts/ReaderCheckoutsClient.java index 671b5067..f1736bcc 100644 --- a/src/main/java/com/sumup/sdk/clients/readers/checkouts/ReaderCheckoutsClient.java +++ b/src/main/java/com/sumup/sdk/clients/readers/checkouts/ReaderCheckoutsClient.java @@ -44,13 +44,13 @@ public ReaderCheckoutsClient(ApiClient apiClient) { * @param request A checkout initial attributes *

Call the overload that accepts RequestOptions to customize headers, authorization, or * request timeout. - * @return com.sumup.sdk.models.CreateReaderCheckoutResponse parsed response. + * @return com.sumup.sdk.models.readers.checkouts.CreateReaderCheckoutResponse parsed response. * @throws ApiException if the SumUp API returns an error. */ - public com.sumup.sdk.models.CreateReaderCheckoutResponse create( + public com.sumup.sdk.models.readers.checkouts.CreateReaderCheckoutResponse create( String merchantCode, String readerId, - com.sumup.sdk.models.CreateReaderCheckoutRequest request) + com.sumup.sdk.models.readers.checkouts.CreateReaderCheckoutRequest request) throws ApiException { return create(merchantCode, readerId, request, null); } @@ -74,13 +74,13 @@ public com.sumup.sdk.models.CreateReaderCheckoutResponse create( * @param request A checkout initial attributes * @param requestOptions Request-specific overrides (headers, authorization, or timeout). Pass * {@code null} to use client defaults. - * @return com.sumup.sdk.models.CreateReaderCheckoutResponse parsed response. + * @return com.sumup.sdk.models.readers.checkouts.CreateReaderCheckoutResponse parsed response. * @throws ApiException if the SumUp API returns an error. */ - public com.sumup.sdk.models.CreateReaderCheckoutResponse create( + public com.sumup.sdk.models.readers.checkouts.CreateReaderCheckoutResponse create( String merchantCode, String readerId, - com.sumup.sdk.models.CreateReaderCheckoutRequest request, + com.sumup.sdk.models.readers.checkouts.CreateReaderCheckoutRequest request, RequestOptions requestOptions) throws ApiException { Objects.requireNonNull(merchantCode, "merchantCode"); @@ -98,7 +98,7 @@ public com.sumup.sdk.models.CreateReaderCheckoutResponse create( null, null, request, - new TypeReference() {}, + new TypeReference() {}, requestOptions); } @@ -114,10 +114,10 @@ public com.sumup.sdk.models.CreateReaderCheckoutResponse create( * @param readerId The unique identifier of the Reader *

Call the overload that accepts RequestOptions to customize headers, authorization, or * request timeout. - * @return com.sumup.sdk.models.GetReaderCheckoutResponse parsed response. + * @return com.sumup.sdk.models.readers.checkouts.GetReaderCheckoutResponse parsed response. * @throws ApiException if the SumUp API returns an error. */ - public com.sumup.sdk.models.GetReaderCheckoutResponse get( + public com.sumup.sdk.models.readers.checkouts.GetReaderCheckoutResponse get( String checkoutId, String merchantCode, String readerId) throws ApiException { return get(checkoutId, merchantCode, readerId, null); } @@ -134,10 +134,10 @@ public com.sumup.sdk.models.GetReaderCheckoutResponse get( * @param readerId The unique identifier of the Reader * @param requestOptions Request-specific overrides (headers, authorization, or timeout). Pass * {@code null} to use client defaults. - * @return com.sumup.sdk.models.GetReaderCheckoutResponse parsed response. + * @return com.sumup.sdk.models.readers.checkouts.GetReaderCheckoutResponse parsed response. * @throws ApiException if the SumUp API returns an error. */ - public com.sumup.sdk.models.GetReaderCheckoutResponse get( + public com.sumup.sdk.models.readers.checkouts.GetReaderCheckoutResponse get( String checkoutId, String merchantCode, String readerId, RequestOptions requestOptions) throws ApiException { Objects.requireNonNull(checkoutId, "checkoutId"); @@ -156,7 +156,7 @@ public com.sumup.sdk.models.GetReaderCheckoutResponse get( null, null, null, - new TypeReference() {}, + new TypeReference() {}, requestOptions); } diff --git a/src/main/java/com/sumup/sdk/clients/readers/settings/ReaderSettingsAsyncClient.java b/src/main/java/com/sumup/sdk/clients/readers/settings/ReaderSettingsAsyncClient.java index e6c86dc8..17449bbd 100644 --- a/src/main/java/com/sumup/sdk/clients/readers/settings/ReaderSettingsAsyncClient.java +++ b/src/main/java/com/sumup/sdk/clients/readers/settings/ReaderSettingsAsyncClient.java @@ -40,11 +40,11 @@ public ReaderSettingsAsyncClient(ApiClient apiClient) { * @param readerId The unique identifier of the reader. *

Call the overload that accepts RequestOptions to customize headers, authorization, or * request timeout. - * @return CompletableFuture resolved with com.sumup.sdk.models.GetReaderSettingsResponse parsed - * response. + * @return CompletableFuture resolved with + * com.sumup.sdk.models.readers.settings.GetReaderSettingsResponse parsed response. * @throws ApiException if the SumUp API returns an error. */ - public CompletableFuture get( + public CompletableFuture get( String merchantCode, String readerId) throws ApiException { return get(merchantCode, readerId, null); } @@ -63,11 +63,11 @@ public CompletableFuture get( * @param readerId The unique identifier of the reader. * @param requestOptions Request-specific overrides (headers, authorization, or timeout). Pass * {@code null} to use client defaults. - * @return CompletableFuture resolved with com.sumup.sdk.models.GetReaderSettingsResponse parsed - * response. + * @return CompletableFuture resolved with + * com.sumup.sdk.models.readers.settings.GetReaderSettingsResponse parsed response. * @throws ApiException if the SumUp API returns an error. */ - public CompletableFuture get( + public CompletableFuture get( String merchantCode, String readerId, RequestOptions requestOptions) throws ApiException { Objects.requireNonNull(merchantCode, "merchantCode"); Objects.requireNonNull(readerId, "readerId"); @@ -83,7 +83,7 @@ public CompletableFuture get( null, null, null, - new TypeReference() {}, + new TypeReference() {}, requestOptions); } @@ -103,15 +103,16 @@ public CompletableFuture get( * @param request Menu lock settings to update. *

Call the overload that accepts RequestOptions to customize headers, authorization, or * request timeout. - * @return CompletableFuture resolved with com.sumup.sdk.models.UpdateReaderSettingsResponse - * parsed response. + * @return CompletableFuture resolved with + * com.sumup.sdk.models.readers.settings.UpdateReaderSettingsResponse parsed response. * @throws ApiException if the SumUp API returns an error. */ - public CompletableFuture update( - String merchantCode, - String readerId, - com.sumup.sdk.models.UpdateReaderSettingsRequest request) - throws ApiException { + public CompletableFuture + update( + String merchantCode, + String readerId, + com.sumup.sdk.models.readers.settings.UpdateReaderSettingsRequest request) + throws ApiException { return update(merchantCode, readerId, request, null); } @@ -131,16 +132,17 @@ public CompletableFuture upda * @param request Menu lock settings to update. * @param requestOptions Request-specific overrides (headers, authorization, or timeout). Pass * {@code null} to use client defaults. - * @return CompletableFuture resolved with com.sumup.sdk.models.UpdateReaderSettingsResponse - * parsed response. + * @return CompletableFuture resolved with + * com.sumup.sdk.models.readers.settings.UpdateReaderSettingsResponse parsed response. * @throws ApiException if the SumUp API returns an error. */ - public CompletableFuture update( - String merchantCode, - String readerId, - com.sumup.sdk.models.UpdateReaderSettingsRequest request, - RequestOptions requestOptions) - throws ApiException { + public CompletableFuture + update( + String merchantCode, + String readerId, + com.sumup.sdk.models.readers.settings.UpdateReaderSettingsRequest request, + RequestOptions requestOptions) + throws ApiException { Objects.requireNonNull(merchantCode, "merchantCode"); Objects.requireNonNull(readerId, "readerId"); Objects.requireNonNull(request, "request"); @@ -156,7 +158,7 @@ public CompletableFuture upda null, null, request, - new TypeReference() {}, + new TypeReference() {}, requestOptions); } } diff --git a/src/main/java/com/sumup/sdk/clients/readers/settings/ReaderSettingsClient.java b/src/main/java/com/sumup/sdk/clients/readers/settings/ReaderSettingsClient.java index 1c7a10f5..99ee163b 100644 --- a/src/main/java/com/sumup/sdk/clients/readers/settings/ReaderSettingsClient.java +++ b/src/main/java/com/sumup/sdk/clients/readers/settings/ReaderSettingsClient.java @@ -39,11 +39,11 @@ public ReaderSettingsClient(ApiClient apiClient) { * @param readerId The unique identifier of the reader. *

Call the overload that accepts RequestOptions to customize headers, authorization, or * request timeout. - * @return com.sumup.sdk.models.GetReaderSettingsResponse parsed response. + * @return com.sumup.sdk.models.readers.settings.GetReaderSettingsResponse parsed response. * @throws ApiException if the SumUp API returns an error. */ - public com.sumup.sdk.models.GetReaderSettingsResponse get(String merchantCode, String readerId) - throws ApiException { + public com.sumup.sdk.models.readers.settings.GetReaderSettingsResponse get( + String merchantCode, String readerId) throws ApiException { return get(merchantCode, readerId, null); } @@ -61,10 +61,10 @@ public com.sumup.sdk.models.GetReaderSettingsResponse get(String merchantCode, S * @param readerId The unique identifier of the reader. * @param requestOptions Request-specific overrides (headers, authorization, or timeout). Pass * {@code null} to use client defaults. - * @return com.sumup.sdk.models.GetReaderSettingsResponse parsed response. + * @return com.sumup.sdk.models.readers.settings.GetReaderSettingsResponse parsed response. * @throws ApiException if the SumUp API returns an error. */ - public com.sumup.sdk.models.GetReaderSettingsResponse get( + public com.sumup.sdk.models.readers.settings.GetReaderSettingsResponse get( String merchantCode, String readerId, RequestOptions requestOptions) throws ApiException { Objects.requireNonNull(merchantCode, "merchantCode"); Objects.requireNonNull(readerId, "readerId"); @@ -80,7 +80,7 @@ public com.sumup.sdk.models.GetReaderSettingsResponse get( null, null, null, - new TypeReference() {}, + new TypeReference() {}, requestOptions); } @@ -100,13 +100,13 @@ public com.sumup.sdk.models.GetReaderSettingsResponse get( * @param request Menu lock settings to update. *

Call the overload that accepts RequestOptions to customize headers, authorization, or * request timeout. - * @return com.sumup.sdk.models.UpdateReaderSettingsResponse parsed response. + * @return com.sumup.sdk.models.readers.settings.UpdateReaderSettingsResponse parsed response. * @throws ApiException if the SumUp API returns an error. */ - public com.sumup.sdk.models.UpdateReaderSettingsResponse update( + public com.sumup.sdk.models.readers.settings.UpdateReaderSettingsResponse update( String merchantCode, String readerId, - com.sumup.sdk.models.UpdateReaderSettingsRequest request) + com.sumup.sdk.models.readers.settings.UpdateReaderSettingsRequest request) throws ApiException { return update(merchantCode, readerId, request, null); } @@ -127,13 +127,13 @@ public com.sumup.sdk.models.UpdateReaderSettingsResponse update( * @param request Menu lock settings to update. * @param requestOptions Request-specific overrides (headers, authorization, or timeout). Pass * {@code null} to use client defaults. - * @return com.sumup.sdk.models.UpdateReaderSettingsResponse parsed response. + * @return com.sumup.sdk.models.readers.settings.UpdateReaderSettingsResponse parsed response. * @throws ApiException if the SumUp API returns an error. */ - public com.sumup.sdk.models.UpdateReaderSettingsResponse update( + public com.sumup.sdk.models.readers.settings.UpdateReaderSettingsResponse update( String merchantCode, String readerId, - com.sumup.sdk.models.UpdateReaderSettingsRequest request, + com.sumup.sdk.models.readers.settings.UpdateReaderSettingsRequest request, RequestOptions requestOptions) throws ApiException { Objects.requireNonNull(merchantCode, "merchantCode"); @@ -151,7 +151,7 @@ public com.sumup.sdk.models.UpdateReaderSettingsResponse update( null, null, request, - new TypeReference() {}, + new TypeReference() {}, requestOptions); } } diff --git a/src/main/java/com/sumup/sdk/models/Affiliate2.java b/src/main/java/com/sumup/sdk/models/readers/checkouts/Affiliate2.java similarity index 98% rename from src/main/java/com/sumup/sdk/models/Affiliate2.java rename to src/main/java/com/sumup/sdk/models/readers/checkouts/Affiliate2.java index d4df5b21..9424020f 100644 --- a/src/main/java/com/sumup/sdk/models/Affiliate2.java +++ b/src/main/java/com/sumup/sdk/models/readers/checkouts/Affiliate2.java @@ -1,5 +1,5 @@ // Code generated by sumup-java/codegen. DO NOT EDIT. -package com.sumup.sdk.models; +package com.sumup.sdk.models.readers.checkouts; import java.util.Objects; diff --git a/src/main/java/com/sumup/sdk/models/CreateReaderCheckoutError.java b/src/main/java/com/sumup/sdk/models/readers/checkouts/CreateReaderCheckoutError.java similarity index 76% rename from src/main/java/com/sumup/sdk/models/CreateReaderCheckoutError.java rename to src/main/java/com/sumup/sdk/models/readers/checkouts/CreateReaderCheckoutError.java index ead9adc7..f6c56030 100644 --- a/src/main/java/com/sumup/sdk/models/CreateReaderCheckoutError.java +++ b/src/main/java/com/sumup/sdk/models/readers/checkouts/CreateReaderCheckoutError.java @@ -1,11 +1,11 @@ // Code generated by sumup-java/codegen. DO NOT EDIT. -package com.sumup.sdk.models; +package com.sumup.sdk.models.readers.checkouts; import java.util.Objects; /** Error description */ public record CreateReaderCheckoutError( - com.sumup.sdk.models.CreateReaderCheckoutErrorErrors errors) { + com.sumup.sdk.models.readers.checkouts.CreateReaderCheckoutErrorErrors errors) { /** * Creates a builder for CreateReaderCheckoutError. * @@ -17,7 +17,7 @@ public static Builder builder() { /** Builder for CreateReaderCheckoutError instances. */ public static final class Builder { - private com.sumup.sdk.models.CreateReaderCheckoutErrorErrors errors; + private com.sumup.sdk.models.readers.checkouts.CreateReaderCheckoutErrorErrors errors; private Builder() {} @@ -27,7 +27,8 @@ private Builder() {} * @param errors Value for the errors field. * @return This builder instance. */ - public Builder errors(com.sumup.sdk.models.CreateReaderCheckoutErrorErrors errors) { + public Builder errors( + com.sumup.sdk.models.readers.checkouts.CreateReaderCheckoutErrorErrors errors) { this.errors = errors; return this; } diff --git a/src/main/java/com/sumup/sdk/models/CreateReaderCheckoutErrorErrors.java b/src/main/java/com/sumup/sdk/models/readers/checkouts/CreateReaderCheckoutErrorErrors.java similarity index 96% rename from src/main/java/com/sumup/sdk/models/CreateReaderCheckoutErrorErrors.java rename to src/main/java/com/sumup/sdk/models/readers/checkouts/CreateReaderCheckoutErrorErrors.java index a27452f4..2264e29f 100644 --- a/src/main/java/com/sumup/sdk/models/CreateReaderCheckoutErrorErrors.java +++ b/src/main/java/com/sumup/sdk/models/readers/checkouts/CreateReaderCheckoutErrorErrors.java @@ -1,5 +1,5 @@ // Code generated by sumup-java/codegen. DO NOT EDIT. -package com.sumup.sdk.models; +package com.sumup.sdk.models.readers.checkouts; import java.util.Objects; diff --git a/src/main/java/com/sumup/sdk/models/CreateReaderCheckoutRequest.java b/src/main/java/com/sumup/sdk/models/readers/checkouts/CreateReaderCheckoutRequest.java similarity index 83% rename from src/main/java/com/sumup/sdk/models/CreateReaderCheckoutRequest.java rename to src/main/java/com/sumup/sdk/models/readers/checkouts/CreateReaderCheckoutRequest.java index eff1298c..a19703ef 100644 --- a/src/main/java/com/sumup/sdk/models/CreateReaderCheckoutRequest.java +++ b/src/main/java/com/sumup/sdk/models/readers/checkouts/CreateReaderCheckoutRequest.java @@ -1,5 +1,5 @@ // Code generated by sumup-java/codegen. DO NOT EDIT. -package com.sumup.sdk.models; +package com.sumup.sdk.models.readers.checkouts; import java.util.Objects; @@ -11,19 +11,19 @@ public record CreateReaderCheckoutRequest( * must be provided and contains the data needed to validate the transaction with the AADE * signature provider. */ - com.sumup.sdk.models.CreateReaderCheckoutRequestAade aade, + com.sumup.sdk.models.readers.checkouts.CreateReaderCheckoutRequestAade aade, /** * Optional affiliate metadata associated with the checkout's payment. Provide both `app_id` and * `key` when including this object. */ - com.sumup.sdk.models.Affiliate2 affiliate, + com.sumup.sdk.models.readers.checkouts.Affiliate2 affiliate, /** * The card type of the card used for the transaction. It is required only for some countries * (e.g: Brazil). */ - com.sumup.sdk.models.CreateReaderCheckoutRequestCardType cardType, + com.sumup.sdk.models.readers.checkouts.CreateReaderCheckoutRequestCardType cardType, /** Description of the checkout to be shown in the Merchant Sales */ String description, @@ -40,7 +40,7 @@ public record CreateReaderCheckoutRequest( * QR-code payment flow on the device. Pix is only supported for Brazilian merchants; other * merchants will receive a 422 error. */ - com.sumup.sdk.models.CreateReaderCheckoutRequestPaymentType paymentType, + com.sumup.sdk.models.readers.checkouts.CreateReaderCheckoutRequestPaymentType paymentType, /** Webhook URL to which the payment result will be sent. It must be a HTTPS url. */ String returnUrl, @@ -63,7 +63,7 @@ public record CreateReaderCheckoutRequest( * Amount to charge in minor units. Use the decimal places for the currency. CLP, COP, and HUF * use zero decimal places. For example, send `1234` for EUR 12.34 or `1000` for CLP 1000. */ - com.sumup.sdk.models.CreateReaderCheckoutRequestTotalAmount totalAmount) { + com.sumup.sdk.models.readers.checkouts.CreateReaderCheckoutRequestTotalAmount totalAmount) { /** * Creates a builder for CreateReaderCheckoutRequest. * @@ -75,16 +75,18 @@ public static Builder builder() { /** Builder for CreateReaderCheckoutRequest instances. */ public static final class Builder { - private com.sumup.sdk.models.CreateReaderCheckoutRequestAade aade; - private com.sumup.sdk.models.Affiliate2 affiliate; - private com.sumup.sdk.models.CreateReaderCheckoutRequestCardType cardType; + private com.sumup.sdk.models.readers.checkouts.CreateReaderCheckoutRequestAade aade; + private com.sumup.sdk.models.readers.checkouts.Affiliate2 affiliate; + private com.sumup.sdk.models.readers.checkouts.CreateReaderCheckoutRequestCardType cardType; private String description; private Long installments; - private com.sumup.sdk.models.CreateReaderCheckoutRequestPaymentType paymentType; + private com.sumup.sdk.models.readers.checkouts.CreateReaderCheckoutRequestPaymentType + paymentType; private String returnUrl; private java.util.List tipRates; private Long tipTimeout; - private com.sumup.sdk.models.CreateReaderCheckoutRequestTotalAmount totalAmount; + private com.sumup.sdk.models.readers.checkouts.CreateReaderCheckoutRequestTotalAmount + totalAmount; private Builder() {} @@ -97,7 +99,8 @@ private Builder() {} * transaction with the AADE signature provider. * @return This builder instance. */ - public Builder aade(com.sumup.sdk.models.CreateReaderCheckoutRequestAade aade) { + public Builder aade( + com.sumup.sdk.models.readers.checkouts.CreateReaderCheckoutRequestAade aade) { this.aade = aade; return this; } @@ -109,7 +112,7 @@ public Builder aade(com.sumup.sdk.models.CreateReaderCheckoutRequestAade aade) { * both `app_id` and `key` when including this object. * @return This builder instance. */ - public Builder affiliate(com.sumup.sdk.models.Affiliate2 affiliate) { + public Builder affiliate(com.sumup.sdk.models.readers.checkouts.Affiliate2 affiliate) { this.affiliate = affiliate; return this; } @@ -121,7 +124,8 @@ public Builder affiliate(com.sumup.sdk.models.Affiliate2 affiliate) { * some countries (e.g: Brazil). * @return This builder instance. */ - public Builder cardType(com.sumup.sdk.models.CreateReaderCheckoutRequestCardType cardType) { + public Builder cardType( + com.sumup.sdk.models.readers.checkouts.CreateReaderCheckoutRequestCardType cardType) { this.cardType = cardType; return this; } @@ -160,7 +164,7 @@ public Builder installments(Long installments) { * @return This builder instance. */ public Builder paymentType( - com.sumup.sdk.models.CreateReaderCheckoutRequestPaymentType paymentType) { + com.sumup.sdk.models.readers.checkouts.CreateReaderCheckoutRequestPaymentType paymentType) { this.paymentType = paymentType; return this; } @@ -212,7 +216,7 @@ public Builder tipTimeout(Long tipTimeout) { * @return This builder instance. */ public Builder totalAmount( - com.sumup.sdk.models.CreateReaderCheckoutRequestTotalAmount totalAmount) { + com.sumup.sdk.models.readers.checkouts.CreateReaderCheckoutRequestTotalAmount totalAmount) { this.totalAmount = totalAmount; return this; } diff --git a/src/main/java/com/sumup/sdk/models/CreateReaderCheckoutRequestAade.java b/src/main/java/com/sumup/sdk/models/readers/checkouts/CreateReaderCheckoutRequestAade.java similarity index 98% rename from src/main/java/com/sumup/sdk/models/CreateReaderCheckoutRequestAade.java rename to src/main/java/com/sumup/sdk/models/readers/checkouts/CreateReaderCheckoutRequestAade.java index 3b648db3..ee45f723 100644 --- a/src/main/java/com/sumup/sdk/models/CreateReaderCheckoutRequestAade.java +++ b/src/main/java/com/sumup/sdk/models/readers/checkouts/CreateReaderCheckoutRequestAade.java @@ -1,5 +1,5 @@ // Code generated by sumup-java/codegen. DO NOT EDIT. -package com.sumup.sdk.models; +package com.sumup.sdk.models.readers.checkouts; import java.util.Objects; diff --git a/src/main/java/com/sumup/sdk/models/CreateReaderCheckoutRequestCardType.java b/src/main/java/com/sumup/sdk/models/readers/checkouts/CreateReaderCheckoutRequestCardType.java similarity index 97% rename from src/main/java/com/sumup/sdk/models/CreateReaderCheckoutRequestCardType.java rename to src/main/java/com/sumup/sdk/models/readers/checkouts/CreateReaderCheckoutRequestCardType.java index d1013c7b..4423a7f4 100644 --- a/src/main/java/com/sumup/sdk/models/CreateReaderCheckoutRequestCardType.java +++ b/src/main/java/com/sumup/sdk/models/readers/checkouts/CreateReaderCheckoutRequestCardType.java @@ -1,5 +1,5 @@ // Code generated by sumup-java/codegen. DO NOT EDIT. -package com.sumup.sdk.models; +package com.sumup.sdk.models.readers.checkouts; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; diff --git a/src/main/java/com/sumup/sdk/models/CreateReaderCheckoutRequestPaymentType.java b/src/main/java/com/sumup/sdk/models/readers/checkouts/CreateReaderCheckoutRequestPaymentType.java similarity index 97% rename from src/main/java/com/sumup/sdk/models/CreateReaderCheckoutRequestPaymentType.java rename to src/main/java/com/sumup/sdk/models/readers/checkouts/CreateReaderCheckoutRequestPaymentType.java index 620d3a97..d544f1bc 100644 --- a/src/main/java/com/sumup/sdk/models/CreateReaderCheckoutRequestPaymentType.java +++ b/src/main/java/com/sumup/sdk/models/readers/checkouts/CreateReaderCheckoutRequestPaymentType.java @@ -1,5 +1,5 @@ // Code generated by sumup-java/codegen. DO NOT EDIT. -package com.sumup.sdk.models; +package com.sumup.sdk.models.readers.checkouts; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; diff --git a/src/main/java/com/sumup/sdk/models/CreateReaderCheckoutRequestTotalAmount.java b/src/main/java/com/sumup/sdk/models/readers/checkouts/CreateReaderCheckoutRequestTotalAmount.java similarity index 97% rename from src/main/java/com/sumup/sdk/models/CreateReaderCheckoutRequestTotalAmount.java rename to src/main/java/com/sumup/sdk/models/readers/checkouts/CreateReaderCheckoutRequestTotalAmount.java index 0c6452c5..504f6418 100644 --- a/src/main/java/com/sumup/sdk/models/CreateReaderCheckoutRequestTotalAmount.java +++ b/src/main/java/com/sumup/sdk/models/readers/checkouts/CreateReaderCheckoutRequestTotalAmount.java @@ -1,5 +1,5 @@ // Code generated by sumup-java/codegen. DO NOT EDIT. -package com.sumup.sdk.models; +package com.sumup.sdk.models.readers.checkouts; import java.util.Objects; diff --git a/src/main/java/com/sumup/sdk/models/CreateReaderCheckoutResponse.java b/src/main/java/com/sumup/sdk/models/readers/checkouts/CreateReaderCheckoutResponse.java similarity index 74% rename from src/main/java/com/sumup/sdk/models/CreateReaderCheckoutResponse.java rename to src/main/java/com/sumup/sdk/models/readers/checkouts/CreateReaderCheckoutResponse.java index 5ed77e29..0978780c 100644 --- a/src/main/java/com/sumup/sdk/models/CreateReaderCheckoutResponse.java +++ b/src/main/java/com/sumup/sdk/models/readers/checkouts/CreateReaderCheckoutResponse.java @@ -1,10 +1,10 @@ // Code generated by sumup-java/codegen. DO NOT EDIT. -package com.sumup.sdk.models; +package com.sumup.sdk.models.readers.checkouts; import java.util.Objects; public record CreateReaderCheckoutResponse( - com.sumup.sdk.models.CreateReaderCheckoutResponseData data) { + com.sumup.sdk.models.readers.checkouts.CreateReaderCheckoutResponseData data) { /** * Creates a builder for CreateReaderCheckoutResponse. * @@ -16,7 +16,7 @@ public static Builder builder() { /** Builder for CreateReaderCheckoutResponse instances. */ public static final class Builder { - private com.sumup.sdk.models.CreateReaderCheckoutResponseData data; + private com.sumup.sdk.models.readers.checkouts.CreateReaderCheckoutResponseData data; private Builder() {} @@ -26,7 +26,8 @@ private Builder() {} * @param data Value for the data field. * @return This builder instance. */ - public Builder data(com.sumup.sdk.models.CreateReaderCheckoutResponseData data) { + public Builder data( + com.sumup.sdk.models.readers.checkouts.CreateReaderCheckoutResponseData data) { this.data = data; return this; } diff --git a/src/main/java/com/sumup/sdk/models/CreateReaderCheckoutResponseData.java b/src/main/java/com/sumup/sdk/models/readers/checkouts/CreateReaderCheckoutResponseData.java similarity index 97% rename from src/main/java/com/sumup/sdk/models/CreateReaderCheckoutResponseData.java rename to src/main/java/com/sumup/sdk/models/readers/checkouts/CreateReaderCheckoutResponseData.java index d6971f42..c251a44c 100644 --- a/src/main/java/com/sumup/sdk/models/CreateReaderCheckoutResponseData.java +++ b/src/main/java/com/sumup/sdk/models/readers/checkouts/CreateReaderCheckoutResponseData.java @@ -1,5 +1,5 @@ // Code generated by sumup-java/codegen. DO NOT EDIT. -package com.sumup.sdk.models; +package com.sumup.sdk.models.readers.checkouts; import java.util.Objects; diff --git a/src/main/java/com/sumup/sdk/models/CreateReaderCheckoutUnprocessableEntity.java b/src/main/java/com/sumup/sdk/models/readers/checkouts/CreateReaderCheckoutUnprocessableEntity.java similarity index 96% rename from src/main/java/com/sumup/sdk/models/CreateReaderCheckoutUnprocessableEntity.java rename to src/main/java/com/sumup/sdk/models/readers/checkouts/CreateReaderCheckoutUnprocessableEntity.java index 944afc84..469769f2 100644 --- a/src/main/java/com/sumup/sdk/models/CreateReaderCheckoutUnprocessableEntity.java +++ b/src/main/java/com/sumup/sdk/models/readers/checkouts/CreateReaderCheckoutUnprocessableEntity.java @@ -1,5 +1,5 @@ // Code generated by sumup-java/codegen. DO NOT EDIT. -package com.sumup.sdk.models; +package com.sumup.sdk.models.readers.checkouts; import java.util.Objects; diff --git a/src/main/java/com/sumup/sdk/models/CreateReaderTerminateError.java b/src/main/java/com/sumup/sdk/models/readers/checkouts/CreateReaderTerminateError.java similarity index 76% rename from src/main/java/com/sumup/sdk/models/CreateReaderTerminateError.java rename to src/main/java/com/sumup/sdk/models/readers/checkouts/CreateReaderTerminateError.java index 525c9fc4..c3847385 100644 --- a/src/main/java/com/sumup/sdk/models/CreateReaderTerminateError.java +++ b/src/main/java/com/sumup/sdk/models/readers/checkouts/CreateReaderTerminateError.java @@ -1,11 +1,11 @@ // Code generated by sumup-java/codegen. DO NOT EDIT. -package com.sumup.sdk.models; +package com.sumup.sdk.models.readers.checkouts; import java.util.Objects; /** Error description */ public record CreateReaderTerminateError( - com.sumup.sdk.models.CreateReaderTerminateErrorErrors errors) { + com.sumup.sdk.models.readers.checkouts.CreateReaderTerminateErrorErrors errors) { /** * Creates a builder for CreateReaderTerminateError. * @@ -17,7 +17,7 @@ public static Builder builder() { /** Builder for CreateReaderTerminateError instances. */ public static final class Builder { - private com.sumup.sdk.models.CreateReaderTerminateErrorErrors errors; + private com.sumup.sdk.models.readers.checkouts.CreateReaderTerminateErrorErrors errors; private Builder() {} @@ -27,7 +27,8 @@ private Builder() {} * @param errors Value for the errors field. * @return This builder instance. */ - public Builder errors(com.sumup.sdk.models.CreateReaderTerminateErrorErrors errors) { + public Builder errors( + com.sumup.sdk.models.readers.checkouts.CreateReaderTerminateErrorErrors errors) { this.errors = errors; return this; } diff --git a/src/main/java/com/sumup/sdk/models/CreateReaderTerminateErrorErrors.java b/src/main/java/com/sumup/sdk/models/readers/checkouts/CreateReaderTerminateErrorErrors.java similarity index 96% rename from src/main/java/com/sumup/sdk/models/CreateReaderTerminateErrorErrors.java rename to src/main/java/com/sumup/sdk/models/readers/checkouts/CreateReaderTerminateErrorErrors.java index a38b666e..1bf1cf67 100644 --- a/src/main/java/com/sumup/sdk/models/CreateReaderTerminateErrorErrors.java +++ b/src/main/java/com/sumup/sdk/models/readers/checkouts/CreateReaderTerminateErrorErrors.java @@ -1,5 +1,5 @@ // Code generated by sumup-java/codegen. DO NOT EDIT. -package com.sumup.sdk.models; +package com.sumup.sdk.models.readers.checkouts; import java.util.Objects; diff --git a/src/main/java/com/sumup/sdk/models/CreateReaderTerminateUnprocessableEntity.java b/src/main/java/com/sumup/sdk/models/readers/checkouts/CreateReaderTerminateUnprocessableEntity.java similarity index 96% rename from src/main/java/com/sumup/sdk/models/CreateReaderTerminateUnprocessableEntity.java rename to src/main/java/com/sumup/sdk/models/readers/checkouts/CreateReaderTerminateUnprocessableEntity.java index d5aac4be..5fd2e14c 100644 --- a/src/main/java/com/sumup/sdk/models/CreateReaderTerminateUnprocessableEntity.java +++ b/src/main/java/com/sumup/sdk/models/readers/checkouts/CreateReaderTerminateUnprocessableEntity.java @@ -1,5 +1,5 @@ // Code generated by sumup-java/codegen. DO NOT EDIT. -package com.sumup.sdk.models; +package com.sumup.sdk.models.readers.checkouts; import java.util.Objects; diff --git a/src/main/java/com/sumup/sdk/models/GetReaderCheckoutResponse.java b/src/main/java/com/sumup/sdk/models/readers/checkouts/GetReaderCheckoutResponse.java similarity index 71% rename from src/main/java/com/sumup/sdk/models/GetReaderCheckoutResponse.java rename to src/main/java/com/sumup/sdk/models/readers/checkouts/GetReaderCheckoutResponse.java index ff179f14..1c00f32b 100644 --- a/src/main/java/com/sumup/sdk/models/GetReaderCheckoutResponse.java +++ b/src/main/java/com/sumup/sdk/models/readers/checkouts/GetReaderCheckoutResponse.java @@ -1,9 +1,10 @@ // Code generated by sumup-java/codegen. DO NOT EDIT. -package com.sumup.sdk.models; +package com.sumup.sdk.models.readers.checkouts; import java.util.Objects; -public record GetReaderCheckoutResponse(com.sumup.sdk.models.GetReaderCheckoutResponseData data) { +public record GetReaderCheckoutResponse( + com.sumup.sdk.models.readers.checkouts.GetReaderCheckoutResponseData data) { /** * Creates a builder for GetReaderCheckoutResponse. * @@ -15,7 +16,7 @@ public static Builder builder() { /** Builder for GetReaderCheckoutResponse instances. */ public static final class Builder { - private com.sumup.sdk.models.GetReaderCheckoutResponseData data; + private com.sumup.sdk.models.readers.checkouts.GetReaderCheckoutResponseData data; private Builder() {} @@ -25,7 +26,7 @@ private Builder() {} * @param data Value for the data field. * @return This builder instance. */ - public Builder data(com.sumup.sdk.models.GetReaderCheckoutResponseData data) { + public Builder data(com.sumup.sdk.models.readers.checkouts.GetReaderCheckoutResponseData data) { this.data = data; return this; } diff --git a/src/main/java/com/sumup/sdk/models/GetReaderCheckoutResponseData.java b/src/main/java/com/sumup/sdk/models/readers/checkouts/GetReaderCheckoutResponseData.java similarity index 85% rename from src/main/java/com/sumup/sdk/models/GetReaderCheckoutResponseData.java rename to src/main/java/com/sumup/sdk/models/readers/checkouts/GetReaderCheckoutResponseData.java index a55ad4c3..63f88164 100644 --- a/src/main/java/com/sumup/sdk/models/GetReaderCheckoutResponseData.java +++ b/src/main/java/com/sumup/sdk/models/readers/checkouts/GetReaderCheckoutResponseData.java @@ -1,11 +1,11 @@ // Code generated by sumup-java/codegen. DO NOT EDIT. -package com.sumup.sdk.models; +package com.sumup.sdk.models.readers.checkouts; import java.util.Objects; public record GetReaderCheckoutResponseData( /** Type of the card, or null when no card type was specified. */ - com.sumup.sdk.models.GetReaderCheckoutResponseDataCardType cardType, + com.sumup.sdk.models.readers.checkouts.GetReaderCheckoutResponseDataCardType cardType, /** Unique identifier for the checkout */ java.util.UUID checkoutId, @@ -26,7 +26,7 @@ public record GetReaderCheckoutResponseData( String paymentStatus, /** Type of the payment. Required for some countries */ - com.sumup.sdk.models.GetReaderCheckoutResponseDataPaymentType paymentType, + com.sumup.sdk.models.readers.checkouts.GetReaderCheckoutResponseDataPaymentType paymentType, /** Reader firmware version */ String readerFirmwareVersion, @@ -35,14 +35,14 @@ public record GetReaderCheckoutResponseData( String readerSerialNumber, /** Current status of the checkout */ - com.sumup.sdk.models.GetReaderCheckoutResponseDataStatus status, + com.sumup.sdk.models.readers.checkouts.GetReaderCheckoutResponseDataStatus status, /** * The checkout amount. The value uses two decimal places, even for currencies such as CLP that * use zero decimal places in the create request. For example, EUR 10.00 is returned as `1000` * and CLP 1000 as `100000`. */ - com.sumup.sdk.models.GetReaderCheckoutResponseDataTotalAmount totalAmount, + com.sumup.sdk.models.readers.checkouts.GetReaderCheckoutResponseDataTotalAmount totalAmount, /** Checkout last update timestamp */ java.time.OffsetDateTime updatedAt, @@ -62,18 +62,20 @@ public static Builder builder() { /** Builder for GetReaderCheckoutResponseData instances. */ public static final class Builder { - private com.sumup.sdk.models.GetReaderCheckoutResponseDataCardType cardType; + private com.sumup.sdk.models.readers.checkouts.GetReaderCheckoutResponseDataCardType cardType; private java.util.UUID checkoutId; private String clientTransactionId; private java.time.OffsetDateTime createdAt; private Long installments; private String paymentFailureReason; private String paymentStatus; - private com.sumup.sdk.models.GetReaderCheckoutResponseDataPaymentType paymentType; + private com.sumup.sdk.models.readers.checkouts.GetReaderCheckoutResponseDataPaymentType + paymentType; private String readerFirmwareVersion; private String readerSerialNumber; - private com.sumup.sdk.models.GetReaderCheckoutResponseDataStatus status; - private com.sumup.sdk.models.GetReaderCheckoutResponseDataTotalAmount totalAmount; + private com.sumup.sdk.models.readers.checkouts.GetReaderCheckoutResponseDataStatus status; + private com.sumup.sdk.models.readers.checkouts.GetReaderCheckoutResponseDataTotalAmount + totalAmount; private java.time.OffsetDateTime updatedAt; private java.time.OffsetDateTime validUntil; @@ -85,7 +87,8 @@ private Builder() {} * @param cardType Type of the card, or null when no card type was specified. * @return This builder instance. */ - public Builder cardType(com.sumup.sdk.models.GetReaderCheckoutResponseDataCardType cardType) { + public Builder cardType( + com.sumup.sdk.models.readers.checkouts.GetReaderCheckoutResponseDataCardType cardType) { this.cardType = cardType; return this; } @@ -164,7 +167,8 @@ public Builder paymentStatus(String paymentStatus) { * @return This builder instance. */ public Builder paymentType( - com.sumup.sdk.models.GetReaderCheckoutResponseDataPaymentType paymentType) { + com.sumup.sdk.models.readers.checkouts.GetReaderCheckoutResponseDataPaymentType + paymentType) { this.paymentType = paymentType; return this; } @@ -197,7 +201,8 @@ public Builder readerSerialNumber(String readerSerialNumber) { * @param status Current status of the checkout * @return This builder instance. */ - public Builder status(com.sumup.sdk.models.GetReaderCheckoutResponseDataStatus status) { + public Builder status( + com.sumup.sdk.models.readers.checkouts.GetReaderCheckoutResponseDataStatus status) { this.status = status; return this; } @@ -211,7 +216,8 @@ public Builder status(com.sumup.sdk.models.GetReaderCheckoutResponseDataStatus s * @return This builder instance. */ public Builder totalAmount( - com.sumup.sdk.models.GetReaderCheckoutResponseDataTotalAmount totalAmount) { + com.sumup.sdk.models.readers.checkouts.GetReaderCheckoutResponseDataTotalAmount + totalAmount) { this.totalAmount = totalAmount; return this; } diff --git a/src/main/java/com/sumup/sdk/models/GetReaderCheckoutResponseDataCardType.java b/src/main/java/com/sumup/sdk/models/readers/checkouts/GetReaderCheckoutResponseDataCardType.java similarity index 97% rename from src/main/java/com/sumup/sdk/models/GetReaderCheckoutResponseDataCardType.java rename to src/main/java/com/sumup/sdk/models/readers/checkouts/GetReaderCheckoutResponseDataCardType.java index fe078085..4befca7a 100644 --- a/src/main/java/com/sumup/sdk/models/GetReaderCheckoutResponseDataCardType.java +++ b/src/main/java/com/sumup/sdk/models/readers/checkouts/GetReaderCheckoutResponseDataCardType.java @@ -1,5 +1,5 @@ // Code generated by sumup-java/codegen. DO NOT EDIT. -package com.sumup.sdk.models; +package com.sumup.sdk.models.readers.checkouts; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; diff --git a/src/main/java/com/sumup/sdk/models/GetReaderCheckoutResponseDataPaymentType.java b/src/main/java/com/sumup/sdk/models/readers/checkouts/GetReaderCheckoutResponseDataPaymentType.java similarity index 97% rename from src/main/java/com/sumup/sdk/models/GetReaderCheckoutResponseDataPaymentType.java rename to src/main/java/com/sumup/sdk/models/readers/checkouts/GetReaderCheckoutResponseDataPaymentType.java index 459ba1d1..4186bb5c 100644 --- a/src/main/java/com/sumup/sdk/models/GetReaderCheckoutResponseDataPaymentType.java +++ b/src/main/java/com/sumup/sdk/models/readers/checkouts/GetReaderCheckoutResponseDataPaymentType.java @@ -1,5 +1,5 @@ // Code generated by sumup-java/codegen. DO NOT EDIT. -package com.sumup.sdk.models; +package com.sumup.sdk.models.readers.checkouts; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; diff --git a/src/main/java/com/sumup/sdk/models/GetReaderCheckoutResponseDataStatus.java b/src/main/java/com/sumup/sdk/models/readers/checkouts/GetReaderCheckoutResponseDataStatus.java similarity index 97% rename from src/main/java/com/sumup/sdk/models/GetReaderCheckoutResponseDataStatus.java rename to src/main/java/com/sumup/sdk/models/readers/checkouts/GetReaderCheckoutResponseDataStatus.java index bcc0254a..8bf648b4 100644 --- a/src/main/java/com/sumup/sdk/models/GetReaderCheckoutResponseDataStatus.java +++ b/src/main/java/com/sumup/sdk/models/readers/checkouts/GetReaderCheckoutResponseDataStatus.java @@ -1,5 +1,5 @@ // Code generated by sumup-java/codegen. DO NOT EDIT. -package com.sumup.sdk.models; +package com.sumup.sdk.models.readers.checkouts; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; diff --git a/src/main/java/com/sumup/sdk/models/GetReaderCheckoutResponseDataTotalAmount.java b/src/main/java/com/sumup/sdk/models/readers/checkouts/GetReaderCheckoutResponseDataTotalAmount.java similarity index 97% rename from src/main/java/com/sumup/sdk/models/GetReaderCheckoutResponseDataTotalAmount.java rename to src/main/java/com/sumup/sdk/models/readers/checkouts/GetReaderCheckoutResponseDataTotalAmount.java index 3eafdd4d..536ee6bf 100644 --- a/src/main/java/com/sumup/sdk/models/GetReaderCheckoutResponseDataTotalAmount.java +++ b/src/main/java/com/sumup/sdk/models/readers/checkouts/GetReaderCheckoutResponseDataTotalAmount.java @@ -1,5 +1,5 @@ // Code generated by sumup-java/codegen. DO NOT EDIT. -package com.sumup.sdk.models; +package com.sumup.sdk.models.readers.checkouts; import java.util.Objects; diff --git a/src/main/java/com/sumup/sdk/models/GetReaderSettingsResponse.java b/src/main/java/com/sumup/sdk/models/readers/settings/GetReaderSettingsResponse.java similarity index 73% rename from src/main/java/com/sumup/sdk/models/GetReaderSettingsResponse.java rename to src/main/java/com/sumup/sdk/models/readers/settings/GetReaderSettingsResponse.java index e6869201..a5eb1f0d 100644 --- a/src/main/java/com/sumup/sdk/models/GetReaderSettingsResponse.java +++ b/src/main/java/com/sumup/sdk/models/readers/settings/GetReaderSettingsResponse.java @@ -1,10 +1,11 @@ // Code generated by sumup-java/codegen. DO NOT EDIT. -package com.sumup.sdk.models; +package com.sumup.sdk.models.readers.settings; import java.util.Objects; /** Menu lock settings reported by the reader, or the last saved settings when offline. */ -public record GetReaderSettingsResponse(com.sumup.sdk.models.GetReaderSettingsResponseData data) { +public record GetReaderSettingsResponse( + com.sumup.sdk.models.readers.settings.GetReaderSettingsResponseData data) { /** * Creates a builder for GetReaderSettingsResponse. * @@ -16,7 +17,7 @@ public static Builder builder() { /** Builder for GetReaderSettingsResponse instances. */ public static final class Builder { - private com.sumup.sdk.models.GetReaderSettingsResponseData data; + private com.sumup.sdk.models.readers.settings.GetReaderSettingsResponseData data; private Builder() {} @@ -26,7 +27,7 @@ private Builder() {} * @param data Value for the data field. * @return This builder instance. */ - public Builder data(com.sumup.sdk.models.GetReaderSettingsResponseData data) { + public Builder data(com.sumup.sdk.models.readers.settings.GetReaderSettingsResponseData data) { this.data = data; return this; } diff --git a/src/main/java/com/sumup/sdk/models/GetReaderSettingsResponseData.java b/src/main/java/com/sumup/sdk/models/readers/settings/GetReaderSettingsResponseData.java similarity index 75% rename from src/main/java/com/sumup/sdk/models/GetReaderSettingsResponseData.java rename to src/main/java/com/sumup/sdk/models/readers/settings/GetReaderSettingsResponseData.java index d1a43dab..42af3129 100644 --- a/src/main/java/com/sumup/sdk/models/GetReaderSettingsResponseData.java +++ b/src/main/java/com/sumup/sdk/models/readers/settings/GetReaderSettingsResponseData.java @@ -1,11 +1,11 @@ // Code generated by sumup-java/codegen. DO NOT EDIT. -package com.sumup.sdk.models; +package com.sumup.sdk.models.readers.settings; import java.util.Objects; public record GetReaderSettingsResponseData( /** Menu lock configuration. Fields may be absent if no value is available. */ - com.sumup.sdk.models.GetReaderSettingsResponseDataMenuLock menuLock) { + com.sumup.sdk.models.readers.settings.GetReaderSettingsResponseDataMenuLock menuLock) { /** * Creates a builder for GetReaderSettingsResponseData. * @@ -17,7 +17,7 @@ public static Builder builder() { /** Builder for GetReaderSettingsResponseData instances. */ public static final class Builder { - private com.sumup.sdk.models.GetReaderSettingsResponseDataMenuLock menuLock; + private com.sumup.sdk.models.readers.settings.GetReaderSettingsResponseDataMenuLock menuLock; private Builder() {} @@ -27,7 +27,8 @@ private Builder() {} * @param menuLock Menu lock configuration. Fields may be absent if no value is available. * @return This builder instance. */ - public Builder menuLock(com.sumup.sdk.models.GetReaderSettingsResponseDataMenuLock menuLock) { + public Builder menuLock( + com.sumup.sdk.models.readers.settings.GetReaderSettingsResponseDataMenuLock menuLock) { this.menuLock = menuLock; return this; } diff --git a/src/main/java/com/sumup/sdk/models/GetReaderSettingsResponseDataMenuLock.java b/src/main/java/com/sumup/sdk/models/readers/settings/GetReaderSettingsResponseDataMenuLock.java similarity index 97% rename from src/main/java/com/sumup/sdk/models/GetReaderSettingsResponseDataMenuLock.java rename to src/main/java/com/sumup/sdk/models/readers/settings/GetReaderSettingsResponseDataMenuLock.java index f021646e..ceda6000 100644 --- a/src/main/java/com/sumup/sdk/models/GetReaderSettingsResponseDataMenuLock.java +++ b/src/main/java/com/sumup/sdk/models/readers/settings/GetReaderSettingsResponseDataMenuLock.java @@ -1,5 +1,5 @@ // Code generated by sumup-java/codegen. DO NOT EDIT. -package com.sumup.sdk.models; +package com.sumup.sdk.models.readers.settings; /** Menu lock configuration. Fields may be absent if no value is available. */ public record GetReaderSettingsResponseDataMenuLock( diff --git a/src/main/java/com/sumup/sdk/models/UpdateReaderSettingsError.java b/src/main/java/com/sumup/sdk/models/readers/settings/UpdateReaderSettingsError.java similarity index 75% rename from src/main/java/com/sumup/sdk/models/UpdateReaderSettingsError.java rename to src/main/java/com/sumup/sdk/models/readers/settings/UpdateReaderSettingsError.java index 0a293fe2..63685fe2 100644 --- a/src/main/java/com/sumup/sdk/models/UpdateReaderSettingsError.java +++ b/src/main/java/com/sumup/sdk/models/readers/settings/UpdateReaderSettingsError.java @@ -1,11 +1,11 @@ // Code generated by sumup-java/codegen. DO NOT EDIT. -package com.sumup.sdk.models; +package com.sumup.sdk.models.readers.settings; import java.util.Objects; /** Details of a failed reader settings request. */ public record UpdateReaderSettingsError( - com.sumup.sdk.models.UpdateReaderSettingsErrorErrors errors) { + com.sumup.sdk.models.readers.settings.UpdateReaderSettingsErrorErrors errors) { /** * Creates a builder for UpdateReaderSettingsError. * @@ -17,7 +17,7 @@ public static Builder builder() { /** Builder for UpdateReaderSettingsError instances. */ public static final class Builder { - private com.sumup.sdk.models.UpdateReaderSettingsErrorErrors errors; + private com.sumup.sdk.models.readers.settings.UpdateReaderSettingsErrorErrors errors; private Builder() {} @@ -27,7 +27,8 @@ private Builder() {} * @param errors Value for the errors field. * @return This builder instance. */ - public Builder errors(com.sumup.sdk.models.UpdateReaderSettingsErrorErrors errors) { + public Builder errors( + com.sumup.sdk.models.readers.settings.UpdateReaderSettingsErrorErrors errors) { this.errors = errors; return this; } diff --git a/src/main/java/com/sumup/sdk/models/UpdateReaderSettingsErrorErrors.java b/src/main/java/com/sumup/sdk/models/readers/settings/UpdateReaderSettingsErrorErrors.java similarity index 96% rename from src/main/java/com/sumup/sdk/models/UpdateReaderSettingsErrorErrors.java rename to src/main/java/com/sumup/sdk/models/readers/settings/UpdateReaderSettingsErrorErrors.java index 162a502e..72d9c680 100644 --- a/src/main/java/com/sumup/sdk/models/UpdateReaderSettingsErrorErrors.java +++ b/src/main/java/com/sumup/sdk/models/readers/settings/UpdateReaderSettingsErrorErrors.java @@ -1,5 +1,5 @@ // Code generated by sumup-java/codegen. DO NOT EDIT. -package com.sumup.sdk.models; +package com.sumup.sdk.models.readers.settings; import java.util.Objects; diff --git a/src/main/java/com/sumup/sdk/models/UpdateReaderSettingsRequest.java b/src/main/java/com/sumup/sdk/models/readers/settings/UpdateReaderSettingsRequest.java similarity index 76% rename from src/main/java/com/sumup/sdk/models/UpdateReaderSettingsRequest.java rename to src/main/java/com/sumup/sdk/models/readers/settings/UpdateReaderSettingsRequest.java index 7516599d..20d39937 100644 --- a/src/main/java/com/sumup/sdk/models/UpdateReaderSettingsRequest.java +++ b/src/main/java/com/sumup/sdk/models/readers/settings/UpdateReaderSettingsRequest.java @@ -1,12 +1,12 @@ // Code generated by sumup-java/codegen. DO NOT EDIT. -package com.sumup.sdk.models; +package com.sumup.sdk.models.readers.settings; import java.util.Objects; /** Menu lock settings to update for a Solo reader. */ public record UpdateReaderSettingsRequest( /** Menu lock configuration. Provide at least one of `enabled` or `passcode`. */ - com.sumup.sdk.models.UpdateReaderSettingsRequestMenuLock menuLock) { + com.sumup.sdk.models.readers.settings.UpdateReaderSettingsRequestMenuLock menuLock) { /** * Creates a builder for UpdateReaderSettingsRequest. * @@ -18,7 +18,7 @@ public static Builder builder() { /** Builder for UpdateReaderSettingsRequest instances. */ public static final class Builder { - private com.sumup.sdk.models.UpdateReaderSettingsRequestMenuLock menuLock; + private com.sumup.sdk.models.readers.settings.UpdateReaderSettingsRequestMenuLock menuLock; private Builder() {} @@ -28,7 +28,8 @@ private Builder() {} * @param menuLock Menu lock configuration. Provide at least one of `enabled` or `passcode`. * @return This builder instance. */ - public Builder menuLock(com.sumup.sdk.models.UpdateReaderSettingsRequestMenuLock menuLock) { + public Builder menuLock( + com.sumup.sdk.models.readers.settings.UpdateReaderSettingsRequestMenuLock menuLock) { this.menuLock = menuLock; return this; } diff --git a/src/main/java/com/sumup/sdk/models/UpdateReaderSettingsRequestMenuLock.java b/src/main/java/com/sumup/sdk/models/readers/settings/UpdateReaderSettingsRequestMenuLock.java similarity index 97% rename from src/main/java/com/sumup/sdk/models/UpdateReaderSettingsRequestMenuLock.java rename to src/main/java/com/sumup/sdk/models/readers/settings/UpdateReaderSettingsRequestMenuLock.java index d654a178..890b1772 100644 --- a/src/main/java/com/sumup/sdk/models/UpdateReaderSettingsRequestMenuLock.java +++ b/src/main/java/com/sumup/sdk/models/readers/settings/UpdateReaderSettingsRequestMenuLock.java @@ -1,5 +1,5 @@ // Code generated by sumup-java/codegen. DO NOT EDIT. -package com.sumup.sdk.models; +package com.sumup.sdk.models.readers.settings; /** Menu lock configuration. Provide at least one of `enabled` or `passcode`. */ public record UpdateReaderSettingsRequestMenuLock( diff --git a/src/main/java/com/sumup/sdk/models/UpdateReaderSettingsResponse.java b/src/main/java/com/sumup/sdk/models/readers/settings/UpdateReaderSettingsResponse.java similarity index 75% rename from src/main/java/com/sumup/sdk/models/UpdateReaderSettingsResponse.java rename to src/main/java/com/sumup/sdk/models/readers/settings/UpdateReaderSettingsResponse.java index 8bded5e2..7299727c 100644 --- a/src/main/java/com/sumup/sdk/models/UpdateReaderSettingsResponse.java +++ b/src/main/java/com/sumup/sdk/models/readers/settings/UpdateReaderSettingsResponse.java @@ -1,11 +1,11 @@ // Code generated by sumup-java/codegen. DO NOT EDIT. -package com.sumup.sdk.models; +package com.sumup.sdk.models.readers.settings; import java.util.Objects; /** Menu lock settings applied to the reader. */ public record UpdateReaderSettingsResponse( - com.sumup.sdk.models.UpdateReaderSettingsResponseData data) { + com.sumup.sdk.models.readers.settings.UpdateReaderSettingsResponseData data) { /** * Creates a builder for UpdateReaderSettingsResponse. * @@ -17,7 +17,7 @@ public static Builder builder() { /** Builder for UpdateReaderSettingsResponse instances. */ public static final class Builder { - private com.sumup.sdk.models.UpdateReaderSettingsResponseData data; + private com.sumup.sdk.models.readers.settings.UpdateReaderSettingsResponseData data; private Builder() {} @@ -27,7 +27,8 @@ private Builder() {} * @param data Value for the data field. * @return This builder instance. */ - public Builder data(com.sumup.sdk.models.UpdateReaderSettingsResponseData data) { + public Builder data( + com.sumup.sdk.models.readers.settings.UpdateReaderSettingsResponseData data) { this.data = data; return this; } diff --git a/src/main/java/com/sumup/sdk/models/UpdateReaderSettingsResponseData.java b/src/main/java/com/sumup/sdk/models/readers/settings/UpdateReaderSettingsResponseData.java similarity index 70% rename from src/main/java/com/sumup/sdk/models/UpdateReaderSettingsResponseData.java rename to src/main/java/com/sumup/sdk/models/readers/settings/UpdateReaderSettingsResponseData.java index 75c9346c..3584cc25 100644 --- a/src/main/java/com/sumup/sdk/models/UpdateReaderSettingsResponseData.java +++ b/src/main/java/com/sumup/sdk/models/readers/settings/UpdateReaderSettingsResponseData.java @@ -1,14 +1,14 @@ // Code generated by sumup-java/codegen. DO NOT EDIT. -package com.sumup.sdk.models; +package com.sumup.sdk.models.readers.settings; import java.util.Objects; public record UpdateReaderSettingsResponseData( /** Settings included in the update. Omitted fields are not returned. */ - com.sumup.sdk.models.UpdateReaderSettingsResponseDataMenuLock menuLock, + com.sumup.sdk.models.readers.settings.UpdateReaderSettingsResponseDataMenuLock menuLock, /** Indicates that the reader applied the settings update. */ - com.sumup.sdk.models.UpdateReaderSettingsResponseDataStatus status) { + com.sumup.sdk.models.readers.settings.UpdateReaderSettingsResponseDataStatus status) { /** * Creates a builder for UpdateReaderSettingsResponseData. * @@ -20,8 +20,8 @@ public static Builder builder() { /** Builder for UpdateReaderSettingsResponseData instances. */ public static final class Builder { - private com.sumup.sdk.models.UpdateReaderSettingsResponseDataMenuLock menuLock; - private com.sumup.sdk.models.UpdateReaderSettingsResponseDataStatus status; + private com.sumup.sdk.models.readers.settings.UpdateReaderSettingsResponseDataMenuLock menuLock; + private com.sumup.sdk.models.readers.settings.UpdateReaderSettingsResponseDataStatus status; private Builder() {} @@ -32,7 +32,7 @@ private Builder() {} * @return This builder instance. */ public Builder menuLock( - com.sumup.sdk.models.UpdateReaderSettingsResponseDataMenuLock menuLock) { + com.sumup.sdk.models.readers.settings.UpdateReaderSettingsResponseDataMenuLock menuLock) { this.menuLock = menuLock; return this; } @@ -43,7 +43,8 @@ public Builder menuLock( * @param status Indicates that the reader applied the settings update. * @return This builder instance. */ - public Builder status(com.sumup.sdk.models.UpdateReaderSettingsResponseDataStatus status) { + public Builder status( + com.sumup.sdk.models.readers.settings.UpdateReaderSettingsResponseDataStatus status) { this.status = status; return this; } diff --git a/src/main/java/com/sumup/sdk/models/UpdateReaderSettingsResponseDataMenuLock.java b/src/main/java/com/sumup/sdk/models/readers/settings/UpdateReaderSettingsResponseDataMenuLock.java similarity index 97% rename from src/main/java/com/sumup/sdk/models/UpdateReaderSettingsResponseDataMenuLock.java rename to src/main/java/com/sumup/sdk/models/readers/settings/UpdateReaderSettingsResponseDataMenuLock.java index efc621b6..124233b9 100644 --- a/src/main/java/com/sumup/sdk/models/UpdateReaderSettingsResponseDataMenuLock.java +++ b/src/main/java/com/sumup/sdk/models/readers/settings/UpdateReaderSettingsResponseDataMenuLock.java @@ -1,5 +1,5 @@ // Code generated by sumup-java/codegen. DO NOT EDIT. -package com.sumup.sdk.models; +package com.sumup.sdk.models.readers.settings; /** Settings included in the update. Omitted fields are not returned. */ public record UpdateReaderSettingsResponseDataMenuLock( diff --git a/src/main/java/com/sumup/sdk/models/UpdateReaderSettingsResponseDataStatus.java b/src/main/java/com/sumup/sdk/models/readers/settings/UpdateReaderSettingsResponseDataStatus.java similarity index 97% rename from src/main/java/com/sumup/sdk/models/UpdateReaderSettingsResponseDataStatus.java rename to src/main/java/com/sumup/sdk/models/readers/settings/UpdateReaderSettingsResponseDataStatus.java index c46b84ac..c5ab293e 100644 --- a/src/main/java/com/sumup/sdk/models/UpdateReaderSettingsResponseDataStatus.java +++ b/src/main/java/com/sumup/sdk/models/readers/settings/UpdateReaderSettingsResponseDataStatus.java @@ -1,5 +1,5 @@ // Code generated by sumup-java/codegen. DO NOT EDIT. -package com.sumup.sdk.models; +package com.sumup.sdk.models.readers.settings; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; diff --git a/src/main/java/com/sumup/sdk/models/UpdateReaderSettingsUnprocessableEntity.java b/src/main/java/com/sumup/sdk/models/readers/settings/UpdateReaderSettingsUnprocessableEntity.java similarity index 96% rename from src/main/java/com/sumup/sdk/models/UpdateReaderSettingsUnprocessableEntity.java rename to src/main/java/com/sumup/sdk/models/readers/settings/UpdateReaderSettingsUnprocessableEntity.java index 0dceef38..2850d933 100644 --- a/src/main/java/com/sumup/sdk/models/UpdateReaderSettingsUnprocessableEntity.java +++ b/src/main/java/com/sumup/sdk/models/readers/settings/UpdateReaderSettingsUnprocessableEntity.java @@ -1,5 +1,5 @@ // Code generated by sumup-java/codegen. DO NOT EDIT. -package com.sumup.sdk.models; +package com.sumup.sdk.models.readers.settings; import java.util.Objects;