Skip to content

Commit e0f4aa9

Browse files
committed
Add additional updatedAtBeginTime, updatedAtEndTime, and sortField query parameters to listPaymentRefuns endpoint.
1 parent b0d3ab0 commit e0f4aa9

File tree

7 files changed

+294
-68
lines changed

7 files changed

+294
-68
lines changed

doc/api/refunds.md

Lines changed: 54 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,27 @@ RefundsApi refundsApi = client.getRefundsApi();
1010

1111
## Methods
1212

13-
* [List Payment Refunds](../../doc/api/refunds.md#list-payment-refunds)
14-
* [Refund Payment](../../doc/api/refunds.md#refund-payment)
13+
* [List Payment Refunds](../../doc/api/refunds.md#list-payment-refunds)
14+
* [Refund Payment](../../doc/api/refunds.md#refund-payment)
1515
* [Get Payment Refund](../../doc/api/refunds.md#get-payment-refund)
1616

1717

1818
# List Payment Refunds
1919

20-
Retrieves a list of refunds for the account making the request.
21-
22-
Results are eventually consistent, and new refunds or changes to refunds might take several
23-
seconds to appear.
24-
20+
Retrieves a list of refunds for the account making the request.
21+
22+
Results are eventually consistent, and new refunds or changes to refunds might take several
23+
seconds to appear.
24+
2525
The maximum results per page is 100.
2626

2727
```java
2828
CompletableFuture<ListPaymentRefundsResponse> listPaymentRefundsAsync(
2929
final String beginTime,
3030
final String endTime,
31+
final String updatedAtBeginTime,
32+
final String updatedAtEndTime,
33+
final String sortField,
3134
final String sortOrder,
3235
final String cursor,
3336
final String locationId,
@@ -42,6 +45,9 @@ CompletableFuture<ListPaymentRefundsResponse> listPaymentRefundsAsync(
4245
| --- | --- | --- | --- |
4346
| `beginTime` | `String` | Query, Optional | Indicates the start of the time range to retrieve each `PaymentRefund` for, in RFC 3339<br>format. The range is determined using the `created_at` field for each `PaymentRefund`.<br><br>Default: The current time minus one year. |
4447
| `endTime` | `String` | Query, Optional | Indicates the end of the time range to retrieve each `PaymentRefund` for, in RFC 3339<br>format. The range is determined using the `created_at` field for each `PaymentRefund`.<br><br>Default: The current time. |
48+
| `updatedAtBeginTime` | `string` | Query, Optional | Indicates the start of the time range to retrieve each `PaymentRefund` for, in RFC 3339<br>format. The range is determined using the `updated_at` field for each `PaymentRefund`.<br><br>Default: if omitted, the time range starts at `beginTime`. |
49+
| `updatedAtEndTime` | `string` | Query, Optional | Indicates the end of the time range to retrieve each `PaymentRefund` for, in RFC 3339<br>format. The range is determined using the `updated_at` field for each `PaymentRefund`.<br><br>Default: The current time. |
50+
| `sortField` | `string` | Query, Optional | The field used to sort results by. The default is `CREATED_AT`.<br>Current values include `CREATED_AT` and `UPDATED_AT`.<br> |
4551
| `sortOrder` | `String` | Query, Optional | The order in which results are listed by `PaymentRefund.created_at`:<br><br>- `ASC` - Oldest to newest.<br>- `DESC` - Newest to oldest (default). |
4652
| `cursor` | `String` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.<br>Provide this cursor to retrieve the next set of results for the original query.<br><br>For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). |
4753
| `locationId` | `String` | Query, Optional | Limit results to the location supplied. By default, results are returned<br>for all locations associated with the seller. |
@@ -56,22 +62,22 @@ CompletableFuture<ListPaymentRefundsResponse> listPaymentRefundsAsync(
5662
## Example Usage
5763

5864
```java
59-
refundsApi.listPaymentRefundsAsync(null, null, null, null, null, null, null, null).thenAccept(result -> {
60-
// TODO success callback handler
61-
System.out.println(result);
62-
}).exceptionally(exception -> {
63-
// TODO failure callback handler
64-
exception.printStackTrace();
65-
return null;
65+
refundsApi.listPaymentRefundsAsync(null, null, null, null, null, null, null, null).thenAccept(result -> {
66+
// TODO success callback handler
67+
System.out.println(result);
68+
}).exceptionally(exception -> {
69+
// TODO failure callback handler
70+
exception.printStackTrace();
71+
return null;
6672
});
6773
```
6874

6975

7076
# Refund Payment
7177

72-
Refunds a payment. You can refund the entire payment amount or a
73-
portion of it. You can use this endpoint to refund a card payment or record a
74-
refund of a cash or external payment. For more information, see
78+
Refunds a payment. You can refund the entire payment amount or a
79+
portion of it. You can use this endpoint to refund a card payment or record a
80+
refund of a cash or external payment. For more information, see
7581
[Refund Payment](https://developer.squareup.com/docs/payments-api/refund-payments).
7682

7783
```java
@@ -92,28 +98,28 @@ CompletableFuture<RefundPaymentResponse> refundPaymentAsync(
9298
## Example Usage
9399

94100
```java
95-
RefundPaymentRequest body = new RefundPaymentRequest.Builder(
96-
"9b7f2dcf-49da-4411-b23e-a2d6af21333a",
97-
new Money.Builder()
98-
.amount(1000L)
99-
.currency("USD")
100-
.build()
101-
)
102-
.appFeeMoney(new Money.Builder()
103-
.amount(10L)
104-
.currency("USD")
105-
.build())
106-
.paymentId("R2B3Z8WMVt3EAmzYWLZvz7Y69EbZY")
107-
.reason("Example")
108-
.build();
109-
110-
refundsApi.refundPaymentAsync(body).thenAccept(result -> {
111-
// TODO success callback handler
112-
System.out.println(result);
113-
}).exceptionally(exception -> {
114-
// TODO failure callback handler
115-
exception.printStackTrace();
116-
return null;
101+
RefundPaymentRequest body = new RefundPaymentRequest.Builder(
102+
"9b7f2dcf-49da-4411-b23e-a2d6af21333a",
103+
new Money.Builder()
104+
.amount(1000L)
105+
.currency("USD")
106+
.build()
107+
)
108+
.appFeeMoney(new Money.Builder()
109+
.amount(10L)
110+
.currency("USD")
111+
.build())
112+
.paymentId("R2B3Z8WMVt3EAmzYWLZvz7Y69EbZY")
113+
.reason("Example")
114+
.build();
115+
116+
refundsApi.refundPaymentAsync(body).thenAccept(result -> {
117+
// TODO success callback handler
118+
System.out.println(result);
119+
}).exceptionally(exception -> {
120+
// TODO failure callback handler
121+
exception.printStackTrace();
122+
return null;
117123
});
118124
```
119125

@@ -140,15 +146,15 @@ CompletableFuture<GetPaymentRefundResponse> getPaymentRefundAsync(
140146
## Example Usage
141147

142148
```java
143-
String refundId = "refund_id4";
144-
145-
refundsApi.getPaymentRefundAsync(refundId).thenAccept(result -> {
146-
// TODO success callback handler
147-
System.out.println(result);
148-
}).exceptionally(exception -> {
149-
// TODO failure callback handler
150-
exception.printStackTrace();
151-
return null;
149+
String refundId = "refund_id4";
150+
151+
refundsApi.getPaymentRefundAsync(refundId).thenAccept(result -> {
152+
// TODO success callback handler
153+
System.out.println(result);
154+
}).exceptionally(exception -> {
155+
// TODO failure callback handler
156+
exception.printStackTrace();
157+
return null;
152158
});
153159
```
154160

doc/client.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ The following parameters are configurable for the API Client:
55

66
| Parameter | Type | Description |
77
| --- | --- | --- |
8-
| `squareVersion` | `String` | Square Connect API versions<br>*Default*: `"2025-01-23"` |
8+
| `squareVersion` | `String` | Square Connect API versions<br>*Default*: `"2025-02-17"` |
99
| `customUrl` | `String` | Sets the base URL requests are made to. Defaults to `https://connect.squareup.com`<br>*Default*: `"https://connect.squareup.com"` |
1010
| `environment` | `string` | The API environment. <br> **Default: `production`** |
1111
| `httpClientConfig` | [`Consumer<HttpClientConfiguration.Builder>`](http-client-configuration-builder.md) | Set up Http Client Configuration instance. |
@@ -19,7 +19,7 @@ The API client can be initialized as follows:
1919
SquareClient client = new SquareClient.Builder()
2020
.httpClientConfig(configBuilder -> configBuilder
2121
.timeout(0))
22-
.squareVersion("2025-01-23")
22+
.squareVersion("2025-02-17")
2323
.bearerAuthCredentials(new BearerAuthModel.Builder(
2424
"AccessToken"
2525
)
@@ -45,7 +45,7 @@ public class Program {
4545
SquareClient client = new SquareClient.Builder()
4646
.httpClientConfig(configBuilder -> configBuilder
4747
.timeout(0))
48-
.squareVersion("2025-01-23")
48+
.squareVersion("2025-02-17")
4949
.bearerAuthCredentials(new BearerAuthModel.Builder(
5050
"AccessToken"
5151
)

doc/models/list-payment-refunds-request.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11

22
# List Payment Refunds Request
33

4-
Describes a request to list refunds using
5-
[ListPaymentRefunds](../../doc/api/refunds.md#list-payment-refunds).
6-
4+
Describes a request to list refunds using
5+
[ListPaymentRefunds](../../doc/api/refunds.md#list-payment-refunds).
6+
77
The maximum results per page is 100.
88

99
## Structure
@@ -16,6 +16,9 @@ The maximum results per page is 100.
1616
| --- | --- | --- | --- | --- |
1717
| `BeginTime` | `String` | Optional | Indicates the start of the time range to retrieve each `PaymentRefund` for, in RFC 3339<br>format. The range is determined using the `created_at` field for each `PaymentRefund`.<br><br>Default: The current time minus one year. | String getBeginTime() |
1818
| `EndTime` | `String` | Optional | Indicates the end of the time range to retrieve each `PaymentRefund` for, in RFC 3339<br>format. The range is determined using the `created_at` field for each `PaymentRefund`.<br><br>Default: The current time. | String getEndTime() |
19+
| `UpdatedAtBeginTime` | `string` | Optional | Indicates the start of the time range to retrieve each `PaymentRefund` for, in RFC 3339<br>format. The range is determined using the `updated_at` field for each `PaymentRefund`.<br><br>Default: if omitted, the time range starts at `beginTime`. |
20+
| `UpdatedAtEndTime` | `string` | Optional | Indicates the end of the time range to retrieve each `PaymentRefund` for, in RFC 3339<br>format. The range is determined using the `updated_at` field for each `PaymentRefund`.<br><br>Default: The current time. |
21+
| `SortField` | `string` | Optional | The field used to sort results by. The default is `CREATED_AT`.<br>Current values include `CREATED_AT` and `UPDATED_AT`.<br> |
1922
| `SortOrder` | `String` | Optional | The order in which results are listed by `PaymentRefund.created_at`:<br><br>- `ASC` - Oldest to newest.<br>- `DESC` - Newest to oldest (default). | String getSortOrder() |
2023
| `Cursor` | `String` | Optional | A pagination cursor returned by a previous call to this endpoint.<br>Provide this cursor to retrieve the next set of results for the original query.<br><br>For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | String getCursor() |
2124
| `LocationId` | `String` | Optional | Limit results to the location supplied. By default, results are returned<br>for all locations associated with the seller. | String getLocationId() |

src/main/java/com/squareup/square/SquareClient.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ public final class SquareClient implements SquareClientInterface {
157157

158158
private static final CompatibilityFactory compatibilityFactory = new CompatibilityFactoryImpl();
159159

160-
private static String userAgent = "Square-Java-SDK/43.0.0.20250123 ({api-version}) {engine}/{engine-version} ({os-info}) {detail}";
160+
private static String userAgent = "Square-Java-SDK/43.1.0.20250220 ({api-version}) {engine}/{engine-version} ({os-info}) {detail}";
161161

162162
/**
163163
* Current API environment.
@@ -719,7 +719,7 @@ public String getAccessToken() {
719719
* @return sdkVersion
720720
*/
721721
public String getSdkVersion() {
722-
return "43.0.0.20250123";
722+
return "43.1.0.20250220";
723723
}
724724

725725
/**
@@ -832,7 +832,7 @@ public static class Builder {
832832

833833
private Environment environment = Environment.PRODUCTION;
834834
private String customUrl = "https://connect.squareup.com";
835-
private String squareVersion = "2025-01-23";
835+
private String squareVersion = "2025-02-17";
836836
private HttpClient httpClient;
837837
private Headers additionalHeaders = new Headers();
838838
private String userAgentDetail = null;

src/main/java/com/squareup/square/api/DefaultRefundsApi.java

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ public DefaultRefundsApi(GlobalConfiguration globalConfig) {
4141
* @param endTime Optional parameter: Indicates the end of the time range to retrieve each
4242
* `PaymentRefund` for, in RFC 3339 format. The range is determined using the
4343
* `created_at` field for each `PaymentRefund`. Default: The current time.
44+
* @param updatedAtBeginTime Optional parameter: Indicates the start of the time range to retrieve each
45+
* `PaymentRefund` for, in RFC 3339 format. The range is determined using the
46+
* `updated_at` field for each `PaymentRefund`. Default: if omitted, the time range starts at `beginTime`.
47+
* @param updatedAtEndTime Optional parameter: Indicates the end of the time range to retrieve each
48+
* `PaymentRefund` for, in RFC 3339 format. The range is determined using the
49+
* `updated_at` field for each `PaymentRefund`. Default: The current time.
50+
* @param sortField Optional parameter: The field used to sort results by. The default is `CREATED_AT`.
51+
* Current values include `CREATED_AT` and `UPDATED_AT`.
4452
* @param sortOrder Optional parameter: The order in which results are listed by
4553
* `PaymentRefund.created_at`: - `ASC` - Oldest to newest. - `DESC` - Newest to oldest
4654
* (default).
@@ -70,6 +78,9 @@ public DefaultRefundsApi(GlobalConfiguration globalConfig) {
7078
public ListPaymentRefundsResponse listPaymentRefunds(
7179
final String beginTime,
7280
final String endTime,
81+
final String updatedAtBeginTime,
82+
final String updatedAtEndTime,
83+
final String sortField,
7384
final String sortOrder,
7485
final String cursor,
7586
final String locationId,
@@ -91,6 +102,14 @@ public ListPaymentRefundsResponse listPaymentRefunds(
91102
* @param endTime Optional parameter: Indicates the end of the time range to retrieve each
92103
* `PaymentRefund` for, in RFC 3339 format. The range is determined using the
93104
* `created_at` field for each `PaymentRefund`. Default: The current time.
105+
* @param updatedAtBeginTime Optional parameter: Indicates the start of the time range to retrieve each
106+
* `PaymentRefund` for, in RFC 3339 format. The range is determined using the
107+
* `updated_at` field for each `PaymentRefund`. Default: if omitted, the time range starts at `beginTime`.
108+
* @param updatedAtEndTime Optional parameter: Indicates the end of the time range to retrieve each
109+
* `PaymentRefund` for, in RFC 3339 format. The range is determined using the
110+
* `updated_at` field for each `PaymentRefund`. Default: The current time.
111+
* @param sortField Optional parameter: The field used to sort results by. The default is `CREATED_AT`.
112+
* Current values include `CREATED_AT` and `UPDATED_AT`.
94113
* @param sortOrder Optional parameter: The order in which results are listed by
95114
* `PaymentRefund.created_at`: - `ASC` - Oldest to newest. - `DESC` - Newest to oldest
96115
* (default).
@@ -118,14 +137,17 @@ public ListPaymentRefundsResponse listPaymentRefunds(
118137
public CompletableFuture<ListPaymentRefundsResponse> listPaymentRefundsAsync(
119138
final String beginTime,
120139
final String endTime,
140+
final String updatedAtBeginTime,
141+
final String updatedAtEndTime,
142+
final String sortField,
121143
final String sortOrder,
122144
final String cursor,
123145
final String locationId,
124146
final String status,
125147
final String sourceType,
126148
final Integer limit) {
127149
try {
128-
return prepareListPaymentRefundsRequest(beginTime, endTime, sortOrder, cursor, locationId,
150+
return prepareListPaymentRefundsRequest(beginTime, endTime, updatedAtBeginTime, updatedAtEndTime, sortField, sortOrder, cursor, locationId,
129151
status, sourceType, limit).executeAsync();
130152
} catch (Exception e) {
131153
throw new CompletionException(e);
@@ -138,6 +160,9 @@ public CompletableFuture<ListPaymentRefundsResponse> listPaymentRefundsAsync(
138160
private ApiCall<ListPaymentRefundsResponse, ApiException> prepareListPaymentRefundsRequest(
139161
final String beginTime,
140162
final String endTime,
163+
final String updatedAtBeginTime,
164+
final String updatedAtEndTime,
165+
final String sortField,
141166
final String sortOrder,
142167
final String cursor,
143168
final String locationId,
@@ -153,6 +178,12 @@ private ApiCall<ListPaymentRefundsResponse, ApiException> prepareListPaymentRefu
153178
.value(beginTime).isRequired(false))
154179
.queryParam(param -> param.key("end_time")
155180
.value(endTime).isRequired(false))
181+
.queryParam(param -> param.key("updated_at_begin_time")
182+
.value(updatedAtBeginTime).isRequired(false))
183+
.queryParam(param -> param.key("updated_at_end_time")
184+
.value(updatedAtEndTime).isRequired(false))
185+
.queryParam(param -> param.key("sort_field")
186+
.value(sortField).isRequired(false))
156187
.queryParam(param -> param.key("sort_order")
157188
.value(sortOrder).isRequired(false))
158189
.queryParam(param -> param.key("cursor")

0 commit comments

Comments
 (0)