Skip to content

Commit 5d30eea

Browse files
Merge pull request #59 from square/release/11.0.0.20210513
Generated PR for Release: 11.0.0.20210513
2 parents 49546d6 + d4f5ed1 commit 5d30eea

133 files changed

Lines changed: 1255 additions & 441 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3+
4+
name: Python package
5+
6+
on:
7+
push:
8+
branches: [master]
9+
pull_request:
10+
branches: [master]
11+
12+
jobs:
13+
build:
14+
env:
15+
SQUARE_ENVIRONMENT: sandbox
16+
SQUARE_SANDBOX_TOKEN: ${{ secrets.SQUARE_SANDBOX_TOKEN }}
17+
18+
runs-on: ubuntu-latest
19+
strategy:
20+
matrix:
21+
python-version: [2.7, 3.5]
22+
23+
steps:
24+
- uses: actions/checkout@v2
25+
- name: Set up Python ${{ matrix.python-version }}
26+
uses: actions/setup-python@v2
27+
with:
28+
python-version: ${{ matrix.python-version }}
29+
- name: Install dependencies
30+
run: |
31+
python -m pip install --upgrade pip
32+
pip install -r requirements.txt
33+
pip install -r test-requirements.txt
34+
- name: Test with nose
35+
run: |
36+
nosetests

CHANGELOG.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,39 @@
11
# Change Log
22

