Skip to content

Commit

Permalink
Merge pull request #124 from square/release/41.2.0.20241017
Browse files Browse the repository at this point in the history
Generated PR for Release: 41.2.0.20241017
  • Loading branch information
Esawyer25 authored Oct 17, 2024
2 parents 37bd603 + 4bbd138 commit be3114b
Show file tree
Hide file tree
Showing 18 changed files with 651 additions and 34 deletions.
6 changes: 3 additions & 3 deletions doc/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ The following parameters are configurable for the API Client:

| Parameter | Type | Description |
| --- | --- | --- |
| `squareVersion` | `String` | Square Connect API versions<br>*Default*: `"2024-09-19"` |
| `squareVersion` | `String` | Square Connect API versions<br>*Default*: `"2024-10-17"` |
| `customUrl` | `String` | Sets the base URL requests are made to. Defaults to `https://connect.squareup.com`<br>*Default*: `"https://connect.squareup.com"` |
| `environment` | `string` | The API environment. <br> **Default: `production`** |
| `httpClientConfig` | [`Consumer<HttpClientConfiguration.Builder>`](http-client-configuration-builder.md) | Set up Http Client Configuration instance. |
Expand All @@ -19,7 +19,7 @@ The API client can be initialized as follows:
SquareClient client = new SquareClient.Builder()
.httpClientConfig(configBuilder -> configBuilder
.timeout(0))
.squareVersion("2024-09-19")
.squareVersion("2024-10-17")
.bearerAuthCredentials(new BearerAuthModel.Builder(
"AccessToken"
)
Expand All @@ -45,7 +45,7 @@ public class Program {
SquareClient client = new SquareClient.Builder()
.httpClientConfig(configBuilder -> configBuilder
.timeout(0))
.squareVersion("2024-09-19")
.squareVersion("2024-10-17")
.bearerAuthCredentials(new BearerAuthModel.Builder(
"AccessToken"
)
Expand Down
31 changes: 31 additions & 0 deletions doc/models/destination-details-cash-refund-details.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

# Destination Details Cash Refund Details

Stores details about a cash refund. Contains only non-confidential information.

## Structure

`DestinationDetailsCashRefundDetails`

## Fields

| Name | Type | Tags | Description | Getter |
| --- | --- | --- | --- | --- |
| `SellerSuppliedMoney` | [`Money`](../../doc/models/money.md) | Required | Represents an amount of money. `Money` fields can be signed or unsigned.<br>Fields that do not explicitly define whether they are signed or unsigned are<br>considered unsigned and can only hold positive amounts. For signed fields, the<br>sign of the value indicates the purpose of the money transfer. See<br>[Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts)<br>for more information. | Money getSellerSuppliedMoney() |
| `ChangeBackMoney` | [`Money`](../../doc/models/money.md) | Optional | Represents an amount of money. `Money` fields can be signed or unsigned.<br>Fields that do not explicitly define whether they are signed or unsigned are<br>considered unsigned and can only hold positive amounts. For signed fields, the<br>sign of the value indicates the purpose of the money transfer. See<br>[Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts)<br>for more information. | Money getChangeBackMoney() |

## Example (as JSON)

```json
{
"seller_supplied_money": {
"amount": 36,
"currency": "AZN"
},
"change_back_money": {
"amount": 78,
"currency": "DJF"
}
}
```

27 changes: 27 additions & 0 deletions doc/models/destination-details-external-refund-details.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

# Destination Details External Refund Details

Stores details about an external refund. Contains only non-confidential information.

## Structure

`DestinationDetailsExternalRefundDetails`

## Fields

| Name | Type | Tags | Description | Getter |
| --- | --- | --- | --- | --- |
| `Type` | `String` | Required | The type of external refund the seller paid to the buyer. It can be one of the<br>following:<br><br>- CHECK - Refunded using a physical check.<br>- BANK_TRANSFER - Refunded using external bank transfer.<br>- OTHER\_GIFT\_CARD - Refunded using a non-Square gift card.<br>- CRYPTO - Refunded using a crypto currency.<br>- SQUARE_CASH - Refunded using Square Cash App.<br>- SOCIAL - Refunded using peer-to-peer payment applications.<br>- EXTERNAL - A third-party application gathered this refund outside of Square.<br>- EMONEY - Refunded using an E-money provider.<br>- CARD - A credit or debit card that Square does not support.<br>- STORED_BALANCE - Use for house accounts, store credit, and so forth.<br>- FOOD_VOUCHER - Restaurant voucher provided by employers to employees to pay for meals<br>- OTHER - A type not listed here.<br>**Constraints**: *Maximum Length*: `50` | String getType() |
| `Source` | `String` | Required | A description of the external refund source. For example,<br>"Food Delivery Service".<br>**Constraints**: *Maximum Length*: `255` | String getSource() |
| `SourceId` | `String` | Optional | An ID to associate the refund to its originating source.<br>**Constraints**: *Maximum Length*: `255` | String getSourceId() |

## Example (as JSON)

```json
{
"type": "type4",
"source": "source2",
"source_id": "source_id0"
}
```

17 changes: 17 additions & 0 deletions doc/models/destination-details.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Details about a refund's destination.
| Name | Type | Tags | Description | Getter |
| --- | --- | --- | --- | --- |
| `CardDetails` | [`DestinationDetailsCardRefundDetails`](../../doc/models/destination-details-card-refund-details.md) | Optional | - | DestinationDetailsCardRefundDetails getCardDetails() |
| `CashDetails` | [`DestinationDetailsCashRefundDetails`](../../doc/models/destination-details-cash-refund-details.md) | Optional | Stores details about a cash refund. Contains only non-confidential information. | DestinationDetailsCashRefundDetails getCashDetails() |
| `ExternalDetails` | [`DestinationDetailsExternalRefundDetails`](../../doc/models/destination-details-external-refund-details.md) | Optional | Stores details about an external refund. Contains only non-confidential information. | DestinationDetailsExternalRefundDetails getExternalDetails() |

## Example (as JSON)

Expand All @@ -27,6 +29,21 @@ Details about a refund's destination.
},
"entry_method": "entry_method8",
"auth_result_code": "auth_result_code0"
},
"cash_details": {
"seller_supplied_money": {
"amount": 36,
"currency": "AZN"
},
"change_back_money": {
"amount": 78,
"currency": "DJF"
}
},
"external_details": {
"type": "type6",
"source": "source0",
"source_id": "source_id8"
}
}
```
Expand Down
15 changes: 15 additions & 0 deletions doc/models/get-payment-refund-response.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,21 @@ present or it might be present in a FAILED state.
},
"entry_method": "entry_method8",
"auth_result_code": "auth_result_code0"
},
"cash_details": {
"seller_supplied_money": {
"amount": 36,
"currency": "AZN"
},
"change_back_money": {
"amount": 78,
"currency": "DJF"
}
},
"external_details": {
"type": "type6",
"source": "source0",
"source_id": "source_id8"
}
}
},
Expand Down
15 changes: 15 additions & 0 deletions doc/models/list-payment-refunds-response.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,21 @@ Either `errors` or `refunds` is present in a given response (never both).
},
"entry_method": "entry_method8",
"auth_result_code": "auth_result_code0"
},
"cash_details": {
"seller_supplied_money": {
"amount": 36,
"currency": "AZN"
},
"change_back_money": {
"amount": 78,
"currency": "DJF"
}
},
"external_details": {
"type": "type6",
"source": "source0",
"source_id": "source_id8"
}
}
}
Expand Down
15 changes: 15 additions & 0 deletions doc/models/payment-refund.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,21 @@ the original payment and the amount of money refunded.
},
"entry_method": "entry_method8",
"auth_result_code": "auth_result_code0"
},
"cash_details": {
"seller_supplied_money": {
"amount": 36,
"currency": "AZN"
},
"change_back_money": {
"amount": 78,
"currency": "DJF"
}
},
"external_details": {
"type": "type6",
"source": "source0",
"source_id": "source_id8"
}
},
"amount_money": {
Expand Down
4 changes: 3 additions & 1 deletion doc/models/refund-payment-request.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ Describes a request to refund a payment using [RefundPayment](../../doc/api/refu
| `AmountMoney` | [`Money`](../../doc/models/money.md) | Required | Represents an amount of money. `Money` fields can be signed or unsigned.<br>Fields that do not explicitly define whether they are signed or unsigned are<br>considered unsigned and can only hold positive amounts. For signed fields, the<br>sign of the value indicates the purpose of the money transfer. See<br>[Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts)<br>for more information. | Money getAmountMoney() |
| `AppFeeMoney` | [`Money`](../../doc/models/money.md) | Optional | Represents an amount of money. `Money` fields can be signed or unsigned.<br>Fields that do not explicitly define whether they are signed or unsigned are<br>considered unsigned and can only hold positive amounts. For signed fields, the<br>sign of the value indicates the purpose of the money transfer. See<br>[Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts)<br>for more information. | Money getAppFeeMoney() |
| `PaymentId` | `String` | Optional | The unique ID of the payment being refunded.<br>Required when unlinked=false, otherwise must not be set. | String getPaymentId() |
| `DestinationId` | `String` | Optional | The ID indicating where funds will be refunded to, if this is an unlinked refund.<br>This can be any of the following: A token generated by Web Payments SDK;<br>a card-on-file identifier.<br>Required for requests specifying unlinked=true.<br>Otherwise, if included when `unlinked=false`, will throw an error. | String getDestinationId() |
| `DestinationId` | `String` | Optional | The ID indicating where funds will be refunded to. Required for unlinked refunds. For more<br>information, see [Create an unlinked refund](https://developer.squareup.com/docs/payments-api/refund-payments#create-an-unlinked-refund).<br><br>For refunds linked to Square payments, destination_id is usually omitted; in this case, funds<br>will be returned to the original payment source. The field may be specified in order to request<br>a cross-method refund to a gift card. For more information,<br>see [Cross-method refunds to gift cards](https://developer.squareup.com/docs/payments-api/refund-payments#cross-method-refunds-to-gift-cards). | String getDestinationId() |
| `Unlinked` | `Boolean` | Optional | Indicates that the refund is not linked to a Square payment.<br>If set to true, `destination_id` and `location_id` must be supplied while `payment_id` must not<br>be provided. | Boolean getUnlinked() |
| `LocationId` | `String` | Optional | The location ID associated with the unlinked refund.<br>Required for requests specifying `unlinked=true`.<br>Otherwise, if included when `unlinked=false`, will throw an error.<br>**Constraints**: *Maximum Length*: `50` | String getLocationId() |
| `CustomerId` | `String` | Optional | The [Customer](entity:Customer) ID of the customer associated with the refund.<br>This is required if the `destination_id` refers to a card on file created using the Cards<br>API. Only allowed when `unlinked=true`. | String getCustomerId() |
| `Reason` | `String` | Optional | A description of the reason for the refund.<br>**Constraints**: *Maximum Length*: `192` | String getReason() |
| `PaymentVersionToken` | `String` | Optional | Used for optimistic concurrency. This opaque token identifies the current `Payment`<br>version that the caller expects. If the server has a different version of the Payment,<br>the update fails and a response with a VERSION_MISMATCH error is returned.<br>If the versions match, or the field is not provided, the refund proceeds as normal. | String getPaymentVersionToken() |
| `TeamMemberId` | `String` | Optional | An optional [TeamMember](entity:TeamMember) ID to associate with this refund.<br>**Constraints**: *Maximum Length*: `192` | String getTeamMemberId() |
| `CashDetails` | [`DestinationDetailsCashRefundDetails`](../../doc/models/destination-details-cash-refund-details.md) | Optional | Stores details about a cash refund. Contains only non-confidential information. | DestinationDetailsCashRefundDetails getCashDetails() |
| `ExternalDetails` | [`DestinationDetailsExternalRefundDetails`](../../doc/models/destination-details-external-refund-details.md) | Optional | Stores details about an external refund. Contains only non-confidential information. | DestinationDetailsExternalRefundDetails getExternalDetails() |

## Example (as JSON)

Expand Down
15 changes: 15 additions & 0 deletions doc/models/refund-payment-response.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,21 @@ present, or it might be present with a status of `FAILED`.
},
"entry_method": "entry_method8",
"auth_result_code": "auth_result_code0"
},
"cash_details": {
"seller_supplied_money": {
"amount": 36,
"currency": "AZN"
},
"change_back_money": {
"amount": 78,
"currency": "DJF"
}
},
"external_details": {
"type": "type6",
"source": "source0",
"source_id": "source_id8"
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.squareup</groupId>
<artifactId>square</artifactId>
<version>41.1.0.20240919</version>
<version>41.2.0.20241017</version>
<packaging>jar</packaging>
<name>Square</name>
<description>Java client library for the Square API</description>
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/squareup/square/SquareClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public final class SquareClient implements SquareClientInterface {

private static final CompatibilityFactory compatibilityFactory = new CompatibilityFactoryImpl();

private static String userAgent = "Square-Java-SDK/41.1.0.20240919 ({api-version}) {engine}/{engine-version} ({os-info}) {detail}";
private static String userAgent = "Square-Java-SDK/41.2.0.20241017 ({api-version}) {engine}/{engine-version} ({os-info}) {detail}";

/**
* Current API environment.
Expand Down Expand Up @@ -719,7 +719,7 @@ public String getAccessToken() {
* @return sdkVersion
*/
public String getSdkVersion() {
return "41.1.0.20240919";
return "41.2.0.20241017";
}

/**
Expand Down Expand Up @@ -832,7 +832,7 @@ public static class Builder {

private Environment environment = Environment.PRODUCTION;
private String customUrl = "https://connect.squareup.com";
private String squareVersion = "2024-09-19";
private String squareVersion = "2024-10-17";
private HttpClient httpClient;
private Headers additionalHeaders = new Headers();
private String userAgentDetail = null;
Expand Down
70 changes: 64 additions & 6 deletions src/main/java/com/squareup/square/models/DestinationDetails.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,23 @@
*/
public class DestinationDetails {
private final DestinationDetailsCardRefundDetails cardDetails;
private final DestinationDetailsCashRefundDetails cashDetails;
private final DestinationDetailsExternalRefundDetails externalDetails;

/**
* Initialization constructor.
* @param cardDetails DestinationDetailsCardRefundDetails value for cardDetails.
* @param cashDetails DestinationDetailsCashRefundDetails value for cashDetails.
* @param externalDetails DestinationDetailsExternalRefundDetails value for externalDetails.
*/
@JsonCreator
public DestinationDetails(
@JsonProperty("card_details") DestinationDetailsCardRefundDetails cardDetails) {
@JsonProperty("card_details") DestinationDetailsCardRefundDetails cardDetails,
@JsonProperty("cash_details") DestinationDetailsCashRefundDetails cashDetails,
@JsonProperty("external_details") DestinationDetailsExternalRefundDetails externalDetails) {
this.cardDetails = cardDetails;
this.cashDetails = cashDetails;
this.externalDetails = externalDetails;
}

/**
Expand All @@ -33,9 +41,31 @@ public DestinationDetailsCardRefundDetails getCardDetails() {
return cardDetails;
}

/**
* Getter for CashDetails.
* Stores details about a cash refund. Contains only non-confidential information.
* @return Returns the DestinationDetailsCashRefundDetails
*/
@JsonGetter("cash_details")
@JsonInclude(JsonInclude.Include.NON_NULL)
public DestinationDetailsCashRefundDetails getCashDetails() {
return cashDetails;
}

/**
* Getter for ExternalDetails.
* Stores details about an external refund. Contains only non-confidential information.
* @return Returns the DestinationDetailsExternalRefundDetails
*/
@JsonGetter("external_details")
@JsonInclude(JsonInclude.Include.NON_NULL)
public DestinationDetailsExternalRefundDetails getExternalDetails() {
return externalDetails;
}

@Override
public int hashCode() {
return Objects.hash(cardDetails);
return Objects.hash(cardDetails, cashDetails, externalDetails);
}

@Override
Expand All @@ -47,7 +77,9 @@ public boolean equals(Object obj) {
return false;
}
DestinationDetails other = (DestinationDetails) obj;
return Objects.equals(cardDetails, other.cardDetails);
return Objects.equals(cardDetails, other.cardDetails)
&& Objects.equals(cashDetails, other.cashDetails)
&& Objects.equals(externalDetails, other.externalDetails);
}

/**
Expand All @@ -56,7 +88,8 @@ public boolean equals(Object obj) {
*/
@Override
public String toString() {
return "DestinationDetails [" + "cardDetails=" + cardDetails + "]";
return "DestinationDetails [" + "cardDetails=" + cardDetails + ", cashDetails="
+ cashDetails + ", externalDetails=" + externalDetails + "]";
}

/**
Expand All @@ -66,7 +99,9 @@ public String toString() {
*/
public Builder toBuilder() {
Builder builder = new Builder()
.cardDetails(getCardDetails());
.cardDetails(getCardDetails())
.cashDetails(getCashDetails())
.externalDetails(getExternalDetails());
return builder;
}

Expand All @@ -75,6 +110,8 @@ public Builder toBuilder() {
*/
public static class Builder {
private DestinationDetailsCardRefundDetails cardDetails;
private DestinationDetailsCashRefundDetails cashDetails;
private DestinationDetailsExternalRefundDetails externalDetails;



Expand All @@ -88,12 +125,33 @@ public Builder cardDetails(DestinationDetailsCardRefundDetails cardDetails) {
return this;
}

/**
* Setter for cashDetails.
* @param cashDetails DestinationDetailsCashRefundDetails value for cashDetails.
* @return Builder
*/
public Builder cashDetails(DestinationDetailsCashRefundDetails cashDetails) {
this.cashDetails = cashDetails;
return this;
}

/**
* Setter for externalDetails.
* @param externalDetails DestinationDetailsExternalRefundDetails value for
* externalDetails.
* @return Builder
*/
public Builder externalDetails(DestinationDetailsExternalRefundDetails externalDetails) {
this.externalDetails = externalDetails;
return this;
}

/**
* Builds a new {@link DestinationDetails} object using the set fields.
* @return {@link DestinationDetails}
*/
public DestinationDetails build() {
return new DestinationDetails(cardDetails);
return new DestinationDetails(cardDetails, cashDetails, externalDetails);
}
}
}
Loading

0 comments on commit be3114b

Please sign in to comment.