diff --git a/src/main/java/com/basistheory/AsyncBasisTheoryApiClient.java b/src/main/java/com/basistheory/AsyncBasisTheoryApiClient.java index 2268673..e4f54a9 100644 --- a/src/main/java/com/basistheory/AsyncBasisTheoryApiClient.java +++ b/src/main/java/com/basistheory/AsyncBasisTheoryApiClient.java @@ -10,10 +10,9 @@ import com.basistheory.resources.applicationkeys.AsyncApplicationKeysClient; import com.basistheory.resources.applications.AsyncApplicationsClient; import com.basistheory.resources.applicationtemplates.AsyncApplicationTemplatesClient; -import com.basistheory.resources.connection.AsyncConnectionClient; import com.basistheory.resources.documents.AsyncDocumentsClient; import com.basistheory.resources.enrichments.AsyncEnrichmentsClient; -import com.basistheory.resources.googlepay.AsyncGooglepayClient; +import com.basistheory.resources.googlepay.AsyncGooglePayClient; import com.basistheory.resources.keys.AsyncKeysClient; import com.basistheory.resources.logs.AsyncLogsClient; import com.basistheory.resources.networktokens.AsyncNetworkTokensClient; @@ -40,14 +39,14 @@ public class AsyncBasisTheoryApiClient { protected final Supplier applePayClient; + protected final Supplier googlePayClient; + protected final Supplier documentsClient; protected final Supplier tokensClient; protected final Supplier enrichmentsClient; - protected final Supplier googlepayClient; - protected final Supplier keysClient; protected final Supplier logsClient; @@ -70,8 +69,6 @@ public class AsyncBasisTheoryApiClient { protected final Supplier accountUpdaterClient; - protected final Supplier connectionClient; - protected final Supplier tenantsClient; protected final Supplier threedsClient; @@ -82,10 +79,10 @@ public AsyncBasisTheoryApiClient(ClientOptions clientOptions) { this.applicationKeysClient = Suppliers.memoize(() -> new AsyncApplicationKeysClient(clientOptions)); this.applicationTemplatesClient = Suppliers.memoize(() -> new AsyncApplicationTemplatesClient(clientOptions)); this.applePayClient = Suppliers.memoize(() -> new AsyncApplePayClient(clientOptions)); + this.googlePayClient = Suppliers.memoize(() -> new AsyncGooglePayClient(clientOptions)); this.documentsClient = Suppliers.memoize(() -> new AsyncDocumentsClient(clientOptions)); this.tokensClient = Suppliers.memoize(() -> new AsyncTokensClient(clientOptions)); this.enrichmentsClient = Suppliers.memoize(() -> new AsyncEnrichmentsClient(clientOptions)); - this.googlepayClient = Suppliers.memoize(() -> new AsyncGooglepayClient(clientOptions)); this.keysClient = Suppliers.memoize(() -> new AsyncKeysClient(clientOptions)); this.logsClient = Suppliers.memoize(() -> new AsyncLogsClient(clientOptions)); this.networkTokensClient = Suppliers.memoize(() -> new AsyncNetworkTokensClient(clientOptions)); @@ -97,7 +94,6 @@ public AsyncBasisTheoryApiClient(ClientOptions clientOptions) { this.tokenIntentsClient = Suppliers.memoize(() -> new AsyncTokenIntentsClient(clientOptions)); this.webhooksClient = Suppliers.memoize(() -> new AsyncWebhooksClient(clientOptions)); this.accountUpdaterClient = Suppliers.memoize(() -> new AsyncAccountUpdaterClient(clientOptions)); - this.connectionClient = Suppliers.memoize(() -> new AsyncConnectionClient(clientOptions)); this.tenantsClient = Suppliers.memoize(() -> new AsyncTenantsClient(clientOptions)); this.threedsClient = Suppliers.memoize(() -> new AsyncThreedsClient(clientOptions)); } @@ -118,6 +114,10 @@ public AsyncApplePayClient applePay() { return this.applePayClient.get(); } + public AsyncGooglePayClient googlePay() { + return this.googlePayClient.get(); + } + public AsyncDocumentsClient documents() { return this.documentsClient.get(); } @@ -130,10 +130,6 @@ public AsyncEnrichmentsClient enrichments() { return this.enrichmentsClient.get(); } - public AsyncGooglepayClient googlepay() { - return this.googlepayClient.get(); - } - public AsyncKeysClient keys() { return this.keysClient.get(); } @@ -178,10 +174,6 @@ public AsyncAccountUpdaterClient accountUpdater() { return this.accountUpdaterClient.get(); } - public AsyncConnectionClient connection() { - return this.connectionClient.get(); - } - public AsyncTenantsClient tenants() { return this.tenantsClient.get(); } diff --git a/src/main/java/com/basistheory/BasisTheoryApiClient.java b/src/main/java/com/basistheory/BasisTheoryApiClient.java index 1a82a20..28d6ef8 100644 --- a/src/main/java/com/basistheory/BasisTheoryApiClient.java +++ b/src/main/java/com/basistheory/BasisTheoryApiClient.java @@ -10,10 +10,9 @@ import com.basistheory.resources.applicationkeys.ApplicationKeysClient; import com.basistheory.resources.applications.ApplicationsClient; import com.basistheory.resources.applicationtemplates.ApplicationTemplatesClient; -import com.basistheory.resources.connection.ConnectionClient; import com.basistheory.resources.documents.DocumentsClient; import com.basistheory.resources.enrichments.EnrichmentsClient; -import com.basistheory.resources.googlepay.GooglepayClient; +import com.basistheory.resources.googlepay.GooglePayClient; import com.basistheory.resources.keys.KeysClient; import com.basistheory.resources.logs.LogsClient; import com.basistheory.resources.networktokens.NetworkTokensClient; @@ -40,14 +39,14 @@ public class BasisTheoryApiClient { protected final Supplier applePayClient; + protected final Supplier googlePayClient; + protected final Supplier documentsClient; protected final Supplier tokensClient; protected final Supplier enrichmentsClient; - protected final Supplier googlepayClient; - protected final Supplier keysClient; protected final Supplier logsClient; @@ -70,8 +69,6 @@ public class BasisTheoryApiClient { protected final Supplier accountUpdaterClient; - protected final Supplier connectionClient; - protected final Supplier tenantsClient; protected final Supplier threedsClient; @@ -82,10 +79,10 @@ public BasisTheoryApiClient(ClientOptions clientOptions) { this.applicationKeysClient = Suppliers.memoize(() -> new ApplicationKeysClient(clientOptions)); this.applicationTemplatesClient = Suppliers.memoize(() -> new ApplicationTemplatesClient(clientOptions)); this.applePayClient = Suppliers.memoize(() -> new ApplePayClient(clientOptions)); + this.googlePayClient = Suppliers.memoize(() -> new GooglePayClient(clientOptions)); this.documentsClient = Suppliers.memoize(() -> new DocumentsClient(clientOptions)); this.tokensClient = Suppliers.memoize(() -> new TokensClient(clientOptions)); this.enrichmentsClient = Suppliers.memoize(() -> new EnrichmentsClient(clientOptions)); - this.googlepayClient = Suppliers.memoize(() -> new GooglepayClient(clientOptions)); this.keysClient = Suppliers.memoize(() -> new KeysClient(clientOptions)); this.logsClient = Suppliers.memoize(() -> new LogsClient(clientOptions)); this.networkTokensClient = Suppliers.memoize(() -> new NetworkTokensClient(clientOptions)); @@ -97,7 +94,6 @@ public BasisTheoryApiClient(ClientOptions clientOptions) { this.tokenIntentsClient = Suppliers.memoize(() -> new TokenIntentsClient(clientOptions)); this.webhooksClient = Suppliers.memoize(() -> new WebhooksClient(clientOptions)); this.accountUpdaterClient = Suppliers.memoize(() -> new AccountUpdaterClient(clientOptions)); - this.connectionClient = Suppliers.memoize(() -> new ConnectionClient(clientOptions)); this.tenantsClient = Suppliers.memoize(() -> new TenantsClient(clientOptions)); this.threedsClient = Suppliers.memoize(() -> new ThreedsClient(clientOptions)); } @@ -118,6 +114,10 @@ public ApplePayClient applePay() { return this.applePayClient.get(); } + public GooglePayClient googlePay() { + return this.googlePayClient.get(); + } + public DocumentsClient documents() { return this.documentsClient.get(); } @@ -130,10 +130,6 @@ public EnrichmentsClient enrichments() { return this.enrichmentsClient.get(); } - public GooglepayClient googlepay() { - return this.googlepayClient.get(); - } - public KeysClient keys() { return this.keysClient.get(); } @@ -178,10 +174,6 @@ public AccountUpdaterClient accountUpdater() { return this.accountUpdaterClient.get(); } - public ConnectionClient connection() { - return this.connectionClient.get(); - } - public TenantsClient tenants() { return this.tenantsClient.get(); } diff --git a/src/main/java/com/basistheory/resources/applepay/domain/AsyncDomainClient.java b/src/main/java/com/basistheory/resources/applepay/domain/AsyncDomainClient.java index 0196afa..cd2cc95 100644 --- a/src/main/java/com/basistheory/resources/applepay/domain/AsyncDomainClient.java +++ b/src/main/java/com/basistheory/resources/applepay/domain/AsyncDomainClient.java @@ -5,9 +5,9 @@ import com.basistheory.core.ClientOptions; import com.basistheory.core.RequestOptions; -import com.basistheory.types.ApplePayDomainDeregistrationRequest; -import com.basistheory.types.ApplePayDomainRegistrationListRequest; -import com.basistheory.types.ApplePayDomainRegistrationRequest; +import com.basistheory.resources.applepay.domain.requests.ApplePayDomainDeregistrationRequest; +import com.basistheory.resources.applepay.domain.requests.ApplePayDomainRegistrationListRequest; +import com.basistheory.resources.applepay.domain.requests.ApplePayDomainRegistrationRequest; import com.basistheory.types.ApplePayDomainRegistrationResponse; import java.util.concurrent.CompletableFuture; diff --git a/src/main/java/com/basistheory/resources/applepay/domain/AsyncRawDomainClient.java b/src/main/java/com/basistheory/resources/applepay/domain/AsyncRawDomainClient.java index 0208d04..9919e7f 100644 --- a/src/main/java/com/basistheory/resources/applepay/domain/AsyncRawDomainClient.java +++ b/src/main/java/com/basistheory/resources/applepay/domain/AsyncRawDomainClient.java @@ -15,9 +15,9 @@ import com.basistheory.errors.ServiceUnavailableError; import com.basistheory.errors.UnauthorizedError; import com.basistheory.errors.UnprocessableEntityError; -import com.basistheory.types.ApplePayDomainDeregistrationRequest; -import com.basistheory.types.ApplePayDomainRegistrationListRequest; -import com.basistheory.types.ApplePayDomainRegistrationRequest; +import com.basistheory.resources.applepay.domain.requests.ApplePayDomainDeregistrationRequest; +import com.basistheory.resources.applepay.domain.requests.ApplePayDomainRegistrationListRequest; +import com.basistheory.resources.applepay.domain.requests.ApplePayDomainRegistrationRequest; import com.basistheory.types.ApplePayDomainRegistrationResponse; import com.basistheory.types.ProblemDetails; import com.basistheory.types.ValidationProblemDetails; diff --git a/src/main/java/com/basistheory/resources/applepay/domain/DomainClient.java b/src/main/java/com/basistheory/resources/applepay/domain/DomainClient.java index fc7d268..aa609de 100644 --- a/src/main/java/com/basistheory/resources/applepay/domain/DomainClient.java +++ b/src/main/java/com/basistheory/resources/applepay/domain/DomainClient.java @@ -5,9 +5,9 @@ import com.basistheory.core.ClientOptions; import com.basistheory.core.RequestOptions; -import com.basistheory.types.ApplePayDomainDeregistrationRequest; -import com.basistheory.types.ApplePayDomainRegistrationListRequest; -import com.basistheory.types.ApplePayDomainRegistrationRequest; +import com.basistheory.resources.applepay.domain.requests.ApplePayDomainDeregistrationRequest; +import com.basistheory.resources.applepay.domain.requests.ApplePayDomainRegistrationListRequest; +import com.basistheory.resources.applepay.domain.requests.ApplePayDomainRegistrationRequest; import com.basistheory.types.ApplePayDomainRegistrationResponse; public class DomainClient { diff --git a/src/main/java/com/basistheory/resources/applepay/domain/RawDomainClient.java b/src/main/java/com/basistheory/resources/applepay/domain/RawDomainClient.java index bfc9a9c..2616dc8 100644 --- a/src/main/java/com/basistheory/resources/applepay/domain/RawDomainClient.java +++ b/src/main/java/com/basistheory/resources/applepay/domain/RawDomainClient.java @@ -15,9 +15,9 @@ import com.basistheory.errors.ServiceUnavailableError; import com.basistheory.errors.UnauthorizedError; import com.basistheory.errors.UnprocessableEntityError; -import com.basistheory.types.ApplePayDomainDeregistrationRequest; -import com.basistheory.types.ApplePayDomainRegistrationListRequest; -import com.basistheory.types.ApplePayDomainRegistrationRequest; +import com.basistheory.resources.applepay.domain.requests.ApplePayDomainDeregistrationRequest; +import com.basistheory.resources.applepay.domain.requests.ApplePayDomainRegistrationListRequest; +import com.basistheory.resources.applepay.domain.requests.ApplePayDomainRegistrationRequest; import com.basistheory.types.ApplePayDomainRegistrationResponse; import com.basistheory.types.ProblemDetails; import com.basistheory.types.ValidationProblemDetails; diff --git a/src/main/java/com/basistheory/types/ApplePayDomainDeregistrationRequest.java b/src/main/java/com/basistheory/resources/applepay/domain/requests/ApplePayDomainDeregistrationRequest.java similarity index 98% rename from src/main/java/com/basistheory/types/ApplePayDomainDeregistrationRequest.java rename to src/main/java/com/basistheory/resources/applepay/domain/requests/ApplePayDomainDeregistrationRequest.java index c08a73e..e2750f7 100644 --- a/src/main/java/com/basistheory/types/ApplePayDomainDeregistrationRequest.java +++ b/src/main/java/com/basistheory/resources/applepay/domain/requests/ApplePayDomainDeregistrationRequest.java @@ -1,7 +1,7 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.basistheory.types; +package com.basistheory.resources.applepay.domain.requests; import com.basistheory.core.ObjectMappers; import com.fasterxml.jackson.annotation.JsonAnyGetter; diff --git a/src/main/java/com/basistheory/types/ApplePayDomainRegistrationListRequest.java b/src/main/java/com/basistheory/resources/applepay/domain/requests/ApplePayDomainRegistrationListRequest.java similarity index 98% rename from src/main/java/com/basistheory/types/ApplePayDomainRegistrationListRequest.java rename to src/main/java/com/basistheory/resources/applepay/domain/requests/ApplePayDomainRegistrationListRequest.java index 12cfa21..e00d70a 100644 --- a/src/main/java/com/basistheory/types/ApplePayDomainRegistrationListRequest.java +++ b/src/main/java/com/basistheory/resources/applepay/domain/requests/ApplePayDomainRegistrationListRequest.java @@ -1,7 +1,7 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.basistheory.types; +package com.basistheory.resources.applepay.domain.requests; import com.basistheory.core.ObjectMappers; import com.fasterxml.jackson.annotation.JsonAnyGetter; diff --git a/src/main/java/com/basistheory/types/ApplePayDomainRegistrationRequest.java b/src/main/java/com/basistheory/resources/applepay/domain/requests/ApplePayDomainRegistrationRequest.java similarity index 98% rename from src/main/java/com/basistheory/types/ApplePayDomainRegistrationRequest.java rename to src/main/java/com/basistheory/resources/applepay/domain/requests/ApplePayDomainRegistrationRequest.java index 524d8bf..e60d3a5 100644 --- a/src/main/java/com/basistheory/types/ApplePayDomainRegistrationRequest.java +++ b/src/main/java/com/basistheory/resources/applepay/domain/requests/ApplePayDomainRegistrationRequest.java @@ -1,7 +1,7 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.basistheory.types; +package com.basistheory.resources.applepay.domain.requests; import com.basistheory.core.ObjectMappers; import com.fasterxml.jackson.annotation.JsonAnyGetter; diff --git a/src/main/java/com/basistheory/resources/applepay/session/AsyncRawSessionClient.java b/src/main/java/com/basistheory/resources/applepay/session/AsyncRawSessionClient.java index e251f18..8698316 100644 --- a/src/main/java/com/basistheory/resources/applepay/session/AsyncRawSessionClient.java +++ b/src/main/java/com/basistheory/resources/applepay/session/AsyncRawSessionClient.java @@ -14,7 +14,7 @@ import com.basistheory.errors.ForbiddenError; import com.basistheory.errors.UnauthorizedError; import com.basistheory.errors.UnprocessableEntityError; -import com.basistheory.types.ApplePaySessionRequest; +import com.basistheory.resources.applepay.session.requests.ApplePaySessionRequest; import com.basistheory.types.ProblemDetails; import com.basistheory.types.ValidationProblemDetails; import com.fasterxml.jackson.core.JsonProcessingException; diff --git a/src/main/java/com/basistheory/resources/applepay/session/AsyncSessionClient.java b/src/main/java/com/basistheory/resources/applepay/session/AsyncSessionClient.java index d6bf976..1df0500 100644 --- a/src/main/java/com/basistheory/resources/applepay/session/AsyncSessionClient.java +++ b/src/main/java/com/basistheory/resources/applepay/session/AsyncSessionClient.java @@ -5,7 +5,7 @@ import com.basistheory.core.ClientOptions; import com.basistheory.core.RequestOptions; -import com.basistheory.types.ApplePaySessionRequest; +import com.basistheory.resources.applepay.session.requests.ApplePaySessionRequest; import java.util.concurrent.CompletableFuture; public class AsyncSessionClient { diff --git a/src/main/java/com/basistheory/resources/applepay/session/RawSessionClient.java b/src/main/java/com/basistheory/resources/applepay/session/RawSessionClient.java index 1968fa0..81e0bac 100644 --- a/src/main/java/com/basistheory/resources/applepay/session/RawSessionClient.java +++ b/src/main/java/com/basistheory/resources/applepay/session/RawSessionClient.java @@ -14,7 +14,7 @@ import com.basistheory.errors.ForbiddenError; import com.basistheory.errors.UnauthorizedError; import com.basistheory.errors.UnprocessableEntityError; -import com.basistheory.types.ApplePaySessionRequest; +import com.basistheory.resources.applepay.session.requests.ApplePaySessionRequest; import com.basistheory.types.ProblemDetails; import com.basistheory.types.ValidationProblemDetails; import com.fasterxml.jackson.core.JsonProcessingException; diff --git a/src/main/java/com/basistheory/resources/applepay/session/SessionClient.java b/src/main/java/com/basistheory/resources/applepay/session/SessionClient.java index 81470a2..2bfbfbd 100644 --- a/src/main/java/com/basistheory/resources/applepay/session/SessionClient.java +++ b/src/main/java/com/basistheory/resources/applepay/session/SessionClient.java @@ -5,7 +5,7 @@ import com.basistheory.core.ClientOptions; import com.basistheory.core.RequestOptions; -import com.basistheory.types.ApplePaySessionRequest; +import com.basistheory.resources.applepay.session.requests.ApplePaySessionRequest; public class SessionClient { protected final ClientOptions clientOptions; diff --git a/src/main/java/com/basistheory/types/ApplePaySessionRequest.java b/src/main/java/com/basistheory/resources/applepay/session/requests/ApplePaySessionRequest.java similarity index 98% rename from src/main/java/com/basistheory/types/ApplePaySessionRequest.java rename to src/main/java/com/basistheory/resources/applepay/session/requests/ApplePaySessionRequest.java index 53aba24..d5aa240 100644 --- a/src/main/java/com/basistheory/types/ApplePaySessionRequest.java +++ b/src/main/java/com/basistheory/resources/applepay/session/requests/ApplePaySessionRequest.java @@ -1,7 +1,7 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.basistheory.types; +package com.basistheory.resources.applepay.session.requests; import com.basistheory.core.ObjectMappers; import com.fasterxml.jackson.annotation.JsonAnyGetter; diff --git a/src/main/java/com/basistheory/resources/connection/AsyncConnectionClient.java b/src/main/java/com/basistheory/resources/connection/AsyncConnectionClient.java deleted file mode 100644 index fe01d7a..0000000 --- a/src/main/java/com/basistheory/resources/connection/AsyncConnectionClient.java +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.basistheory.resources.connection; - -import com.basistheory.core.ClientOptions; -import com.basistheory.core.Suppliers; -import com.basistheory.resources.connection.applepay.AsyncApplePayClient; -import java.util.function.Supplier; - -public class AsyncConnectionClient { - protected final ClientOptions clientOptions; - - protected final Supplier applePayClient; - - public AsyncConnectionClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.applePayClient = Suppliers.memoize(() -> new AsyncApplePayClient(clientOptions)); - } - - public AsyncApplePayClient applePay() { - return this.applePayClient.get(); - } -} diff --git a/src/main/java/com/basistheory/resources/connection/ConnectionClient.java b/src/main/java/com/basistheory/resources/connection/ConnectionClient.java deleted file mode 100644 index d74aa2a..0000000 --- a/src/main/java/com/basistheory/resources/connection/ConnectionClient.java +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.basistheory.resources.connection; - -import com.basistheory.core.ClientOptions; -import com.basistheory.core.Suppliers; -import com.basistheory.resources.connection.applepay.ApplePayClient; -import java.util.function.Supplier; - -public class ConnectionClient { - protected final ClientOptions clientOptions; - - protected final Supplier applePayClient; - - public ConnectionClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.applePayClient = Suppliers.memoize(() -> new ApplePayClient(clientOptions)); - } - - public ApplePayClient applePay() { - return this.applePayClient.get(); - } -} diff --git a/src/main/java/com/basistheory/resources/connection/applepay/ApplePayClient.java b/src/main/java/com/basistheory/resources/connection/applepay/ApplePayClient.java deleted file mode 100644 index aefca1c..0000000 --- a/src/main/java/com/basistheory/resources/connection/applepay/ApplePayClient.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.basistheory.resources.connection.applepay; - -import com.basistheory.core.ClientOptions; -import com.basistheory.core.RequestOptions; -import com.basistheory.core.Suppliers; -import com.basistheory.resources.connection.applepay.domain.DomainClient; -import com.basistheory.resources.connection.applepay.requests.ApplePayTokenizeRequest; -import com.basistheory.resources.connection.applepay.session.SessionClient; -import com.basistheory.types.ApplePayTokenizeResponse; -import java.util.function.Supplier; - -public class ApplePayClient { - protected final ClientOptions clientOptions; - - private final RawApplePayClient rawClient; - - protected final Supplier domainClient; - - protected final Supplier sessionClient; - - public ApplePayClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new RawApplePayClient(clientOptions); - this.domainClient = Suppliers.memoize(() -> new DomainClient(clientOptions)); - this.sessionClient = Suppliers.memoize(() -> new SessionClient(clientOptions)); - } - - /** - * Get responses with HTTP metadata like headers - */ - public RawApplePayClient withRawResponse() { - return this.rawClient; - } - - public ApplePayTokenizeResponse tokenize() { - return this.rawClient.tokenize().body(); - } - - public ApplePayTokenizeResponse tokenize(ApplePayTokenizeRequest request) { - return this.rawClient.tokenize(request).body(); - } - - public ApplePayTokenizeResponse tokenize(ApplePayTokenizeRequest request, RequestOptions requestOptions) { - return this.rawClient.tokenize(request, requestOptions).body(); - } - - public DomainClient domain() { - return this.domainClient.get(); - } - - public SessionClient session() { - return this.sessionClient.get(); - } -} diff --git a/src/main/java/com/basistheory/resources/connection/applepay/AsyncApplePayClient.java b/src/main/java/com/basistheory/resources/connection/applepay/AsyncApplePayClient.java deleted file mode 100644 index efd6839..0000000 --- a/src/main/java/com/basistheory/resources/connection/applepay/AsyncApplePayClient.java +++ /dev/null @@ -1,59 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.basistheory.resources.connection.applepay; - -import com.basistheory.core.ClientOptions; -import com.basistheory.core.RequestOptions; -import com.basistheory.core.Suppliers; -import com.basistheory.resources.connection.applepay.domain.AsyncDomainClient; -import com.basistheory.resources.connection.applepay.requests.ApplePayTokenizeRequest; -import com.basistheory.resources.connection.applepay.session.AsyncSessionClient; -import com.basistheory.types.ApplePayTokenizeResponse; -import java.util.concurrent.CompletableFuture; -import java.util.function.Supplier; - -public class AsyncApplePayClient { - protected final ClientOptions clientOptions; - - private final AsyncRawApplePayClient rawClient; - - protected final Supplier domainClient; - - protected final Supplier sessionClient; - - public AsyncApplePayClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new AsyncRawApplePayClient(clientOptions); - this.domainClient = Suppliers.memoize(() -> new AsyncDomainClient(clientOptions)); - this.sessionClient = Suppliers.memoize(() -> new AsyncSessionClient(clientOptions)); - } - - /** - * Get responses with HTTP metadata like headers - */ - public AsyncRawApplePayClient withRawResponse() { - return this.rawClient; - } - - public CompletableFuture tokenize() { - return this.rawClient.tokenize().thenApply(response -> response.body()); - } - - public CompletableFuture tokenize(ApplePayTokenizeRequest request) { - return this.rawClient.tokenize(request).thenApply(response -> response.body()); - } - - public CompletableFuture tokenize( - ApplePayTokenizeRequest request, RequestOptions requestOptions) { - return this.rawClient.tokenize(request, requestOptions).thenApply(response -> response.body()); - } - - public AsyncDomainClient domain() { - return this.domainClient.get(); - } - - public AsyncSessionClient session() { - return this.sessionClient.get(); - } -} diff --git a/src/main/java/com/basistheory/resources/connection/applepay/AsyncRawApplePayClient.java b/src/main/java/com/basistheory/resources/connection/applepay/AsyncRawApplePayClient.java deleted file mode 100644 index 5c739e5..0000000 --- a/src/main/java/com/basistheory/resources/connection/applepay/AsyncRawApplePayClient.java +++ /dev/null @@ -1,133 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.basistheory.resources.connection.applepay; - -import com.basistheory.core.BasisTheoryApiApiException; -import com.basistheory.core.BasisTheoryApiHttpResponse; -import com.basistheory.core.BasisTheoryException; -import com.basistheory.core.ClientOptions; -import com.basistheory.core.MediaTypes; -import com.basistheory.core.ObjectMappers; -import com.basistheory.core.RequestOptions; -import com.basistheory.errors.BadRequestError; -import com.basistheory.errors.ForbiddenError; -import com.basistheory.errors.UnauthorizedError; -import com.basistheory.errors.UnprocessableEntityError; -import com.basistheory.resources.connection.applepay.requests.ApplePayTokenizeRequest; -import com.basistheory.types.ApplePayTokenizeResponse; -import com.basistheory.types.ProblemDetails; -import com.basistheory.types.ValidationProblemDetails; -import com.fasterxml.jackson.core.JsonProcessingException; -import java.io.IOException; -import java.util.concurrent.CompletableFuture; -import okhttp3.Call; -import okhttp3.Callback; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; -import okhttp3.ResponseBody; -import org.jetbrains.annotations.NotNull; - -public class AsyncRawApplePayClient { - protected final ClientOptions clientOptions; - - public AsyncRawApplePayClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - public CompletableFuture> tokenize() { - return tokenize(ApplePayTokenizeRequest.builder().build()); - } - - public CompletableFuture> tokenize( - ApplePayTokenizeRequest request) { - return tokenize(request, null); - } - - public CompletableFuture> tokenize( - ApplePayTokenizeRequest request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("connections/apple-pay/tokenize") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); - } catch (JsonProcessingException e) { - throw new BasisTheoryException("Failed to serialize request", e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = new CompletableFuture<>(); - client.newCall(okhttpRequest).enqueue(new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { - try (ResponseBody responseBody = response.body()) { - if (response.isSuccessful()) { - future.complete(new BasisTheoryApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), ApplePayTokenizeResponse.class), - response)); - return; - } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - try { - switch (response.code()) { - case 400: - future.completeExceptionally(new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, ValidationProblemDetails.class), - response)); - return; - case 401: - future.completeExceptionally(new UnauthorizedError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProblemDetails.class), - response)); - return; - case 403: - future.completeExceptionally(new ForbiddenError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProblemDetails.class), - response)); - return; - case 422: - future.completeExceptionally(new UnprocessableEntityError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProblemDetails.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - future.completeExceptionally(new BasisTheoryApiApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - } catch (IOException e) { - future.completeExceptionally(new BasisTheoryException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BasisTheoryException("Network error executing HTTP request", e)); - } - }); - return future; - } -} diff --git a/src/main/java/com/basistheory/resources/connection/applepay/RawApplePayClient.java b/src/main/java/com/basistheory/resources/connection/applepay/RawApplePayClient.java deleted file mode 100644 index c1f2a18..0000000 --- a/src/main/java/com/basistheory/resources/connection/applepay/RawApplePayClient.java +++ /dev/null @@ -1,109 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.basistheory.resources.connection.applepay; - -import com.basistheory.core.BasisTheoryApiApiException; -import com.basistheory.core.BasisTheoryApiHttpResponse; -import com.basistheory.core.BasisTheoryException; -import com.basistheory.core.ClientOptions; -import com.basistheory.core.MediaTypes; -import com.basistheory.core.ObjectMappers; -import com.basistheory.core.RequestOptions; -import com.basistheory.errors.BadRequestError; -import com.basistheory.errors.ForbiddenError; -import com.basistheory.errors.UnauthorizedError; -import com.basistheory.errors.UnprocessableEntityError; -import com.basistheory.resources.connection.applepay.requests.ApplePayTokenizeRequest; -import com.basistheory.types.ApplePayTokenizeResponse; -import com.basistheory.types.ProblemDetails; -import com.basistheory.types.ValidationProblemDetails; -import com.fasterxml.jackson.core.JsonProcessingException; -import java.io.IOException; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; -import okhttp3.ResponseBody; - -public class RawApplePayClient { - protected final ClientOptions clientOptions; - - public RawApplePayClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - public BasisTheoryApiHttpResponse tokenize() { - return tokenize(ApplePayTokenizeRequest.builder().build()); - } - - public BasisTheoryApiHttpResponse tokenize(ApplePayTokenizeRequest request) { - return tokenize(request, null); - } - - public BasisTheoryApiHttpResponse tokenize( - ApplePayTokenizeRequest request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("connections/apple-pay/tokenize") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); - } catch (JsonProcessingException e) { - throw new BasisTheoryException("Failed to serialize request", e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - try (Response response = client.newCall(okhttpRequest).execute()) { - ResponseBody responseBody = response.body(); - if (response.isSuccessful()) { - return new BasisTheoryApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ApplePayTokenizeResponse.class), - response); - } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - try { - switch (response.code()) { - case 400: - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ValidationProblemDetails.class), - response); - case 401: - throw new UnauthorizedError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProblemDetails.class), - response); - case 403: - throw new ForbiddenError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProblemDetails.class), - response); - case 422: - throw new UnprocessableEntityError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProblemDetails.class), - response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - throw new BasisTheoryApiApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); - } catch (IOException e) { - throw new BasisTheoryException("Network error executing HTTP request", e); - } - } -} diff --git a/src/main/java/com/basistheory/resources/connection/applepay/domain/AsyncDomainClient.java b/src/main/java/com/basistheory/resources/connection/applepay/domain/AsyncDomainClient.java deleted file mode 100644 index 046c5bb..0000000 --- a/src/main/java/com/basistheory/resources/connection/applepay/domain/AsyncDomainClient.java +++ /dev/null @@ -1,70 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.basistheory.resources.connection.applepay.domain; - -import com.basistheory.core.ClientOptions; -import com.basistheory.core.RequestOptions; -import com.basistheory.types.ApplePayDomainDeregistrationRequest; -import com.basistheory.types.ApplePayDomainRegistrationListRequest; -import com.basistheory.types.ApplePayDomainRegistrationRequest; -import com.basistheory.types.ApplePayDomainRegistrationResponse; -import java.util.concurrent.CompletableFuture; - -public class AsyncDomainClient { - protected final ClientOptions clientOptions; - - private final AsyncRawDomainClient rawClient; - - public AsyncDomainClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new AsyncRawDomainClient(clientOptions); - } - - /** - * Get responses with HTTP metadata like headers - */ - public AsyncRawDomainClient withRawResponse() { - return this.rawClient; - } - - public CompletableFuture deregister(ApplePayDomainDeregistrationRequest request) { - return this.rawClient.deregister(request).thenApply(response -> response.body()); - } - - public CompletableFuture deregister( - ApplePayDomainDeregistrationRequest request, RequestOptions requestOptions) { - return this.rawClient.deregister(request, requestOptions).thenApply(response -> response.body()); - } - - public CompletableFuture get() { - return this.rawClient.get().thenApply(response -> response.body()); - } - - public CompletableFuture get(RequestOptions requestOptions) { - return this.rawClient.get(requestOptions).thenApply(response -> response.body()); - } - - public CompletableFuture register(ApplePayDomainRegistrationRequest request) { - return this.rawClient.register(request).thenApply(response -> response.body()); - } - - public CompletableFuture register( - ApplePayDomainRegistrationRequest request, RequestOptions requestOptions) { - return this.rawClient.register(request, requestOptions).thenApply(response -> response.body()); - } - - public CompletableFuture registerAll() { - return this.rawClient.registerAll().thenApply(response -> response.body()); - } - - public CompletableFuture registerAll( - ApplePayDomainRegistrationListRequest request) { - return this.rawClient.registerAll(request).thenApply(response -> response.body()); - } - - public CompletableFuture registerAll( - ApplePayDomainRegistrationListRequest request, RequestOptions requestOptions) { - return this.rawClient.registerAll(request, requestOptions).thenApply(response -> response.body()); - } -} diff --git a/src/main/java/com/basistheory/resources/connection/applepay/domain/DomainClient.java b/src/main/java/com/basistheory/resources/connection/applepay/domain/DomainClient.java deleted file mode 100644 index 3db2b08..0000000 --- a/src/main/java/com/basistheory/resources/connection/applepay/domain/DomainClient.java +++ /dev/null @@ -1,67 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.basistheory.resources.connection.applepay.domain; - -import com.basistheory.core.ClientOptions; -import com.basistheory.core.RequestOptions; -import com.basistheory.types.ApplePayDomainDeregistrationRequest; -import com.basistheory.types.ApplePayDomainRegistrationListRequest; -import com.basistheory.types.ApplePayDomainRegistrationRequest; -import com.basistheory.types.ApplePayDomainRegistrationResponse; - -public class DomainClient { - protected final ClientOptions clientOptions; - - private final RawDomainClient rawClient; - - public DomainClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new RawDomainClient(clientOptions); - } - - /** - * Get responses with HTTP metadata like headers - */ - public RawDomainClient withRawResponse() { - return this.rawClient; - } - - public void deregister(ApplePayDomainDeregistrationRequest request) { - this.rawClient.deregister(request).body(); - } - - public void deregister(ApplePayDomainDeregistrationRequest request, RequestOptions requestOptions) { - this.rawClient.deregister(request, requestOptions).body(); - } - - public ApplePayDomainRegistrationResponse get() { - return this.rawClient.get().body(); - } - - public ApplePayDomainRegistrationResponse get(RequestOptions requestOptions) { - return this.rawClient.get(requestOptions).body(); - } - - public ApplePayDomainRegistrationResponse register(ApplePayDomainRegistrationRequest request) { - return this.rawClient.register(request).body(); - } - - public ApplePayDomainRegistrationResponse register( - ApplePayDomainRegistrationRequest request, RequestOptions requestOptions) { - return this.rawClient.register(request, requestOptions).body(); - } - - public ApplePayDomainRegistrationResponse registerAll() { - return this.rawClient.registerAll().body(); - } - - public ApplePayDomainRegistrationResponse registerAll(ApplePayDomainRegistrationListRequest request) { - return this.rawClient.registerAll(request).body(); - } - - public ApplePayDomainRegistrationResponse registerAll( - ApplePayDomainRegistrationListRequest request, RequestOptions requestOptions) { - return this.rawClient.registerAll(request, requestOptions).body(); - } -} diff --git a/src/main/java/com/basistheory/resources/connection/applepay/session/AsyncRawSessionClient.java b/src/main/java/com/basistheory/resources/connection/applepay/session/AsyncRawSessionClient.java deleted file mode 100644 index ebf210d..0000000 --- a/src/main/java/com/basistheory/resources/connection/applepay/session/AsyncRawSessionClient.java +++ /dev/null @@ -1,129 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.basistheory.resources.connection.applepay.session; - -import com.basistheory.core.BasisTheoryApiApiException; -import com.basistheory.core.BasisTheoryApiHttpResponse; -import com.basistheory.core.BasisTheoryException; -import com.basistheory.core.ClientOptions; -import com.basistheory.core.MediaTypes; -import com.basistheory.core.ObjectMappers; -import com.basistheory.core.RequestOptions; -import com.basistheory.errors.BadRequestError; -import com.basistheory.errors.ForbiddenError; -import com.basistheory.errors.UnauthorizedError; -import com.basistheory.errors.UnprocessableEntityError; -import com.basistheory.types.ApplePaySessionRequest; -import com.basistheory.types.ProblemDetails; -import com.basistheory.types.ValidationProblemDetails; -import com.fasterxml.jackson.core.JsonProcessingException; -import java.io.IOException; -import java.util.concurrent.CompletableFuture; -import okhttp3.Call; -import okhttp3.Callback; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; -import okhttp3.ResponseBody; -import org.jetbrains.annotations.NotNull; - -public class AsyncRawSessionClient { - protected final ClientOptions clientOptions; - - public AsyncRawSessionClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - public CompletableFuture> create() { - return create(ApplePaySessionRequest.builder().build()); - } - - public CompletableFuture> create(ApplePaySessionRequest request) { - return create(request, null); - } - - public CompletableFuture> create( - ApplePaySessionRequest request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("connections/apple-pay/session") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); - } catch (JsonProcessingException e) { - throw new BasisTheoryException("Failed to serialize request", e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = new CompletableFuture<>(); - client.newCall(okhttpRequest).enqueue(new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { - try (ResponseBody responseBody = response.body()) { - if (response.isSuccessful()) { - future.complete(new BasisTheoryApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), String.class), response)); - return; - } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - try { - switch (response.code()) { - case 400: - future.completeExceptionally(new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, ValidationProblemDetails.class), - response)); - return; - case 401: - future.completeExceptionally(new UnauthorizedError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProblemDetails.class), - response)); - return; - case 403: - future.completeExceptionally(new ForbiddenError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProblemDetails.class), - response)); - return; - case 422: - future.completeExceptionally(new UnprocessableEntityError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProblemDetails.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - future.completeExceptionally(new BasisTheoryApiApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - } catch (IOException e) { - future.completeExceptionally(new BasisTheoryException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BasisTheoryException("Network error executing HTTP request", e)); - } - }); - return future; - } -} diff --git a/src/main/java/com/basistheory/resources/connection/applepay/session/AsyncSessionClient.java b/src/main/java/com/basistheory/resources/connection/applepay/session/AsyncSessionClient.java deleted file mode 100644 index 9503d0f..0000000 --- a/src/main/java/com/basistheory/resources/connection/applepay/session/AsyncSessionClient.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.basistheory.resources.connection.applepay.session; - -import com.basistheory.core.ClientOptions; -import com.basistheory.core.RequestOptions; -import com.basistheory.types.ApplePaySessionRequest; -import java.util.concurrent.CompletableFuture; - -public class AsyncSessionClient { - protected final ClientOptions clientOptions; - - private final AsyncRawSessionClient rawClient; - - public AsyncSessionClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new AsyncRawSessionClient(clientOptions); - } - - /** - * Get responses with HTTP metadata like headers - */ - public AsyncRawSessionClient withRawResponse() { - return this.rawClient; - } - - public CompletableFuture create() { - return this.rawClient.create().thenApply(response -> response.body()); - } - - public CompletableFuture create(ApplePaySessionRequest request) { - return this.rawClient.create(request).thenApply(response -> response.body()); - } - - public CompletableFuture create(ApplePaySessionRequest request, RequestOptions requestOptions) { - return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); - } -} diff --git a/src/main/java/com/basistheory/resources/connection/applepay/session/RawSessionClient.java b/src/main/java/com/basistheory/resources/connection/applepay/session/RawSessionClient.java deleted file mode 100644 index ddb11b6..0000000 --- a/src/main/java/com/basistheory/resources/connection/applepay/session/RawSessionClient.java +++ /dev/null @@ -1,106 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.basistheory.resources.connection.applepay.session; - -import com.basistheory.core.BasisTheoryApiApiException; -import com.basistheory.core.BasisTheoryApiHttpResponse; -import com.basistheory.core.BasisTheoryException; -import com.basistheory.core.ClientOptions; -import com.basistheory.core.MediaTypes; -import com.basistheory.core.ObjectMappers; -import com.basistheory.core.RequestOptions; -import com.basistheory.errors.BadRequestError; -import com.basistheory.errors.ForbiddenError; -import com.basistheory.errors.UnauthorizedError; -import com.basistheory.errors.UnprocessableEntityError; -import com.basistheory.types.ApplePaySessionRequest; -import com.basistheory.types.ProblemDetails; -import com.basistheory.types.ValidationProblemDetails; -import com.fasterxml.jackson.core.JsonProcessingException; -import java.io.IOException; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; -import okhttp3.ResponseBody; - -public class RawSessionClient { - protected final ClientOptions clientOptions; - - public RawSessionClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - public BasisTheoryApiHttpResponse create() { - return create(ApplePaySessionRequest.builder().build()); - } - - public BasisTheoryApiHttpResponse create(ApplePaySessionRequest request) { - return create(request, null); - } - - public BasisTheoryApiHttpResponse create(ApplePaySessionRequest request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("connections/apple-pay/session") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); - } catch (JsonProcessingException e) { - throw new BasisTheoryException("Failed to serialize request", e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - try (Response response = client.newCall(okhttpRequest).execute()) { - ResponseBody responseBody = response.body(); - if (response.isSuccessful()) { - return new BasisTheoryApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), String.class), response); - } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - try { - switch (response.code()) { - case 400: - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ValidationProblemDetails.class), - response); - case 401: - throw new UnauthorizedError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProblemDetails.class), - response); - case 403: - throw new ForbiddenError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProblemDetails.class), - response); - case 422: - throw new UnprocessableEntityError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProblemDetails.class), - response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - throw new BasisTheoryApiApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); - } catch (IOException e) { - throw new BasisTheoryException("Network error executing HTTP request", e); - } - } -} diff --git a/src/main/java/com/basistheory/resources/connection/applepay/session/SessionClient.java b/src/main/java/com/basistheory/resources/connection/applepay/session/SessionClient.java deleted file mode 100644 index 672f8b5..0000000 --- a/src/main/java/com/basistheory/resources/connection/applepay/session/SessionClient.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.basistheory.resources.connection.applepay.session; - -import com.basistheory.core.ClientOptions; -import com.basistheory.core.RequestOptions; -import com.basistheory.types.ApplePaySessionRequest; - -public class SessionClient { - protected final ClientOptions clientOptions; - - private final RawSessionClient rawClient; - - public SessionClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new RawSessionClient(clientOptions); - } - - /** - * Get responses with HTTP metadata like headers - */ - public RawSessionClient withRawResponse() { - return this.rawClient; - } - - public String create() { - return this.rawClient.create().body(); - } - - public String create(ApplePaySessionRequest request) { - return this.rawClient.create(request).body(); - } - - public String create(ApplePaySessionRequest request, RequestOptions requestOptions) { - return this.rawClient.create(request, requestOptions).body(); - } -} diff --git a/src/main/java/com/basistheory/resources/enrichments/AsyncEnrichmentsClient.java b/src/main/java/com/basistheory/resources/enrichments/AsyncEnrichmentsClient.java index 0ed74b6..6871d83 100644 --- a/src/main/java/com/basistheory/resources/enrichments/AsyncEnrichmentsClient.java +++ b/src/main/java/com/basistheory/resources/enrichments/AsyncEnrichmentsClient.java @@ -6,7 +6,9 @@ import com.basistheory.core.ClientOptions; import com.basistheory.core.RequestOptions; import com.basistheory.resources.enrichments.requests.BankVerificationRequest; +import com.basistheory.resources.enrichments.requests.EnrichmentsGetCardDetailsRequest; import com.basistheory.types.BankVerificationResponse; +import com.basistheory.types.CardDetailsResponse; import java.util.concurrent.CompletableFuture; public class AsyncEnrichmentsClient { @@ -34,4 +36,13 @@ public CompletableFuture bankAccountVerify( BankVerificationRequest request, RequestOptions requestOptions) { return this.rawClient.bankAccountVerify(request, requestOptions).thenApply(response -> response.body()); } + + public CompletableFuture getcarddetails(EnrichmentsGetCardDetailsRequest request) { + return this.rawClient.getcarddetails(request).thenApply(response -> response.body()); + } + + public CompletableFuture getcarddetails( + EnrichmentsGetCardDetailsRequest request, RequestOptions requestOptions) { + return this.rawClient.getcarddetails(request, requestOptions).thenApply(response -> response.body()); + } } diff --git a/src/main/java/com/basistheory/resources/enrichments/AsyncRawEnrichmentsClient.java b/src/main/java/com/basistheory/resources/enrichments/AsyncRawEnrichmentsClient.java index 9ce2771..3760784 100644 --- a/src/main/java/com/basistheory/resources/enrichments/AsyncRawEnrichmentsClient.java +++ b/src/main/java/com/basistheory/resources/enrichments/AsyncRawEnrichmentsClient.java @@ -9,12 +9,15 @@ import com.basistheory.core.ClientOptions; import com.basistheory.core.MediaTypes; import com.basistheory.core.ObjectMappers; +import com.basistheory.core.QueryStringMapper; import com.basistheory.core.RequestOptions; import com.basistheory.errors.BadRequestError; import com.basistheory.errors.ForbiddenError; import com.basistheory.errors.UnauthorizedError; import com.basistheory.resources.enrichments.requests.BankVerificationRequest; +import com.basistheory.resources.enrichments.requests.EnrichmentsGetCardDetailsRequest; import com.basistheory.types.BankVerificationResponse; +import com.basistheory.types.CardDetailsResponse; import com.basistheory.types.ProblemDetails; import com.basistheory.types.ValidationProblemDetails; import com.fasterxml.jackson.core.JsonProcessingException; @@ -120,4 +123,72 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { }); return future; } + + public CompletableFuture> getcarddetails( + EnrichmentsGetCardDetailsRequest request) { + return getcarddetails(request, null); + } + + public CompletableFuture> getcarddetails( + EnrichmentsGetCardDetailsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("enrichments/card-details"); + QueryStringMapper.addQueryParameter(httpUrl, "bin", request.getBin(), false); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new BasisTheoryApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CardDetailsResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProblemDetails.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProblemDetails.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + future.completeExceptionally(new BasisTheoryApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new BasisTheoryException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new BasisTheoryException("Network error executing HTTP request", e)); + } + }); + return future; + } } diff --git a/src/main/java/com/basistheory/resources/enrichments/EnrichmentsClient.java b/src/main/java/com/basistheory/resources/enrichments/EnrichmentsClient.java index e3de9cb..c3588cf 100644 --- a/src/main/java/com/basistheory/resources/enrichments/EnrichmentsClient.java +++ b/src/main/java/com/basistheory/resources/enrichments/EnrichmentsClient.java @@ -6,7 +6,9 @@ import com.basistheory.core.ClientOptions; import com.basistheory.core.RequestOptions; import com.basistheory.resources.enrichments.requests.BankVerificationRequest; +import com.basistheory.resources.enrichments.requests.EnrichmentsGetCardDetailsRequest; import com.basistheory.types.BankVerificationResponse; +import com.basistheory.types.CardDetailsResponse; public class EnrichmentsClient { protected final ClientOptions clientOptions; @@ -32,4 +34,12 @@ public BankVerificationResponse bankAccountVerify(BankVerificationRequest reques public BankVerificationResponse bankAccountVerify(BankVerificationRequest request, RequestOptions requestOptions) { return this.rawClient.bankAccountVerify(request, requestOptions).body(); } + + public CardDetailsResponse getcarddetails(EnrichmentsGetCardDetailsRequest request) { + return this.rawClient.getcarddetails(request).body(); + } + + public CardDetailsResponse getcarddetails(EnrichmentsGetCardDetailsRequest request, RequestOptions requestOptions) { + return this.rawClient.getcarddetails(request, requestOptions).body(); + } } diff --git a/src/main/java/com/basistheory/resources/enrichments/RawEnrichmentsClient.java b/src/main/java/com/basistheory/resources/enrichments/RawEnrichmentsClient.java index c7e2d2e..caca149 100644 --- a/src/main/java/com/basistheory/resources/enrichments/RawEnrichmentsClient.java +++ b/src/main/java/com/basistheory/resources/enrichments/RawEnrichmentsClient.java @@ -9,12 +9,15 @@ import com.basistheory.core.ClientOptions; import com.basistheory.core.MediaTypes; import com.basistheory.core.ObjectMappers; +import com.basistheory.core.QueryStringMapper; import com.basistheory.core.RequestOptions; import com.basistheory.errors.BadRequestError; import com.basistheory.errors.ForbiddenError; import com.basistheory.errors.UnauthorizedError; import com.basistheory.resources.enrichments.requests.BankVerificationRequest; +import com.basistheory.resources.enrichments.requests.EnrichmentsGetCardDetailsRequest; import com.basistheory.types.BankVerificationResponse; +import com.basistheory.types.CardDetailsResponse; import com.basistheory.types.ProblemDetails; import com.basistheory.types.ValidationProblemDetails; import com.fasterxml.jackson.core.JsonProcessingException; @@ -97,4 +100,56 @@ public BasisTheoryApiHttpResponse bankAccountVerify( throw new BasisTheoryException("Network error executing HTTP request", e); } } + + public BasisTheoryApiHttpResponse getcarddetails(EnrichmentsGetCardDetailsRequest request) { + return getcarddetails(request, null); + } + + public BasisTheoryApiHttpResponse getcarddetails( + EnrichmentsGetCardDetailsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("enrichments/card-details"); + QueryStringMapper.addQueryParameter(httpUrl, "bin", request.getBin(), false); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new BasisTheoryApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CardDetailsResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProblemDetails.class), + response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProblemDetails.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + throw new BasisTheoryApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new BasisTheoryException("Network error executing HTTP request", e); + } + } } diff --git a/src/main/java/com/basistheory/resources/enrichments/requests/EnrichmentsGetCardDetailsRequest.java b/src/main/java/com/basistheory/resources/enrichments/requests/EnrichmentsGetCardDetailsRequest.java new file mode 100644 index 0000000..ee01db6 --- /dev/null +++ b/src/main/java/com/basistheory/resources/enrichments/requests/EnrichmentsGetCardDetailsRequest.java @@ -0,0 +1,102 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.basistheory.resources.enrichments.requests; + +import com.basistheory.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = EnrichmentsGetCardDetailsRequest.Builder.class) +public final class EnrichmentsGetCardDetailsRequest { + private final String bin; + + private final Map additionalProperties; + + private EnrichmentsGetCardDetailsRequest(String bin, Map additionalProperties) { + this.bin = bin; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("bin") + public String getBin() { + return bin; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof EnrichmentsGetCardDetailsRequest && equalTo((EnrichmentsGetCardDetailsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(EnrichmentsGetCardDetailsRequest other) { + return bin.equals(other.bin); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.bin); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BinStage builder() { + return new Builder(); + } + + public interface BinStage { + _FinalStage bin(@NotNull String bin); + + Builder from(EnrichmentsGetCardDetailsRequest other); + } + + public interface _FinalStage { + EnrichmentsGetCardDetailsRequest build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements BinStage, _FinalStage { + private String bin; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(EnrichmentsGetCardDetailsRequest other) { + bin(other.getBin()); + return this; + } + + @java.lang.Override + @JsonSetter("bin") + public _FinalStage bin(@NotNull String bin) { + this.bin = Objects.requireNonNull(bin, "bin must not be null"); + return this; + } + + @java.lang.Override + public EnrichmentsGetCardDetailsRequest build() { + return new EnrichmentsGetCardDetailsRequest(bin, additionalProperties); + } + } +} diff --git a/src/main/java/com/basistheory/resources/googlepay/AsyncGooglePayClient.java b/src/main/java/com/basistheory/resources/googlepay/AsyncGooglePayClient.java new file mode 100644 index 0000000..a219bc7 --- /dev/null +++ b/src/main/java/com/basistheory/resources/googlepay/AsyncGooglePayClient.java @@ -0,0 +1,58 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.basistheory.resources.googlepay; + +import com.basistheory.core.ClientOptions; +import com.basistheory.core.RequestOptions; +import com.basistheory.resources.googlepay.requests.GooglePayCreateRequest; +import com.basistheory.types.GooglePayCreateResponse; +import com.basistheory.types.GooglePayToken; +import java.util.concurrent.CompletableFuture; + +public class AsyncGooglePayClient { + protected final ClientOptions clientOptions; + + private final AsyncRawGooglePayClient rawClient; + + public AsyncGooglePayClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawGooglePayClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawGooglePayClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture create() { + return this.rawClient.create().thenApply(response -> response.body()); + } + + public CompletableFuture create(GooglePayCreateRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + public CompletableFuture create( + GooglePayCreateRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture get(String id) { + return this.rawClient.get(id).thenApply(response -> response.body()); + } + + public CompletableFuture get(String id, RequestOptions requestOptions) { + return this.rawClient.get(id, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture delete(String id) { + return this.rawClient.delete(id).thenApply(response -> response.body()); + } + + public CompletableFuture delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/basistheory/resources/googlepay/AsyncGooglepayClient.java b/src/main/java/com/basistheory/resources/googlepay/AsyncGooglepayClient.java deleted file mode 100644 index 8867d48..0000000 --- a/src/main/java/com/basistheory/resources/googlepay/AsyncGooglepayClient.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.basistheory.resources.googlepay; - -import com.basistheory.core.ClientOptions; -import com.basistheory.core.RequestOptions; -import com.basistheory.resources.googlepay.requests.GooglePayTokenizeRequest; -import com.basistheory.types.GooglePayTokenizeResponse; -import java.util.concurrent.CompletableFuture; - -public class AsyncGooglepayClient { - protected final ClientOptions clientOptions; - - private final AsyncRawGooglepayClient rawClient; - - public AsyncGooglepayClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new AsyncRawGooglepayClient(clientOptions); - } - - /** - * Get responses with HTTP metadata like headers - */ - public AsyncRawGooglepayClient withRawResponse() { - return this.rawClient; - } - - public CompletableFuture tokenize() { - return this.rawClient.tokenize().thenApply(response -> response.body()); - } - - public CompletableFuture tokenize(GooglePayTokenizeRequest request) { - return this.rawClient.tokenize(request).thenApply(response -> response.body()); - } - - public CompletableFuture tokenize( - GooglePayTokenizeRequest request, RequestOptions requestOptions) { - return this.rawClient.tokenize(request, requestOptions).thenApply(response -> response.body()); - } -} diff --git a/src/main/java/com/basistheory/resources/connection/applepay/domain/AsyncRawDomainClient.java b/src/main/java/com/basistheory/resources/googlepay/AsyncRawGooglePayClient.java similarity index 62% rename from src/main/java/com/basistheory/resources/connection/applepay/domain/AsyncRawDomainClient.java rename to src/main/java/com/basistheory/resources/googlepay/AsyncRawGooglePayClient.java index defb6dd..ec05eed 100644 --- a/src/main/java/com/basistheory/resources/connection/applepay/domain/AsyncRawDomainClient.java +++ b/src/main/java/com/basistheory/resources/googlepay/AsyncRawGooglePayClient.java @@ -1,7 +1,7 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.basistheory.resources.connection.applepay.domain; +package com.basistheory.resources.googlepay; import com.basistheory.core.BasisTheoryApiApiException; import com.basistheory.core.BasisTheoryApiHttpResponse; @@ -11,14 +11,14 @@ import com.basistheory.core.ObjectMappers; import com.basistheory.core.RequestOptions; import com.basistheory.errors.BadRequestError; +import com.basistheory.errors.ConflictError; import com.basistheory.errors.ForbiddenError; -import com.basistheory.errors.ServiceUnavailableError; +import com.basistheory.errors.NotFoundError; import com.basistheory.errors.UnauthorizedError; import com.basistheory.errors.UnprocessableEntityError; -import com.basistheory.types.ApplePayDomainDeregistrationRequest; -import com.basistheory.types.ApplePayDomainRegistrationListRequest; -import com.basistheory.types.ApplePayDomainRegistrationRequest; -import com.basistheory.types.ApplePayDomainRegistrationResponse; +import com.basistheory.resources.googlepay.requests.GooglePayCreateRequest; +import com.basistheory.types.GooglePayCreateResponse; +import com.basistheory.types.GooglePayToken; import com.basistheory.types.ProblemDetails; import com.basistheory.types.ValidationProblemDetails; import com.fasterxml.jackson.core.JsonProcessingException; @@ -35,22 +35,27 @@ import okhttp3.ResponseBody; import org.jetbrains.annotations.NotNull; -public class AsyncRawDomainClient { +public class AsyncRawGooglePayClient { protected final ClientOptions clientOptions; - public AsyncRawDomainClient(ClientOptions clientOptions) { + public AsyncRawGooglePayClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - public CompletableFuture> deregister(ApplePayDomainDeregistrationRequest request) { - return deregister(request, null); + public CompletableFuture> create() { + return create(GooglePayCreateRequest.builder().build()); } - public CompletableFuture> deregister( - ApplePayDomainDeregistrationRequest request, RequestOptions requestOptions) { + public CompletableFuture> create( + GooglePayCreateRequest request) { + return create(request, null); + } + + public CompletableFuture> create( + GooglePayCreateRequest request, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("connections/apple-pay/domain-deregistration") + .addPathSegments("google-pay") .build(); RequestBody body; try { @@ -70,18 +75,27 @@ public CompletableFuture> deregister( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BasisTheoryApiHttpResponse<>(null, response)); + future.complete(new BasisTheoryApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), GooglePayCreateResponse.class), + response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ValidationProblemDetails.class), + response)); + return; case 401: future.completeExceptionally(new UnauthorizedError( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProblemDetails.class), @@ -92,6 +106,16 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProblemDetails.class), response)); return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProblemDetails.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProblemDetails.class), + response)); + return; } } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error @@ -115,15 +139,15 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { return future; } - public CompletableFuture> get() { - return get(null); + public CompletableFuture> get(String id) { + return get(id, null); } - public CompletableFuture> get( - RequestOptions requestOptions) { + public CompletableFuture> get(String id, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("connections/apple-pay/domain-registration") + .addPathSegments("google-pay") + .addPathSegment(id) .build(); Request okhttpRequest = new Request.Builder() .url(httpUrl) @@ -135,100 +159,20 @@ public CompletableFuture> future = - new CompletableFuture<>(); - client.newCall(okhttpRequest).enqueue(new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { - try (ResponseBody responseBody = response.body()) { - if (response.isSuccessful()) { - future.complete(new BasisTheoryApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), ApplePayDomainRegistrationResponse.class), - response)); - return; - } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - try { - if (response.code() == 401) { - future.completeExceptionally(new UnauthorizedError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProblemDetails.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - future.completeExceptionally(new BasisTheoryApiApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - } catch (IOException e) { - future.completeExceptionally(new BasisTheoryException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BasisTheoryException("Network error executing HTTP request", e)); - } - }); - return future; - } - - public CompletableFuture> register( - ApplePayDomainRegistrationRequest request) { - return register(request, null); - } - - public CompletableFuture> register( - ApplePayDomainRegistrationRequest request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("connections/apple-pay/domain-registration") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); - } catch (JsonProcessingException e) { - throw new BasisTheoryException("Failed to serialize request", e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = - new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { future.complete(new BasisTheoryApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), ApplePayDomainRegistrationResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GooglePayToken.class), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { - case 400: - future.completeExceptionally(new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, ValidationProblemDetails.class), - response)); - return; case 401: future.completeExceptionally(new UnauthorizedError( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProblemDetails.class), @@ -239,14 +183,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProblemDetails.class), response)); return; - case 422: - future.completeExceptionally(new UnprocessableEntityError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProblemDetails.class), - response)); - return; - case 503: - future.completeExceptionally(new ServiceUnavailableError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProblemDetails.class), + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } @@ -272,61 +211,39 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { return future; } - public CompletableFuture> registerAll() { - return registerAll(ApplePayDomainRegistrationListRequest.builder().build()); + public CompletableFuture> delete(String id) { + return delete(id, null); } - public CompletableFuture> registerAll( - ApplePayDomainRegistrationListRequest request) { - return registerAll(request, null); - } - - public CompletableFuture> registerAll( - ApplePayDomainRegistrationListRequest request, RequestOptions requestOptions) { + public CompletableFuture> delete(String id, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("connections/apple-pay/domain-registration") + .addPathSegments("google-pay") + .addPathSegment(id) .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); - } catch (JsonProcessingException e) { - throw new BasisTheoryException("Failed to serialize request", e); - } Request okhttpRequest = new Request.Builder() .url(httpUrl) - .method("PUT", body) + .method("DELETE", null) .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = - new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { future.complete(new BasisTheoryApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), ApplePayDomainRegistrationResponse.class), - response)); + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), String.class), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { - case 400: - future.completeExceptionally(new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, ValidationProblemDetails.class), - response)); - return; case 401: future.completeExceptionally(new UnauthorizedError( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProblemDetails.class), @@ -337,14 +254,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProblemDetails.class), response)); return; - case 422: - future.completeExceptionally(new UnprocessableEntityError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProblemDetails.class), - response)); - return; - case 503: - future.completeExceptionally(new ServiceUnavailableError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProblemDetails.class), + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } diff --git a/src/main/java/com/basistheory/resources/googlepay/AsyncRawGooglepayClient.java b/src/main/java/com/basistheory/resources/googlepay/AsyncRawGooglepayClient.java deleted file mode 100644 index 2fd164a..0000000 --- a/src/main/java/com/basistheory/resources/googlepay/AsyncRawGooglepayClient.java +++ /dev/null @@ -1,139 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.basistheory.resources.googlepay; - -import com.basistheory.core.BasisTheoryApiApiException; -import com.basistheory.core.BasisTheoryApiHttpResponse; -import com.basistheory.core.BasisTheoryException; -import com.basistheory.core.ClientOptions; -import com.basistheory.core.MediaTypes; -import com.basistheory.core.ObjectMappers; -import com.basistheory.core.RequestOptions; -import com.basistheory.errors.BadRequestError; -import com.basistheory.errors.ConflictError; -import com.basistheory.errors.ForbiddenError; -import com.basistheory.errors.UnauthorizedError; -import com.basistheory.errors.UnprocessableEntityError; -import com.basistheory.resources.googlepay.requests.GooglePayTokenizeRequest; -import com.basistheory.types.GooglePayTokenizeResponse; -import com.basistheory.types.ProblemDetails; -import com.basistheory.types.ValidationProblemDetails; -import com.fasterxml.jackson.core.JsonProcessingException; -import java.io.IOException; -import java.util.concurrent.CompletableFuture; -import okhttp3.Call; -import okhttp3.Callback; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; -import okhttp3.ResponseBody; -import org.jetbrains.annotations.NotNull; - -public class AsyncRawGooglepayClient { - protected final ClientOptions clientOptions; - - public AsyncRawGooglepayClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - public CompletableFuture> tokenize() { - return tokenize(GooglePayTokenizeRequest.builder().build()); - } - - public CompletableFuture> tokenize( - GooglePayTokenizeRequest request) { - return tokenize(request, null); - } - - public CompletableFuture> tokenize( - GooglePayTokenizeRequest request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("connections/google-pay/tokenize") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); - } catch (JsonProcessingException e) { - throw new BasisTheoryException("Failed to serialize request", e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = new CompletableFuture<>(); - client.newCall(okhttpRequest).enqueue(new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { - try (ResponseBody responseBody = response.body()) { - if (response.isSuccessful()) { - future.complete(new BasisTheoryApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), GooglePayTokenizeResponse.class), - response)); - return; - } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - try { - switch (response.code()) { - case 400: - future.completeExceptionally(new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, ValidationProblemDetails.class), - response)); - return; - case 401: - future.completeExceptionally(new UnauthorizedError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProblemDetails.class), - response)); - return; - case 403: - future.completeExceptionally(new ForbiddenError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProblemDetails.class), - response)); - return; - case 409: - future.completeExceptionally(new ConflictError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProblemDetails.class), - response)); - return; - case 422: - future.completeExceptionally(new UnprocessableEntityError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProblemDetails.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - future.completeExceptionally(new BasisTheoryApiApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - } catch (IOException e) { - future.completeExceptionally(new BasisTheoryException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BasisTheoryException("Network error executing HTTP request", e)); - } - }); - return future; - } -} diff --git a/src/main/java/com/basistheory/resources/googlepay/GooglePayClient.java b/src/main/java/com/basistheory/resources/googlepay/GooglePayClient.java new file mode 100644 index 0000000..3470520 --- /dev/null +++ b/src/main/java/com/basistheory/resources/googlepay/GooglePayClient.java @@ -0,0 +1,56 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.basistheory.resources.googlepay; + +import com.basistheory.core.ClientOptions; +import com.basistheory.core.RequestOptions; +import com.basistheory.resources.googlepay.requests.GooglePayCreateRequest; +import com.basistheory.types.GooglePayCreateResponse; +import com.basistheory.types.GooglePayToken; + +public class GooglePayClient { + protected final ClientOptions clientOptions; + + private final RawGooglePayClient rawClient; + + public GooglePayClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawGooglePayClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawGooglePayClient withRawResponse() { + return this.rawClient; + } + + public GooglePayCreateResponse create() { + return this.rawClient.create().body(); + } + + public GooglePayCreateResponse create(GooglePayCreateRequest request) { + return this.rawClient.create(request).body(); + } + + public GooglePayCreateResponse create(GooglePayCreateRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + public GooglePayToken get(String id) { + return this.rawClient.get(id).body(); + } + + public GooglePayToken get(String id, RequestOptions requestOptions) { + return this.rawClient.get(id, requestOptions).body(); + } + + public String delete(String id) { + return this.rawClient.delete(id).body(); + } + + public String delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).body(); + } +} diff --git a/src/main/java/com/basistheory/resources/googlepay/GooglepayClient.java b/src/main/java/com/basistheory/resources/googlepay/GooglepayClient.java deleted file mode 100644 index c3a2c80..0000000 --- a/src/main/java/com/basistheory/resources/googlepay/GooglepayClient.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.basistheory.resources.googlepay; - -import com.basistheory.core.ClientOptions; -import com.basistheory.core.RequestOptions; -import com.basistheory.resources.googlepay.requests.GooglePayTokenizeRequest; -import com.basistheory.types.GooglePayTokenizeResponse; - -public class GooglepayClient { - protected final ClientOptions clientOptions; - - private final RawGooglepayClient rawClient; - - public GooglepayClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new RawGooglepayClient(clientOptions); - } - - /** - * Get responses with HTTP metadata like headers - */ - public RawGooglepayClient withRawResponse() { - return this.rawClient; - } - - public GooglePayTokenizeResponse tokenize() { - return this.rawClient.tokenize().body(); - } - - public GooglePayTokenizeResponse tokenize(GooglePayTokenizeRequest request) { - return this.rawClient.tokenize(request).body(); - } - - public GooglePayTokenizeResponse tokenize(GooglePayTokenizeRequest request, RequestOptions requestOptions) { - return this.rawClient.tokenize(request, requestOptions).body(); - } -} diff --git a/src/main/java/com/basistheory/resources/connection/applepay/domain/RawDomainClient.java b/src/main/java/com/basistheory/resources/googlepay/RawGooglePayClient.java similarity index 58% rename from src/main/java/com/basistheory/resources/connection/applepay/domain/RawDomainClient.java rename to src/main/java/com/basistheory/resources/googlepay/RawGooglePayClient.java index a07edb2..503a6a4 100644 --- a/src/main/java/com/basistheory/resources/connection/applepay/domain/RawDomainClient.java +++ b/src/main/java/com/basistheory/resources/googlepay/RawGooglePayClient.java @@ -1,7 +1,7 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.basistheory.resources.connection.applepay.domain; +package com.basistheory.resources.googlepay; import com.basistheory.core.BasisTheoryApiApiException; import com.basistheory.core.BasisTheoryApiHttpResponse; @@ -11,14 +11,14 @@ import com.basistheory.core.ObjectMappers; import com.basistheory.core.RequestOptions; import com.basistheory.errors.BadRequestError; +import com.basistheory.errors.ConflictError; import com.basistheory.errors.ForbiddenError; -import com.basistheory.errors.ServiceUnavailableError; +import com.basistheory.errors.NotFoundError; import com.basistheory.errors.UnauthorizedError; import com.basistheory.errors.UnprocessableEntityError; -import com.basistheory.types.ApplePayDomainDeregistrationRequest; -import com.basistheory.types.ApplePayDomainRegistrationListRequest; -import com.basistheory.types.ApplePayDomainRegistrationRequest; -import com.basistheory.types.ApplePayDomainRegistrationResponse; +import com.basistheory.resources.googlepay.requests.GooglePayCreateRequest; +import com.basistheory.types.GooglePayCreateResponse; +import com.basistheory.types.GooglePayToken; import com.basistheory.types.ProblemDetails; import com.basistheory.types.ValidationProblemDetails; import com.fasterxml.jackson.core.JsonProcessingException; @@ -31,22 +31,26 @@ import okhttp3.Response; import okhttp3.ResponseBody; -public class RawDomainClient { +public class RawGooglePayClient { protected final ClientOptions clientOptions; - public RawDomainClient(ClientOptions clientOptions) { + public RawGooglePayClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - public BasisTheoryApiHttpResponse deregister(ApplePayDomainDeregistrationRequest request) { - return deregister(request, null); + public BasisTheoryApiHttpResponse create() { + return create(GooglePayCreateRequest.builder().build()); } - public BasisTheoryApiHttpResponse deregister( - ApplePayDomainDeregistrationRequest request, RequestOptions requestOptions) { + public BasisTheoryApiHttpResponse create(GooglePayCreateRequest request) { + return create(request, null); + } + + public BasisTheoryApiHttpResponse create( + GooglePayCreateRequest request, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("connections/apple-pay/domain-deregistration") + .addPathSegments("google-pay") .build(); RequestBody body; try { @@ -69,11 +73,17 @@ public BasisTheoryApiHttpResponse deregister( try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BasisTheoryApiHttpResponse<>(null, response); + return new BasisTheoryApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GooglePayCreateResponse.class), + response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ValidationProblemDetails.class), + response); case 401: throw new UnauthorizedError( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProblemDetails.class), @@ -82,6 +92,14 @@ public BasisTheoryApiHttpResponse deregister( throw new ForbiddenError( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProblemDetails.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProblemDetails.class), + response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProblemDetails.class), + response); } } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error @@ -96,14 +114,15 @@ public BasisTheoryApiHttpResponse deregister( } } - public BasisTheoryApiHttpResponse get() { - return get(null); + public BasisTheoryApiHttpResponse get(String id) { + return get(id, null); } - public BasisTheoryApiHttpResponse get(RequestOptions requestOptions) { + public BasisTheoryApiHttpResponse get(String id, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("connections/apple-pay/domain-registration") + .addPathSegments("google-pay") + .addPathSegment(id) .build(); Request okhttpRequest = new Request.Builder() .url(httpUrl) @@ -119,73 +138,11 @@ public BasisTheoryApiHttpResponse get(Reques ResponseBody responseBody = response.body(); if (response.isSuccessful()) { return new BasisTheoryApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), ApplePayDomainRegistrationResponse.class), - response); - } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - try { - if (response.code() == 401) { - throw new UnauthorizedError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProblemDetails.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - throw new BasisTheoryApiApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); - } catch (IOException e) { - throw new BasisTheoryException("Network error executing HTTP request", e); - } - } - - public BasisTheoryApiHttpResponse register( - ApplePayDomainRegistrationRequest request) { - return register(request, null); - } - - public BasisTheoryApiHttpResponse register( - ApplePayDomainRegistrationRequest request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("connections/apple-pay/domain-registration") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); - } catch (JsonProcessingException e) { - throw new BasisTheoryException("Failed to serialize request", e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - try (Response response = client.newCall(okhttpRequest).execute()) { - ResponseBody responseBody = response.body(); - if (response.isSuccessful()) { - return new BasisTheoryApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), ApplePayDomainRegistrationResponse.class), - response); + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GooglePayToken.class), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { - case 400: - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ValidationProblemDetails.class), - response); case 401: throw new UnauthorizedError( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProblemDetails.class), @@ -194,14 +151,9 @@ public BasisTheoryApiHttpResponse register( throw new ForbiddenError( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProblemDetails.class), response); - case 422: - throw new UnprocessableEntityError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProblemDetails.class), - response); - case 503: - throw new ServiceUnavailableError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProblemDetails.class), - response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error @@ -216,33 +168,20 @@ public BasisTheoryApiHttpResponse register( } } - public BasisTheoryApiHttpResponse registerAll() { - return registerAll(ApplePayDomainRegistrationListRequest.builder().build()); - } - - public BasisTheoryApiHttpResponse registerAll( - ApplePayDomainRegistrationListRequest request) { - return registerAll(request, null); + public BasisTheoryApiHttpResponse delete(String id) { + return delete(id, null); } - public BasisTheoryApiHttpResponse registerAll( - ApplePayDomainRegistrationListRequest request, RequestOptions requestOptions) { + public BasisTheoryApiHttpResponse delete(String id, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("connections/apple-pay/domain-registration") + .addPathSegments("google-pay") + .addPathSegment(id) .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); - } catch (JsonProcessingException e) { - throw new BasisTheoryException("Failed to serialize request", e); - } Request okhttpRequest = new Request.Builder() .url(httpUrl) - .method("PUT", body) + .method("DELETE", null) .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); @@ -253,17 +192,11 @@ public BasisTheoryApiHttpResponse registerAl ResponseBody responseBody = response.body(); if (response.isSuccessful()) { return new BasisTheoryApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), ApplePayDomainRegistrationResponse.class), - response); + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), String.class), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { - case 400: - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ValidationProblemDetails.class), - response); case 401: throw new UnauthorizedError( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProblemDetails.class), @@ -272,14 +205,9 @@ public BasisTheoryApiHttpResponse registerAl throw new ForbiddenError( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProblemDetails.class), response); - case 422: - throw new UnprocessableEntityError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProblemDetails.class), - response); - case 503: - throw new ServiceUnavailableError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProblemDetails.class), - response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error diff --git a/src/main/java/com/basistheory/resources/googlepay/RawGooglepayClient.java b/src/main/java/com/basistheory/resources/googlepay/RawGooglepayClient.java deleted file mode 100644 index b26da34..0000000 --- a/src/main/java/com/basistheory/resources/googlepay/RawGooglepayClient.java +++ /dev/null @@ -1,114 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.basistheory.resources.googlepay; - -import com.basistheory.core.BasisTheoryApiApiException; -import com.basistheory.core.BasisTheoryApiHttpResponse; -import com.basistheory.core.BasisTheoryException; -import com.basistheory.core.ClientOptions; -import com.basistheory.core.MediaTypes; -import com.basistheory.core.ObjectMappers; -import com.basistheory.core.RequestOptions; -import com.basistheory.errors.BadRequestError; -import com.basistheory.errors.ConflictError; -import com.basistheory.errors.ForbiddenError; -import com.basistheory.errors.UnauthorizedError; -import com.basistheory.errors.UnprocessableEntityError; -import com.basistheory.resources.googlepay.requests.GooglePayTokenizeRequest; -import com.basistheory.types.GooglePayTokenizeResponse; -import com.basistheory.types.ProblemDetails; -import com.basistheory.types.ValidationProblemDetails; -import com.fasterxml.jackson.core.JsonProcessingException; -import java.io.IOException; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; -import okhttp3.ResponseBody; - -public class RawGooglepayClient { - protected final ClientOptions clientOptions; - - public RawGooglepayClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - public BasisTheoryApiHttpResponse tokenize() { - return tokenize(GooglePayTokenizeRequest.builder().build()); - } - - public BasisTheoryApiHttpResponse tokenize(GooglePayTokenizeRequest request) { - return tokenize(request, null); - } - - public BasisTheoryApiHttpResponse tokenize( - GooglePayTokenizeRequest request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("connections/google-pay/tokenize") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); - } catch (JsonProcessingException e) { - throw new BasisTheoryException("Failed to serialize request", e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - try (Response response = client.newCall(okhttpRequest).execute()) { - ResponseBody responseBody = response.body(); - if (response.isSuccessful()) { - return new BasisTheoryApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GooglePayTokenizeResponse.class), - response); - } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - try { - switch (response.code()) { - case 400: - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ValidationProblemDetails.class), - response); - case 401: - throw new UnauthorizedError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProblemDetails.class), - response); - case 403: - throw new ForbiddenError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProblemDetails.class), - response); - case 409: - throw new ConflictError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProblemDetails.class), - response); - case 422: - throw new UnprocessableEntityError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProblemDetails.class), - response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - throw new BasisTheoryApiApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); - } catch (IOException e) { - throw new BasisTheoryException("Network error executing HTTP request", e); - } - } -} diff --git a/src/main/java/com/basistheory/resources/googlepay/requests/GooglePayCreateRequest.java b/src/main/java/com/basistheory/resources/googlepay/requests/GooglePayCreateRequest.java new file mode 100644 index 0000000..18af5eb --- /dev/null +++ b/src/main/java/com/basistheory/resources/googlepay/requests/GooglePayCreateRequest.java @@ -0,0 +1,121 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.basistheory.resources.googlepay.requests; + +import com.basistheory.core.ObjectMappers; +import com.basistheory.types.GooglePayMethodToken; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GooglePayCreateRequest.Builder.class) +public final class GooglePayCreateRequest { + private final Optional expiresAt; + + private final Optional googlePaymentData; + + private final Map additionalProperties; + + private GooglePayCreateRequest( + Optional expiresAt, + Optional googlePaymentData, + Map additionalProperties) { + this.expiresAt = expiresAt; + this.googlePaymentData = googlePaymentData; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("expires_at") + public Optional getExpiresAt() { + return expiresAt; + } + + @JsonProperty("google_payment_data") + public Optional getGooglePaymentData() { + return googlePaymentData; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GooglePayCreateRequest && equalTo((GooglePayCreateRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GooglePayCreateRequest other) { + return expiresAt.equals(other.expiresAt) && googlePaymentData.equals(other.googlePaymentData); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.expiresAt, this.googlePaymentData); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional expiresAt = Optional.empty(); + + private Optional googlePaymentData = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(GooglePayCreateRequest other) { + expiresAt(other.getExpiresAt()); + googlePaymentData(other.getGooglePaymentData()); + return this; + } + + @JsonSetter(value = "expires_at", nulls = Nulls.SKIP) + public Builder expiresAt(Optional expiresAt) { + this.expiresAt = expiresAt; + return this; + } + + public Builder expiresAt(String expiresAt) { + this.expiresAt = Optional.ofNullable(expiresAt); + return this; + } + + @JsonSetter(value = "google_payment_data", nulls = Nulls.SKIP) + public Builder googlePaymentData(Optional googlePaymentData) { + this.googlePaymentData = googlePaymentData; + return this; + } + + public Builder googlePaymentData(GooglePayMethodToken googlePaymentData) { + this.googlePaymentData = Optional.ofNullable(googlePaymentData); + return this; + } + + public GooglePayCreateRequest build() { + return new GooglePayCreateRequest(expiresAt, googlePaymentData, additionalProperties); + } + } +} diff --git a/src/main/java/com/basistheory/resources/proxies/requests/CreateProxyRequest.java b/src/main/java/com/basistheory/resources/proxies/requests/CreateProxyRequest.java index a76483a..4704c01 100644 --- a/src/main/java/com/basistheory/resources/proxies/requests/CreateProxyRequest.java +++ b/src/main/java/com/basistheory/resources/proxies/requests/CreateProxyRequest.java @@ -15,6 +15,7 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Optional; @@ -35,6 +36,10 @@ public final class CreateProxyRequest { private final Optional responseTransform; + private final Optional> requestTransforms; + + private final Optional> responseTransforms; + private final Optional application; private final Optional>> configuration; @@ -50,6 +55,8 @@ private CreateProxyRequest( Optional responseReactorId, Optional requestTransform, Optional responseTransform, + Optional> requestTransforms, + Optional> responseTransforms, Optional application, Optional>> configuration, Optional requireAuth, @@ -60,6 +67,8 @@ private CreateProxyRequest( this.responseReactorId = responseReactorId; this.requestTransform = requestTransform; this.responseTransform = responseTransform; + this.requestTransforms = requestTransforms; + this.responseTransforms = responseTransforms; this.application = application; this.configuration = configuration; this.requireAuth = requireAuth; @@ -96,6 +105,16 @@ public Optional getResponseTransform() { return responseTransform; } + @JsonProperty("request_transforms") + public Optional> getRequestTransforms() { + return requestTransforms; + } + + @JsonProperty("response_transforms") + public Optional> getResponseTransforms() { + return responseTransforms; + } + @JsonProperty("application") public Optional getApplication() { return application; @@ -129,6 +148,8 @@ private boolean equalTo(CreateProxyRequest other) { && responseReactorId.equals(other.responseReactorId) && requestTransform.equals(other.requestTransform) && responseTransform.equals(other.responseTransform) + && requestTransforms.equals(other.requestTransforms) + && responseTransforms.equals(other.responseTransforms) && application.equals(other.application) && configuration.equals(other.configuration) && requireAuth.equals(other.requireAuth); @@ -143,6 +164,8 @@ public int hashCode() { this.responseReactorId, this.requestTransform, this.responseTransform, + this.requestTransforms, + this.responseTransforms, this.application, this.configuration, this.requireAuth); @@ -186,6 +209,14 @@ public interface _FinalStage { _FinalStage responseTransform(ProxyTransform responseTransform); + _FinalStage requestTransforms(Optional> requestTransforms); + + _FinalStage requestTransforms(List requestTransforms); + + _FinalStage responseTransforms(Optional> responseTransforms); + + _FinalStage responseTransforms(List responseTransforms); + _FinalStage application(Optional application); _FinalStage application(Application application); @@ -211,6 +242,10 @@ public static final class Builder implements NameStage, DestinationUrlStage, _Fi private Optional application = Optional.empty(); + private Optional> responseTransforms = Optional.empty(); + + private Optional> requestTransforms = Optional.empty(); + private Optional responseTransform = Optional.empty(); private Optional requestTransform = Optional.empty(); @@ -232,6 +267,8 @@ public Builder from(CreateProxyRequest other) { responseReactorId(other.getResponseReactorId()); requestTransform(other.getRequestTransform()); responseTransform(other.getResponseTransform()); + requestTransforms(other.getRequestTransforms()); + responseTransforms(other.getResponseTransforms()); application(other.getApplication()); configuration(other.getConfiguration()); requireAuth(other.getRequireAuth()); @@ -291,6 +328,32 @@ public _FinalStage application(Optional application) { return this; } + @java.lang.Override + public _FinalStage responseTransforms(List responseTransforms) { + this.responseTransforms = Optional.ofNullable(responseTransforms); + return this; + } + + @java.lang.Override + @JsonSetter(value = "response_transforms", nulls = Nulls.SKIP) + public _FinalStage responseTransforms(Optional> responseTransforms) { + this.responseTransforms = responseTransforms; + return this; + } + + @java.lang.Override + public _FinalStage requestTransforms(List requestTransforms) { + this.requestTransforms = Optional.ofNullable(requestTransforms); + return this; + } + + @java.lang.Override + @JsonSetter(value = "request_transforms", nulls = Nulls.SKIP) + public _FinalStage requestTransforms(Optional> requestTransforms) { + this.requestTransforms = requestTransforms; + return this; + } + @java.lang.Override public _FinalStage responseTransform(ProxyTransform responseTransform) { this.responseTransform = Optional.ofNullable(responseTransform); @@ -352,6 +415,8 @@ public CreateProxyRequest build() { responseReactorId, requestTransform, responseTransform, + requestTransforms, + responseTransforms, application, configuration, requireAuth, diff --git a/src/main/java/com/basistheory/resources/proxies/requests/PatchProxyRequest.java b/src/main/java/com/basistheory/resources/proxies/requests/PatchProxyRequest.java index cad962b..0bf5e65 100644 --- a/src/main/java/com/basistheory/resources/proxies/requests/PatchProxyRequest.java +++ b/src/main/java/com/basistheory/resources/proxies/requests/PatchProxyRequest.java @@ -15,6 +15,7 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Optional; @@ -30,6 +31,10 @@ public final class PatchProxyRequest { private final Optional responseTransform; + private final Optional> requestTransforms; + + private final Optional> responseTransforms; + private final Optional application; private final Optional>> configuration; @@ -43,6 +48,8 @@ private PatchProxyRequest( Optional destinationUrl, Optional requestTransform, Optional responseTransform, + Optional> requestTransforms, + Optional> responseTransforms, Optional application, Optional>> configuration, Optional requireAuth, @@ -51,6 +58,8 @@ private PatchProxyRequest( this.destinationUrl = destinationUrl; this.requestTransform = requestTransform; this.responseTransform = responseTransform; + this.requestTransforms = requestTransforms; + this.responseTransforms = responseTransforms; this.application = application; this.configuration = configuration; this.requireAuth = requireAuth; @@ -77,6 +86,16 @@ public Optional getResponseTransform() { return responseTransform; } + @JsonProperty("request_transforms") + public Optional> getRequestTransforms() { + return requestTransforms; + } + + @JsonProperty("response_transforms") + public Optional> getResponseTransforms() { + return responseTransforms; + } + @JsonProperty("application") public Optional getApplication() { return application; @@ -108,6 +127,8 @@ private boolean equalTo(PatchProxyRequest other) { && destinationUrl.equals(other.destinationUrl) && requestTransform.equals(other.requestTransform) && responseTransform.equals(other.responseTransform) + && requestTransforms.equals(other.requestTransforms) + && responseTransforms.equals(other.responseTransforms) && application.equals(other.application) && configuration.equals(other.configuration) && requireAuth.equals(other.requireAuth); @@ -120,6 +141,8 @@ public int hashCode() { this.destinationUrl, this.requestTransform, this.responseTransform, + this.requestTransforms, + this.responseTransforms, this.application, this.configuration, this.requireAuth); @@ -144,6 +167,10 @@ public static final class Builder { private Optional responseTransform = Optional.empty(); + private Optional> requestTransforms = Optional.empty(); + + private Optional> responseTransforms = Optional.empty(); + private Optional application = Optional.empty(); private Optional>> configuration = Optional.empty(); @@ -160,6 +187,8 @@ public Builder from(PatchProxyRequest other) { destinationUrl(other.getDestinationUrl()); requestTransform(other.getRequestTransform()); responseTransform(other.getResponseTransform()); + requestTransforms(other.getRequestTransforms()); + responseTransforms(other.getResponseTransforms()); application(other.getApplication()); configuration(other.getConfiguration()); requireAuth(other.getRequireAuth()); @@ -210,6 +239,28 @@ public Builder responseTransform(ProxyTransform responseTransform) { return this; } + @JsonSetter(value = "request_transforms", nulls = Nulls.SKIP) + public Builder requestTransforms(Optional> requestTransforms) { + this.requestTransforms = requestTransforms; + return this; + } + + public Builder requestTransforms(List requestTransforms) { + this.requestTransforms = Optional.ofNullable(requestTransforms); + return this; + } + + @JsonSetter(value = "response_transforms", nulls = Nulls.SKIP) + public Builder responseTransforms(Optional> responseTransforms) { + this.responseTransforms = responseTransforms; + return this; + } + + public Builder responseTransforms(List responseTransforms) { + this.responseTransforms = Optional.ofNullable(responseTransforms); + return this; + } + @JsonSetter(value = "application", nulls = Nulls.SKIP) public Builder application(Optional application) { this.application = application; @@ -249,6 +300,8 @@ public PatchProxyRequest build() { destinationUrl, requestTransform, responseTransform, + requestTransforms, + responseTransforms, application, configuration, requireAuth, diff --git a/src/main/java/com/basistheory/resources/proxies/requests/UpdateProxyRequest.java b/src/main/java/com/basistheory/resources/proxies/requests/UpdateProxyRequest.java index 617c8cf..eb7a4c1 100644 --- a/src/main/java/com/basistheory/resources/proxies/requests/UpdateProxyRequest.java +++ b/src/main/java/com/basistheory/resources/proxies/requests/UpdateProxyRequest.java @@ -15,6 +15,7 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Optional; @@ -35,6 +36,10 @@ public final class UpdateProxyRequest { private final Optional responseTransform; + private final Optional> requestTransforms; + + private final Optional> responseTransforms; + private final Optional application; private final Optional>> configuration; @@ -50,6 +55,8 @@ private UpdateProxyRequest( Optional responseReactorId, Optional requestTransform, Optional responseTransform, + Optional> requestTransforms, + Optional> responseTransforms, Optional application, Optional>> configuration, Optional requireAuth, @@ -60,6 +67,8 @@ private UpdateProxyRequest( this.responseReactorId = responseReactorId; this.requestTransform = requestTransform; this.responseTransform = responseTransform; + this.requestTransforms = requestTransforms; + this.responseTransforms = responseTransforms; this.application = application; this.configuration = configuration; this.requireAuth = requireAuth; @@ -96,6 +105,16 @@ public Optional getResponseTransform() { return responseTransform; } + @JsonProperty("request_transforms") + public Optional> getRequestTransforms() { + return requestTransforms; + } + + @JsonProperty("response_transforms") + public Optional> getResponseTransforms() { + return responseTransforms; + } + @JsonProperty("application") public Optional getApplication() { return application; @@ -129,6 +148,8 @@ private boolean equalTo(UpdateProxyRequest other) { && responseReactorId.equals(other.responseReactorId) && requestTransform.equals(other.requestTransform) && responseTransform.equals(other.responseTransform) + && requestTransforms.equals(other.requestTransforms) + && responseTransforms.equals(other.responseTransforms) && application.equals(other.application) && configuration.equals(other.configuration) && requireAuth.equals(other.requireAuth); @@ -143,6 +164,8 @@ public int hashCode() { this.responseReactorId, this.requestTransform, this.responseTransform, + this.requestTransforms, + this.responseTransforms, this.application, this.configuration, this.requireAuth); @@ -186,6 +209,14 @@ public interface _FinalStage { _FinalStage responseTransform(ProxyTransform responseTransform); + _FinalStage requestTransforms(Optional> requestTransforms); + + _FinalStage requestTransforms(List requestTransforms); + + _FinalStage responseTransforms(Optional> responseTransforms); + + _FinalStage responseTransforms(List responseTransforms); + _FinalStage application(Optional application); _FinalStage application(Application application); @@ -211,6 +242,10 @@ public static final class Builder implements NameStage, DestinationUrlStage, _Fi private Optional application = Optional.empty(); + private Optional> responseTransforms = Optional.empty(); + + private Optional> requestTransforms = Optional.empty(); + private Optional responseTransform = Optional.empty(); private Optional requestTransform = Optional.empty(); @@ -232,6 +267,8 @@ public Builder from(UpdateProxyRequest other) { responseReactorId(other.getResponseReactorId()); requestTransform(other.getRequestTransform()); responseTransform(other.getResponseTransform()); + requestTransforms(other.getRequestTransforms()); + responseTransforms(other.getResponseTransforms()); application(other.getApplication()); configuration(other.getConfiguration()); requireAuth(other.getRequireAuth()); @@ -291,6 +328,32 @@ public _FinalStage application(Optional application) { return this; } + @java.lang.Override + public _FinalStage responseTransforms(List responseTransforms) { + this.responseTransforms = Optional.ofNullable(responseTransforms); + return this; + } + + @java.lang.Override + @JsonSetter(value = "response_transforms", nulls = Nulls.SKIP) + public _FinalStage responseTransforms(Optional> responseTransforms) { + this.responseTransforms = responseTransforms; + return this; + } + + @java.lang.Override + public _FinalStage requestTransforms(List requestTransforms) { + this.requestTransforms = Optional.ofNullable(requestTransforms); + return this; + } + + @java.lang.Override + @JsonSetter(value = "request_transforms", nulls = Nulls.SKIP) + public _FinalStage requestTransforms(Optional> requestTransforms) { + this.requestTransforms = requestTransforms; + return this; + } + @java.lang.Override public _FinalStage responseTransform(ProxyTransform responseTransform) { this.responseTransform = Optional.ofNullable(responseTransform); @@ -352,6 +415,8 @@ public UpdateProxyRequest build() { responseReactorId, requestTransform, responseTransform, + requestTransforms, + responseTransforms, application, configuration, requireAuth, diff --git a/src/main/java/com/basistheory/resources/tokens/AsyncRawTokensClient.java b/src/main/java/com/basistheory/resources/tokens/AsyncRawTokensClient.java index 316f3d8..430a38e 100644 --- a/src/main/java/com/basistheory/resources/tokens/AsyncRawTokensClient.java +++ b/src/main/java/com/basistheory/resources/tokens/AsyncRawTokensClient.java @@ -18,11 +18,11 @@ import com.basistheory.errors.ForbiddenError; import com.basistheory.errors.NotFoundError; import com.basistheory.errors.UnauthorizedError; -import com.basistheory.resources.tokens.requests.CreateTokenRequest; import com.basistheory.resources.tokens.requests.SearchTokensRequestV2; import com.basistheory.resources.tokens.requests.TokensListRequest; import com.basistheory.resources.tokens.requests.TokensListV2Request; import com.basistheory.resources.tokens.requests.UpdateTokenRequest; +import com.basistheory.types.CreateTokenRequest; import com.basistheory.types.CursorPagination; import com.basistheory.types.ProblemDetails; import com.basistheory.types.Token; diff --git a/src/main/java/com/basistheory/resources/tokens/AsyncTokensClient.java b/src/main/java/com/basistheory/resources/tokens/AsyncTokensClient.java index df4e857..2481115 100644 --- a/src/main/java/com/basistheory/resources/tokens/AsyncTokensClient.java +++ b/src/main/java/com/basistheory/resources/tokens/AsyncTokensClient.java @@ -7,11 +7,11 @@ import com.basistheory.core.IdempotentRequestOptions; import com.basistheory.core.RequestOptions; import com.basistheory.core.pagination.SyncPagingIterable; -import com.basistheory.resources.tokens.requests.CreateTokenRequest; import com.basistheory.resources.tokens.requests.SearchTokensRequestV2; import com.basistheory.resources.tokens.requests.TokensListRequest; import com.basistheory.resources.tokens.requests.TokensListV2Request; import com.basistheory.resources.tokens.requests.UpdateTokenRequest; +import com.basistheory.types.CreateTokenRequest; import com.basistheory.types.Token; import java.util.concurrent.CompletableFuture; diff --git a/src/main/java/com/basistheory/resources/tokens/RawTokensClient.java b/src/main/java/com/basistheory/resources/tokens/RawTokensClient.java index 2d778ec..7caad00 100644 --- a/src/main/java/com/basistheory/resources/tokens/RawTokensClient.java +++ b/src/main/java/com/basistheory/resources/tokens/RawTokensClient.java @@ -18,11 +18,11 @@ import com.basistheory.errors.ForbiddenError; import com.basistheory.errors.NotFoundError; import com.basistheory.errors.UnauthorizedError; -import com.basistheory.resources.tokens.requests.CreateTokenRequest; import com.basistheory.resources.tokens.requests.SearchTokensRequestV2; import com.basistheory.resources.tokens.requests.TokensListRequest; import com.basistheory.resources.tokens.requests.TokensListV2Request; import com.basistheory.resources.tokens.requests.UpdateTokenRequest; +import com.basistheory.types.CreateTokenRequest; import com.basistheory.types.CursorPagination; import com.basistheory.types.ProblemDetails; import com.basistheory.types.Token; diff --git a/src/main/java/com/basistheory/resources/tokens/TokensClient.java b/src/main/java/com/basistheory/resources/tokens/TokensClient.java index 56abc4b..73ac9a1 100644 --- a/src/main/java/com/basistheory/resources/tokens/TokensClient.java +++ b/src/main/java/com/basistheory/resources/tokens/TokensClient.java @@ -7,11 +7,11 @@ import com.basistheory.core.IdempotentRequestOptions; import com.basistheory.core.RequestOptions; import com.basistheory.core.pagination.SyncPagingIterable; -import com.basistheory.resources.tokens.requests.CreateTokenRequest; import com.basistheory.resources.tokens.requests.SearchTokensRequestV2; import com.basistheory.resources.tokens.requests.TokensListRequest; import com.basistheory.resources.tokens.requests.TokensListV2Request; import com.basistheory.resources.tokens.requests.UpdateTokenRequest; +import com.basistheory.types.CreateTokenRequest; import com.basistheory.types.Token; public class TokensClient { diff --git a/src/main/java/com/basistheory/types/AdditionalCardDetail.java b/src/main/java/com/basistheory/types/AdditionalCardDetail.java new file mode 100644 index 0000000..ef05a73 --- /dev/null +++ b/src/main/java/com/basistheory/types/AdditionalCardDetail.java @@ -0,0 +1,169 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.basistheory.types; + +import com.basistheory.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdditionalCardDetail.Builder.class) +public final class AdditionalCardDetail { + private final Optional brand; + + private final Optional funding; + + private final Optional segment; + + private final Optional issuer; + + private final Map additionalProperties; + + private AdditionalCardDetail( + Optional brand, + Optional funding, + Optional segment, + Optional issuer, + Map additionalProperties) { + this.brand = brand; + this.funding = funding; + this.segment = segment; + this.issuer = issuer; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("brand") + public Optional getBrand() { + return brand; + } + + @JsonProperty("funding") + public Optional getFunding() { + return funding; + } + + @JsonProperty("segment") + public Optional getSegment() { + return segment; + } + + @JsonProperty("issuer") + public Optional getIssuer() { + return issuer; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdditionalCardDetail && equalTo((AdditionalCardDetail) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdditionalCardDetail other) { + return brand.equals(other.brand) + && funding.equals(other.funding) + && segment.equals(other.segment) + && issuer.equals(other.issuer); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.brand, this.funding, this.segment, this.issuer); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional brand = Optional.empty(); + + private Optional funding = Optional.empty(); + + private Optional segment = Optional.empty(); + + private Optional issuer = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AdditionalCardDetail other) { + brand(other.getBrand()); + funding(other.getFunding()); + segment(other.getSegment()); + issuer(other.getIssuer()); + return this; + } + + @JsonSetter(value = "brand", nulls = Nulls.SKIP) + public Builder brand(Optional brand) { + this.brand = brand; + return this; + } + + public Builder brand(String brand) { + this.brand = Optional.ofNullable(brand); + return this; + } + + @JsonSetter(value = "funding", nulls = Nulls.SKIP) + public Builder funding(Optional funding) { + this.funding = funding; + return this; + } + + public Builder funding(String funding) { + this.funding = Optional.ofNullable(funding); + return this; + } + + @JsonSetter(value = "segment", nulls = Nulls.SKIP) + public Builder segment(Optional segment) { + this.segment = segment; + return this; + } + + public Builder segment(String segment) { + this.segment = Optional.ofNullable(segment); + return this; + } + + @JsonSetter(value = "issuer", nulls = Nulls.SKIP) + public Builder issuer(Optional issuer) { + this.issuer = issuer; + return this; + } + + public Builder issuer(CardIssuerDetails issuer) { + this.issuer = Optional.ofNullable(issuer); + return this; + } + + public AdditionalCardDetail build() { + return new AdditionalCardDetail(brand, funding, segment, issuer, additionalProperties); + } + } +} diff --git a/src/main/java/com/basistheory/resources/connection/applepay/requests/ApplePayTokenizeRequest.java b/src/main/java/com/basistheory/types/ApplePayTokenizeRequest.java similarity index 96% rename from src/main/java/com/basistheory/resources/connection/applepay/requests/ApplePayTokenizeRequest.java rename to src/main/java/com/basistheory/types/ApplePayTokenizeRequest.java index 39ce449..26917b0 100644 --- a/src/main/java/com/basistheory/resources/connection/applepay/requests/ApplePayTokenizeRequest.java +++ b/src/main/java/com/basistheory/types/ApplePayTokenizeRequest.java @@ -1,10 +1,9 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.basistheory.resources.connection.applepay.requests; +package com.basistheory.types; import com.basistheory.core.ObjectMappers; -import com.basistheory.types.ApplePayMethodToken; import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; diff --git a/src/main/java/com/basistheory/types/CardDetailsResponse.java b/src/main/java/com/basistheory/types/CardDetailsResponse.java new file mode 100644 index 0000000..61011eb --- /dev/null +++ b/src/main/java/com/basistheory/types/CardDetailsResponse.java @@ -0,0 +1,194 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.basistheory.types; + +import com.basistheory.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CardDetailsResponse.Builder.class) +public final class CardDetailsResponse { + private final Optional brand; + + private final Optional funding; + + private final Optional segment; + + private final Optional issuer; + + private final Optional> additional; + + private final Map additionalProperties; + + private CardDetailsResponse( + Optional brand, + Optional funding, + Optional segment, + Optional issuer, + Optional> additional, + Map additionalProperties) { + this.brand = brand; + this.funding = funding; + this.segment = segment; + this.issuer = issuer; + this.additional = additional; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("brand") + public Optional getBrand() { + return brand; + } + + @JsonProperty("funding") + public Optional getFunding() { + return funding; + } + + @JsonProperty("segment") + public Optional getSegment() { + return segment; + } + + @JsonProperty("issuer") + public Optional getIssuer() { + return issuer; + } + + @JsonProperty("additional") + public Optional> getAdditional() { + return additional; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CardDetailsResponse && equalTo((CardDetailsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CardDetailsResponse other) { + return brand.equals(other.brand) + && funding.equals(other.funding) + && segment.equals(other.segment) + && issuer.equals(other.issuer) + && additional.equals(other.additional); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.brand, this.funding, this.segment, this.issuer, this.additional); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional brand = Optional.empty(); + + private Optional funding = Optional.empty(); + + private Optional segment = Optional.empty(); + + private Optional issuer = Optional.empty(); + + private Optional> additional = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CardDetailsResponse other) { + brand(other.getBrand()); + funding(other.getFunding()); + segment(other.getSegment()); + issuer(other.getIssuer()); + additional(other.getAdditional()); + return this; + } + + @JsonSetter(value = "brand", nulls = Nulls.SKIP) + public Builder brand(Optional brand) { + this.brand = brand; + return this; + } + + public Builder brand(String brand) { + this.brand = Optional.ofNullable(brand); + return this; + } + + @JsonSetter(value = "funding", nulls = Nulls.SKIP) + public Builder funding(Optional funding) { + this.funding = funding; + return this; + } + + public Builder funding(String funding) { + this.funding = Optional.ofNullable(funding); + return this; + } + + @JsonSetter(value = "segment", nulls = Nulls.SKIP) + public Builder segment(Optional segment) { + this.segment = segment; + return this; + } + + public Builder segment(String segment) { + this.segment = Optional.ofNullable(segment); + return this; + } + + @JsonSetter(value = "issuer", nulls = Nulls.SKIP) + public Builder issuer(Optional issuer) { + this.issuer = issuer; + return this; + } + + public Builder issuer(CardIssuerDetails issuer) { + this.issuer = Optional.ofNullable(issuer); + return this; + } + + @JsonSetter(value = "additional", nulls = Nulls.SKIP) + public Builder additional(Optional> additional) { + this.additional = additional; + return this; + } + + public Builder additional(List additional) { + this.additional = Optional.ofNullable(additional); + return this; + } + + public CardDetailsResponse build() { + return new CardDetailsResponse(brand, funding, segment, issuer, additional, additionalProperties); + } + } +} diff --git a/src/main/java/com/basistheory/types/CardIssuerDetails.java b/src/main/java/com/basistheory/types/CardIssuerDetails.java new file mode 100644 index 0000000..3279d67 --- /dev/null +++ b/src/main/java/com/basistheory/types/CardIssuerDetails.java @@ -0,0 +1,118 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.basistheory.types; + +import com.basistheory.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CardIssuerDetails.Builder.class) +public final class CardIssuerDetails { + private final Optional country; + + private final Optional name; + + private final Map additionalProperties; + + private CardIssuerDetails( + Optional country, Optional name, Map additionalProperties) { + this.country = country; + this.name = name; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("country") + public Optional getCountry() { + return country; + } + + @JsonProperty("name") + public Optional getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CardIssuerDetails && equalTo((CardIssuerDetails) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CardIssuerDetails other) { + return country.equals(other.country) && name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.country, this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional country = Optional.empty(); + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CardIssuerDetails other) { + country(other.getCountry()); + name(other.getName()); + return this; + } + + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + public CardIssuerDetails build() { + return new CardIssuerDetails(country, name, additionalProperties); + } + } +} diff --git a/src/main/java/com/basistheory/resources/tokens/requests/CreateTokenRequest.java b/src/main/java/com/basistheory/types/CreateTokenRequest.java similarity index 99% rename from src/main/java/com/basistheory/resources/tokens/requests/CreateTokenRequest.java rename to src/main/java/com/basistheory/types/CreateTokenRequest.java index 9695481..a4a0ead 100644 --- a/src/main/java/com/basistheory/resources/tokens/requests/CreateTokenRequest.java +++ b/src/main/java/com/basistheory/types/CreateTokenRequest.java @@ -1,10 +1,9 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.basistheory.resources.tokens.requests; +package com.basistheory.types; import com.basistheory.core.ObjectMappers; -import com.basistheory.types.Privacy; import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; diff --git a/src/main/java/com/basistheory/types/GooglePayCreateResponse.java b/src/main/java/com/basistheory/types/GooglePayCreateResponse.java new file mode 100644 index 0000000..92d5021 --- /dev/null +++ b/src/main/java/com/basistheory/types/GooglePayCreateResponse.java @@ -0,0 +1,120 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.basistheory.types; + +import com.basistheory.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GooglePayCreateResponse.Builder.class) +public final class GooglePayCreateResponse { + private final Optional googlePay; + + private final Optional tokenIntent; + + private final Map additionalProperties; + + private GooglePayCreateResponse( + Optional googlePay, + Optional tokenIntent, + Map additionalProperties) { + this.googlePay = googlePay; + this.tokenIntent = tokenIntent; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("google_pay") + public Optional getGooglePay() { + return googlePay; + } + + @JsonProperty("token_intent") + public Optional getTokenIntent() { + return tokenIntent; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GooglePayCreateResponse && equalTo((GooglePayCreateResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GooglePayCreateResponse other) { + return googlePay.equals(other.googlePay) && tokenIntent.equals(other.tokenIntent); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.googlePay, this.tokenIntent); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional googlePay = Optional.empty(); + + private Optional tokenIntent = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(GooglePayCreateResponse other) { + googlePay(other.getGooglePay()); + tokenIntent(other.getTokenIntent()); + return this; + } + + @JsonSetter(value = "google_pay", nulls = Nulls.SKIP) + public Builder googlePay(Optional googlePay) { + this.googlePay = googlePay; + return this; + } + + public Builder googlePay(GooglePayCreateTokenResponse googlePay) { + this.googlePay = Optional.ofNullable(googlePay); + return this; + } + + @JsonSetter(value = "token_intent", nulls = Nulls.SKIP) + public Builder tokenIntent(Optional tokenIntent) { + this.tokenIntent = tokenIntent; + return this; + } + + public Builder tokenIntent(CreateTokenIntentResponse tokenIntent) { + this.tokenIntent = Optional.ofNullable(tokenIntent); + return this; + } + + public GooglePayCreateResponse build() { + return new GooglePayCreateResponse(googlePay, tokenIntent, additionalProperties); + } + } +} diff --git a/src/main/java/com/basistheory/types/GooglePayCreateTokenResponse.java b/src/main/java/com/basistheory/types/GooglePayCreateTokenResponse.java new file mode 100644 index 0000000..1b358ea --- /dev/null +++ b/src/main/java/com/basistheory/types/GooglePayCreateTokenResponse.java @@ -0,0 +1,275 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.basistheory.types; + +import com.basistheory.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GooglePayCreateTokenResponse.Builder.class) +public final class GooglePayCreateTokenResponse { + private final Optional id; + + private final Optional tenantId; + + private final Optional status; + + private final Optional expiresAt; + + private final Optional createdBy; + + private final Optional createdAt; + + private final Optional card; + + private final Optional details; + + private final Map additionalProperties; + + private GooglePayCreateTokenResponse( + Optional id, + Optional tenantId, + Optional status, + Optional expiresAt, + Optional createdBy, + Optional createdAt, + Optional card, + Optional details, + Map additionalProperties) { + this.id = id; + this.tenantId = tenantId; + this.status = status; + this.expiresAt = expiresAt; + this.createdBy = createdBy; + this.createdAt = createdAt; + this.card = card; + this.details = details; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public Optional getId() { + return id; + } + + @JsonProperty("tenant_id") + public Optional getTenantId() { + return tenantId; + } + + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + @JsonProperty("expires_at") + public Optional getExpiresAt() { + return expiresAt; + } + + @JsonProperty("created_by") + public Optional getCreatedBy() { + return createdBy; + } + + @JsonProperty("created_at") + public Optional getCreatedAt() { + return createdAt; + } + + @JsonProperty("card") + public Optional getCard() { + return card; + } + + @JsonProperty("details") + public Optional getDetails() { + return details; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GooglePayCreateTokenResponse && equalTo((GooglePayCreateTokenResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GooglePayCreateTokenResponse other) { + return id.equals(other.id) + && tenantId.equals(other.tenantId) + && status.equals(other.status) + && expiresAt.equals(other.expiresAt) + && createdBy.equals(other.createdBy) + && createdAt.equals(other.createdAt) + && card.equals(other.card) + && details.equals(other.details); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.id, + this.tenantId, + this.status, + this.expiresAt, + this.createdBy, + this.createdAt, + this.card, + this.details); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional id = Optional.empty(); + + private Optional tenantId = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional expiresAt = Optional.empty(); + + private Optional createdBy = Optional.empty(); + + private Optional createdAt = Optional.empty(); + + private Optional card = Optional.empty(); + + private Optional details = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(GooglePayCreateTokenResponse other) { + id(other.getId()); + tenantId(other.getTenantId()); + status(other.getStatus()); + expiresAt(other.getExpiresAt()); + createdBy(other.getCreatedBy()); + createdAt(other.getCreatedAt()); + card(other.getCard()); + details(other.getDetails()); + return this; + } + + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + @JsonSetter(value = "tenant_id", nulls = Nulls.SKIP) + public Builder tenantId(Optional tenantId) { + this.tenantId = tenantId; + return this; + } + + public Builder tenantId(String tenantId) { + this.tenantId = Optional.ofNullable(tenantId); + return this; + } + + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(String status) { + this.status = Optional.ofNullable(status); + return this; + } + + @JsonSetter(value = "expires_at", nulls = Nulls.SKIP) + public Builder expiresAt(Optional expiresAt) { + this.expiresAt = expiresAt; + return this; + } + + public Builder expiresAt(OffsetDateTime expiresAt) { + this.expiresAt = Optional.ofNullable(expiresAt); + return this; + } + + @JsonSetter(value = "created_by", nulls = Nulls.SKIP) + public Builder createdBy(Optional createdBy) { + this.createdBy = createdBy; + return this; + } + + public Builder createdBy(String createdBy) { + this.createdBy = Optional.ofNullable(createdBy); + return this; + } + + @JsonSetter(value = "created_at", nulls = Nulls.SKIP) + public Builder createdAt(Optional createdAt) { + this.createdAt = createdAt; + return this; + } + + public Builder createdAt(OffsetDateTime createdAt) { + this.createdAt = Optional.ofNullable(createdAt); + return this; + } + + @JsonSetter(value = "card", nulls = Nulls.SKIP) + public Builder card(Optional card) { + this.card = card; + return this; + } + + public Builder card(CardDetails card) { + this.card = Optional.ofNullable(card); + return this; + } + + @JsonSetter(value = "details", nulls = Nulls.SKIP) + public Builder details(Optional details) { + this.details = details; + return this; + } + + public Builder details(TokenServiceProviderDetails details) { + this.details = Optional.ofNullable(details); + return this; + } + + public GooglePayCreateTokenResponse build() { + return new GooglePayCreateTokenResponse( + id, tenantId, status, expiresAt, createdBy, createdAt, card, details, additionalProperties); + } + } +} diff --git a/src/main/java/com/basistheory/types/GooglePaymentMethodToken.java b/src/main/java/com/basistheory/types/GooglePayMethodToken.java similarity index 91% rename from src/main/java/com/basistheory/types/GooglePaymentMethodToken.java rename to src/main/java/com/basistheory/types/GooglePayMethodToken.java index 8c00d02..afe416e 100644 --- a/src/main/java/com/basistheory/types/GooglePaymentMethodToken.java +++ b/src/main/java/com/basistheory/types/GooglePayMethodToken.java @@ -18,8 +18,8 @@ import java.util.Optional; @JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = GooglePaymentMethodToken.Builder.class) -public final class GooglePaymentMethodToken { +@JsonDeserialize(builder = GooglePayMethodToken.Builder.class) +public final class GooglePayMethodToken { private final Optional protocolVersion; private final Optional signature; @@ -30,7 +30,7 @@ public final class GooglePaymentMethodToken { private final Map additionalProperties; - private GooglePaymentMethodToken( + private GooglePayMethodToken( Optional protocolVersion, Optional signature, Optional intermediateSigningKey, @@ -66,7 +66,7 @@ public Optional getSignedMessage() { @java.lang.Override public boolean equals(Object other) { if (this == other) return true; - return other instanceof GooglePaymentMethodToken && equalTo((GooglePaymentMethodToken) other); + return other instanceof GooglePayMethodToken && equalTo((GooglePayMethodToken) other); } @JsonAnyGetter @@ -74,7 +74,7 @@ public Map getAdditionalProperties() { return this.additionalProperties; } - private boolean equalTo(GooglePaymentMethodToken other) { + private boolean equalTo(GooglePayMethodToken other) { return protocolVersion.equals(other.protocolVersion) && signature.equals(other.signature) && intermediateSigningKey.equals(other.intermediateSigningKey) @@ -110,7 +110,7 @@ public static final class Builder { private Builder() {} - public Builder from(GooglePaymentMethodToken other) { + public Builder from(GooglePayMethodToken other) { protocolVersion(other.getProtocolVersion()); signature(other.getSignature()); intermediateSigningKey(other.getIntermediateSigningKey()); @@ -162,8 +162,8 @@ public Builder signedMessage(String signedMessage) { return this; } - public GooglePaymentMethodToken build() { - return new GooglePaymentMethodToken( + public GooglePayMethodToken build() { + return new GooglePayMethodToken( protocolVersion, signature, intermediateSigningKey, signedMessage, additionalProperties); } } diff --git a/src/main/java/com/basistheory/types/GooglePayToken.java b/src/main/java/com/basistheory/types/GooglePayToken.java new file mode 100644 index 0000000..124c46c --- /dev/null +++ b/src/main/java/com/basistheory/types/GooglePayToken.java @@ -0,0 +1,387 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.basistheory.types; + +import com.basistheory.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GooglePayToken.Builder.class) +public final class GooglePayToken { + private final Optional id; + + private final Optional tenantId; + + private final Optional status; + + private final Optional expiresAt; + + private final Optional createdBy; + + private final Optional createdAt; + + private final Optional modifiedBy; + + private final Optional modifiedAt; + + private final Optional card; + + private final Optional data; + + private final Optional authentication; + + private final Optional details; + + private final Map additionalProperties; + + private GooglePayToken( + Optional id, + Optional tenantId, + Optional status, + Optional expiresAt, + Optional createdBy, + Optional createdAt, + Optional modifiedBy, + Optional modifiedAt, + Optional card, + Optional data, + Optional authentication, + Optional details, + Map additionalProperties) { + this.id = id; + this.tenantId = tenantId; + this.status = status; + this.expiresAt = expiresAt; + this.createdBy = createdBy; + this.createdAt = createdAt; + this.modifiedBy = modifiedBy; + this.modifiedAt = modifiedAt; + this.card = card; + this.data = data; + this.authentication = authentication; + this.details = details; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public Optional getId() { + return id; + } + + @JsonProperty("tenant_id") + public Optional getTenantId() { + return tenantId; + } + + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + @JsonProperty("expires_at") + public Optional getExpiresAt() { + return expiresAt; + } + + @JsonProperty("created_by") + public Optional getCreatedBy() { + return createdBy; + } + + @JsonProperty("created_at") + public Optional getCreatedAt() { + return createdAt; + } + + @JsonProperty("modified_by") + public Optional getModifiedBy() { + return modifiedBy; + } + + @JsonProperty("modified_at") + public Optional getModifiedAt() { + return modifiedAt; + } + + @JsonProperty("card") + public Optional getCard() { + return card; + } + + @JsonProperty("data") + public Optional getData() { + return data; + } + + @JsonProperty("authentication") + public Optional getAuthentication() { + return authentication; + } + + @JsonProperty("details") + public Optional getDetails() { + return details; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GooglePayToken && equalTo((GooglePayToken) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GooglePayToken other) { + return id.equals(other.id) + && tenantId.equals(other.tenantId) + && status.equals(other.status) + && expiresAt.equals(other.expiresAt) + && createdBy.equals(other.createdBy) + && createdAt.equals(other.createdAt) + && modifiedBy.equals(other.modifiedBy) + && modifiedAt.equals(other.modifiedAt) + && card.equals(other.card) + && data.equals(other.data) + && authentication.equals(other.authentication) + && details.equals(other.details); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.id, + this.tenantId, + this.status, + this.expiresAt, + this.createdBy, + this.createdAt, + this.modifiedBy, + this.modifiedAt, + this.card, + this.data, + this.authentication, + this.details); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional id = Optional.empty(); + + private Optional tenantId = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional expiresAt = Optional.empty(); + + private Optional createdBy = Optional.empty(); + + private Optional createdAt = Optional.empty(); + + private Optional modifiedBy = Optional.empty(); + + private Optional modifiedAt = Optional.empty(); + + private Optional card = Optional.empty(); + + private Optional data = Optional.empty(); + + private Optional authentication = Optional.empty(); + + private Optional details = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(GooglePayToken other) { + id(other.getId()); + tenantId(other.getTenantId()); + status(other.getStatus()); + expiresAt(other.getExpiresAt()); + createdBy(other.getCreatedBy()); + createdAt(other.getCreatedAt()); + modifiedBy(other.getModifiedBy()); + modifiedAt(other.getModifiedAt()); + card(other.getCard()); + data(other.getData()); + authentication(other.getAuthentication()); + details(other.getDetails()); + return this; + } + + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + @JsonSetter(value = "tenant_id", nulls = Nulls.SKIP) + public Builder tenantId(Optional tenantId) { + this.tenantId = tenantId; + return this; + } + + public Builder tenantId(String tenantId) { + this.tenantId = Optional.ofNullable(tenantId); + return this; + } + + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(String status) { + this.status = Optional.ofNullable(status); + return this; + } + + @JsonSetter(value = "expires_at", nulls = Nulls.SKIP) + public Builder expiresAt(Optional expiresAt) { + this.expiresAt = expiresAt; + return this; + } + + public Builder expiresAt(OffsetDateTime expiresAt) { + this.expiresAt = Optional.ofNullable(expiresAt); + return this; + } + + @JsonSetter(value = "created_by", nulls = Nulls.SKIP) + public Builder createdBy(Optional createdBy) { + this.createdBy = createdBy; + return this; + } + + public Builder createdBy(String createdBy) { + this.createdBy = Optional.ofNullable(createdBy); + return this; + } + + @JsonSetter(value = "created_at", nulls = Nulls.SKIP) + public Builder createdAt(Optional createdAt) { + this.createdAt = createdAt; + return this; + } + + public Builder createdAt(OffsetDateTime createdAt) { + this.createdAt = Optional.ofNullable(createdAt); + return this; + } + + @JsonSetter(value = "modified_by", nulls = Nulls.SKIP) + public Builder modifiedBy(Optional modifiedBy) { + this.modifiedBy = modifiedBy; + return this; + } + + public Builder modifiedBy(String modifiedBy) { + this.modifiedBy = Optional.ofNullable(modifiedBy); + return this; + } + + @JsonSetter(value = "modified_at", nulls = Nulls.SKIP) + public Builder modifiedAt(Optional modifiedAt) { + this.modifiedAt = modifiedAt; + return this; + } + + public Builder modifiedAt(OffsetDateTime modifiedAt) { + this.modifiedAt = Optional.ofNullable(modifiedAt); + return this; + } + + @JsonSetter(value = "card", nulls = Nulls.SKIP) + public Builder card(Optional card) { + this.card = card; + return this; + } + + public Builder card(CardDetails card) { + this.card = Optional.ofNullable(card); + return this; + } + + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public Builder data(Optional data) { + this.data = data; + return this; + } + + public Builder data(Object data) { + this.data = Optional.ofNullable(data); + return this; + } + + @JsonSetter(value = "authentication", nulls = Nulls.SKIP) + public Builder authentication(Optional authentication) { + this.authentication = authentication; + return this; + } + + public Builder authentication(TokenAuthentication authentication) { + this.authentication = Optional.ofNullable(authentication); + return this; + } + + @JsonSetter(value = "details", nulls = Nulls.SKIP) + public Builder details(Optional details) { + this.details = details; + return this; + } + + public Builder details(TokenServiceProviderDetails details) { + this.details = Optional.ofNullable(details); + return this; + } + + public GooglePayToken build() { + return new GooglePayToken( + id, + tenantId, + status, + expiresAt, + createdBy, + createdAt, + modifiedBy, + modifiedAt, + card, + data, + authentication, + details, + additionalProperties); + } + } +} diff --git a/src/main/java/com/basistheory/resources/googlepay/requests/GooglePayTokenizeRequest.java b/src/main/java/com/basistheory/types/GooglePayTokenizeRequest.java similarity index 82% rename from src/main/java/com/basistheory/resources/googlepay/requests/GooglePayTokenizeRequest.java rename to src/main/java/com/basistheory/types/GooglePayTokenizeRequest.java index 97c00c9..ef7340d 100644 --- a/src/main/java/com/basistheory/resources/googlepay/requests/GooglePayTokenizeRequest.java +++ b/src/main/java/com/basistheory/types/GooglePayTokenizeRequest.java @@ -1,10 +1,9 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.basistheory.resources.googlepay.requests; +package com.basistheory.types; import com.basistheory.core.ObjectMappers; -import com.basistheory.types.GooglePaymentMethodToken; import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; @@ -21,18 +20,18 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = GooglePayTokenizeRequest.Builder.class) public final class GooglePayTokenizeRequest { - private final Optional googlePaymentMethodToken; + private final Optional googlePaymentMethodToken; private final Map additionalProperties; private GooglePayTokenizeRequest( - Optional googlePaymentMethodToken, Map additionalProperties) { + Optional googlePaymentMethodToken, Map additionalProperties) { this.googlePaymentMethodToken = googlePaymentMethodToken; this.additionalProperties = additionalProperties; } @JsonProperty("google_payment_method_token") - public Optional getGooglePaymentMethodToken() { + public Optional getGooglePaymentMethodToken() { return googlePaymentMethodToken; } @@ -67,7 +66,7 @@ public static Builder builder() { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder { - private Optional googlePaymentMethodToken = Optional.empty(); + private Optional googlePaymentMethodToken = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -80,12 +79,12 @@ public Builder from(GooglePayTokenizeRequest other) { } @JsonSetter(value = "google_payment_method_token", nulls = Nulls.SKIP) - public Builder googlePaymentMethodToken(Optional googlePaymentMethodToken) { + public Builder googlePaymentMethodToken(Optional googlePaymentMethodToken) { this.googlePaymentMethodToken = googlePaymentMethodToken; return this; } - public Builder googlePaymentMethodToken(GooglePaymentMethodToken googlePaymentMethodToken) { + public Builder googlePaymentMethodToken(GooglePayMethodToken googlePaymentMethodToken) { this.googlePaymentMethodToken = Optional.ofNullable(googlePaymentMethodToken); return this; } diff --git a/src/main/java/com/basistheory/types/Proxy.java b/src/main/java/com/basistheory/types/Proxy.java index 99a0e85..8606784 100644 --- a/src/main/java/com/basistheory/types/Proxy.java +++ b/src/main/java/com/basistheory/types/Proxy.java @@ -14,6 +14,7 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import java.time.OffsetDateTime; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Optional; @@ -41,6 +42,10 @@ public final class Proxy { private final Optional responseTransform; + private final Optional> requestTransforms; + + private final Optional> responseTransforms; + private final Optional applicationId; private final Optional>> configuration; @@ -72,6 +77,8 @@ private Proxy( Optional requireAuth, Optional requestTransform, Optional responseTransform, + Optional> requestTransforms, + Optional> responseTransforms, Optional applicationId, Optional>> configuration, Optional proxyHost, @@ -92,6 +99,8 @@ private Proxy( this.requireAuth = requireAuth; this.requestTransform = requestTransform; this.responseTransform = responseTransform; + this.requestTransforms = requestTransforms; + this.responseTransforms = responseTransforms; this.applicationId = applicationId; this.configuration = configuration; this.proxyHost = proxyHost; @@ -154,6 +163,16 @@ public Optional getResponseTransform() { return responseTransform; } + @JsonProperty("request_transforms") + public Optional> getRequestTransforms() { + return requestTransforms; + } + + @JsonProperty("response_transforms") + public Optional> getResponseTransforms() { + return responseTransforms; + } + @JsonProperty("application_id") public Optional getApplicationId() { return applicationId; @@ -221,6 +240,8 @@ private boolean equalTo(Proxy other) { && requireAuth.equals(other.requireAuth) && requestTransform.equals(other.requestTransform) && responseTransform.equals(other.responseTransform) + && requestTransforms.equals(other.requestTransforms) + && responseTransforms.equals(other.responseTransforms) && applicationId.equals(other.applicationId) && configuration.equals(other.configuration) && proxyHost.equals(other.proxyHost) @@ -245,6 +266,8 @@ public int hashCode() { this.requireAuth, this.requestTransform, this.responseTransform, + this.requestTransforms, + this.responseTransforms, this.applicationId, this.configuration, this.proxyHost, @@ -287,6 +310,10 @@ public static final class Builder { private Optional responseTransform = Optional.empty(); + private Optional> requestTransforms = Optional.empty(); + + private Optional> responseTransforms = Optional.empty(); + private Optional applicationId = Optional.empty(); private Optional>> configuration = Optional.empty(); @@ -321,6 +348,8 @@ public Builder from(Proxy other) { requireAuth(other.getRequireAuth()); requestTransform(other.getRequestTransform()); responseTransform(other.getResponseTransform()); + requestTransforms(other.getRequestTransforms()); + responseTransforms(other.getResponseTransforms()); applicationId(other.getApplicationId()); configuration(other.getConfiguration()); proxyHost(other.getProxyHost()); @@ -443,6 +472,28 @@ public Builder responseTransform(ProxyTransform responseTransform) { return this; } + @JsonSetter(value = "request_transforms", nulls = Nulls.SKIP) + public Builder requestTransforms(Optional> requestTransforms) { + this.requestTransforms = requestTransforms; + return this; + } + + public Builder requestTransforms(List requestTransforms) { + this.requestTransforms = Optional.ofNullable(requestTransforms); + return this; + } + + @JsonSetter(value = "response_transforms", nulls = Nulls.SKIP) + public Builder responseTransforms(Optional> responseTransforms) { + this.responseTransforms = responseTransforms; + return this; + } + + public Builder responseTransforms(List responseTransforms) { + this.responseTransforms = Optional.ofNullable(responseTransforms); + return this; + } + @JsonSetter(value = "application_id", nulls = Nulls.SKIP) public Builder applicationId(Optional applicationId) { this.applicationId = applicationId; @@ -554,6 +605,8 @@ public Proxy build() { requireAuth, requestTransform, responseTransform, + requestTransforms, + responseTransforms, applicationId, configuration, proxyHost, diff --git a/src/main/java/com/basistheory/types/ProxyTransform.java b/src/main/java/com/basistheory/types/ProxyTransform.java index 33c3883..5ed5ad7 100644 --- a/src/main/java/com/basistheory/types/ProxyTransform.java +++ b/src/main/java/com/basistheory/types/ProxyTransform.java @@ -30,6 +30,8 @@ public final class ProxyTransform { private final Optional replacement; + private final Optional options; + private final Map additionalProperties; private ProxyTransform( @@ -38,12 +40,14 @@ private ProxyTransform( Optional matcher, Optional expression, Optional replacement, + Optional options, Map additionalProperties) { this.type = type; this.code = code; this.matcher = matcher; this.expression = expression; this.replacement = replacement; + this.options = options; this.additionalProperties = additionalProperties; } @@ -72,6 +76,11 @@ public Optional getReplacement() { return replacement; } + @JsonProperty("options") + public Optional getOptions() { + return options; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -88,12 +97,13 @@ private boolean equalTo(ProxyTransform other) { && code.equals(other.code) && matcher.equals(other.matcher) && expression.equals(other.expression) - && replacement.equals(other.replacement); + && replacement.equals(other.replacement) + && options.equals(other.options); } @java.lang.Override public int hashCode() { - return Objects.hash(this.type, this.code, this.matcher, this.expression, this.replacement); + return Objects.hash(this.type, this.code, this.matcher, this.expression, this.replacement, this.options); } @java.lang.Override @@ -117,6 +127,8 @@ public static final class Builder { private Optional replacement = Optional.empty(); + private Optional options = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -128,6 +140,7 @@ public Builder from(ProxyTransform other) { matcher(other.getMatcher()); expression(other.getExpression()); replacement(other.getReplacement()); + options(other.getOptions()); return this; } @@ -186,8 +199,19 @@ public Builder replacement(String replacement) { return this; } + @JsonSetter(value = "options", nulls = Nulls.SKIP) + public Builder options(Optional options) { + this.options = options; + return this; + } + + public Builder options(ProxyTransformOptions options) { + this.options = Optional.ofNullable(options); + return this; + } + public ProxyTransform build() { - return new ProxyTransform(type, code, matcher, expression, replacement, additionalProperties); + return new ProxyTransform(type, code, matcher, expression, replacement, options, additionalProperties); } } } diff --git a/src/main/java/com/basistheory/types/ProxyTransformOptions.java b/src/main/java/com/basistheory/types/ProxyTransformOptions.java new file mode 100644 index 0000000..7095c44 --- /dev/null +++ b/src/main/java/com/basistheory/types/ProxyTransformOptions.java @@ -0,0 +1,169 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.basistheory.types; + +import com.basistheory.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ProxyTransformOptions.Builder.class) +public final class ProxyTransformOptions { + private final Optional token; + + private final Optional identifier; + + private final Optional value; + + private final Optional location; + + private final Map additionalProperties; + + private ProxyTransformOptions( + Optional token, + Optional identifier, + Optional value, + Optional location, + Map additionalProperties) { + this.token = token; + this.identifier = identifier; + this.value = value; + this.location = location; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("token") + public Optional getToken() { + return token; + } + + @JsonProperty("identifier") + public Optional getIdentifier() { + return identifier; + } + + @JsonProperty("value") + public Optional getValue() { + return value; + } + + @JsonProperty("location") + public Optional getLocation() { + return location; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ProxyTransformOptions && equalTo((ProxyTransformOptions) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ProxyTransformOptions other) { + return token.equals(other.token) + && identifier.equals(other.identifier) + && value.equals(other.value) + && location.equals(other.location); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.token, this.identifier, this.value, this.location); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional token = Optional.empty(); + + private Optional identifier = Optional.empty(); + + private Optional value = Optional.empty(); + + private Optional location = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ProxyTransformOptions other) { + token(other.getToken()); + identifier(other.getIdentifier()); + value(other.getValue()); + location(other.getLocation()); + return this; + } + + @JsonSetter(value = "token", nulls = Nulls.SKIP) + public Builder token(Optional token) { + this.token = token; + return this; + } + + public Builder token(CreateTokenRequest token) { + this.token = Optional.ofNullable(token); + return this; + } + + @JsonSetter(value = "identifier", nulls = Nulls.SKIP) + public Builder identifier(Optional identifier) { + this.identifier = identifier; + return this; + } + + public Builder identifier(String identifier) { + this.identifier = Optional.ofNullable(identifier); + return this; + } + + @JsonSetter(value = "value", nulls = Nulls.SKIP) + public Builder value(Optional value) { + this.value = value; + return this; + } + + public Builder value(String value) { + this.value = Optional.ofNullable(value); + return this; + } + + @JsonSetter(value = "location", nulls = Nulls.SKIP) + public Builder location(Optional location) { + this.location = location; + return this; + } + + public Builder location(String location) { + this.location = Optional.ofNullable(location); + return this; + } + + public ProxyTransformOptions build() { + return new ProxyTransformOptions(token, identifier, value, location, additionalProperties); + } + } +} diff --git a/src/main/java/com/basistheory/types/TokenAuthentication.java b/src/main/java/com/basistheory/types/TokenAuthentication.java new file mode 100644 index 0000000..10196b4 --- /dev/null +++ b/src/main/java/com/basistheory/types/TokenAuthentication.java @@ -0,0 +1,120 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.basistheory.types; + +import com.basistheory.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TokenAuthentication.Builder.class) +public final class TokenAuthentication { + private final Optional threedsCryptogram; + + private final Optional eciIndicator; + + private final Map additionalProperties; + + private TokenAuthentication( + Optional threedsCryptogram, + Optional eciIndicator, + Map additionalProperties) { + this.threedsCryptogram = threedsCryptogram; + this.eciIndicator = eciIndicator; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("threeds_cryptogram") + public Optional getThreedsCryptogram() { + return threedsCryptogram; + } + + @JsonProperty("eci_indicator") + public Optional getEciIndicator() { + return eciIndicator; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TokenAuthentication && equalTo((TokenAuthentication) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TokenAuthentication other) { + return threedsCryptogram.equals(other.threedsCryptogram) && eciIndicator.equals(other.eciIndicator); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.threedsCryptogram, this.eciIndicator); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional threedsCryptogram = Optional.empty(); + + private Optional eciIndicator = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(TokenAuthentication other) { + threedsCryptogram(other.getThreedsCryptogram()); + eciIndicator(other.getEciIndicator()); + return this; + } + + @JsonSetter(value = "threeds_cryptogram", nulls = Nulls.SKIP) + public Builder threedsCryptogram(Optional threedsCryptogram) { + this.threedsCryptogram = threedsCryptogram; + return this; + } + + public Builder threedsCryptogram(String threedsCryptogram) { + this.threedsCryptogram = Optional.ofNullable(threedsCryptogram); + return this; + } + + @JsonSetter(value = "eci_indicator", nulls = Nulls.SKIP) + public Builder eciIndicator(Optional eciIndicator) { + this.eciIndicator = eciIndicator; + return this; + } + + public Builder eciIndicator(String eciIndicator) { + this.eciIndicator = Optional.ofNullable(eciIndicator); + return this; + } + + public TokenAuthentication build() { + return new TokenAuthentication(threedsCryptogram, eciIndicator, additionalProperties); + } + } +} diff --git a/src/test/java/com/basistheory/TestClient.java b/src/test/java/com/basistheory/TestClient.java index 4438676..dd738eb 100644 --- a/src/test/java/com/basistheory/TestClient.java +++ b/src/test/java/com/basistheory/TestClient.java @@ -12,10 +12,9 @@ import com.basistheory.errors.UnprocessableEntityError; import com.basistheory.resources.applications.ApplicationsClient; import com.basistheory.resources.applications.requests.CreateApplicationRequest; -import com.basistheory.resources.documents.DocumentsClient; import com.basistheory.resources.documents.requests.DocumentsUploadRequest; -import com.basistheory.resources.googlepay.GooglepayClient; -import com.basistheory.resources.googlepay.requests.GooglePayTokenizeRequest; +import com.basistheory.resources.googlepay.GooglePayClient; +import com.basistheory.resources.googlepay.requests.GooglePayCreateRequest; import com.basistheory.resources.keys.AsyncKeysClient; import com.basistheory.resources.proxies.ProxiesClient; import com.basistheory.resources.proxies.requests.CreateProxyRequest; @@ -26,7 +25,6 @@ import com.basistheory.resources.reactors.requests.ReactRequest; import com.basistheory.resources.tenants.TenantsClient; import com.basistheory.resources.tokens.TokensClient; -import com.basistheory.resources.tokens.requests.CreateTokenRequest; import com.basistheory.resources.tokens.requests.TokensListV2Request; import com.basistheory.resources.tokens.requests.UpdateTokenRequest; import com.basistheory.resources.webhooks.WebhooksClient; @@ -169,13 +167,13 @@ public void shouldManageWebhookLifecycle() throws InterruptedException { @Test public void shouldSupportGooglePay() throws JsonProcessingException { - GooglepayClient client = new GooglepayClient(privateTestTenantClientOptions()); - GooglePaymentMethodToken googlePayToken = ObjectMappers.JSON_MAPPER.readValue( + GooglePayClient client = new GooglePayClient(privateTestTenantClientOptions()); + GooglePayMethodToken googlePayToken = ObjectMappers.JSON_MAPPER.readValue( "{\"signature\":\"MEQCIBnz8wKrUi3qrLSn6KSrTcNIo6YcOzrfre7X49S27MrKAiBMF70q7EHe0Bw8uva77pclggSiPMRTFRFl7TZILyACOQ\\u003d\\u003d\",\"intermediateSigningKey\":{\"signedKey\":\"{\\\"keyValue\\\":\\\"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEnK9rrDl5FJalSwcoZD3qB5EYcA/sYVTH2Nbh6y/EZArFvvBRQA1eI3BIv1iZeCkBLd/A2nU1ve7xENoPOfp7+Q\\\\u003d\\\\u003d\\\",\\\"keyExpiration\\\":\\\"1737724267469\\\"}\",\"signatures\":[\"MEQCIHugFzQtVBVNizwkMhG/POcZAmRRXyeiZpt3aFwBzt5cAiBSOY4pfT4tQGWzZjkldbYkpBwWGpSasxRmlt7XPNOaLQ\\u003d\\u003d\"]},\"protocolVersion\":\"ECv2\",\"signedMessage\":\"{\\\"encryptedMessage\\\":\\\"XURDnvPAIhAKT9rARBV9RT0/yVTesT/w0UniXCJflwu2TkE54UnP7ZmWBo0gKjTJIU3j8D1Rntw2Ywr2UDLbZor+UoeZltzZOAv6iAR4MfvCLSzlh3HcjechwqZM8oxSF2iZoD2XrNqOgaYbOY1EaYoLx1JpftZDuTqSDLYa+szsoPjAUgzBO5TJZTDIa3zDNAdK3UtAPwutL1M4pTyuFhUKOC12J3RzZdaGFANbKSc8vdfqnR1hqsvsEt1sWPf2O3yty91klSA7FDckvwlKfRoNyQMDhaDkEvYUi75uxcjCRHE0Jjbj61bZriSTXiG2KWNF2OKpz7l61kgPJxCpK7A7TV3P4pBLwW7DYbRusO6FupLehxOZl9nBpVfApytCZGjaSXT7QfPpxdBv8j2VfKsodOf/dwv2Thrra9a6ZzFWsUz4l7Jbr4MCBLhXH4lSuxKrlA2Rf/CVPTgz8b88cYpEDZyqLJxDstwy74/Nl7Mjc4V7thzmdskAeYSuZXKXyyeo3BHqkguRkeagEwuHiZoem2V4W2qWOF8hYn14KY3cXXNcVA\\\\u003d\\\\u003d\\\",\\\"ephemeralPublicKey\\\":\\\"BHBDKlM3tik4o9leEkHu+875bHbORaCK7dDeXFCRmv4bzWJw/4bsvtBtaBH3SW5JXkE/6pkRYAtjFzQmHMRQYvc\\\\u003d\\\",\\\"tag\\\":\\\"Hle3Oafx5sfUc3U3sCQgV0tRPhCAvPlVLYiqvbPyTYY\\\\u003d\\\"}\"}", - GooglePaymentMethodToken.class); + GooglePayMethodToken.class); try { - client.tokenize(GooglePayTokenizeRequest.builder().googlePaymentMethodToken(googlePayToken).build()); + client.create(GooglePayCreateRequest.builder().googlePaymentData(googlePayToken).build()); fail("Should have thrown exception"); } catch (UnprocessableEntityError e) { assertTrue(true);