From 855b875cbf8c29e61597d0cc4f55a85ef8c4f20c Mon Sep 17 00:00:00 2001 From: fern-api <115122769+fern-api[bot]@users.noreply.github.com> Date: Wed, 20 Nov 2024 21:01:44 +0000 Subject: [PATCH] SDK regeneration --- .../theory/api/BasisTheoryApiClient.java | 8 + .../tokenintents/TokenIntentsClient.java | 140 +++++++++ .../requests/CreateTokenIntentRequest.java | 124 ++++++++ .../basis/theory/api/types/CardDetails.java | 140 ++++++++- .../api/types/CreateTokenIntentResponse.java | 275 ++++++++++++++++++ .../theory/api/types/TokenEnrichments.java | 12 +- .../types/TokenEnrichmentsCardDetails.java | 118 ++++++++ 7 files changed, 807 insertions(+), 10 deletions(-) create mode 100644 src/main/java/com/basis/theory/api/resources/tokenintents/TokenIntentsClient.java create mode 100644 src/main/java/com/basis/theory/api/resources/tokenintents/requests/CreateTokenIntentRequest.java create mode 100644 src/main/java/com/basis/theory/api/types/CreateTokenIntentResponse.java create mode 100644 src/main/java/com/basis/theory/api/types/TokenEnrichmentsCardDetails.java diff --git a/src/main/java/com/basis/theory/api/BasisTheoryApiClient.java b/src/main/java/com/basis/theory/api/BasisTheoryApiClient.java index 0087a36..e6b4d34 100644 --- a/src/main/java/com/basis/theory/api/BasisTheoryApiClient.java +++ b/src/main/java/com/basis/theory/api/BasisTheoryApiClient.java @@ -17,6 +17,7 @@ import com.basis.theory.api.resources.sessions.SessionsClient; import com.basis.theory.api.resources.tenants.TenantsClient; import com.basis.theory.api.resources.threeds.ThreedsClient; +import com.basis.theory.api.resources.tokenintents.TokenIntentsClient; import com.basis.theory.api.resources.tokens.TokensClient; import com.basis.theory.api.resources.webhooks.WebhooksClient; import java.util.function.Supplier; @@ -46,6 +47,8 @@ public class BasisTheoryApiClient { protected final Supplier sessionsClient; + protected final Supplier tokenIntentsClient; + protected final Supplier webhooksClient; protected final Supplier tenantsClient; @@ -65,6 +68,7 @@ public BasisTheoryApiClient(ClientOptions clientOptions) { this.reactorsClient = Suppliers.memoize(() -> new ReactorsClient(clientOptions)); this.rolesClient = Suppliers.memoize(() -> new RolesClient(clientOptions)); this.sessionsClient = Suppliers.memoize(() -> new SessionsClient(clientOptions)); + this.tokenIntentsClient = Suppliers.memoize(() -> new TokenIntentsClient(clientOptions)); this.webhooksClient = Suppliers.memoize(() -> new WebhooksClient(clientOptions)); this.tenantsClient = Suppliers.memoize(() -> new TenantsClient(clientOptions)); this.threedsClient = Suppliers.memoize(() -> new ThreedsClient(clientOptions)); @@ -114,6 +118,10 @@ public SessionsClient sessions() { return this.sessionsClient.get(); } + public TokenIntentsClient tokenIntents() { + return this.tokenIntentsClient.get(); + } + public WebhooksClient webhooks() { return this.webhooksClient.get(); } diff --git a/src/main/java/com/basis/theory/api/resources/tokenintents/TokenIntentsClient.java b/src/main/java/com/basis/theory/api/resources/tokenintents/TokenIntentsClient.java new file mode 100644 index 0000000..f27c205 --- /dev/null +++ b/src/main/java/com/basis/theory/api/resources/tokenintents/TokenIntentsClient.java @@ -0,0 +1,140 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.basis.theory.api.resources.tokenintents; + +import com.basis.theory.api.core.BasisTheoryApiApiException; +import com.basis.theory.api.core.BasisTheoryException; +import com.basis.theory.api.core.ClientOptions; +import com.basis.theory.api.core.MediaTypes; +import com.basis.theory.api.core.ObjectMappers; +import com.basis.theory.api.core.RequestOptions; +import com.basis.theory.api.errors.BadRequestError; +import com.basis.theory.api.errors.ForbiddenError; +import com.basis.theory.api.errors.NotFoundError; +import com.basis.theory.api.errors.UnauthorizedError; +import com.basis.theory.api.resources.tokenintents.requests.CreateTokenIntentRequest; +import com.basis.theory.api.types.CreateTokenIntentResponse; +import com.basis.theory.api.types.ProblemDetails; +import com.basis.theory.api.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 TokenIntentsClient { + protected final ClientOptions clientOptions; + + public TokenIntentsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CreateTokenIntentResponse create(CreateTokenIntentRequest request) { + return create(request, null); + } + + public CreateTokenIntentResponse create(CreateTokenIntentRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("token-intents") + .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") + .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 ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CreateTokenIntentResponse.class); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 400: + throw new BadRequestError(ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ValidationProblemDetails.class)); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProblemDetails.class)); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProblemDetails.class)); + } + } 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)); + } catch (IOException e) { + throw new BasisTheoryException("Network error executing HTTP request", e); + } + } + + public void delete(String id) { + delete(id, null); + } + + public void delete(String id, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("token-intents") + .addPathSegment(id) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .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; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProblemDetails.class)); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProblemDetails.class)); + case 404: + throw new NotFoundError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class)); + } + } 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)); + } catch (IOException e) { + throw new BasisTheoryException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/basis/theory/api/resources/tokenintents/requests/CreateTokenIntentRequest.java b/src/main/java/com/basis/theory/api/resources/tokenintents/requests/CreateTokenIntentRequest.java new file mode 100644 index 0000000..7b98140 --- /dev/null +++ b/src/main/java/com/basis/theory/api/resources/tokenintents/requests/CreateTokenIntentRequest.java @@ -0,0 +1,124 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.basis.theory.api.resources.tokenintents.requests; + +import com.basis.theory.api.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 = CreateTokenIntentRequest.Builder.class) +public final class CreateTokenIntentRequest { + private final String type; + + private final Object data; + + private final Map additionalProperties; + + private CreateTokenIntentRequest(String type, Object data, Map additionalProperties) { + this.type = type; + this.data = data; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("type") + public String getType() { + return type; + } + + @JsonProperty("data") + public Object getData() { + return data; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateTokenIntentRequest && equalTo((CreateTokenIntentRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateTokenIntentRequest other) { + return type.equals(other.type) && data.equals(other.data); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.data); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TypeStage builder() { + return new Builder(); + } + + public interface TypeStage { + DataStage type(@NotNull String type); + + Builder from(CreateTokenIntentRequest other); + } + + public interface DataStage { + _FinalStage data(Object data); + } + + public interface _FinalStage { + CreateTokenIntentRequest build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TypeStage, DataStage, _FinalStage { + private String type; + + private Object data; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateTokenIntentRequest other) { + type(other.getType()); + data(other.getData()); + return this; + } + + @java.lang.Override + @JsonSetter("type") + public DataStage type(@NotNull String type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(Object data) { + this.data = data; + return this; + } + + @java.lang.Override + public CreateTokenIntentRequest build() { + return new CreateTokenIntentRequest(type, data, additionalProperties); + } + } +} diff --git a/src/main/java/com/basis/theory/api/types/CardDetails.java b/src/main/java/com/basis/theory/api/types/CardDetails.java index cfe83f5..bd33993 100644 --- a/src/main/java/com/basis/theory/api/types/CardDetails.java +++ b/src/main/java/com/basis/theory/api/types/CardDetails.java @@ -24,11 +24,34 @@ public final class CardDetails { private final Optional last4; + private final Optional expirationMonth; + + private final Optional expirationYear; + + private final Optional brand; + + private final Optional funding; + + private final Optional authentication; + private final Map additionalProperties; - private CardDetails(Optional bin, Optional last4, Map additionalProperties) { + private CardDetails( + Optional bin, + Optional last4, + Optional expirationMonth, + Optional expirationYear, + Optional brand, + Optional funding, + Optional authentication, + Map additionalProperties) { this.bin = bin; this.last4 = last4; + this.expirationMonth = expirationMonth; + this.expirationYear = expirationYear; + this.brand = brand; + this.funding = funding; + this.authentication = authentication; this.additionalProperties = additionalProperties; } @@ -42,6 +65,31 @@ public Optional getLast4() { return last4; } + @JsonProperty("expiration_month") + public Optional getExpirationMonth() { + return expirationMonth; + } + + @JsonProperty("expiration_year") + public Optional getExpirationYear() { + return expirationYear; + } + + @JsonProperty("brand") + public Optional getBrand() { + return brand; + } + + @JsonProperty("funding") + public Optional getFunding() { + return funding; + } + + @JsonProperty("authentication") + public Optional getAuthentication() { + return authentication; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -54,12 +102,25 @@ public Map getAdditionalProperties() { } private boolean equalTo(CardDetails other) { - return bin.equals(other.bin) && last4.equals(other.last4); + return bin.equals(other.bin) + && last4.equals(other.last4) + && expirationMonth.equals(other.expirationMonth) + && expirationYear.equals(other.expirationYear) + && brand.equals(other.brand) + && funding.equals(other.funding) + && authentication.equals(other.authentication); } @java.lang.Override public int hashCode() { - return Objects.hash(this.bin, this.last4); + return Objects.hash( + this.bin, + this.last4, + this.expirationMonth, + this.expirationYear, + this.brand, + this.funding, + this.authentication); } @java.lang.Override @@ -77,6 +138,16 @@ public static final class Builder { private Optional last4 = Optional.empty(); + private Optional expirationMonth = Optional.empty(); + + private Optional expirationYear = Optional.empty(); + + private Optional brand = Optional.empty(); + + private Optional funding = Optional.empty(); + + private Optional authentication = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -85,6 +156,11 @@ private Builder() {} public Builder from(CardDetails other) { bin(other.getBin()); last4(other.getLast4()); + expirationMonth(other.getExpirationMonth()); + expirationYear(other.getExpirationYear()); + brand(other.getBrand()); + funding(other.getFunding()); + authentication(other.getAuthentication()); return this; } @@ -110,8 +186,64 @@ public Builder last4(String last4) { return this; } + @JsonSetter(value = "expiration_month", nulls = Nulls.SKIP) + public Builder expirationMonth(Optional expirationMonth) { + this.expirationMonth = expirationMonth; + return this; + } + + public Builder expirationMonth(Integer expirationMonth) { + this.expirationMonth = Optional.ofNullable(expirationMonth); + return this; + } + + @JsonSetter(value = "expiration_year", nulls = Nulls.SKIP) + public Builder expirationYear(Optional expirationYear) { + this.expirationYear = expirationYear; + return this; + } + + public Builder expirationYear(Integer expirationYear) { + this.expirationYear = Optional.ofNullable(expirationYear); + 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 = "authentication", nulls = Nulls.SKIP) + public Builder authentication(Optional authentication) { + this.authentication = authentication; + return this; + } + + public Builder authentication(String authentication) { + this.authentication = Optional.ofNullable(authentication); + return this; + } + public CardDetails build() { - return new CardDetails(bin, last4, additionalProperties); + return new CardDetails( + bin, last4, expirationMonth, expirationYear, brand, funding, authentication, additionalProperties); } } } diff --git a/src/main/java/com/basis/theory/api/types/CreateTokenIntentResponse.java b/src/main/java/com/basis/theory/api/types/CreateTokenIntentResponse.java new file mode 100644 index 0000000..c6c1cf9 --- /dev/null +++ b/src/main/java/com/basis/theory/api/types/CreateTokenIntentResponse.java @@ -0,0 +1,275 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.basis.theory.api.types; + +import com.basis.theory.api.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 = CreateTokenIntentResponse.Builder.class) +public final class CreateTokenIntentResponse { + private final Optional id; + + private final Optional type; + + private final Optional tenantId; + + private final Optional fingerprint; + + private final Optional createdBy; + + private final Optional createdAt; + + private final Optional expiresAt; + + private final Optional card; + + private final Map additionalProperties; + + private CreateTokenIntentResponse( + Optional id, + Optional type, + Optional tenantId, + Optional fingerprint, + Optional createdBy, + Optional createdAt, + Optional expiresAt, + Optional card, + Map additionalProperties) { + this.id = id; + this.type = type; + this.tenantId = tenantId; + this.fingerprint = fingerprint; + this.createdBy = createdBy; + this.createdAt = createdAt; + this.expiresAt = expiresAt; + this.card = card; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public Optional getId() { + return id; + } + + @JsonProperty("type") + public Optional getType() { + return type; + } + + @JsonProperty("tenant_id") + public Optional getTenantId() { + return tenantId; + } + + @JsonProperty("fingerprint") + public Optional getFingerprint() { + return fingerprint; + } + + @JsonProperty("created_by") + public Optional getCreatedBy() { + return createdBy; + } + + @JsonProperty("created_at") + public Optional getCreatedAt() { + return createdAt; + } + + @JsonProperty("expires_at") + public Optional getExpiresAt() { + return expiresAt; + } + + @JsonProperty("card") + public Optional getCard() { + return card; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateTokenIntentResponse && equalTo((CreateTokenIntentResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateTokenIntentResponse other) { + return id.equals(other.id) + && type.equals(other.type) + && tenantId.equals(other.tenantId) + && fingerprint.equals(other.fingerprint) + && createdBy.equals(other.createdBy) + && createdAt.equals(other.createdAt) + && expiresAt.equals(other.expiresAt) + && card.equals(other.card); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.id, + this.type, + this.tenantId, + this.fingerprint, + this.createdBy, + this.createdAt, + this.expiresAt, + this.card); + } + + @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 type = Optional.empty(); + + private Optional tenantId = Optional.empty(); + + private Optional fingerprint = Optional.empty(); + + private Optional createdBy = Optional.empty(); + + private Optional createdAt = Optional.empty(); + + private Optional expiresAt = Optional.empty(); + + private Optional card = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateTokenIntentResponse other) { + id(other.getId()); + type(other.getType()); + tenantId(other.getTenantId()); + fingerprint(other.getFingerprint()); + createdBy(other.getCreatedBy()); + createdAt(other.getCreatedAt()); + expiresAt(other.getExpiresAt()); + card(other.getCard()); + 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 = "type", nulls = Nulls.SKIP) + public Builder type(Optional type) { + this.type = type; + return this; + } + + public Builder type(String type) { + this.type = Optional.ofNullable(type); + 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 = "fingerprint", nulls = Nulls.SKIP) + public Builder fingerprint(Optional fingerprint) { + this.fingerprint = fingerprint; + return this; + } + + public Builder fingerprint(String fingerprint) { + this.fingerprint = Optional.ofNullable(fingerprint); + 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 = "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 = "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; + } + + public CreateTokenIntentResponse build() { + return new CreateTokenIntentResponse( + id, type, tenantId, fingerprint, createdBy, createdAt, expiresAt, card, additionalProperties); + } + } +} diff --git a/src/main/java/com/basis/theory/api/types/TokenEnrichments.java b/src/main/java/com/basis/theory/api/types/TokenEnrichments.java index 8572893..90c3084 100644 --- a/src/main/java/com/basis/theory/api/types/TokenEnrichments.java +++ b/src/main/java/com/basis/theory/api/types/TokenEnrichments.java @@ -22,13 +22,13 @@ public final class TokenEnrichments { private final Optional binDetails; - private final Optional cardDetails; + private final Optional cardDetails; private final Map additionalProperties; private TokenEnrichments( Optional binDetails, - Optional cardDetails, + Optional cardDetails, Map additionalProperties) { this.binDetails = binDetails; this.cardDetails = cardDetails; @@ -41,7 +41,7 @@ public Optional getBinDetails() { } @JsonProperty("card_details") - public Optional getCardDetails() { + public Optional getCardDetails() { return cardDetails; } @@ -78,7 +78,7 @@ public static Builder builder() { public static final class Builder { private Optional binDetails = Optional.empty(); - private Optional cardDetails = Optional.empty(); + private Optional cardDetails = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -103,12 +103,12 @@ public Builder binDetails(BinDetails binDetails) { } @JsonSetter(value = "card_details", nulls = Nulls.SKIP) - public Builder cardDetails(Optional cardDetails) { + public Builder cardDetails(Optional cardDetails) { this.cardDetails = cardDetails; return this; } - public Builder cardDetails(CardDetails cardDetails) { + public Builder cardDetails(TokenEnrichmentsCardDetails cardDetails) { this.cardDetails = Optional.ofNullable(cardDetails); return this; } diff --git a/src/main/java/com/basis/theory/api/types/TokenEnrichmentsCardDetails.java b/src/main/java/com/basis/theory/api/types/TokenEnrichmentsCardDetails.java new file mode 100644 index 0000000..022045c --- /dev/null +++ b/src/main/java/com/basis/theory/api/types/TokenEnrichmentsCardDetails.java @@ -0,0 +1,118 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.basis.theory.api.types; + +import com.basis.theory.api.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 = TokenEnrichmentsCardDetails.Builder.class) +public final class TokenEnrichmentsCardDetails { + private final Optional bin; + + private final Optional last4; + + private final Map additionalProperties; + + private TokenEnrichmentsCardDetails( + Optional bin, Optional last4, Map additionalProperties) { + this.bin = bin; + this.last4 = last4; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("bin") + public Optional getBin() { + return bin; + } + + @JsonProperty("last4") + public Optional getLast4() { + return last4; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TokenEnrichmentsCardDetails && equalTo((TokenEnrichmentsCardDetails) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TokenEnrichmentsCardDetails other) { + return bin.equals(other.bin) && last4.equals(other.last4); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.bin, this.last4); + } + + @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 bin = Optional.empty(); + + private Optional last4 = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(TokenEnrichmentsCardDetails other) { + bin(other.getBin()); + last4(other.getLast4()); + return this; + } + + @JsonSetter(value = "bin", nulls = Nulls.SKIP) + public Builder bin(Optional bin) { + this.bin = bin; + return this; + } + + public Builder bin(String bin) { + this.bin = Optional.ofNullable(bin); + return this; + } + + @JsonSetter(value = "last4", nulls = Nulls.SKIP) + public Builder last4(Optional last4) { + this.last4 = last4; + return this; + } + + public Builder last4(String last4) { + this.last4 = Optional.ofNullable(last4); + return this; + } + + public TokenEnrichmentsCardDetails build() { + return new TokenEnrichmentsCardDetails(bin, last4, additionalProperties); + } + } +}