From 90264ed429b31db46478fe5bc7a6c033b78e9e86 Mon Sep 17 00:00:00 2001 From: speakeasybot Date: Wed, 4 Jun 2025 09:06:42 +0000 Subject: [PATCH 1/2] ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.555.2 --- .speakeasy/gen.lock | 167 +- .speakeasy/gen.yaml | 2 +- .speakeasy/workflow.lock | 14 +- README.md | 26 +- RELEASES.md | 12 +- USAGE.md | 1 + build.gradle | 2 +- .../components/CollectionPaymentLink.md | 11 + docs/models/components/Locale.md | 12 + docs/models/components/PaymentLink.md | 34 + docs/models/components/PaymentLinkCreate.md | 28 + docs/models/components/PaymentLinkStatus.md | 11 + .../operations/AddPaymentLinkRequest.md | 9 + .../operations/AddPaymentLinkResponse.md | 11 + .../operations/ExpirePaymentLinkRequest.md | 9 + .../operations/ExpirePaymentLinkResponse.md | 10 + .../operations/GetPaymentLinkRequest.md | 9 + .../operations/GetPaymentLinkResponse.md | 11 + .../operations/ListPaymentLinksRequest.md | 10 + .../operations/ListPaymentLinksResponse.md | 11 + docs/sdks/all/README.md | 6 + docs/sdks/auditlogs/README.md | 6 + docs/sdks/balances/README.md | 1 + docs/sdks/buyers/README.md | 8 + docs/sdks/buyersgiftcards/README.md | 1 + docs/sdks/buyerspaymentmethods/README.md | 5 + docs/sdks/cardschemedefinitions/README.md | 1 + docs/sdks/checkoutsessions/README.md | 123 ++ docs/sdks/cryptogram/README.md | 1 + docs/sdks/digitalwallets/README.md | 5 + docs/sdks/domains/README.md | 2 + docs/sdks/events/README.md | 3 + docs/sdks/executions/README.md | 3 + docs/sdks/giftcards/README.md | 4 + docs/sdks/jobs/README.md | 1 + docs/sdks/merchantaccounts/README.md | 5 + docs/sdks/networktokens/README.md | 5 + docs/sdks/paymentlinks/README.md | 266 +++ docs/sdks/paymentmethods/README.md | 8 + docs/sdks/paymentoptions/README.md | 1 + docs/sdks/paymentservicedefinitions/README.md | 2 + docs/sdks/paymentservices/README.md | 12 + docs/sdks/paymentservicetokens/README.md | 4 + docs/sdks/payouts/README.md | 5 + docs/sdks/refunds/README.md | 1 + docs/sdks/reports/README.md | 5 + docs/sdks/reportsexecutions/README.md | 2 + docs/sdks/sessions/README.md | 2 + docs/sdks/shippingdetails/README.md | 5 + docs/sdks/transactions/README.md | 65 + docs/sdks/transactionsrefunds/README.md | 3 + gradle.properties | 2 +- src/main/java/com/gr4vy/sdk/Gr4vy.java | 7 + src/main/java/com/gr4vy/sdk/PaymentLinks.java | 1567 +++++++++++++++++ .../java/com/gr4vy/sdk/SDKConfiguration.java | 4 +- .../components/CollectionPaymentLink.java | 300 ++++ .../gr4vy/sdk/models/components/Locale.java | 191 ++ .../sdk/models/components/PaymentLink.java | 1459 +++++++++++++++ .../models/components/PaymentLinkCreate.java | 1267 +++++++++++++ .../models/components/PaymentLinkStatus.java | 187 ++ .../operations/AddPaymentLinkRequest.java | 152 ++ .../AddPaymentLinkRequestBuilder.java | 46 + .../operations/AddPaymentLinkResponse.java | 249 +++ .../operations/ExpirePaymentLinkRequest.java | 163 ++ .../ExpirePaymentLinkRequestBuilder.java | 45 + .../operations/ExpirePaymentLinkResponse.java | 180 ++ .../operations/GetPaymentLinkRequest.java | 163 ++ .../GetPaymentLinkRequestBuilder.java | 64 + .../operations/GetPaymentLinkResponse.java | 249 +++ .../operations/ListPaymentLinksRequest.java | 252 +++ .../ListPaymentLinksRequestBuilder.java | 121 ++ .../operations/ListPaymentLinksResponse.java | 278 +++ .../operations/SDKMethodInterfaces.java | 28 + 73 files changed, 7915 insertions(+), 20 deletions(-) create mode 100644 docs/models/components/CollectionPaymentLink.md create mode 100644 docs/models/components/Locale.md create mode 100644 docs/models/components/PaymentLink.md create mode 100644 docs/models/components/PaymentLinkCreate.md create mode 100644 docs/models/components/PaymentLinkStatus.md create mode 100644 docs/models/operations/AddPaymentLinkRequest.md create mode 100644 docs/models/operations/AddPaymentLinkResponse.md create mode 100644 docs/models/operations/ExpirePaymentLinkRequest.md create mode 100644 docs/models/operations/ExpirePaymentLinkResponse.md create mode 100644 docs/models/operations/GetPaymentLinkRequest.md create mode 100644 docs/models/operations/GetPaymentLinkResponse.md create mode 100644 docs/models/operations/ListPaymentLinksRequest.md create mode 100644 docs/models/operations/ListPaymentLinksResponse.md create mode 100644 docs/sdks/paymentlinks/README.md create mode 100644 src/main/java/com/gr4vy/sdk/PaymentLinks.java create mode 100644 src/main/java/com/gr4vy/sdk/models/components/CollectionPaymentLink.java create mode 100644 src/main/java/com/gr4vy/sdk/models/components/Locale.java create mode 100644 src/main/java/com/gr4vy/sdk/models/components/PaymentLink.java create mode 100644 src/main/java/com/gr4vy/sdk/models/components/PaymentLinkCreate.java create mode 100644 src/main/java/com/gr4vy/sdk/models/components/PaymentLinkStatus.java create mode 100644 src/main/java/com/gr4vy/sdk/models/operations/AddPaymentLinkRequest.java create mode 100644 src/main/java/com/gr4vy/sdk/models/operations/AddPaymentLinkRequestBuilder.java create mode 100644 src/main/java/com/gr4vy/sdk/models/operations/AddPaymentLinkResponse.java create mode 100644 src/main/java/com/gr4vy/sdk/models/operations/ExpirePaymentLinkRequest.java create mode 100644 src/main/java/com/gr4vy/sdk/models/operations/ExpirePaymentLinkRequestBuilder.java create mode 100644 src/main/java/com/gr4vy/sdk/models/operations/ExpirePaymentLinkResponse.java create mode 100644 src/main/java/com/gr4vy/sdk/models/operations/GetPaymentLinkRequest.java create mode 100644 src/main/java/com/gr4vy/sdk/models/operations/GetPaymentLinkRequestBuilder.java create mode 100644 src/main/java/com/gr4vy/sdk/models/operations/GetPaymentLinkResponse.java create mode 100644 src/main/java/com/gr4vy/sdk/models/operations/ListPaymentLinksRequest.java create mode 100644 src/main/java/com/gr4vy/sdk/models/operations/ListPaymentLinksRequestBuilder.java create mode 100644 src/main/java/com/gr4vy/sdk/models/operations/ListPaymentLinksResponse.java diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 3f76845e..7555f78b 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: 2.0.0 id: 5bbaa3a9-baa0-471b-ba6a-13fd88e8c119 management: - docChecksum: 8a4b3ebc8f237643115c054cca75d13d + docChecksum: 18c6516bb55583b76843d64969c1d642 docVersion: 1.0.0 - speakeasyVersion: 1.555.0 - generationVersion: 2.618.0 - releaseVersion: 1.0.0-beta.7 - configChecksum: e7aac6e8b5dd41783d1083c4c4765adf + speakeasyVersion: 1.555.2 + generationVersion: 2.620.2 + releaseVersion: 1.0.0-beta.8 + configChecksum: d043c1b0c3ee14241ba7dac567c4ae76 repoURL: https://github.com/gr4vy/gr4vy-java.git published: true features: @@ -78,6 +78,7 @@ generatedFiles: - docs/models/components/ClickToPayPaymentMethodCreate.md - docs/models/components/ClickToPaySession.md - docs/models/components/ClickToPaySessionRequest.md + - docs/models/components/CollectionPaymentLink.md - docs/models/components/ConnectionOptions.md - docs/models/components/Context.md - docs/models/components/CreateSession.md @@ -124,6 +125,7 @@ generatedFiles: - docs/models/components/InstrumentType.md - docs/models/components/Item.md - docs/models/components/Loc.md + - docs/models/components/Locale.md - docs/models/components/MerchantAccount.md - docs/models/components/MerchantAccountCreate.md - docs/models/components/MerchantAccountUpdate.md @@ -138,6 +140,9 @@ generatedFiles: - docs/models/components/NetworkTokenPaymentMethodCreate.md - docs/models/components/NetworkTokenStatus.md - docs/models/components/NetworkTokens.md + - docs/models/components/PaymentLink.md + - docs/models/components/PaymentLinkCreate.md + - docs/models/components/PaymentLinkStatus.md - docs/models/components/PaymentMethod.md - docs/models/components/PaymentMethodCard.md - docs/models/components/PaymentMethodDetailsCard.md @@ -261,6 +266,8 @@ generatedFiles: - docs/models/operations/AddBuyerResponse.md - docs/models/operations/AddBuyerShippingDetailsRequest.md - docs/models/operations/AddBuyerShippingDetailsResponse.md + - docs/models/operations/AddPaymentLinkRequest.md + - docs/models/operations/AddPaymentLinkResponse.md - docs/models/operations/AddReportRequest.md - docs/models/operations/AddReportResponse.md - docs/models/operations/Body.md @@ -322,6 +329,8 @@ generatedFiles: - docs/models/operations/DeletePaymentMethodResponse.md - docs/models/operations/DeletePaymentServiceRequest.md - docs/models/operations/DeletePaymentServiceResponse.md + - docs/models/operations/ExpirePaymentLinkRequest.md + - docs/models/operations/ExpirePaymentLinkResponse.md - docs/models/operations/GetBuyerRequest.md - docs/models/operations/GetBuyerResponse.md - docs/models/operations/GetBuyerShippingDetailsRequest.md @@ -334,6 +343,8 @@ generatedFiles: - docs/models/operations/GetGiftCardResponse.md - docs/models/operations/GetMerchantAccountRequest.md - docs/models/operations/GetMerchantAccountResponse.md + - docs/models/operations/GetPaymentLinkRequest.md + - docs/models/operations/GetPaymentLinkResponse.md - docs/models/operations/GetPaymentMethodRequest.md - docs/models/operations/GetPaymentMethodResponse.md - docs/models/operations/GetPaymentServiceDefinitionRequest.md @@ -374,6 +385,8 @@ generatedFiles: - docs/models/operations/ListGiftCardsResponse.md - docs/models/operations/ListMerchantAccountsRequest.md - docs/models/operations/ListMerchantAccountsResponse.md + - docs/models/operations/ListPaymentLinksRequest.md + - docs/models/operations/ListPaymentLinksResponse.md - docs/models/operations/ListPaymentMethodNetworkTokensRequest.md - docs/models/operations/ListPaymentMethodNetworkTokensResponse.md - docs/models/operations/ListPaymentMethodPaymentServiceTokensRequest.md @@ -446,6 +459,7 @@ generatedFiles: - docs/sdks/jobs/README.md - docs/sdks/merchantaccounts/README.md - docs/sdks/networktokens/README.md + - docs/sdks/paymentlinks/README.md - docs/sdks/paymentmethods/README.md - docs/sdks/paymentoptions/README.md - docs/sdks/paymentservicedefinitions/README.md @@ -484,6 +498,7 @@ generatedFiles: - src/main/java/com/gr4vy/sdk/Jobs.java - src/main/java/com/gr4vy/sdk/MerchantAccounts.java - src/main/java/com/gr4vy/sdk/NetworkTokens.java + - src/main/java/com/gr4vy/sdk/PaymentLinks.java - src/main/java/com/gr4vy/sdk/PaymentMethods.java - src/main/java/com/gr4vy/sdk/PaymentOptions.java - src/main/java/com/gr4vy/sdk/PaymentServiceDefinitions.java @@ -544,6 +559,7 @@ generatedFiles: - src/main/java/com/gr4vy/sdk/models/components/ClickToPayPaymentMethodCreate.java - src/main/java/com/gr4vy/sdk/models/components/ClickToPaySession.java - src/main/java/com/gr4vy/sdk/models/components/ClickToPaySessionRequest.java + - src/main/java/com/gr4vy/sdk/models/components/CollectionPaymentLink.java - src/main/java/com/gr4vy/sdk/models/components/ConnectionOptions.java - src/main/java/com/gr4vy/sdk/models/components/Context.java - src/main/java/com/gr4vy/sdk/models/components/CreateSession.java @@ -590,6 +606,7 @@ generatedFiles: - src/main/java/com/gr4vy/sdk/models/components/InstrumentType.java - src/main/java/com/gr4vy/sdk/models/components/Item.java - src/main/java/com/gr4vy/sdk/models/components/Loc.java + - src/main/java/com/gr4vy/sdk/models/components/Locale.java - src/main/java/com/gr4vy/sdk/models/components/MerchantAccount.java - src/main/java/com/gr4vy/sdk/models/components/MerchantAccountCreate.java - src/main/java/com/gr4vy/sdk/models/components/MerchantAccountUpdate.java @@ -604,6 +621,9 @@ generatedFiles: - src/main/java/com/gr4vy/sdk/models/components/NetworkTokenPaymentMethodCreate.java - src/main/java/com/gr4vy/sdk/models/components/NetworkTokenStatus.java - src/main/java/com/gr4vy/sdk/models/components/NetworkTokens.java + - src/main/java/com/gr4vy/sdk/models/components/PaymentLink.java + - src/main/java/com/gr4vy/sdk/models/components/PaymentLinkCreate.java + - src/main/java/com/gr4vy/sdk/models/components/PaymentLinkStatus.java - src/main/java/com/gr4vy/sdk/models/components/PaymentMethod.java - src/main/java/com/gr4vy/sdk/models/components/PaymentMethodCard.java - src/main/java/com/gr4vy/sdk/models/components/PaymentMethodDetailsCard.java @@ -731,6 +751,9 @@ generatedFiles: - src/main/java/com/gr4vy/sdk/models/operations/AddBuyerShippingDetailsRequest.java - src/main/java/com/gr4vy/sdk/models/operations/AddBuyerShippingDetailsRequestBuilder.java - src/main/java/com/gr4vy/sdk/models/operations/AddBuyerShippingDetailsResponse.java + - src/main/java/com/gr4vy/sdk/models/operations/AddPaymentLinkRequest.java + - src/main/java/com/gr4vy/sdk/models/operations/AddPaymentLinkRequestBuilder.java + - src/main/java/com/gr4vy/sdk/models/operations/AddPaymentLinkResponse.java - src/main/java/com/gr4vy/sdk/models/operations/AddReportRequest.java - src/main/java/com/gr4vy/sdk/models/operations/AddReportRequestBuilder.java - src/main/java/com/gr4vy/sdk/models/operations/AddReportResponse.java @@ -823,6 +846,9 @@ generatedFiles: - src/main/java/com/gr4vy/sdk/models/operations/DeletePaymentServiceRequest.java - src/main/java/com/gr4vy/sdk/models/operations/DeletePaymentServiceRequestBuilder.java - src/main/java/com/gr4vy/sdk/models/operations/DeletePaymentServiceResponse.java + - src/main/java/com/gr4vy/sdk/models/operations/ExpirePaymentLinkRequest.java + - src/main/java/com/gr4vy/sdk/models/operations/ExpirePaymentLinkRequestBuilder.java + - src/main/java/com/gr4vy/sdk/models/operations/ExpirePaymentLinkResponse.java - src/main/java/com/gr4vy/sdk/models/operations/GetBuyerRequest.java - src/main/java/com/gr4vy/sdk/models/operations/GetBuyerRequestBuilder.java - src/main/java/com/gr4vy/sdk/models/operations/GetBuyerResponse.java @@ -841,6 +867,9 @@ generatedFiles: - src/main/java/com/gr4vy/sdk/models/operations/GetMerchantAccountRequest.java - src/main/java/com/gr4vy/sdk/models/operations/GetMerchantAccountRequestBuilder.java - src/main/java/com/gr4vy/sdk/models/operations/GetMerchantAccountResponse.java + - src/main/java/com/gr4vy/sdk/models/operations/GetPaymentLinkRequest.java + - src/main/java/com/gr4vy/sdk/models/operations/GetPaymentLinkRequestBuilder.java + - src/main/java/com/gr4vy/sdk/models/operations/GetPaymentLinkResponse.java - src/main/java/com/gr4vy/sdk/models/operations/GetPaymentMethodRequest.java - src/main/java/com/gr4vy/sdk/models/operations/GetPaymentMethodRequestBuilder.java - src/main/java/com/gr4vy/sdk/models/operations/GetPaymentMethodResponse.java @@ -901,6 +930,9 @@ generatedFiles: - src/main/java/com/gr4vy/sdk/models/operations/ListMerchantAccountsRequest.java - src/main/java/com/gr4vy/sdk/models/operations/ListMerchantAccountsRequestBuilder.java - src/main/java/com/gr4vy/sdk/models/operations/ListMerchantAccountsResponse.java + - src/main/java/com/gr4vy/sdk/models/operations/ListPaymentLinksRequest.java + - src/main/java/com/gr4vy/sdk/models/operations/ListPaymentLinksRequestBuilder.java + - src/main/java/com/gr4vy/sdk/models/operations/ListPaymentLinksResponse.java - src/main/java/com/gr4vy/sdk/models/operations/ListPaymentMethodNetworkTokensRequest.java - src/main/java/com/gr4vy/sdk/models/operations/ListPaymentMethodNetworkTokensRequestBuilder.java - src/main/java/com/gr4vy/sdk/models/operations/ListPaymentMethodNetworkTokensResponse.java @@ -4198,5 +4230,130 @@ examples: application/json: {"type": "error", "code": "bad_gateway", "status": 502, "message": "Request could not be processed"} "504": application/json: {"type": "error", "code": "gateway_timeout", "status": 504, "message": "Request could not be processed"} + add_payment_link: + speakeasy-default-add-payment-link: + requestBody: + application/json: {"amount": 1299, "country": "DE", "currency": "EUR"} + responses: + "201": + application/json: {"id": "a1b2c3d4-5678-90ab-cdef-1234567890ab", "type": "payment-link", "url": "https://example.com/link/a1b2c3d4-5678-90ab-cdef-1234567890ab", "amount": 1299, "country": "DE", "currency": "EUR", "intent": "capture", "cart_items": [{"name": "Widget", "quantity": 2, "unit_amount": 1299}], "payment_source": "moto", "created_at": "2024-05-30T12:34:56.000Z", "updated_at": "2024-05-30T13:00:00.000Z", "status": "completed"} + "400": + application/json: {"type": "error", "code": "bad_request", "status": 400, "message": "Request failed validation"} + "401": + application/json: {"type": "error", "code": "unauthorized", "status": 401, "message": "No valid API authentication found"} + "403": + application/json: {"type": "error", "code": "forbidden", "status": 403, "message": "Request failed validation"} + "404": + application/json: {"type": "error", "code": "not_found", "status": 404, "message": "The resource could not be found"} + "405": + application/json: {"type": "error", "code": "method_not_allowed", "status": 405, "message": "Method Not Allowed"} + "409": + application/json: {"type": "error", "code": "duplicate_record", "status": 409, "message": "Request failed validation"} + "422": + application/json: {} + "425": + application/json: {"type": "error", "code": "too_early", "status": 425, "message": "Request failed validation"} + "429": + application/json: {"type": "error", "code": "too_many_requests", "status": 429, "message": "Request failed validation"} + "500": + application/json: {"type": "error", "code": "server_error", "status": 500, "message": "Request could not be processed"} + "502": + application/json: {"type": "error", "code": "bad_gateway", "status": 502, "message": "Request could not be processed"} + "504": + application/json: {"type": "error", "code": "gateway_timeout", "status": 504, "message": "Request could not be processed"} + list_payment_links: + speakeasy-default-list-payment-links: + parameters: + query: + limit: 20 + responses: + "200": + application/json: {"items": [], "limit": 20} + "400": + application/json: {"type": "error", "code": "bad_request", "status": 400, "message": "Request failed validation"} + "401": + application/json: {"type": "error", "code": "unauthorized", "status": 401, "message": "No valid API authentication found"} + "403": + application/json: {"type": "error", "code": "forbidden", "status": 403, "message": "Request failed validation"} + "404": + application/json: {"type": "error", "code": "not_found", "status": 404, "message": "The resource could not be found"} + "405": + application/json: {"type": "error", "code": "method_not_allowed", "status": 405, "message": "Method Not Allowed"} + "409": + application/json: {"type": "error", "code": "duplicate_record", "status": 409, "message": "Request failed validation"} + "422": + application/json: {} + "425": + application/json: {"type": "error", "code": "too_early", "status": 425, "message": "Request failed validation"} + "429": + application/json: {"type": "error", "code": "too_many_requests", "status": 429, "message": "Request failed validation"} + "500": + application/json: {"type": "error", "code": "server_error", "status": 500, "message": "Request could not be processed"} + "502": + application/json: {"type": "error", "code": "bad_gateway", "status": 502, "message": "Request could not be processed"} + "504": + application/json: {"type": "error", "code": "gateway_timeout", "status": 504, "message": "Request could not be processed"} + expire_payment_link: + speakeasy-default-expire-payment-link: + parameters: + path: + payment_link_id: "a1b2c3d4-5678-90ab-cdef-1234567890ab" + responses: + "400": + application/json: {"type": "error", "code": "bad_request", "status": 400, "message": "Request failed validation"} + "401": + application/json: {"type": "error", "code": "unauthorized", "status": 401, "message": "No valid API authentication found"} + "403": + application/json: {"type": "error", "code": "forbidden", "status": 403, "message": "Request failed validation"} + "404": + application/json: {"type": "error", "code": "not_found", "status": 404, "message": "The resource could not be found"} + "405": + application/json: {"type": "error", "code": "method_not_allowed", "status": 405, "message": "Method Not Allowed"} + "409": + application/json: {"type": "error", "code": "duplicate_record", "status": 409, "message": "Request failed validation"} + "422": + application/json: {} + "425": + application/json: {"type": "error", "code": "too_early", "status": 425, "message": "Request failed validation"} + "429": + application/json: {"type": "error", "code": "too_many_requests", "status": 429, "message": "Request failed validation"} + "500": + application/json: {"type": "error", "code": "server_error", "status": 500, "message": "Request could not be processed"} + "502": + application/json: {"type": "error", "code": "bad_gateway", "status": 502, "message": "Request could not be processed"} + "504": + application/json: {"type": "error", "code": "gateway_timeout", "status": 504, "message": "Request could not be processed"} + get_payment_link: + speakeasy-default-get-payment-link: + parameters: + path: + payment_link_id: "a1b2c3d4-5678-90ab-cdef-1234567890ab" + responses: + "200": + application/json: {"id": "a1b2c3d4-5678-90ab-cdef-1234567890ab", "type": "payment-link", "url": "https://example.com/link/a1b2c3d4-5678-90ab-cdef-1234567890ab", "amount": 1299, "country": "DE", "currency": "EUR", "intent": "authorize", "cart_items": [{"name": "Widget", "quantity": 2, "unit_amount": 1299}], "payment_source": "recurring", "created_at": "2024-05-30T12:34:56.000Z", "updated_at": "2024-05-30T13:00:00.000Z", "status": "active"} + "400": + application/json: {"type": "error", "code": "bad_request", "status": 400, "message": "Request failed validation"} + "401": + application/json: {"type": "error", "code": "unauthorized", "status": 401, "message": "No valid API authentication found"} + "403": + application/json: {"type": "error", "code": "forbidden", "status": 403, "message": "Request failed validation"} + "404": + application/json: {"type": "error", "code": "not_found", "status": 404, "message": "The resource could not be found"} + "405": + application/json: {"type": "error", "code": "method_not_allowed", "status": 405, "message": "Method Not Allowed"} + "409": + application/json: {"type": "error", "code": "duplicate_record", "status": 409, "message": "Request failed validation"} + "422": + application/json: {} + "425": + application/json: {"type": "error", "code": "too_early", "status": 425, "message": "Request failed validation"} + "429": + application/json: {"type": "error", "code": "too_many_requests", "status": 429, "message": "Request failed validation"} + "500": + application/json: {"type": "error", "code": "server_error", "status": 500, "message": "Request could not be processed"} + "502": + application/json: {"type": "error", "code": "bad_gateway", "status": 502, "message": "Request could not be processed"} + "504": + application/json: {"type": "error", "code": "gateway_timeout", "status": 504, "message": "Request could not be processed"} examplesVersion: 1.0.2 generatedTests: {} diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 211cfaa6..99b62bff 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -18,7 +18,7 @@ generation: oAuth2PasswordEnabled: false sdkHooksConfigAccess: true java: - version: 1.0.0-beta.7 + version: 1.0.0-beta.8 additionalDependencies: - testImplementation:org.junit.jupiter:junit-jupiter:5.10.0 - implementation:com.auth0:java-jwt:4.5.0 diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index bcfed04a..8f18bf48 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,4 +1,4 @@ -speakeasyVersion: 1.555.0 +speakeasyVersion: 1.555.2 sources: Gr4vy: sourceNamespace: openapi @@ -9,11 +9,11 @@ sources: - 1.0.0 openapi: sourceNamespace: openapi - sourceRevisionDigest: sha256:8504a2ac7ffb0ee763800e6d50dafe18ff7b67e9093f798523270b6e8c7f5d62 - sourceBlobDigest: sha256:b6ef58a6f8dda9b5163a34af28ce4ebe3a4f079dff0f0d734a2da9f714742a24 + sourceRevisionDigest: sha256:8ee4f196bee9bb7ac2297c1865f961c5394e4118a0e74feec1bb9f9137b99504 + sourceBlobDigest: sha256:bbf37bd476f9d17978dbed983ca325a3bc61bd1703c9888c7fbbc9a35abe1414 tags: - latest - - speakeasy-sdk-regen-1748963300 + - speakeasy-sdk-regen-1749027924 - 1.0.0 targets: gr-4-vy: @@ -26,10 +26,10 @@ targets: java: source: openapi sourceNamespace: openapi - sourceRevisionDigest: sha256:8504a2ac7ffb0ee763800e6d50dafe18ff7b67e9093f798523270b6e8c7f5d62 - sourceBlobDigest: sha256:b6ef58a6f8dda9b5163a34af28ce4ebe3a4f079dff0f0d734a2da9f714742a24 + sourceRevisionDigest: sha256:8ee4f196bee9bb7ac2297c1865f961c5394e4118a0e74feec1bb9f9137b99504 + sourceBlobDigest: sha256:bbf37bd476f9d17978dbed983ca325a3bc61bd1703c9888c7fbbc9a35abe1414 codeSamplesNamespace: openapi-java-code-samples - codeSamplesRevisionDigest: sha256:f9b9fa5877c77975eac6f4a5fc55a28455053aa9752ccc1b79b0f0c284908ec9 + codeSamplesRevisionDigest: sha256:dd03b1de57b4f1255a4a7ce668d92adf247960f509c5dadc47198860a7eecc75 workflow: workflowVersion: 1.0.0 speakeasyVersion: latest diff --git a/README.md b/README.md index 7e5757a5..4c1ad52f 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ The samples below show how a published SDK artifact is used: Gradle: ```groovy -implementation 'com.gr4vy:sdk:1.0.0-beta.7' +implementation 'com.gr4vy:sdk:1.0.0-beta.8' ``` Maven: @@ -68,7 +68,7 @@ Maven: com.gr4vy sdk - 1.0.0-beta.7 + 1.0.0-beta.8 ``` @@ -331,6 +331,13 @@ try { * [get](docs/sdks/merchantaccounts/README.md#get) - Get a merchant account * [update](docs/sdks/merchantaccounts/README.md#update) - Update a merchant account +### [paymentLinks()](docs/sdks/paymentlinks/README.md) + +* [create](docs/sdks/paymentlinks/README.md#create) - Add a payment link +* [list](docs/sdks/paymentlinks/README.md#list) - List all payment links +* [expire](docs/sdks/paymentlinks/README.md#expire) - Expire a payment link +* [get](docs/sdks/paymentlinks/README.md#get) - Get payment link + ### [paymentMethods()](docs/sdks/paymentmethods/README.md) * [list](docs/sdks/paymentmethods/README.md#list) - List all payment methods @@ -450,10 +457,14 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); ListBuyersRequest req = ListBuyersRequest.builder() + .cursor("ZXhhbXBsZTE") + .search("John") + .externalIdentifier("buyer-12345") .build(); sdk.buyers().list() @@ -490,10 +501,14 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); ListBuyersRequest req = ListBuyersRequest.builder() + .cursor("ZXhhbXBsZTE") + .search("John") + .externalIdentifier("buyer-12345") .build(); sdk.buyers().list() @@ -544,10 +559,14 @@ public class Application { .retryConnectError(false) .build()) .build()) + .merchantAccountId("default") .bearerAuth("") .build(); ListBuyersRequest req = ListBuyersRequest.builder() + .cursor("ZXhhbXBsZTE") + .search("John") + .externalIdentifier("buyer-12345") .build(); sdk.buyers().list() @@ -602,6 +621,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); @@ -658,6 +678,7 @@ public class Application { Gr4vy sdk = Gr4vy.builder() .server(Gr4vy.AvailableServers.SANDBOX) .id("") + .merchantAccountId("default") .bearerAuth("") .build(); @@ -695,6 +716,7 @@ public class Application { Gr4vy sdk = Gr4vy.builder() .serverURL("https://api.example.gr4vy.app") + .merchantAccountId("default") .bearerAuth("") .build(); diff --git a/RELEASES.md b/RELEASES.md index 2b44a2b3..518ed7a6 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -58,4 +58,14 @@ Based on: ### Generated - [java v1.0.0-beta.7] . ### Releases -- [Maven Central v1.0.0-beta.7] https://central.sonatype.com/artifact/com.gr4vy/sdk/1.0.0-beta.7 - . \ No newline at end of file +- [Maven Central v1.0.0-beta.7] https://central.sonatype.com/artifact/com.gr4vy/sdk/1.0.0-beta.7 - . + +## 2025-06-04 09:05:07 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.555.2 (2.620.2) https://github.com/speakeasy-api/speakeasy +### Generated +- [java v1.0.0-beta.8] . +### Releases +- [Maven Central v1.0.0-beta.8] https://central.sonatype.com/artifact/com.gr4vy/sdk/1.0.0-beta.8 - . \ No newline at end of file diff --git a/USAGE.md b/USAGE.md index 725452e7..e141a0ab 100644 --- a/USAGE.md +++ b/USAGE.md @@ -14,6 +14,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); diff --git a/build.gradle b/build.gradle index f1df493c..43ee6315 100644 --- a/build.gradle +++ b/build.gradle @@ -103,7 +103,7 @@ publishing { // https://github.com/gradle/gradle/issues/18619 groupId = "com.gr4vy" artifactId = "sdk" - version = "1.0.0-beta.7" + version = "1.0.0-beta.8" from components.java diff --git a/docs/models/components/CollectionPaymentLink.md b/docs/models/components/CollectionPaymentLink.md new file mode 100644 index 00000000..484fc84e --- /dev/null +++ b/docs/models/components/CollectionPaymentLink.md @@ -0,0 +1,11 @@ +# CollectionPaymentLink + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | +| `items` | List\<[PaymentLink](../../models/components/PaymentLink.md)> | :heavy_check_mark: | A list of items returned for this request. | | +| `limit` | *Optional\* | :heavy_minus_sign: | The number of items for this page. | 20 | +| `nextCursor` | *JsonNullable\* | :heavy_minus_sign: | The cursor pointing at the next page of items. | ZXhhbXBsZTE | +| `previousCursor` | *JsonNullable\* | :heavy_minus_sign: | The cursor pointing at the previous page of items. | Xkjss7asS | \ No newline at end of file diff --git a/docs/models/components/Locale.md b/docs/models/components/Locale.md new file mode 100644 index 00000000..b95c3381 --- /dev/null +++ b/docs/models/components/Locale.md @@ -0,0 +1,12 @@ +# Locale + + +## Values + +| Name | Value | +| ------- | ------- | +| `EN` | en | +| `EN_GB` | en-GB | +| `PT` | pt | +| `PT_BR` | pt-BR | +| `ES` | es | \ No newline at end of file diff --git a/docs/models/components/PaymentLink.md b/docs/models/components/PaymentLink.md new file mode 100644 index 00000000..79c489a1 --- /dev/null +++ b/docs/models/components/PaymentLink.md @@ -0,0 +1,34 @@ +# PaymentLink + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | +| `id` | *String* | :heavy_check_mark: | The unique identifier for the payment link. | a1b2c3d4-5678-90ab-cdef-1234567890ab | +| `type` | *Optional\* | :heavy_minus_sign: | Always `payment-link`. | payment-link | +| `url` | *String* | :heavy_check_mark: | The URL for the payment link. | https://example.com/link/a1b2c3d4-5678-90ab-cdef-1234567890ab | +| `expiresAt` | [OffsetDateTime](https://docs.oracle.com/javase/8/docs/api/java/time/OffsetDateTime.html) | :heavy_minus_sign: | The expiration date and time for the payment link. | 2024-06-01T00:00:00.000Z | +| `externalIdentifier` | *JsonNullable\* | :heavy_minus_sign: | The merchant reference for the payment link. | external-12345 | +| `statementDescriptor` | [JsonNullable\](../../models/components/StatementDescriptor.md) | :heavy_minus_sign: | The statement descriptor for the payment link. | | +| `locale` | *JsonNullable\* | :heavy_minus_sign: | The locale for the payment link. | en | +| `merchantName` | *JsonNullable\* | :heavy_minus_sign: | The merchant's display name. | ACME Inc. | +| `merchantUrl` | *JsonNullable\* | :heavy_minus_sign: | The merchant's website URL. | https://merchant.example.com | +| `merchantBannerUrl` | *JsonNullable\* | :heavy_minus_sign: | The merchant's banner image URL. | https://merchant.example.com/banner.png | +| `merchantColor` | *JsonNullable\* | :heavy_minus_sign: | The merchant's brand color. | #FF5733 | +| `merchantMessage` | *JsonNullable\* | :heavy_minus_sign: | A message from the merchant. | Thank you for your purchase! | +| `merchantTermsAndConditionsUrl` | *JsonNullable\* | :heavy_minus_sign: | URL to the merchant's terms and conditions. | https://merchant.example.com/terms | +| `merchantFaviconUrl` | *JsonNullable\* | :heavy_minus_sign: | URL to the merchant's favicon. | https://merchant.example.com/favicon.ico | +| `amount` | *long* | :heavy_check_mark: | The amount for the payment link. | 1299 | +| `country` | *String* | :heavy_check_mark: | The country code for the payment link. | DE | +| `currency` | *String* | :heavy_check_mark: | The currency code for the payment link. | EUR | +| `intent` | [TransactionIntent](../../models/components/TransactionIntent.md) | :heavy_check_mark: | N/A | | +| `returnUrl` | *JsonNullable\* | :heavy_minus_sign: | The return URL after payment completion. | https://merchant.example.com/return | +| `cartItems` | List\<[CartItem](../../models/components/CartItem.md)> | :heavy_check_mark: | The cart items for the payment link. | [
{
"amount": {
"currency": "USD",
"value": 500
},
"name": "Widget",
"quantity": 2
}
] | +| `metadata` | Map\ | :heavy_minus_sign: | Arbitrary metadata for the payment link. | {
"order_id": "ORD-12345"
} | +| `paymentSource` | [TransactionPaymentSource](../../models/components/TransactionPaymentSource.md) | :heavy_check_mark: | The way payment method information made it to this transaction. | | +| `createdAt` | [OffsetDateTime](https://docs.oracle.com/javase/8/docs/api/java/time/OffsetDateTime.html) | :heavy_check_mark: | The date and time the payment link was created. | 2024-05-30T12:34:56.000Z | +| `updatedAt` | [OffsetDateTime](https://docs.oracle.com/javase/8/docs/api/java/time/OffsetDateTime.html) | :heavy_check_mark: | The date and time the payment link was last updated. | 2024-05-30T13:00:00.000Z | +| `status` | [PaymentLinkStatus](../../models/components/PaymentLinkStatus.md) | :heavy_check_mark: | N/A | | +| `buyer` | [JsonNullable\](../../models/components/TransactionBuyer.md) | :heavy_minus_sign: | The buyer associated with the payment link. | | +| `shippingDetails` | [JsonNullable\](../../models/components/ShippingDetails.md) | :heavy_minus_sign: | The shipping details for the payment link. | | \ No newline at end of file diff --git a/docs/models/components/PaymentLinkCreate.md b/docs/models/components/PaymentLinkCreate.md new file mode 100644 index 00000000..92c80f5f --- /dev/null +++ b/docs/models/components/PaymentLinkCreate.md @@ -0,0 +1,28 @@ +# PaymentLinkCreate + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | +| `buyer` | [JsonNullable\](../../models/components/GuestBuyerInput.md) | :heavy_minus_sign: | The guest buyer for the payment link. | | +| `expiresAt` | [OffsetDateTime](https://docs.oracle.com/javase/8/docs/api/java/time/OffsetDateTime.html) | :heavy_minus_sign: | The expiration date and time for the payment link. | 2024-06-01T00:00:00.000Z | +| `connectionOptions` | Map\> | :heavy_minus_sign: | Connection options for the payment link. | | +| `externalIdentifier` | *JsonNullable\* | :heavy_minus_sign: | The merchant reference for the payment link. | external-12345 | +| `statementDescriptor` | [JsonNullable\](../../models/components/StatementDescriptor.md) | :heavy_minus_sign: | The statement descriptor for the payment link. | | +| `locale` | [JsonNullable\](../../models/components/Locale.md) | :heavy_minus_sign: | The locale for the payment link. | en | +| `merchantName` | *JsonNullable\* | :heavy_minus_sign: | The merchant's display name. | ACME Inc. | +| `merchantUrl` | *JsonNullable\* | :heavy_minus_sign: | The merchant's website URL. | https://merchant.example.com | +| `merchantBannerUrl` | *JsonNullable\* | :heavy_minus_sign: | The merchant's banner image URL. | https://merchant.example.com/banner.png | +| `merchantColor` | *JsonNullable\* | :heavy_minus_sign: | The merchant's brand color. | #FF5733 | +| `merchantMessage` | *JsonNullable\* | :heavy_minus_sign: | A message from the merchant. | Thank you for your purchase! | +| `merchantTermsAndConditionsUrl` | *JsonNullable\* | :heavy_minus_sign: | URL to the merchant's terms and conditions. | https://merchant.example.com/terms | +| `merchantFaviconUrl` | *JsonNullable\* | :heavy_minus_sign: | URL to the merchant's favicon. | https://merchant.example.com/favicon.ico | +| `amount` | *long* | :heavy_check_mark: | The amount for the payment link. | 1299 | +| `country` | *String* | :heavy_check_mark: | The country code for the payment link. | DE | +| `currency` | *String* | :heavy_check_mark: | The currency code for the payment link. | EUR | +| `intent` | [Optional\](../../models/components/TransactionIntent.md) | :heavy_minus_sign: | N/A | | +| `returnUrl` | *JsonNullable\* | :heavy_minus_sign: | The return URL after payment completion. | https://merchant.example.com/return | +| `cartItems` | List\<[CartItem](../../models/components/CartItem.md)> | :heavy_minus_sign: | The cart items for the payment link. | | +| `metadata` | Map\ | :heavy_minus_sign: | Arbitrary metadata for the payment link. | {
"order_id": "ORD-12345"
} | +| `paymentSource` | [Optional\](../../models/components/TransactionPaymentSource.md) | :heavy_minus_sign: | The way payment method information made it to this transaction. | | \ No newline at end of file diff --git a/docs/models/components/PaymentLinkStatus.md b/docs/models/components/PaymentLinkStatus.md new file mode 100644 index 00000000..190a8751 --- /dev/null +++ b/docs/models/components/PaymentLinkStatus.md @@ -0,0 +1,11 @@ +# PaymentLinkStatus + + +## Values + +| Name | Value | +| ------------ | ------------ | +| `ACTIVE` | active | +| `COMPLETED` | completed | +| `EXPIRED` | expired | +| `PROCESSING` | processing | \ No newline at end of file diff --git a/docs/models/operations/AddPaymentLinkRequest.md b/docs/models/operations/AddPaymentLinkRequest.md new file mode 100644 index 00000000..f9902096 --- /dev/null +++ b/docs/models/operations/AddPaymentLinkRequest.md @@ -0,0 +1,9 @@ +# AddPaymentLinkRequest + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `merchantAccountId` | *JsonNullable\* | :heavy_minus_sign: | The ID of the merchant account to use for this request. | +| `paymentLinkCreate` | [PaymentLinkCreate](../../models/components/PaymentLinkCreate.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/AddPaymentLinkResponse.md b/docs/models/operations/AddPaymentLinkResponse.md new file mode 100644 index 00000000..69cd6436 --- /dev/null +++ b/docs/models/operations/AddPaymentLinkResponse.md @@ -0,0 +1,11 @@ +# AddPaymentLinkResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `paymentLink` | [Optional\](../../models/components/PaymentLink.md) | :heavy_minus_sign: | Successful Response | \ No newline at end of file diff --git a/docs/models/operations/ExpirePaymentLinkRequest.md b/docs/models/operations/ExpirePaymentLinkRequest.md new file mode 100644 index 00000000..b8da0c6d --- /dev/null +++ b/docs/models/operations/ExpirePaymentLinkRequest.md @@ -0,0 +1,9 @@ +# ExpirePaymentLinkRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | +| `paymentLinkId` | *String* | :heavy_check_mark: | The unique identifier for the payment link. | a1b2c3d4-5678-90ab-cdef-1234567890ab | +| `merchantAccountId` | *JsonNullable\* | :heavy_minus_sign: | The ID of the merchant account to use for this request. | | \ No newline at end of file diff --git a/docs/models/operations/ExpirePaymentLinkResponse.md b/docs/models/operations/ExpirePaymentLinkResponse.md new file mode 100644 index 00000000..76600620 --- /dev/null +++ b/docs/models/operations/ExpirePaymentLinkResponse.md @@ -0,0 +1,10 @@ +# ExpirePaymentLinkResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/operations/GetPaymentLinkRequest.md b/docs/models/operations/GetPaymentLinkRequest.md new file mode 100644 index 00000000..3d341511 --- /dev/null +++ b/docs/models/operations/GetPaymentLinkRequest.md @@ -0,0 +1,9 @@ +# GetPaymentLinkRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | +| `paymentLinkId` | *String* | :heavy_check_mark: | The unique identifier for the payment link. | a1b2c3d4-5678-90ab-cdef-1234567890ab | +| `merchantAccountId` | *JsonNullable\* | :heavy_minus_sign: | The ID of the merchant account to use for this request. | | \ No newline at end of file diff --git a/docs/models/operations/GetPaymentLinkResponse.md b/docs/models/operations/GetPaymentLinkResponse.md new file mode 100644 index 00000000..41d77dfb --- /dev/null +++ b/docs/models/operations/GetPaymentLinkResponse.md @@ -0,0 +1,11 @@ +# GetPaymentLinkResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `paymentLink` | [Optional\](../../models/components/PaymentLink.md) | :heavy_minus_sign: | Successful Response | \ No newline at end of file diff --git a/docs/models/operations/ListPaymentLinksRequest.md b/docs/models/operations/ListPaymentLinksRequest.md new file mode 100644 index 00000000..8d39ee2d --- /dev/null +++ b/docs/models/operations/ListPaymentLinksRequest.md @@ -0,0 +1,10 @@ +# ListPaymentLinksRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | +| `cursor` | *JsonNullable\* | :heavy_minus_sign: | A pointer to the page of results to return. | ZXhhbXBsZTE | +| `limit` | *Optional\* | :heavy_minus_sign: | The maximum number of items that are returned. | 20 | +| `merchantAccountId` | *JsonNullable\* | :heavy_minus_sign: | The ID of the merchant account to use for this request. | | \ No newline at end of file diff --git a/docs/models/operations/ListPaymentLinksResponse.md b/docs/models/operations/ListPaymentLinksResponse.md new file mode 100644 index 00000000..80f52368 --- /dev/null +++ b/docs/models/operations/ListPaymentLinksResponse.md @@ -0,0 +1,11 @@ +# ListPaymentLinksResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `collectionPaymentLink` | [Optional\](../../models/components/CollectionPaymentLink.md) | :heavy_minus_sign: | Successful Response | \ No newline at end of file diff --git a/docs/sdks/all/README.md b/docs/sdks/all/README.md index 7602b657..a2025f4d 100644 --- a/docs/sdks/all/README.md +++ b/docs/sdks/all/README.md @@ -17,6 +17,7 @@ Create a refund for all instruments on a transaction. package hello.world; import com.gr4vy.sdk.Gr4vy; +import com.gr4vy.sdk.models.components.TransactionRefundAllCreate; import com.gr4vy.sdk.models.errors.*; import com.gr4vy.sdk.models.operations.CreateFullTransactionRefundResponse; import java.lang.Exception; @@ -26,11 +27,16 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); CreateFullTransactionRefundResponse res = sdk.transactions().refunds().all().create() .transactionId("7099948d-7286-47e4-aad8-b68f7eb44591") + .transactionRefundAllCreate(TransactionRefundAllCreate.builder() + .reason("Refund due to user request.") + .externalIdentifier("refund-12345") + .build()) .call(); if (res.refunds().isPresent()) { diff --git a/docs/sdks/auditlogs/README.md b/docs/sdks/auditlogs/README.md index 8854fc96..12eff37f 100644 --- a/docs/sdks/auditlogs/README.md +++ b/docs/sdks/auditlogs/README.md @@ -17,6 +17,7 @@ Returns a list of activity by dashboard users. package hello.world; import com.gr4vy.sdk.Gr4vy; +import com.gr4vy.sdk.models.components.AuditLogAction; import com.gr4vy.sdk.models.errors.*; import com.gr4vy.sdk.models.operations.ListAuditLogsRequest; import java.lang.Exception; @@ -26,10 +27,15 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); ListAuditLogsRequest req = ListAuditLogsRequest.builder() + .cursor("ZXhhbXBsZTE") + .action(AuditLogAction.CREATED) + .userId("14b7b8c5-a6ba-4fb6-bbab-52d43c7f37ef") + .resourceType("user") .build(); sdk.auditLogs().list() diff --git a/docs/sdks/balances/README.md b/docs/sdks/balances/README.md index cb57a77c..35dd1c25 100644 --- a/docs/sdks/balances/README.md +++ b/docs/sdks/balances/README.md @@ -28,6 +28,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); diff --git a/docs/sdks/buyers/README.md b/docs/sdks/buyers/README.md index 181ac1ca..a31b9978 100644 --- a/docs/sdks/buyers/README.md +++ b/docs/sdks/buyers/README.md @@ -30,10 +30,14 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); ListBuyersRequest req = ListBuyersRequest.builder() + .cursor("ZXhhbXBsZTE") + .search("John") + .externalIdentifier("buyer-12345") .build(); sdk.buyers().list() @@ -95,6 +99,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); @@ -158,6 +163,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); @@ -221,6 +227,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); @@ -286,6 +293,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); diff --git a/docs/sdks/buyersgiftcards/README.md b/docs/sdks/buyersgiftcards/README.md index 2424e895..655f40c6 100644 --- a/docs/sdks/buyersgiftcards/README.md +++ b/docs/sdks/buyersgiftcards/README.md @@ -26,6 +26,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); diff --git a/docs/sdks/buyerspaymentmethods/README.md b/docs/sdks/buyerspaymentmethods/README.md index cfae22a2..d2079a87 100644 --- a/docs/sdks/buyerspaymentmethods/README.md +++ b/docs/sdks/buyerspaymentmethods/README.md @@ -27,10 +27,15 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); ListBuyerPaymentMethodsRequest req = ListBuyerPaymentMethodsRequest.builder() + .buyerId("fe26475d-ec3e-4884-9553-f7356683f7f9") + .buyerExternalIdentifier("buyer-12345") + .country("US") + .currency("USD") .build(); ListBuyerPaymentMethodsResponse res = sdk.buyers().paymentMethods().list() diff --git a/docs/sdks/cardschemedefinitions/README.md b/docs/sdks/cardschemedefinitions/README.md index 9f522447..efed4c5b 100644 --- a/docs/sdks/cardschemedefinitions/README.md +++ b/docs/sdks/cardschemedefinitions/README.md @@ -26,6 +26,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); diff --git a/docs/sdks/checkoutsessions/README.md b/docs/sdks/checkoutsessions/README.md index 2add69c4..d4be3109 100644 --- a/docs/sdks/checkoutsessions/README.md +++ b/docs/sdks/checkoutsessions/README.md @@ -20,19 +20,139 @@ Create a new checkout session. package hello.world; import com.gr4vy.sdk.Gr4vy; +import com.gr4vy.sdk.models.components.*; import com.gr4vy.sdk.models.errors.*; import com.gr4vy.sdk.models.operations.CreateCheckoutSessionResponse; import java.lang.Exception; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import org.openapitools.jackson.nullable.JsonNullable; public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); CreateCheckoutSessionResponse res = sdk.checkoutSessions().create() + .checkoutSessionCreate(CheckoutSessionCreate.builder() + .cartItems(List.of( + CartItem.builder() + .name("GoPro HD") + .quantity(2L) + .unitAmount(1299L) + .discountAmount(0L) + .taxAmount(0L) + .externalIdentifier("goprohd") + .sku("GPHD1078") + .productUrl("https://example.com/catalog/go-pro-hd") + .imageUrl("https://example.com/images/go-pro-hd.jpg") + .categories(List.of( + "camera", + "travel", + "gear")) + .productType(ProductType.PHYSICAL) + .sellerCountry("US") + .build(), + CartItem.builder() + .name("GoPro HD") + .quantity(2L) + .unitAmount(1299L) + .discountAmount(0L) + .taxAmount(0L) + .externalIdentifier("goprohd") + .sku("GPHD1078") + .productUrl("https://example.com/catalog/go-pro-hd") + .imageUrl("https://example.com/images/go-pro-hd.jpg") + .categories(List.of( + "camera", + "travel", + "gear")) + .productType(ProductType.PHYSICAL) + .sellerCountry("US") + .build())) + .metadata(Map.ofEntries( + Map.entry("cohort", "cohort-a"), + Map.entry("order_id", "order-12345"))) + .buyer(JsonNullable.of(null)) + .airline(Airline.builder() + .bookingCode("X36Q9C") + .isCardholderTraveling(true) + .issuedAddress("123 Broadway, New York") + .issuedAt(OffsetDateTime.parse("2013-07-16T19:23:00.000+00:00")) + .issuingCarrierCode("649") + .issuingCarrierName("Air Transat A.T. Inc") + .issuingIataDesignator("TS") + .issuingIcaoCode("TSC") + .legs(List.of( + AirlineLeg.builder() + .arrivalAirport("LAX") + .arrivalAt(OffsetDateTime.parse("2013-07-16T19:23:00.000+00:00")) + .arrivalCity("Los Angeles") + .arrivalCountry("US") + .carrierCode("649") + .carrierName("Air Transat A.T. Inc") + .iataDesignator("TS") + .icaoCode("TSC") + .couponNumber("15885566") + .departureAirport("LHR") + .departureAt(OffsetDateTime.parse("2013-07-16T19:23:00.000+00:00")) + .departureCity("London") + .departureCountry("GB") + .departureTaxAmount(1200L) + .fareAmount(129900L) + .fareBasisCode("FY") + .feeAmount(1200L) + .flightClass("E") + .flightNumber("101") + .routeType(RouteType.ROUND_TRIP) + .seatClass("F") + .stopOver(false) + .taxAmount(1200L) + .build())) + .passengerNameRecord("JOHN L") + .passengers(List.of( + AirlinePassenger.builder() + .ageGroup(AgeGroup.ADULT) + .dateOfBirth(LocalDate.parse("2013-07-16")) + .emailAddress("john@example.com") + .firstName("John") + .frequentFlyerNumber("15885566") + .lastName("Luhn") + .passportNumber("11117700225") + .phoneNumber("+1234567890") + .ticketNumber("BA1236699999") + .title("Mr.") + .countryCode("US") + .build(), + AirlinePassenger.builder() + .ageGroup(AgeGroup.ADULT) + .dateOfBirth(LocalDate.parse("2013-07-16")) + .emailAddress("john@example.com") + .firstName("John") + .frequentFlyerNumber("15885566") + .lastName("Luhn") + .passportNumber("11117700225") + .phoneNumber("+1234567890") + .ticketNumber("BA1236699999") + .title("Mr.") + .countryCode("US") + .build())) + .reservationSystem("Amadeus") + .restrictedTicket(false) + .ticketDeliveryMethod(TicketDeliveryMethod.ELECTRONIC) + .ticketNumber("123-1234-151555") + .travelAgencyCode("12345") + .travelAgencyInvoiceNumber("EG15555155") + .travelAgencyName("ACME Agency") + .travelAgencyPlanName("B733") + .build()) + .build()) .call(); if (res.checkoutSession().isPresent()) { @@ -91,6 +211,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); @@ -156,6 +277,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); @@ -217,6 +339,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); diff --git a/docs/sdks/cryptogram/README.md b/docs/sdks/cryptogram/README.md index b9c7adcd..3190426f 100644 --- a/docs/sdks/cryptogram/README.md +++ b/docs/sdks/cryptogram/README.md @@ -27,6 +27,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); diff --git a/docs/sdks/digitalwallets/README.md b/docs/sdks/digitalwallets/README.md index a45da88f..77a705b7 100644 --- a/docs/sdks/digitalwallets/README.md +++ b/docs/sdks/digitalwallets/README.md @@ -32,6 +32,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); @@ -98,6 +99,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); @@ -158,6 +160,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); @@ -220,6 +223,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); @@ -283,6 +287,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); diff --git a/docs/sdks/domains/README.md b/docs/sdks/domains/README.md index 086a3472..4e723776 100644 --- a/docs/sdks/domains/README.md +++ b/docs/sdks/domains/README.md @@ -28,6 +28,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); @@ -95,6 +96,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); diff --git a/docs/sdks/events/README.md b/docs/sdks/events/README.md index cb93fdc3..2f87e7b5 100644 --- a/docs/sdks/events/README.md +++ b/docs/sdks/events/README.md @@ -26,11 +26,14 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("") .bearerAuth("") .build(); ListTransactionEventsResponse res = sdk.transactions().events().list() .transactionId("7099948d-7286-47e4-aad8-b68f7eb44591") + .cursor("ZXhhbXBsZTE") + .limit(100L) .call(); if (res.transactionEvents().isPresent()) { diff --git a/docs/sdks/executions/README.md b/docs/sdks/executions/README.md index 0fd6a092..4984b6e3 100644 --- a/docs/sdks/executions/README.md +++ b/docs/sdks/executions/README.md @@ -26,11 +26,13 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("") .bearerAuth("") .build(); sdk.reports().executions().list() .reportId("4d4c7123-b794-4fad-b1b9-5ab2606e6bbe") + .limit(20L) .callAsStream() .forEach(item -> { // handle item @@ -90,6 +92,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("") .bearerAuth("") .build(); diff --git a/docs/sdks/giftcards/README.md b/docs/sdks/giftcards/README.md index 20306918..f72a479f 100644 --- a/docs/sdks/giftcards/README.md +++ b/docs/sdks/giftcards/README.md @@ -29,6 +29,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); @@ -91,6 +92,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); @@ -154,6 +156,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); @@ -219,6 +222,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); diff --git a/docs/sdks/jobs/README.md b/docs/sdks/jobs/README.md index f5521877..748bf9b2 100644 --- a/docs/sdks/jobs/README.md +++ b/docs/sdks/jobs/README.md @@ -28,6 +28,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); diff --git a/docs/sdks/merchantaccounts/README.md b/docs/sdks/merchantaccounts/README.md index f443e453..8f1fa0a6 100644 --- a/docs/sdks/merchantaccounts/README.md +++ b/docs/sdks/merchantaccounts/README.md @@ -32,6 +32,9 @@ public class Application { .build(); sdk.merchantAccounts().list() + .cursor("ZXhhbXBsZTE") + .limit(20L) + .search("merchant-12345") .callAsStream() .forEach(item -> { // handle item @@ -97,6 +100,7 @@ public class Application { MerchantAccountCreate req = MerchantAccountCreate.builder() .id("merchant-12345") .displayName("Example") + .accountUpdaterEnabled(true) .build(); CreateMerchantAccountResponse res = sdk.merchantAccounts().create() @@ -225,6 +229,7 @@ public class Application { UpdateMerchantAccountResponse res = sdk.merchantAccounts().update() .merchantAccountId("merchant-12345") .merchantAccountUpdate(MerchantAccountUpdate.builder() + .accountUpdaterEnabled(true) .build()) .call(); diff --git a/docs/sdks/networktokens/README.md b/docs/sdks/networktokens/README.md index d200f8b6..f7c1c660 100644 --- a/docs/sdks/networktokens/README.md +++ b/docs/sdks/networktokens/README.md @@ -30,6 +30,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); @@ -93,6 +94,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); @@ -160,6 +162,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); @@ -224,6 +227,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); @@ -288,6 +292,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); diff --git a/docs/sdks/paymentlinks/README.md b/docs/sdks/paymentlinks/README.md new file mode 100644 index 00000000..21742022 --- /dev/null +++ b/docs/sdks/paymentlinks/README.md @@ -0,0 +1,266 @@ +# PaymentLinks +(*paymentLinks()*) + +## Overview + +### Available Operations + +* [create](#create) - Add a payment link +* [list](#list) - List all payment links +* [expire](#expire) - Expire a payment link +* [get](#get) - Get payment link + +## create + +Create a new payment link. + +### Example Usage + +```java +package hello.world; + +import com.gr4vy.sdk.Gr4vy; +import com.gr4vy.sdk.models.components.PaymentLinkCreate; +import com.gr4vy.sdk.models.errors.*; +import com.gr4vy.sdk.models.operations.AddPaymentLinkResponse; +import java.lang.Exception; + +public class Application { + + public static void main(String[] args) throws Exception { + + Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("") + .bearerAuth("") + .build(); + + AddPaymentLinkResponse res = sdk.paymentLinks().create() + .paymentLinkCreate(PaymentLinkCreate.builder() + .amount(1299L) + .country("DE") + .currency("EUR") + .build()) + .call(); + + if (res.paymentLink().isPresent()) { + // handle response + } + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `merchantAccountId` | *JsonNullable\* | :heavy_minus_sign: | The ID of the merchant account to use for this request. | +| `paymentLinkCreate` | [PaymentLinkCreate](../../models/components/PaymentLinkCreate.md) | :heavy_check_mark: | N/A | + +### Response + +**[AddPaymentLinkResponse](../../models/operations/AddPaymentLinkResponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------------------------- | --------------------------------- | --------------------------------- | +| models/errors/Error400 | 400 | application/json | +| models/errors/Error401 | 401 | application/json | +| models/errors/Error403 | 403 | application/json | +| models/errors/Error404 | 404 | application/json | +| models/errors/Error405 | 405 | application/json | +| models/errors/Error409 | 409 | application/json | +| models/errors/HTTPValidationError | 422 | application/json | +| models/errors/Error425 | 425 | application/json | +| models/errors/Error429 | 429 | application/json | +| models/errors/Error500 | 500 | application/json | +| models/errors/Error502 | 502 | application/json | +| models/errors/Error504 | 504 | application/json | +| models/errors/APIException | 4XX, 5XX | \*/\* | + +## list + +List all created payment links. + +### Example Usage + +```java +package hello.world; + +import com.gr4vy.sdk.Gr4vy; +import com.gr4vy.sdk.models.errors.*; +import java.lang.Exception; + +public class Application { + + public static void main(String[] args) throws Exception { + + Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("") + .bearerAuth("") + .build(); + + sdk.paymentLinks().list() + .limit(20L) + .callAsStream() + .forEach(item -> { + // handle item + }); + + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | +| `cursor` | *JsonNullable\* | :heavy_minus_sign: | A pointer to the page of results to return. | ZXhhbXBsZTE | +| `limit` | *Optional\* | :heavy_minus_sign: | The maximum number of items that are returned. | 20 | +| `merchantAccountId` | *JsonNullable\* | :heavy_minus_sign: | The ID of the merchant account to use for this request. | | + +### Response + +**[ListPaymentLinksResponse](../../models/operations/ListPaymentLinksResponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------------------------- | --------------------------------- | --------------------------------- | +| models/errors/Error400 | 400 | application/json | +| models/errors/Error401 | 401 | application/json | +| models/errors/Error403 | 403 | application/json | +| models/errors/Error404 | 404 | application/json | +| models/errors/Error405 | 405 | application/json | +| models/errors/Error409 | 409 | application/json | +| models/errors/HTTPValidationError | 422 | application/json | +| models/errors/Error425 | 425 | application/json | +| models/errors/Error429 | 429 | application/json | +| models/errors/Error500 | 500 | application/json | +| models/errors/Error502 | 502 | application/json | +| models/errors/Error504 | 504 | application/json | +| models/errors/APIException | 4XX, 5XX | \*/\* | + +## expire + +Expire an existing payment link. + +### Example Usage + +```java +package hello.world; + +import com.gr4vy.sdk.Gr4vy; +import com.gr4vy.sdk.models.errors.*; +import com.gr4vy.sdk.models.operations.ExpirePaymentLinkResponse; +import java.lang.Exception; + +public class Application { + + public static void main(String[] args) throws Exception { + + Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("") + .bearerAuth("") + .build(); + + ExpirePaymentLinkResponse res = sdk.paymentLinks().expire() + .paymentLinkId("a1b2c3d4-5678-90ab-cdef-1234567890ab") + .call(); + + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | +| `paymentLinkId` | *String* | :heavy_check_mark: | The unique identifier for the payment link. | a1b2c3d4-5678-90ab-cdef-1234567890ab | +| `merchantAccountId` | *JsonNullable\* | :heavy_minus_sign: | The ID of the merchant account to use for this request. | | + +### Response + +**[ExpirePaymentLinkResponse](../../models/operations/ExpirePaymentLinkResponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------------------------- | --------------------------------- | --------------------------------- | +| models/errors/Error400 | 400 | application/json | +| models/errors/Error401 | 401 | application/json | +| models/errors/Error403 | 403 | application/json | +| models/errors/Error404 | 404 | application/json | +| models/errors/Error405 | 405 | application/json | +| models/errors/Error409 | 409 | application/json | +| models/errors/HTTPValidationError | 422 | application/json | +| models/errors/Error425 | 425 | application/json | +| models/errors/Error429 | 429 | application/json | +| models/errors/Error500 | 500 | application/json | +| models/errors/Error502 | 502 | application/json | +| models/errors/Error504 | 504 | application/json | +| models/errors/APIException | 4XX, 5XX | \*/\* | + +## get + +Fetch the details for a payment link. + +### Example Usage + +```java +package hello.world; + +import com.gr4vy.sdk.Gr4vy; +import com.gr4vy.sdk.models.errors.*; +import com.gr4vy.sdk.models.operations.GetPaymentLinkResponse; +import java.lang.Exception; + +public class Application { + + public static void main(String[] args) throws Exception { + + Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("") + .bearerAuth("") + .build(); + + GetPaymentLinkResponse res = sdk.paymentLinks().get() + .paymentLinkId("a1b2c3d4-5678-90ab-cdef-1234567890ab") + .call(); + + if (res.paymentLink().isPresent()) { + // handle response + } + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | +| `paymentLinkId` | *String* | :heavy_check_mark: | The unique identifier for the payment link. | a1b2c3d4-5678-90ab-cdef-1234567890ab | +| `merchantAccountId` | *JsonNullable\* | :heavy_minus_sign: | The ID of the merchant account to use for this request. | | + +### Response + +**[GetPaymentLinkResponse](../../models/operations/GetPaymentLinkResponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------------------------- | --------------------------------- | --------------------------------- | +| models/errors/Error400 | 400 | application/json | +| models/errors/Error401 | 401 | application/json | +| models/errors/Error403 | 403 | application/json | +| models/errors/Error404 | 404 | application/json | +| models/errors/Error405 | 405 | application/json | +| models/errors/Error409 | 409 | application/json | +| models/errors/HTTPValidationError | 422 | application/json | +| models/errors/Error425 | 425 | application/json | +| models/errors/Error429 | 429 | application/json | +| models/errors/Error500 | 500 | application/json | +| models/errors/Error502 | 502 | application/json | +| models/errors/Error504 | 504 | application/json | +| models/errors/APIException | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/paymentmethods/README.md b/docs/sdks/paymentmethods/README.md index b3a32143..29527e24 100644 --- a/docs/sdks/paymentmethods/README.md +++ b/docs/sdks/paymentmethods/README.md @@ -29,10 +29,15 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); ListPaymentMethodsRequest req = ListPaymentMethodsRequest.builder() + .cursor("ZXhhbXBsZTE") + .buyerId("fe26475d-ec3e-4884-9553-f7356683f7f9") + .buyerExternalIdentifier("buyer-12345") + .externalIdentifier("payment-method-12345") .build(); sdk.paymentMethods().list() @@ -95,6 +100,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); @@ -159,6 +165,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); @@ -221,6 +228,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); diff --git a/docs/sdks/paymentoptions/README.md b/docs/sdks/paymentoptions/README.md index ab6bd9fc..11302e17 100644 --- a/docs/sdks/paymentoptions/README.md +++ b/docs/sdks/paymentoptions/README.md @@ -27,6 +27,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); diff --git a/docs/sdks/paymentservicedefinitions/README.md b/docs/sdks/paymentservicedefinitions/README.md index 6a015dd0..04de366c 100644 --- a/docs/sdks/paymentservicedefinitions/README.md +++ b/docs/sdks/paymentservicedefinitions/README.md @@ -31,6 +31,8 @@ public class Application { .build(); sdk.paymentServiceDefinitions().list() + .cursor("ZXhhbXBsZTE") + .limit(20L) .callAsStream() .forEach(item -> { // handle item diff --git a/docs/sdks/paymentservices/README.md b/docs/sdks/paymentservices/README.md index 3afac3f7..62042bf4 100644 --- a/docs/sdks/paymentservices/README.md +++ b/docs/sdks/paymentservices/README.md @@ -32,10 +32,13 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); ListPaymentServicesRequest req = ListPaymentServicesRequest.builder() + .cursor("ZXhhbXBsZTE") + .deleted(true) .build(); sdk.paymentServices().list() @@ -99,6 +102,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); @@ -123,6 +127,8 @@ public class Application { "US", "DE", "GB")) + .threeDSecureEnabled(true) + .settlementReportingEnabled(true) .build()) .call(); @@ -181,6 +187,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); @@ -244,12 +251,14 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); CreatePaymentServiceResponse res = sdk.paymentServices().update() .paymentServiceId("fffd152a-9532-4087-9a4f-de58754210f0") .paymentServiceUpdate(PaymentServiceUpdate.builder() + .settlementReportingEnabled(true) .build()) .call(); @@ -309,6 +318,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); @@ -373,6 +383,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); @@ -439,6 +450,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); diff --git a/docs/sdks/paymentservicetokens/README.md b/docs/sdks/paymentservicetokens/README.md index da4f2d50..2196227c 100644 --- a/docs/sdks/paymentservicetokens/README.md +++ b/docs/sdks/paymentservicetokens/README.md @@ -28,11 +28,13 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); ListPaymentMethodPaymentServiceTokensResponse res = sdk.paymentMethods().paymentServiceTokens().list() .paymentMethodId("ef9496d8-53a5-4aad-8ca2-00eb68334389") + .paymentServiceId("fffd152a-9532-4087-9a4f-de58754210f0") .call(); if (res.paymentServiceTokens().isPresent()) { @@ -92,6 +94,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); @@ -159,6 +162,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); diff --git a/docs/sdks/payouts/README.md b/docs/sdks/payouts/README.md index 1ec5660d..ac35dc4e 100644 --- a/docs/sdks/payouts/README.md +++ b/docs/sdks/payouts/README.md @@ -27,10 +27,13 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); sdk.payouts().list() + .cursor("ZXhhbXBsZTE") + .limit(20L) .callAsStream() .forEach(item -> { // handle item @@ -90,6 +93,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); @@ -159,6 +163,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); diff --git a/docs/sdks/refunds/README.md b/docs/sdks/refunds/README.md index 25b26769..1bdb476a 100644 --- a/docs/sdks/refunds/README.md +++ b/docs/sdks/refunds/README.md @@ -26,6 +26,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); diff --git a/docs/sdks/reports/README.md b/docs/sdks/reports/README.md index ce08b3ca..44cd17de 100644 --- a/docs/sdks/reports/README.md +++ b/docs/sdks/reports/README.md @@ -29,6 +29,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("") .bearerAuth("") .build(); @@ -95,6 +96,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("") .bearerAuth("") .build(); @@ -110,6 +112,7 @@ public class Application { Map.entry("end", "day_end"), Map.entry("start", "day_start"))))))) .build()) + .scheduleTimezone("UTC") .build()) .call(); @@ -168,6 +171,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("") .bearerAuth("") .build(); @@ -231,6 +235,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("") .bearerAuth("") .build(); diff --git a/docs/sdks/reportsexecutions/README.md b/docs/sdks/reportsexecutions/README.md index c7988328..d46d837d 100644 --- a/docs/sdks/reportsexecutions/README.md +++ b/docs/sdks/reportsexecutions/README.md @@ -28,6 +28,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("") .bearerAuth("") .build(); @@ -92,6 +93,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("") .bearerAuth("") .build(); diff --git a/docs/sdks/sessions/README.md b/docs/sdks/sessions/README.md index 2413ba19..4f6ea849 100644 --- a/docs/sdks/sessions/README.md +++ b/docs/sdks/sessions/README.md @@ -29,6 +29,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); @@ -94,6 +95,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); diff --git a/docs/sdks/shippingdetails/README.md b/docs/sdks/shippingdetails/README.md index ba5559ec..ded66299 100644 --- a/docs/sdks/shippingdetails/README.md +++ b/docs/sdks/shippingdetails/README.md @@ -31,6 +31,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); @@ -96,6 +97,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); @@ -158,6 +160,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); @@ -223,6 +226,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); @@ -290,6 +294,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); diff --git a/docs/sdks/transactions/README.md b/docs/sdks/transactions/README.md index 04da69ca..fa5dc274 100644 --- a/docs/sdks/transactions/README.md +++ b/docs/sdks/transactions/README.md @@ -22,19 +22,73 @@ List all transactions for a specific merchant account sorted by most recently cr package hello.world; import com.gr4vy.sdk.Gr4vy; +import com.gr4vy.sdk.models.components.*; import com.gr4vy.sdk.models.errors.*; import com.gr4vy.sdk.models.operations.ListTransactionsRequest; import java.lang.Exception; +import java.time.OffsetDateTime; +import java.util.List; public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); ListTransactionsRequest req = ListTransactionsRequest.builder() + .cursor("ZXhhbXBsZTE") + .createdAtLte(OffsetDateTime.parse("2022-01-01T12:00:00+08:00")) + .createdAtGte(OffsetDateTime.parse("2022-01-01T12:00:00+08:00")) + .updatedAtLte(OffsetDateTime.parse("2022-01-01T12:00:00+08:00")) + .updatedAtGte(OffsetDateTime.parse("2022-01-01T12:00:00+08:00")) + .search("transaction-12345") + .buyerExternalIdentifier("buyer-12345") + .buyerId("fe26475d-ec3e-4884-9553-f7356683f7f9") + .buyerEmailAddress("john@example.com") + .buyerSearch("John") + .ipAddress("8.214.133.47") + .status(List.of( + TransactionStatus.AUTHORIZATION_SUCCEEDED)) + .id("7099948d-7286-47e4-aad8-b68f7eb44591") + .paymentServiceTransactionId("tx-12345") + .externalIdentifier("transaction-12345") + .metadata(List.of( + "{\"first_key\":\"first_value\",\"second_key\":\"second_value\"}")) + .amountEq(1299L) + .amountLte(1299L) + .amountGte(1299L) + .currency(List.of( + "USD")) + .country(List.of( + "US")) + .paymentServiceId(List.of( + "fffd152a-9532-4087-9a4f-de58754210f0")) + .paymentMethodId("ef9496d8-53a5-4aad-8ca2-00eb68334389") + .paymentMethodLabel("1234") + .paymentMethodScheme("[\"visa\"]") + .paymentMethodCountry("[\"US\"]") + .paymentMethodFingerprint("a50b85c200ee0795d6fd33a5c66f37a4564f554355c5b46a756aac485dd168a4") + .method(List.of( + Method.CARD)) + .errorCode(List.of( + "insufficient_funds")) + .hasRefunds(true) + .pendingReview(true) + .checkoutSessionId("4137b1cf-39ac-42a8-bad6-1c680d5dab6b") + .reconciliationId("7jZXl4gBUNl0CnaLEnfXbt") + .hasGiftCardRedemptions(true) + .giftCardId("356d56e5-fe16-42ae-97ee-8d55d846ae2e") + .giftCardLast4("7890") + .hasSettlements(true) + .paymentMethodBin("411111") + .paymentSource(List.of( + TransactionPaymentSource.RECURRING)) + .isSubsequentPayment(true) + .merchantInitiated(true) + .used3ds(true) .build(); sdk.transactions().list() @@ -96,13 +150,20 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); CreateTransactionResponse res = sdk.transactions().create() + .idempotencyKey("request-12345") .transactionCreate(TransactionCreate.builder() .amount(1299L) .currency("EUR") + .store(true) + .isSubsequentPayment(true) + .merchantInitiated(true) + .asyncCapture(true) + .accountFundingTransaction(true) .build()) .call(); @@ -162,6 +223,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); @@ -225,6 +287,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); @@ -290,6 +353,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); @@ -352,6 +416,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); diff --git a/docs/sdks/transactionsrefunds/README.md b/docs/sdks/transactionsrefunds/README.md index d7735403..5f9c52ef 100644 --- a/docs/sdks/transactionsrefunds/README.md +++ b/docs/sdks/transactionsrefunds/README.md @@ -28,6 +28,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); @@ -91,6 +92,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); @@ -156,6 +158,7 @@ public class Application { public static void main(String[] args) throws Exception { Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("default") .bearerAuth("") .build(); diff --git a/gradle.properties b/gradle.properties index d228c90e..6d28fc78 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ groupId=com.gr4vy artifactId=sdk -version=1.0.0-beta.7 \ No newline at end of file +version=1.0.0-beta.8 \ No newline at end of file diff --git a/src/main/java/com/gr4vy/sdk/Gr4vy.java b/src/main/java/com/gr4vy/sdk/Gr4vy.java index ee6dd546..ca05f015 100644 --- a/src/main/java/com/gr4vy/sdk/Gr4vy.java +++ b/src/main/java/com/gr4vy/sdk/Gr4vy.java @@ -80,6 +80,8 @@ public String server() { private final Payouts payouts; + private final PaymentLinks paymentLinks; + public AccountUpdater accountUpdater() { return accountUpdater; } @@ -148,6 +150,10 @@ public Payouts payouts() { return payouts; } + public PaymentLinks paymentLinks() { + return paymentLinks; + } + private SDKConfiguration sdkConfiguration; /** @@ -325,6 +331,7 @@ private Gr4vy(SDKConfiguration sdkConfiguration) { this.checkoutSessions = new CheckoutSessions(sdkConfiguration); this.merchantAccounts = new MerchantAccounts(sdkConfiguration); this.payouts = new Payouts(sdkConfiguration); + this.paymentLinks = new PaymentLinks(sdkConfiguration); } } diff --git a/src/main/java/com/gr4vy/sdk/PaymentLinks.java b/src/main/java/com/gr4vy/sdk/PaymentLinks.java new file mode 100644 index 00000000..5c2832a8 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/PaymentLinks.java @@ -0,0 +1,1567 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.gr4vy.sdk.models.components.CollectionPaymentLink; +import com.gr4vy.sdk.models.components.PaymentLink; +import com.gr4vy.sdk.models.components.PaymentLinkCreate; +import com.gr4vy.sdk.models.errors.APIException; +import com.gr4vy.sdk.models.errors.Error400; +import com.gr4vy.sdk.models.errors.Error401; +import com.gr4vy.sdk.models.errors.Error403; +import com.gr4vy.sdk.models.errors.Error404; +import com.gr4vy.sdk.models.errors.Error405; +import com.gr4vy.sdk.models.errors.Error409; +import com.gr4vy.sdk.models.errors.Error425; +import com.gr4vy.sdk.models.errors.Error429; +import com.gr4vy.sdk.models.errors.Error500; +import com.gr4vy.sdk.models.errors.Error502; +import com.gr4vy.sdk.models.errors.Error504; +import com.gr4vy.sdk.models.errors.HTTPValidationError; +import com.gr4vy.sdk.models.operations.AddPaymentLinkRequest; +import com.gr4vy.sdk.models.operations.AddPaymentLinkRequestBuilder; +import com.gr4vy.sdk.models.operations.AddPaymentLinkResponse; +import com.gr4vy.sdk.models.operations.ExpirePaymentLinkRequest; +import com.gr4vy.sdk.models.operations.ExpirePaymentLinkRequestBuilder; +import com.gr4vy.sdk.models.operations.ExpirePaymentLinkResponse; +import com.gr4vy.sdk.models.operations.GetPaymentLinkRequest; +import com.gr4vy.sdk.models.operations.GetPaymentLinkRequestBuilder; +import com.gr4vy.sdk.models.operations.GetPaymentLinkResponse; +import com.gr4vy.sdk.models.operations.ListPaymentLinksRequest; +import com.gr4vy.sdk.models.operations.ListPaymentLinksRequestBuilder; +import com.gr4vy.sdk.models.operations.ListPaymentLinksResponse; +import com.gr4vy.sdk.models.operations.SDKMethodInterfaces.*; +import com.gr4vy.sdk.utils.BackoffStrategy; +import com.gr4vy.sdk.utils.HTTPClient; +import com.gr4vy.sdk.utils.HTTPRequest; +import com.gr4vy.sdk.utils.Hook.AfterErrorContextImpl; +import com.gr4vy.sdk.utils.Hook.AfterSuccessContextImpl; +import com.gr4vy.sdk.utils.Hook.BeforeRequestContextImpl; +import com.gr4vy.sdk.utils.Options; +import com.gr4vy.sdk.utils.Retries.NonRetryableException; +import com.gr4vy.sdk.utils.Retries; +import com.gr4vy.sdk.utils.RetryConfig; +import com.gr4vy.sdk.utils.SerializedBody; +import com.gr4vy.sdk.utils.Utils.JsonShape; +import com.gr4vy.sdk.utils.Utils; +import com.jayway.jsonpath.Configuration; +import com.jayway.jsonpath.JsonPath; +import com.jayway.jsonpath.Option; +import com.jayway.jsonpath.ReadContext; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.Long; +import java.lang.Object; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.TimeUnit; +import org.openapitools.jackson.nullable.JsonNullable; + +public class PaymentLinks implements + MethodCallAddPaymentLink, + MethodCallListPaymentLinks, + MethodCallExpirePaymentLink, + MethodCallGetPaymentLink { + + private final SDKConfiguration sdkConfiguration; + + PaymentLinks(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + + /** + * Add a payment link + * + *

