Skip to content

Commit 38717db

Browse files
authored
Merge pull request #143 from square/eden/update-list-payment-refunds
feat: Add additional `updatedAtBeginTime`, `updatedAtEndTime`, and `sortField` query parameters to `listPaymentRefunds` endpoint.
2 parents ead4876 + 9f9c0a5 commit 38717db

File tree

8 files changed

+51
-16
lines changed

8 files changed

+51
-16
lines changed

doc/api/refunds.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ def list_payment_refunds(self,
3333
location_id=None,
3434
status=None,
3535
source_type=None,
36-
limit=None)
36+
limit=None,
37+
updated_at_begin_time=None,
38+
updated_at_end_time=None,
39+
sort_field=None)
3740
```
3841

3942
## Parameters
@@ -48,6 +51,9 @@ def list_payment_refunds(self,
4851
| `status` | `str` | 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. |
4952
| `source_type` | `str` | 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. |
5053
| `limit` | `int` | 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 |
54+
| `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`. |
55+
| `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. |
56+
| `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> |
5157

5258
## Response Type
5359

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` | `str` | Square Connect API versions<br>*Default*: `'2025-01-23'` |
8+
| `square_version` | `str` | Square Connect API versions<br>*Default*: `'2025-02-20'` |
99
| `custom_url` | `str` | 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
| `http_client_instance` | `HttpClient` | The Http Client passed from the sdk user for making requests |
@@ -24,7 +24,7 @@ The API client can be initialized as follows:
2424

