From b21bf5f27b08b07c56a142825b2504e6acd0c030 Mon Sep 17 00:00:00 2001 From: appscisumup Date: Fri, 24 Jul 2026 14:05:30 +0000 Subject: [PATCH 1/2] chore: synced local 'openapi.json' with remote 'specs/openapi.json' --- openapi.json | 622 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 605 insertions(+), 17 deletions(-) diff --git a/openapi.json b/openapi.json index de333ee..04f9652 100755 --- a/openapi.json +++ b/openapi.json @@ -3030,6 +3030,171 @@ ] } }, + "/v0/merchants/{merchant_code}/readers/{reader_id}/go-checkout": { + "post": { + "operationId": "CreateGoReaderCheckout", + "summary": "Create a Go Reader Payment", + "description": "Initiates a payment on the SumUp Go terminal identified by the reader ID.\n\nUse `client_transaction_id` as an idempotency key: retrying the request with the same value returns the result of the original payment instead of creating a duplicate.", + "parameters": [ + { + "name": "Authorization", + "in": "header", + "description": "Access token in the format 'Bearer {token}'.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "merchant_code", + "in": "path", + "description": "Short unique identifier for the merchant.", + "required": true, + "schema": { + "type": "string", + "example": "MK10CL2A" + } + }, + { + "name": "reader_id", + "in": "path", + "description": "The unique identifier of the reader.", + "required": true, + "schema": { + "$ref": "#/components/schemas/ReaderID" + } + } + ], + "requestBody": { + "description": "Payment details to initiate on the reader.", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ReaderPaymentRequestParams" + } + } + } + }, + "responses": { + "200": { + "description": "Returns the result of the payment initiated on the reader.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ReaderPaymentResponse" + } + } + } + }, + "400": { + "description": "The request is invalid.", + "content": { + "application/problem+json": { + "schema": { + "$ref": "#/components/schemas/Problem" + }, + "example": { + "type": "https://developer.sumup.com/problem/bad-request", + "title": "Bad Request", + "status": 400, + "detail": "Request validation failed." + } + } + } + }, + "401": { + "description": "Authentication failed or missing required scope.", + "content": { + "application/problem+json": { + "schema": { + "$ref": "#/components/schemas/Problem" + }, + "example": { + "type": "https://developer.sumup.com/problem/unauthorized", + "title": "Unauthorized", + "status": 401, + "detail": "Authentication credentials are missing or invalid." + } + } + } + }, + "404": { + "description": "The requested Reader resource does not exist.", + "content": { + "application/problem+json": { + "schema": { + "$ref": "#/components/schemas/Problem" + }, + "example": { + "type": "https://developer.sumup.com/problem/not-found", + "title": "Requested resource couldn't be found.", + "status": 404, + "detail": "The requested resource doesn't exist or does not belong to you." + } + } + } + }, + "422": { + "description": "The request could not be processed as it violates a business rule.", + "content": { + "application/problem+json": { + "schema": { + "$ref": "#/components/schemas/Problem" + }, + "example": { + "type": "https://developer.sumup.com/problem/validation-error", + "title": "Unprocessable Entity", + "status": 422, + "detail": "Validation failed." + } + } + } + }, + "500": { + "description": "An unexpected error occurred while processing the request.", + "content": { + "application/problem+json": { + "schema": { + "$ref": "#/components/schemas/Problem" + }, + "example": { + "type": "https://developer.sumup.com/problem/internal-server-error", + "title": "Internal Server Error", + "status": 500, + "detail": "An unexpected error occurred while processing the request." + } + } + } + } + }, + "security": [ + { + "apiKey": [] + }, + { + "oauth2": [ + "payments", + "readers.write" + ] + } + ], + "tags": [ + "Readers" + ], + "x-codegen": { + "method_name": "create_go_checkout", + "ignore": true + }, + "x-permissions": [ + "readers_checkout_create" + ], + "x-scopes": [ + "payments", + "readers.write" + ] + } + }, "/v0.1/memberships": { "get": { "operationId": "ListMemberships", @@ -5711,6 +5876,122 @@ "readers.write" ] } + }, + "/v0.1/merchants/{merchant_code}/readers/{reader_id}/checkout/{checkout_id}": { + "get": { + "operationId": "GetReaderCheckout", + "summary": "Get a Reader Checkout", + "description": "Get a Checkout for a Reader.\n", + "parameters": [ + { + "name": "merchant_code", + "in": "path", + "description": "Merchant Code", + "required": true, + "schema": { + "type": "string" + }, + "example": "MC0X0ABC" + }, + { + "name": "reader_id", + "in": "path", + "description": "The unique identifier of the Reader", + "required": true, + "schema": { + "type": "string" + }, + "example": "rdr_3MSAFM23CK82VSTT4BN6RWSQ65" + }, + { + "name": "checkout_id", + "in": "path", + "description": "The unique identifier of the Checkout", + "required": true, + "schema": { + "type": "string" + }, + "example": "74ecff66-1655-43ed-8ce3-193f49fa602f" + } + ], + "responses": { + "200": { + "description": "The Checkout got successfully retrieved for the given reader.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetReaderCheckoutResponse" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateReaderCheckoutError" + } + }, + "application/problem+json": { + "example": { + "detail": "Unauthorized", + "status": 401, + "title": "Unauthorized", + "type": "https://developer.sumup.com/problem/unauthorized" + }, + "schema": { + "$ref": "#/components/schemas/Problem" + } + } + } + }, + "404": { + "description": "Response when given reader or checkout is not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NotFound" + } + }, + "application/problem+json": { + "example": { + "detail": "The requested resource doesn't exist or does not belong to you.", + "status": 404, + "title": "Requested resource couldn't be found.", + "type": "https://developer.sumup.com/problem/not-found" + }, + "schema": { + "$ref": "#/components/schemas/Problem" + } + } + } + } + }, + "callbacks": {}, + "security": [ + { + "apiKey": [] + }, + { + "oauth2": [ + "readers.read" + ] + } + ], + "tags": [ + "Readers" + ], + "x-codegen": { + "method_name": "get_checkout" + }, + "x-permissions": [ + "readers_checkout_view" + ], + "x-scopes": [ + "readers.read" + ] + } } }, "components": { @@ -8066,6 +8347,97 @@ "type": "string", "title": "Transaction ID" }, + "Affiliate": { + "type": "object", + "properties": { + "app_id": { + "type": "string", + "example": "com.example.app" + }, + "key": { + "type": "string", + "example": "123e4567-e89b-12d3-a456-426614174000" + } + }, + "required": [ + "app_id", + "key" + ] + }, + "Amount": { + "type": "object", + "properties": { + "currency": { + "description": "Currency ISO 4217 code", + "type": "string", + "example": "MXN" + }, + "value": { + "description": "Amount in minor units (e.g. cents).", + "type": "integer", + "example": 1000 + } + }, + "required": [ + "currency", + "value" + ] + }, + "ReaderID": { + "description": "Unique identifier of the reader that the payment is initiated on.", + "type": "string", + "example": "rdr_3MSAFM23CK82VSTT4BN6RWSQ65", + "maxLength": 30, + "minLength": 30 + }, + "ReaderPaymentRequestParams": { + "type": "object", + "properties": { + "affiliate": { + "$ref": "#/components/schemas/Affiliate" + }, + "client_transaction_id": { + "description": "Caller-supplied correlation identifier, used as the idempotency key.", + "type": "string", + "example": "19e12390-72cf-4f9f-80b5-b0c8a67fa43f" + }, + "tip_amount": { + "description": "Optional tip amount in minor units, added on top of total_amount.", + "type": "integer", + "example": 100 + }, + "total_amount": { + "$ref": "#/components/schemas/Amount" + } + }, + "required": [ + "total_amount", + "client_transaction_id" + ] + }, + "ReaderPaymentResponse": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/ReaderPaymentResponseData" + } + } + }, + "ReaderPaymentResponseData": { + "type": "object", + "properties": { + "client_transaction_id": { + "description": "Caller-supplied correlation identifier that was provided in the request.", + "type": "string", + "example": "3fa85f64-5717-4562-b3fc-2c963f66afa6" + }, + "transaction_code": { + "description": "Transaction code returned by the acquirer/processing entity after processing the transaction.", + "type": "string", + "example": "TEENSK4W2K" + } + } + }, "MembershipStatus": { "description": "The status of the membership.", "type": "string", @@ -9246,13 +9618,6 @@ ], "title": "Reader" }, - "ReaderID": { - "description": "Unique identifier of the object.\n\nNote that this identifies the instance of the physical devices pairing with your SumUp account. If you [delete](https://developer.sumup.com/api/readers/delete-reader) a reader, and pair the device again, the ID will be different. Do not use this ID to refer to a physical device.", - "type": "string", - "example": "rdr_3MSAFM23CK82VSTT4BN6RWSQ65", - "maxLength": 30, - "minLength": 30 - }, "ReaderName": { "description": "Custom human-readable, user-defined name for easier identification of the reader.", "type": "string", @@ -9393,6 +9758,165 @@ ], "title": "CreateReaderCheckoutError" }, + "GetReaderCheckoutResponse": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "card_type": { + "description": "Type of the card. Required for some countries", + "type": "string", + "enum": [ + "credit", + "debit" + ], + "nullable": true + }, + "checkout_id": { + "description": "Unique identifier for the checkout", + "type": "string", + "format": "uuid" + }, + "client_transaction_id": { + "description": "Client transaction identifier associated with the checkout", + "type": "string" + }, + "created_at": { + "description": "Checkout creation timestamp", + "type": "string", + "format": "date-time" + }, + "installments": { + "description": "Number of installments for the transaction. Required for some countries.", + "type": "integer", + "nullable": true + }, + "payment_failure_reason": { + "description": "Payment failure reason", + "type": "string", + "nullable": true + }, + "payment_status": { + "description": "Payment status from payments v2 event", + "type": "string", + "nullable": true + }, + "payment_type": { + "description": "Type of the payment. Required for some countries", + "type": "string", + "enum": [ + "card", + "pix" + ] + }, + "reader_firmware_version": { + "description": "Reader firmware version", + "type": "string" + }, + "reader_serial_number": { + "description": "Device serial number", + "type": "string" + }, + "status": { + "description": "Current status of the checkout", + "type": "string", + "enum": [ + "pending", + "successful", + "failed", + "cancelled" + ] + }, + "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", + "type": "object", + "example": { + "currency": "EUR", + "minor_unit": 2, + "value": 1000 + }, + "properties": { + "currency": { + "description": "Currency ISO 4217 code", + "type": "string", + "example": "EUR" + }, + "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", + "type": "integer", + "example": 2, + "minimum": 0 + }, + "value": { + "description": "Integer value of the amount.", + "type": "integer", + "example": 1000, + "minimum": 0 + } + }, + "required": [ + "currency", + "minor_unit", + "value" + ], + "title": "Money" + }, + "updated_at": { + "description": "Checkout last update timestamp", + "type": "string", + "format": "date-time" + }, + "valid_until": { + "description": "Checkout expiration timestamp. After this time, the checkout will be automatically cancelled.", + "type": "string", + "format": "date-time", + "nullable": true + } + }, + "required": [ + "checkout_id", + "client_transaction_id", + "reader_serial_number", + "payment_type", + "card_type", + "reader_firmware_version", + "installments", + "payment_status", + "valid_until", + "created_at", + "updated_at", + "status", + "total_amount" + ] + } + }, + "example": { + "data": { + "card_type": "credit", + "checkout_id": "00e33a36-c99b-4cb2-b635-b90c1455c9c8", + "client_transaction_id": "00e33a36-c99b-4cb2-b635-b90c1455c9c8", + "created_at": "2026-07-07T20:41:16.315434Z", + "installments": 1, + "payment_status": "pending", + "payment_type": "card", + "reader_firmware_version": "3.3.3.21", + "reader_serial_number": "1234567890", + "status": "pending", + "total_amount": { + "currency": "EUR", + "minor_unit": 2, + "value": 10000 + }, + "updated_at": "2026-07-07T20:42:18.117244Z", + "valid_until": "2026-07-07T20:41:16.315434Z" + } + }, + "required": [ + "data" + ], + "title": "GetReaderCheckoutResponse" + }, "StatusResponse": { "description": "Status of a device", "type": "object", @@ -9577,6 +10101,11 @@ "data": { "type": "object", "properties": { + "checkout_id": { + "description": "The checkout ID is a unique identifier for the checkout.\n", + "type": "string", + "example": "3fa85f64-5717-4562-b3fc-2c963f66afa6" + }, "client_transaction_id": { "description": "The client transaction ID is a unique identifier for the transaction that is generated for the client.\n\nIt can be used later to fetch the transaction details via the [Transactions API](https://developer.sumup.com/api/transactions/get).\n", "type": "string", @@ -9590,6 +10119,7 @@ }, "example": { "data": { + "checkout_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "client_transaction_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6" } }, @@ -10676,6 +11206,70 @@ } } }, + "BadRequest": { + "description": "The request is invalid.", + "content": { + "application/problem+json": { + "schema": { + "$ref": "#/components/schemas/Problem" + }, + "example": { + "type": "https://developer.sumup.com/problem/bad-request", + "title": "Bad Request", + "status": 400, + "detail": "Request validation failed." + } + } + } + }, + "Unauthorized": { + "description": "Authentication failed or missing required scope.", + "content": { + "application/problem+json": { + "schema": { + "$ref": "#/components/schemas/Problem" + }, + "example": { + "type": "https://developer.sumup.com/problem/unauthorized", + "title": "Unauthorized", + "status": 401, + "detail": "Authentication credentials are missing or invalid." + } + } + } + }, + "NotFound": { + "description": "The requested Reader resource does not exist.", + "content": { + "application/problem+json": { + "schema": { + "$ref": "#/components/schemas/Problem" + }, + "example": { + "type": "https://developer.sumup.com/problem/not-found", + "title": "Requested resource couldn't be found.", + "status": 404, + "detail": "The requested resource doesn't exist or does not belong to you." + } + } + } + }, + "InternalError": { + "description": "An unexpected error occurred while processing the request.", + "content": { + "application/problem+json": { + "schema": { + "$ref": "#/components/schemas/Problem" + }, + "example": { + "type": "https://developer.sumup.com/problem/internal-server-error", + "title": "Internal Server Error", + "status": 500, + "detail": "An unexpected error occurred while processing the request." + } + } + } + }, "ListMemberships": { "description": "Returns a list of Membership objects.", "content": { @@ -10848,6 +11442,9 @@ } ] }, + { + "name": "Readers" + }, { "name": "Members", "description": "Endpoints to manage account members. Members are users that have membership within merchant accounts.", @@ -10886,15 +11483,6 @@ "$ref": "#/components/schemas/Merchant" } ] - }, - { - "name": "Readers", - "description": "A reader represents a device that accepts payments. You can use the SumUp Solo to accept in-person payments.", - "x-core-objects": [ - { - "$ref": "#/components/schemas/Reader" - } - ] } ] -} +} \ No newline at end of file From 3a5e35cf9bc7c09e118b18a7e3382e3c0125a702 Mon Sep 17 00:00:00 2001 From: "sumup-release-bot[bot]" <241716704+sumup-release-bot[bot]@users.noreply.github.com> Date: Fri, 24 Jul 2026 14:07:47 +0000 Subject: [PATCH 2/2] chore: generate code --- .../sumup/sdk/clients/ReadersAsyncClient.java | 136 ++++++++- .../com/sumup/sdk/clients/ReadersClient.java | 132 ++++++++- .../java/com/sumup/sdk/models/Affiliate.java | 70 +---- .../java/com/sumup/sdk/models/Affiliate2.java | 118 ++++++++ .../java/com/sumup/sdk/models/Amount.java | 60 ++++ .../models/CreateReaderCheckoutRequest.java | 6 +- .../CreateReaderCheckoutResponseData.java | 17 +- .../sdk/models/GetReaderCheckoutResponse.java | 42 +++ .../models/GetReaderCheckoutResponseData.java | 262 ++++++++++++++++++ ...GetReaderCheckoutResponseDataCardType.java | 57 ++++ ...ReaderCheckoutResponseDataPaymentType.java | 58 ++++ .../GetReaderCheckoutResponseDataStatus.java | 61 ++++ .../java/com/sumup/sdk/models/Money2.java | 85 ++++++ .../java/com/sumup/sdk/models/Reader.java | 12 +- .../java/com/sumup/sdk/models/ReaderId.java | 7 +- .../models/ReaderPaymentRequestParams.java | 91 ++++++ .../sdk/models/ReaderPaymentResponse.java | 40 +++ .../sdk/models/ReaderPaymentResponseData.java | 61 ++++ 18 files changed, 1217 insertions(+), 98 deletions(-) create mode 100644 src/main/java/com/sumup/sdk/models/Affiliate2.java create mode 100644 src/main/java/com/sumup/sdk/models/Amount.java create mode 100644 src/main/java/com/sumup/sdk/models/GetReaderCheckoutResponse.java create mode 100644 src/main/java/com/sumup/sdk/models/GetReaderCheckoutResponseData.java create mode 100644 src/main/java/com/sumup/sdk/models/GetReaderCheckoutResponseDataCardType.java create mode 100644 src/main/java/com/sumup/sdk/models/GetReaderCheckoutResponseDataPaymentType.java create mode 100644 src/main/java/com/sumup/sdk/models/GetReaderCheckoutResponseDataStatus.java create mode 100644 src/main/java/com/sumup/sdk/models/Money2.java create mode 100644 src/main/java/com/sumup/sdk/models/ReaderPaymentRequestParams.java create mode 100644 src/main/java/com/sumup/sdk/models/ReaderPaymentResponse.java create mode 100644 src/main/java/com/sumup/sdk/models/ReaderPaymentResponseData.java diff --git a/src/main/java/com/sumup/sdk/clients/ReadersAsyncClient.java b/src/main/java/com/sumup/sdk/clients/ReadersAsyncClient.java index 260510b..6793fa9 100644 --- a/src/main/java/com/sumup/sdk/clients/ReadersAsyncClient.java +++ b/src/main/java/com/sumup/sdk/clients/ReadersAsyncClient.java @@ -11,12 +11,7 @@ import java.util.Objects; import java.util.concurrent.CompletableFuture; -/** - * Client for the "Readers" API group. - * - *

A reader represents a device that accepts payments. You can use the SumUp Solo to accept - * in-person payments. - */ +/** Client for the "Readers" API group. */ public final class ReadersAsyncClient { private final ApiClient apiClient; @@ -159,6 +154,75 @@ public CompletableFuture crea requestOptions); } + /** + * Create a Go Reader Payment + * + *

Initiates a payment on the SumUp Go terminal identified by the reader ID. Use + * `client_transaction_id` as an idempotency key: retrying the request with the same value returns + * the result of the original payment instead of creating a duplicate. + * + *

Operation ID: CreateGoReaderCheckout + * + * @param merchantCode Short unique identifier for the merchant. + * @param readerId The unique identifier of the reader. + * @param request Payment details to initiate on the reader. + *

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

Initiates a payment on the SumUp Go terminal identified by the reader ID. Use + * `client_transaction_id` as an idempotency key: retrying the request with the same value returns + * the result of the original payment instead of creating a duplicate. + * + *

Operation ID: CreateGoReaderCheckout + * + * @param merchantCode Short unique identifier for the merchant. + * @param readerId The unique identifier of the reader. + * @param request Payment details to initiate on 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.ReaderPaymentResponse parsed + * response. + * @throws ApiException if the SumUp API returns an error. + */ + public CompletableFuture createGoCheckout( + String merchantCode, + com.sumup.sdk.models.ReaderId readerId, + com.sumup.sdk.models.ReaderPaymentRequestParams request, + RequestOptions requestOptions) + throws ApiException { + Objects.requireNonNull(merchantCode, "merchantCode"); + Objects.requireNonNull(readerId, "readerId"); + Objects.requireNonNull(request, "request"); + String path = "/v0/merchants/{merchant_code}/readers/{reader_id}/go-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); + } + /** * Delete a reader * @@ -290,6 +354,66 @@ 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 a Reader Status * diff --git a/src/main/java/com/sumup/sdk/clients/ReadersClient.java b/src/main/java/com/sumup/sdk/clients/ReadersClient.java index 0c11dff..bf10efd 100644 --- a/src/main/java/com/sumup/sdk/clients/ReadersClient.java +++ b/src/main/java/com/sumup/sdk/clients/ReadersClient.java @@ -10,12 +10,7 @@ import java.util.Map; import java.util.Objects; -/** - * Client for the "Readers" API group. - * - *

A reader represents a device that accepts payments. You can use the SumUp Solo to accept - * in-person payments. - */ +/** Client for the "Readers" API group. */ public final class ReadersClient { private final ApiClient apiClient; @@ -156,6 +151,73 @@ public com.sumup.sdk.models.CreateReaderCheckoutResponse createCheckout( requestOptions); } + /** + * Create a Go Reader Payment + * + *

Initiates a payment on the SumUp Go terminal identified by the reader ID. Use + * `client_transaction_id` as an idempotency key: retrying the request with the same value returns + * the result of the original payment instead of creating a duplicate. + * + *

Operation ID: CreateGoReaderCheckout + * + * @param merchantCode Short unique identifier for the merchant. + * @param readerId The unique identifier of the reader. + * @param request Payment details to initiate on the reader. + *

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

Initiates a payment on the SumUp Go terminal identified by the reader ID. Use + * `client_transaction_id` as an idempotency key: retrying the request with the same value returns + * the result of the original payment instead of creating a duplicate. + * + *

Operation ID: CreateGoReaderCheckout + * + * @param merchantCode Short unique identifier for the merchant. + * @param readerId The unique identifier of the reader. + * @param request Payment details to initiate on the reader. + * @param requestOptions Request-specific overrides (headers, authorization, or timeout). Pass + * {@code null} to use client defaults. + * @return com.sumup.sdk.models.ReaderPaymentResponse parsed response. + * @throws ApiException if the SumUp API returns an error. + */ + public com.sumup.sdk.models.ReaderPaymentResponse createGoCheckout( + String merchantCode, + com.sumup.sdk.models.ReaderId readerId, + com.sumup.sdk.models.ReaderPaymentRequestParams request, + RequestOptions requestOptions) + throws ApiException { + Objects.requireNonNull(merchantCode, "merchantCode"); + Objects.requireNonNull(readerId, "readerId"); + Objects.requireNonNull(request, "request"); + String path = "/v0/merchants/{merchant_code}/readers/{reader_id}/go-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); + } + /** * Delete a reader * @@ -284,6 +346,64 @@ 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 a Reader Status * diff --git a/src/main/java/com/sumup/sdk/models/Affiliate.java b/src/main/java/com/sumup/sdk/models/Affiliate.java index 6e3166e..cf977ca 100644 --- a/src/main/java/com/sumup/sdk/models/Affiliate.java +++ b/src/main/java/com/sumup/sdk/models/Affiliate.java @@ -3,36 +3,8 @@ import java.util.Objects; -/** - * Affiliate metadata for the transaction. It is a field that allow for integrators to track the - * source of the transaction. - */ -public record Affiliate( - /** - * Application ID of the affiliate. It is a unique identifier for the application and should be - * set by the integrator in the [Affiliate Keys](https://developer.sumup.com/affiliate-keys) - * page. - */ - String appId, - - /** - * Foreign transaction ID of the affiliate. It is a unique identifier for the transaction. It - * can be used later to fetch the transaction details via the [Transactions - * API](https://developer.sumup.com/api/transactions/get). - */ - String foreignTransactionId, - - /** - * Key of the affiliate. It is a unique identifier for the key and should be generated by the - * integrator in the [Affiliate Keys](https://developer.sumup.com/affiliate-keys) page. - */ - String key, +public record Affiliate(String appId, String key) { - /** - * Additional metadata for the transaction. It is key-value object that can be associated with - * the transaction. - */ - java.util.Map tags) { /** * Creates a builder for Affiliate. * @@ -45,18 +17,14 @@ public static Builder builder() { /** Builder for Affiliate instances. */ public static final class Builder { private String appId; - private String foreignTransactionId; private String key; - private java.util.Map tags; private Builder() {} /** * Sets the value for {@code appId}. * - * @param appId Application ID of the affiliate. It is a unique identifier for the application - * and should be set by the integrator in the [Affiliate - * Keys](https://developer.sumup.com/affiliate-keys) page. + * @param appId Value for the appId field. * @return This builder instance. */ public Builder appId(String appId) { @@ -64,25 +32,10 @@ public Builder appId(String appId) { return this; } - /** - * Sets the value for {@code foreignTransactionId}. - * - * @param foreignTransactionId Foreign transaction ID of the affiliate. It is a unique - * identifier for the transaction. It can be used later to fetch the transaction details via - * the [Transactions API](https://developer.sumup.com/api/transactions/get). - * @return This builder instance. - */ - public Builder foreignTransactionId(String foreignTransactionId) { - this.foreignTransactionId = foreignTransactionId; - return this; - } - /** * Sets the value for {@code key}. * - * @param key Key of the affiliate. It is a unique identifier for the key and should be - * generated by the integrator in the [Affiliate - * Keys](https://developer.sumup.com/affiliate-keys) page. + * @param key Value for the key field. * @return This builder instance. */ public Builder key(String key) { @@ -90,18 +43,6 @@ public Builder key(String key) { return this; } - /** - * Sets the value for {@code tags}. - * - * @param tags Additional metadata for the transaction. It is key-value object that can be - * associated with the transaction. - * @return This builder instance. - */ - public Builder tags(java.util.Map tags) { - this.tags = tags; - return this; - } - /** * Builds an immutable Affiliate instance. * @@ -109,10 +50,7 @@ public Builder tags(java.util.Map tags) { */ public Affiliate build() { return new Affiliate( - Objects.requireNonNull(appId, "appId"), - Objects.requireNonNull(foreignTransactionId, "foreignTransactionId"), - Objects.requireNonNull(key, "key"), - tags); + Objects.requireNonNull(appId, "appId"), Objects.requireNonNull(key, "key")); } } } diff --git a/src/main/java/com/sumup/sdk/models/Affiliate2.java b/src/main/java/com/sumup/sdk/models/Affiliate2.java new file mode 100644 index 0000000..d8b1e9e --- /dev/null +++ b/src/main/java/com/sumup/sdk/models/Affiliate2.java @@ -0,0 +1,118 @@ +// Code generated by sumup-java/codegen. DO NOT EDIT. +package com.sumup.sdk.models; + +import java.util.Objects; + +/** + * Affiliate metadata for the transaction. It is a field that allow for integrators to track the + * source of the transaction. + */ +public record Affiliate2( + /** + * Application ID of the affiliate. It is a unique identifier for the application and should be + * set by the integrator in the [Affiliate Keys](https://developer.sumup.com/affiliate-keys) + * page. + */ + String appId, + + /** + * Foreign transaction ID of the affiliate. It is a unique identifier for the transaction. It + * can be used later to fetch the transaction details via the [Transactions + * API](https://developer.sumup.com/api/transactions/get). + */ + String foreignTransactionId, + + /** + * Key of the affiliate. It is a unique identifier for the key and should be generated by the + * integrator in the [Affiliate Keys](https://developer.sumup.com/affiliate-keys) page. + */ + String key, + + /** + * Additional metadata for the transaction. It is key-value object that can be associated with + * the transaction. + */ + java.util.Map tags) { + /** + * Creates a builder for Affiliate2. + * + * @return Builder that constructs immutable Affiliate2 instances. + */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for Affiliate2 instances. */ + public static final class Builder { + private String appId; + private String foreignTransactionId; + private String key; + private java.util.Map tags; + + private Builder() {} + + /** + * Sets the value for {@code appId}. + * + * @param appId Application ID of the affiliate. It is a unique identifier for the application + * and should be set by the integrator in the [Affiliate + * Keys](https://developer.sumup.com/affiliate-keys) page. + * @return This builder instance. + */ + public Builder appId(String appId) { + this.appId = appId; + return this; + } + + /** + * Sets the value for {@code foreignTransactionId}. + * + * @param foreignTransactionId Foreign transaction ID of the affiliate. It is a unique + * identifier for the transaction. It can be used later to fetch the transaction details via + * the [Transactions API](https://developer.sumup.com/api/transactions/get). + * @return This builder instance. + */ + public Builder foreignTransactionId(String foreignTransactionId) { + this.foreignTransactionId = foreignTransactionId; + return this; + } + + /** + * Sets the value for {@code key}. + * + * @param key Key of the affiliate. It is a unique identifier for the key and should be + * generated by the integrator in the [Affiliate + * Keys](https://developer.sumup.com/affiliate-keys) page. + * @return This builder instance. + */ + public Builder key(String key) { + this.key = key; + return this; + } + + /** + * Sets the value for {@code tags}. + * + * @param tags Additional metadata for the transaction. It is key-value object that can be + * associated with the transaction. + * @return This builder instance. + */ + public Builder tags(java.util.Map tags) { + this.tags = tags; + return this; + } + + /** + * Builds an immutable Affiliate2 instance. + * + * @return Immutable Affiliate2. + */ + public Affiliate2 build() { + return new Affiliate2( + Objects.requireNonNull(appId, "appId"), + Objects.requireNonNull(foreignTransactionId, "foreignTransactionId"), + Objects.requireNonNull(key, "key"), + tags); + } + } +} diff --git a/src/main/java/com/sumup/sdk/models/Amount.java b/src/main/java/com/sumup/sdk/models/Amount.java new file mode 100644 index 0000000..2526400 --- /dev/null +++ b/src/main/java/com/sumup/sdk/models/Amount.java @@ -0,0 +1,60 @@ +// Code generated by sumup-java/codegen. DO NOT EDIT. +package com.sumup.sdk.models; + +import java.util.Objects; + +public record Amount( + /** Currency ISO 4217 code */ + String currency, + + /** Amount in minor units (e.g. cents). */ + Long value) { + /** + * Creates a builder for Amount. + * + * @return Builder that constructs immutable Amount instances. + */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for Amount 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 Amount in minor units (e.g. cents). + * @return This builder instance. + */ + public Builder value(Long value) { + this.value = value; + return this; + } + + /** + * Builds an immutable Amount instance. + * + * @return Immutable Amount. + */ + public Amount build() { + return new Amount( + Objects.requireNonNull(currency, "currency"), Objects.requireNonNull(value, "value")); + } + } +} diff --git a/src/main/java/com/sumup/sdk/models/CreateReaderCheckoutRequest.java b/src/main/java/com/sumup/sdk/models/CreateReaderCheckoutRequest.java index 9d0885c..abfaac8 100644 --- a/src/main/java/com/sumup/sdk/models/CreateReaderCheckoutRequest.java +++ b/src/main/java/com/sumup/sdk/models/CreateReaderCheckoutRequest.java @@ -17,7 +17,7 @@ public record CreateReaderCheckoutRequest( * Affiliate metadata for the transaction. It is a field that allow for integrators to track the * source of the transaction. */ - com.sumup.sdk.models.Affiliate affiliate, + com.sumup.sdk.models.Affiliate2 affiliate, /** * The card type of the card used for the transaction. Is is required only for some countries @@ -68,7 +68,7 @@ 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.Affiliate affiliate; + private com.sumup.sdk.models.Affiliate2 affiliate; private com.sumup.sdk.models.CreateReaderCheckoutRequestCardType cardType; private String description; private Long installments; @@ -100,7 +100,7 @@ public Builder aade(com.sumup.sdk.models.CreateReaderCheckoutRequestAade aade) { * integrators to track the source of the transaction. * @return This builder instance. */ - public Builder affiliate(com.sumup.sdk.models.Affiliate affiliate) { + public Builder affiliate(com.sumup.sdk.models.Affiliate2 affiliate) { this.affiliate = affiliate; return this; } diff --git a/src/main/java/com/sumup/sdk/models/CreateReaderCheckoutResponseData.java b/src/main/java/com/sumup/sdk/models/CreateReaderCheckoutResponseData.java index b716ac2..017b63a 100644 --- a/src/main/java/com/sumup/sdk/models/CreateReaderCheckoutResponseData.java +++ b/src/main/java/com/sumup/sdk/models/CreateReaderCheckoutResponseData.java @@ -4,6 +4,9 @@ import java.util.Objects; public record CreateReaderCheckoutResponseData( + /** The checkout ID is a unique identifier for the checkout. */ + String checkoutId, + /** * The client transaction ID is a unique identifier for the transaction that is generated for * the client. It can be used later to fetch the transaction details via the [Transactions @@ -21,10 +24,22 @@ public static Builder builder() { /** Builder for CreateReaderCheckoutResponseData instances. */ public static final class Builder { + private String checkoutId; private String clientTransactionId; private Builder() {} + /** + * Sets the value for {@code checkoutId}. + * + * @param checkoutId The checkout ID is a unique identifier for the checkout. + * @return This builder instance. + */ + public Builder checkoutId(String checkoutId) { + this.checkoutId = checkoutId; + return this; + } + /** * Sets the value for {@code clientTransactionId}. * @@ -46,7 +61,7 @@ public Builder clientTransactionId(String clientTransactionId) { */ public CreateReaderCheckoutResponseData build() { return new CreateReaderCheckoutResponseData( - Objects.requireNonNull(clientTransactionId, "clientTransactionId")); + checkoutId, Objects.requireNonNull(clientTransactionId, "clientTransactionId")); } } } diff --git a/src/main/java/com/sumup/sdk/models/GetReaderCheckoutResponse.java b/src/main/java/com/sumup/sdk/models/GetReaderCheckoutResponse.java new file mode 100644 index 0000000..ff179f1 --- /dev/null +++ b/src/main/java/com/sumup/sdk/models/GetReaderCheckoutResponse.java @@ -0,0 +1,42 @@ +// Code generated by sumup-java/codegen. DO NOT EDIT. +package com.sumup.sdk.models; + +import java.util.Objects; + +public record GetReaderCheckoutResponse(com.sumup.sdk.models.GetReaderCheckoutResponseData data) { + /** + * Creates a builder for GetReaderCheckoutResponse. + * + * @return Builder that constructs immutable GetReaderCheckoutResponse instances. + */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for GetReaderCheckoutResponse instances. */ + public static final class Builder { + private com.sumup.sdk.models.GetReaderCheckoutResponseData data; + + private Builder() {} + + /** + * Sets the value for {@code data}. + * + * @param data Value for the data field. + * @return This builder instance. + */ + public Builder data(com.sumup.sdk.models.GetReaderCheckoutResponseData data) { + this.data = data; + return this; + } + + /** + * Builds an immutable GetReaderCheckoutResponse instance. + * + * @return Immutable GetReaderCheckoutResponse. + */ + public GetReaderCheckoutResponse build() { + return new GetReaderCheckoutResponse(Objects.requireNonNull(data, "data")); + } + } +} diff --git a/src/main/java/com/sumup/sdk/models/GetReaderCheckoutResponseData.java b/src/main/java/com/sumup/sdk/models/GetReaderCheckoutResponseData.java new file mode 100644 index 0000000..628c8ae --- /dev/null +++ b/src/main/java/com/sumup/sdk/models/GetReaderCheckoutResponseData.java @@ -0,0 +1,262 @@ +// Code generated by sumup-java/codegen. DO NOT EDIT. +package com.sumup.sdk.models; + +import java.util.Objects; + +public record GetReaderCheckoutResponseData( + /** Type of the card. Required for some countries */ + com.sumup.sdk.models.GetReaderCheckoutResponseDataCardType cardType, + + /** Unique identifier for the checkout */ + java.util.UUID checkoutId, + + /** Client transaction identifier associated with the checkout */ + String clientTransactionId, + + /** Checkout creation timestamp */ + java.time.OffsetDateTime createdAt, + + /** Number of installments for the transaction. Required for some countries. */ + Long installments, + + /** Payment failure reason */ + String paymentFailureReason, + + /** Payment status from payments v2 event */ + String paymentStatus, + + /** Type of the payment. Required for some countries */ + com.sumup.sdk.models.GetReaderCheckoutResponseDataPaymentType paymentType, + + /** Reader firmware version */ + String readerFirmwareVersion, + + /** Device serial number */ + String readerSerialNumber, + + /** Current status of the checkout */ + 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. + */ + com.sumup.sdk.models.Money2 totalAmount, + + /** Checkout last update timestamp */ + java.time.OffsetDateTime updatedAt, + + /** + * Checkout expiration timestamp. After this time, the checkout will be automatically cancelled. + */ + java.time.OffsetDateTime validUntil) { + /** + * Creates a builder for GetReaderCheckoutResponseData. + * + * @return Builder that constructs immutable GetReaderCheckoutResponseData instances. + */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for GetReaderCheckoutResponseData instances. */ + public static final class Builder { + private com.sumup.sdk.models.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 String readerFirmwareVersion; + private String readerSerialNumber; + private com.sumup.sdk.models.GetReaderCheckoutResponseDataStatus status; + private com.sumup.sdk.models.Money2 totalAmount; + private java.time.OffsetDateTime updatedAt; + private java.time.OffsetDateTime validUntil; + + private Builder() {} + + /** + * Sets the value for {@code cardType}. + * + * @param cardType Type of the card. Required for some countries + * @return This builder instance. + */ + public Builder cardType(com.sumup.sdk.models.GetReaderCheckoutResponseDataCardType cardType) { + this.cardType = cardType; + return this; + } + + /** + * Sets the value for {@code checkoutId}. + * + * @param checkoutId Unique identifier for the checkout + * @return This builder instance. + */ + public Builder checkoutId(java.util.UUID checkoutId) { + this.checkoutId = checkoutId; + return this; + } + + /** + * Sets the value for {@code clientTransactionId}. + * + * @param clientTransactionId Client transaction identifier associated with the checkout + * @return This builder instance. + */ + public Builder clientTransactionId(String clientTransactionId) { + this.clientTransactionId = clientTransactionId; + return this; + } + + /** + * Sets the value for {@code createdAt}. + * + * @param createdAt Checkout creation timestamp + * @return This builder instance. + */ + public Builder createdAt(java.time.OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Sets the value for {@code installments}. + * + * @param installments Number of installments for the transaction. Required for some countries. + * @return This builder instance. + */ + public Builder installments(Long installments) { + this.installments = installments; + return this; + } + + /** + * Sets the value for {@code paymentFailureReason}. + * + * @param paymentFailureReason Payment failure reason + * @return This builder instance. + */ + public Builder paymentFailureReason(String paymentFailureReason) { + this.paymentFailureReason = paymentFailureReason; + return this; + } + + /** + * Sets the value for {@code paymentStatus}. + * + * @param paymentStatus Payment status from payments v2 event + * @return This builder instance. + */ + public Builder paymentStatus(String paymentStatus) { + this.paymentStatus = paymentStatus; + return this; + } + + /** + * Sets the value for {@code paymentType}. + * + * @param paymentType Type of the payment. Required for some countries + * @return This builder instance. + */ + public Builder paymentType( + com.sumup.sdk.models.GetReaderCheckoutResponseDataPaymentType paymentType) { + this.paymentType = paymentType; + return this; + } + + /** + * Sets the value for {@code readerFirmwareVersion}. + * + * @param readerFirmwareVersion Reader firmware version + * @return This builder instance. + */ + public Builder readerFirmwareVersion(String readerFirmwareVersion) { + this.readerFirmwareVersion = readerFirmwareVersion; + return this; + } + + /** + * Sets the value for {@code readerSerialNumber}. + * + * @param readerSerialNumber Device serial number + * @return This builder instance. + */ + public Builder readerSerialNumber(String readerSerialNumber) { + this.readerSerialNumber = readerSerialNumber; + return this; + } + + /** + * Sets the value for {@code status}. + * + * @param status Current status of the checkout + * @return This builder instance. + */ + public Builder status(com.sumup.sdk.models.GetReaderCheckoutResponseDataStatus status) { + this.status = status; + return this; + } + + /** + * 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. + * @return This builder instance. + */ + public Builder totalAmount(com.sumup.sdk.models.Money2 totalAmount) { + this.totalAmount = totalAmount; + return this; + } + + /** + * Sets the value for {@code updatedAt}. + * + * @param updatedAt Checkout last update timestamp + * @return This builder instance. + */ + public Builder updatedAt(java.time.OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * Sets the value for {@code validUntil}. + * + * @param validUntil Checkout expiration timestamp. After this time, the checkout will be + * automatically cancelled. + * @return This builder instance. + */ + public Builder validUntil(java.time.OffsetDateTime validUntil) { + this.validUntil = validUntil; + return this; + } + + /** + * Builds an immutable GetReaderCheckoutResponseData instance. + * + * @return Immutable GetReaderCheckoutResponseData. + */ + public GetReaderCheckoutResponseData build() { + return new GetReaderCheckoutResponseData( + Objects.requireNonNull(cardType, "cardType"), + Objects.requireNonNull(checkoutId, "checkoutId"), + Objects.requireNonNull(clientTransactionId, "clientTransactionId"), + Objects.requireNonNull(createdAt, "createdAt"), + Objects.requireNonNull(installments, "installments"), + paymentFailureReason, + Objects.requireNonNull(paymentStatus, "paymentStatus"), + Objects.requireNonNull(paymentType, "paymentType"), + Objects.requireNonNull(readerFirmwareVersion, "readerFirmwareVersion"), + Objects.requireNonNull(readerSerialNumber, "readerSerialNumber"), + Objects.requireNonNull(status, "status"), + Objects.requireNonNull(totalAmount, "totalAmount"), + Objects.requireNonNull(updatedAt, "updatedAt"), + Objects.requireNonNull(validUntil, "validUntil")); + } + } +} diff --git a/src/main/java/com/sumup/sdk/models/GetReaderCheckoutResponseDataCardType.java b/src/main/java/com/sumup/sdk/models/GetReaderCheckoutResponseDataCardType.java new file mode 100644 index 0000000..4a8eb01 --- /dev/null +++ b/src/main/java/com/sumup/sdk/models/GetReaderCheckoutResponseDataCardType.java @@ -0,0 +1,57 @@ +// Code generated by sumup-java/codegen. DO NOT EDIT. +package com.sumup.sdk.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; + +/** Type of the card. Required for some countries */ +public final class GetReaderCheckoutResponseDataCardType { + public static final GetReaderCheckoutResponseDataCardType CREDIT = + new GetReaderCheckoutResponseDataCardType("credit"); + public static final GetReaderCheckoutResponseDataCardType DEBIT = + new GetReaderCheckoutResponseDataCardType("debit"); + + private final String value; + + private GetReaderCheckoutResponseDataCardType(String value) { + this.value = Objects.requireNonNull(value, "value"); + } + + /** + * Creates a GetReaderCheckoutResponseDataCardType for a value not yet known to this SDK version. + * + * @param value Wire value sent to or received from the API. + * @return Open enum value wrapping {@code value}. + */ + public static GetReaderCheckoutResponseDataCardType of(String value) { + return new GetReaderCheckoutResponseDataCardType(value); + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return value; + } + + @JsonCreator + public static GetReaderCheckoutResponseDataCardType fromValue(String value) { + return value == null ? null : new GetReaderCheckoutResponseDataCardType(value); + } + + @Override + public boolean equals(Object other) { + return this == other + || (other instanceof GetReaderCheckoutResponseDataCardType that + && this.value.equals(that.value)); + } + + @Override + public int hashCode() { + return value.hashCode(); + } +} diff --git a/src/main/java/com/sumup/sdk/models/GetReaderCheckoutResponseDataPaymentType.java b/src/main/java/com/sumup/sdk/models/GetReaderCheckoutResponseDataPaymentType.java new file mode 100644 index 0000000..459ba1d --- /dev/null +++ b/src/main/java/com/sumup/sdk/models/GetReaderCheckoutResponseDataPaymentType.java @@ -0,0 +1,58 @@ +// Code generated by sumup-java/codegen. DO NOT EDIT. +package com.sumup.sdk.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; + +/** Type of the payment. Required for some countries */ +public final class GetReaderCheckoutResponseDataPaymentType { + public static final GetReaderCheckoutResponseDataPaymentType CARD = + new GetReaderCheckoutResponseDataPaymentType("card"); + public static final GetReaderCheckoutResponseDataPaymentType PIX = + new GetReaderCheckoutResponseDataPaymentType("pix"); + + private final String value; + + private GetReaderCheckoutResponseDataPaymentType(String value) { + this.value = Objects.requireNonNull(value, "value"); + } + + /** + * Creates a GetReaderCheckoutResponseDataPaymentType for a value not yet known to this SDK + * version. + * + * @param value Wire value sent to or received from the API. + * @return Open enum value wrapping {@code value}. + */ + public static GetReaderCheckoutResponseDataPaymentType of(String value) { + return new GetReaderCheckoutResponseDataPaymentType(value); + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return value; + } + + @JsonCreator + public static GetReaderCheckoutResponseDataPaymentType fromValue(String value) { + return value == null ? null : new GetReaderCheckoutResponseDataPaymentType(value); + } + + @Override + public boolean equals(Object other) { + return this == other + || (other instanceof GetReaderCheckoutResponseDataPaymentType that + && this.value.equals(that.value)); + } + + @Override + public int hashCode() { + return value.hashCode(); + } +} diff --git a/src/main/java/com/sumup/sdk/models/GetReaderCheckoutResponseDataStatus.java b/src/main/java/com/sumup/sdk/models/GetReaderCheckoutResponseDataStatus.java new file mode 100644 index 0000000..bcc0254 --- /dev/null +++ b/src/main/java/com/sumup/sdk/models/GetReaderCheckoutResponseDataStatus.java @@ -0,0 +1,61 @@ +// Code generated by sumup-java/codegen. DO NOT EDIT. +package com.sumup.sdk.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; + +/** Current status of the checkout */ +public final class GetReaderCheckoutResponseDataStatus { + public static final GetReaderCheckoutResponseDataStatus PENDING = + new GetReaderCheckoutResponseDataStatus("pending"); + public static final GetReaderCheckoutResponseDataStatus SUCCESSFUL = + new GetReaderCheckoutResponseDataStatus("successful"); + public static final GetReaderCheckoutResponseDataStatus FAILED = + new GetReaderCheckoutResponseDataStatus("failed"); + public static final GetReaderCheckoutResponseDataStatus CANCELLED = + new GetReaderCheckoutResponseDataStatus("cancelled"); + + private final String value; + + private GetReaderCheckoutResponseDataStatus(String value) { + this.value = Objects.requireNonNull(value, "value"); + } + + /** + * Creates a GetReaderCheckoutResponseDataStatus for a value not yet known to this SDK version. + * + * @param value Wire value sent to or received from the API. + * @return Open enum value wrapping {@code value}. + */ + public static GetReaderCheckoutResponseDataStatus of(String value) { + return new GetReaderCheckoutResponseDataStatus(value); + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return value; + } + + @JsonCreator + public static GetReaderCheckoutResponseDataStatus fromValue(String value) { + return value == null ? null : new GetReaderCheckoutResponseDataStatus(value); + } + + @Override + public boolean equals(Object other) { + return this == other + || (other instanceof GetReaderCheckoutResponseDataStatus that + && this.value.equals(that.value)); + } + + @Override + public int hashCode() { + return value.hashCode(); + } +} diff --git a/src/main/java/com/sumup/sdk/models/Money2.java b/src/main/java/com/sumup/sdk/models/Money2.java new file mode 100644 index 0000000..09108fd --- /dev/null +++ b/src/main/java/com/sumup/sdk/models/Money2.java @@ -0,0 +1,85 @@ +// 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")); + } + } +} diff --git a/src/main/java/com/sumup/sdk/models/Reader.java b/src/main/java/com/sumup/sdk/models/Reader.java index 8c11639..aa4b17d 100644 --- a/src/main/java/com/sumup/sdk/models/Reader.java +++ b/src/main/java/com/sumup/sdk/models/Reader.java @@ -11,12 +11,7 @@ public record Reader( /** Information about the underlying physical device. */ com.sumup.sdk.models.ReaderDevice device, - /** - * Unique identifier of the object. Note that this identifies the instance of the physical - * devices pairing with your SumUp account. If you - * [delete](https://developer.sumup.com/api/readers/delete-reader) a reader, and pair the device - * again, the ID will be different. Do not use this ID to refer to a physical device. - */ + /** Unique identifier of the reader that the payment is initiated on. */ com.sumup.sdk.models.ReaderId id, /** @@ -93,10 +88,7 @@ public Builder device(com.sumup.sdk.models.ReaderDevice device) { /** * Sets the value for {@code id}. * - * @param id Unique identifier of the object. Note that this identifies the instance of the - * physical devices pairing with your SumUp account. If you - * [delete](https://developer.sumup.com/api/readers/delete-reader) a reader, and pair the - * device again, the ID will be different. Do not use this ID to refer to a physical device. + * @param id Unique identifier of the reader that the payment is initiated on. * @return This builder instance. */ public Builder id(com.sumup.sdk.models.ReaderId id) { diff --git a/src/main/java/com/sumup/sdk/models/ReaderId.java b/src/main/java/com/sumup/sdk/models/ReaderId.java index bf329a8..6c65be8 100644 --- a/src/main/java/com/sumup/sdk/models/ReaderId.java +++ b/src/main/java/com/sumup/sdk/models/ReaderId.java @@ -1,10 +1,5 @@ // Code generated by sumup-java/codegen. DO NOT EDIT. package com.sumup.sdk.models; -/** - * Unique identifier of the object. Note that this identifies the instance of the physical devices - * pairing with your SumUp account. If you - * [delete](https://developer.sumup.com/api/readers/delete-reader) a reader, and pair the device - * again, the ID will be different. Do not use this ID to refer to a physical device. - */ +/** Unique identifier of the reader that the payment is initiated on. */ public record ReaderId(String value) {} diff --git a/src/main/java/com/sumup/sdk/models/ReaderPaymentRequestParams.java b/src/main/java/com/sumup/sdk/models/ReaderPaymentRequestParams.java new file mode 100644 index 0000000..ebdd030 --- /dev/null +++ b/src/main/java/com/sumup/sdk/models/ReaderPaymentRequestParams.java @@ -0,0 +1,91 @@ +// Code generated by sumup-java/codegen. DO NOT EDIT. +package com.sumup.sdk.models; + +import java.util.Objects; + +public record ReaderPaymentRequestParams( + com.sumup.sdk.models.Affiliate affiliate, + + /** Caller-supplied correlation identifier, used as the idempotency key. */ + String clientTransactionId, + + /** Optional tip amount in minor units, added on top of total_amount. */ + Long tipAmount, + com.sumup.sdk.models.Amount totalAmount) { + /** + * Creates a builder for ReaderPaymentRequestParams. + * + * @return Builder that constructs immutable ReaderPaymentRequestParams instances. + */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for ReaderPaymentRequestParams instances. */ + public static final class Builder { + private com.sumup.sdk.models.Affiliate affiliate; + private String clientTransactionId; + private Long tipAmount; + private com.sumup.sdk.models.Amount totalAmount; + + private Builder() {} + + /** + * Sets the value for {@code affiliate}. + * + * @param affiliate Value for the affiliate field. + * @return This builder instance. + */ + public Builder affiliate(com.sumup.sdk.models.Affiliate affiliate) { + this.affiliate = affiliate; + return this; + } + + /** + * Sets the value for {@code clientTransactionId}. + * + * @param clientTransactionId Caller-supplied correlation identifier, used as the idempotency + * key. + * @return This builder instance. + */ + public Builder clientTransactionId(String clientTransactionId) { + this.clientTransactionId = clientTransactionId; + return this; + } + + /** + * Sets the value for {@code tipAmount}. + * + * @param tipAmount Optional tip amount in minor units, added on top of total_amount. + * @return This builder instance. + */ + public Builder tipAmount(Long tipAmount) { + this.tipAmount = tipAmount; + return this; + } + + /** + * Sets the value for {@code totalAmount}. + * + * @param totalAmount Value for the totalAmount field. + * @return This builder instance. + */ + public Builder totalAmount(com.sumup.sdk.models.Amount totalAmount) { + this.totalAmount = totalAmount; + return this; + } + + /** + * Builds an immutable ReaderPaymentRequestParams instance. + * + * @return Immutable ReaderPaymentRequestParams. + */ + public ReaderPaymentRequestParams build() { + return new ReaderPaymentRequestParams( + affiliate, + Objects.requireNonNull(clientTransactionId, "clientTransactionId"), + tipAmount, + Objects.requireNonNull(totalAmount, "totalAmount")); + } + } +} diff --git a/src/main/java/com/sumup/sdk/models/ReaderPaymentResponse.java b/src/main/java/com/sumup/sdk/models/ReaderPaymentResponse.java new file mode 100644 index 0000000..cf3b8ea --- /dev/null +++ b/src/main/java/com/sumup/sdk/models/ReaderPaymentResponse.java @@ -0,0 +1,40 @@ +// Code generated by sumup-java/codegen. DO NOT EDIT. +package com.sumup.sdk.models; + +public record ReaderPaymentResponse(com.sumup.sdk.models.ReaderPaymentResponseData data) { + /** + * Creates a builder for ReaderPaymentResponse. + * + * @return Builder that constructs immutable ReaderPaymentResponse instances. + */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for ReaderPaymentResponse instances. */ + public static final class Builder { + private com.sumup.sdk.models.ReaderPaymentResponseData data; + + private Builder() {} + + /** + * Sets the value for {@code data}. + * + * @param data Value for the data field. + * @return This builder instance. + */ + public Builder data(com.sumup.sdk.models.ReaderPaymentResponseData data) { + this.data = data; + return this; + } + + /** + * Builds an immutable ReaderPaymentResponse instance. + * + * @return Immutable ReaderPaymentResponse. + */ + public ReaderPaymentResponse build() { + return new ReaderPaymentResponse(data); + } + } +} diff --git a/src/main/java/com/sumup/sdk/models/ReaderPaymentResponseData.java b/src/main/java/com/sumup/sdk/models/ReaderPaymentResponseData.java new file mode 100644 index 0000000..c1b3692 --- /dev/null +++ b/src/main/java/com/sumup/sdk/models/ReaderPaymentResponseData.java @@ -0,0 +1,61 @@ +// Code generated by sumup-java/codegen. DO NOT EDIT. +package com.sumup.sdk.models; + +public record ReaderPaymentResponseData( + /** Caller-supplied correlation identifier that was provided in the request. */ + String clientTransactionId, + + /** + * Transaction code returned by the acquirer/processing entity after processing the transaction. + */ + String transactionCode) { + /** + * Creates a builder for ReaderPaymentResponseData. + * + * @return Builder that constructs immutable ReaderPaymentResponseData instances. + */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for ReaderPaymentResponseData instances. */ + public static final class Builder { + private String clientTransactionId; + private String transactionCode; + + private Builder() {} + + /** + * Sets the value for {@code clientTransactionId}. + * + * @param clientTransactionId Caller-supplied correlation identifier that was provided in the + * request. + * @return This builder instance. + */ + public Builder clientTransactionId(String clientTransactionId) { + this.clientTransactionId = clientTransactionId; + return this; + } + + /** + * Sets the value for {@code transactionCode}. + * + * @param transactionCode Transaction code returned by the acquirer/processing entity after + * processing the transaction. + * @return This builder instance. + */ + public Builder transactionCode(String transactionCode) { + this.transactionCode = transactionCode; + return this; + } + + /** + * Builds an immutable ReaderPaymentResponseData instance. + * + * @return Immutable ReaderPaymentResponseData. + */ + public ReaderPaymentResponseData build() { + return new ReaderPaymentResponseData(clientTransactionId, transactionCode); + } + } +}