Create a new payment link. + * + * @return The call builder + */ + public AddPaymentLinkRequestBuilder create() { + return new AddPaymentLinkRequestBuilder(this); + } + + /** + * Add a payment link + * + *

Create a new payment link. + * + * @param paymentLinkCreate + * @return The response from the API call + * @throws Exception if the API call fails + */ + public AddPaymentLinkResponse create( + PaymentLinkCreate paymentLinkCreate) throws Exception { + return create(JsonNullable.undefined(), paymentLinkCreate); + } + + /** + * Add a payment link + * + *

Create a new payment link. + * + * @param merchantAccountId + * @param paymentLinkCreate + * @return The response from the API call + * @throws Exception if the API call fails + */ + public AddPaymentLinkResponse create( + JsonNullable merchantAccountId, + PaymentLinkCreate paymentLinkCreate) throws Exception { + AddPaymentLinkRequest request = + AddPaymentLinkRequest + .builder() + .merchantAccountId(merchantAccountId) + .paymentLinkCreate(paymentLinkCreate) + .build(); + + String _baseUrl = Utils.templateUrl( + this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); + String _url = Utils.generateURL( + _baseUrl, + "/payment-links"); + + HTTPRequest _req = new HTTPRequest(_url, "POST"); + Object _convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() {}); + SerializedBody _serializedRequestBody = Utils.serializeRequestBody( + _convertedRequest, + "paymentLinkCreate", + "json", + false); + if (_serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + _req.setBody(Optional.ofNullable(_serializedRequestBody)); + _req.addHeader("Accept", "application/json") + .addHeader("user-agent", + SDKConfiguration.USER_AGENT); + _req.addHeaders(Utils.getHeadersFromMetadata(request, this.sdkConfiguration.globals)); + + Optional _hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); + Utils.configureSecurity(_req, + this.sdkConfiguration.securitySource().getSecurity()); + HTTPClient _client = this.sdkConfiguration.client(); + HttpRequest _r = + sdkConfiguration.hooks() + .beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + _baseUrl, + "add_payment_link", + Optional.of(List.of()), + _hookSecuritySource), + _req.build()); + HttpResponse _httpRes; + try { + _httpRes = _client.send(_r); + if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "401", "403", "404", "405", "409", "422", "425", "429", "4XX", "500", "502", "504", "5XX")) { + _httpRes = sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + _baseUrl, + "add_payment_link", + Optional.of(List.of()), + _hookSecuritySource), + Optional.of(_httpRes), + Optional.empty()); + } else { + _httpRes = sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + _baseUrl, + "add_payment_link", + Optional.of(List.of()), + _hookSecuritySource), + _httpRes); + } + } catch (Exception _e) { + _httpRes = sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + _baseUrl, + "add_payment_link", + Optional.of(List.of()), + _hookSecuritySource), + Optional.empty(), + Optional.of(_e)); + } + String _contentType = _httpRes + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + AddPaymentLinkResponse.Builder _resBuilder = + AddPaymentLinkResponse + .builder() + .contentType(_contentType) + .statusCode(_httpRes.statusCode()) + .rawResponse(_httpRes); + + AddPaymentLinkResponse _res = _resBuilder.build(); + + if (Utils.statusCodeMatches(_httpRes.statusCode(), "201")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + PaymentLink _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _res.withPaymentLink(Optional.ofNullable(_out)); + return _res; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "400")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error400 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "401")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error401 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "403")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error403 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "404")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error404 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "405")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error405 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "409")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error409 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "422")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + HTTPValidationError _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "425")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error425 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "429")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error429 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "500")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error500 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "502")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error502 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "504")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error504 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX")) { + // no content + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(_httpRes)); + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "5XX")) { + // no content + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(_httpRes)); + } + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected status code received: " + _httpRes.statusCode(), + Utils.extractByteArrayFromBody(_httpRes)); + } + + + + /** + * List all payment links + * + *

List all created payment links. + * + * @return The call builder + */ + public ListPaymentLinksRequestBuilder list() { + return new ListPaymentLinksRequestBuilder(this); + } + + /** + * List all payment links + * + *

List all created payment links. + * + * @return The response from the API call + * @throws Exception if the API call fails + */ + public ListPaymentLinksResponse listDirect() throws Exception { + return list(JsonNullable.undefined(), Optional.empty(), JsonNullable.undefined(), Optional.empty()); + } + + /** + * List all payment links + * + *

List all created payment links. + * + * @param cursor A pointer to the page of results to return. + * @param limit The maximum number of items that are returned. + * @param merchantAccountId + * @param options additional options + * @return The response from the API call + * @throws Exception if the API call fails + */ + public ListPaymentLinksResponse list( + JsonNullable cursor, + Optional limit, + JsonNullable merchantAccountId, + Optional options) throws Exception { + + if (options.isPresent()) { + options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG)); + } + ListPaymentLinksRequest request = + ListPaymentLinksRequest + .builder() + .cursor(cursor) + .limit(limit) + .merchantAccountId(merchantAccountId) + .build(); + + String _baseUrl = Utils.templateUrl( + this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); + String _url = Utils.generateURL( + _baseUrl, + "/payment-links"); + + HTTPRequest _req = new HTTPRequest(_url, "GET"); + _req.addHeader("Accept", "application/json") + .addHeader("user-agent", + SDKConfiguration.USER_AGENT); + + _req.addQueryParams(Utils.getQueryParams( + ListPaymentLinksRequest.class, + request, + this.sdkConfiguration.globals)); + _req.addHeaders(Utils.getHeadersFromMetadata(request, this.sdkConfiguration.globals)); + + Optional _hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); + Utils.configureSecurity(_req, + this.sdkConfiguration.securitySource().getSecurity()); + HTTPClient _client = this.sdkConfiguration.client(); + HTTPRequest _finalReq = _req; + RetryConfig _retryConfig; + if (options.isPresent() && options.get().retryConfig().isPresent()) { + _retryConfig = options.get().retryConfig().get(); + } else if (this.sdkConfiguration.retryConfig().isPresent()) { + _retryConfig = this.sdkConfiguration.retryConfig().get(); + } else { + _retryConfig = RetryConfig.builder() + .backoff(BackoffStrategy.builder() + .initialInterval(200, TimeUnit.MILLISECONDS) + .maxInterval(200, TimeUnit.MILLISECONDS) + .baseFactor((double)(1)) + .maxElapsedTime(1000, TimeUnit.MILLISECONDS) + .retryConnectError(true) + .build()) + .build(); + } + List _statusCodes = new ArrayList<>(); + _statusCodes.add("5XX"); + Retries _retries = Retries.builder() + .action(() -> { + HttpRequest _r = null; + try { + _r = sdkConfiguration.hooks() + .beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + _baseUrl, + "list_payment_links", + Optional.of(List.of()), + _hookSecuritySource), + _finalReq.build()); + } catch (Exception _e) { + throw new NonRetryableException(_e); + } + try { + return _client.send(_r); + } catch (Exception _e) { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + _baseUrl, + "list_payment_links", + Optional.of(List.of()), + _hookSecuritySource), + Optional.empty(), + Optional.of(_e)); + } + }) + .retryConfig(_retryConfig) + .statusCodes(_statusCodes) + .build(); + HttpResponse _httpRes = sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + _baseUrl, + "list_payment_links", + Optional.of(List.of()), + _hookSecuritySource), + _retries.run()); + String _contentType = _httpRes + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + byte[] _fullResponse = Utils.extractByteArrayFromBody(_httpRes); + + @SuppressWarnings("deprecation") + ListPaymentLinksResponse.Builder _resBuilder = + ListPaymentLinksResponse + .builder() + .contentType(_contentType) + .statusCode(_httpRes.statusCode()) + .rawResponse(_httpRes) + .next(() -> { + if (request == null) { + return Optional.empty(); + } + String _stringBody = new String(_fullResponse, StandardCharsets.UTF_8); + Configuration _config = Configuration.defaultConfiguration() + .addOptions(Option.SUPPRESS_EXCEPTIONS); + ReadContext _body = JsonPath.using(_config).parse(_stringBody); + String _nextCursor = _body.read("$.next_cursor", String.class); + if (_nextCursor == null) { + return Optional.empty(); + } + ListPaymentLinksRequestBuilder _nextRequest = list() + .cursor(_nextCursor) + .limit(limit) + .merchantAccountId(merchantAccountId); + return Optional.of(_nextRequest.call()); + }); + + ListPaymentLinksResponse _res = _resBuilder.build(); + + if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + CollectionPaymentLink _out = Utils.mapper().readValue( + new String(_fullResponse, StandardCharsets.UTF_8), + new TypeReference() {}); + _res.withCollectionPaymentLink(Optional.ofNullable(_out)); + return _res; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + _fullResponse); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "400")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error400 _out = Utils.mapper().readValue( + new String(_fullResponse, StandardCharsets.UTF_8), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + _fullResponse); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "401")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error401 _out = Utils.mapper().readValue( + new String(_fullResponse, StandardCharsets.UTF_8), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + _fullResponse); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "403")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error403 _out = Utils.mapper().readValue( + new String(_fullResponse, StandardCharsets.UTF_8), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + _fullResponse); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "404")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error404 _out = Utils.mapper().readValue( + new String(_fullResponse, StandardCharsets.UTF_8), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + _fullResponse); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "405")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error405 _out = Utils.mapper().readValue( + new String(_fullResponse, StandardCharsets.UTF_8), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + _fullResponse); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "409")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error409 _out = Utils.mapper().readValue( + new String(_fullResponse, StandardCharsets.UTF_8), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + _fullResponse); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "422")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + HTTPValidationError _out = Utils.mapper().readValue( + new String(_fullResponse, StandardCharsets.UTF_8), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + _fullResponse); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "425")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error425 _out = Utils.mapper().readValue( + new String(_fullResponse, StandardCharsets.UTF_8), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + _fullResponse); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "429")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error429 _out = Utils.mapper().readValue( + new String(_fullResponse, StandardCharsets.UTF_8), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + _fullResponse); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "500")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error500 _out = Utils.mapper().readValue( + new String(_fullResponse, StandardCharsets.UTF_8), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + _fullResponse); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "502")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error502 _out = Utils.mapper().readValue( + new String(_fullResponse, StandardCharsets.UTF_8), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + _fullResponse); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "504")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error504 _out = Utils.mapper().readValue( + new String(_fullResponse, StandardCharsets.UTF_8), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + _fullResponse); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX")) { + // no content + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "API error occurred", + _fullResponse); + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "5XX")) { + // no content + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "API error occurred", + _fullResponse); + } + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected status code received: " + _httpRes.statusCode(), + _fullResponse); + } + + + + /** + * Expire a payment link + * + *

Expire an existing payment link. + * + * @return The call builder + */ + public ExpirePaymentLinkRequestBuilder expire() { + return new ExpirePaymentLinkRequestBuilder(this); + } + + /** + * Expire a payment link + * + *

Expire an existing payment link. + * + * @param paymentLinkId The unique identifier for the payment link. + * @return The response from the API call + * @throws Exception if the API call fails + */ + public ExpirePaymentLinkResponse expire( + String paymentLinkId) throws Exception { + return expire(paymentLinkId, JsonNullable.undefined()); + } + + /** + * Expire a payment link + * + *

Expire an existing payment link. + * + * @param paymentLinkId The unique identifier for the payment link. + * @param merchantAccountId + * @return The response from the API call + * @throws Exception if the API call fails + */ + public ExpirePaymentLinkResponse expire( + String paymentLinkId, + JsonNullable merchantAccountId) throws Exception { + ExpirePaymentLinkRequest request = + ExpirePaymentLinkRequest + .builder() + .paymentLinkId(paymentLinkId) + .merchantAccountId(merchantAccountId) + .build(); + + String _baseUrl = Utils.templateUrl( + this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); + String _url = Utils.generateURL( + ExpirePaymentLinkRequest.class, + _baseUrl, + "/payment-links/{payment_link_id}/expire", + request, this.sdkConfiguration.globals); + + HTTPRequest _req = new HTTPRequest(_url, "POST"); + _req.addHeader("Accept", "application/json") + .addHeader("user-agent", + SDKConfiguration.USER_AGENT); + _req.addHeaders(Utils.getHeadersFromMetadata(request, this.sdkConfiguration.globals)); + + Optional _hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); + Utils.configureSecurity(_req, + this.sdkConfiguration.securitySource().getSecurity()); + HTTPClient _client = this.sdkConfiguration.client(); + HttpRequest _r = + sdkConfiguration.hooks() + .beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + _baseUrl, + "expire_payment_link", + Optional.of(List.of()), + _hookSecuritySource), + _req.build()); + HttpResponse _httpRes; + try { + _httpRes = _client.send(_r); + if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "401", "403", "404", "405", "409", "422", "425", "429", "4XX", "500", "502", "504", "5XX")) { + _httpRes = sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + _baseUrl, + "expire_payment_link", + Optional.of(List.of()), + _hookSecuritySource), + Optional.of(_httpRes), + Optional.empty()); + } else { + _httpRes = sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + _baseUrl, + "expire_payment_link", + Optional.of(List.of()), + _hookSecuritySource), + _httpRes); + } + } catch (Exception _e) { + _httpRes = sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + _baseUrl, + "expire_payment_link", + Optional.of(List.of()), + _hookSecuritySource), + Optional.empty(), + Optional.of(_e)); + } + String _contentType = _httpRes + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + ExpirePaymentLinkResponse.Builder _resBuilder = + ExpirePaymentLinkResponse + .builder() + .contentType(_contentType) + .statusCode(_httpRes.statusCode()) + .rawResponse(_httpRes); + + ExpirePaymentLinkResponse _res = _resBuilder.build(); + + if (Utils.statusCodeMatches(_httpRes.statusCode(), "204")) { + // no content + return _res; + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "400")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error400 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "401")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error401 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "403")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error403 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "404")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error404 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "405")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error405 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "409")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error409 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "422")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + HTTPValidationError _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "425")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error425 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "429")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error429 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "500")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error500 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "502")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error502 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "504")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error504 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX")) { + // no content + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(_httpRes)); + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "5XX")) { + // no content + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(_httpRes)); + } + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected status code received: " + _httpRes.statusCode(), + Utils.extractByteArrayFromBody(_httpRes)); + } + + + + /** + * Get payment link + * + *

Fetch the details for a payment link. + * + * @return The call builder + */ + public GetPaymentLinkRequestBuilder get() { + return new GetPaymentLinkRequestBuilder(this); + } + + /** + * Get payment link + * + *

Fetch the details for a payment link. + * + * @param paymentLinkId The unique identifier for the payment link. + * @return The response from the API call + * @throws Exception if the API call fails + */ + public GetPaymentLinkResponse get( + String paymentLinkId) throws Exception { + return get(paymentLinkId, JsonNullable.undefined(), Optional.empty()); + } + + /** + * Get payment link + * + *

Fetch the details for a payment link. + * + * @param paymentLinkId The unique identifier for the payment link. + * @param merchantAccountId + * @param options additional options + * @return The response from the API call + * @throws Exception if the API call fails + */ + public GetPaymentLinkResponse get( + String paymentLinkId, + JsonNullable merchantAccountId, + Optional options) throws Exception { + + if (options.isPresent()) { + options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG)); + } + GetPaymentLinkRequest request = + GetPaymentLinkRequest + .builder() + .paymentLinkId(paymentLinkId) + .merchantAccountId(merchantAccountId) + .build(); + + String _baseUrl = Utils.templateUrl( + this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); + String _url = Utils.generateURL( + GetPaymentLinkRequest.class, + _baseUrl, + "/payment-links/{payment_link_id}", + request, this.sdkConfiguration.globals); + + HTTPRequest _req = new HTTPRequest(_url, "GET"); + _req.addHeader("Accept", "application/json") + .addHeader("user-agent", + SDKConfiguration.USER_AGENT); + _req.addHeaders(Utils.getHeadersFromMetadata(request, this.sdkConfiguration.globals)); + + Optional _hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); + Utils.configureSecurity(_req, + this.sdkConfiguration.securitySource().getSecurity()); + HTTPClient _client = this.sdkConfiguration.client(); + HTTPRequest _finalReq = _req; + RetryConfig _retryConfig; + if (options.isPresent() && options.get().retryConfig().isPresent()) { + _retryConfig = options.get().retryConfig().get(); + } else if (this.sdkConfiguration.retryConfig().isPresent()) { + _retryConfig = this.sdkConfiguration.retryConfig().get(); + } else { + _retryConfig = RetryConfig.builder() + .backoff(BackoffStrategy.builder() + .initialInterval(200, TimeUnit.MILLISECONDS) + .maxInterval(200, TimeUnit.MILLISECONDS) + .baseFactor((double)(1)) + .maxElapsedTime(1000, TimeUnit.MILLISECONDS) + .retryConnectError(true) + .build()) + .build(); + } + List _statusCodes = new ArrayList<>(); + _statusCodes.add("5XX"); + Retries _retries = Retries.builder() + .action(() -> { + HttpRequest _r = null; + try { + _r = sdkConfiguration.hooks() + .beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + _baseUrl, + "get_payment_link", + Optional.of(List.of()), + _hookSecuritySource), + _finalReq.build()); + } catch (Exception _e) { + throw new NonRetryableException(_e); + } + try { + return _client.send(_r); + } catch (Exception _e) { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + _baseUrl, + "get_payment_link", + Optional.of(List.of()), + _hookSecuritySource), + Optional.empty(), + Optional.of(_e)); + } + }) + .retryConfig(_retryConfig) + .statusCodes(_statusCodes) + .build(); + HttpResponse _httpRes = sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + _baseUrl, + "get_payment_link", + Optional.of(List.of()), + _hookSecuritySource), + _retries.run()); + String _contentType = _httpRes + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + GetPaymentLinkResponse.Builder _resBuilder = + GetPaymentLinkResponse + .builder() + .contentType(_contentType) + .statusCode(_httpRes.statusCode()) + .rawResponse(_httpRes); + + GetPaymentLinkResponse _res = _resBuilder.build(); + + if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + PaymentLink _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _res.withPaymentLink(Optional.ofNullable(_out)); + return _res; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "400")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error400 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "401")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error401 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "403")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error403 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "404")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error404 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "405")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error405 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "409")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error409 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "422")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + HTTPValidationError _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "425")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error425 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "429")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error429 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "500")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error500 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "502")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error502 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "504")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error504 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX")) { + // no content + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(_httpRes)); + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "5XX")) { + // no content + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(_httpRes)); + } + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected status code received: " + _httpRes.statusCode(), + Utils.extractByteArrayFromBody(_httpRes)); + } + +} diff --git a/src/main/java/com/gr4vy/sdk/SDKConfiguration.java b/src/main/java/com/gr4vy/sdk/SDKConfiguration.java index 6ec5695e..8140e03e 100644 --- a/src/main/java/com/gr4vy/sdk/SDKConfiguration.java +++ b/src/main/java/com/gr4vy/sdk/SDKConfiguration.java @@ -19,8 +19,8 @@ public class SDKConfiguration { private static final String LANGUAGE = "java"; public static final String OPENAPI_DOC_VERSION = "1.0.0"; - public static final String SDK_VERSION = "1.0.0-beta.7"; - public static final String GEN_VERSION = "2.618.0"; + public static final String SDK_VERSION = "1.0.0-beta.8"; + public static final String GEN_VERSION = "2.620.2"; private static final String BASE_PACKAGE = "com.gr4vy.sdk"; public static final String USER_AGENT = String.format("speakeasy-sdk/%s %s %s %s %s", diff --git a/src/main/java/com/gr4vy/sdk/models/components/CollectionPaymentLink.java b/src/main/java/com/gr4vy/sdk/models/components/CollectionPaymentLink.java new file mode 100644 index 00000000..18420425 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/components/CollectionPaymentLink.java @@ -0,0 +1,300 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.components; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.core.type.TypeReference; +import com.gr4vy.sdk.utils.LazySingletonValue; +import com.gr4vy.sdk.utils.Utils; +import java.lang.Long; +import java.lang.Override; +import java.lang.String; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import org.openapitools.jackson.nullable.JsonNullable; + +public class CollectionPaymentLink { + + /** + * A list of items returned for this request. + */ + @JsonProperty("items") + private List items; + + /** + * The number of items for this page. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("limit") + private Optional limit; + + /** + * The cursor pointing at the next page of items. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("next_cursor") + private JsonNullable nextCursor; + + /** + * The cursor pointing at the previous page of items. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("previous_cursor") + private JsonNullable previousCursor; + + @JsonCreator + public CollectionPaymentLink( + @JsonProperty("items") List items, + @JsonProperty("limit") Optional limit, + @JsonProperty("next_cursor") JsonNullable nextCursor, + @JsonProperty("previous_cursor") JsonNullable previousCursor) { + Utils.checkNotNull(items, "items"); + Utils.checkNotNull(limit, "limit"); + Utils.checkNotNull(nextCursor, "nextCursor"); + Utils.checkNotNull(previousCursor, "previousCursor"); + this.items = items; + this.limit = limit; + this.nextCursor = nextCursor; + this.previousCursor = previousCursor; + } + + public CollectionPaymentLink( + List items) { + this(items, Optional.empty(), JsonNullable.undefined(), JsonNullable.undefined()); + } + + /** + * A list of items returned for this request. + */ + @JsonIgnore + public List items() { + return items; + } + + /** + * The number of items for this page. + */ + @JsonIgnore + public Optional limit() { + return limit; + } + + /** + * The cursor pointing at the next page of items. + */ + @JsonIgnore + public JsonNullable nextCursor() { + return nextCursor; + } + + /** + * The cursor pointing at the previous page of items. + */ + @JsonIgnore + public JsonNullable previousCursor() { + return previousCursor; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * A list of items returned for this request. + */ + public CollectionPaymentLink withItems(List items) { + Utils.checkNotNull(items, "items"); + this.items = items; + return this; + } + + /** + * The number of items for this page. + */ + public CollectionPaymentLink withLimit(long limit) { + Utils.checkNotNull(limit, "limit"); + this.limit = Optional.ofNullable(limit); + return this; + } + + /** + * The number of items for this page. + */ + public CollectionPaymentLink withLimit(Optional limit) { + Utils.checkNotNull(limit, "limit"); + this.limit = limit; + return this; + } + + /** + * The cursor pointing at the next page of items. + */ + public CollectionPaymentLink withNextCursor(String nextCursor) { + Utils.checkNotNull(nextCursor, "nextCursor"); + this.nextCursor = JsonNullable.of(nextCursor); + return this; + } + + /** + * The cursor pointing at the next page of items. + */ + public CollectionPaymentLink withNextCursor(JsonNullable nextCursor) { + Utils.checkNotNull(nextCursor, "nextCursor"); + this.nextCursor = nextCursor; + return this; + } + + /** + * The cursor pointing at the previous page of items. + */ + public CollectionPaymentLink withPreviousCursor(String previousCursor) { + Utils.checkNotNull(previousCursor, "previousCursor"); + this.previousCursor = JsonNullable.of(previousCursor); + return this; + } + + /** + * The cursor pointing at the previous page of items. + */ + public CollectionPaymentLink withPreviousCursor(JsonNullable previousCursor) { + Utils.checkNotNull(previousCursor, "previousCursor"); + this.previousCursor = previousCursor; + return this; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CollectionPaymentLink other = (CollectionPaymentLink) o; + return + Objects.deepEquals(this.items, other.items) && + Objects.deepEquals(this.limit, other.limit) && + Objects.deepEquals(this.nextCursor, other.nextCursor) && + Objects.deepEquals(this.previousCursor, other.previousCursor); + } + + @Override + public int hashCode() { + return Objects.hash( + items, + limit, + nextCursor, + previousCursor); + } + + @Override + public String toString() { + return Utils.toString(CollectionPaymentLink.class, + "items", items, + "limit", limit, + "nextCursor", nextCursor, + "previousCursor", previousCursor); + } + + public final static class Builder { + + private List items; + + private Optional limit; + + private JsonNullable nextCursor = JsonNullable.undefined(); + + private JsonNullable previousCursor = JsonNullable.undefined(); + + private Builder() { + // force use of static builder() method + } + + /** + * A list of items returned for this request. + */ + public Builder items(List items) { + Utils.checkNotNull(items, "items"); + this.items = items; + return this; + } + + /** + * The number of items for this page. + */ + public Builder limit(long limit) { + Utils.checkNotNull(limit, "limit"); + this.limit = Optional.ofNullable(limit); + return this; + } + + /** + * The number of items for this page. + */ + public Builder limit(Optional limit) { + Utils.checkNotNull(limit, "limit"); + this.limit = limit; + return this; + } + + /** + * The cursor pointing at the next page of items. + */ + public Builder nextCursor(String nextCursor) { + Utils.checkNotNull(nextCursor, "nextCursor"); + this.nextCursor = JsonNullable.of(nextCursor); + return this; + } + + /** + * The cursor pointing at the next page of items. + */ + public Builder nextCursor(JsonNullable nextCursor) { + Utils.checkNotNull(nextCursor, "nextCursor"); + this.nextCursor = nextCursor; + return this; + } + + /** + * The cursor pointing at the previous page of items. + */ + public Builder previousCursor(String previousCursor) { + Utils.checkNotNull(previousCursor, "previousCursor"); + this.previousCursor = JsonNullable.of(previousCursor); + return this; + } + + /** + * The cursor pointing at the previous page of items. + */ + public Builder previousCursor(JsonNullable previousCursor) { + Utils.checkNotNull(previousCursor, "previousCursor"); + this.previousCursor = previousCursor; + return this; + } + + public CollectionPaymentLink build() { + if (limit == null) { + limit = _SINGLETON_VALUE_Limit.value(); + } + return new CollectionPaymentLink( + items, + limit, + nextCursor, + previousCursor); + } + + private static final LazySingletonValue> _SINGLETON_VALUE_Limit = + new LazySingletonValue<>( + "limit", + "20", + new TypeReference>() {}); + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/components/Locale.java b/src/main/java/com/gr4vy/sdk/models/components/Locale.java new file mode 100644 index 00000000..5b4c6c03 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/components/Locale.java @@ -0,0 +1,191 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.components; + +import com.fasterxml.jackson.core.JacksonException; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +/** + *

Wrapper class for an "open" enum. "Open" enums are those that are expected + * to evolve (particularly with the addition of enum members over time). If an + * open enum is used then the appearance of unexpected enum values (say in a + * response from an updated an API) will not bring about a runtime error thus + * ensuring that non-updated client versions can continue to work without error. + * + *

Note that instances are immutable and are singletons (an internal thread-safe + * cache is maintained to ensure that). As a consequence instances created with the + * same value will satisfy reference equality (via {@code ==}). + * + *

This class is intended to emulate an enum (in terms of common usage and with + * reference equality) but with the ability to carry unknown values. Unfortunately + * Java does not permit the use of an instance in a switch expression but you can + * use the {@code asEnum()} method (after dealing with the `Optional` appropriately). + * + */ +@JsonDeserialize(using = Locale._Deserializer.class) +@JsonSerialize(using = Locale._Serializer.class) +public class Locale { + + public static final Locale EN = new Locale("en"); + public static final Locale EN_GB = new Locale("en-GB"); + public static final Locale PT = new Locale("pt"); + public static final Locale PT_BR = new Locale("pt-BR"); + public static final Locale ES = new Locale("es"); + + // This map will grow whenever a Color gets created with a new + // unrecognized value (a potential memory leak if the user is not + // careful). Keep this field lower case to avoid clashing with + // generated member names which will always be upper cased (Java + // convention) + private static final Map values = createValuesMap(); + private static final Map enums = createEnumsMap(); + + private final String value; + + private Locale(String value) { + this.value = value; + } + + /** + * Returns a Locale with the given value. For a specific value the + * returned object will always be a singleton so reference equality + * is satisfied when the values are the same. + * + * @param value value to be wrapped as Locale + */ + public static Locale of(String value) { + synchronized (Locale.class) { + return values.computeIfAbsent(value, v -> new Locale(v)); + } + } + + public String value() { + return value; + } + + public Optional asEnum() { + return Optional.ofNullable(enums.getOrDefault(value, null)); + } + + public boolean isKnown() { + return asEnum().isPresent(); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public boolean equals(java.lang.Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + Locale other = (Locale) obj; + return Objects.equals(value, other.value); + } + + @Override + public String toString() { + return "Locale [value=" + value + "]"; + } + + // return an array just like an enum + public static Locale[] values() { + synchronized (Locale.class) { + return values.values().toArray(new Locale[] {}); + } + } + + private static final Map createValuesMap() { + Map map = new LinkedHashMap<>(); + map.put("en", EN); + map.put("en-GB", EN_GB); + map.put("pt", PT); + map.put("pt-BR", PT_BR); + map.put("es", ES); + return map; + } + + private static final Map createEnumsMap() { + Map map = new HashMap<>(); + map.put("en", LocaleEnum.EN); + map.put("en-GB", LocaleEnum.EN_GB); + map.put("pt", LocaleEnum.PT); + map.put("pt-BR", LocaleEnum.PT_BR); + map.put("es", LocaleEnum.ES); + return map; + } + + @SuppressWarnings("serial") + public static final class _Serializer extends StdSerializer { + + protected _Serializer() { + super(Locale.class); + } + + @Override + public void serialize(Locale value, JsonGenerator g, SerializerProvider provider) + throws IOException, JsonProcessingException { + g.writeObject(value.value); + } + } + + @SuppressWarnings("serial") + public static final class _Deserializer extends StdDeserializer { + + protected _Deserializer() { + super(Locale.class); + } + + @Override + public Locale deserialize(JsonParser p, DeserializationContext ctxt) + throws IOException, JacksonException { + String v = p.readValueAs(new TypeReference() {}); + // use the factory method to ensure we get singletons + return Locale.of(v); + } + } + + public enum LocaleEnum { + + EN("en"), + EN_GB("en-GB"), + PT("pt"), + PT_BR("pt-BR"), + ES("es"),; + + private final String value; + + private LocaleEnum(String value) { + this.value = value; + } + + public String value() { + return value; + } + } +} + diff --git a/src/main/java/com/gr4vy/sdk/models/components/PaymentLink.java b/src/main/java/com/gr4vy/sdk/models/components/PaymentLink.java new file mode 100644 index 00000000..3322fc14 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/components/PaymentLink.java @@ -0,0 +1,1459 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.components; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.core.type.TypeReference; +import com.gr4vy.sdk.utils.LazySingletonValue; +import com.gr4vy.sdk.utils.Utils; +import java.lang.Long; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.openapitools.jackson.nullable.JsonNullable; + +public class PaymentLink { + + /** + * The unique identifier for the payment link. + */ + @JsonProperty("id") + private String id; + + /** + * Always `payment-link`. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("type") + private Optional type; + + /** + * The URL for the payment link. + */ + @JsonProperty("url") + private String url; + + /** + * The expiration date and time for the payment link. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("expires_at") + private JsonNullable expiresAt; + + /** + * The merchant reference for the payment link. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("external_identifier") + private JsonNullable externalIdentifier; + + /** + * The statement descriptor for the payment link. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("statement_descriptor") + private JsonNullable statementDescriptor; + + /** + * The locale for the payment link. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("locale") + private JsonNullable locale; + + /** + * The merchant's display name. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("merchant_name") + private JsonNullable merchantName; + + /** + * The merchant's website URL. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("merchant_url") + private JsonNullable merchantUrl; + + /** + * The merchant's banner image URL. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("merchant_banner_url") + private JsonNullable merchantBannerUrl; + + /** + * The merchant's brand color. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("merchant_color") + private JsonNullable merchantColor; + + /** + * A message from the merchant. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("merchant_message") + private JsonNullable merchantMessage; + + /** + * URL to the merchant's terms and conditions. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("merchant_terms_and_conditions_url") + private JsonNullable merchantTermsAndConditionsUrl; + + /** + * URL to the merchant's favicon. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("merchant_favicon_url") + private JsonNullable merchantFaviconUrl; + + /** + * The amount for the payment link. + */ + @JsonProperty("amount") + private long amount; + + /** + * The country code for the payment link. + */ + @JsonProperty("country") + private String country; + + /** + * The currency code for the payment link. + */ + @JsonProperty("currency") + private String currency; + + @JsonProperty("intent") + private TransactionIntent intent; + + /** + * The return URL after payment completion. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("return_url") + private JsonNullable returnUrl; + + /** + * The cart items for the payment link. + */ + @JsonInclude(Include.ALWAYS) + @JsonProperty("cart_items") + private Optional> cartItems; + + /** + * Arbitrary metadata for the payment link. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("metadata") + private JsonNullable> metadata; + + /** + * The way payment method information made it to this transaction. + */ + @JsonProperty("payment_source") + private TransactionPaymentSource paymentSource; + + /** + * The date and time the payment link was created. + */ + @JsonProperty("created_at") + private OffsetDateTime createdAt; + + /** + * The date and time the payment link was last updated. + */ + @JsonProperty("updated_at") + private OffsetDateTime updatedAt; + + @JsonProperty("status") + private PaymentLinkStatus status; + + /** + * The buyer associated with the payment link. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("buyer") + private JsonNullable buyer; + + /** + * The shipping details for the payment link. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("shipping_details") + private JsonNullable shippingDetails; + + @JsonCreator + public PaymentLink( + @JsonProperty("id") String id, + @JsonProperty("url") String url, + @JsonProperty("expires_at") JsonNullable expiresAt, + @JsonProperty("external_identifier") JsonNullable externalIdentifier, + @JsonProperty("statement_descriptor") JsonNullable statementDescriptor, + @JsonProperty("locale") JsonNullable locale, + @JsonProperty("merchant_name") JsonNullable merchantName, + @JsonProperty("merchant_url") JsonNullable merchantUrl, + @JsonProperty("merchant_banner_url") JsonNullable merchantBannerUrl, + @JsonProperty("merchant_color") JsonNullable merchantColor, + @JsonProperty("merchant_message") JsonNullable merchantMessage, + @JsonProperty("merchant_terms_and_conditions_url") JsonNullable merchantTermsAndConditionsUrl, + @JsonProperty("merchant_favicon_url") JsonNullable merchantFaviconUrl, + @JsonProperty("amount") long amount, + @JsonProperty("country") String country, + @JsonProperty("currency") String currency, + @JsonProperty("intent") TransactionIntent intent, + @JsonProperty("return_url") JsonNullable returnUrl, + @JsonProperty("cart_items") Optional> cartItems, + @JsonProperty("metadata") JsonNullable> metadata, + @JsonProperty("payment_source") TransactionPaymentSource paymentSource, + @JsonProperty("created_at") OffsetDateTime createdAt, + @JsonProperty("updated_at") OffsetDateTime updatedAt, + @JsonProperty("status") PaymentLinkStatus status, + @JsonProperty("buyer") JsonNullable buyer, + @JsonProperty("shipping_details") JsonNullable shippingDetails) { + Utils.checkNotNull(id, "id"); + Utils.checkNotNull(url, "url"); + Utils.checkNotNull(expiresAt, "expiresAt"); + Utils.checkNotNull(externalIdentifier, "externalIdentifier"); + Utils.checkNotNull(statementDescriptor, "statementDescriptor"); + Utils.checkNotNull(locale, "locale"); + Utils.checkNotNull(merchantName, "merchantName"); + Utils.checkNotNull(merchantUrl, "merchantUrl"); + Utils.checkNotNull(merchantBannerUrl, "merchantBannerUrl"); + Utils.checkNotNull(merchantColor, "merchantColor"); + Utils.checkNotNull(merchantMessage, "merchantMessage"); + Utils.checkNotNull(merchantTermsAndConditionsUrl, "merchantTermsAndConditionsUrl"); + Utils.checkNotNull(merchantFaviconUrl, "merchantFaviconUrl"); + Utils.checkNotNull(amount, "amount"); + Utils.checkNotNull(country, "country"); + Utils.checkNotNull(currency, "currency"); + Utils.checkNotNull(intent, "intent"); + Utils.checkNotNull(returnUrl, "returnUrl"); + Utils.checkNotNull(cartItems, "cartItems"); + Utils.checkNotNull(metadata, "metadata"); + Utils.checkNotNull(paymentSource, "paymentSource"); + Utils.checkNotNull(createdAt, "createdAt"); + Utils.checkNotNull(updatedAt, "updatedAt"); + Utils.checkNotNull(status, "status"); + Utils.checkNotNull(buyer, "buyer"); + Utils.checkNotNull(shippingDetails, "shippingDetails"); + this.id = id; + this.type = Builder._SINGLETON_VALUE_Type.value(); + this.url = url; + this.expiresAt = expiresAt; + this.externalIdentifier = externalIdentifier; + this.statementDescriptor = statementDescriptor; + this.locale = locale; + this.merchantName = merchantName; + this.merchantUrl = merchantUrl; + this.merchantBannerUrl = merchantBannerUrl; + this.merchantColor = merchantColor; + this.merchantMessage = merchantMessage; + this.merchantTermsAndConditionsUrl = merchantTermsAndConditionsUrl; + this.merchantFaviconUrl = merchantFaviconUrl; + this.amount = amount; + this.country = country; + this.currency = currency; + this.intent = intent; + this.returnUrl = returnUrl; + this.cartItems = cartItems; + this.metadata = metadata; + this.paymentSource = paymentSource; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.status = status; + this.buyer = buyer; + this.shippingDetails = shippingDetails; + } + + public PaymentLink( + String id, + String url, + long amount, + String country, + String currency, + TransactionIntent intent, + TransactionPaymentSource paymentSource, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + PaymentLinkStatus status) { + this(id, url, JsonNullable.undefined(), JsonNullable.undefined(), JsonNullable.undefined(), JsonNullable.undefined(), JsonNullable.undefined(), JsonNullable.undefined(), JsonNullable.undefined(), JsonNullable.undefined(), JsonNullable.undefined(), JsonNullable.undefined(), JsonNullable.undefined(), amount, country, currency, intent, JsonNullable.undefined(), Optional.empty(), JsonNullable.undefined(), paymentSource, createdAt, updatedAt, status, JsonNullable.undefined(), JsonNullable.undefined()); + } + + /** + * The unique identifier for the payment link. + */ + @JsonIgnore + public String id() { + return id; + } + + /** + * Always `payment-link`. + */ + @JsonIgnore + public Optional type() { + return type; + } + + /** + * The URL for the payment link. + */ + @JsonIgnore + public String url() { + return url; + } + + /** + * The expiration date and time for the payment link. + */ + @JsonIgnore + public JsonNullable expiresAt() { + return expiresAt; + } + + /** + * The merchant reference for the payment link. + */ + @JsonIgnore + public JsonNullable externalIdentifier() { + return externalIdentifier; + } + + /** + * The statement descriptor for the payment link. + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public JsonNullable statementDescriptor() { + return (JsonNullable) statementDescriptor; + } + + /** + * The locale for the payment link. + */ + @JsonIgnore + public JsonNullable locale() { + return locale; + } + + /** + * The merchant's display name. + */ + @JsonIgnore + public JsonNullable merchantName() { + return merchantName; + } + + /** + * The merchant's website URL. + */ + @JsonIgnore + public JsonNullable merchantUrl() { + return merchantUrl; + } + + /** + * The merchant's banner image URL. + */ + @JsonIgnore + public JsonNullable merchantBannerUrl() { + return merchantBannerUrl; + } + + /** + * The merchant's brand color. + */ + @JsonIgnore + public JsonNullable merchantColor() { + return merchantColor; + } + + /** + * A message from the merchant. + */ + @JsonIgnore + public JsonNullable merchantMessage() { + return merchantMessage; + } + + /** + * URL to the merchant's terms and conditions. + */ + @JsonIgnore + public JsonNullable merchantTermsAndConditionsUrl() { + return merchantTermsAndConditionsUrl; + } + + /** + * URL to the merchant's favicon. + */ + @JsonIgnore + public JsonNullable merchantFaviconUrl() { + return merchantFaviconUrl; + } + + /** + * The amount for the payment link. + */ + @JsonIgnore + public long amount() { + return amount; + } + + /** + * The country code for the payment link. + */ + @JsonIgnore + public String country() { + return country; + } + + /** + * The currency code for the payment link. + */ + @JsonIgnore + public String currency() { + return currency; + } + + @JsonIgnore + public TransactionIntent intent() { + return intent; + } + + /** + * The return URL after payment completion. + */ + @JsonIgnore + public JsonNullable returnUrl() { + return returnUrl; + } + + /** + * The cart items for the payment link. + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional> cartItems() { + return (Optional>) cartItems; + } + + /** + * Arbitrary metadata for the payment link. + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public JsonNullable> metadata() { + return (JsonNullable>) metadata; + } + + /** + * The way payment method information made it to this transaction. + */ + @JsonIgnore + public TransactionPaymentSource paymentSource() { + return paymentSource; + } + + /** + * The date and time the payment link was created. + */ + @JsonIgnore + public OffsetDateTime createdAt() { + return createdAt; + } + + /** + * The date and time the payment link was last updated. + */ + @JsonIgnore + public OffsetDateTime updatedAt() { + return updatedAt; + } + + @JsonIgnore + public PaymentLinkStatus status() { + return status; + } + + /** + * The buyer associated with the payment link. + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public JsonNullable buyer() { + return (JsonNullable) buyer; + } + + /** + * The shipping details for the payment link. + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public JsonNullable shippingDetails() { + return (JsonNullable) shippingDetails; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * The unique identifier for the payment link. + */ + public PaymentLink withId(String id) { + Utils.checkNotNull(id, "id"); + this.id = id; + return this; + } + + /** + * The URL for the payment link. + */ + public PaymentLink withUrl(String url) { + Utils.checkNotNull(url, "url"); + this.url = url; + return this; + } + + /** + * The expiration date and time for the payment link. + */ + public PaymentLink withExpiresAt(OffsetDateTime expiresAt) { + Utils.checkNotNull(expiresAt, "expiresAt"); + this.expiresAt = JsonNullable.of(expiresAt); + return this; + } + + /** + * The expiration date and time for the payment link. + */ + public PaymentLink withExpiresAt(JsonNullable expiresAt) { + Utils.checkNotNull(expiresAt, "expiresAt"); + this.expiresAt = expiresAt; + return this; + } + + /** + * The merchant reference for the payment link. + */ + public PaymentLink withExternalIdentifier(String externalIdentifier) { + Utils.checkNotNull(externalIdentifier, "externalIdentifier"); + this.externalIdentifier = JsonNullable.of(externalIdentifier); + return this; + } + + /** + * The merchant reference for the payment link. + */ + public PaymentLink withExternalIdentifier(JsonNullable externalIdentifier) { + Utils.checkNotNull(externalIdentifier, "externalIdentifier"); + this.externalIdentifier = externalIdentifier; + return this; + } + + /** + * The statement descriptor for the payment link. + */ + public PaymentLink withStatementDescriptor(StatementDescriptor statementDescriptor) { + Utils.checkNotNull(statementDescriptor, "statementDescriptor"); + this.statementDescriptor = JsonNullable.of(statementDescriptor); + return this; + } + + /** + * The statement descriptor for the payment link. + */ + public PaymentLink withStatementDescriptor(JsonNullable statementDescriptor) { + Utils.checkNotNull(statementDescriptor, "statementDescriptor"); + this.statementDescriptor = statementDescriptor; + return this; + } + + /** + * The locale for the payment link. + */ + public PaymentLink withLocale(String locale) { + Utils.checkNotNull(locale, "locale"); + this.locale = JsonNullable.of(locale); + return this; + } + + /** + * The locale for the payment link. + */ + public PaymentLink withLocale(JsonNullable locale) { + Utils.checkNotNull(locale, "locale"); + this.locale = locale; + return this; + } + + /** + * The merchant's display name. + */ + public PaymentLink withMerchantName(String merchantName) { + Utils.checkNotNull(merchantName, "merchantName"); + this.merchantName = JsonNullable.of(merchantName); + return this; + } + + /** + * The merchant's display name. + */ + public PaymentLink withMerchantName(JsonNullable merchantName) { + Utils.checkNotNull(merchantName, "merchantName"); + this.merchantName = merchantName; + return this; + } + + /** + * The merchant's website URL. + */ + public PaymentLink withMerchantUrl(String merchantUrl) { + Utils.checkNotNull(merchantUrl, "merchantUrl"); + this.merchantUrl = JsonNullable.of(merchantUrl); + return this; + } + + /** + * The merchant's website URL. + */ + public PaymentLink withMerchantUrl(JsonNullable merchantUrl) { + Utils.checkNotNull(merchantUrl, "merchantUrl"); + this.merchantUrl = merchantUrl; + return this; + } + + /** + * The merchant's banner image URL. + */ + public PaymentLink withMerchantBannerUrl(String merchantBannerUrl) { + Utils.checkNotNull(merchantBannerUrl, "merchantBannerUrl"); + this.merchantBannerUrl = JsonNullable.of(merchantBannerUrl); + return this; + } + + /** + * The merchant's banner image URL. + */ + public PaymentLink withMerchantBannerUrl(JsonNullable merchantBannerUrl) { + Utils.checkNotNull(merchantBannerUrl, "merchantBannerUrl"); + this.merchantBannerUrl = merchantBannerUrl; + return this; + } + + /** + * The merchant's brand color. + */ + public PaymentLink withMerchantColor(String merchantColor) { + Utils.checkNotNull(merchantColor, "merchantColor"); + this.merchantColor = JsonNullable.of(merchantColor); + return this; + } + + /** + * The merchant's brand color. + */ + public PaymentLink withMerchantColor(JsonNullable merchantColor) { + Utils.checkNotNull(merchantColor, "merchantColor"); + this.merchantColor = merchantColor; + return this; + } + + /** + * A message from the merchant. + */ + public PaymentLink withMerchantMessage(String merchantMessage) { + Utils.checkNotNull(merchantMessage, "merchantMessage"); + this.merchantMessage = JsonNullable.of(merchantMessage); + return this; + } + + /** + * A message from the merchant. + */ + public PaymentLink withMerchantMessage(JsonNullable merchantMessage) { + Utils.checkNotNull(merchantMessage, "merchantMessage"); + this.merchantMessage = merchantMessage; + return this; + } + + /** + * URL to the merchant's terms and conditions. + */ + public PaymentLink withMerchantTermsAndConditionsUrl(String merchantTermsAndConditionsUrl) { + Utils.checkNotNull(merchantTermsAndConditionsUrl, "merchantTermsAndConditionsUrl"); + this.merchantTermsAndConditionsUrl = JsonNullable.of(merchantTermsAndConditionsUrl); + return this; + } + + /** + * URL to the merchant's terms and conditions. + */ + public PaymentLink withMerchantTermsAndConditionsUrl(JsonNullable merchantTermsAndConditionsUrl) { + Utils.checkNotNull(merchantTermsAndConditionsUrl, "merchantTermsAndConditionsUrl"); + this.merchantTermsAndConditionsUrl = merchantTermsAndConditionsUrl; + return this; + } + + /** + * URL to the merchant's favicon. + */ + public PaymentLink withMerchantFaviconUrl(String merchantFaviconUrl) { + Utils.checkNotNull(merchantFaviconUrl, "merchantFaviconUrl"); + this.merchantFaviconUrl = JsonNullable.of(merchantFaviconUrl); + return this; + } + + /** + * URL to the merchant's favicon. + */ + public PaymentLink withMerchantFaviconUrl(JsonNullable merchantFaviconUrl) { + Utils.checkNotNull(merchantFaviconUrl, "merchantFaviconUrl"); + this.merchantFaviconUrl = merchantFaviconUrl; + return this; + } + + /** + * The amount for the payment link. + */ + public PaymentLink withAmount(long amount) { + Utils.checkNotNull(amount, "amount"); + this.amount = amount; + return this; + } + + /** + * The country code for the payment link. + */ + public PaymentLink withCountry(String country) { + Utils.checkNotNull(country, "country"); + this.country = country; + return this; + } + + /** + * The currency code for the payment link. + */ + public PaymentLink withCurrency(String currency) { + Utils.checkNotNull(currency, "currency"); + this.currency = currency; + return this; + } + + public PaymentLink withIntent(TransactionIntent intent) { + Utils.checkNotNull(intent, "intent"); + this.intent = intent; + return this; + } + + /** + * The return URL after payment completion. + */ + public PaymentLink withReturnUrl(String returnUrl) { + Utils.checkNotNull(returnUrl, "returnUrl"); + this.returnUrl = JsonNullable.of(returnUrl); + return this; + } + + /** + * The return URL after payment completion. + */ + public PaymentLink withReturnUrl(JsonNullable returnUrl) { + Utils.checkNotNull(returnUrl, "returnUrl"); + this.returnUrl = returnUrl; + return this; + } + + /** + * The cart items for the payment link. + */ + public PaymentLink withCartItems(List cartItems) { + Utils.checkNotNull(cartItems, "cartItems"); + this.cartItems = Optional.ofNullable(cartItems); + return this; + } + + /** + * The cart items for the payment link. + */ + public PaymentLink withCartItems(Optional> cartItems) { + Utils.checkNotNull(cartItems, "cartItems"); + this.cartItems = cartItems; + return this; + } + + /** + * Arbitrary metadata for the payment link. + */ + public PaymentLink withMetadata(Map metadata) { + Utils.checkNotNull(metadata, "metadata"); + this.metadata = JsonNullable.of(metadata); + return this; + } + + /** + * Arbitrary metadata for the payment link. + */ + public PaymentLink withMetadata(JsonNullable> metadata) { + Utils.checkNotNull(metadata, "metadata"); + this.metadata = metadata; + return this; + } + + /** + * The way payment method information made it to this transaction. + */ + public PaymentLink withPaymentSource(TransactionPaymentSource paymentSource) { + Utils.checkNotNull(paymentSource, "paymentSource"); + this.paymentSource = paymentSource; + return this; + } + + /** + * The date and time the payment link was created. + */ + public PaymentLink withCreatedAt(OffsetDateTime createdAt) { + Utils.checkNotNull(createdAt, "createdAt"); + this.createdAt = createdAt; + return this; + } + + /** + * The date and time the payment link was last updated. + */ + public PaymentLink withUpdatedAt(OffsetDateTime updatedAt) { + Utils.checkNotNull(updatedAt, "updatedAt"); + this.updatedAt = updatedAt; + return this; + } + + public PaymentLink withStatus(PaymentLinkStatus status) { + Utils.checkNotNull(status, "status"); + this.status = status; + return this; + } + + /** + * The buyer associated with the payment link. + */ + public PaymentLink withBuyer(TransactionBuyer buyer) { + Utils.checkNotNull(buyer, "buyer"); + this.buyer = JsonNullable.of(buyer); + return this; + } + + /** + * The buyer associated with the payment link. + */ + public PaymentLink withBuyer(JsonNullable buyer) { + Utils.checkNotNull(buyer, "buyer"); + this.buyer = buyer; + return this; + } + + /** + * The shipping details for the payment link. + */ + public PaymentLink withShippingDetails(ShippingDetails shippingDetails) { + Utils.checkNotNull(shippingDetails, "shippingDetails"); + this.shippingDetails = JsonNullable.of(shippingDetails); + return this; + } + + /** + * The shipping details for the payment link. + */ + public PaymentLink withShippingDetails(JsonNullable shippingDetails) { + Utils.checkNotNull(shippingDetails, "shippingDetails"); + this.shippingDetails = shippingDetails; + return this; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PaymentLink other = (PaymentLink) o; + return + Objects.deepEquals(this.id, other.id) && + Objects.deepEquals(this.type, other.type) && + Objects.deepEquals(this.url, other.url) && + Objects.deepEquals(this.expiresAt, other.expiresAt) && + Objects.deepEquals(this.externalIdentifier, other.externalIdentifier) && + Objects.deepEquals(this.statementDescriptor, other.statementDescriptor) && + Objects.deepEquals(this.locale, other.locale) && + Objects.deepEquals(this.merchantName, other.merchantName) && + Objects.deepEquals(this.merchantUrl, other.merchantUrl) && + Objects.deepEquals(this.merchantBannerUrl, other.merchantBannerUrl) && + Objects.deepEquals(this.merchantColor, other.merchantColor) && + Objects.deepEquals(this.merchantMessage, other.merchantMessage) && + Objects.deepEquals(this.merchantTermsAndConditionsUrl, other.merchantTermsAndConditionsUrl) && + Objects.deepEquals(this.merchantFaviconUrl, other.merchantFaviconUrl) && + Objects.deepEquals(this.amount, other.amount) && + Objects.deepEquals(this.country, other.country) && + Objects.deepEquals(this.currency, other.currency) && + Objects.deepEquals(this.intent, other.intent) && + Objects.deepEquals(this.returnUrl, other.returnUrl) && + Objects.deepEquals(this.cartItems, other.cartItems) && + Objects.deepEquals(this.metadata, other.metadata) && + Objects.deepEquals(this.paymentSource, other.paymentSource) && + Objects.deepEquals(this.createdAt, other.createdAt) && + Objects.deepEquals(this.updatedAt, other.updatedAt) && + Objects.deepEquals(this.status, other.status) && + Objects.deepEquals(this.buyer, other.buyer) && + Objects.deepEquals(this.shippingDetails, other.shippingDetails); + } + + @Override + public int hashCode() { + return Objects.hash( + id, + type, + url, + expiresAt, + externalIdentifier, + statementDescriptor, + locale, + merchantName, + merchantUrl, + merchantBannerUrl, + merchantColor, + merchantMessage, + merchantTermsAndConditionsUrl, + merchantFaviconUrl, + amount, + country, + currency, + intent, + returnUrl, + cartItems, + metadata, + paymentSource, + createdAt, + updatedAt, + status, + buyer, + shippingDetails); + } + + @Override + public String toString() { + return Utils.toString(PaymentLink.class, + "id", id, + "type", type, + "url", url, + "expiresAt", expiresAt, + "externalIdentifier", externalIdentifier, + "statementDescriptor", statementDescriptor, + "locale", locale, + "merchantName", merchantName, + "merchantUrl", merchantUrl, + "merchantBannerUrl", merchantBannerUrl, + "merchantColor", merchantColor, + "merchantMessage", merchantMessage, + "merchantTermsAndConditionsUrl", merchantTermsAndConditionsUrl, + "merchantFaviconUrl", merchantFaviconUrl, + "amount", amount, + "country", country, + "currency", currency, + "intent", intent, + "returnUrl", returnUrl, + "cartItems", cartItems, + "metadata", metadata, + "paymentSource", paymentSource, + "createdAt", createdAt, + "updatedAt", updatedAt, + "status", status, + "buyer", buyer, + "shippingDetails", shippingDetails); + } + + public final static class Builder { + + private String id; + + private String url; + + private JsonNullable expiresAt = JsonNullable.undefined(); + + private JsonNullable externalIdentifier = JsonNullable.undefined(); + + private JsonNullable statementDescriptor = JsonNullable.undefined(); + + private JsonNullable locale = JsonNullable.undefined(); + + private JsonNullable merchantName = JsonNullable.undefined(); + + private JsonNullable merchantUrl = JsonNullable.undefined(); + + private JsonNullable merchantBannerUrl = JsonNullable.undefined(); + + private JsonNullable merchantColor = JsonNullable.undefined(); + + private JsonNullable merchantMessage = JsonNullable.undefined(); + + private JsonNullable merchantTermsAndConditionsUrl = JsonNullable.undefined(); + + private JsonNullable merchantFaviconUrl = JsonNullable.undefined(); + + private Long amount; + + private String country; + + private String currency; + + private TransactionIntent intent; + + private JsonNullable returnUrl = JsonNullable.undefined(); + + private Optional> cartItems = Optional.empty(); + + private JsonNullable> metadata = JsonNullable.undefined(); + + private TransactionPaymentSource paymentSource; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + private PaymentLinkStatus status; + + private JsonNullable buyer = JsonNullable.undefined(); + + private JsonNullable shippingDetails = JsonNullable.undefined(); + + private Builder() { + // force use of static builder() method + } + + /** + * The unique identifier for the payment link. + */ + public Builder id(String id) { + Utils.checkNotNull(id, "id"); + this.id = id; + return this; + } + + /** + * The URL for the payment link. + */ + public Builder url(String url) { + Utils.checkNotNull(url, "url"); + this.url = url; + return this; + } + + /** + * The expiration date and time for the payment link. + */ + public Builder expiresAt(OffsetDateTime expiresAt) { + Utils.checkNotNull(expiresAt, "expiresAt"); + this.expiresAt = JsonNullable.of(expiresAt); + return this; + } + + /** + * The expiration date and time for the payment link. + */ + public Builder expiresAt(JsonNullable expiresAt) { + Utils.checkNotNull(expiresAt, "expiresAt"); + this.expiresAt = expiresAt; + return this; + } + + /** + * The merchant reference for the payment link. + */ + public Builder externalIdentifier(String externalIdentifier) { + Utils.checkNotNull(externalIdentifier, "externalIdentifier"); + this.externalIdentifier = JsonNullable.of(externalIdentifier); + return this; + } + + /** + * The merchant reference for the payment link. + */ + public Builder externalIdentifier(JsonNullable externalIdentifier) { + Utils.checkNotNull(externalIdentifier, "externalIdentifier"); + this.externalIdentifier = externalIdentifier; + return this; + } + + /** + * The statement descriptor for the payment link. + */ + public Builder statementDescriptor(StatementDescriptor statementDescriptor) { + Utils.checkNotNull(statementDescriptor, "statementDescriptor"); + this.statementDescriptor = JsonNullable.of(statementDescriptor); + return this; + } + + /** + * The statement descriptor for the payment link. + */ + public Builder statementDescriptor(JsonNullable statementDescriptor) { + Utils.checkNotNull(statementDescriptor, "statementDescriptor"); + this.statementDescriptor = statementDescriptor; + return this; + } + + /** + * The locale for the payment link. + */ + public Builder locale(String locale) { + Utils.checkNotNull(locale, "locale"); + this.locale = JsonNullable.of(locale); + return this; + } + + /** + * The locale for the payment link. + */ + public Builder locale(JsonNullable locale) { + Utils.checkNotNull(locale, "locale"); + this.locale = locale; + return this; + } + + /** + * The merchant's display name. + */ + public Builder merchantName(String merchantName) { + Utils.checkNotNull(merchantName, "merchantName"); + this.merchantName = JsonNullable.of(merchantName); + return this; + } + + /** + * The merchant's display name. + */ + public Builder merchantName(JsonNullable merchantName) { + Utils.checkNotNull(merchantName, "merchantName"); + this.merchantName = merchantName; + return this; + } + + /** + * The merchant's website URL. + */ + public Builder merchantUrl(String merchantUrl) { + Utils.checkNotNull(merchantUrl, "merchantUrl"); + this.merchantUrl = JsonNullable.of(merchantUrl); + return this; + } + + /** + * The merchant's website URL. + */ + public Builder merchantUrl(JsonNullable merchantUrl) { + Utils.checkNotNull(merchantUrl, "merchantUrl"); + this.merchantUrl = merchantUrl; + return this; + } + + /** + * The merchant's banner image URL. + */ + public Builder merchantBannerUrl(String merchantBannerUrl) { + Utils.checkNotNull(merchantBannerUrl, "merchantBannerUrl"); + this.merchantBannerUrl = JsonNullable.of(merchantBannerUrl); + return this; + } + + /** + * The merchant's banner image URL. + */ + public Builder merchantBannerUrl(JsonNullable merchantBannerUrl) { + Utils.checkNotNull(merchantBannerUrl, "merchantBannerUrl"); + this.merchantBannerUrl = merchantBannerUrl; + return this; + } + + /** + * The merchant's brand color. + */ + public Builder merchantColor(String merchantColor) { + Utils.checkNotNull(merchantColor, "merchantColor"); + this.merchantColor = JsonNullable.of(merchantColor); + return this; + } + + /** + * The merchant's brand color. + */ + public Builder merchantColor(JsonNullable merchantColor) { + Utils.checkNotNull(merchantColor, "merchantColor"); + this.merchantColor = merchantColor; + return this; + } + + /** + * A message from the merchant. + */ + public Builder merchantMessage(String merchantMessage) { + Utils.checkNotNull(merchantMessage, "merchantMessage"); + this.merchantMessage = JsonNullable.of(merchantMessage); + return this; + } + + /** + * A message from the merchant. + */ + public Builder merchantMessage(JsonNullable merchantMessage) { + Utils.checkNotNull(merchantMessage, "merchantMessage"); + this.merchantMessage = merchantMessage; + return this; + } + + /** + * URL to the merchant's terms and conditions. + */ + public Builder merchantTermsAndConditionsUrl(String merchantTermsAndConditionsUrl) { + Utils.checkNotNull(merchantTermsAndConditionsUrl, "merchantTermsAndConditionsUrl"); + this.merchantTermsAndConditionsUrl = JsonNullable.of(merchantTermsAndConditionsUrl); + return this; + } + + /** + * URL to the merchant's terms and conditions. + */ + public Builder merchantTermsAndConditionsUrl(JsonNullable merchantTermsAndConditionsUrl) { + Utils.checkNotNull(merchantTermsAndConditionsUrl, "merchantTermsAndConditionsUrl"); + this.merchantTermsAndConditionsUrl = merchantTermsAndConditionsUrl; + return this; + } + + /** + * URL to the merchant's favicon. + */ + public Builder merchantFaviconUrl(String merchantFaviconUrl) { + Utils.checkNotNull(merchantFaviconUrl, "merchantFaviconUrl"); + this.merchantFaviconUrl = JsonNullable.of(merchantFaviconUrl); + return this; + } + + /** + * URL to the merchant's favicon. + */ + public Builder merchantFaviconUrl(JsonNullable merchantFaviconUrl) { + Utils.checkNotNull(merchantFaviconUrl, "merchantFaviconUrl"); + this.merchantFaviconUrl = merchantFaviconUrl; + return this; + } + + /** + * The amount for the payment link. + */ + public Builder amount(long amount) { + Utils.checkNotNull(amount, "amount"); + this.amount = amount; + return this; + } + + /** + * The country code for the payment link. + */ + public Builder country(String country) { + Utils.checkNotNull(country, "country"); + this.country = country; + return this; + } + + /** + * The currency code for the payment link. + */ + public Builder currency(String currency) { + Utils.checkNotNull(currency, "currency"); + this.currency = currency; + return this; + } + + public Builder intent(TransactionIntent intent) { + Utils.checkNotNull(intent, "intent"); + this.intent = intent; + return this; + } + + /** + * The return URL after payment completion. + */ + public Builder returnUrl(String returnUrl) { + Utils.checkNotNull(returnUrl, "returnUrl"); + this.returnUrl = JsonNullable.of(returnUrl); + return this; + } + + /** + * The return URL after payment completion. + */ + public Builder returnUrl(JsonNullable returnUrl) { + Utils.checkNotNull(returnUrl, "returnUrl"); + this.returnUrl = returnUrl; + return this; + } + + /** + * The cart items for the payment link. + */ + public Builder cartItems(List cartItems) { + Utils.checkNotNull(cartItems, "cartItems"); + this.cartItems = Optional.ofNullable(cartItems); + return this; + } + + /** + * The cart items for the payment link. + */ + public Builder cartItems(Optional> cartItems) { + Utils.checkNotNull(cartItems, "cartItems"); + this.cartItems = cartItems; + return this; + } + + /** + * Arbitrary metadata for the payment link. + */ + public Builder metadata(Map metadata) { + Utils.checkNotNull(metadata, "metadata"); + this.metadata = JsonNullable.of(metadata); + return this; + } + + /** + * Arbitrary metadata for the payment link. + */ + public Builder metadata(JsonNullable> metadata) { + Utils.checkNotNull(metadata, "metadata"); + this.metadata = metadata; + return this; + } + + /** + * The way payment method information made it to this transaction. + */ + public Builder paymentSource(TransactionPaymentSource paymentSource) { + Utils.checkNotNull(paymentSource, "paymentSource"); + this.paymentSource = paymentSource; + return this; + } + + /** + * The date and time the payment link was created. + */ + public Builder createdAt(OffsetDateTime createdAt) { + Utils.checkNotNull(createdAt, "createdAt"); + this.createdAt = createdAt; + return this; + } + + /** + * The date and time the payment link was last updated. + */ + public Builder updatedAt(OffsetDateTime updatedAt) { + Utils.checkNotNull(updatedAt, "updatedAt"); + this.updatedAt = updatedAt; + return this; + } + + public Builder status(PaymentLinkStatus status) { + Utils.checkNotNull(status, "status"); + this.status = status; + return this; + } + + /** + * The buyer associated with the payment link. + */ + public Builder buyer(TransactionBuyer buyer) { + Utils.checkNotNull(buyer, "buyer"); + this.buyer = JsonNullable.of(buyer); + return this; + } + + /** + * The buyer associated with the payment link. + */ + public Builder buyer(JsonNullable buyer) { + Utils.checkNotNull(buyer, "buyer"); + this.buyer = buyer; + return this; + } + + /** + * The shipping details for the payment link. + */ + public Builder shippingDetails(ShippingDetails shippingDetails) { + Utils.checkNotNull(shippingDetails, "shippingDetails"); + this.shippingDetails = JsonNullable.of(shippingDetails); + return this; + } + + /** + * The shipping details for the payment link. + */ + public Builder shippingDetails(JsonNullable shippingDetails) { + Utils.checkNotNull(shippingDetails, "shippingDetails"); + this.shippingDetails = shippingDetails; + return this; + } + + public PaymentLink build() { + return new PaymentLink( + id, + url, + expiresAt, + externalIdentifier, + statementDescriptor, + locale, + merchantName, + merchantUrl, + merchantBannerUrl, + merchantColor, + merchantMessage, + merchantTermsAndConditionsUrl, + merchantFaviconUrl, + amount, + country, + currency, + intent, + returnUrl, + cartItems, + metadata, + paymentSource, + createdAt, + updatedAt, + status, + buyer, + shippingDetails); + } + + private static final LazySingletonValue> _SINGLETON_VALUE_Type = + new LazySingletonValue<>( + "type", + "\"payment-link\"", + new TypeReference>() {}); + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/components/PaymentLinkCreate.java b/src/main/java/com/gr4vy/sdk/models/components/PaymentLinkCreate.java new file mode 100644 index 00000000..fa01e476 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/components/PaymentLinkCreate.java @@ -0,0 +1,1267 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.components; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.gr4vy.sdk.utils.Utils; +import java.lang.Long; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.openapitools.jackson.nullable.JsonNullable; + +public class PaymentLinkCreate { + + /** + * The guest buyer for the payment link. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("buyer") + private JsonNullable buyer; + + /** + * The expiration date and time for the payment link. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("expires_at") + private JsonNullable expiresAt; + + /** + * Connection options for the payment link. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("connection_options") + private JsonNullable>> connectionOptions; + + /** + * The merchant reference for the payment link. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("external_identifier") + private JsonNullable externalIdentifier; + + /** + * The statement descriptor for the payment link. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("statement_descriptor") + private JsonNullable statementDescriptor; + + /** + * The locale for the payment link. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("locale") + private JsonNullable locale; + + /** + * The merchant's display name. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("merchant_name") + private JsonNullable merchantName; + + /** + * The merchant's website URL. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("merchant_url") + private JsonNullable merchantUrl; + + /** + * The merchant's banner image URL. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("merchant_banner_url") + private JsonNullable merchantBannerUrl; + + /** + * The merchant's brand color. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("merchant_color") + private JsonNullable merchantColor; + + /** + * A message from the merchant. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("merchant_message") + private JsonNullable merchantMessage; + + /** + * URL to the merchant's terms and conditions. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("merchant_terms_and_conditions_url") + private JsonNullable merchantTermsAndConditionsUrl; + + /** + * URL to the merchant's favicon. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("merchant_favicon_url") + private JsonNullable merchantFaviconUrl; + + /** + * The amount for the payment link. + */ + @JsonProperty("amount") + private long amount; + + /** + * The country code for the payment link. + */ + @JsonProperty("country") + private String country; + + /** + * The currency code for the payment link. + */ + @JsonProperty("currency") + private String currency; + + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("intent") + private Optional intent; + + /** + * The return URL after payment completion. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("return_url") + private JsonNullable returnUrl; + + /** + * The cart items for the payment link. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("cart_items") + private JsonNullable> cartItems; + + /** + * Arbitrary metadata for the payment link. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("metadata") + private JsonNullable> metadata; + + /** + * The way payment method information made it to this transaction. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("payment_source") + private Optional paymentSource; + + @JsonCreator + public PaymentLinkCreate( + @JsonProperty("buyer") JsonNullable buyer, + @JsonProperty("expires_at") JsonNullable expiresAt, + @JsonProperty("connection_options") JsonNullable>> connectionOptions, + @JsonProperty("external_identifier") JsonNullable externalIdentifier, + @JsonProperty("statement_descriptor") JsonNullable statementDescriptor, + @JsonProperty("locale") JsonNullable locale, + @JsonProperty("merchant_name") JsonNullable merchantName, + @JsonProperty("merchant_url") JsonNullable merchantUrl, + @JsonProperty("merchant_banner_url") JsonNullable merchantBannerUrl, + @JsonProperty("merchant_color") JsonNullable merchantColor, + @JsonProperty("merchant_message") JsonNullable merchantMessage, + @JsonProperty("merchant_terms_and_conditions_url") JsonNullable merchantTermsAndConditionsUrl, + @JsonProperty("merchant_favicon_url") JsonNullable merchantFaviconUrl, + @JsonProperty("amount") long amount, + @JsonProperty("country") String country, + @JsonProperty("currency") String currency, + @JsonProperty("intent") Optional intent, + @JsonProperty("return_url") JsonNullable returnUrl, + @JsonProperty("cart_items") JsonNullable> cartItems, + @JsonProperty("metadata") JsonNullable> metadata, + @JsonProperty("payment_source") Optional paymentSource) { + Utils.checkNotNull(buyer, "buyer"); + Utils.checkNotNull(expiresAt, "expiresAt"); + Utils.checkNotNull(connectionOptions, "connectionOptions"); + Utils.checkNotNull(externalIdentifier, "externalIdentifier"); + Utils.checkNotNull(statementDescriptor, "statementDescriptor"); + Utils.checkNotNull(locale, "locale"); + Utils.checkNotNull(merchantName, "merchantName"); + Utils.checkNotNull(merchantUrl, "merchantUrl"); + Utils.checkNotNull(merchantBannerUrl, "merchantBannerUrl"); + Utils.checkNotNull(merchantColor, "merchantColor"); + Utils.checkNotNull(merchantMessage, "merchantMessage"); + Utils.checkNotNull(merchantTermsAndConditionsUrl, "merchantTermsAndConditionsUrl"); + Utils.checkNotNull(merchantFaviconUrl, "merchantFaviconUrl"); + Utils.checkNotNull(amount, "amount"); + Utils.checkNotNull(country, "country"); + Utils.checkNotNull(currency, "currency"); + Utils.checkNotNull(intent, "intent"); + Utils.checkNotNull(returnUrl, "returnUrl"); + Utils.checkNotNull(cartItems, "cartItems"); + Utils.checkNotNull(metadata, "metadata"); + Utils.checkNotNull(paymentSource, "paymentSource"); + this.buyer = buyer; + this.expiresAt = expiresAt; + this.connectionOptions = connectionOptions; + this.externalIdentifier = externalIdentifier; + this.statementDescriptor = statementDescriptor; + this.locale = locale; + this.merchantName = merchantName; + this.merchantUrl = merchantUrl; + this.merchantBannerUrl = merchantBannerUrl; + this.merchantColor = merchantColor; + this.merchantMessage = merchantMessage; + this.merchantTermsAndConditionsUrl = merchantTermsAndConditionsUrl; + this.merchantFaviconUrl = merchantFaviconUrl; + this.amount = amount; + this.country = country; + this.currency = currency; + this.intent = intent; + this.returnUrl = returnUrl; + this.cartItems = cartItems; + this.metadata = metadata; + this.paymentSource = paymentSource; + } + + public PaymentLinkCreate( + long amount, + String country, + String currency) { + this(JsonNullable.undefined(), JsonNullable.undefined(), JsonNullable.undefined(), JsonNullable.undefined(), JsonNullable.undefined(), JsonNullable.undefined(), JsonNullable.undefined(), JsonNullable.undefined(), JsonNullable.undefined(), JsonNullable.undefined(), JsonNullable.undefined(), JsonNullable.undefined(), JsonNullable.undefined(), amount, country, currency, Optional.empty(), JsonNullable.undefined(), JsonNullable.undefined(), JsonNullable.undefined(), Optional.empty()); + } + + /** + * The guest buyer for the payment link. + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public JsonNullable buyer() { + return (JsonNullable) buyer; + } + + /** + * The expiration date and time for the payment link. + */ + @JsonIgnore + public JsonNullable expiresAt() { + return expiresAt; + } + + /** + * Connection options for the payment link. + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public JsonNullable>> connectionOptions() { + return (JsonNullable>>) connectionOptions; + } + + /** + * The merchant reference for the payment link. + */ + @JsonIgnore + public JsonNullable externalIdentifier() { + return externalIdentifier; + } + + /** + * The statement descriptor for the payment link. + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public JsonNullable statementDescriptor() { + return (JsonNullable) statementDescriptor; + } + + /** + * The locale for the payment link. + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public JsonNullable locale() { + return (JsonNullable) locale; + } + + /** + * The merchant's display name. + */ + @JsonIgnore + public JsonNullable merchantName() { + return merchantName; + } + + /** + * The merchant's website URL. + */ + @JsonIgnore + public JsonNullable merchantUrl() { + return merchantUrl; + } + + /** + * The merchant's banner image URL. + */ + @JsonIgnore + public JsonNullable merchantBannerUrl() { + return merchantBannerUrl; + } + + /** + * The merchant's brand color. + */ + @JsonIgnore + public JsonNullable merchantColor() { + return merchantColor; + } + + /** + * A message from the merchant. + */ + @JsonIgnore + public JsonNullable merchantMessage() { + return merchantMessage; + } + + /** + * URL to the merchant's terms and conditions. + */ + @JsonIgnore + public JsonNullable merchantTermsAndConditionsUrl() { + return merchantTermsAndConditionsUrl; + } + + /** + * URL to the merchant's favicon. + */ + @JsonIgnore + public JsonNullable merchantFaviconUrl() { + return merchantFaviconUrl; + } + + /** + * The amount for the payment link. + */ + @JsonIgnore + public long amount() { + return amount; + } + + /** + * The country code for the payment link. + */ + @JsonIgnore + public String country() { + return country; + } + + /** + * The currency code for the payment link. + */ + @JsonIgnore + public String currency() { + return currency; + } + + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional intent() { + return (Optional) intent; + } + + /** + * The return URL after payment completion. + */ + @JsonIgnore + public JsonNullable returnUrl() { + return returnUrl; + } + + /** + * The cart items for the payment link. + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public JsonNullable> cartItems() { + return (JsonNullable>) cartItems; + } + + /** + * Arbitrary metadata for the payment link. + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public JsonNullable> metadata() { + return (JsonNullable>) metadata; + } + + /** + * The way payment method information made it to this transaction. + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional paymentSource() { + return (Optional) paymentSource; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * The guest buyer for the payment link. + */ + public PaymentLinkCreate withBuyer(GuestBuyerInput buyer) { + Utils.checkNotNull(buyer, "buyer"); + this.buyer = JsonNullable.of(buyer); + return this; + } + + /** + * The guest buyer for the payment link. + */ + public PaymentLinkCreate withBuyer(JsonNullable buyer) { + Utils.checkNotNull(buyer, "buyer"); + this.buyer = buyer; + return this; + } + + /** + * The expiration date and time for the payment link. + */ + public PaymentLinkCreate withExpiresAt(OffsetDateTime expiresAt) { + Utils.checkNotNull(expiresAt, "expiresAt"); + this.expiresAt = JsonNullable.of(expiresAt); + return this; + } + + /** + * The expiration date and time for the payment link. + */ + public PaymentLinkCreate withExpiresAt(JsonNullable expiresAt) { + Utils.checkNotNull(expiresAt, "expiresAt"); + this.expiresAt = expiresAt; + return this; + } + + /** + * Connection options for the payment link. + */ + public PaymentLinkCreate withConnectionOptions(Map> connectionOptions) { + Utils.checkNotNull(connectionOptions, "connectionOptions"); + this.connectionOptions = JsonNullable.of(connectionOptions); + return this; + } + + /** + * Connection options for the payment link. + */ + public PaymentLinkCreate withConnectionOptions(JsonNullable>> connectionOptions) { + Utils.checkNotNull(connectionOptions, "connectionOptions"); + this.connectionOptions = connectionOptions; + return this; + } + + /** + * The merchant reference for the payment link. + */ + public PaymentLinkCreate withExternalIdentifier(String externalIdentifier) { + Utils.checkNotNull(externalIdentifier, "externalIdentifier"); + this.externalIdentifier = JsonNullable.of(externalIdentifier); + return this; + } + + /** + * The merchant reference for the payment link. + */ + public PaymentLinkCreate withExternalIdentifier(JsonNullable externalIdentifier) { + Utils.checkNotNull(externalIdentifier, "externalIdentifier"); + this.externalIdentifier = externalIdentifier; + return this; + } + + /** + * The statement descriptor for the payment link. + */ + public PaymentLinkCreate withStatementDescriptor(StatementDescriptor statementDescriptor) { + Utils.checkNotNull(statementDescriptor, "statementDescriptor"); + this.statementDescriptor = JsonNullable.of(statementDescriptor); + return this; + } + + /** + * The statement descriptor for the payment link. + */ + public PaymentLinkCreate withStatementDescriptor(JsonNullable statementDescriptor) { + Utils.checkNotNull(statementDescriptor, "statementDescriptor"); + this.statementDescriptor = statementDescriptor; + return this; + } + + /** + * The locale for the payment link. + */ + public PaymentLinkCreate withLocale(Locale locale) { + Utils.checkNotNull(locale, "locale"); + this.locale = JsonNullable.of(locale); + return this; + } + + /** + * The locale for the payment link. + */ + public PaymentLinkCreate withLocale(JsonNullable locale) { + Utils.checkNotNull(locale, "locale"); + this.locale = locale; + return this; + } + + /** + * The merchant's display name. + */ + public PaymentLinkCreate withMerchantName(String merchantName) { + Utils.checkNotNull(merchantName, "merchantName"); + this.merchantName = JsonNullable.of(merchantName); + return this; + } + + /** + * The merchant's display name. + */ + public PaymentLinkCreate withMerchantName(JsonNullable merchantName) { + Utils.checkNotNull(merchantName, "merchantName"); + this.merchantName = merchantName; + return this; + } + + /** + * The merchant's website URL. + */ + public PaymentLinkCreate withMerchantUrl(String merchantUrl) { + Utils.checkNotNull(merchantUrl, "merchantUrl"); + this.merchantUrl = JsonNullable.of(merchantUrl); + return this; + } + + /** + * The merchant's website URL. + */ + public PaymentLinkCreate withMerchantUrl(JsonNullable merchantUrl) { + Utils.checkNotNull(merchantUrl, "merchantUrl"); + this.merchantUrl = merchantUrl; + return this; + } + + /** + * The merchant's banner image URL. + */ + public PaymentLinkCreate withMerchantBannerUrl(String merchantBannerUrl) { + Utils.checkNotNull(merchantBannerUrl, "merchantBannerUrl"); + this.merchantBannerUrl = JsonNullable.of(merchantBannerUrl); + return this; + } + + /** + * The merchant's banner image URL. + */ + public PaymentLinkCreate withMerchantBannerUrl(JsonNullable merchantBannerUrl) { + Utils.checkNotNull(merchantBannerUrl, "merchantBannerUrl"); + this.merchantBannerUrl = merchantBannerUrl; + return this; + } + + /** + * The merchant's brand color. + */ + public PaymentLinkCreate withMerchantColor(String merchantColor) { + Utils.checkNotNull(merchantColor, "merchantColor"); + this.merchantColor = JsonNullable.of(merchantColor); + return this; + } + + /** + * The merchant's brand color. + */ + public PaymentLinkCreate withMerchantColor(JsonNullable merchantColor) { + Utils.checkNotNull(merchantColor, "merchantColor"); + this.merchantColor = merchantColor; + return this; + } + + /** + * A message from the merchant. + */ + public PaymentLinkCreate withMerchantMessage(String merchantMessage) { + Utils.checkNotNull(merchantMessage, "merchantMessage"); + this.merchantMessage = JsonNullable.of(merchantMessage); + return this; + } + + /** + * A message from the merchant. + */ + public PaymentLinkCreate withMerchantMessage(JsonNullable merchantMessage) { + Utils.checkNotNull(merchantMessage, "merchantMessage"); + this.merchantMessage = merchantMessage; + return this; + } + + /** + * URL to the merchant's terms and conditions. + */ + public PaymentLinkCreate withMerchantTermsAndConditionsUrl(String merchantTermsAndConditionsUrl) { + Utils.checkNotNull(merchantTermsAndConditionsUrl, "merchantTermsAndConditionsUrl"); + this.merchantTermsAndConditionsUrl = JsonNullable.of(merchantTermsAndConditionsUrl); + return this; + } + + /** + * URL to the merchant's terms and conditions. + */ + public PaymentLinkCreate withMerchantTermsAndConditionsUrl(JsonNullable merchantTermsAndConditionsUrl) { + Utils.checkNotNull(merchantTermsAndConditionsUrl, "merchantTermsAndConditionsUrl"); + this.merchantTermsAndConditionsUrl = merchantTermsAndConditionsUrl; + return this; + } + + /** + * URL to the merchant's favicon. + */ + public PaymentLinkCreate withMerchantFaviconUrl(String merchantFaviconUrl) { + Utils.checkNotNull(merchantFaviconUrl, "merchantFaviconUrl"); + this.merchantFaviconUrl = JsonNullable.of(merchantFaviconUrl); + return this; + } + + /** + * URL to the merchant's favicon. + */ + public PaymentLinkCreate withMerchantFaviconUrl(JsonNullable merchantFaviconUrl) { + Utils.checkNotNull(merchantFaviconUrl, "merchantFaviconUrl"); + this.merchantFaviconUrl = merchantFaviconUrl; + return this; + } + + /** + * The amount for the payment link. + */ + public PaymentLinkCreate withAmount(long amount) { + Utils.checkNotNull(amount, "amount"); + this.amount = amount; + return this; + } + + /** + * The country code for the payment link. + */ + public PaymentLinkCreate withCountry(String country) { + Utils.checkNotNull(country, "country"); + this.country = country; + return this; + } + + /** + * The currency code for the payment link. + */ + public PaymentLinkCreate withCurrency(String currency) { + Utils.checkNotNull(currency, "currency"); + this.currency = currency; + return this; + } + + public PaymentLinkCreate withIntent(TransactionIntent intent) { + Utils.checkNotNull(intent, "intent"); + this.intent = Optional.ofNullable(intent); + return this; + } + + public PaymentLinkCreate withIntent(Optional intent) { + Utils.checkNotNull(intent, "intent"); + this.intent = intent; + return this; + } + + /** + * The return URL after payment completion. + */ + public PaymentLinkCreate withReturnUrl(String returnUrl) { + Utils.checkNotNull(returnUrl, "returnUrl"); + this.returnUrl = JsonNullable.of(returnUrl); + return this; + } + + /** + * The return URL after payment completion. + */ + public PaymentLinkCreate withReturnUrl(JsonNullable returnUrl) { + Utils.checkNotNull(returnUrl, "returnUrl"); + this.returnUrl = returnUrl; + return this; + } + + /** + * The cart items for the payment link. + */ + public PaymentLinkCreate withCartItems(List cartItems) { + Utils.checkNotNull(cartItems, "cartItems"); + this.cartItems = JsonNullable.of(cartItems); + return this; + } + + /** + * The cart items for the payment link. + */ + public PaymentLinkCreate withCartItems(JsonNullable> cartItems) { + Utils.checkNotNull(cartItems, "cartItems"); + this.cartItems = cartItems; + return this; + } + + /** + * Arbitrary metadata for the payment link. + */ + public PaymentLinkCreate withMetadata(Map metadata) { + Utils.checkNotNull(metadata, "metadata"); + this.metadata = JsonNullable.of(metadata); + return this; + } + + /** + * Arbitrary metadata for the payment link. + */ + public PaymentLinkCreate withMetadata(JsonNullable> metadata) { + Utils.checkNotNull(metadata, "metadata"); + this.metadata = metadata; + return this; + } + + /** + * The way payment method information made it to this transaction. + */ + public PaymentLinkCreate withPaymentSource(TransactionPaymentSource paymentSource) { + Utils.checkNotNull(paymentSource, "paymentSource"); + this.paymentSource = Optional.ofNullable(paymentSource); + return this; + } + + /** + * The way payment method information made it to this transaction. + */ + public PaymentLinkCreate withPaymentSource(Optional paymentSource) { + Utils.checkNotNull(paymentSource, "paymentSource"); + this.paymentSource = paymentSource; + return this; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PaymentLinkCreate other = (PaymentLinkCreate) o; + return + Objects.deepEquals(this.buyer, other.buyer) && + Objects.deepEquals(this.expiresAt, other.expiresAt) && + Objects.deepEquals(this.connectionOptions, other.connectionOptions) && + Objects.deepEquals(this.externalIdentifier, other.externalIdentifier) && + Objects.deepEquals(this.statementDescriptor, other.statementDescriptor) && + Objects.deepEquals(this.locale, other.locale) && + Objects.deepEquals(this.merchantName, other.merchantName) && + Objects.deepEquals(this.merchantUrl, other.merchantUrl) && + Objects.deepEquals(this.merchantBannerUrl, other.merchantBannerUrl) && + Objects.deepEquals(this.merchantColor, other.merchantColor) && + Objects.deepEquals(this.merchantMessage, other.merchantMessage) && + Objects.deepEquals(this.merchantTermsAndConditionsUrl, other.merchantTermsAndConditionsUrl) && + Objects.deepEquals(this.merchantFaviconUrl, other.merchantFaviconUrl) && + Objects.deepEquals(this.amount, other.amount) && + Objects.deepEquals(this.country, other.country) && + Objects.deepEquals(this.currency, other.currency) && + Objects.deepEquals(this.intent, other.intent) && + Objects.deepEquals(this.returnUrl, other.returnUrl) && + Objects.deepEquals(this.cartItems, other.cartItems) && + Objects.deepEquals(this.metadata, other.metadata) && + Objects.deepEquals(this.paymentSource, other.paymentSource); + } + + @Override + public int hashCode() { + return Objects.hash( + buyer, + expiresAt, + connectionOptions, + externalIdentifier, + statementDescriptor, + locale, + merchantName, + merchantUrl, + merchantBannerUrl, + merchantColor, + merchantMessage, + merchantTermsAndConditionsUrl, + merchantFaviconUrl, + amount, + country, + currency, + intent, + returnUrl, + cartItems, + metadata, + paymentSource); + } + + @Override + public String toString() { + return Utils.toString(PaymentLinkCreate.class, + "buyer", buyer, + "expiresAt", expiresAt, + "connectionOptions", connectionOptions, + "externalIdentifier", externalIdentifier, + "statementDescriptor", statementDescriptor, + "locale", locale, + "merchantName", merchantName, + "merchantUrl", merchantUrl, + "merchantBannerUrl", merchantBannerUrl, + "merchantColor", merchantColor, + "merchantMessage", merchantMessage, + "merchantTermsAndConditionsUrl", merchantTermsAndConditionsUrl, + "merchantFaviconUrl", merchantFaviconUrl, + "amount", amount, + "country", country, + "currency", currency, + "intent", intent, + "returnUrl", returnUrl, + "cartItems", cartItems, + "metadata", metadata, + "paymentSource", paymentSource); + } + + public final static class Builder { + + private JsonNullable buyer = JsonNullable.undefined(); + + private JsonNullable expiresAt = JsonNullable.undefined(); + + private JsonNullable>> connectionOptions = JsonNullable.undefined(); + + private JsonNullable externalIdentifier = JsonNullable.undefined(); + + private JsonNullable statementDescriptor = JsonNullable.undefined(); + + private JsonNullable locale = JsonNullable.undefined(); + + private JsonNullable merchantName = JsonNullable.undefined(); + + private JsonNullable merchantUrl = JsonNullable.undefined(); + + private JsonNullable merchantBannerUrl = JsonNullable.undefined(); + + private JsonNullable merchantColor = JsonNullable.undefined(); + + private JsonNullable merchantMessage = JsonNullable.undefined(); + + private JsonNullable merchantTermsAndConditionsUrl = JsonNullable.undefined(); + + private JsonNullable merchantFaviconUrl = JsonNullable.undefined(); + + private Long amount; + + private String country; + + private String currency; + + private Optional intent = Optional.empty(); + + private JsonNullable returnUrl = JsonNullable.undefined(); + + private JsonNullable> cartItems = JsonNullable.undefined(); + + private JsonNullable> metadata = JsonNullable.undefined(); + + private Optional paymentSource = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + /** + * The guest buyer for the payment link. + */ + public Builder buyer(GuestBuyerInput buyer) { + Utils.checkNotNull(buyer, "buyer"); + this.buyer = JsonNullable.of(buyer); + return this; + } + + /** + * The guest buyer for the payment link. + */ + public Builder buyer(JsonNullable buyer) { + Utils.checkNotNull(buyer, "buyer"); + this.buyer = buyer; + return this; + } + + /** + * The expiration date and time for the payment link. + */ + public Builder expiresAt(OffsetDateTime expiresAt) { + Utils.checkNotNull(expiresAt, "expiresAt"); + this.expiresAt = JsonNullable.of(expiresAt); + return this; + } + + /** + * The expiration date and time for the payment link. + */ + public Builder expiresAt(JsonNullable expiresAt) { + Utils.checkNotNull(expiresAt, "expiresAt"); + this.expiresAt = expiresAt; + return this; + } + + /** + * Connection options for the payment link. + */ + public Builder connectionOptions(Map> connectionOptions) { + Utils.checkNotNull(connectionOptions, "connectionOptions"); + this.connectionOptions = JsonNullable.of(connectionOptions); + return this; + } + + /** + * Connection options for the payment link. + */ + public Builder connectionOptions(JsonNullable>> connectionOptions) { + Utils.checkNotNull(connectionOptions, "connectionOptions"); + this.connectionOptions = connectionOptions; + return this; + } + + /** + * The merchant reference for the payment link. + */ + public Builder externalIdentifier(String externalIdentifier) { + Utils.checkNotNull(externalIdentifier, "externalIdentifier"); + this.externalIdentifier = JsonNullable.of(externalIdentifier); + return this; + } + + /** + * The merchant reference for the payment link. + */ + public Builder externalIdentifier(JsonNullable externalIdentifier) { + Utils.checkNotNull(externalIdentifier, "externalIdentifier"); + this.externalIdentifier = externalIdentifier; + return this; + } + + /** + * The statement descriptor for the payment link. + */ + public Builder statementDescriptor(StatementDescriptor statementDescriptor) { + Utils.checkNotNull(statementDescriptor, "statementDescriptor"); + this.statementDescriptor = JsonNullable.of(statementDescriptor); + return this; + } + + /** + * The statement descriptor for the payment link. + */ + public Builder statementDescriptor(JsonNullable statementDescriptor) { + Utils.checkNotNull(statementDescriptor, "statementDescriptor"); + this.statementDescriptor = statementDescriptor; + return this; + } + + /** + * The locale for the payment link. + */ + public Builder locale(Locale locale) { + Utils.checkNotNull(locale, "locale"); + this.locale = JsonNullable.of(locale); + return this; + } + + /** + * The locale for the payment link. + */ + public Builder locale(JsonNullable locale) { + Utils.checkNotNull(locale, "locale"); + this.locale = locale; + return this; + } + + /** + * The merchant's display name. + */ + public Builder merchantName(String merchantName) { + Utils.checkNotNull(merchantName, "merchantName"); + this.merchantName = JsonNullable.of(merchantName); + return this; + } + + /** + * The merchant's display name. + */ + public Builder merchantName(JsonNullable merchantName) { + Utils.checkNotNull(merchantName, "merchantName"); + this.merchantName = merchantName; + return this; + } + + /** + * The merchant's website URL. + */ + public Builder merchantUrl(String merchantUrl) { + Utils.checkNotNull(merchantUrl, "merchantUrl"); + this.merchantUrl = JsonNullable.of(merchantUrl); + return this; + } + + /** + * The merchant's website URL. + */ + public Builder merchantUrl(JsonNullable merchantUrl) { + Utils.checkNotNull(merchantUrl, "merchantUrl"); + this.merchantUrl = merchantUrl; + return this; + } + + /** + * The merchant's banner image URL. + */ + public Builder merchantBannerUrl(String merchantBannerUrl) { + Utils.checkNotNull(merchantBannerUrl, "merchantBannerUrl"); + this.merchantBannerUrl = JsonNullable.of(merchantBannerUrl); + return this; + } + + /** + * The merchant's banner image URL. + */ + public Builder merchantBannerUrl(JsonNullable merchantBannerUrl) { + Utils.checkNotNull(merchantBannerUrl, "merchantBannerUrl"); + this.merchantBannerUrl = merchantBannerUrl; + return this; + } + + /** + * The merchant's brand color. + */ + public Builder merchantColor(String merchantColor) { + Utils.checkNotNull(merchantColor, "merchantColor"); + this.merchantColor = JsonNullable.of(merchantColor); + return this; + } + + /** + * The merchant's brand color. + */ + public Builder merchantColor(JsonNullable merchantColor) { + Utils.checkNotNull(merchantColor, "merchantColor"); + this.merchantColor = merchantColor; + return this; + } + + /** + * A message from the merchant. + */ + public Builder merchantMessage(String merchantMessage) { + Utils.checkNotNull(merchantMessage, "merchantMessage"); + this.merchantMessage = JsonNullable.of(merchantMessage); + return this; + } + + /** + * A message from the merchant. + */ + public Builder merchantMessage(JsonNullable merchantMessage) { + Utils.checkNotNull(merchantMessage, "merchantMessage"); + this.merchantMessage = merchantMessage; + return this; + } + + /** + * URL to the merchant's terms and conditions. + */ + public Builder merchantTermsAndConditionsUrl(String merchantTermsAndConditionsUrl) { + Utils.checkNotNull(merchantTermsAndConditionsUrl, "merchantTermsAndConditionsUrl"); + this.merchantTermsAndConditionsUrl = JsonNullable.of(merchantTermsAndConditionsUrl); + return this; + } + + /** + * URL to the merchant's terms and conditions. + */ + public Builder merchantTermsAndConditionsUrl(JsonNullable merchantTermsAndConditionsUrl) { + Utils.checkNotNull(merchantTermsAndConditionsUrl, "merchantTermsAndConditionsUrl"); + this.merchantTermsAndConditionsUrl = merchantTermsAndConditionsUrl; + return this; + } + + /** + * URL to the merchant's favicon. + */ + public Builder merchantFaviconUrl(String merchantFaviconUrl) { + Utils.checkNotNull(merchantFaviconUrl, "merchantFaviconUrl"); + this.merchantFaviconUrl = JsonNullable.of(merchantFaviconUrl); + return this; + } + + /** + * URL to the merchant's favicon. + */ + public Builder merchantFaviconUrl(JsonNullable merchantFaviconUrl) { + Utils.checkNotNull(merchantFaviconUrl, "merchantFaviconUrl"); + this.merchantFaviconUrl = merchantFaviconUrl; + return this; + } + + /** + * The amount for the payment link. + */ + public Builder amount(long amount) { + Utils.checkNotNull(amount, "amount"); + this.amount = amount; + return this; + } + + /** + * The country code for the payment link. + */ + public Builder country(String country) { + Utils.checkNotNull(country, "country"); + this.country = country; + return this; + } + + /** + * The currency code for the payment link. + */ + public Builder currency(String currency) { + Utils.checkNotNull(currency, "currency"); + this.currency = currency; + return this; + } + + public Builder intent(TransactionIntent intent) { + Utils.checkNotNull(intent, "intent"); + this.intent = Optional.ofNullable(intent); + return this; + } + + public Builder intent(Optional intent) { + Utils.checkNotNull(intent, "intent"); + this.intent = intent; + return this; + } + + /** + * The return URL after payment completion. + */ + public Builder returnUrl(String returnUrl) { + Utils.checkNotNull(returnUrl, "returnUrl"); + this.returnUrl = JsonNullable.of(returnUrl); + return this; + } + + /** + * The return URL after payment completion. + */ + public Builder returnUrl(JsonNullable returnUrl) { + Utils.checkNotNull(returnUrl, "returnUrl"); + this.returnUrl = returnUrl; + return this; + } + + /** + * The cart items for the payment link. + */ + public Builder cartItems(List cartItems) { + Utils.checkNotNull(cartItems, "cartItems"); + this.cartItems = JsonNullable.of(cartItems); + return this; + } + + /** + * The cart items for the payment link. + */ + public Builder cartItems(JsonNullable> cartItems) { + Utils.checkNotNull(cartItems, "cartItems"); + this.cartItems = cartItems; + return this; + } + + /** + * Arbitrary metadata for the payment link. + */ + public Builder metadata(Map metadata) { + Utils.checkNotNull(metadata, "metadata"); + this.metadata = JsonNullable.of(metadata); + return this; + } + + /** + * Arbitrary metadata for the payment link. + */ + public Builder metadata(JsonNullable> metadata) { + Utils.checkNotNull(metadata, "metadata"); + this.metadata = metadata; + return this; + } + + /** + * The way payment method information made it to this transaction. + */ + public Builder paymentSource(TransactionPaymentSource paymentSource) { + Utils.checkNotNull(paymentSource, "paymentSource"); + this.paymentSource = Optional.ofNullable(paymentSource); + return this; + } + + /** + * The way payment method information made it to this transaction. + */ + public Builder paymentSource(Optional paymentSource) { + Utils.checkNotNull(paymentSource, "paymentSource"); + this.paymentSource = paymentSource; + return this; + } + + public PaymentLinkCreate build() { + return new PaymentLinkCreate( + buyer, + expiresAt, + connectionOptions, + externalIdentifier, + statementDescriptor, + locale, + merchantName, + merchantUrl, + merchantBannerUrl, + merchantColor, + merchantMessage, + merchantTermsAndConditionsUrl, + merchantFaviconUrl, + amount, + country, + currency, + intent, + returnUrl, + cartItems, + metadata, + paymentSource); + } + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/components/PaymentLinkStatus.java b/src/main/java/com/gr4vy/sdk/models/components/PaymentLinkStatus.java new file mode 100644 index 00000000..7a555660 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/components/PaymentLinkStatus.java @@ -0,0 +1,187 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.components; + +import com.fasterxml.jackson.core.JacksonException; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +/** + *

Wrapper class for an "open" enum. "Open" enums are those that are expected + * to evolve (particularly with the addition of enum members over time). If an + * open enum is used then the appearance of unexpected enum values (say in a + * response from an updated an API) will not bring about a runtime error thus + * ensuring that non-updated client versions can continue to work without error. + * + *

Note that instances are immutable and are singletons (an internal thread-safe + * cache is maintained to ensure that). As a consequence instances created with the + * same value will satisfy reference equality (via {@code ==}). + * + *

This class is intended to emulate an enum (in terms of common usage and with + * reference equality) but with the ability to carry unknown values. Unfortunately + * Java does not permit the use of an instance in a switch expression but you can + * use the {@code asEnum()} method (after dealing with the `Optional` appropriately). + * + */ +@JsonDeserialize(using = PaymentLinkStatus._Deserializer.class) +@JsonSerialize(using = PaymentLinkStatus._Serializer.class) +public class PaymentLinkStatus { + + public static final PaymentLinkStatus ACTIVE = new PaymentLinkStatus("active"); + public static final PaymentLinkStatus COMPLETED = new PaymentLinkStatus("completed"); + public static final PaymentLinkStatus EXPIRED = new PaymentLinkStatus("expired"); + public static final PaymentLinkStatus PROCESSING = new PaymentLinkStatus("processing"); + + // This map will grow whenever a Color gets created with a new + // unrecognized value (a potential memory leak if the user is not + // careful). Keep this field lower case to avoid clashing with + // generated member names which will always be upper cased (Java + // convention) + private static final Map values = createValuesMap(); + private static final Map enums = createEnumsMap(); + + private final String value; + + private PaymentLinkStatus(String value) { + this.value = value; + } + + /** + * Returns a PaymentLinkStatus with the given value. For a specific value the + * returned object will always be a singleton so reference equality + * is satisfied when the values are the same. + * + * @param value value to be wrapped as PaymentLinkStatus + */ + public static PaymentLinkStatus of(String value) { + synchronized (PaymentLinkStatus.class) { + return values.computeIfAbsent(value, v -> new PaymentLinkStatus(v)); + } + } + + public String value() { + return value; + } + + public Optional asEnum() { + return Optional.ofNullable(enums.getOrDefault(value, null)); + } + + public boolean isKnown() { + return asEnum().isPresent(); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public boolean equals(java.lang.Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + PaymentLinkStatus other = (PaymentLinkStatus) obj; + return Objects.equals(value, other.value); + } + + @Override + public String toString() { + return "PaymentLinkStatus [value=" + value + "]"; + } + + // return an array just like an enum + public static PaymentLinkStatus[] values() { + synchronized (PaymentLinkStatus.class) { + return values.values().toArray(new PaymentLinkStatus[] {}); + } + } + + private static final Map createValuesMap() { + Map map = new LinkedHashMap<>(); + map.put("active", ACTIVE); + map.put("completed", COMPLETED); + map.put("expired", EXPIRED); + map.put("processing", PROCESSING); + return map; + } + + private static final Map createEnumsMap() { + Map map = new HashMap<>(); + map.put("active", PaymentLinkStatusEnum.ACTIVE); + map.put("completed", PaymentLinkStatusEnum.COMPLETED); + map.put("expired", PaymentLinkStatusEnum.EXPIRED); + map.put("processing", PaymentLinkStatusEnum.PROCESSING); + return map; + } + + @SuppressWarnings("serial") + public static final class _Serializer extends StdSerializer { + + protected _Serializer() { + super(PaymentLinkStatus.class); + } + + @Override + public void serialize(PaymentLinkStatus value, JsonGenerator g, SerializerProvider provider) + throws IOException, JsonProcessingException { + g.writeObject(value.value); + } + } + + @SuppressWarnings("serial") + public static final class _Deserializer extends StdDeserializer { + + protected _Deserializer() { + super(PaymentLinkStatus.class); + } + + @Override + public PaymentLinkStatus deserialize(JsonParser p, DeserializationContext ctxt) + throws IOException, JacksonException { + String v = p.readValueAs(new TypeReference() {}); + // use the factory method to ensure we get singletons + return PaymentLinkStatus.of(v); + } + } + + public enum PaymentLinkStatusEnum { + + ACTIVE("active"), + COMPLETED("completed"), + EXPIRED("expired"), + PROCESSING("processing"),; + + private final String value; + + private PaymentLinkStatusEnum(String value) { + this.value = value; + } + + public String value() { + return value; + } + } +} + diff --git a/src/main/java/com/gr4vy/sdk/models/operations/AddPaymentLinkRequest.java b/src/main/java/com/gr4vy/sdk/models/operations/AddPaymentLinkRequest.java new file mode 100644 index 00000000..0712d796 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/operations/AddPaymentLinkRequest.java @@ -0,0 +1,152 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.operations; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.gr4vy.sdk.models.components.PaymentLinkCreate; +import com.gr4vy.sdk.utils.SpeakeasyMetadata; +import com.gr4vy.sdk.utils.Utils; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; + +public class AddPaymentLinkRequest { + + /** + * The ID of the merchant account to use for this request. + */ + @SpeakeasyMetadata("header:style=simple,explode=false,name=x-gr4vy-merchant-account-id") + private JsonNullable merchantAccountId; + + @SpeakeasyMetadata("request:mediaType=application/json") + private PaymentLinkCreate paymentLinkCreate; + + @JsonCreator + public AddPaymentLinkRequest( + JsonNullable merchantAccountId, + PaymentLinkCreate paymentLinkCreate) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + Utils.checkNotNull(paymentLinkCreate, "paymentLinkCreate"); + this.merchantAccountId = merchantAccountId; + this.paymentLinkCreate = paymentLinkCreate; + } + + public AddPaymentLinkRequest( + PaymentLinkCreate paymentLinkCreate) { + this(JsonNullable.undefined(), paymentLinkCreate); + } + + /** + * The ID of the merchant account to use for this request. + */ + @JsonIgnore + public JsonNullable merchantAccountId() { + return merchantAccountId; + } + + @JsonIgnore + public PaymentLinkCreate paymentLinkCreate() { + return paymentLinkCreate; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * The ID of the merchant account to use for this request. + */ + public AddPaymentLinkRequest withMerchantAccountId(String merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = JsonNullable.of(merchantAccountId); + return this; + } + + /** + * The ID of the merchant account to use for this request. + */ + public AddPaymentLinkRequest withMerchantAccountId(JsonNullable merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = merchantAccountId; + return this; + } + + public AddPaymentLinkRequest withPaymentLinkCreate(PaymentLinkCreate paymentLinkCreate) { + Utils.checkNotNull(paymentLinkCreate, "paymentLinkCreate"); + this.paymentLinkCreate = paymentLinkCreate; + return this; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AddPaymentLinkRequest other = (AddPaymentLinkRequest) o; + return + Objects.deepEquals(this.merchantAccountId, other.merchantAccountId) && + Objects.deepEquals(this.paymentLinkCreate, other.paymentLinkCreate); + } + + @Override + public int hashCode() { + return Objects.hash( + merchantAccountId, + paymentLinkCreate); + } + + @Override + public String toString() { + return Utils.toString(AddPaymentLinkRequest.class, + "merchantAccountId", merchantAccountId, + "paymentLinkCreate", paymentLinkCreate); + } + + public final static class Builder { + + private JsonNullable merchantAccountId = JsonNullable.undefined(); + + private PaymentLinkCreate paymentLinkCreate; + + private Builder() { + // force use of static builder() method + } + + /** + * The ID of the merchant account to use for this request. + */ + public Builder merchantAccountId(String merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = JsonNullable.of(merchantAccountId); + return this; + } + + /** + * The ID of the merchant account to use for this request. + */ + public Builder merchantAccountId(JsonNullable merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = merchantAccountId; + return this; + } + + public Builder paymentLinkCreate(PaymentLinkCreate paymentLinkCreate) { + Utils.checkNotNull(paymentLinkCreate, "paymentLinkCreate"); + this.paymentLinkCreate = paymentLinkCreate; + return this; + } + + public AddPaymentLinkRequest build() { + return new AddPaymentLinkRequest( + merchantAccountId, + paymentLinkCreate); + } + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/operations/AddPaymentLinkRequestBuilder.java b/src/main/java/com/gr4vy/sdk/models/operations/AddPaymentLinkRequestBuilder.java new file mode 100644 index 00000000..022c740c --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/operations/AddPaymentLinkRequestBuilder.java @@ -0,0 +1,46 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.operations; + +import com.gr4vy.sdk.models.components.PaymentLinkCreate; +import com.gr4vy.sdk.utils.Utils; +import java.lang.Exception; +import java.lang.String; +import org.openapitools.jackson.nullable.JsonNullable; + +public class AddPaymentLinkRequestBuilder { + + private JsonNullable merchantAccountId = JsonNullable.undefined(); + private PaymentLinkCreate paymentLinkCreate; + private final SDKMethodInterfaces.MethodCallAddPaymentLink sdk; + + public AddPaymentLinkRequestBuilder(SDKMethodInterfaces.MethodCallAddPaymentLink sdk) { + this.sdk = sdk; + } + + public AddPaymentLinkRequestBuilder merchantAccountId(String merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = JsonNullable.of(merchantAccountId); + return this; + } + + public AddPaymentLinkRequestBuilder merchantAccountId(JsonNullable merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = merchantAccountId; + return this; + } + + public AddPaymentLinkRequestBuilder paymentLinkCreate(PaymentLinkCreate paymentLinkCreate) { + Utils.checkNotNull(paymentLinkCreate, "paymentLinkCreate"); + this.paymentLinkCreate = paymentLinkCreate; + return this; + } + + public AddPaymentLinkResponse call() throws Exception { + + return sdk.create( + merchantAccountId, + paymentLinkCreate); + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/operations/AddPaymentLinkResponse.java b/src/main/java/com/gr4vy/sdk/models/operations/AddPaymentLinkResponse.java new file mode 100644 index 00000000..82929175 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/operations/AddPaymentLinkResponse.java @@ -0,0 +1,249 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.operations; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.gr4vy.sdk.models.components.PaymentLink; +import com.gr4vy.sdk.utils.Response; +import com.gr4vy.sdk.utils.Utils; +import java.io.InputStream; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Objects; +import java.util.Optional; + +public class AddPaymentLinkResponse implements Response { + + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Successful Response + */ + private Optional paymentLink; + + @JsonCreator + public AddPaymentLinkResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional paymentLink) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(paymentLink, "paymentLink"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.paymentLink = paymentLink; + } + + public AddPaymentLinkResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Successful Response + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional paymentLink() { + return (Optional) paymentLink; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * HTTP response content type for this operation + */ + public AddPaymentLinkResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public AddPaymentLinkResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public AddPaymentLinkResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Successful Response + */ + public AddPaymentLinkResponse withPaymentLink(PaymentLink paymentLink) { + Utils.checkNotNull(paymentLink, "paymentLink"); + this.paymentLink = Optional.ofNullable(paymentLink); + return this; + } + + /** + * Successful Response + */ + public AddPaymentLinkResponse withPaymentLink(Optional paymentLink) { + Utils.checkNotNull(paymentLink, "paymentLink"); + this.paymentLink = paymentLink; + return this; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AddPaymentLinkResponse other = (AddPaymentLinkResponse) o; + return + Objects.deepEquals(this.contentType, other.contentType) && + Objects.deepEquals(this.statusCode, other.statusCode) && + Objects.deepEquals(this.rawResponse, other.rawResponse) && + Objects.deepEquals(this.paymentLink, other.paymentLink); + } + + @Override + public int hashCode() { + return Objects.hash( + contentType, + statusCode, + rawResponse, + paymentLink); + } + + @Override + public String toString() { + return Utils.toString(AddPaymentLinkResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "paymentLink", paymentLink); + } + + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional paymentLink = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Successful Response + */ + public Builder paymentLink(PaymentLink paymentLink) { + Utils.checkNotNull(paymentLink, "paymentLink"); + this.paymentLink = Optional.ofNullable(paymentLink); + return this; + } + + /** + * Successful Response + */ + public Builder paymentLink(Optional paymentLink) { + Utils.checkNotNull(paymentLink, "paymentLink"); + this.paymentLink = paymentLink; + return this; + } + + public AddPaymentLinkResponse build() { + return new AddPaymentLinkResponse( + contentType, + statusCode, + rawResponse, + paymentLink); + } + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/operations/ExpirePaymentLinkRequest.java b/src/main/java/com/gr4vy/sdk/models/operations/ExpirePaymentLinkRequest.java new file mode 100644 index 00000000..cbd595d6 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/operations/ExpirePaymentLinkRequest.java @@ -0,0 +1,163 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.operations; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.gr4vy.sdk.utils.SpeakeasyMetadata; +import com.gr4vy.sdk.utils.Utils; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; + +public class ExpirePaymentLinkRequest { + + /** + * The unique identifier for the payment link. + */ + @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=payment_link_id") + private String paymentLinkId; + + /** + * The ID of the merchant account to use for this request. + */ + @SpeakeasyMetadata("header:style=simple,explode=false,name=x-gr4vy-merchant-account-id") + private JsonNullable merchantAccountId; + + @JsonCreator + public ExpirePaymentLinkRequest( + String paymentLinkId, + JsonNullable merchantAccountId) { + Utils.checkNotNull(paymentLinkId, "paymentLinkId"); + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.paymentLinkId = paymentLinkId; + this.merchantAccountId = merchantAccountId; + } + + public ExpirePaymentLinkRequest( + String paymentLinkId) { + this(paymentLinkId, JsonNullable.undefined()); + } + + /** + * The unique identifier for the payment link. + */ + @JsonIgnore + public String paymentLinkId() { + return paymentLinkId; + } + + /** + * The ID of the merchant account to use for this request. + */ + @JsonIgnore + public JsonNullable merchantAccountId() { + return merchantAccountId; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * The unique identifier for the payment link. + */ + public ExpirePaymentLinkRequest withPaymentLinkId(String paymentLinkId) { + Utils.checkNotNull(paymentLinkId, "paymentLinkId"); + this.paymentLinkId = paymentLinkId; + return this; + } + + /** + * The ID of the merchant account to use for this request. + */ + public ExpirePaymentLinkRequest withMerchantAccountId(String merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = JsonNullable.of(merchantAccountId); + return this; + } + + /** + * The ID of the merchant account to use for this request. + */ + public ExpirePaymentLinkRequest withMerchantAccountId(JsonNullable merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = merchantAccountId; + return this; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExpirePaymentLinkRequest other = (ExpirePaymentLinkRequest) o; + return + Objects.deepEquals(this.paymentLinkId, other.paymentLinkId) && + Objects.deepEquals(this.merchantAccountId, other.merchantAccountId); + } + + @Override + public int hashCode() { + return Objects.hash( + paymentLinkId, + merchantAccountId); + } + + @Override + public String toString() { + return Utils.toString(ExpirePaymentLinkRequest.class, + "paymentLinkId", paymentLinkId, + "merchantAccountId", merchantAccountId); + } + + public final static class Builder { + + private String paymentLinkId; + + private JsonNullable merchantAccountId = JsonNullable.undefined(); + + private Builder() { + // force use of static builder() method + } + + /** + * The unique identifier for the payment link. + */ + public Builder paymentLinkId(String paymentLinkId) { + Utils.checkNotNull(paymentLinkId, "paymentLinkId"); + this.paymentLinkId = paymentLinkId; + return this; + } + + /** + * The ID of the merchant account to use for this request. + */ + public Builder merchantAccountId(String merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = JsonNullable.of(merchantAccountId); + return this; + } + + /** + * The ID of the merchant account to use for this request. + */ + public Builder merchantAccountId(JsonNullable merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = merchantAccountId; + return this; + } + + public ExpirePaymentLinkRequest build() { + return new ExpirePaymentLinkRequest( + paymentLinkId, + merchantAccountId); + } + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/operations/ExpirePaymentLinkRequestBuilder.java b/src/main/java/com/gr4vy/sdk/models/operations/ExpirePaymentLinkRequestBuilder.java new file mode 100644 index 00000000..a968b428 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/operations/ExpirePaymentLinkRequestBuilder.java @@ -0,0 +1,45 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.operations; + +import com.gr4vy.sdk.utils.Utils; +import java.lang.Exception; +import java.lang.String; +import org.openapitools.jackson.nullable.JsonNullable; + +public class ExpirePaymentLinkRequestBuilder { + + private String paymentLinkId; + private JsonNullable merchantAccountId = JsonNullable.undefined(); + private final SDKMethodInterfaces.MethodCallExpirePaymentLink sdk; + + public ExpirePaymentLinkRequestBuilder(SDKMethodInterfaces.MethodCallExpirePaymentLink sdk) { + this.sdk = sdk; + } + + public ExpirePaymentLinkRequestBuilder paymentLinkId(String paymentLinkId) { + Utils.checkNotNull(paymentLinkId, "paymentLinkId"); + this.paymentLinkId = paymentLinkId; + return this; + } + + public ExpirePaymentLinkRequestBuilder merchantAccountId(String merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = JsonNullable.of(merchantAccountId); + return this; + } + + public ExpirePaymentLinkRequestBuilder merchantAccountId(JsonNullable merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = merchantAccountId; + return this; + } + + public ExpirePaymentLinkResponse call() throws Exception { + + return sdk.expire( + paymentLinkId, + merchantAccountId); + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/operations/ExpirePaymentLinkResponse.java b/src/main/java/com/gr4vy/sdk/models/operations/ExpirePaymentLinkResponse.java new file mode 100644 index 00000000..7643fd51 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/operations/ExpirePaymentLinkResponse.java @@ -0,0 +1,180 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.operations; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.gr4vy.sdk.utils.Response; +import com.gr4vy.sdk.utils.Utils; +import java.io.InputStream; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.net.http.HttpResponse; +import java.util.Objects; + +public class ExpirePaymentLinkResponse implements Response { + + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + @JsonCreator + public ExpirePaymentLinkResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * HTTP response content type for this operation + */ + public ExpirePaymentLinkResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public ExpirePaymentLinkResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public ExpirePaymentLinkResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExpirePaymentLinkResponse other = (ExpirePaymentLinkResponse) o; + return + Objects.deepEquals(this.contentType, other.contentType) && + Objects.deepEquals(this.statusCode, other.statusCode) && + Objects.deepEquals(this.rawResponse, other.rawResponse); + } + + @Override + public int hashCode() { + return Objects.hash( + contentType, + statusCode, + rawResponse); + } + + @Override + public String toString() { + return Utils.toString(ExpirePaymentLinkResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse); + } + + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Builder() { + // force use of static builder() method + } + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + public ExpirePaymentLinkResponse build() { + return new ExpirePaymentLinkResponse( + contentType, + statusCode, + rawResponse); + } + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/operations/GetPaymentLinkRequest.java b/src/main/java/com/gr4vy/sdk/models/operations/GetPaymentLinkRequest.java new file mode 100644 index 00000000..cc490bc4 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/operations/GetPaymentLinkRequest.java @@ -0,0 +1,163 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.operations; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.gr4vy.sdk.utils.SpeakeasyMetadata; +import com.gr4vy.sdk.utils.Utils; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; + +public class GetPaymentLinkRequest { + + /** + * The unique identifier for the payment link. + */ + @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=payment_link_id") + private String paymentLinkId; + + /** + * The ID of the merchant account to use for this request. + */ + @SpeakeasyMetadata("header:style=simple,explode=false,name=x-gr4vy-merchant-account-id") + private JsonNullable merchantAccountId; + + @JsonCreator + public GetPaymentLinkRequest( + String paymentLinkId, + JsonNullable merchantAccountId) { + Utils.checkNotNull(paymentLinkId, "paymentLinkId"); + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.paymentLinkId = paymentLinkId; + this.merchantAccountId = merchantAccountId; + } + + public GetPaymentLinkRequest( + String paymentLinkId) { + this(paymentLinkId, JsonNullable.undefined()); + } + + /** + * The unique identifier for the payment link. + */ + @JsonIgnore + public String paymentLinkId() { + return paymentLinkId; + } + + /** + * The ID of the merchant account to use for this request. + */ + @JsonIgnore + public JsonNullable merchantAccountId() { + return merchantAccountId; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * The unique identifier for the payment link. + */ + public GetPaymentLinkRequest withPaymentLinkId(String paymentLinkId) { + Utils.checkNotNull(paymentLinkId, "paymentLinkId"); + this.paymentLinkId = paymentLinkId; + return this; + } + + /** + * The ID of the merchant account to use for this request. + */ + public GetPaymentLinkRequest withMerchantAccountId(String merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = JsonNullable.of(merchantAccountId); + return this; + } + + /** + * The ID of the merchant account to use for this request. + */ + public GetPaymentLinkRequest withMerchantAccountId(JsonNullable merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = merchantAccountId; + return this; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetPaymentLinkRequest other = (GetPaymentLinkRequest) o; + return + Objects.deepEquals(this.paymentLinkId, other.paymentLinkId) && + Objects.deepEquals(this.merchantAccountId, other.merchantAccountId); + } + + @Override + public int hashCode() { + return Objects.hash( + paymentLinkId, + merchantAccountId); + } + + @Override + public String toString() { + return Utils.toString(GetPaymentLinkRequest.class, + "paymentLinkId", paymentLinkId, + "merchantAccountId", merchantAccountId); + } + + public final static class Builder { + + private String paymentLinkId; + + private JsonNullable merchantAccountId = JsonNullable.undefined(); + + private Builder() { + // force use of static builder() method + } + + /** + * The unique identifier for the payment link. + */ + public Builder paymentLinkId(String paymentLinkId) { + Utils.checkNotNull(paymentLinkId, "paymentLinkId"); + this.paymentLinkId = paymentLinkId; + return this; + } + + /** + * The ID of the merchant account to use for this request. + */ + public Builder merchantAccountId(String merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = JsonNullable.of(merchantAccountId); + return this; + } + + /** + * The ID of the merchant account to use for this request. + */ + public Builder merchantAccountId(JsonNullable merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = merchantAccountId; + return this; + } + + public GetPaymentLinkRequest build() { + return new GetPaymentLinkRequest( + paymentLinkId, + merchantAccountId); + } + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/operations/GetPaymentLinkRequestBuilder.java b/src/main/java/com/gr4vy/sdk/models/operations/GetPaymentLinkRequestBuilder.java new file mode 100644 index 00000000..9b055502 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/operations/GetPaymentLinkRequestBuilder.java @@ -0,0 +1,64 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.operations; + +import com.gr4vy.sdk.utils.Options; +import com.gr4vy.sdk.utils.RetryConfig; +import com.gr4vy.sdk.utils.Utils; +import java.lang.Exception; +import java.lang.String; +import java.util.Optional; +import org.openapitools.jackson.nullable.JsonNullable; + +public class GetPaymentLinkRequestBuilder { + + private String paymentLinkId; + private JsonNullable merchantAccountId = JsonNullable.undefined(); + private Optional retryConfig = Optional.empty(); + private final SDKMethodInterfaces.MethodCallGetPaymentLink sdk; + + public GetPaymentLinkRequestBuilder(SDKMethodInterfaces.MethodCallGetPaymentLink sdk) { + this.sdk = sdk; + } + + public GetPaymentLinkRequestBuilder paymentLinkId(String paymentLinkId) { + Utils.checkNotNull(paymentLinkId, "paymentLinkId"); + this.paymentLinkId = paymentLinkId; + return this; + } + + public GetPaymentLinkRequestBuilder merchantAccountId(String merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = JsonNullable.of(merchantAccountId); + return this; + } + + public GetPaymentLinkRequestBuilder merchantAccountId(JsonNullable merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = merchantAccountId; + return this; + } + + public GetPaymentLinkRequestBuilder retryConfig(RetryConfig retryConfig) { + Utils.checkNotNull(retryConfig, "retryConfig"); + this.retryConfig = Optional.of(retryConfig); + return this; + } + + public GetPaymentLinkRequestBuilder retryConfig(Optional retryConfig) { + Utils.checkNotNull(retryConfig, "retryConfig"); + this.retryConfig = retryConfig; + return this; + } + + public GetPaymentLinkResponse call() throws Exception { + Optional options = Optional.of(Options.builder() + .retryConfig(retryConfig) + .build()); + return sdk.get( + paymentLinkId, + merchantAccountId, + options); + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/operations/GetPaymentLinkResponse.java b/src/main/java/com/gr4vy/sdk/models/operations/GetPaymentLinkResponse.java new file mode 100644 index 00000000..af543605 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/operations/GetPaymentLinkResponse.java @@ -0,0 +1,249 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.operations; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.gr4vy.sdk.models.components.PaymentLink; +import com.gr4vy.sdk.utils.Response; +import com.gr4vy.sdk.utils.Utils; +import java.io.InputStream; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Objects; +import java.util.Optional; + +public class GetPaymentLinkResponse implements Response { + + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Successful Response + */ + private Optional paymentLink; + + @JsonCreator + public GetPaymentLinkResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional paymentLink) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(paymentLink, "paymentLink"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.paymentLink = paymentLink; + } + + public GetPaymentLinkResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Successful Response + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional paymentLink() { + return (Optional) paymentLink; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * HTTP response content type for this operation + */ + public GetPaymentLinkResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public GetPaymentLinkResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public GetPaymentLinkResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Successful Response + */ + public GetPaymentLinkResponse withPaymentLink(PaymentLink paymentLink) { + Utils.checkNotNull(paymentLink, "paymentLink"); + this.paymentLink = Optional.ofNullable(paymentLink); + return this; + } + + /** + * Successful Response + */ + public GetPaymentLinkResponse withPaymentLink(Optional paymentLink) { + Utils.checkNotNull(paymentLink, "paymentLink"); + this.paymentLink = paymentLink; + return this; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetPaymentLinkResponse other = (GetPaymentLinkResponse) o; + return + Objects.deepEquals(this.contentType, other.contentType) && + Objects.deepEquals(this.statusCode, other.statusCode) && + Objects.deepEquals(this.rawResponse, other.rawResponse) && + Objects.deepEquals(this.paymentLink, other.paymentLink); + } + + @Override + public int hashCode() { + return Objects.hash( + contentType, + statusCode, + rawResponse, + paymentLink); + } + + @Override + public String toString() { + return Utils.toString(GetPaymentLinkResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "paymentLink", paymentLink); + } + + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional paymentLink = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Successful Response + */ + public Builder paymentLink(PaymentLink paymentLink) { + Utils.checkNotNull(paymentLink, "paymentLink"); + this.paymentLink = Optional.ofNullable(paymentLink); + return this; + } + + /** + * Successful Response + */ + public Builder paymentLink(Optional paymentLink) { + Utils.checkNotNull(paymentLink, "paymentLink"); + this.paymentLink = paymentLink; + return this; + } + + public GetPaymentLinkResponse build() { + return new GetPaymentLinkResponse( + contentType, + statusCode, + rawResponse, + paymentLink); + } + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/operations/ListPaymentLinksRequest.java b/src/main/java/com/gr4vy/sdk/models/operations/ListPaymentLinksRequest.java new file mode 100644 index 00000000..7df13434 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/operations/ListPaymentLinksRequest.java @@ -0,0 +1,252 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.operations; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.type.TypeReference; +import com.gr4vy.sdk.utils.LazySingletonValue; +import com.gr4vy.sdk.utils.SpeakeasyMetadata; +import com.gr4vy.sdk.utils.Utils; +import java.lang.Long; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import java.util.Optional; +import org.openapitools.jackson.nullable.JsonNullable; + +public class ListPaymentLinksRequest { + + /** + * A pointer to the page of results to return. + */ + @SpeakeasyMetadata("queryParam:style=form,explode=true,name=cursor") + private JsonNullable cursor; + + /** + * The maximum number of items that are returned. + */ + @SpeakeasyMetadata("queryParam:style=form,explode=true,name=limit") + private Optional limit; + + /** + * The ID of the merchant account to use for this request. + */ + @SpeakeasyMetadata("header:style=simple,explode=false,name=x-gr4vy-merchant-account-id") + private JsonNullable merchantAccountId; + + @JsonCreator + public ListPaymentLinksRequest( + JsonNullable cursor, + Optional limit, + JsonNullable merchantAccountId) { + Utils.checkNotNull(cursor, "cursor"); + Utils.checkNotNull(limit, "limit"); + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.cursor = cursor; + this.limit = limit; + this.merchantAccountId = merchantAccountId; + } + + public ListPaymentLinksRequest() { + this(JsonNullable.undefined(), Optional.empty(), JsonNullable.undefined()); + } + + /** + * A pointer to the page of results to return. + */ + @JsonIgnore + public JsonNullable cursor() { + return cursor; + } + + /** + * The maximum number of items that are returned. + */ + @JsonIgnore + public Optional limit() { + return limit; + } + + /** + * The ID of the merchant account to use for this request. + */ + @JsonIgnore + public JsonNullable merchantAccountId() { + return merchantAccountId; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * A pointer to the page of results to return. + */ + public ListPaymentLinksRequest withCursor(String cursor) { + Utils.checkNotNull(cursor, "cursor"); + this.cursor = JsonNullable.of(cursor); + return this; + } + + /** + * A pointer to the page of results to return. + */ + public ListPaymentLinksRequest withCursor(JsonNullable cursor) { + Utils.checkNotNull(cursor, "cursor"); + this.cursor = cursor; + return this; + } + + /** + * The maximum number of items that are returned. + */ + public ListPaymentLinksRequest withLimit(long limit) { + Utils.checkNotNull(limit, "limit"); + this.limit = Optional.ofNullable(limit); + return this; + } + + /** + * The maximum number of items that are returned. + */ + public ListPaymentLinksRequest withLimit(Optional limit) { + Utils.checkNotNull(limit, "limit"); + this.limit = limit; + return this; + } + + /** + * The ID of the merchant account to use for this request. + */ + public ListPaymentLinksRequest withMerchantAccountId(String merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = JsonNullable.of(merchantAccountId); + return this; + } + + /** + * The ID of the merchant account to use for this request. + */ + public ListPaymentLinksRequest withMerchantAccountId(JsonNullable merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = merchantAccountId; + return this; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListPaymentLinksRequest other = (ListPaymentLinksRequest) o; + return + Objects.deepEquals(this.cursor, other.cursor) && + Objects.deepEquals(this.limit, other.limit) && + Objects.deepEquals(this.merchantAccountId, other.merchantAccountId); + } + + @Override + public int hashCode() { + return Objects.hash( + cursor, + limit, + merchantAccountId); + } + + @Override + public String toString() { + return Utils.toString(ListPaymentLinksRequest.class, + "cursor", cursor, + "limit", limit, + "merchantAccountId", merchantAccountId); + } + + public final static class Builder { + + private JsonNullable cursor = JsonNullable.undefined(); + + private Optional limit; + + private JsonNullable merchantAccountId = JsonNullable.undefined(); + + private Builder() { + // force use of static builder() method + } + + /** + * A pointer to the page of results to return. + */ + public Builder cursor(String cursor) { + Utils.checkNotNull(cursor, "cursor"); + this.cursor = JsonNullable.of(cursor); + return this; + } + + /** + * A pointer to the page of results to return. + */ + public Builder cursor(JsonNullable cursor) { + Utils.checkNotNull(cursor, "cursor"); + this.cursor = cursor; + return this; + } + + /** + * The maximum number of items that are returned. + */ + public Builder limit(long limit) { + Utils.checkNotNull(limit, "limit"); + this.limit = Optional.ofNullable(limit); + return this; + } + + /** + * The maximum number of items that are returned. + */ + public Builder limit(Optional limit) { + Utils.checkNotNull(limit, "limit"); + this.limit = limit; + return this; + } + + /** + * The ID of the merchant account to use for this request. + */ + public Builder merchantAccountId(String merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = JsonNullable.of(merchantAccountId); + return this; + } + + /** + * The ID of the merchant account to use for this request. + */ + public Builder merchantAccountId(JsonNullable merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = merchantAccountId; + return this; + } + + public ListPaymentLinksRequest build() { + if (limit == null) { + limit = _SINGLETON_VALUE_Limit.value(); + } + return new ListPaymentLinksRequest( + cursor, + limit, + merchantAccountId); + } + + private static final LazySingletonValue> _SINGLETON_VALUE_Limit = + new LazySingletonValue<>( + "limit", + "20", + new TypeReference>() {}); + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/operations/ListPaymentLinksRequestBuilder.java b/src/main/java/com/gr4vy/sdk/models/operations/ListPaymentLinksRequestBuilder.java new file mode 100644 index 00000000..34b89948 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/operations/ListPaymentLinksRequestBuilder.java @@ -0,0 +1,121 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.operations; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.gr4vy.sdk.models.errors.APIException; +import com.gr4vy.sdk.utils.LazySingletonValue; +import com.gr4vy.sdk.utils.Options; +import com.gr4vy.sdk.utils.RetryConfig; +import com.gr4vy.sdk.utils.Utils; +import java.lang.Exception; +import java.lang.Long; +import java.lang.String; +import java.util.Optional; +import java.util.stream.Stream; +import org.openapitools.jackson.nullable.JsonNullable; + +public class ListPaymentLinksRequestBuilder { + + private JsonNullable cursor = JsonNullable.undefined(); + private Optional limit = Utils.readDefaultOrConstValue( + "limit", + "20", + new TypeReference>() {}); + private JsonNullable merchantAccountId = JsonNullable.undefined(); + private Optional retryConfig = Optional.empty(); + private final SDKMethodInterfaces.MethodCallListPaymentLinks sdk; + + public ListPaymentLinksRequestBuilder(SDKMethodInterfaces.MethodCallListPaymentLinks sdk) { + this.sdk = sdk; + } + + public ListPaymentLinksRequestBuilder cursor(String cursor) { + Utils.checkNotNull(cursor, "cursor"); + this.cursor = JsonNullable.of(cursor); + return this; + } + + public ListPaymentLinksRequestBuilder cursor(JsonNullable cursor) { + Utils.checkNotNull(cursor, "cursor"); + this.cursor = cursor; + return this; + } + + public ListPaymentLinksRequestBuilder limit(long limit) { + Utils.checkNotNull(limit, "limit"); + this.limit = Optional.of(limit); + return this; + } + + public ListPaymentLinksRequestBuilder limit(Optional limit) { + Utils.checkNotNull(limit, "limit"); + this.limit = limit; + return this; + } + + public ListPaymentLinksRequestBuilder merchantAccountId(String merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = JsonNullable.of(merchantAccountId); + return this; + } + + public ListPaymentLinksRequestBuilder merchantAccountId(JsonNullable merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = merchantAccountId; + return this; + } + + public ListPaymentLinksRequestBuilder retryConfig(RetryConfig retryConfig) { + Utils.checkNotNull(retryConfig, "retryConfig"); + this.retryConfig = Optional.of(retryConfig); + return this; + } + + public ListPaymentLinksRequestBuilder retryConfig(Optional retryConfig) { + Utils.checkNotNull(retryConfig, "retryConfig"); + this.retryConfig = retryConfig; + return this; + } + + public ListPaymentLinksResponse call() throws Exception { + if (limit == null) { + limit = _SINGLETON_VALUE_Limit.value(); + } Optional options = Optional.of(Options.builder() + .retryConfig(retryConfig) + .build()); + return sdk.list( + cursor, + limit, + merchantAccountId, + options); + } + + /** + * Returns a stream that performs next page calls till no more pages + * are returned. Unlike the {@link #call()} method this method will + * throw an {@link APIException} if any page retrieval has an HTTP status + * code >= 300 (Note that 3XX is not an error range but will need + * special handling by the user if for example the HTTP client is + * not configured to follow redirects). + * + * @throws {@link APIException} if HTTP status code >= 300 is encountered + **/ + public Stream callAsStream() { + return Utils.stream(() -> Optional.of(call()), x -> { + if (x.statusCode() >= 300) { + byte[] body = Utils.toByteArrayAndClose(x.rawResponse().body()); + throw new APIException(x.rawResponse(), x.statusCode(), x.contentType(), body); + } else { + return x.next(); + } + }); + } + + private static final LazySingletonValue> _SINGLETON_VALUE_Limit = + new LazySingletonValue<>( + "limit", + "20", + new TypeReference>() {}); +} diff --git a/src/main/java/com/gr4vy/sdk/models/operations/ListPaymentLinksResponse.java b/src/main/java/com/gr4vy/sdk/models/operations/ListPaymentLinksResponse.java new file mode 100644 index 00000000..0d5b2d6d --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/operations/ListPaymentLinksResponse.java @@ -0,0 +1,278 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.operations; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.gr4vy.sdk.models.components.CollectionPaymentLink; +import com.gr4vy.sdk.utils.Response; +import com.gr4vy.sdk.utils.Utils; +import java.io.InputStream; +import java.lang.Deprecated; +import java.lang.Exception; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Objects; +import java.util.Optional; +import java.util.concurrent.Callable; + +public class ListPaymentLinksResponse implements Response { + + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Successful Response + */ + private Optional collectionPaymentLink; + + private Callable> next = () -> Optional.empty(); + + @JsonCreator + public ListPaymentLinksResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional collectionPaymentLink) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(collectionPaymentLink, "collectionPaymentLink"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.collectionPaymentLink = collectionPaymentLink; + } + + public ListPaymentLinksResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Successful Response + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional collectionPaymentLink() { + return (Optional) collectionPaymentLink; + } + + public Optional next() throws Exception { + return this.next.call(); + } + + // internal use only + private ListPaymentLinksResponse withNext(Callable> next) { + this.next = next; + return this; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * HTTP response content type for this operation + */ + public ListPaymentLinksResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public ListPaymentLinksResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public ListPaymentLinksResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Successful Response + */ + public ListPaymentLinksResponse withCollectionPaymentLink(CollectionPaymentLink collectionPaymentLink) { + Utils.checkNotNull(collectionPaymentLink, "collectionPaymentLink"); + this.collectionPaymentLink = Optional.ofNullable(collectionPaymentLink); + return this; + } + + /** + * Successful Response + */ + public ListPaymentLinksResponse withCollectionPaymentLink(Optional collectionPaymentLink) { + Utils.checkNotNull(collectionPaymentLink, "collectionPaymentLink"); + this.collectionPaymentLink = collectionPaymentLink; + return this; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListPaymentLinksResponse other = (ListPaymentLinksResponse) o; + return + Objects.deepEquals(this.contentType, other.contentType) && + Objects.deepEquals(this.statusCode, other.statusCode) && + Objects.deepEquals(this.rawResponse, other.rawResponse) && + Objects.deepEquals(this.collectionPaymentLink, other.collectionPaymentLink); + } + + @Override + public int hashCode() { + return Objects.hash( + contentType, + statusCode, + rawResponse, + collectionPaymentLink); + } + + @Override + public String toString() { + return Utils.toString(ListPaymentLinksResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "collectionPaymentLink", collectionPaymentLink); + } + + public final static class Builder { + private Callable> next; + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional collectionPaymentLink = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Successful Response + */ + public Builder collectionPaymentLink(CollectionPaymentLink collectionPaymentLink) { + Utils.checkNotNull(collectionPaymentLink, "collectionPaymentLink"); + this.collectionPaymentLink = Optional.ofNullable(collectionPaymentLink); + return this; + } + + /** + * Successful Response + */ + public Builder collectionPaymentLink(Optional collectionPaymentLink) { + Utils.checkNotNull(collectionPaymentLink, "collectionPaymentLink"); + this.collectionPaymentLink = collectionPaymentLink; + return this; + } + + /** + * Internal API. Not for public use. Sets the provider of the next page. + * + * @deprecated not part of the public API, may be removed without notice + */ + @Deprecated + public Builder next(Callable> next) { + Utils.checkNotNull(next, "next"); + this.next = next; + return this; + } + + public ListPaymentLinksResponse build() { + return new ListPaymentLinksResponse( + contentType, + statusCode, + rawResponse, + collectionPaymentLink) + .withNext(next); + } + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/operations/SDKMethodInterfaces.java b/src/main/java/com/gr4vy/sdk/models/operations/SDKMethodInterfaces.java index 6aaf3d29..5d2c51ac 100644 --- a/src/main/java/com/gr4vy/sdk/models/operations/SDKMethodInterfaces.java +++ b/src/main/java/com/gr4vy/sdk/models/operations/SDKMethodInterfaces.java @@ -19,6 +19,7 @@ import com.gr4vy.sdk.models.components.MerchantAccountCreate; import com.gr4vy.sdk.models.components.MerchantAccountUpdate; import com.gr4vy.sdk.models.components.NetworkTokenCreate; +import com.gr4vy.sdk.models.components.PaymentLinkCreate; import com.gr4vy.sdk.models.components.PaymentOptionRequest; import com.gr4vy.sdk.models.components.PaymentServiceCreate; import com.gr4vy.sdk.models.components.PaymentServiceTokenCreate; @@ -609,4 +610,31 @@ GetPayoutResponse get( JsonNullable merchantAccountId, Optional options) throws Exception; } + + public interface MethodCallAddPaymentLink { + AddPaymentLinkResponse create( + JsonNullable merchantAccountId, + PaymentLinkCreate paymentLinkCreate) throws Exception; + } + + public interface MethodCallListPaymentLinks { + ListPaymentLinksResponse list( + JsonNullable cursor, + Optional limit, + JsonNullable merchantAccountId, + Optional options) throws Exception; + } + + public interface MethodCallExpirePaymentLink { + ExpirePaymentLinkResponse expire( + String paymentLinkId, + JsonNullable merchantAccountId) throws Exception; + } + + public interface MethodCallGetPaymentLink { + GetPaymentLinkResponse get( + String paymentLinkId, + JsonNullable merchantAccountId, + Optional options) throws Exception; + } } From 57474645227e16acf5731295ee7f5a34da5d1adc Mon Sep 17 00:00:00 2001 From: "speakeasy-github[bot]" <128539517+speakeasy-github[bot]@users.noreply.github.com> Date: Wed, 4 Jun 2025 09:06:56 +0000 Subject: [PATCH 2/2] empty commit to trigger [run-tests] workflow