3+
## Version 11.0.0.20210513 (2021-05-13)
4+
## New API releases
5+
6+
* **Sites API.** The [Sites API](https://developer.squareup.com/reference/square_2021-05-13/sites-api) lets you retrieve basic details about the Square Online sites that belong to a Square seller. For more information, see [Sites API Overview.](https://developer.squareup.com/docs/sites-api/overview)
7+
8+
9+
* **Snippets API.** The [Snippets API](https://developer.squareup.com/reference/square_2021-05-13/snippets-api) lets you manage snippets that provide custom functionality on Square Online sites. A snippet is a script that is injected into all pages on a site, except for checkout pages. For more information, see [Snippets API Overview.](https://developer.squareup.com/docs/snippets-api/overview)
10+
11+
The Sites API and Snippets API are publicly available to all developers as part of an early access program (EAP). For more information, see [Early access program for Square Online APIs.](https://developer.squareup.com/docs/online-api#early-access-program-for-square-online-apis)
12+
13+
## API updates
14+
15+
* **Payments API.**
16+
* [CreatePayment.](https://developer.squareup.com/reference/square_2021-05-13/payments-api/create-payment) The endpoint now supports ACH bank transfer payments. For more information, see [ACH Payment](https://developer.squareup.com/docs/payments-api/take-payments/ach-payments).
17+
18+
* **Loyalty API:**
19+
* The [Loyalty API](https://developer.squareup.com/docs/loyalty-api/overview) has moved to the [general availability](https://developer.squareup.com/docs/build-basics/api-lifecycle#general-availability) (GA) state.
20+
21+
* The [ListLoyaltyPrograms](https://developer.squareup.com/reference/square_2021-05-13/loyalty-api/list-loyalty-programs) endpoint is deprecated and replaced by the [RetrieveLoyaltyProgram](https://developer.squareup.com/reference/square_2021-05-13/loyalty-api/retrieve-loyalty-program) endpoint when used with the `main` keyword.
22+
23+
* [LoyaltyAccount](https://developer.squareup.com/reference/square_2021-05-13/objects/LoyaltyAccount)  object. The `mappings` field is retired and replaced by `mapping`.
24+
25+
* [LoyaltyAccountMapping](https://developer.squareup.com/reference/square_2021-05-13/objects/LoyaltyAccountMapping) object. The `type` and `value` fields are retired and replaced by `phone_number`.
26+
27+
Starting in Square version 2021-05-13:
28+
* `mappings` is not accepted in `CreateLoyaltyAccount` requests or returned in responses.
29+
* `type` and `value` are not accepted in `CreateLoyaltyAccount` or `SearchLoyaltyAccounts` requests or returned in responses.
30+
31+
For more information, see [Migration notes.](https://developer.squareup.com/docs/loyalty-api/overview#migration-notes)
32+
33+
## Documentation updates
34+
* **Getting Started** Added step that shows how to use the API Logs to examine a transaction.
35+
36+
337
## Version 10.0.0.20210421 (2021-04-21)
438
## New API releases
539

README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Square Python SDK
44

5-
[![Travis status](https://travis-ci.org/square/square-python-sdk.svg?branch=master)](https://travis-ci.org/square/square-python-sdk)
5+
[![Build](https://github.com/square/square-python-sdk/actions/workflows/python-package.yml/badge.svg)](https://github.com/square/square-python-sdk/actions/workflows/python-package.yml)
66
[![PyPi version](https://badge.fury.io/py/squareup.svg?new)](https://badge.fury.io/py/squareup)
77
[![Apache-2 license](https://img.shields.io/badge/license-Apache2-brightgreen.svg)](https://www.apache.org/licenses/LICENSE-2.0)
88

@@ -86,9 +86,13 @@ pip install -r test-requirements.txt
8686
### Financials
8787
* [Bank Accounts]
8888

89+
### Online
90+
* [Sites]
91+
* [Snippets]
92+
8993
### Authorization APIs
9094
* [Mobile Authorization]
91-
* [O Auth]
95+
* [OAuth]
9296

9397
### Deprecated APIs
9498
* [V1 Employees]
@@ -394,7 +398,7 @@ You can also use the Square API to create applications or services that work wit
394398
[Refunds]: doc/api/refunds.md
395399
[Subscriptions]: doc/api/subscriptions.md
396400
[Mobile Authorization]: doc/api/mobile-authorization.md
397-
[O Auth]: doc/api/o-auth.md
401+
[OAuth]: doc/api/o-auth.md
398402
[V1 Employees]: doc/api/v1-employees.md
399403
[V1 Transactions]: doc/api/v1-transactions.md
400404
[V1 Items]: doc/api/v1-items.md
@@ -403,3 +407,5 @@ You can also use the Square API to create applications or services that work wit
403407
[Python SDK]: https://github.com/square/square-python-sdk
404408
[Locations overview]: https://developer.squareup.com/docs/locations-api/what-it-does
405409
[OAuth overview]: https://developer.squareup.com/docs/oauth-api/what-it-does
410+
[Sites]: doc/api/sites.md
411+
[Snippets]: doc/api/snippets.md

doc/api/catalog.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -444,9 +444,9 @@ def list_catalog(self,
444444

445445
| Parameter | Type | Tags | Description |
446446
| --- | --- | --- | --- |
447-
| `cursor` | `string` | Query, Optional | The pagination cursor returned in the previous response. Leave unset for an initial request.<br>See [Pagination](https://developer.squareup.com/docs/basics/api101/pagination) for more information. |
447+
| `cursor` | `string` | Query, Optional | The pagination cursor returned in the previous response. Leave unset for an initial request.<br>The page size is currently set to be 100.<br>See [Pagination](https://developer.squareup.com/docs/basics/api101/pagination) for more information. |
448448
| `types` | `string` | Query, Optional | An optional case-insensitive, comma-separated list of object types to retrieve, for example<br>`ITEM,ITEM_VARIATION,CATEGORY,IMAGE`.<br><br>The legal values are taken from the CatalogObjectType enum:<br>`ITEM`, `ITEM_VARIATION`, `CATEGORY`, `DISCOUNT`, `TAX`,<br>`MODIFIER`, `MODIFIER_LIST`, or `IMAGE`. |
449-
| `catalog_version` | `long|int` | Query, Optional | The specific version of the catalog objects to be included in the response.<br>This allows you to retrieve historical<br>versions of objects. The specified version value is matched against<br>the [CatalogObject](/doc/models/catalog-object.md)s' `version` attribute. |
449+
| `catalog_version` | `long\|int` | Query, Optional | The specific version of the catalog objects to be included in the response.<br>This allows you to retrieve historical<br>versions of objects. The specified version value is matched against<br>the [CatalogObject](/doc/models/catalog-object.md)s' `version` attribute. |
450450

451451
## Response Type
452452

@@ -590,7 +590,7 @@ def retrieve_catalog_object(self,
590590
| --- | --- | --- | --- |
591591
| `object_id` | `string` | Template, Required | The object ID of any type of catalog objects to be retrieved. |
592592
| `include_related_objects` | `bool` | Query, Optional | If `true`, the response will include additional objects that are related to the<br>requested object, as follows:<br><br>If the `object` field of the response contains a `CatalogItem`, its associated<br>`CatalogCategory`, `CatalogTax`, `CatalogImage` and `CatalogModifierList` objects will<br>be returned in the `related_objects` field of the response. If the `object` field of<br>the response contains a `CatalogItemVariation`, its parent `CatalogItem` will be returned<br>in the `related_objects` field of the response.<br><br>Default value: `false`<br>**Default**: `False` |
593-
| `catalog_version` | `long|int` | Query, Optional | Requests objects as of a specific version of the catalog. This allows you to retrieve historical<br>versions of objects. The value to retrieve a specific version of an object can be found<br>in the version field of [CatalogObject](/doc/models/catalog-object.md)s. |
593+
| `catalog_version` | `long\|int` | Query, Optional | Requests objects as of a specific version of the catalog. This allows you to retrieve historical<br>versions of objects. The value to retrieve a specific version of an object can be found<br>in the version field of [CatalogObject](/doc/models/catalog-object.md)s. |
594594

595595
## Response Type
596596

doc/api/customers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ def delete_customer(self,
211211
| Parameter | Type | Tags | Description |
212212
| --- | --- | --- | --- |
213213
| `customer_id` | `string` | Template, Required | The ID of the customer to delete. |
214-
| `version` | `long|int` | Query, Optional | The current version of the customer profile.<br><br>As a best practice, you should include this parameter to enable [optimistic concurrency](https://developer.squareup.com/docs/working-with-apis/optimistic-concurrency) control. For more information, see [Delete a customer profile](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#delete-customer-profile). |
214+
| `version` | `long\|int` | Query, Optional | The current version of the customer profile.<br><br>As a best practice, you should include this parameter to enable [optimistic concurrency](https://developer.squareup.com/docs/working-with-apis/optimistic-concurrency) control. For more information, see [Delete a customer profile](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#delete-customer-profile). |
215215

216216
## Response Type
217217

doc/api/loyalty.md

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ loyalty_api = client.loyalty
2828

2929
# Create Loyalty Account
3030

31-
Creates a loyalty account. To create a loyalty account, you must provide the `program_id` and either the `mapping` field (preferred) or the `mappings` field.
31+
Creates a loyalty account. To create a loyalty account, you must provide the `program_id` and a `mapping` with the `phone_number` of the buyer.
3232

3333
```python
3434
def create_loyalty_account(self,
@@ -51,23 +51,13 @@ def create_loyalty_account(self,
5151
body = {}
5252
body['loyalty_account'] = {}
5353
body['loyalty_account']['id'] = 'id2'
54-
body['loyalty_account']['mappings'] = []
55-
56-
body['loyalty_account']['mappings'].append({})
57-
body['loyalty_account']['mappings'][0]['id'] = 'id0'
58-
body['loyalty_account']['mappings'][0]['type'] = 'PHONE'
59-
body['loyalty_account']['mappings'][0]['value'] = 'value2'
60-
body['loyalty_account']['mappings'][0]['created_at'] = 'created_at8'
61-
body['loyalty_account']['mappings'][0]['phone_number'] = 'phone_number8'
62-
6354
body['loyalty_account']['program_id'] = 'd619f755-2d17-41f3-990d-c04ecedd64dd'
6455
body['loyalty_account']['balance'] = 14
6556
body['loyalty_account']['lifetime_points'] = 38
6657
body['loyalty_account']['customer_id'] = 'customer_id0'
58+
body['loyalty_account']['enrolled_at'] = 'enrolled_at2'
6759
body['loyalty_account']['mapping'] = {}
6860
body['loyalty_account']['mapping']['id'] = 'id6'
69-
body['loyalty_account']['mapping']['type'] = 'PHONE'
70-
body['loyalty_account']['mapping']['value'] = 'value8'
7161
body['loyalty_account']['mapping']['created_at'] = 'created_at4'
7262
body['loyalty_account']['mapping']['phone_number'] = '+14155551234'
7363
body['idempotency_key'] = 'ec78c477-b1c3-4899-a209-a4e71337c996'
@@ -113,8 +103,6 @@ body['query']['mappings'] = []
113103

114104
body['query']['mappings'].append({})
115105
body['query']['mappings'][0]['id'] = 'id4'
116-
body['query']['mappings'][0]['type'] = 'PHONE'
117-
body['query']['mappings'][0]['value'] = 'value6'
118106
body['query']['mappings'][0]['created_at'] = 'created_at8'
119107
body['query']['mappings'][0]['phone_number'] = '+14155551234'
120108

@@ -318,8 +306,12 @@ elif result.is_error():
318306

319307
# List Loyalty Programs
320308

309+
**This endpoint is deprecated. **
310+
321311
Returns a list of loyalty programs in the seller's account.
322-
Currently, a seller can only have one loyalty program.
312+
Loyalty programs define how buyers can earn points and redeem points for rewards. Square sellers can have only one loyalty program, which is created and managed from the Seller Dashboard. For more information, see [Loyalty Program Overview](https://developer.squareup.com/docs/loyalty/overview).
313+
314+
Replaced with [RetrieveLoyaltyProgram](/doc/api/loyalty.md#retrieve-loyalty-program) when used with the keyword `main`.
323315

324316
```python
325317
def list_loyalty_programs(self)

doc/api/orders.md

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,11 @@ orders_api = client.orders
2121

2222
# Create Order
2323

24-
Creates a new [Order](/doc/models/order.md) which can include information on products for
24+
Creates a new [order](/doc/models/order.md) that can include information about products for
2525
purchase and settings to apply to the purchase.
2626

27-
To pay for a created order, please refer to the
28-
[Pay for Orders](https://developer.squareup.com/docs/orders-api/pay-for-orders)
29-
guide.
27+
To pay for a created order, see
28+
[Pay for Orders](https://developer.squareup.com/docs/orders-api/pay-for-orders).
3029

3130
You can modify open orders using the [UpdateOrder](/doc/api/orders.md#update-order) endpoint.
3231

@@ -169,9 +168,9 @@ elif result.is_error():
169168

170169
# Batch Retrieve Orders
171170

172-
Retrieves a set of [Order](/doc/models/order.md)s by their IDs.
171+
Retrieves a set of [orders](/doc/models/order.md) by their IDs.
173172

174-
If a given Order ID does not exist, the ID is ignored instead of generating an error.
173+
If a given order ID does not exist, the ID is ignored instead of generating an error.
175174

176175
```python
177176
def batch_retrieve_orders(self,
@@ -314,19 +313,19 @@ elif result.is_error():
314313

315314
Search all orders for one or more locations. Orders include all sales,
316315
returns, and exchanges regardless of how or when they entered the Square
317-
Ecosystem (e.g. Point of Sale, Invoices, Connect APIs, etc).
316+
ecosystem (such as Point of Sale, Invoices, and Connect APIs).
318317

319-
SearchOrders requests need to specify which locations to search and define a
320-
[`SearchOrdersQuery`](/doc/models/search-orders-query.md) object which controls
321-
how to sort or filter the results. Your SearchOrdersQuery can:
318+
`SearchOrders` requests need to specify which locations to search and define a
319+
[SearchOrdersQuery](/doc/models/search-orders-query.md) object that controls
320+
how to sort or filter the results. Your `SearchOrdersQuery` can:
322321

323322
Set filter criteria.
324-
Set sort order.
325-
Determine whether to return results as complete Order objects, or as
323+
Set the sort order.
324+
Determine whether to return results as complete `Order` objects or as
326325
[OrderEntry](/doc/models/order-entry.md) objects.
327326

328327
Note that details for orders processed with Square Point of Sale while in
329-
offline mode may not be transmitted to Square for up to 72 hours. Offline
328+
offline mode might not be transmitted to Square for up to 72 hours. Offline
330329
orders have a `created_at` value that reflects the time the order was created,
331330
not the time it was subsequently transmitted to Square.
332331

@@ -422,21 +421,21 @@ elif result.is_error():
422421

423422
# Update Order
424423

425-
Updates an open [Order](/doc/models/order.md) by adding, replacing, or deleting
424+
Updates an open [order](/doc/models/order.md) by adding, replacing, or deleting
426425
fields. Orders with a `COMPLETED` or `CANCELED` state cannot be updated.
427426

428-
An UpdateOrder request requires the following:
427+
An `UpdateOrder` request requires the following:
429428

430429
- The `order_id` in the endpoint path, identifying the order to update.
431430
- The latest `version` of the order to update.
432431
- The [sparse order](https://developer.squareup.com/docs/orders-api/manage-orders#sparse-order-objects)
433-
containing only the fields to update and the version the update is
434-
being applied to.
432+
containing only the fields to update and the version to which the update is
433+
being applied.
435434
- If deleting fields, the [dot notation paths](https://developer.squareup.com/docs/orders-api/manage-orders#on-dot-notation)
436-
identifying fields to clear.
435+
identifying the fields to clear.
437436

438-
To pay for an order, please refer to the
439-
[Pay for Orders](https://developer.squareup.com/docs/orders-api/pay-for-orders) guide.
437+
To pay for an order, see
438+
[Pay for Orders](https://developer.squareup.com/docs/orders-api/pay-for-orders).
440439

441440
```python
442441
def update_order(self,
@@ -517,20 +516,20 @@ elif result.is_error():
517516

518517
# Pay Order
519518

520-
Pay for an [order](/doc/models/order.md) using one or more approved [payments](/doc/models/payment.md),
519+
Pay for an [order](/doc/models/order.md) using one or more approved [payments](/doc/models/payment.md)
521520
or settle an order with a total of `0`.
522521

523522
The total of the `payment_ids` listed in the request must be equal to the order
524523
total. Orders with a total amount of `0` can be marked as paid by specifying an empty
525524
array of `payment_ids` in the request.
526525

527-
To be used with PayOrder, a payment must:
526+
To be used with `PayOrder`, a payment must:
528527

529528
- Reference the order by specifying the `order_id` when [creating the payment](/doc/api/payments.md#create-payment).
530529
Any approved payments that reference the same `order_id` not specified in the
531-
`payment_ids` will be canceled.
530+
`payment_ids` is canceled.
532531
- Be approved with [delayed capture](https://developer.squareup.com/docs/payments-api/take-payments#delayed-capture).
533-
Using a delayed capture payment with PayOrder will complete the approved payment.
532+
Using a delayed capture payment with `PayOrder` completes the approved payment.
534533

535534
```python
536535
def pay_order(self,

doc/api/payments.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def list_payments(self,
5050
| `sort_order` | `string` | Query, Optional | The order in which results are listed:<br><br>- `ASC` - Oldest to newest.<br>- `DESC` - Newest to oldest (default). |
5151
| `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/basics/api101/pagination). |
5252
| `location_id` | `string` | Query, Optional | Limit results to the location supplied. By default, results are returned<br>for the default (main) location associated with the seller. |
53-
| `total` | `long|int` | Query, Optional | The exact amount in the `total_money` for a payment. |
53+
| `total` | `long\|int` | Query, Optional | The exact amount in the `total_money` for a payment. |
5454
| `last_4` | `string` | Query, Optional | The last four digits of a payment card. |
5555
| `card_brand` | `string` | Query, Optional | The brand of the payment card (for example, VISA). |
5656
| `limit` | `int` | Query, Optional | The maximum number of results to be returned in a single page.<br>It is possible to receive fewer results than the specified limit on a given page.<br><br>The default value of 100 is also the maximum allowed value. If the provided value is<br>greater than 100, it is ignored and the default value is used instead.<br><br>Default: `100` |

doc/api/sites.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Sites
2+
3+
```python
4+
sites_api = client.sites
5+
```
6+
7+
## Class Name
8+
9+
`SitesApi`
10+
11+
12+
# List Sites
13+
14+
Lists the Square Online sites that belong to a seller.
15+
16+
__Note:__ Square Online APIs are publicly available as part of an early access program. For more information, see [Early access program for Square Online APIs](https://developer.squareup.com/docs/online-api#early-access-program-for-square-online-apis).
17+
18+
```python
19+
def list_sites(self)
20+
```
21+
22+
## Response Type
23+
24+
[`List Sites Response`](/doc/models/list-sites-response.md)
25+
26+
## Example Usage
27+
28+
```python
29+
result = sites_api.list_sites()
30+
31+
if result.is_success():
32+
print(result.body)
33+
elif result.is_error():
34+
print(result.errors)
35+
```
36+

0 commit comments

Comments
 (0)