sync(String transactionId, Jso
.thenCompose(operation::handleResponse);
}
+
+ /**
+ * Increment transaction authorization
+ *
+ * Increment the transaction authorization amount of a given transaction_id.
+ *
+ * @return The async call builder
+ */
+ public IncrementTransactionAuthorizationRequestBuilder incrementAuthorization() {
+ return new IncrementTransactionAuthorizationRequestBuilder(sdkConfiguration);
+ }
+
+ /**
+ * Increment transaction authorization
+ *
+ *
Increment the transaction authorization amount of a given transaction_id.
+ *
+ * @param transactionId The unique identifier of the transaction.
+ * @param transactionAuthorizationIncrementCreate
+ * @return {@code CompletableFuture} - The async response
+ */
+ public CompletableFuture incrementAuthorization(String transactionId, TransactionAuthorizationIncrementCreate transactionAuthorizationIncrementCreate) {
+ return incrementAuthorization(
+ transactionId, JsonNullable.undefined(), JsonNullable.undefined(),
+ transactionAuthorizationIncrementCreate);
+ }
+
+ /**
+ * Increment transaction authorization
+ *
+ * Increment the transaction authorization amount of a given transaction_id.
+ *
+ * @param transactionId The unique identifier of the transaction.
+ * @param merchantAccountId
+ * @param idempotencyKey A unique key that identifies this request. Providing this header will make this an idempotent request. We recommend using V4 UUIDs, or another random string with enough entropy to avoid collisions.
+ * @param transactionAuthorizationIncrementCreate
+ * @return {@code CompletableFuture} - The async response
+ */
+ public CompletableFuture incrementAuthorization(
+ String transactionId, JsonNullable merchantAccountId,
+ JsonNullable idempotencyKey, TransactionAuthorizationIncrementCreate transactionAuthorizationIncrementCreate) {
+ IncrementTransactionAuthorizationRequest request =
+ IncrementTransactionAuthorizationRequest
+ .builder()
+ .transactionId(transactionId)
+ .merchantAccountId(merchantAccountId)
+ .idempotencyKey(idempotencyKey)
+ .transactionAuthorizationIncrementCreate(transactionAuthorizationIncrementCreate)
+ .build();
+ AsyncRequestOperation operation
+ = new IncrementTransactionAuthorization.Async(sdkConfiguration, _headers);
+ return operation.doRequest(request)
+ .thenCompose(operation::handleResponse);
+ }
+
}
diff --git a/src/main/java/com/gr4vy/sdk/SDKConfiguration.java b/src/main/java/com/gr4vy/sdk/SDKConfiguration.java
index a68d33ed..03ea0ed5 100644
--- a/src/main/java/com/gr4vy/sdk/SDKConfiguration.java
+++ b/src/main/java/com/gr4vy/sdk/SDKConfiguration.java
@@ -22,7 +22,7 @@ public class SDKConfiguration {
private static final String LANGUAGE = "java";
public static final String OPENAPI_DOC_VERSION = "1.0.0";
- public static final String SDK_VERSION = "2.18.4";
+ public static final String SDK_VERSION = "2.18.5";
public static final String GEN_VERSION = "2.926.2";
private static final String BASE_PACKAGE = "com.gr4vy.sdk";
public static final String USER_AGENT =
diff --git a/src/main/java/com/gr4vy/sdk/Transactions.java b/src/main/java/com/gr4vy/sdk/Transactions.java
index fa86c63a..fb956274 100644
--- a/src/main/java/com/gr4vy/sdk/Transactions.java
+++ b/src/main/java/com/gr4vy/sdk/Transactions.java
@@ -5,6 +5,7 @@
import static com.gr4vy.sdk.operations.Operations.RequestOperation;
+import com.gr4vy.sdk.models.components.TransactionAuthorizationIncrementCreate;
import com.gr4vy.sdk.models.components.TransactionCreate;
import com.gr4vy.sdk.models.components.TransactionUpdate;
import com.gr4vy.sdk.models.operations.CancelTransactionRequest;
@@ -19,6 +20,9 @@
import com.gr4vy.sdk.models.operations.GetTransactionRequest;
import com.gr4vy.sdk.models.operations.GetTransactionRequestBuilder;
import com.gr4vy.sdk.models.operations.GetTransactionResponse;
+import com.gr4vy.sdk.models.operations.IncrementTransactionAuthorizationRequest;
+import com.gr4vy.sdk.models.operations.IncrementTransactionAuthorizationRequestBuilder;
+import com.gr4vy.sdk.models.operations.IncrementTransactionAuthorizationResponse;
import com.gr4vy.sdk.models.operations.ListTransactionsRequest;
import com.gr4vy.sdk.models.operations.ListTransactionsRequestBuilder;
import com.gr4vy.sdk.models.operations.ListTransactionsResponse;
@@ -35,6 +39,7 @@
import com.gr4vy.sdk.operations.CaptureTransaction;
import com.gr4vy.sdk.operations.CreateTransaction;
import com.gr4vy.sdk.operations.GetTransaction;
+import com.gr4vy.sdk.operations.IncrementTransactionAuthorization;
import com.gr4vy.sdk.operations.ListTransactions;
import com.gr4vy.sdk.operations.SyncTransaction;
import com.gr4vy.sdk.operations.UpdateTransaction;
@@ -497,4 +502,58 @@ public SyncTransactionResponse sync(String transactionId, JsonNullable m
return operation.handleResponse(operation.doRequest(request));
}
+ /**
+ * Increment transaction authorization
+ *
+ * Increment the transaction authorization amount of a given transaction_id.
+ *
+ * @return The call builder
+ */
+ public IncrementTransactionAuthorizationRequestBuilder incrementAuthorization() {
+ return new IncrementTransactionAuthorizationRequestBuilder(sdkConfiguration);
+ }
+
+ /**
+ * Increment transaction authorization
+ *
+ *
Increment the transaction authorization amount of a given transaction_id.
+ *
+ * @param transactionId The unique identifier of the transaction.
+ * @param transactionAuthorizationIncrementCreate
+ * @return The response from the API call
+ * @throws RuntimeException subclass if the API call fails
+ */
+ public IncrementTransactionAuthorizationResponse incrementAuthorization(String transactionId, TransactionAuthorizationIncrementCreate transactionAuthorizationIncrementCreate) {
+ return incrementAuthorization(transactionId, JsonNullable.undefined(), JsonNullable.undefined(),
+ transactionAuthorizationIncrementCreate);
+ }
+
+ /**
+ * Increment transaction authorization
+ *
+ *
Increment the transaction authorization amount of a given transaction_id.
+ *
+ * @param transactionId The unique identifier of the transaction.
+ * @param merchantAccountId
+ * @param idempotencyKey A unique key that identifies this request. Providing this header will make this an idempotent request. We recommend using V4 UUIDs, or another random string with enough entropy to avoid collisions.
+ * @param transactionAuthorizationIncrementCreate
+ * @return The response from the API call
+ * @throws RuntimeException subclass if the API call fails
+ */
+ public IncrementTransactionAuthorizationResponse incrementAuthorization(
+ String transactionId, JsonNullable merchantAccountId,
+ JsonNullable idempotencyKey, TransactionAuthorizationIncrementCreate transactionAuthorizationIncrementCreate) {
+ IncrementTransactionAuthorizationRequest request =
+ IncrementTransactionAuthorizationRequest
+ .builder()
+ .transactionId(transactionId)
+ .merchantAccountId(merchantAccountId)
+ .idempotencyKey(idempotencyKey)
+ .transactionAuthorizationIncrementCreate(transactionAuthorizationIncrementCreate)
+ .build();
+ RequestOperation operation
+ = new IncrementTransactionAuthorization.Sync(sdkConfiguration, _headers);
+ return operation.handleResponse(operation.doRequest(request));
+ }
+
}
diff --git a/src/main/java/com/gr4vy/sdk/models/components/IncrementalAuthorizationStatus.java b/src/main/java/com/gr4vy/sdk/models/components/IncrementalAuthorizationStatus.java
new file mode 100644
index 00000000..76b3892b
--- /dev/null
+++ b/src/main/java/com/gr4vy/sdk/models/components/IncrementalAuthorizationStatus.java
@@ -0,0 +1,127 @@
+/*
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
+ */
+package com.gr4vy.sdk.models.components;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonValue;
+import java.lang.Override;
+import java.lang.String;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+
+/**
+ * Wrapper for an "open" enum that can handle unknown values from API responses
+ * without runtime errors. Instances are immutable singletons with reference equality.
+ * Use {@code asEnum()} for switch expressions.
+ */
+public class IncrementalAuthorizationStatus {
+
+ public static final IncrementalAuthorizationStatus SUCCEEDED = new IncrementalAuthorizationStatus("succeeded");
+ public static final IncrementalAuthorizationStatus FAILED = new IncrementalAuthorizationStatus("failed");
+
+ // This map will grow whenever a Color gets created with a new
+ // unrecognized value (a potential memory leak if the user is not
+ // careful). Keep this field lower case to avoid clashing with
+ // generated member names which will always be upper cased (Java
+ // convention)
+ private static final Map values = createValuesMap();
+ private static final Map enums = createEnumsMap();
+
+ private final String value;
+
+ private IncrementalAuthorizationStatus(String value) {
+ this.value = value;
+ }
+
+ /**
+ * Returns a IncrementalAuthorizationStatus with the given value. For a specific value the
+ * returned object will always be a singleton so reference equality
+ * is satisfied when the values are the same.
+ *
+ * @param value value to be wrapped as IncrementalAuthorizationStatus
+ */
+ @JsonCreator
+ public static IncrementalAuthorizationStatus of(String value) {
+ synchronized (IncrementalAuthorizationStatus.class) {
+ return values.computeIfAbsent(value, v -> new IncrementalAuthorizationStatus(v));
+ }
+ }
+
+ @JsonValue
+ public String value() {
+ return value;
+ }
+
+ public Optional asEnum() {
+ return Optional.ofNullable(enums.getOrDefault(value, null));
+ }
+
+ public boolean isKnown() {
+ return asEnum().isPresent();
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(value);
+ }
+
+ @Override
+ public boolean equals(java.lang.Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ IncrementalAuthorizationStatus other = (IncrementalAuthorizationStatus) obj;
+ return Objects.equals(value, other.value);
+ }
+
+ @Override
+ public String toString() {
+ return "IncrementalAuthorizationStatus [value=" + value + "]";
+ }
+
+ // return an array just like an enum
+ public static IncrementalAuthorizationStatus[] values() {
+ synchronized (IncrementalAuthorizationStatus.class) {
+ return values.values().toArray(new IncrementalAuthorizationStatus[] {});
+ }
+ }
+
+ private static final Map createValuesMap() {
+ Map map = new LinkedHashMap<>();
+ map.put("succeeded", SUCCEEDED);
+ map.put("failed", FAILED);
+ return map;
+ }
+
+ private static final Map createEnumsMap() {
+ Map map = new HashMap<>();
+ map.put("succeeded", IncrementalAuthorizationStatusEnum.SUCCEEDED);
+ map.put("failed", IncrementalAuthorizationStatusEnum.FAILED);
+ return map;
+ }
+
+
+ public enum IncrementalAuthorizationStatusEnum {
+
+ SUCCEEDED("succeeded"),
+ FAILED("failed"),;
+
+ private final String value;
+
+ private IncrementalAuthorizationStatusEnum(String value) {
+ this.value = value;
+ }
+
+ public String value() {
+ return value;
+ }
+ }
+}
+
diff --git a/src/main/java/com/gr4vy/sdk/models/components/TransactionAuthorizationIncrement.java b/src/main/java/com/gr4vy/sdk/models/components/TransactionAuthorizationIncrement.java
new file mode 100644
index 00000000..20171ff5
--- /dev/null
+++ b/src/main/java/com/gr4vy/sdk/models/components/TransactionAuthorizationIncrement.java
@@ -0,0 +1,360 @@
+/*
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
+ */
+package com.gr4vy.sdk.models.components;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.gr4vy.sdk.utils.LazySingletonValue;
+import com.gr4vy.sdk.utils.Utils;
+import java.lang.Override;
+import java.lang.String;
+import java.util.Optional;
+
+
+public class TransactionAuthorizationIncrement {
+ /**
+ * Always `transaction-authorization-increment`.
+ */
+ @JsonInclude(Include.NON_ABSENT)
+ @JsonProperty("type")
+ private Optional type;
+
+
+ @JsonProperty("status")
+ private IncrementalAuthorizationStatus status;
+
+ /**
+ * The standardized error code set by Gr4vy.
+ */
+ @JsonInclude(Include.ALWAYS)
+ @JsonProperty("code")
+ private Optional code;
+
+ /**
+ * This is the response code received from the payment service. This can be set to any value and is not
+ * standardized across different payment services.
+ */
+ @JsonInclude(Include.ALWAYS)
+ @JsonProperty("raw_response_code")
+ private Optional rawResponseCode;
+
+ /**
+ * This is the response description received from the payment service. This can be set to any value and
+ * is not standardized across different payment services.
+ */
+ @JsonInclude(Include.ALWAYS)
+ @JsonProperty("raw_response_description")
+ private Optional rawResponseDescription;
+
+ /**
+ * A full transaction resource.
+ */
+ @JsonProperty("transaction")
+ private Transaction transaction;
+
+ @JsonCreator
+ public TransactionAuthorizationIncrement(
+ @JsonProperty("status") IncrementalAuthorizationStatus status,
+ @JsonProperty("code") Optional code,
+ @JsonProperty("raw_response_code") Optional rawResponseCode,
+ @JsonProperty("raw_response_description") Optional rawResponseDescription,
+ @JsonProperty("transaction") Transaction transaction) {
+ Utils.checkNotNull(status, "status");
+ Utils.checkNotNull(code, "code");
+ Utils.checkNotNull(rawResponseCode, "rawResponseCode");
+ Utils.checkNotNull(rawResponseDescription, "rawResponseDescription");
+ Utils.checkNotNull(transaction, "transaction");
+ this.type = Builder._SINGLETON_VALUE_Type.value();
+ this.status = status;
+ this.code = code;
+ this.rawResponseCode = rawResponseCode;
+ this.rawResponseDescription = rawResponseDescription;
+ this.transaction = transaction;
+ }
+
+ public TransactionAuthorizationIncrement(
+ IncrementalAuthorizationStatus status,
+ Transaction transaction) {
+ this(status, Optional.empty(), Optional.empty(),
+ Optional.empty(), transaction);
+ }
+
+ /**
+ * Always `transaction-authorization-increment`.
+ */
+ @JsonIgnore
+ public Optional type() {
+ return type;
+ }
+
+ @JsonIgnore
+ public IncrementalAuthorizationStatus status() {
+ return status;
+ }
+
+ /**
+ * The standardized error code set by Gr4vy.
+ */
+ @JsonIgnore
+ public Optional code() {
+ return code;
+ }
+
+ /**
+ * This is the response code received from the payment service. This can be set to any value and is not
+ * standardized across different payment services.
+ */
+ @JsonIgnore
+ public Optional rawResponseCode() {
+ return rawResponseCode;
+ }
+
+ /**
+ * This is the response description received from the payment service. This can be set to any value and
+ * is not standardized across different payment services.
+ */
+ @JsonIgnore
+ public Optional rawResponseDescription() {
+ return rawResponseDescription;
+ }
+
+ /**
+ * A full transaction resource.
+ */
+ @JsonIgnore
+ public Transaction transaction() {
+ return transaction;
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+
+ public TransactionAuthorizationIncrement withStatus(IncrementalAuthorizationStatus status) {
+ Utils.checkNotNull(status, "status");
+ this.status = status;
+ return this;
+ }
+
+ /**
+ * The standardized error code set by Gr4vy.
+ */
+ public TransactionAuthorizationIncrement withCode(String code) {
+ Utils.checkNotNull(code, "code");
+ this.code = Optional.ofNullable(code);
+ return this;
+ }
+
+
+ /**
+ * The standardized error code set by Gr4vy.
+ */
+ public TransactionAuthorizationIncrement withCode(Optional code) {
+ Utils.checkNotNull(code, "code");
+ this.code = code;
+ return this;
+ }
+
+ /**
+ * This is the response code received from the payment service. This can be set to any value and is not
+ * standardized across different payment services.
+ */
+ public TransactionAuthorizationIncrement withRawResponseCode(String rawResponseCode) {
+ Utils.checkNotNull(rawResponseCode, "rawResponseCode");
+ this.rawResponseCode = Optional.ofNullable(rawResponseCode);
+ return this;
+ }
+
+
+ /**
+ * This is the response code received from the payment service. This can be set to any value and is not
+ * standardized across different payment services.
+ */
+ public TransactionAuthorizationIncrement withRawResponseCode(Optional rawResponseCode) {
+ Utils.checkNotNull(rawResponseCode, "rawResponseCode");
+ this.rawResponseCode = rawResponseCode;
+ return this;
+ }
+
+ /**
+ * This is the response description received from the payment service. This can be set to any value and
+ * is not standardized across different payment services.
+ */
+ public TransactionAuthorizationIncrement withRawResponseDescription(String rawResponseDescription) {
+ Utils.checkNotNull(rawResponseDescription, "rawResponseDescription");
+ this.rawResponseDescription = Optional.ofNullable(rawResponseDescription);
+ return this;
+ }
+
+
+ /**
+ * This is the response description received from the payment service. This can be set to any value and
+ * is not standardized across different payment services.
+ */
+ public TransactionAuthorizationIncrement withRawResponseDescription(Optional rawResponseDescription) {
+ Utils.checkNotNull(rawResponseDescription, "rawResponseDescription");
+ this.rawResponseDescription = rawResponseDescription;
+ return this;
+ }
+
+ /**
+ * A full transaction resource.
+ */
+ public TransactionAuthorizationIncrement withTransaction(Transaction transaction) {
+ Utils.checkNotNull(transaction, "transaction");
+ this.transaction = transaction;
+ return this;
+ }
+
+ @Override
+ public boolean equals(java.lang.Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ TransactionAuthorizationIncrement other = (TransactionAuthorizationIncrement) o;
+ return
+ Utils.enhancedDeepEquals(this.type, other.type) &&
+ Utils.enhancedDeepEquals(this.status, other.status) &&
+ Utils.enhancedDeepEquals(this.code, other.code) &&
+ Utils.enhancedDeepEquals(this.rawResponseCode, other.rawResponseCode) &&
+ Utils.enhancedDeepEquals(this.rawResponseDescription, other.rawResponseDescription) &&
+ Utils.enhancedDeepEquals(this.transaction, other.transaction);
+ }
+
+ @Override
+ public int hashCode() {
+ return Utils.enhancedHash(
+ type, status, code,
+ rawResponseCode, rawResponseDescription, transaction);
+ }
+
+ @Override
+ public String toString() {
+ return Utils.toString(TransactionAuthorizationIncrement.class,
+ "type", type,
+ "status", status,
+ "code", code,
+ "rawResponseCode", rawResponseCode,
+ "rawResponseDescription", rawResponseDescription,
+ "transaction", transaction);
+ }
+
+ @SuppressWarnings("UnusedReturnValue")
+ public final static class Builder {
+
+ private IncrementalAuthorizationStatus status;
+
+ private Optional code = Optional.empty();
+
+ private Optional rawResponseCode = Optional.empty();
+
+ private Optional rawResponseDescription = Optional.empty();
+
+ private Transaction transaction;
+
+ private Builder() {
+ // force use of static builder() method
+ }
+
+
+ public Builder status(IncrementalAuthorizationStatus status) {
+ Utils.checkNotNull(status, "status");
+ this.status = status;
+ return this;
+ }
+
+
+ /**
+ * The standardized error code set by Gr4vy.
+ */
+ public Builder code(String code) {
+ Utils.checkNotNull(code, "code");
+ this.code = Optional.ofNullable(code);
+ return this;
+ }
+
+ /**
+ * The standardized error code set by Gr4vy.
+ */
+ public Builder code(Optional code) {
+ Utils.checkNotNull(code, "code");
+ this.code = code;
+ return this;
+ }
+
+
+ /**
+ * This is the response code received from the payment service. This can be set to any value and is not
+ * standardized across different payment services.
+ */
+ public Builder rawResponseCode(String rawResponseCode) {
+ Utils.checkNotNull(rawResponseCode, "rawResponseCode");
+ this.rawResponseCode = Optional.ofNullable(rawResponseCode);
+ return this;
+ }
+
+ /**
+ * This is the response code received from the payment service. This can be set to any value and is not
+ * standardized across different payment services.
+ */
+ public Builder rawResponseCode(Optional rawResponseCode) {
+ Utils.checkNotNull(rawResponseCode, "rawResponseCode");
+ this.rawResponseCode = rawResponseCode;
+ return this;
+ }
+
+
+ /**
+ * This is the response description received from the payment service. This can be set to any value and
+ * is not standardized across different payment services.
+ */
+ public Builder rawResponseDescription(String rawResponseDescription) {
+ Utils.checkNotNull(rawResponseDescription, "rawResponseDescription");
+ this.rawResponseDescription = Optional.ofNullable(rawResponseDescription);
+ return this;
+ }
+
+ /**
+ * This is the response description received from the payment service. This can be set to any value and
+ * is not standardized across different payment services.
+ */
+ public Builder rawResponseDescription(Optional rawResponseDescription) {
+ Utils.checkNotNull(rawResponseDescription, "rawResponseDescription");
+ this.rawResponseDescription = rawResponseDescription;
+ return this;
+ }
+
+
+ /**
+ * A full transaction resource.
+ */
+ public Builder transaction(Transaction transaction) {
+ Utils.checkNotNull(transaction, "transaction");
+ this.transaction = transaction;
+ return this;
+ }
+
+ public TransactionAuthorizationIncrement build() {
+
+ return new TransactionAuthorizationIncrement(
+ status, code, rawResponseCode,
+ rawResponseDescription, transaction);
+ }
+
+
+ private static final LazySingletonValue> _SINGLETON_VALUE_Type =
+ new LazySingletonValue<>(
+ "type",
+ "\"transaction-authorization-increment\"",
+ new TypeReference>() {});
+ }
+}
diff --git a/src/main/java/com/gr4vy/sdk/models/components/TransactionAuthorizationIncrementCreate.java b/src/main/java/com/gr4vy/sdk/models/components/TransactionAuthorizationIncrementCreate.java
new file mode 100644
index 00000000..f1c2975c
--- /dev/null
+++ b/src/main/java/com/gr4vy/sdk/models/components/TransactionAuthorizationIncrementCreate.java
@@ -0,0 +1,106 @@
+/*
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
+ */
+package com.gr4vy.sdk.models.components;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.gr4vy.sdk.utils.Utils;
+import java.lang.Long;
+import java.lang.Override;
+import java.lang.String;
+
+
+public class TransactionAuthorizationIncrementCreate {
+ /**
+ * The amount by which to increment the authorization, in the smallest currency unit of the
+ * transaction's currency. For example, `1299` cents to increment the authorization by `$12.99`.
+ */
+ @JsonProperty("amount")
+ private long amount;
+
+ @JsonCreator
+ public TransactionAuthorizationIncrementCreate(
+ @JsonProperty("amount") long amount) {
+ Utils.checkNotNull(amount, "amount");
+ this.amount = amount;
+ }
+
+ /**
+ * The amount by which to increment the authorization, in the smallest currency unit of the
+ * transaction's currency. For example, `1299` cents to increment the authorization by `$12.99`.
+ */
+ @JsonIgnore
+ public long amount() {
+ return amount;
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+
+ /**
+ * The amount by which to increment the authorization, in the smallest currency unit of the
+ * transaction's currency. For example, `1299` cents to increment the authorization by `$12.99`.
+ */
+ public TransactionAuthorizationIncrementCreate withAmount(long amount) {
+ Utils.checkNotNull(amount, "amount");
+ this.amount = amount;
+ return this;
+ }
+
+ @Override
+ public boolean equals(java.lang.Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ TransactionAuthorizationIncrementCreate other = (TransactionAuthorizationIncrementCreate) o;
+ return
+ Utils.enhancedDeepEquals(this.amount, other.amount);
+ }
+
+ @Override
+ public int hashCode() {
+ return Utils.enhancedHash(
+ amount);
+ }
+
+ @Override
+ public String toString() {
+ return Utils.toString(TransactionAuthorizationIncrementCreate.class,
+ "amount", amount);
+ }
+
+ @SuppressWarnings("UnusedReturnValue")
+ public final static class Builder {
+
+ private Long amount;
+
+ private Builder() {
+ // force use of static builder() method
+ }
+
+
+ /**
+ * The amount by which to increment the authorization, in the smallest currency unit of the
+ * transaction's currency. For example, `1299` cents to increment the authorization by `$12.99`.
+ */
+ public Builder amount(long amount) {
+ Utils.checkNotNull(amount, "amount");
+ this.amount = amount;
+ return this;
+ }
+
+ public TransactionAuthorizationIncrementCreate build() {
+
+ return new TransactionAuthorizationIncrementCreate(
+ amount);
+ }
+
+ }
+}
diff --git a/src/main/java/com/gr4vy/sdk/models/operations/IncrementTransactionAuthorizationRequest.java b/src/main/java/com/gr4vy/sdk/models/operations/IncrementTransactionAuthorizationRequest.java
new file mode 100644
index 00000000..b1c92a27
--- /dev/null
+++ b/src/main/java/com/gr4vy/sdk/models/operations/IncrementTransactionAuthorizationRequest.java
@@ -0,0 +1,269 @@
+/*
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
+ */
+package com.gr4vy.sdk.models.operations;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.gr4vy.sdk.models.components.TransactionAuthorizationIncrementCreate;
+import com.gr4vy.sdk.utils.SpeakeasyMetadata;
+import com.gr4vy.sdk.utils.Utils;
+import java.lang.Override;
+import java.lang.String;
+import org.openapitools.jackson.nullable.JsonNullable;
+
+
+public class IncrementTransactionAuthorizationRequest {
+ /**
+ * The unique identifier of the transaction.
+ */
+ @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=transaction_id")
+ private String transactionId;
+
+ /**
+ * The ID of the merchant account to use for this request.
+ */
+ @SpeakeasyMetadata("header:style=simple,explode=false,name=x-gr4vy-merchant-account-id")
+ private JsonNullable merchantAccountId;
+
+ /**
+ * A unique key that identifies this request. Providing this header will make this an idempotent
+ * request. We recommend using V4 UUIDs, or another random string with enough entropy to avoid
+ * collisions.
+ */
+ @SpeakeasyMetadata("header:style=simple,explode=false,name=idempotency-key")
+ private JsonNullable idempotencyKey;
+
+
+ @SpeakeasyMetadata("request:mediaType=application/json")
+ private TransactionAuthorizationIncrementCreate transactionAuthorizationIncrementCreate;
+
+ @JsonCreator
+ public IncrementTransactionAuthorizationRequest(
+ String transactionId,
+ JsonNullable merchantAccountId,
+ JsonNullable idempotencyKey,
+ TransactionAuthorizationIncrementCreate transactionAuthorizationIncrementCreate) {
+ Utils.checkNotNull(transactionId, "transactionId");
+ Utils.checkNotNull(merchantAccountId, "merchantAccountId");
+ Utils.checkNotNull(idempotencyKey, "idempotencyKey");
+ Utils.checkNotNull(transactionAuthorizationIncrementCreate, "transactionAuthorizationIncrementCreate");
+ this.transactionId = transactionId;
+ this.merchantAccountId = merchantAccountId;
+ this.idempotencyKey = idempotencyKey;
+ this.transactionAuthorizationIncrementCreate = transactionAuthorizationIncrementCreate;
+ }
+
+ public IncrementTransactionAuthorizationRequest(
+ String transactionId,
+ TransactionAuthorizationIncrementCreate transactionAuthorizationIncrementCreate) {
+ this(transactionId, JsonNullable.undefined(), JsonNullable.undefined(),
+ transactionAuthorizationIncrementCreate);
+ }
+
+ /**
+ * The unique identifier of the transaction.
+ */
+ @JsonIgnore
+ public String transactionId() {
+ return transactionId;
+ }
+
+ /**
+ * The ID of the merchant account to use for this request.
+ */
+ @JsonIgnore
+ public JsonNullable merchantAccountId() {
+ return merchantAccountId;
+ }
+
+ /**
+ * A unique key that identifies this request. Providing this header will make this an idempotent
+ * request. We recommend using V4 UUIDs, or another random string with enough entropy to avoid
+ * collisions.
+ */
+ @JsonIgnore
+ public JsonNullable idempotencyKey() {
+ return idempotencyKey;
+ }
+
+ @JsonIgnore
+ public TransactionAuthorizationIncrementCreate transactionAuthorizationIncrementCreate() {
+ return transactionAuthorizationIncrementCreate;
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+
+ /**
+ * The unique identifier of the transaction.
+ */
+ public IncrementTransactionAuthorizationRequest withTransactionId(String transactionId) {
+ Utils.checkNotNull(transactionId, "transactionId");
+ this.transactionId = transactionId;
+ return this;
+ }
+
+ /**
+ * The ID of the merchant account to use for this request.
+ */
+ public IncrementTransactionAuthorizationRequest withMerchantAccountId(String merchantAccountId) {
+ Utils.checkNotNull(merchantAccountId, "merchantAccountId");
+ this.merchantAccountId = JsonNullable.of(merchantAccountId);
+ return this;
+ }
+
+ /**
+ * The ID of the merchant account to use for this request.
+ */
+ public IncrementTransactionAuthorizationRequest withMerchantAccountId(JsonNullable merchantAccountId) {
+ Utils.checkNotNull(merchantAccountId, "merchantAccountId");
+ this.merchantAccountId = merchantAccountId;
+ return this;
+ }
+
+ /**
+ * A unique key that identifies this request. Providing this header will make this an idempotent
+ * request. We recommend using V4 UUIDs, or another random string with enough entropy to avoid
+ * collisions.
+ */
+ public IncrementTransactionAuthorizationRequest withIdempotencyKey(String idempotencyKey) {
+ Utils.checkNotNull(idempotencyKey, "idempotencyKey");
+ this.idempotencyKey = JsonNullable.of(idempotencyKey);
+ return this;
+ }
+
+ /**
+ * A unique key that identifies this request. Providing this header will make this an idempotent
+ * request. We recommend using V4 UUIDs, or another random string with enough entropy to avoid
+ * collisions.
+ */
+ public IncrementTransactionAuthorizationRequest withIdempotencyKey(JsonNullable idempotencyKey) {
+ Utils.checkNotNull(idempotencyKey, "idempotencyKey");
+ this.idempotencyKey = idempotencyKey;
+ return this;
+ }
+
+ public IncrementTransactionAuthorizationRequest withTransactionAuthorizationIncrementCreate(TransactionAuthorizationIncrementCreate transactionAuthorizationIncrementCreate) {
+ Utils.checkNotNull(transactionAuthorizationIncrementCreate, "transactionAuthorizationIncrementCreate");
+ this.transactionAuthorizationIncrementCreate = transactionAuthorizationIncrementCreate;
+ return this;
+ }
+
+ @Override
+ public boolean equals(java.lang.Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ IncrementTransactionAuthorizationRequest other = (IncrementTransactionAuthorizationRequest) o;
+ return
+ Utils.enhancedDeepEquals(this.transactionId, other.transactionId) &&
+ Utils.enhancedDeepEquals(this.merchantAccountId, other.merchantAccountId) &&
+ Utils.enhancedDeepEquals(this.idempotencyKey, other.idempotencyKey) &&
+ Utils.enhancedDeepEquals(this.transactionAuthorizationIncrementCreate, other.transactionAuthorizationIncrementCreate);
+ }
+
+ @Override
+ public int hashCode() {
+ return Utils.enhancedHash(
+ transactionId, merchantAccountId, idempotencyKey,
+ transactionAuthorizationIncrementCreate);
+ }
+
+ @Override
+ public String toString() {
+ return Utils.toString(IncrementTransactionAuthorizationRequest.class,
+ "transactionId", transactionId,
+ "merchantAccountId", merchantAccountId,
+ "idempotencyKey", idempotencyKey,
+ "transactionAuthorizationIncrementCreate", transactionAuthorizationIncrementCreate);
+ }
+
+ @SuppressWarnings("UnusedReturnValue")
+ public final static class Builder {
+
+ private String transactionId;
+
+ private JsonNullable merchantAccountId = JsonNullable.undefined();
+
+ private JsonNullable idempotencyKey = JsonNullable.undefined();
+
+ private TransactionAuthorizationIncrementCreate transactionAuthorizationIncrementCreate;
+
+ private Builder() {
+ // force use of static builder() method
+ }
+
+
+ /**
+ * The unique identifier of the transaction.
+ */
+ public Builder transactionId(String transactionId) {
+ Utils.checkNotNull(transactionId, "transactionId");
+ this.transactionId = transactionId;
+ return this;
+ }
+
+
+ /**
+ * The ID of the merchant account to use for this request.
+ */
+ public Builder merchantAccountId(String merchantAccountId) {
+ Utils.checkNotNull(merchantAccountId, "merchantAccountId");
+ this.merchantAccountId = JsonNullable.of(merchantAccountId);
+ return this;
+ }
+
+ /**
+ * The ID of the merchant account to use for this request.
+ */
+ public Builder merchantAccountId(JsonNullable merchantAccountId) {
+ Utils.checkNotNull(merchantAccountId, "merchantAccountId");
+ this.merchantAccountId = merchantAccountId;
+ return this;
+ }
+
+
+ /**
+ * A unique key that identifies this request. Providing this header will make this an idempotent
+ * request. We recommend using V4 UUIDs, or another random string with enough entropy to avoid
+ * collisions.
+ */
+ public Builder idempotencyKey(String idempotencyKey) {
+ Utils.checkNotNull(idempotencyKey, "idempotencyKey");
+ this.idempotencyKey = JsonNullable.of(idempotencyKey);
+ return this;
+ }
+
+ /**
+ * A unique key that identifies this request. Providing this header will make this an idempotent
+ * request. We recommend using V4 UUIDs, or another random string with enough entropy to avoid
+ * collisions.
+ */
+ public Builder idempotencyKey(JsonNullable idempotencyKey) {
+ Utils.checkNotNull(idempotencyKey, "idempotencyKey");
+ this.idempotencyKey = idempotencyKey;
+ return this;
+ }
+
+
+ public Builder transactionAuthorizationIncrementCreate(TransactionAuthorizationIncrementCreate transactionAuthorizationIncrementCreate) {
+ Utils.checkNotNull(transactionAuthorizationIncrementCreate, "transactionAuthorizationIncrementCreate");
+ this.transactionAuthorizationIncrementCreate = transactionAuthorizationIncrementCreate;
+ return this;
+ }
+
+ public IncrementTransactionAuthorizationRequest build() {
+
+ return new IncrementTransactionAuthorizationRequest(
+ transactionId, merchantAccountId, idempotencyKey,
+ transactionAuthorizationIncrementCreate);
+ }
+
+ }
+}
diff --git a/src/main/java/com/gr4vy/sdk/models/operations/IncrementTransactionAuthorizationRequestBuilder.java b/src/main/java/com/gr4vy/sdk/models/operations/IncrementTransactionAuthorizationRequestBuilder.java
new file mode 100644
index 00000000..2495aff5
--- /dev/null
+++ b/src/main/java/com/gr4vy/sdk/models/operations/IncrementTransactionAuthorizationRequestBuilder.java
@@ -0,0 +1,84 @@
+/*
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
+ */
+package com.gr4vy.sdk.models.operations;
+
+import static com.gr4vy.sdk.operations.Operations.RequestOperation;
+
+import com.gr4vy.sdk.SDKConfiguration;
+import com.gr4vy.sdk.models.components.TransactionAuthorizationIncrementCreate;
+import com.gr4vy.sdk.operations.IncrementTransactionAuthorization;
+import com.gr4vy.sdk.utils.Headers;
+import com.gr4vy.sdk.utils.Utils;
+import java.lang.String;
+import org.openapitools.jackson.nullable.JsonNullable;
+
+public class IncrementTransactionAuthorizationRequestBuilder {
+
+ private String transactionId;
+ private JsonNullable merchantAccountId = JsonNullable.undefined();
+ private JsonNullable idempotencyKey = JsonNullable.undefined();
+ private TransactionAuthorizationIncrementCreate transactionAuthorizationIncrementCreate;
+ private final SDKConfiguration sdkConfiguration;
+ private final Headers _headers = new Headers();
+
+ public IncrementTransactionAuthorizationRequestBuilder(SDKConfiguration sdkConfiguration) {
+ this.sdkConfiguration = sdkConfiguration;
+ }
+
+ public IncrementTransactionAuthorizationRequestBuilder transactionId(String transactionId) {
+ Utils.checkNotNull(transactionId, "transactionId");
+ this.transactionId = transactionId;
+ return this;
+ }
+
+ public IncrementTransactionAuthorizationRequestBuilder merchantAccountId(String merchantAccountId) {
+ Utils.checkNotNull(merchantAccountId, "merchantAccountId");
+ this.merchantAccountId = JsonNullable.of(merchantAccountId);
+ return this;
+ }
+
+ public IncrementTransactionAuthorizationRequestBuilder merchantAccountId(JsonNullable merchantAccountId) {
+ Utils.checkNotNull(merchantAccountId, "merchantAccountId");
+ this.merchantAccountId = merchantAccountId;
+ return this;
+ }
+
+ public IncrementTransactionAuthorizationRequestBuilder idempotencyKey(String idempotencyKey) {
+ Utils.checkNotNull(idempotencyKey, "idempotencyKey");
+ this.idempotencyKey = JsonNullable.of(idempotencyKey);
+ return this;
+ }
+
+ public IncrementTransactionAuthorizationRequestBuilder idempotencyKey(JsonNullable idempotencyKey) {
+ Utils.checkNotNull(idempotencyKey, "idempotencyKey");
+ this.idempotencyKey = idempotencyKey;
+ return this;
+ }
+
+ public IncrementTransactionAuthorizationRequestBuilder transactionAuthorizationIncrementCreate(TransactionAuthorizationIncrementCreate transactionAuthorizationIncrementCreate) {
+ Utils.checkNotNull(transactionAuthorizationIncrementCreate, "transactionAuthorizationIncrementCreate");
+ this.transactionAuthorizationIncrementCreate = transactionAuthorizationIncrementCreate;
+ return this;
+ }
+
+
+ private IncrementTransactionAuthorizationRequest buildRequest() {
+
+ IncrementTransactionAuthorizationRequest request = new IncrementTransactionAuthorizationRequest(transactionId,
+ merchantAccountId,
+ idempotencyKey,
+ transactionAuthorizationIncrementCreate);
+
+ return request;
+ }
+
+ public IncrementTransactionAuthorizationResponse call() {
+
+ RequestOperation operation
+ = new IncrementTransactionAuthorization.Sync(sdkConfiguration, _headers);
+ IncrementTransactionAuthorizationRequest request = buildRequest();
+
+ return operation.handleResponse(operation.doRequest(request));
+ }
+}
diff --git a/src/main/java/com/gr4vy/sdk/models/operations/IncrementTransactionAuthorizationResponse.java b/src/main/java/com/gr4vy/sdk/models/operations/IncrementTransactionAuthorizationResponse.java
new file mode 100644
index 00000000..0e3cf189
--- /dev/null
+++ b/src/main/java/com/gr4vy/sdk/models/operations/IncrementTransactionAuthorizationResponse.java
@@ -0,0 +1,253 @@
+/*
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
+ */
+package com.gr4vy.sdk.models.operations;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.gr4vy.sdk.models.components.TransactionAuthorizationIncrement;
+import com.gr4vy.sdk.utils.Response;
+import com.gr4vy.sdk.utils.Utils;
+import java.io.InputStream;
+import java.lang.Integer;
+import java.lang.Override;
+import java.lang.String;
+import java.lang.SuppressWarnings;
+import java.net.http.HttpResponse;
+import java.util.Optional;
+
+
+public class IncrementTransactionAuthorizationResponse implements Response {
+ /**
+ * HTTP response content type for this operation
+ */
+ private String contentType;
+
+ /**
+ * HTTP response status code for this operation
+ */
+ private int statusCode;
+
+ /**
+ * Raw HTTP response; suitable for custom response parsing
+ */
+ private HttpResponse rawResponse;
+
+ /**
+ * Successful Response
+ */
+ private Optional extends TransactionAuthorizationIncrement> transactionAuthorizationIncrement;
+
+ @JsonCreator
+ public IncrementTransactionAuthorizationResponse(
+ String contentType,
+ int statusCode,
+ HttpResponse rawResponse,
+ Optional extends TransactionAuthorizationIncrement> transactionAuthorizationIncrement) {
+ Utils.checkNotNull(contentType, "contentType");
+ Utils.checkNotNull(statusCode, "statusCode");
+ Utils.checkNotNull(rawResponse, "rawResponse");
+ Utils.checkNotNull(transactionAuthorizationIncrement, "transactionAuthorizationIncrement");
+ this.contentType = contentType;
+ this.statusCode = statusCode;
+ this.rawResponse = rawResponse;
+ this.transactionAuthorizationIncrement = transactionAuthorizationIncrement;
+ }
+
+ public IncrementTransactionAuthorizationResponse(
+ String contentType,
+ int statusCode,
+ HttpResponse rawResponse) {
+ this(contentType, statusCode, rawResponse,
+ Optional.empty());
+ }
+
+ /**
+ * HTTP response content type for this operation
+ */
+ @JsonIgnore
+ public String contentType() {
+ return contentType;
+ }
+
+ /**
+ * HTTP response status code for this operation
+ */
+ @JsonIgnore
+ public int statusCode() {
+ return statusCode;
+ }
+
+ /**
+ * Raw HTTP response; suitable for custom response parsing
+ */
+ @JsonIgnore
+ public HttpResponse rawResponse() {
+ return rawResponse;
+ }
+
+ /**
+ * Successful Response
+ */
+ @SuppressWarnings("unchecked")
+ @JsonIgnore
+ public Optional transactionAuthorizationIncrement() {
+ return (Optional) transactionAuthorizationIncrement;
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+
+ /**
+ * HTTP response content type for this operation
+ */
+ public IncrementTransactionAuthorizationResponse withContentType(String contentType) {
+ Utils.checkNotNull(contentType, "contentType");
+ this.contentType = contentType;
+ return this;
+ }
+
+ /**
+ * HTTP response status code for this operation
+ */
+ public IncrementTransactionAuthorizationResponse withStatusCode(int statusCode) {
+ Utils.checkNotNull(statusCode, "statusCode");
+ this.statusCode = statusCode;
+ return this;
+ }
+
+ /**
+ * Raw HTTP response; suitable for custom response parsing
+ */
+ public IncrementTransactionAuthorizationResponse withRawResponse(HttpResponse rawResponse) {
+ Utils.checkNotNull(rawResponse, "rawResponse");
+ this.rawResponse = rawResponse;
+ return this;
+ }
+
+ /**
+ * Successful Response
+ */
+ public IncrementTransactionAuthorizationResponse withTransactionAuthorizationIncrement(TransactionAuthorizationIncrement transactionAuthorizationIncrement) {
+ Utils.checkNotNull(transactionAuthorizationIncrement, "transactionAuthorizationIncrement");
+ this.transactionAuthorizationIncrement = Optional.ofNullable(transactionAuthorizationIncrement);
+ return this;
+ }
+
+
+ /**
+ * Successful Response
+ */
+ public IncrementTransactionAuthorizationResponse withTransactionAuthorizationIncrement(Optional extends TransactionAuthorizationIncrement> transactionAuthorizationIncrement) {
+ Utils.checkNotNull(transactionAuthorizationIncrement, "transactionAuthorizationIncrement");
+ this.transactionAuthorizationIncrement = transactionAuthorizationIncrement;
+ return this;
+ }
+
+ @Override
+ public boolean equals(java.lang.Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ IncrementTransactionAuthorizationResponse other = (IncrementTransactionAuthorizationResponse) o;
+ return
+ Utils.enhancedDeepEquals(this.contentType, other.contentType) &&
+ Utils.enhancedDeepEquals(this.statusCode, other.statusCode) &&
+ Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) &&
+ Utils.enhancedDeepEquals(this.transactionAuthorizationIncrement, other.transactionAuthorizationIncrement);
+ }
+
+ @Override
+ public int hashCode() {
+ return Utils.enhancedHash(
+ contentType, statusCode, rawResponse,
+ transactionAuthorizationIncrement);
+ }
+
+ @Override
+ public String toString() {
+ return Utils.toString(IncrementTransactionAuthorizationResponse.class,
+ "contentType", contentType,
+ "statusCode", statusCode,
+ "rawResponse", rawResponse,
+ "transactionAuthorizationIncrement", transactionAuthorizationIncrement);
+ }
+
+ @SuppressWarnings("UnusedReturnValue")
+ public final static class Builder {
+
+ private String contentType;
+
+ private Integer statusCode;
+
+ private HttpResponse rawResponse;
+
+ private Optional extends TransactionAuthorizationIncrement> transactionAuthorizationIncrement = Optional.empty();
+
+ private Builder() {
+ // force use of static builder() method
+ }
+
+
+ /**
+ * HTTP response content type for this operation
+ */
+ public Builder contentType(String contentType) {
+ Utils.checkNotNull(contentType, "contentType");
+ this.contentType = contentType;
+ return this;
+ }
+
+
+ /**
+ * HTTP response status code for this operation
+ */
+ public Builder statusCode(int statusCode) {
+ Utils.checkNotNull(statusCode, "statusCode");
+ this.statusCode = statusCode;
+ return this;
+ }
+
+
+ /**
+ * Raw HTTP response; suitable for custom response parsing
+ */
+ public Builder rawResponse(HttpResponse rawResponse) {
+ Utils.checkNotNull(rawResponse, "rawResponse");
+ this.rawResponse = rawResponse;
+ return this;
+ }
+
+
+ /**
+ * Successful Response
+ */
+ public Builder transactionAuthorizationIncrement(TransactionAuthorizationIncrement transactionAuthorizationIncrement) {
+ Utils.checkNotNull(transactionAuthorizationIncrement, "transactionAuthorizationIncrement");
+ this.transactionAuthorizationIncrement = Optional.ofNullable(transactionAuthorizationIncrement);
+ return this;
+ }
+
+ /**
+ * Successful Response
+ */
+ public Builder transactionAuthorizationIncrement(Optional extends TransactionAuthorizationIncrement> transactionAuthorizationIncrement) {
+ Utils.checkNotNull(transactionAuthorizationIncrement, "transactionAuthorizationIncrement");
+ this.transactionAuthorizationIncrement = transactionAuthorizationIncrement;
+ return this;
+ }
+
+ public IncrementTransactionAuthorizationResponse build() {
+
+ return new IncrementTransactionAuthorizationResponse(
+ contentType, statusCode, rawResponse,
+ transactionAuthorizationIncrement);
+ }
+
+ }
+}
diff --git a/src/main/java/com/gr4vy/sdk/models/operations/async/IncrementTransactionAuthorizationRequestBuilder.java b/src/main/java/com/gr4vy/sdk/models/operations/async/IncrementTransactionAuthorizationRequestBuilder.java
new file mode 100644
index 00000000..591fa059
--- /dev/null
+++ b/src/main/java/com/gr4vy/sdk/models/operations/async/IncrementTransactionAuthorizationRequestBuilder.java
@@ -0,0 +1,87 @@
+/*
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
+ */
+package com.gr4vy.sdk.models.operations.async;
+
+import static com.gr4vy.sdk.operations.Operations.AsyncRequestOperation;
+
+import com.gr4vy.sdk.SDKConfiguration;
+import com.gr4vy.sdk.models.components.TransactionAuthorizationIncrementCreate;
+import com.gr4vy.sdk.models.operations.IncrementTransactionAuthorizationRequest;
+import com.gr4vy.sdk.operations.IncrementTransactionAuthorization;
+import com.gr4vy.sdk.utils.Headers;
+import com.gr4vy.sdk.utils.Utils;
+import java.lang.String;
+import java.util.concurrent.CompletableFuture;
+import org.openapitools.jackson.nullable.JsonNullable;
+
+public class IncrementTransactionAuthorizationRequestBuilder {
+
+ private String transactionId;
+ private JsonNullable merchantAccountId = JsonNullable.undefined();
+ private JsonNullable idempotencyKey = JsonNullable.undefined();
+ private TransactionAuthorizationIncrementCreate transactionAuthorizationIncrementCreate;
+ private final SDKConfiguration sdkConfiguration;
+ private final Headers _headers = new Headers();
+
+ public IncrementTransactionAuthorizationRequestBuilder(SDKConfiguration sdkConfiguration) {
+ this.sdkConfiguration = sdkConfiguration;
+ }
+
+ public IncrementTransactionAuthorizationRequestBuilder transactionId(String transactionId) {
+ Utils.checkNotNull(transactionId, "transactionId");
+ this.transactionId = transactionId;
+ return this;
+ }
+
+ public IncrementTransactionAuthorizationRequestBuilder merchantAccountId(String merchantAccountId) {
+ Utils.checkNotNull(merchantAccountId, "merchantAccountId");
+ this.merchantAccountId = JsonNullable.of(merchantAccountId);
+ return this;
+ }
+
+ public IncrementTransactionAuthorizationRequestBuilder merchantAccountId(JsonNullable merchantAccountId) {
+ Utils.checkNotNull(merchantAccountId, "merchantAccountId");
+ this.merchantAccountId = merchantAccountId;
+ return this;
+ }
+
+ public IncrementTransactionAuthorizationRequestBuilder idempotencyKey(String idempotencyKey) {
+ Utils.checkNotNull(idempotencyKey, "idempotencyKey");
+ this.idempotencyKey = JsonNullable.of(idempotencyKey);
+ return this;
+ }
+
+ public IncrementTransactionAuthorizationRequestBuilder idempotencyKey(JsonNullable idempotencyKey) {
+ Utils.checkNotNull(idempotencyKey, "idempotencyKey");
+ this.idempotencyKey = idempotencyKey;
+ return this;
+ }
+
+ public IncrementTransactionAuthorizationRequestBuilder transactionAuthorizationIncrementCreate(TransactionAuthorizationIncrementCreate transactionAuthorizationIncrementCreate) {
+ Utils.checkNotNull(transactionAuthorizationIncrementCreate, "transactionAuthorizationIncrementCreate");
+ this.transactionAuthorizationIncrementCreate = transactionAuthorizationIncrementCreate;
+ return this;
+ }
+
+
+ private IncrementTransactionAuthorizationRequest buildRequest() {
+
+ IncrementTransactionAuthorizationRequest request = new IncrementTransactionAuthorizationRequest(transactionId,
+ merchantAccountId,
+ idempotencyKey,
+ transactionAuthorizationIncrementCreate);
+
+ return request;
+ }
+
+ public CompletableFuture call() {
+
+ AsyncRequestOperation operation
+ = new IncrementTransactionAuthorization.Async(sdkConfiguration, _headers);
+ IncrementTransactionAuthorizationRequest request = buildRequest();
+
+ return operation.doRequest(request)
+ .thenCompose(operation::handleResponse);
+ }
+}
diff --git a/src/main/java/com/gr4vy/sdk/models/operations/async/IncrementTransactionAuthorizationResponse.java b/src/main/java/com/gr4vy/sdk/models/operations/async/IncrementTransactionAuthorizationResponse.java
new file mode 100644
index 00000000..8c4d8563
--- /dev/null
+++ b/src/main/java/com/gr4vy/sdk/models/operations/async/IncrementTransactionAuthorizationResponse.java
@@ -0,0 +1,253 @@
+/*
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
+ */
+package com.gr4vy.sdk.models.operations.async;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.gr4vy.sdk.models.components.TransactionAuthorizationIncrement;
+import com.gr4vy.sdk.utils.AsyncResponse;
+import com.gr4vy.sdk.utils.Blob;
+import com.gr4vy.sdk.utils.Utils;
+import java.lang.Integer;
+import java.lang.Override;
+import java.lang.String;
+import java.lang.SuppressWarnings;
+import java.net.http.HttpResponse;
+import java.util.Optional;
+
+
+public class IncrementTransactionAuthorizationResponse implements AsyncResponse {
+ /**
+ * HTTP response content type for this operation
+ */
+ private String contentType;
+
+ /**
+ * HTTP response status code for this operation
+ */
+ private int statusCode;
+
+ /**
+ * Raw HTTP response; suitable for custom response parsing
+ */
+ private HttpResponse rawResponse;
+
+ /**
+ * Successful Response
+ */
+ private Optional extends TransactionAuthorizationIncrement> transactionAuthorizationIncrement;
+
+ @JsonCreator
+ public IncrementTransactionAuthorizationResponse(
+ String contentType,
+ int statusCode,
+ HttpResponse rawResponse,
+ Optional extends TransactionAuthorizationIncrement> transactionAuthorizationIncrement) {
+ Utils.checkNotNull(contentType, "contentType");
+ Utils.checkNotNull(statusCode, "statusCode");
+ Utils.checkNotNull(rawResponse, "rawResponse");
+ Utils.checkNotNull(transactionAuthorizationIncrement, "transactionAuthorizationIncrement");
+ this.contentType = contentType;
+ this.statusCode = statusCode;
+ this.rawResponse = rawResponse;
+ this.transactionAuthorizationIncrement = transactionAuthorizationIncrement;
+ }
+
+ public IncrementTransactionAuthorizationResponse(
+ String contentType,
+ int statusCode,
+ HttpResponse rawResponse) {
+ this(contentType, statusCode, rawResponse,
+ Optional.empty());
+ }
+
+ /**
+ * HTTP response content type for this operation
+ */
+ @JsonIgnore
+ public String contentType() {
+ return contentType;
+ }
+
+ /**
+ * HTTP response status code for this operation
+ */
+ @JsonIgnore
+ public int statusCode() {
+ return statusCode;
+ }
+
+ /**
+ * Raw HTTP response; suitable for custom response parsing
+ */
+ @JsonIgnore
+ public HttpResponse rawResponse() {
+ return rawResponse;
+ }
+
+ /**
+ * Successful Response
+ */
+ @SuppressWarnings("unchecked")
+ @JsonIgnore
+ public Optional transactionAuthorizationIncrement() {
+ return (Optional) transactionAuthorizationIncrement;
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+
+ /**
+ * HTTP response content type for this operation
+ */
+ public IncrementTransactionAuthorizationResponse withContentType(String contentType) {
+ Utils.checkNotNull(contentType, "contentType");
+ this.contentType = contentType;
+ return this;
+ }
+
+ /**
+ * HTTP response status code for this operation
+ */
+ public IncrementTransactionAuthorizationResponse withStatusCode(int statusCode) {
+ Utils.checkNotNull(statusCode, "statusCode");
+ this.statusCode = statusCode;
+ return this;
+ }
+
+ /**
+ * Raw HTTP response; suitable for custom response parsing
+ */
+ public IncrementTransactionAuthorizationResponse withRawResponse(HttpResponse rawResponse) {
+ Utils.checkNotNull(rawResponse, "rawResponse");
+ this.rawResponse = rawResponse;
+ return this;
+ }
+
+ /**
+ * Successful Response
+ */
+ public IncrementTransactionAuthorizationResponse withTransactionAuthorizationIncrement(TransactionAuthorizationIncrement transactionAuthorizationIncrement) {
+ Utils.checkNotNull(transactionAuthorizationIncrement, "transactionAuthorizationIncrement");
+ this.transactionAuthorizationIncrement = Optional.ofNullable(transactionAuthorizationIncrement);
+ return this;
+ }
+
+
+ /**
+ * Successful Response
+ */
+ public IncrementTransactionAuthorizationResponse withTransactionAuthorizationIncrement(Optional extends TransactionAuthorizationIncrement> transactionAuthorizationIncrement) {
+ Utils.checkNotNull(transactionAuthorizationIncrement, "transactionAuthorizationIncrement");
+ this.transactionAuthorizationIncrement = transactionAuthorizationIncrement;
+ return this;
+ }
+
+ @Override
+ public boolean equals(java.lang.Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ IncrementTransactionAuthorizationResponse other = (IncrementTransactionAuthorizationResponse) o;
+ return
+ Utils.enhancedDeepEquals(this.contentType, other.contentType) &&
+ Utils.enhancedDeepEquals(this.statusCode, other.statusCode) &&
+ Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) &&
+ Utils.enhancedDeepEquals(this.transactionAuthorizationIncrement, other.transactionAuthorizationIncrement);
+ }
+
+ @Override
+ public int hashCode() {
+ return Utils.enhancedHash(
+ contentType, statusCode, rawResponse,
+ transactionAuthorizationIncrement);
+ }
+
+ @Override
+ public String toString() {
+ return Utils.toString(IncrementTransactionAuthorizationResponse.class,
+ "contentType", contentType,
+ "statusCode", statusCode,
+ "rawResponse", rawResponse,
+ "transactionAuthorizationIncrement", transactionAuthorizationIncrement);
+ }
+
+ @SuppressWarnings("UnusedReturnValue")
+ public final static class Builder {
+
+ private String contentType;
+
+ private Integer statusCode;
+
+ private HttpResponse rawResponse;
+
+ private Optional extends TransactionAuthorizationIncrement> transactionAuthorizationIncrement = Optional.empty();
+
+ private Builder() {
+ // force use of static builder() method
+ }
+
+
+ /**
+ * HTTP response content type for this operation
+ */
+ public Builder contentType(String contentType) {
+ Utils.checkNotNull(contentType, "contentType");
+ this.contentType = contentType;
+ return this;
+ }
+
+
+ /**
+ * HTTP response status code for this operation
+ */
+ public Builder statusCode(int statusCode) {
+ Utils.checkNotNull(statusCode, "statusCode");
+ this.statusCode = statusCode;
+ return this;
+ }
+
+
+ /**
+ * Raw HTTP response; suitable for custom response parsing
+ */
+ public Builder rawResponse(HttpResponse rawResponse) {
+ Utils.checkNotNull(rawResponse, "rawResponse");
+ this.rawResponse = rawResponse;
+ return this;
+ }
+
+
+ /**
+ * Successful Response
+ */
+ public Builder transactionAuthorizationIncrement(TransactionAuthorizationIncrement transactionAuthorizationIncrement) {
+ Utils.checkNotNull(transactionAuthorizationIncrement, "transactionAuthorizationIncrement");
+ this.transactionAuthorizationIncrement = Optional.ofNullable(transactionAuthorizationIncrement);
+ return this;
+ }
+
+ /**
+ * Successful Response
+ */
+ public Builder transactionAuthorizationIncrement(Optional extends TransactionAuthorizationIncrement> transactionAuthorizationIncrement) {
+ Utils.checkNotNull(transactionAuthorizationIncrement, "transactionAuthorizationIncrement");
+ this.transactionAuthorizationIncrement = transactionAuthorizationIncrement;
+ return this;
+ }
+
+ public IncrementTransactionAuthorizationResponse build() {
+
+ return new IncrementTransactionAuthorizationResponse(
+ contentType, statusCode, rawResponse,
+ transactionAuthorizationIncrement);
+ }
+
+ }
+}
diff --git a/src/main/java/com/gr4vy/sdk/operations/IncrementTransactionAuthorization.java b/src/main/java/com/gr4vy/sdk/operations/IncrementTransactionAuthorization.java
new file mode 100644
index 00000000..f82708b0
--- /dev/null
+++ b/src/main/java/com/gr4vy/sdk/operations/IncrementTransactionAuthorization.java
@@ -0,0 +1,460 @@
+/*
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
+ */
+package com.gr4vy.sdk.operations;
+
+import static com.gr4vy.sdk.operations.Operations.RequestOperation;
+import static com.gr4vy.sdk.utils.Exceptions.unchecked;
+import static com.gr4vy.sdk.operations.Operations.AsyncRequestOperation;
+
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.gr4vy.sdk.SDKConfiguration;
+import com.gr4vy.sdk.SecuritySource;
+import com.gr4vy.sdk.models.components.TransactionAuthorizationIncrement;
+import com.gr4vy.sdk.models.errors.APIException;
+import com.gr4vy.sdk.models.errors.Error400;
+import com.gr4vy.sdk.models.errors.Error401;
+import com.gr4vy.sdk.models.errors.Error403;
+import com.gr4vy.sdk.models.errors.Error404;
+import com.gr4vy.sdk.models.errors.Error405;
+import com.gr4vy.sdk.models.errors.Error409;
+import com.gr4vy.sdk.models.errors.Error425;
+import com.gr4vy.sdk.models.errors.Error429;
+import com.gr4vy.sdk.models.errors.Error500;
+import com.gr4vy.sdk.models.errors.Error502;
+import com.gr4vy.sdk.models.errors.Error504;
+import com.gr4vy.sdk.models.errors.HTTPValidationError;
+import com.gr4vy.sdk.models.operations.IncrementTransactionAuthorizationRequest;
+import com.gr4vy.sdk.models.operations.IncrementTransactionAuthorizationResponse;
+import com.gr4vy.sdk.utils.Blob;
+import com.gr4vy.sdk.utils.Globals;
+import com.gr4vy.sdk.utils.HTTPClient;
+import com.gr4vy.sdk.utils.HTTPRequest;
+import com.gr4vy.sdk.utils.Headers;
+import com.gr4vy.sdk.utils.Hook.AfterErrorContextImpl;
+import com.gr4vy.sdk.utils.Hook.AfterSuccessContextImpl;
+import com.gr4vy.sdk.utils.Hook.BeforeRequestContextImpl;
+import com.gr4vy.sdk.utils.SerializedBody;
+import com.gr4vy.sdk.utils.Utils.JsonShape;
+import com.gr4vy.sdk.utils.Utils;
+import java.io.InputStream;
+import java.lang.Exception;
+import java.lang.IllegalArgumentException;
+import java.lang.Object;
+import java.lang.String;
+import java.lang.Throwable;
+import java.net.http.HttpRequest;
+import java.net.http.HttpResponse;
+import java.util.Optional;
+import java.util.concurrent.CompletableFuture;
+import java.util.function.Function;
+
+
+public class IncrementTransactionAuthorization {
+
+ static abstract class Base {
+ final SDKConfiguration sdkConfiguration;
+ final String baseUrl;
+ final SecuritySource securitySource;
+ final HTTPClient client;
+ final Headers _headers;
+ final Globals operationGlobals;
+
+ public Base(SDKConfiguration sdkConfiguration, Headers _headers) {
+ this.sdkConfiguration = sdkConfiguration;
+ this._headers =_headers;
+ this.baseUrl = Utils.templateUrl(
+ this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults());
+ this.securitySource = this.sdkConfiguration.securitySource();
+ this.client = this.sdkConfiguration.client();
+ this.operationGlobals = new Globals();
+ this.sdkConfiguration.globals.getParam("header", "x-gr4vy-merchant-account-id")
+ .ifPresent(param -> operationGlobals.putParam("header", "x-gr4vy-merchant-account-id", param));
+ }
+
+ Optional securitySource() {
+ return Optional.ofNullable(this.securitySource);
+ }
+
+ BeforeRequestContextImpl createBeforeRequestContext() {
+ return new BeforeRequestContextImpl(
+ this.sdkConfiguration,
+ this.baseUrl,
+ "increment_transaction_authorization",
+ java.util.Optional.empty(),
+ securitySource());
+ }
+
+ AfterSuccessContextImpl createAfterSuccessContext() {
+ return new AfterSuccessContextImpl(
+ this.sdkConfiguration,
+ this.baseUrl,
+ "increment_transaction_authorization",
+ java.util.Optional.empty(),
+ securitySource());
+ }
+
+ AfterErrorContextImpl createAfterErrorContext() {
+ return new AfterErrorContextImpl(
+ this.sdkConfiguration,
+ this.baseUrl,
+ "increment_transaction_authorization",
+ java.util.Optional.empty(),
+ securitySource());
+ }
+ HttpRequest buildRequest(T request, Class klass, TypeReference typeReference) throws Exception {
+ String url = Utils.generateURL(
+ klass,
+ this.baseUrl,
+ "/transactions/{transaction_id}/authorization/increment",
+ request, this.operationGlobals);
+ HTTPRequest req = new HTTPRequest(url, "POST");
+ Object convertedRequest = Utils.convertToShape(
+ request,
+ JsonShape.DEFAULT,
+ typeReference);
+ SerializedBody serializedRequestBody = Utils.serializeRequestBody(
+ convertedRequest,
+ "transactionAuthorizationIncrementCreate",
+ "json",
+ false);
+ if (serializedRequestBody == null) {
+ throw new IllegalArgumentException("Request body is required");
+ }
+ req.setBody(Optional.ofNullable(serializedRequestBody));
+ req.addHeader("Accept", "application/json")
+ .addHeader("user-agent", SDKConfiguration.USER_AGENT);
+ _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v)));
+ req.addHeaders(Utils.getHeadersFromMetadata(request, this.operationGlobals));
+ Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity());
+
+ return req.build();
+ }
+ }
+
+ public static class Sync extends Base
+ implements RequestOperation {
+ public Sync(SDKConfiguration sdkConfiguration, Headers _headers) {
+ super(sdkConfiguration, _headers);
+ }
+
+ private HttpRequest onBuildRequest(IncrementTransactionAuthorizationRequest request) throws Exception {
+ HttpRequest req = buildRequest(request, IncrementTransactionAuthorizationRequest.class, new TypeReference() {});
+ return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req);
+ }
+
+ private HttpResponse onError(HttpResponse response, Exception error) throws Exception {
+ return sdkConfiguration.hooks().afterError(
+ createAfterErrorContext(),
+ Optional.ofNullable(response),
+ Optional.ofNullable(error));
+ }
+
+ private HttpResponse onSuccess(HttpResponse response) throws Exception {
+ return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response);
+ }
+
+ @Override
+ public HttpResponse doRequest(IncrementTransactionAuthorizationRequest request) {
+ HttpRequest r = unchecked(() -> onBuildRequest(request)).get();
+ HttpResponse httpRes;
+ try {
+ httpRes = client.send(r);
+ if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) {
+ httpRes = onError(httpRes, null);
+ } else {
+ httpRes = onSuccess(httpRes);
+ }
+ } catch (Exception e) {
+ httpRes = unchecked(() -> onError(null, e)).get();
+ }
+
+ return httpRes;
+ }
+
+
+ @Override
+ public IncrementTransactionAuthorizationResponse handleResponse(HttpResponse response) {
+ String contentType = response
+ .headers()
+ .firstValue("Content-Type")
+ .orElse("application/octet-stream");
+ IncrementTransactionAuthorizationResponse.Builder resBuilder =
+ IncrementTransactionAuthorizationResponse
+ .builder()
+ .contentType(contentType)
+ .statusCode(response.statusCode())
+ .rawResponse(response);
+
+ IncrementTransactionAuthorizationResponse res = resBuilder.build();
+
+ if (Utils.statusCodeMatches(response.statusCode(), "200")) {
+ if (Utils.contentTypeMatches(contentType, "application/json")) {
+ return res.withTransactionAuthorizationIncrement(Utils.unmarshal(response, new TypeReference() {}));
+ } else {
+ throw APIException.from("Unexpected content-type received: " + contentType, response);
+ }
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "400")) {
+ if (Utils.contentTypeMatches(contentType, "application/json")) {
+ throw Error400.from(response);
+ } else {
+ throw APIException.from("Unexpected content-type received: " + contentType, response);
+ }
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "401")) {
+ if (Utils.contentTypeMatches(contentType, "application/json")) {
+ throw Error401.from(response);
+ } else {
+ throw APIException.from("Unexpected content-type received: " + contentType, response);
+ }
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "403")) {
+ if (Utils.contentTypeMatches(contentType, "application/json")) {
+ throw Error403.from(response);
+ } else {
+ throw APIException.from("Unexpected content-type received: " + contentType, response);
+ }
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "404")) {
+ if (Utils.contentTypeMatches(contentType, "application/json")) {
+ throw Error404.from(response);
+ } else {
+ throw APIException.from("Unexpected content-type received: " + contentType, response);
+ }
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "405")) {
+ if (Utils.contentTypeMatches(contentType, "application/json")) {
+ throw Error405.from(response);
+ } else {
+ throw APIException.from("Unexpected content-type received: " + contentType, response);
+ }
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "409")) {
+ if (Utils.contentTypeMatches(contentType, "application/json")) {
+ throw Error409.from(response);
+ } else {
+ throw APIException.from("Unexpected content-type received: " + contentType, response);
+ }
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "422")) {
+ if (Utils.contentTypeMatches(contentType, "application/json")) {
+ throw HTTPValidationError.from(response);
+ } else {
+ throw APIException.from("Unexpected content-type received: " + contentType, response);
+ }
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "425")) {
+ if (Utils.contentTypeMatches(contentType, "application/json")) {
+ throw Error425.from(response);
+ } else {
+ throw APIException.from("Unexpected content-type received: " + contentType, response);
+ }
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "429")) {
+ if (Utils.contentTypeMatches(contentType, "application/json")) {
+ throw Error429.from(response);
+ } else {
+ throw APIException.from("Unexpected content-type received: " + contentType, response);
+ }
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "500")) {
+ if (Utils.contentTypeMatches(contentType, "application/json")) {
+ throw Error500.from(response);
+ } else {
+ throw APIException.from("Unexpected content-type received: " + contentType, response);
+ }
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "502")) {
+ if (Utils.contentTypeMatches(contentType, "application/json")) {
+ throw Error502.from(response);
+ } else {
+ throw APIException.from("Unexpected content-type received: " + contentType, response);
+ }
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "504")) {
+ if (Utils.contentTypeMatches(contentType, "application/json")) {
+ throw Error504.from(response);
+ } else {
+ throw APIException.from("Unexpected content-type received: " + contentType, response);
+ }
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "4XX")) {
+ // no content
+ throw APIException.from("API error occurred", response);
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "5XX")) {
+ // no content
+ throw APIException.from("API error occurred", response);
+ }
+ throw APIException.from("Unexpected status code received: " + response.statusCode(), response);
+ }
+ }
+ public static class Async extends Base
+ implements AsyncRequestOperation {
+
+ public Async(SDKConfiguration sdkConfiguration, Headers _headers) {
+ super(sdkConfiguration, _headers);
+ }
+
+ private CompletableFuture onBuildRequest(IncrementTransactionAuthorizationRequest request) throws Exception {
+ HttpRequest req = buildRequest(request, IncrementTransactionAuthorizationRequest.class, new TypeReference() {});
+ return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req);
+ }
+
+ private CompletableFuture> onError(HttpResponse response, Throwable error) {
+ return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error);
+ }
+
+ private CompletableFuture> onSuccess(HttpResponse response) {
+ return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response);
+ }
+
+ @Override
+ public CompletableFuture> doRequest(IncrementTransactionAuthorizationRequest request) {
+ return unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync)
+ .handle((resp, err) -> {
+ if (err != null) {
+ return onError(null, err);
+ }
+ if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) {
+ return onError(resp, null);
+ }
+ return CompletableFuture.completedFuture(resp);
+ })
+ .thenCompose(Function.identity())
+ .thenCompose(this::onSuccess);
+ }
+
+ @Override
+ public CompletableFuture handleResponse(
+ HttpResponse response) {
+ String contentType = response
+ .headers()
+ .firstValue("Content-Type")
+ .orElse("application/octet-stream");
+ com.gr4vy.sdk.models.operations.async.IncrementTransactionAuthorizationResponse.Builder resBuilder =
+ com.gr4vy.sdk.models.operations.async.IncrementTransactionAuthorizationResponse
+ .builder()
+ .contentType(contentType)
+ .statusCode(response.statusCode())
+ .rawResponse(response);
+
+ com.gr4vy.sdk.models.operations.async.IncrementTransactionAuthorizationResponse res = resBuilder.build();
+
+ if (Utils.statusCodeMatches(response.statusCode(), "200")) {
+ if (Utils.contentTypeMatches(contentType, "application/json")) {
+ return Utils.unmarshalAsync(response, new TypeReference() {})
+ .thenApply(res::withTransactionAuthorizationIncrement);
+ } else {
+ return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType);
+ }
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "400")) {
+ if (Utils.contentTypeMatches(contentType, "application/json")) {
+ return Error400.fromAsync(response)
+ .thenCompose(CompletableFuture::failedFuture);
+ } else {
+ return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType);
+ }
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "401")) {
+ if (Utils.contentTypeMatches(contentType, "application/json")) {
+ return Error401.fromAsync(response)
+ .thenCompose(CompletableFuture::failedFuture);
+ } else {
+ return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType);
+ }
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "403")) {
+ if (Utils.contentTypeMatches(contentType, "application/json")) {
+ return Error403.fromAsync(response)
+ .thenCompose(CompletableFuture::failedFuture);
+ } else {
+ return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType);
+ }
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "404")) {
+ if (Utils.contentTypeMatches(contentType, "application/json")) {
+ return Error404.fromAsync(response)
+ .thenCompose(CompletableFuture::failedFuture);
+ } else {
+ return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType);
+ }
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "405")) {
+ if (Utils.contentTypeMatches(contentType, "application/json")) {
+ return Error405.fromAsync(response)
+ .thenCompose(CompletableFuture::failedFuture);
+ } else {
+ return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType);
+ }
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "409")) {
+ if (Utils.contentTypeMatches(contentType, "application/json")) {
+ return Error409.fromAsync(response)
+ .thenCompose(CompletableFuture::failedFuture);
+ } else {
+ return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType);
+ }
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "422")) {
+ if (Utils.contentTypeMatches(contentType, "application/json")) {
+ return HTTPValidationError.fromAsync(response)
+ .thenCompose(CompletableFuture::failedFuture);
+ } else {
+ return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType);
+ }
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "425")) {
+ if (Utils.contentTypeMatches(contentType, "application/json")) {
+ return Error425.fromAsync(response)
+ .thenCompose(CompletableFuture::failedFuture);
+ } else {
+ return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType);
+ }
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "429")) {
+ if (Utils.contentTypeMatches(contentType, "application/json")) {
+ return Error429.fromAsync(response)
+ .thenCompose(CompletableFuture::failedFuture);
+ } else {
+ return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType);
+ }
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "500")) {
+ if (Utils.contentTypeMatches(contentType, "application/json")) {
+ return Error500.fromAsync(response)
+ .thenCompose(CompletableFuture::failedFuture);
+ } else {
+ return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType);
+ }
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "502")) {
+ if (Utils.contentTypeMatches(contentType, "application/json")) {
+ return Error502.fromAsync(response)
+ .thenCompose(CompletableFuture::failedFuture);
+ } else {
+ return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType);
+ }
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "504")) {
+ if (Utils.contentTypeMatches(contentType, "application/json")) {
+ return Error504.fromAsync(response)
+ .thenCompose(CompletableFuture::failedFuture);
+ } else {
+ return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType);
+ }
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "4XX")) {
+ // no content
+ return Utils.createAsyncApiError(response, "API error occurred");
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "5XX")) {
+ // no content
+ return Utils.createAsyncApiError(response, "API error occurred");
+ }
+ return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode());
+ }
+ }
+}