2525
```python
2626
client = Client(
27-
square_version='2025-01-23',
27+
square_version='2025-02-20',
2828
bearer_auth_credentials=BearerAuthCredentials(
2929
access_token='AccessToken'
3030
),
@@ -53,7 +53,7 @@ from square.http.auth.o_auth_2 import BearerAuthCredentials
5353
from square.client import Client
5454

5555
client = Client(
56-
square_version='2025-01-23',
56+
square_version='2025-02-20',
5757
bearer_auth_credentials=BearerAuthCredentials(
5858
access_token='AccessToken'
5959
),

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ requires = ["setuptools>=61.0"]
44
[project]
55
name = "squareup"
66
description = "Use Square APIs to manage and run business including payment, customer, product, inventory, and employee management."
7-
version = "40.0.0.220250123"
7+
version = "40.1.0.220250220"
88
readme = "README.md"
99
requires-python = ">=3.7"
1010
authors = [{name = "Square Developer Platform", email = "developers@squareup.com"}]

square/api/base_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class BaseApi(object):
2222

2323
@staticmethod
2424
def user_agent():
25-
return 'Square-Python-SDK/40.0.0.220250123 ({api-version}) {engine}/{engine-version} ({os-info}) {detail}'
25+
return 'Square-Python-SDK/40.1.0.220250220 ({api-version}) {engine}/{engine-version} ({os-info}) {detail}'
2626

2727
@staticmethod
2828
def user_agent_parameters():

square/api/refunds_api.py

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
# -*- coding: utf-8 -*-
22

3-
from square.api_helper import APIHelper
4-
from square.http.api_response import ApiResponse
5-
from square.api.base_api import BaseApi
3+
from apimatic_core.authentication.multiple.single_auth import Single
64
from apimatic_core.request_builder import RequestBuilder
75
from apimatic_core.response_handler import ResponseHandler
86
from apimatic_core.types.parameter import Parameter
7+
8+
from square.api.base_api import BaseApi
9+
from square.api_helper import APIHelper
10+
from square.http.api_response import ApiResponse
911
from square.http.http_method_enum import HttpMethodEnum
10-
from apimatic_core.authentication.multiple.single_auth import Single
1112

1213

1314
class RefundsApi(BaseApi):
@@ -24,7 +25,10 @@ def list_payment_refunds(self,
2425
location_id=None,
2526
status=None,
2627
source_type=None,
27-
limit=None):
28+
limit=None,
29+
updated_at_begin_time=None,
30+
updated_at_end_time=None,
31+
sort_field=None):
2832
"""Does a GET request to /v2/refunds.
2933
3034
Retrieves a list of refunds for the account making the request.
@@ -71,6 +75,18 @@ def list_payment_refunds(self,
7175
results than the specified limit on a given page. If the
7276
supplied value is greater than 100, no more than 100 results
7377
are returned. Default: 100
78+
updated_at_begin_time (str, optional): Indicates the start of the time range
79+
to retrieve each `PaymentRefund` for, in RFC 3339 format.
80+
The range is determined using the `updated_at` field for each
81+
`PaymentRefund`. Default: if omitted, the time range starts at
82+
`begin_time`.
83+
updated_at_end_time (str, optional): Indicates the end of the time range to
84+
retrieve each `PaymentRefund` for, in RFC 3339 format. The
85+
range is determined using the `updated_at` field for each
86+
`PaymentRefund`. Default: The current time.
87+
sort_field (str, optional): The field used to sort results by. The default
88+
is `CREATED_AT`. Current values include `CREATED_AT` and
89+
`UPDATED_AT`.
7490
7591
Returns:
7692
ApiResponse: An object with the response value as well as other
@@ -112,6 +128,15 @@ def list_payment_refunds(self,
112128
.query_param(Parameter()
113129
.key('limit')
114130
.value(limit))
131+
.query_param(Parameter()
132+
.key('updated_at_begin_time')
133+
.value(updated_at_begin_time))
134+
.query_param(Parameter()
135+
.key('updated_at_end_time')
136+
.value(updated_at_end_time))
137+
.query_param(Parameter()
138+
.key('sort_field')
139+
.value(sort_field))
115140
.header_param(Parameter()
116141
.key('accept')
117142
.value('application/json'))

square/client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@
5555
class Client(object):
5656
@staticmethod
5757
def sdk_version():
58-
return '40.0.0.220250123'
58+
return '40.1.0.220250220'
5959

6060
@staticmethod
6161
def square_version():
62-
return '2025-01-23'
62+
return '2025-02-20'
6363

6464
def user_agent_detail(self):
6565
return self.config.user_agent_detail
@@ -238,7 +238,7 @@ def __init__(self, http_client_instance=None,
238238
retry_statuses=None, retry_methods=None,
239239
environment='production',
240240
custom_url='https://connect.squareup.com', access_token=None,
241-
bearer_auth_credentials=None, square_version='2025-01-23',
241+
bearer_auth_credentials=None, square_version='2025-02-20',
242242
additional_headers={}, user_agent_detail='', config=None):
243243
self.config = config or Configuration(
244244
http_client_instance=http_client_instance,

square/configuration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def __init__(self, http_client_instance=None,
4545
retry_statuses=None, retry_methods=None,
4646
environment='production',
4747
custom_url='https://connect.squareup.com', access_token=None,
48-
bearer_auth_credentials=None, square_version='2025-01-23',
48+
bearer_auth_credentials=None, square_version='2025-02-20',
4949
additional_headers={}, user_agent_detail=''):
5050
if retry_methods is None:
5151
retry_methods = ['GET', 'PUT']

tests/api/test_refunds_api.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from tests.test_helper import TestHelper
44
from tests.api.api_test_base import ApiTestBase
55

6+
67
class RefundsApiTests(ApiTestBase):
78

89
@classmethod
@@ -23,9 +24,12 @@ def test_test_list_payment_refunds(self):
2324
location_id = None
2425
status = None
2526
source_type = None
27+
updated_at_begin_time = None
28+
updated_at_end_time = None
29+
sort_field = None
2630

2731
# Perform the API call through the SDK function
28-
result = self.controller.list_payment_refunds(begin_time, end_time, sort_order, cursor, location_id, status, source_type)
32+
result = self.controller.list_payment_refunds(begin_time, end_time, sort_order, cursor, location_id, status, source_type, updated_at_begin_time, updated_at_end_time, sort_field)
2933

3034
# Test response code
3135
self.assertEquals(self.response_catcher.response.status_code, 200)

0 commit comments

Comments
 (0)