diff --git a/.fern/metadata.json b/.fern/metadata.json index 97957d82..b808b571 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -13,5 +13,5 @@ "enable-forward-compatible-enums": true, "publish-to": "central" }, - "sdkVersion": "46.1.0.20260122" + "sdkVersion": "46.1.0.20260520" } \ No newline at end of file diff --git a/.fern/replay.lock b/.fern/replay.lock new file mode 100644 index 00000000..4641bc99 --- /dev/null +++ b/.fern/replay.lock @@ -0,0 +1,10 @@ +# DO NOT EDIT MANUALLY - Managed by Fern Replay +version: "1.0" +generations: + - commit_sha: 057a56683ddf1e5007072397fc4221b8eda8676f + tree_hash: d77c090eed91cd634edf2d25d9a78cc98a391bdb + timestamp: 2026-05-19T21:19:34.660Z + cli_version: unknown + generator_versions: {} +current_generation: 057a56683ddf1e5007072397fc4221b8eda8676f +patches: [] diff --git a/.fernignore b/.fernignore index 0dce8ae6..c234b7f8 100644 --- a/.fernignore +++ b/.fernignore @@ -6,3 +6,6 @@ src/main/java/com/squareup/square/core/SquareApiException.java src/main/java/com/squareup/square/utilities/WebhooksHelper.java src/test/resources/testdata .github/workflows/ci.yml +.fern/replay.lock +.fern/replay.yml +.gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..74928d6a --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +.fern/replay.lock linguist-generated=true diff --git a/README.md b/README.md index 51154439..6d9b3d4b 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ Add the dependency in your `pom.xml` file: com.squareup square - 46.1.0.20260122 + 46.1.0.20260520 ``` @@ -361,8 +361,8 @@ Gradle: ```groovy dependencies { - implementation 'com.squareup:square:46.1.0.20260122' - implementation 'com.squareup:square-legacy:46.1.0.20260122' + implementation 'com.squareup:square:46.1.0.20260520' + implementation 'com.squareup:square-legacy:46.1.0.20260520' } ``` @@ -372,12 +372,12 @@ Maven: com.squareup square - 46.1.0.20260122 + 46.1.0.20260520 com.squareup square-legacy - 46.1.0.20260122 + 46.1.0.20260520 ``` diff --git a/build.gradle b/build.gradle index 7fb73bdf..92366215 100644 --- a/build.gradle +++ b/build.gradle @@ -47,7 +47,7 @@ java { group = 'com.squareup' -version = '46.1.0.20260122' +version = '46.1.0.20260520' jar { dependsOn(":generatePomFileForMavenPublication") @@ -78,7 +78,7 @@ publishing { maven(MavenPublication) { groupId = 'com.squareup' artifactId = 'square' - version = '46.1.0.20260122' + version = '46.1.0.20260520' from components.java pom { name = 'square' diff --git a/reference.md b/reference.md index 9e8d4775..b516def7 100644 --- a/reference.md +++ b/reference.md @@ -11539,6 +11539,19 @@ For more information, see [Permissions](https://developer.squareup.com/docs/paym
+**appFeeAllocations:** `Optional>` + +Details pertaining to recipients of the application fee. The sum of the amounts in the +app_fee_allocations must equal the app_fee_money amount, if present. If populated, an +allocation must be present for every party that expects to receive a portion of the application +fee, including the application developer. + +
+
+ +
+
+ **delayDuration:** `Optional` The duration of time after the payment's creation when Square automatically @@ -12769,6 +12782,19 @@ For more information, see [Permissions](https://developer.squareup.com/docs/paym
+**appFeeAllocations:** `Optional>` + +Details pertaining to contributors to the refund of the application fee. +The sum of the amounts in the app_fee_allocations must equal the app_fee_money amount, if +present. If populated, an allocation must be present for every party that expects to contribute +a portion of the refunded application fee, including the application developer. + +
+
+ +
+
+ **paymentId:** `Optional` The unique ID of the payment being refunded. diff --git a/src/main/java/com/squareup/square/AsyncSquareClientBuilder.java b/src/main/java/com/squareup/square/AsyncSquareClientBuilder.java index 1bf8d661..1be6dfee 100644 --- a/src/main/java/com/squareup/square/AsyncSquareClientBuilder.java +++ b/src/main/java/com/squareup/square/AsyncSquareClientBuilder.java @@ -20,7 +20,7 @@ public class AsyncSquareClientBuilder { private String token = System.getenv("SQUARE_TOKEN"); - private String version = "2026-01-22"; + private String version = "2026-05-20"; private Environment environment = Environment.PRODUCTION; diff --git a/src/main/java/com/squareup/square/SquareClientBuilder.java b/src/main/java/com/squareup/square/SquareClientBuilder.java index adc5469e..9b8ee1fc 100644 --- a/src/main/java/com/squareup/square/SquareClientBuilder.java +++ b/src/main/java/com/squareup/square/SquareClientBuilder.java @@ -20,7 +20,7 @@ public class SquareClientBuilder { private String token = System.getenv("SQUARE_TOKEN"); - private String version = "2026-01-22"; + private String version = "2026-05-20"; private Environment environment = Environment.PRODUCTION; diff --git a/src/main/java/com/squareup/square/core/ClientOptions.java b/src/main/java/com/squareup/square/core/ClientOptions.java index c0b18131..f1d3f7d7 100644 --- a/src/main/java/com/squareup/square/core/ClientOptions.java +++ b/src/main/java/com/squareup/square/core/ClientOptions.java @@ -38,10 +38,10 @@ private ClientOptions( this.headers.putAll(headers); this.headers.putAll(new HashMap() { { - put("User-Agent", "com.squareup:square/46.1.0.20260122"); + put("User-Agent", "com.squareup:square/46.1.0.20260520"); put("X-Fern-Language", "JAVA"); put("X-Fern-SDK-Name", "com.square.fern:api-sdk"); - put("X-Fern-SDK-Version", "46.1.0.20260122"); + put("X-Fern-SDK-Version", "46.1.0.20260520"); } }); this.headerSuppliers = headerSuppliers; diff --git a/src/main/java/com/squareup/square/types/CardPaymentDetails.java b/src/main/java/com/squareup/square/types/CardPaymentDetails.java index 045181b7..66b5baa3 100644 --- a/src/main/java/com/squareup/square/types/CardPaymentDetails.java +++ b/src/main/java/com/squareup/square/types/CardPaymentDetails.java @@ -53,6 +53,10 @@ public final class CardPaymentDetails { private final Optional> errors; + private final Optional appliedCardSurchargeDetails; + + private final Optional walletType; + private final Map additionalProperties; private CardPaymentDetails( @@ -72,6 +76,8 @@ private CardPaymentDetails( Optional cardPaymentTimeline, Optional refundRequiresCardPresence, Optional> errors, + Optional appliedCardSurchargeDetails, + Optional walletType, Map additionalProperties) { this.status = status; this.card = card; @@ -89,6 +95,8 @@ private CardPaymentDetails( this.cardPaymentTimeline = cardPaymentTimeline; this.refundRequiresCardPresence = refundRequiresCardPresence; this.errors = errors; + this.appliedCardSurchargeDetails = appliedCardSurchargeDetails; + this.walletType = walletType; this.additionalProperties = additionalProperties; } @@ -231,6 +239,26 @@ public Optional> getErrors() { return errors; } + /** + * @return Additional information about a card_surcharge on the payment. + */ + @JsonProperty("applied_card_surcharge_details") + public Optional getAppliedCardSurchargeDetails() { + return appliedCardSurchargeDetails; + } + + /** + * @return The type of digital wallet used for this card payment, if applicable. + * Currently only populated for in-person Apple Pay payments. Detection has no false + * positives but may have false negatives (some Apple Pay payments may not be detected). + *

For payments with source_type of WALLET, see DigitalWalletDetails instead.

+ *

Values: APPLE_PAY

+ */ + @JsonProperty("wallet_type") + public Optional getWalletType() { + return walletType; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -258,7 +286,9 @@ private boolean equalTo(CardPaymentDetails other) { && deviceDetails.equals(other.deviceDetails) && cardPaymentTimeline.equals(other.cardPaymentTimeline) && refundRequiresCardPresence.equals(other.refundRequiresCardPresence) - && errors.equals(other.errors); + && errors.equals(other.errors) + && appliedCardSurchargeDetails.equals(other.appliedCardSurchargeDetails) + && walletType.equals(other.walletType); } @java.lang.Override @@ -279,7 +309,9 @@ public int hashCode() { this.deviceDetails, this.cardPaymentTimeline, this.refundRequiresCardPresence, - this.errors); + this.errors, + this.appliedCardSurchargeDetails, + this.walletType); } @java.lang.Override @@ -325,6 +357,10 @@ public static final class Builder { private Optional> errors = Optional.empty(); + private Optional appliedCardSurchargeDetails = Optional.empty(); + + private Optional walletType = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -347,6 +383,8 @@ public Builder from(CardPaymentDetails other) { cardPaymentTimeline(other.getCardPaymentTimeline()); refundRequiresCardPresence(other.getRefundRequiresCardPresence()); errors(other.getErrors()); + appliedCardSurchargeDetails(other.getAppliedCardSurchargeDetails()); + walletType(other.getWalletType()); return this; } @@ -585,6 +623,38 @@ public Builder errors(List errors) { return this; } + /** + *

Additional information about a card_surcharge on the payment.

+ */ + @JsonSetter(value = "applied_card_surcharge_details", nulls = Nulls.SKIP) + public Builder appliedCardSurchargeDetails(Optional appliedCardSurchargeDetails) { + this.appliedCardSurchargeDetails = appliedCardSurchargeDetails; + return this; + } + + public Builder appliedCardSurchargeDetails(CardSurchargeDetails appliedCardSurchargeDetails) { + this.appliedCardSurchargeDetails = Optional.ofNullable(appliedCardSurchargeDetails); + return this; + } + + /** + *

The type of digital wallet used for this card payment, if applicable. + * Currently only populated for in-person Apple Pay payments. Detection has no false + * positives but may have false negatives (some Apple Pay payments may not be detected).

+ *

For payments with source_type of WALLET, see DigitalWalletDetails instead.

+ *

Values: APPLE_PAY

+ */ + @JsonSetter(value = "wallet_type", nulls = Nulls.SKIP) + public Builder walletType(Optional walletType) { + this.walletType = walletType; + return this; + } + + public Builder walletType(String walletType) { + this.walletType = Optional.ofNullable(walletType); + return this; + } + public CardPaymentDetails build() { return new CardPaymentDetails( status, @@ -603,6 +673,8 @@ public CardPaymentDetails build() { cardPaymentTimeline, refundRequiresCardPresence, errors, + appliedCardSurchargeDetails, + walletType, additionalProperties); } diff --git a/src/main/java/com/squareup/square/types/CardSurchargeDetails.java b/src/main/java/com/squareup/square/types/CardSurchargeDetails.java new file mode 100644 index 00000000..96abb486 --- /dev/null +++ b/src/main/java/com/squareup/square/types/CardSurchargeDetails.java @@ -0,0 +1,125 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.squareup.square.types; + +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 com.squareup.square.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CardSurchargeDetails.Builder.class) +public final class CardSurchargeDetails { + private final Optional cardSurchargeMoney; + + private final Map additionalProperties; + + private CardSurchargeDetails(Optional cardSurchargeMoney, Map additionalProperties) { + this.cardSurchargeMoney = cardSurchargeMoney; + this.additionalProperties = additionalProperties; + } + + /** + * @return A specific surcharge levied by the merchant, if a card payment is used, instead of cash or + * some other payment type. Should only include the base surcharge amount. Any additional fees related + * to the surcharge (e.g. taxes on the surcharge) should only be included in the additional_amount_money. + * This amount is specified in the smallest denomination of the applicable currency (for example, + * US dollar amounts are specified in cents). For more information, see + * Working with Monetary Amounts. + * The currency code must match the currency associated with the business that is accepting the + * payment. + */ + @JsonProperty("card_surcharge_money") + public Optional getCardSurchargeMoney() { + return cardSurchargeMoney; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CardSurchargeDetails && equalTo((CardSurchargeDetails) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CardSurchargeDetails other) { + return cardSurchargeMoney.equals(other.cardSurchargeMoney); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.cardSurchargeMoney); + } + + @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 cardSurchargeMoney = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CardSurchargeDetails other) { + cardSurchargeMoney(other.getCardSurchargeMoney()); + return this; + } + + /** + *

A specific surcharge levied by the merchant, if a card payment is used, instead of cash or + * some other payment type. Should only include the base surcharge amount. Any additional fees related + * to the surcharge (e.g. taxes on the surcharge) should only be included in the additional_amount_money. + * This amount is specified in the smallest denomination of the applicable currency (for example, + * US dollar amounts are specified in cents). For more information, see + * Working with Monetary Amounts. + * The currency code must match the currency associated with the business that is accepting the + * payment.

+ */ + @JsonSetter(value = "card_surcharge_money", nulls = Nulls.SKIP) + public Builder cardSurchargeMoney(Optional cardSurchargeMoney) { + this.cardSurchargeMoney = cardSurchargeMoney; + return this; + } + + public Builder cardSurchargeMoney(Money cardSurchargeMoney) { + this.cardSurchargeMoney = Optional.ofNullable(cardSurchargeMoney); + return this; + } + + public CardSurchargeDetails build() { + return new CardSurchargeDetails(cardSurchargeMoney, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/squareup/square/types/CreatePaymentRequest.java b/src/main/java/com/squareup/square/types/CreatePaymentRequest.java index 75f8ee7d..a179e6fb 100644 --- a/src/main/java/com/squareup/square/types/CreatePaymentRequest.java +++ b/src/main/java/com/squareup/square/types/CreatePaymentRequest.java @@ -13,6 +13,7 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.squareup.square.core.ObjectMappers; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Optional; @@ -31,6 +32,8 @@ public final class CreatePaymentRequest { private final Optional appFeeMoney; + private final Optional> appFeeAllocations; + private final Optional delayDuration; private final Optional delayAction; @@ -79,6 +82,7 @@ private CreatePaymentRequest( Optional amountMoney, Optional tipMoney, Optional appFeeMoney, + Optional> appFeeAllocations, Optional delayDuration, Optional delayAction, Optional autocomplete, @@ -105,6 +109,7 @@ private CreatePaymentRequest( this.amountMoney = amountMoney; this.tipMoney = tipMoney; this.appFeeMoney = appFeeMoney; + this.appFeeAllocations = appFeeAllocations; this.delayDuration = delayDuration; this.delayAction = delayAction; this.autocomplete = autocomplete; @@ -201,6 +206,17 @@ public Optional getAppFeeMoney() { return appFeeMoney; } + /** + * @return Details pertaining to recipients of the application fee. The sum of the amounts in the + * app_fee_allocations must equal the app_fee_money amount, if present. If populated, an + * allocation must be present for every party that expects to receive a portion of the application + * fee, including the application developer. + */ + @JsonProperty("app_fee_allocations") + public Optional> getAppFeeAllocations() { + return appFeeAllocations; + } + /** * @return The duration of time after the payment's creation when Square automatically * either completes or cancels the payment depending on the delay_action field value. @@ -424,6 +440,7 @@ private boolean equalTo(CreatePaymentRequest other) { && amountMoney.equals(other.amountMoney) && tipMoney.equals(other.tipMoney) && appFeeMoney.equals(other.appFeeMoney) + && appFeeAllocations.equals(other.appFeeAllocations) && delayDuration.equals(other.delayDuration) && delayAction.equals(other.delayAction) && autocomplete.equals(other.autocomplete) @@ -454,6 +471,7 @@ public int hashCode() { this.amountMoney, this.tipMoney, this.appFeeMoney, + this.appFeeAllocations, this.delayDuration, this.delayAction, this.autocomplete, @@ -562,6 +580,16 @@ public interface _FinalStage { _FinalStage appFeeMoney(Money appFeeMoney); + /** + *

Details pertaining to recipients of the application fee. The sum of the amounts in the + * app_fee_allocations must equal the app_fee_money amount, if present. If populated, an + * allocation must be present for every party that expects to receive a portion of the application + * fee, including the application developer.

+ */ + _FinalStage appFeeAllocations(Optional> appFeeAllocations); + + _FinalStage appFeeAllocations(List appFeeAllocations); + /** *

The duration of time after the payment's creation when Square automatically * either completes or cancels the payment depending on the delay_action field value. @@ -795,6 +823,8 @@ public static final class Builder implements SourceIdStage, IdempotencyKeyStage, private Optional delayDuration = Optional.empty(); + private Optional> appFeeAllocations = Optional.empty(); + private Optional appFeeMoney = Optional.empty(); private Optional tipMoney = Optional.empty(); @@ -813,6 +843,7 @@ public Builder from(CreatePaymentRequest other) { amountMoney(other.getAmountMoney()); tipMoney(other.getTipMoney()); appFeeMoney(other.getAppFeeMoney()); + appFeeAllocations(other.getAppFeeAllocations()); delayDuration(other.getDelayDuration()); delayAction(other.getDelayAction()); autocomplete(other.getAutocomplete()); @@ -1372,6 +1403,32 @@ public _FinalStage delayDuration(Optional delayDuration) { return this; } + /** + *

Details pertaining to recipients of the application fee. The sum of the amounts in the + * app_fee_allocations must equal the app_fee_money amount, if present. If populated, an + * allocation must be present for every party that expects to receive a portion of the application + * fee, including the application developer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage appFeeAllocations(List appFeeAllocations) { + this.appFeeAllocations = Optional.ofNullable(appFeeAllocations); + return this; + } + + /** + *

Details pertaining to recipients of the application fee. The sum of the amounts in the + * app_fee_allocations must equal the app_fee_money amount, if present. If populated, an + * allocation must be present for every party that expects to receive a portion of the application + * fee, including the application developer.

+ */ + @java.lang.Override + @JsonSetter(value = "app_fee_allocations", nulls = Nulls.SKIP) + public _FinalStage appFeeAllocations(Optional> appFeeAllocations) { + this.appFeeAllocations = appFeeAllocations; + return this; + } + /** *

The amount of money that the developer is taking as a fee * for facilitating the payment on behalf of the seller.

@@ -1486,6 +1543,7 @@ public CreatePaymentRequest build() { amountMoney, tipMoney, appFeeMoney, + appFeeAllocations, delayDuration, delayAction, autocomplete, diff --git a/src/main/java/com/squareup/square/types/DigitalWalletDetails.java b/src/main/java/com/squareup/square/types/DigitalWalletDetails.java index cfb717cc..6f7d7225 100644 --- a/src/main/java/com/squareup/square/types/DigitalWalletDetails.java +++ b/src/main/java/com/squareup/square/types/DigitalWalletDetails.java @@ -30,6 +30,8 @@ public final class DigitalWalletDetails { private final Optional cashAppDetails; + private final Optional lightningDetails; + private final Optional> errors; private final Map additionalProperties; @@ -38,11 +40,13 @@ private DigitalWalletDetails( Optional status, Optional brand, Optional cashAppDetails, + Optional lightningDetails, Optional> errors, Map additionalProperties) { this.status = status; this.brand = brand; this.cashAppDetails = cashAppDetails; + this.lightningDetails = lightningDetails; this.errors = errors; this.additionalProperties = additionalProperties; } @@ -79,6 +83,14 @@ public Optional getCashAppDetails() { return cashAppDetails; } + /** + * @return Brand-specific details for payments with the brand of LIGHTNING. + */ + @JsonProperty("lightning_details") + public Optional getLightningDetails() { + return lightningDetails; + } + /** * @return Information about errors encountered during the payment. */ @@ -114,12 +126,13 @@ private boolean equalTo(DigitalWalletDetails other) { return status.equals(other.status) && brand.equals(other.brand) && cashAppDetails.equals(other.cashAppDetails) + && lightningDetails.equals(other.lightningDetails) && errors.equals(other.errors); } @java.lang.Override public int hashCode() { - return Objects.hash(this.status, this.brand, this.cashAppDetails, this.errors); + return Objects.hash(this.status, this.brand, this.cashAppDetails, this.lightningDetails, this.errors); } @java.lang.Override @@ -139,6 +152,8 @@ public static final class Builder { private Optional cashAppDetails = Optional.empty(); + private Optional lightningDetails = Optional.empty(); + private Optional> errors = Optional.empty(); @JsonAnySetter @@ -150,6 +165,7 @@ public Builder from(DigitalWalletDetails other) { status(other.getStatus()); brand(other.getBrand()); cashAppDetails(other.getCashAppDetails()); + lightningDetails(other.getLightningDetails()); errors(other.getErrors()); return this; } @@ -220,6 +236,20 @@ public Builder cashAppDetails(CashAppDetails cashAppDetails) { return this; } + /** + *

Brand-specific details for payments with the brand of LIGHTNING.

+ */ + @JsonSetter(value = "lightning_details", nulls = Nulls.SKIP) + public Builder lightningDetails(Optional lightningDetails) { + this.lightningDetails = lightningDetails; + return this; + } + + public Builder lightningDetails(LightningDetails lightningDetails) { + this.lightningDetails = Optional.ofNullable(lightningDetails); + return this; + } + /** *

Information about errors encountered during the payment.

*/ @@ -235,7 +265,8 @@ public Builder errors(List errors) { } public DigitalWalletDetails build() { - return new DigitalWalletDetails(status, brand, cashAppDetails, errors, additionalProperties); + return new DigitalWalletDetails( + status, brand, cashAppDetails, lightningDetails, errors, additionalProperties); } public Builder additionalProperty(String key, Object value) { diff --git a/src/main/java/com/squareup/square/types/ElectronicMoneyDetails.java b/src/main/java/com/squareup/square/types/ElectronicMoneyDetails.java new file mode 100644 index 00000000..15d79727 --- /dev/null +++ b/src/main/java/com/squareup/square/types/ElectronicMoneyDetails.java @@ -0,0 +1,111 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.squareup.square.types; + +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 com.squareup.square.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ElectronicMoneyDetails.Builder.class) +public final class ElectronicMoneyDetails { + private final Optional felicaDetails; + + private final Map additionalProperties; + + private ElectronicMoneyDetails(Optional felicaDetails, Map additionalProperties) { + this.felicaDetails = felicaDetails; + this.additionalProperties = additionalProperties; + } + + /** + * @return Details specific to FeliCa payments. + */ + @JsonProperty("felica_details") + public Optional getFelicaDetails() { + return felicaDetails; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ElectronicMoneyDetails && equalTo((ElectronicMoneyDetails) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ElectronicMoneyDetails other) { + return felicaDetails.equals(other.felicaDetails); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.felicaDetails); + } + + @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 felicaDetails = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ElectronicMoneyDetails other) { + felicaDetails(other.getFelicaDetails()); + return this; + } + + /** + *

Details specific to FeliCa payments.

+ */ + @JsonSetter(value = "felica_details", nulls = Nulls.SKIP) + public Builder felicaDetails(Optional felicaDetails) { + this.felicaDetails = felicaDetails; + return this; + } + + public Builder felicaDetails(FelicaDetails felicaDetails) { + this.felicaDetails = Optional.ofNullable(felicaDetails); + return this; + } + + public ElectronicMoneyDetails build() { + return new ElectronicMoneyDetails(felicaDetails, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/squareup/square/types/FelicaDetails.java b/src/main/java/com/squareup/square/types/FelicaDetails.java new file mode 100644 index 00000000..fc0d17ca --- /dev/null +++ b/src/main/java/com/squareup/square/types/FelicaDetails.java @@ -0,0 +1,218 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.squareup.square.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +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 com.squareup.square.core.Nullable; +import com.squareup.square.core.NullableNonemptyFilter; +import com.squareup.square.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = FelicaDetails.Builder.class) +public final class FelicaDetails { + private final Optional terminalId; + + private final Optional felicaMaskedCardNumber; + + private final Optional felicaBrand; + + private final Map additionalProperties; + + private FelicaDetails( + Optional terminalId, + Optional felicaMaskedCardNumber, + Optional felicaBrand, + Map additionalProperties) { + this.terminalId = terminalId; + this.felicaMaskedCardNumber = felicaMaskedCardNumber; + this.felicaBrand = felicaBrand; + this.additionalProperties = additionalProperties; + } + + /** + * @return The terminal id for a Felica payment. + */ + @JsonIgnore + public Optional getTerminalId() { + if (terminalId == null) { + return Optional.empty(); + } + return terminalId; + } + + /** + * @return The masked card number for a Felica payment. + */ + @JsonIgnore + public Optional getFelicaMaskedCardNumber() { + if (felicaMaskedCardNumber == null) { + return Optional.empty(); + } + return felicaMaskedCardNumber; + } + + /** + * @return The Felica sub-brand of the payment. + * See FelicaBrand for possible values + */ + @JsonProperty("felica_brand") + public Optional getFelicaBrand() { + return felicaBrand; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("terminal_id") + private Optional _getTerminalId() { + return terminalId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("felica_masked_card_number") + private Optional _getFelicaMaskedCardNumber() { + return felicaMaskedCardNumber; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FelicaDetails && equalTo((FelicaDetails) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(FelicaDetails other) { + return terminalId.equals(other.terminalId) + && felicaMaskedCardNumber.equals(other.felicaMaskedCardNumber) + && felicaBrand.equals(other.felicaBrand); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.terminalId, this.felicaMaskedCardNumber, this.felicaBrand); + } + + @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 terminalId = Optional.empty(); + + private Optional felicaMaskedCardNumber = Optional.empty(); + + private Optional felicaBrand = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(FelicaDetails other) { + terminalId(other.getTerminalId()); + felicaMaskedCardNumber(other.getFelicaMaskedCardNumber()); + felicaBrand(other.getFelicaBrand()); + return this; + } + + /** + *

The terminal id for a Felica payment.

+ */ + @JsonSetter(value = "terminal_id", nulls = Nulls.SKIP) + public Builder terminalId(Optional terminalId) { + this.terminalId = terminalId; + return this; + } + + public Builder terminalId(String terminalId) { + this.terminalId = Optional.ofNullable(terminalId); + return this; + } + + public Builder terminalId(Nullable terminalId) { + if (terminalId.isNull()) { + this.terminalId = null; + } else if (terminalId.isEmpty()) { + this.terminalId = Optional.empty(); + } else { + this.terminalId = Optional.of(terminalId.get()); + } + return this; + } + + /** + *

The masked card number for a Felica payment.

+ */ + @JsonSetter(value = "felica_masked_card_number", nulls = Nulls.SKIP) + public Builder felicaMaskedCardNumber(Optional felicaMaskedCardNumber) { + this.felicaMaskedCardNumber = felicaMaskedCardNumber; + return this; + } + + public Builder felicaMaskedCardNumber(String felicaMaskedCardNumber) { + this.felicaMaskedCardNumber = Optional.ofNullable(felicaMaskedCardNumber); + return this; + } + + public Builder felicaMaskedCardNumber(Nullable felicaMaskedCardNumber) { + if (felicaMaskedCardNumber.isNull()) { + this.felicaMaskedCardNumber = null; + } else if (felicaMaskedCardNumber.isEmpty()) { + this.felicaMaskedCardNumber = Optional.empty(); + } else { + this.felicaMaskedCardNumber = Optional.of(felicaMaskedCardNumber.get()); + } + return this; + } + + /** + *

The Felica sub-brand of the payment. + * See FelicaBrand for possible values

+ */ + @JsonSetter(value = "felica_brand", nulls = Nulls.SKIP) + public Builder felicaBrand(Optional felicaBrand) { + this.felicaBrand = felicaBrand; + return this; + } + + public Builder felicaBrand(FelicaDetailsFelicaBrand felicaBrand) { + this.felicaBrand = Optional.ofNullable(felicaBrand); + return this; + } + + public FelicaDetails build() { + return new FelicaDetails(terminalId, felicaMaskedCardNumber, felicaBrand, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/squareup/square/types/FelicaDetailsFelicaBrand.java b/src/main/java/com/squareup/square/types/FelicaDetailsFelicaBrand.java new file mode 100644 index 00000000..9cd4d6b5 --- /dev/null +++ b/src/main/java/com/squareup/square/types/FelicaDetailsFelicaBrand.java @@ -0,0 +1,105 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.squareup.square.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class FelicaDetailsFelicaBrand { + public static final FelicaDetailsFelicaBrand FELICA_QP = new FelicaDetailsFelicaBrand(Value.FELICA_QP, "FELICA_QP"); + + public static final FelicaDetailsFelicaBrand FELICA_ID = new FelicaDetailsFelicaBrand(Value.FELICA_ID, "FELICA_ID"); + + public static final FelicaDetailsFelicaBrand UNKNOWN = new FelicaDetailsFelicaBrand(Value.UNKNOWN, "UNKNOWN"); + + public static final FelicaDetailsFelicaBrand FELICA_TRANSPORTATION = + new FelicaDetailsFelicaBrand(Value.FELICA_TRANSPORTATION, "FELICA_TRANSPORTATION"); + + private final Value value; + + private final String string; + + FelicaDetailsFelicaBrand(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof FelicaDetailsFelicaBrand + && this.string.equals(((FelicaDetailsFelicaBrand) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FELICA_QP: + return visitor.visitFelicaQp(); + case FELICA_ID: + return visitor.visitFelicaId(); + case UNKNOWN: + return visitor.visitUnknown(); + case FELICA_TRANSPORTATION: + return visitor.visitFelicaTransportation(); + case _UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static FelicaDetailsFelicaBrand valueOf(String value) { + switch (value) { + case "FELICA_QP": + return FELICA_QP; + case "FELICA_ID": + return FELICA_ID; + case "UNKNOWN": + return UNKNOWN; + case "FELICA_TRANSPORTATION": + return FELICA_TRANSPORTATION; + default: + return new FelicaDetailsFelicaBrand(Value._UNKNOWN, value); + } + } + + public enum Value { + UNKNOWN, + + FELICA_ID, + + FELICA_TRANSPORTATION, + + FELICA_QP, + + _UNKNOWN + } + + public interface Visitor { + T visitUnknown(); + + T visitFelicaId(); + + T visitFelicaTransportation(); + + T visitFelicaQp(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/squareup/square/types/LightningDetails.java b/src/main/java/com/squareup/square/types/LightningDetails.java new file mode 100644 index 00000000..4025c03b --- /dev/null +++ b/src/main/java/com/squareup/square/types/LightningDetails.java @@ -0,0 +1,134 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.squareup.square.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +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 com.squareup.square.core.Nullable; +import com.squareup.square.core.NullableNonemptyFilter; +import com.squareup.square.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LightningDetails.Builder.class) +public final class LightningDetails { + private final Optional paymentUrl; + + private final Map additionalProperties; + + private LightningDetails(Optional paymentUrl, Map additionalProperties) { + this.paymentUrl = paymentUrl; + this.additionalProperties = additionalProperties; + } + + /** + * @return Payment URL for the lightning payment, a.k.a. the invoice. + */ + @JsonIgnore + public Optional getPaymentUrl() { + if (paymentUrl == null) { + return Optional.empty(); + } + return paymentUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment_url") + private Optional _getPaymentUrl() { + return paymentUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LightningDetails && equalTo((LightningDetails) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LightningDetails other) { + return paymentUrl.equals(other.paymentUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.paymentUrl); + } + + @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 paymentUrl = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(LightningDetails other) { + paymentUrl(other.getPaymentUrl()); + return this; + } + + /** + *

Payment URL for the lightning payment, a.k.a. the invoice.

+ */ + @JsonSetter(value = "payment_url", nulls = Nulls.SKIP) + public Builder paymentUrl(Optional paymentUrl) { + this.paymentUrl = paymentUrl; + return this; + } + + public Builder paymentUrl(String paymentUrl) { + this.paymentUrl = Optional.ofNullable(paymentUrl); + return this; + } + + public Builder paymentUrl(Nullable paymentUrl) { + if (paymentUrl.isNull()) { + this.paymentUrl = null; + } else if (paymentUrl.isEmpty()) { + this.paymentUrl = Optional.empty(); + } else { + this.paymentUrl = Optional.of(paymentUrl.get()); + } + return this; + } + + public LightningDetails build() { + return new LightningDetails(paymentUrl, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/squareup/square/types/Payment.java b/src/main/java/com/squareup/square/types/Payment.java index 25d7a024..d7818e74 100644 --- a/src/main/java/com/squareup/square/types/Payment.java +++ b/src/main/java/com/squareup/square/types/Payment.java @@ -38,6 +38,8 @@ public final class Payment { private final Optional appFeeMoney; + private final Optional> appFeeAllocations; + private final Optional approvedMoney; private final Optional> processingFee; @@ -60,6 +62,8 @@ public final class Payment { private final Optional bankAccountDetails; + private final Optional electronicMoneyDetails; + private final Optional externalDetails; private final Optional walletDetails; @@ -106,6 +110,8 @@ public final class Payment { private final Optional applicationDetails; + private final Optional buyerCurrencyExchange; + private final Optional isOfflinePayment; private final Optional offlinePaymentDetails; @@ -122,6 +128,7 @@ private Payment( Optional tipMoney, Optional totalMoney, Optional appFeeMoney, + Optional> appFeeAllocations, Optional approvedMoney, Optional> processingFee, Optional refundedMoney, @@ -133,6 +140,7 @@ private Payment( Optional cardDetails, Optional cashDetails, Optional bankAccountDetails, + Optional electronicMoneyDetails, Optional externalDetails, Optional walletDetails, Optional buyNowPayLaterDetails, @@ -156,6 +164,7 @@ private Payment( Optional receiptUrl, Optional deviceDetails, Optional applicationDetails, + Optional buyerCurrencyExchange, Optional isOfflinePayment, Optional offlinePaymentDetails, Optional versionToken, @@ -167,6 +176,7 @@ private Payment( this.tipMoney = tipMoney; this.totalMoney = totalMoney; this.appFeeMoney = appFeeMoney; + this.appFeeAllocations = appFeeAllocations; this.approvedMoney = approvedMoney; this.processingFee = processingFee; this.refundedMoney = refundedMoney; @@ -178,6 +188,7 @@ private Payment( this.cardDetails = cardDetails; this.cashDetails = cashDetails; this.bankAccountDetails = bankAccountDetails; + this.electronicMoneyDetails = electronicMoneyDetails; this.externalDetails = externalDetails; this.walletDetails = walletDetails; this.buyNowPayLaterDetails = buyNowPayLaterDetails; @@ -201,6 +212,7 @@ private Payment( this.receiptUrl = receiptUrl; this.deviceDetails = deviceDetails; this.applicationDetails = applicationDetails; + this.buyerCurrencyExchange = buyerCurrencyExchange; this.isOfflinePayment = isOfflinePayment; this.offlinePaymentDetails = offlinePaymentDetails; this.versionToken = versionToken; @@ -279,6 +291,17 @@ public Optional getAppFeeMoney() { return appFeeMoney; } + /** + * @return Details pertaining to recipients of the application fee. + */ + @JsonIgnore + public Optional> getAppFeeAllocations() { + if (appFeeAllocations == null) { + return Optional.empty(); + } + return appFeeAllocations; + } + /** * @return The amount of money approved for this payment. This value may change if Square chooses to * obtain reauthorization as part of a call to UpdatePayment. @@ -392,6 +415,14 @@ public Optional getBankAccountDetails() { return bankAccountDetails; } + /** + * @return Details specific to electronic money payments. + */ + @JsonProperty("electronic_money_details") + public Optional getElectronicMoneyDetails() { + return electronicMoneyDetails; + } + /** * @return Details about an external payment. The details are only populated * if the source_type is EXTERNAL. @@ -613,6 +644,11 @@ public Optional getApplicationDetails() { return applicationDetails; } + @JsonProperty("buyer_currency_exchange") + public Optional getBuyerCurrencyExchange() { + return buyerCurrencyExchange; + } + /** * @return Whether or not this payment was taken offline. */ @@ -641,6 +677,12 @@ public Optional getVersionToken() { return versionToken; } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("app_fee_allocations") + private Optional> _getAppFeeAllocations() { + return appFeeAllocations; + } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) @JsonProperty("delay_action") private Optional _getDelayAction() { @@ -678,6 +720,7 @@ private boolean equalTo(Payment other) { && tipMoney.equals(other.tipMoney) && totalMoney.equals(other.totalMoney) && appFeeMoney.equals(other.appFeeMoney) + && appFeeAllocations.equals(other.appFeeAllocations) && approvedMoney.equals(other.approvedMoney) && processingFee.equals(other.processingFee) && refundedMoney.equals(other.refundedMoney) @@ -689,6 +732,7 @@ private boolean equalTo(Payment other) { && cardDetails.equals(other.cardDetails) && cashDetails.equals(other.cashDetails) && bankAccountDetails.equals(other.bankAccountDetails) + && electronicMoneyDetails.equals(other.electronicMoneyDetails) && externalDetails.equals(other.externalDetails) && walletDetails.equals(other.walletDetails) && buyNowPayLaterDetails.equals(other.buyNowPayLaterDetails) @@ -712,6 +756,7 @@ private boolean equalTo(Payment other) { && receiptUrl.equals(other.receiptUrl) && deviceDetails.equals(other.deviceDetails) && applicationDetails.equals(other.applicationDetails) + && buyerCurrencyExchange.equals(other.buyerCurrencyExchange) && isOfflinePayment.equals(other.isOfflinePayment) && offlinePaymentDetails.equals(other.offlinePaymentDetails) && versionToken.equals(other.versionToken); @@ -727,6 +772,7 @@ public int hashCode() { this.tipMoney, this.totalMoney, this.appFeeMoney, + this.appFeeAllocations, this.approvedMoney, this.processingFee, this.refundedMoney, @@ -738,6 +784,7 @@ public int hashCode() { this.cardDetails, this.cashDetails, this.bankAccountDetails, + this.electronicMoneyDetails, this.externalDetails, this.walletDetails, this.buyNowPayLaterDetails, @@ -761,6 +808,7 @@ public int hashCode() { this.receiptUrl, this.deviceDetails, this.applicationDetails, + this.buyerCurrencyExchange, this.isOfflinePayment, this.offlinePaymentDetails, this.versionToken); @@ -791,6 +839,8 @@ public static final class Builder { private Optional appFeeMoney = Optional.empty(); + private Optional> appFeeAllocations = Optional.empty(); + private Optional approvedMoney = Optional.empty(); private Optional> processingFee = Optional.empty(); @@ -813,6 +863,8 @@ public static final class Builder { private Optional bankAccountDetails = Optional.empty(); + private Optional electronicMoneyDetails = Optional.empty(); + private Optional externalDetails = Optional.empty(); private Optional walletDetails = Optional.empty(); @@ -859,6 +911,8 @@ public static final class Builder { private Optional applicationDetails = Optional.empty(); + private Optional buyerCurrencyExchange = Optional.empty(); + private Optional isOfflinePayment = Optional.empty(); private Optional offlinePaymentDetails = Optional.empty(); @@ -878,6 +932,7 @@ public Builder from(Payment other) { tipMoney(other.getTipMoney()); totalMoney(other.getTotalMoney()); appFeeMoney(other.getAppFeeMoney()); + appFeeAllocations(other.getAppFeeAllocations()); approvedMoney(other.getApprovedMoney()); processingFee(other.getProcessingFee()); refundedMoney(other.getRefundedMoney()); @@ -889,6 +944,7 @@ public Builder from(Payment other) { cardDetails(other.getCardDetails()); cashDetails(other.getCashDetails()); bankAccountDetails(other.getBankAccountDetails()); + electronicMoneyDetails(other.getElectronicMoneyDetails()); externalDetails(other.getExternalDetails()); walletDetails(other.getWalletDetails()); buyNowPayLaterDetails(other.getBuyNowPayLaterDetails()); @@ -912,6 +968,7 @@ public Builder from(Payment other) { receiptUrl(other.getReceiptUrl()); deviceDetails(other.getDeviceDetails()); applicationDetails(other.getApplicationDetails()); + buyerCurrencyExchange(other.getBuyerCurrencyExchange()); isOfflinePayment(other.getIsOfflinePayment()); offlinePaymentDetails(other.getOfflinePaymentDetails()); versionToken(other.getVersionToken()); @@ -1032,6 +1089,31 @@ public Builder appFeeMoney(Money appFeeMoney) { return this; } + /** + *

Details pertaining to recipients of the application fee.

+ */ + @JsonSetter(value = "app_fee_allocations", nulls = Nulls.SKIP) + public Builder appFeeAllocations(Optional> appFeeAllocations) { + this.appFeeAllocations = appFeeAllocations; + return this; + } + + public Builder appFeeAllocations(List appFeeAllocations) { + this.appFeeAllocations = Optional.ofNullable(appFeeAllocations); + return this; + } + + public Builder appFeeAllocations(Nullable> appFeeAllocations) { + if (appFeeAllocations.isNull()) { + this.appFeeAllocations = null; + } else if (appFeeAllocations.isEmpty()) { + this.appFeeAllocations = Optional.empty(); + } else { + this.appFeeAllocations = Optional.of(appFeeAllocations.get()); + } + return this; + } + /** *

The amount of money approved for this payment. This value may change if Square chooses to * obtain reauthorization as part of a call to UpdatePayment.

@@ -1219,6 +1301,20 @@ public Builder bankAccountDetails(BankAccountPaymentDetails bankAccountDetails) return this; } + /** + *

Details specific to electronic money payments.

+ */ + @JsonSetter(value = "electronic_money_details", nulls = Nulls.SKIP) + public Builder electronicMoneyDetails(Optional electronicMoneyDetails) { + this.electronicMoneyDetails = electronicMoneyDetails; + return this; + } + + public Builder electronicMoneyDetails(ElectronicMoneyDetails electronicMoneyDetails) { + this.electronicMoneyDetails = Optional.ofNullable(electronicMoneyDetails); + return this; + } + /** *

Details about an external payment. The details are only populated * if the source_type is EXTERNAL.

@@ -1586,6 +1682,17 @@ public Builder applicationDetails(ApplicationDetails applicationDetails) { return this; } + @JsonSetter(value = "buyer_currency_exchange", nulls = Nulls.SKIP) + public Builder buyerCurrencyExchange(Optional buyerCurrencyExchange) { + this.buyerCurrencyExchange = buyerCurrencyExchange; + return this; + } + + public Builder buyerCurrencyExchange(Object buyerCurrencyExchange) { + this.buyerCurrencyExchange = Optional.ofNullable(buyerCurrencyExchange); + return this; + } + /** *

Whether or not this payment was taken offline.

*/ @@ -1649,6 +1756,7 @@ public Payment build() { tipMoney, totalMoney, appFeeMoney, + appFeeAllocations, approvedMoney, processingFee, refundedMoney, @@ -1660,6 +1768,7 @@ public Payment build() { cardDetails, cashDetails, bankAccountDetails, + electronicMoneyDetails, externalDetails, walletDetails, buyNowPayLaterDetails, @@ -1683,6 +1792,7 @@ public Payment build() { receiptUrl, deviceDetails, applicationDetails, + buyerCurrencyExchange, isOfflinePayment, offlinePaymentDetails, versionToken, diff --git a/src/main/java/com/squareup/square/types/PaymentRefund.java b/src/main/java/com/squareup/square/types/PaymentRefund.java index 4e8839ea..4337b4c2 100644 --- a/src/main/java/com/squareup/square/types/PaymentRefund.java +++ b/src/main/java/com/squareup/square/types/PaymentRefund.java @@ -41,6 +41,8 @@ public final class PaymentRefund { private final Optional appFeeMoney; + private final Optional> appFeeAllocations; + private final Optional> processingFee; private final Optional paymentId; @@ -68,6 +70,7 @@ private PaymentRefund( Optional destinationDetails, Money amountMoney, Optional appFeeMoney, + Optional> appFeeAllocations, Optional> processingFee, Optional paymentId, Optional orderId, @@ -85,6 +88,7 @@ private PaymentRefund( this.destinationDetails = destinationDetails; this.amountMoney = amountMoney; this.appFeeMoney = appFeeMoney; + this.appFeeAllocations = appFeeAllocations; this.processingFee = processingFee; this.paymentId = paymentId; this.orderId = orderId; @@ -182,6 +186,14 @@ public Optional getAppFeeMoney() { return appFeeMoney; } + /** + * @return Details pertaining to contributors to the refund of the application fee. + */ + @JsonProperty("app_fee_allocations") + public Optional> getAppFeeAllocations() { + return appFeeAllocations; + } + /** * @return Processing fees and fee adjustments assessed by Square for this refund. */ @@ -320,6 +332,7 @@ private boolean equalTo(PaymentRefund other) { && destinationDetails.equals(other.destinationDetails) && amountMoney.equals(other.amountMoney) && appFeeMoney.equals(other.appFeeMoney) + && appFeeAllocations.equals(other.appFeeAllocations) && processingFee.equals(other.processingFee) && paymentId.equals(other.paymentId) && orderId.equals(other.orderId) @@ -341,6 +354,7 @@ public int hashCode() { this.destinationDetails, this.amountMoney, this.appFeeMoney, + this.appFeeAllocations, this.processingFee, this.paymentId, this.orderId, @@ -444,6 +458,13 @@ public interface _FinalStage { _FinalStage appFeeMoney(Money appFeeMoney); + /** + *

Details pertaining to contributors to the refund of the application fee.

+ */ + _FinalStage appFeeAllocations(Optional> appFeeAllocations); + + _FinalStage appFeeAllocations(List appFeeAllocations); + /** *

Processing fees and fee adjustments assessed by Square for this refund.

*/ @@ -531,6 +552,8 @@ public static final class Builder implements IdStage, AmountMoneyStage, _FinalSt private Optional> processingFee = Optional.empty(); + private Optional> appFeeAllocations = Optional.empty(); + private Optional appFeeMoney = Optional.empty(); private Optional destinationDetails = Optional.empty(); @@ -558,6 +581,7 @@ public Builder from(PaymentRefund other) { destinationDetails(other.getDestinationDetails()); amountMoney(other.getAmountMoney()); appFeeMoney(other.getAppFeeMoney()); + appFeeAllocations(other.getAppFeeAllocations()); processingFee(other.getProcessingFee()); paymentId(other.getPaymentId()); orderId(other.getOrderId()); @@ -819,6 +843,26 @@ public _FinalStage processingFee(Optional> processingFee) { return this; } + /** + *

Details pertaining to contributors to the refund of the application fee.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage appFeeAllocations(List appFeeAllocations) { + this.appFeeAllocations = Optional.ofNullable(appFeeAllocations); + return this; + } + + /** + *

Details pertaining to contributors to the refund of the application fee.

+ */ + @java.lang.Override + @JsonSetter(value = "app_fee_allocations", nulls = Nulls.SKIP) + public _FinalStage appFeeAllocations(Optional> appFeeAllocations) { + this.appFeeAllocations = appFeeAllocations; + return this; + } + /** *

The amount of money the application developer contributed to help cover the refunded amount. * This amount is specified in the smallest denomination of the applicable currency (for example, @@ -1030,6 +1074,7 @@ public PaymentRefund build() { destinationDetails, amountMoney, appFeeMoney, + appFeeAllocations, processingFee, paymentId, orderId, diff --git a/src/main/java/com/squareup/square/types/RefundPaymentRequest.java b/src/main/java/com/squareup/square/types/RefundPaymentRequest.java index f519b476..fe9399d1 100644 --- a/src/main/java/com/squareup/square/types/RefundPaymentRequest.java +++ b/src/main/java/com/squareup/square/types/RefundPaymentRequest.java @@ -16,6 +16,7 @@ import com.squareup.square.core.NullableNonemptyFilter; import com.squareup.square.core.ObjectMappers; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Optional; @@ -30,6 +31,8 @@ public final class RefundPaymentRequest { private final Optional appFeeMoney; + private final Optional> appFeeAllocations; + private final Optional paymentId; private final Optional destinationId; @@ -56,6 +59,7 @@ private RefundPaymentRequest( String idempotencyKey, Money amountMoney, Optional appFeeMoney, + Optional> appFeeAllocations, Optional paymentId, Optional destinationId, Optional unlinked, @@ -70,6 +74,7 @@ private RefundPaymentRequest( this.idempotencyKey = idempotencyKey; this.amountMoney = amountMoney; this.appFeeMoney = appFeeMoney; + this.appFeeAllocations = appFeeAllocations; this.paymentId = paymentId; this.destinationId = destinationId; this.unlinked = unlinked; @@ -126,6 +131,20 @@ public Optional getAppFeeMoney() { return appFeeMoney; } + /** + * @return Details pertaining to contributors to the refund of the application fee. + * The sum of the amounts in the app_fee_allocations must equal the app_fee_money amount, if + * present. If populated, an allocation must be present for every party that expects to contribute + * a portion of the refunded application fee, including the application developer. + */ + @JsonIgnore + public Optional> getAppFeeAllocations() { + if (appFeeAllocations == null) { + return Optional.empty(); + } + return appFeeAllocations; + } + /** * @return The unique ID of the payment being refunded. * Required when unlinked=false, otherwise must not be set. @@ -246,6 +265,12 @@ public Optional getExternalDetails() { return externalDetails; } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("app_fee_allocations") + private Optional> _getAppFeeAllocations() { + return appFeeAllocations; + } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) @JsonProperty("payment_id") private Optional _getPaymentId() { @@ -309,6 +334,7 @@ private boolean equalTo(RefundPaymentRequest other) { return idempotencyKey.equals(other.idempotencyKey) && amountMoney.equals(other.amountMoney) && appFeeMoney.equals(other.appFeeMoney) + && appFeeAllocations.equals(other.appFeeAllocations) && paymentId.equals(other.paymentId) && destinationId.equals(other.destinationId) && unlinked.equals(other.unlinked) @@ -327,6 +353,7 @@ public int hashCode() { this.idempotencyKey, this.amountMoney, this.appFeeMoney, + this.appFeeAllocations, this.paymentId, this.destinationId, this.unlinked, @@ -397,6 +424,18 @@ public interface _FinalStage { _FinalStage appFeeMoney(Money appFeeMoney); + /** + *

Details pertaining to contributors to the refund of the application fee. + * The sum of the amounts in the app_fee_allocations must equal the app_fee_money amount, if + * present. If populated, an allocation must be present for every party that expects to contribute + * a portion of the refunded application fee, including the application developer.

+ */ + _FinalStage appFeeAllocations(Optional> appFeeAllocations); + + _FinalStage appFeeAllocations(List appFeeAllocations); + + _FinalStage appFeeAllocations(Nullable> appFeeAllocations); + /** *

The unique ID of the payment being refunded. * Required when unlinked=false, otherwise must not be set.

@@ -526,6 +565,8 @@ public static final class Builder implements IdempotencyKeyStage, AmountMoneySta private Optional paymentId = Optional.empty(); + private Optional> appFeeAllocations = Optional.empty(); + private Optional appFeeMoney = Optional.empty(); @JsonAnySetter @@ -538,6 +579,7 @@ public Builder from(RefundPaymentRequest other) { idempotencyKey(other.getIdempotencyKey()); amountMoney(other.getAmountMoney()); appFeeMoney(other.getAppFeeMoney()); + appFeeAllocations(other.getAppFeeAllocations()); paymentId(other.getPaymentId()); destinationId(other.getDestinationId()); unlinked(other.getUnlinked()); @@ -972,6 +1014,51 @@ public _FinalStage paymentId(Optional paymentId) { return this; } + /** + *

Details pertaining to contributors to the refund of the application fee. + * The sum of the amounts in the app_fee_allocations must equal the app_fee_money amount, if + * present. If populated, an allocation must be present for every party that expects to contribute + * a portion of the refunded application fee, including the application developer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage appFeeAllocations(Nullable> appFeeAllocations) { + if (appFeeAllocations.isNull()) { + this.appFeeAllocations = null; + } else if (appFeeAllocations.isEmpty()) { + this.appFeeAllocations = Optional.empty(); + } else { + this.appFeeAllocations = Optional.of(appFeeAllocations.get()); + } + return this; + } + + /** + *

Details pertaining to contributors to the refund of the application fee. + * The sum of the amounts in the app_fee_allocations must equal the app_fee_money amount, if + * present. If populated, an allocation must be present for every party that expects to contribute + * a portion of the refunded application fee, including the application developer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage appFeeAllocations(List appFeeAllocations) { + this.appFeeAllocations = Optional.ofNullable(appFeeAllocations); + return this; + } + + /** + *

Details pertaining to contributors to the refund of the application fee. + * The sum of the amounts in the app_fee_allocations must equal the app_fee_money amount, if + * present. If populated, an allocation must be present for every party that expects to contribute + * a portion of the refunded application fee, including the application developer.

+ */ + @java.lang.Override + @JsonSetter(value = "app_fee_allocations", nulls = Nulls.SKIP) + public _FinalStage appFeeAllocations(Optional> appFeeAllocations) { + this.appFeeAllocations = appFeeAllocations; + return this; + } + /** *

The amount of money the developer contributes to help cover the refunded amount. * This amount is specified in the smallest denomination of the applicable currency (for example, @@ -1014,6 +1101,7 @@ public RefundPaymentRequest build() { idempotencyKey, amountMoney, appFeeMoney, + appFeeAllocations, paymentId, destinationId, unlinked, diff --git a/src/main/java/com/squareup/square/types/SearchOrdersSourceFilter.java b/src/main/java/com/squareup/square/types/SearchOrdersSourceFilter.java index e335cc1e..6c1158de 100644 --- a/src/main/java/com/squareup/square/types/SearchOrdersSourceFilter.java +++ b/src/main/java/com/squareup/square/types/SearchOrdersSourceFilter.java @@ -26,20 +26,10 @@ public final class SearchOrdersSourceFilter { private final Optional> sourceNames; - private final Optional> sourceApplicationIds; - - private final Optional> sourceClientOus; - private final Map additionalProperties; - private SearchOrdersSourceFilter( - Optional> sourceNames, - Optional> sourceApplicationIds, - Optional> sourceClientOus, - Map additionalProperties) { + private SearchOrdersSourceFilter(Optional> sourceNames, Map additionalProperties) { this.sourceNames = sourceNames; - this.sourceApplicationIds = sourceApplicationIds; - this.sourceClientOus = sourceClientOus; this.additionalProperties = additionalProperties; } @@ -56,50 +46,12 @@ public Optional> getSourceNames() { return sourceNames; } - /** - * @return Filters by the Source applicationId. The filter returns any orders - * with a source.applicationId that matches any of the listed source applicationIds. - *

Max: 100 source applicationIds.

- */ - @JsonIgnore - public Optional> getSourceApplicationIds() { - if (sourceApplicationIds == null) { - return Optional.empty(); - } - return sourceApplicationIds; - } - - /** - * @return Filters by the Source clientOu. The filter returns any orders - * with a source.clientOu that matches any of the listed source clientOus. - *

Max: 100 source clientOus.

- */ - @JsonIgnore - public Optional> getSourceClientOus() { - if (sourceClientOus == null) { - return Optional.empty(); - } - return sourceClientOus; - } - @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) @JsonProperty("source_names") private Optional> _getSourceNames() { return sourceNames; } - @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) - @JsonProperty("source_application_ids") - private Optional> _getSourceApplicationIds() { - return sourceApplicationIds; - } - - @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) - @JsonProperty("source_client_ous") - private Optional> _getSourceClientOus() { - return sourceClientOus; - } - @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -112,14 +64,12 @@ public Map getAdditionalProperties() { } private boolean equalTo(SearchOrdersSourceFilter other) { - return sourceNames.equals(other.sourceNames) - && sourceApplicationIds.equals(other.sourceApplicationIds) - && sourceClientOus.equals(other.sourceClientOus); + return sourceNames.equals(other.sourceNames); } @java.lang.Override public int hashCode() { - return Objects.hash(this.sourceNames, this.sourceApplicationIds, this.sourceClientOus); + return Objects.hash(this.sourceNames); } @java.lang.Override @@ -135,10 +85,6 @@ public static Builder builder() { public static final class Builder { private Optional> sourceNames = Optional.empty(); - private Optional> sourceApplicationIds = Optional.empty(); - - private Optional> sourceClientOus = Optional.empty(); - @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -146,8 +92,6 @@ private Builder() {} public Builder from(SearchOrdersSourceFilter other) { sourceNames(other.getSourceNames()); - sourceApplicationIds(other.getSourceApplicationIds()); - sourceClientOus(other.getSourceClientOus()); return this; } @@ -178,63 +122,8 @@ public Builder sourceNames(Nullable> sourceNames) { return this; } - /** - *

Filters by the Source applicationId. The filter returns any orders - * with a source.applicationId that matches any of the listed source applicationIds.

- *

Max: 100 source applicationIds.

- */ - @JsonSetter(value = "source_application_ids", nulls = Nulls.SKIP) - public Builder sourceApplicationIds(Optional> sourceApplicationIds) { - this.sourceApplicationIds = sourceApplicationIds; - return this; - } - - public Builder sourceApplicationIds(List sourceApplicationIds) { - this.sourceApplicationIds = Optional.ofNullable(sourceApplicationIds); - return this; - } - - public Builder sourceApplicationIds(Nullable> sourceApplicationIds) { - if (sourceApplicationIds.isNull()) { - this.sourceApplicationIds = null; - } else if (sourceApplicationIds.isEmpty()) { - this.sourceApplicationIds = Optional.empty(); - } else { - this.sourceApplicationIds = Optional.of(sourceApplicationIds.get()); - } - return this; - } - - /** - *

Filters by the Source clientOu. The filter returns any orders - * with a source.clientOu that matches any of the listed source clientOus.

- *

Max: 100 source clientOus.

- */ - @JsonSetter(value = "source_client_ous", nulls = Nulls.SKIP) - public Builder sourceClientOus(Optional> sourceClientOus) { - this.sourceClientOus = sourceClientOus; - return this; - } - - public Builder sourceClientOus(List sourceClientOus) { - this.sourceClientOus = Optional.ofNullable(sourceClientOus); - return this; - } - - public Builder sourceClientOus(Nullable> sourceClientOus) { - if (sourceClientOus.isNull()) { - this.sourceClientOus = null; - } else if (sourceClientOus.isEmpty()) { - this.sourceClientOus = Optional.empty(); - } else { - this.sourceClientOus = Optional.of(sourceClientOus.get()); - } - return this; - } - public SearchOrdersSourceFilter build() { - return new SearchOrdersSourceFilter( - sourceNames, sourceApplicationIds, sourceClientOus, additionalProperties); + return new SearchOrdersSourceFilter(sourceNames, additionalProperties); } public Builder additionalProperty(String key, Object value) {