Skip to content

Commit c1dc7ff

Browse files
authored
Merge pull request #143 from square/eden/update-list-payment-refunds
Add additional `updatedAtBeginTime`, `updatedAtEndTime`, and `sortField` query parameters to `listPaymentRefunds` endpoint.
2 parents a184ac3 + 587db4e commit c1dc7ff

File tree

9 files changed

+41
-11
lines changed

9 files changed

+41
-11
lines changed

doc/api/refunds.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ def list_payment_refunds(begin_time: nil,
3232
location_id: nil,
3333
status: nil,
3434
source_type: nil,
35-
limit: nil)
35+
limit: nil,
36+
updated_at_begin_time: nil,
37+
updated_at_end_time: nil,
38+
sort_field: nil)
3639
```
3740

3841
## Parameters
@@ -47,6 +50,9 @@ def list_payment_refunds(begin_time: nil,
4750
| `status` | `String` | Query, Optional | If provided, only refunds with the given status are returned.<br>For a list of refund status values, see [PaymentRefund](entity:PaymentRefund).<br><br>Default: If omitted, refunds are returned regardless of their status. |
4851
| `source_type` | `String` | Query, Optional | If provided, only returns refunds whose payments have the indicated source type.<br>Current values include `CARD`, `BANK_ACCOUNT`, `WALLET`, `CASH`, and `EXTERNAL`.<br>For information about these payment source types, see<br>[Take Payments](https://developer.squareup.com/docs/payments-api/take-payments).<br><br>Default: If omitted, refunds are returned regardless of the source type. |
4952
| `limit` | `Integer` | Query, Optional | The maximum number of results to be returned in a single page.<br><br>It is possible to receive fewer results than the specified limit on a given page.<br><br>If the supplied value is greater than 100, no more than 100 results are returned.<br><br>Default: 100 |
53+
| `updated_at_begin_time` | `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 `begin_time`. |
54+
| `updated_at_end_time` | `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. |
55+
| `sort_field` | `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> |
5056

5157
## Response Type
5258

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-
| `square_version` | `String` | Square Connect API versions<br>*Default*: `'2025-01-23'` |
8+
| `square_version` | `String` | Square Connect API versions<br>*Default*: `'2025-02-20'` |
99
| `custom_url` | `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
| `connection` | `Faraday::Connection` | The Faraday connection object passed by the SDK user for making requests |
@@ -25,7 +25,7 @@ The API client can be initialized as follows:
2525

2626
```ruby
2727
client = Square::Client.new(
28-
square_version: '2025-01-23',
28+
square_version: '2025-02-20',
2929
bearer_auth_credentials: BearerAuthCredentials.new(
3030
access_token: 'AccessToken'
3131
),
@@ -55,7 +55,7 @@ require 'square'
5555
include Square
5656

5757
client = Square::Client.new(
58-
square_version: '2025-01-23',
58+
square_version: '2025-02-20',
5959
bearer_auth_credentials: BearerAuthCredentials.new(
6060
access_token: 'AccessToken'
6161
),

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ The maximum results per page is 100.
2222
| `status` | `String` | Optional | If provided, only refunds with the given status are returned.<br>For a list of refund status values, see [PaymentRefund](entity:PaymentRefund).<br><br>Default: If omitted, refunds are returned regardless of their status. |
2323
| `source_type` | `String` | Optional | If provided, only returns refunds whose payments have the indicated source type.<br>Current values include `CARD`, `BANK_ACCOUNT`, `WALLET`, `CASH`, and `EXTERNAL`.<br>For information about these payment source types, see<br>[Take Payments](https://developer.squareup.com/docs/payments-api/take-payments).<br><br>Default: If omitted, refunds are returned regardless of the source type. |
2424
| `limit` | `Integer` | Optional | The maximum number of results to be returned in a single page.<br><br>It is possible to receive fewer results than the specified limit on a given page.<br><br>If the supplied value is greater than 100, no more than 100 results are returned.<br><br>Default: 100 |
25+
| `updated_at_begin_time` | `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 `begin_time`. |
26+
| `updated_at_end_time` | `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. |
27+
| `sort_field` | `String` | Optional | The field used to sort results by. The default is `CREATED_AT`.<br>Current values include `CREATED_AT` and `UPDATED_AT`.<br> |
2528

2629
## Example (as JSON)
2730

lib/square/api/base_api.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class BaseApi
55
attr_accessor :config, :http_call_back
66

77
def self.user_agent
8-
'Square-Ruby-SDK/41.0.0.20250123 ({api-version}) {engine}/{engine-version} ({os-info}) {detail}'
8+
'Square-Ruby-SDK/41.1.0.20250220 ({api-version}) {engine}/{engine-version} ({os-info}) {detail}'
99
end
1010

1111
def self.user_agent_parameters

lib/square/api/refunds_api.rb

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,18 @@ class RefundsApi < BaseApi
4040
# to be returned in a single page. It is possible to receive fewer results
4141
# than the specified limit on a given page. If the supplied value is
4242
# greater than 100, no more than 100 results are returned. Default: 100
43+
# @param [String] updated_at_begin_time Optional parameter: Indicates the
44+
# start of the time range to retrieve each `PaymentRefund` for, in RFC 3339
45+
# format. The range is determined using the `updated_at` field for each
46+
# `PaymentRefund`. Default: if omitted, the time range starts at
47+
# `begin_time`.
48+
# @param [String] updated_at_end_time Optional parameter: Indicates the end
49+
# of the time range to retrieve each `PaymentRefund` for, in RFC 3339
50+
# format. The range is determined using the `updated_at` field for each
51+
# `PaymentRefund`. Default: The current time.
52+
# @param [String] sort_field Optional parameter: The field used to sort
53+
# results by. The default is `CREATED_AT`. Current values include
54+
# `CREATED_AT` and `UPDATED_AT`.
4355
# @return [ApiResponse] the complete http response with raw body and status code.
4456
def list_payment_refunds(begin_time: nil,
4557
end_time: nil,
@@ -48,7 +60,10 @@ def list_payment_refunds(begin_time: nil,
4860
location_id: nil,
4961
status: nil,
5062
source_type: nil,
51-
limit: nil)
63+
limit: nil,
64+
updated_at_begin_time: nil,
65+
updated_at_end_time: nil,
66+
sort_field: nil)
5267
new_api_call_builder
5368
.request(new_request_builder(HttpMethodEnum::GET,
5469
'/v2/refunds',
@@ -61,6 +76,9 @@ def list_payment_refunds(begin_time: nil,
6176
.query_param(new_parameter(status, key: 'status'))
6277
.query_param(new_parameter(source_type, key: 'source_type'))
6378
.query_param(new_parameter(limit, key: 'limit'))
79+
.query_param(new_parameter(updated_at_begin_time, key: 'updated_at_begin_time'))
80+
.query_param(new_parameter(updated_at_end_time, key: 'updated_at_end_time'))
81+
.query_param(new_parameter(sort_field, key: 'sort_field'))
6482
.header_param(new_parameter('application/json', key: 'accept'))
6583
.auth(Single.new('global')))
6684
.response(new_response_handler

lib/square/client.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class Client
55
attr_reader :config, :auth_managers
66

77
def sdk_version
8-
'41.0.0.20250123'
8+
'41.1.0.20250220'
99
end
1010

1111
def square_version
@@ -274,7 +274,7 @@ def initialize(
274274
retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
275275
retry_methods: %i[get put], http_callback: nil, environment: 'production',
276276
custom_url: 'https://connect.squareup.com', access_token: nil,
277-
bearer_auth_credentials: nil, square_version: '2025-01-23',
277+
bearer_auth_credentials: nil, square_version: '2025-02-20',
278278
user_agent_detail: '', additional_headers: {}, config: nil
279279
)
280280
@config = if config.nil?

lib/square/configuration.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def initialize(
2424
retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
2525
retry_methods: %i[get put], http_callback: nil, environment: 'production',
2626
custom_url: 'https://connect.squareup.com', access_token: nil,
27-
bearer_auth_credentials: nil, square_version: '2025-01-23',
27+
bearer_auth_credentials: nil, square_version: '2025-02-20',
2828
user_agent_detail: '', additional_headers: {}
2929
)
3030

square.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Gem::Specification.new do |s|
22
s.name = 'square.rb'
3-
s.version = '41.0.0.20250123'
3+
s.version = '41.1.0.20250220'
44
s.summary = 'square'
55
s.description = ''
66
s.authors = ['Square Developer Platform']

test/api/test_refunds_api.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,12 @@ def test_test_list_payment_refunds()
2222
location_id = nil
2323
status = nil
2424
source_type = nil
25+
updated_at_begin_time = nil
26+
updated_at_end_time = nil
27+
sort_field = nil
2528

2629
# Perform the API call through the SDK function
27-
result = @controller.list_payment_refunds(begin_time: begin_time, end_time: end_time, sort_order: sort_order, cursor: cursor, location_id: location_id, status: status, source_type: source_type)
30+
result = @controller.list_payment_refunds(begin_time: begin_time, end_time: end_time, sort_order: sort_order, cursor: cursor, location_id: location_id, status: status, source_type: source_type, updated_at_begin_time: updated_at_begin_time, updated_at_end_time: updated_at_end_time, sort_field: sort_field)
2831

2932
# Test response code
3033
assert_equal(200, @response_catcher.response.status_code)

0 commit comments

Comments
 (0)