Skip to content

Commit 410807f

Browse files
square-sdk-deployerssung88
authored andcommitted
release
1 parent afb6201 commit 410807f

80 files changed

Lines changed: 2728 additions & 528 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.

CHANGELOG.md

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

3+
## Version 5.0.0.20200226 (2020-02-26)
4+
## API releases
5+
* **GA release**: All SDKs have been updated to support the new Bank Accounts and CashDrawerShifts APIs.
6+
7+
* **Beta release**: All SDKs have been updated to support the new Disputes API.
8+
9+
10+
## Existing API updates
11+
12+
All SDKs have been updated to support the following changes:
13+
14+
* **Catalog API**
15+
* Batch upsert catalog objects endpoint — The `batches` field is now required and the array must have at least one element.
16+
* CatalogModifier — Two fields added:
17+
* `ordinal` to support custom ordering in a modifier list
18+
* `modifier_list_id` to reference the parent modifier list
19+
* CatalogModifierList — New field added: `ordinal` to support custom ordering in a list of **CatalogModifierList** objects.
20+
21+
* **Customers API changes**
22+
* SearchCustomers endpoint — `limit` size reduced from 1000 to 100 to improve the endpoint performance.
23+
24+
* **Orders API changes**
25+
* CreateOrderRequest — Previously these request fields were deprecated: `line_items`, `taxes`, `discounts`. These fields are no longer available. Instead you now use the `Order` object in the request. For example, `Order.line_items`, `Order.taxes`, and `Order.discounts`.
26+
* OrderLineItem type — There are two changes:
27+
* The `taxes` field that was previously deprecated is no longer available. Instead, you now use the `OrderLineItem.applied_taxes` field. This also now requires that you set the `OrderLineItemTax.scope` field.
28+
* The `discounts` field that was previously deprecated is no longer available. Instead, you now use the `OrderLineItem.applied_discounts` field. This also now requires that you set the `OrderLineItemDiscount.scope` field.
29+
30+
* **Shared object updates**
31+
* **Card object** — New fields added: `card_type`, `prepaid_type`. Currently, only the Payments API responses populate these fields.
32+
333
## Version 4.1.0.20200122 (2020-01-22)
434

535
* New field: The **Employee** object now has an `is_owner` field.

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
include LICENSE
2-
include README.md
2+
include README.md

doc/bank-accounts.md

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
# Bank Accounts
2+
3+
```python
4+
bank_accounts_api = client.bank_accounts
5+
```
6+
7+
## Class Name
8+
9+
`BankAccountsApi`
10+
11+
## Methods
12+
13+
* [List Bank Accounts](/doc/bank-accounts.md#list-bank-accounts)
14+
* [Get Bank Account by V1 Id](/doc/bank-accounts.md#get-bank-account-by-v1-id)
15+
* [Get Bank Account](/doc/bank-accounts.md#get-bank-account)
16+
17+
## List Bank Accounts
18+
19+
Returns a list of [BankAccount](#type-bankaccount) objects linked to a Square account.
20+
For more information, see
21+
[Bank Accounts API](https://developer.squareup.com/docs/docs/bank-accounts-api).
22+
23+
```python
24+
def list_bank_accounts(self,
25+
cursor=None,
26+
limit=None,
27+
location_id=None)
28+
```
29+
30+
### Parameters
31+
32+
| Parameter | Type | Tags | Description |
33+
| --- | --- | --- | --- |
34+
| `cursor` | `string` | Query, Optional | The pagination cursor returned by a previous call to this endpoint.<br>Use it in the next `ListBankAccounts` request to retrieve the next set <br>of results.<br><br>See the [Pagination](https://developer.squareup.com/docs/docs/working-with-apis/pagination) guide for more information. |
35+
| `limit` | `int` | Query, Optional | Upper limit on the number of bank accounts to return in the response. <br>Currently, 1000 is the largest supported limit. You can specify a limit <br>of up to 1000 bank accounts. This is also the default limit. |
36+
| `location_id` | `string` | Query, Optional | Location ID. You can specify this optional filter <br>to retrieve only the linked bank accounts belonging to a specific location. |
37+
38+
### Response Type
39+
40+
[`List Bank Accounts Response`](/doc/models/list-bank-accounts-response.md)
41+
42+
### Example Usage
43+
44+
```python
45+
result = bank_accounts_api.list_bank_accounts()
46+
47+
if result.is_success():
48+
print(result.body)
49+
elif result.is_error():
50+
print(result.errors)
51+
```
52+
53+
## Get Bank Account by V1 Id
54+
55+
Returns details of a [BankAccount](#type-bankaccount) identified by V1 bank account ID.
56+
For more information, see
57+
[Retrieve a bank account by using an ID issued by V1 Bank Accounts API](https://developer.squareup.com/docs/docs/bank-accounts-api#retrieve-a-bank-account-by-using-an-id-issued-by-the-v1-bank-accounts-api).
58+
59+
```python
60+
def get_bank_account_by_v1_id(self,
61+
v1_bank_account_id)
62+
```
63+
64+
### Parameters
65+
66+
| Parameter | Type | Tags | Description |
67+
| --- | --- | --- | --- |
68+
| `v1_bank_account_id` | `string` | Template, Required | Connect V1 ID of the desired `BankAccount`. For more information, see <br>[Retrieve a bank account by using an ID issued by V1 Bank Accounts API](https://developer.squareup.com/docs/docs/bank-accounts-api#retrieve-a-bank-account-by-using-an-id-issued-by-v1-bank-accounts-api). |
69+
70+
### Response Type
71+
72+
[`Get Bank Account by V1 Id Response`](/doc/models/get-bank-account-by-v1-id-response.md)
73+
74+
### Example Usage
75+
76+
```python
77+
v1_bank_account_id = 'v1_bank_account_id8'
78+
79+
result = bank_accounts_api.get_bank_account_by_v1_id(v1_bank_account_id)
80+
81+
if result.is_success():
82+
print(result.body)
83+
elif result.is_error():
84+
print(result.errors)
85+
```
86+
87+
## Get Bank Account
88+
89+
Returns details of a [BankAccount](#type-bankaccount)
90+
linked to a Square account. For more information, see
91+
[Bank Accounts API](https://developer.squareup.com/docs/docs/bank-accounts-api).
92+
93+
```python
94+
def get_bank_account(self,
95+
bank_account_id)
96+
```
97+
98+
### Parameters
99+
100+
| Parameter | Type | Tags | Description |
101+
| --- | --- | --- | --- |
102+
| `bank_account_id` | `string` | Template, Required | Square-issued ID of the desired `BankAccount`. |
103+
104+
### Response Type
105+
106+
[`Get Bank Account Response`](/doc/models/get-bank-account-response.md)
107+
108+
### Example Usage
109+
110+
```python
111+
bank_account_id = 'bank_account_id0'
112+
113+
result = bank_accounts_api.get_bank_account(bank_account_id)
114+
115+
if result.is_success():
116+
print(result.body)
117+
elif result.is_error():
118+
print(result.errors)
119+
```
120+

doc/catalog.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ body['batches'][0]['objects'][0]['item_data']['variations'][0]['item_variation_d
163163
"price_money": {
164164
"amount": 150,
165165
"currency": "USD"
166-
}
167166
}
167+
}
168168

169169
body['batches'][0]['objects'].append({})
170170
body['batches'][0]['objects'][1]['type'] = 'ITEM'
@@ -188,8 +188,8 @@ body['batches'][0]['objects'][1]['item_data']['variations'][0]['item_variation_d
188188
"price_money": {
189189
"amount": 250,
190190
"currency": "USD"
191-
}
192191
}
192+
}
193193

194194
body['batches'][0]['objects'][1]['item_data']['variations'].append({})
195195
body['batches'][0]['objects'][1]['item_data']['variations'][1]['type'] = 'ITEM_VARIATION'
@@ -202,16 +202,17 @@ body['batches'][0]['objects'][1]['item_data']['variations'][1]['item_variation_d
202202
"price_money": {
203203
"amount": 350,
204204
"currency": "USD"
205-
}
206205
}
206+
}
207+
207208

208209
body['batches'][0]['objects'].append({})
209210
body['batches'][0]['objects'][2]['type'] = 'CATEGORY'
210211
body['batches'][0]['objects'][2]['id'] = '#Beverages'
211212
body['batches'][0]['objects'][2]['present_at_all_locations'] = True
212213
body['batches'][0]['objects'][2]['category_data'] = {
213214
"name": "Beverages"
214-
}
215+
}
215216

216217
body['batches'][0]['objects'].append({})
217218
body['batches'][0]['objects'][3]['type'] = 'TAX'
@@ -224,7 +225,8 @@ body['batches'][0]['objects'][3]['tax_data'] = {
224225
"percentage": "5.0",
225226
"applies_to_custom_amounts": True,
226227
"enabled": True
227-
}
228+
}
229+
228230

229231

230232
result = catalog_api.batch_upsert_catalog_objects(body)

doc/checkout.md

Lines changed: 56 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -38,65 +38,62 @@ location_id = 'location_id4'
3838
body = {}
3939
body['idempotency_key'] = '86ae1696-b1e3-4328-af6d-f1e04d947ad6'
4040
body['order'] = {}
41-
body['order']['reference_id'] = 'reference_id'
42-
body['order']['line_items'] = []
43-
44-
body['order']['line_items'].append({})
45-
body['order']['line_items'][0]['name'] = 'Printed T Shirt'
46-
body['order']['line_items'][0]['quantity'] = '2'
47-
body['order']['line_items'][0]['base_price_money'] = {}
48-
body['order']['line_items'][0]['base_price_money']['amount'] = 1500
49-
body['order']['line_items'][0]['base_price_money']['currency'] = 'USD'
50-
body['order']['line_items'][0]['discounts'] = []
51-
52-
body['order']['line_items'][0]['discounts'].append({})
53-
body['order']['line_items'][0]['discounts'][0]['name'] = '7% off previous season item'
54-
body['order']['line_items'][0]['discounts'][0]['percentage'] = '7'
55-
56-
body['order']['line_items'][0]['discounts'].append({})
57-
body['order']['line_items'][0]['discounts'][1]['name'] = '$3 off Customer Discount'
58-
59-
60-
body['order']['line_items'].append({})
61-
body['order']['line_items'][1]['name'] = 'Slim Jeans'
62-
body['order']['line_items'][1]['quantity'] = '1'
63-
body['order']['line_items'][1]['base_price_money'] = {}
64-
body['order']['line_items'][1]['base_price_money']['amount'] = 2500
65-
body['order']['line_items'][1]['base_price_money']['currency'] = 'USD'
66-
67-
body['order']['line_items'].append({})
68-
body['order']['line_items'][2]['name'] = 'Woven Sweater'
69-
body['order']['line_items'][2]['quantity'] = '3'
70-
body['order']['line_items'][2]['base_price_money'] = {}
71-
body['order']['line_items'][2]['base_price_money']['amount'] = 3500
72-
body['order']['line_items'][2]['base_price_money']['currency'] = 'USD'
73-
body['order']['line_items'][2]['taxes'] = []
74-
75-
body['order']['line_items'][2]['taxes'].append({})
76-
body['order']['line_items'][2]['taxes'][0]['name'] = 'Fair Trade Tax'
77-
body['order']['line_items'][2]['taxes'][0]['percentage'] = '5'
78-
79-
body['order']['line_items'][2]['discounts'] = []
80-
81-
body['order']['line_items'][2]['discounts'].append({})
82-
body['order']['line_items'][2]['discounts'][0]['name'] = '$11 off Customer Discount'
83-
84-
85-
body['order']['taxes'] = []
86-
87-
body['order']['taxes'].append({})
88-
body['order']['taxes'][0]['name'] = 'Sales Tax'
89-
body['order']['taxes'][0]['percentage'] = '8.5'
90-
91-
body['order']['discounts'] = []
92-
93-
body['order']['discounts'].append({})
94-
body['order']['discounts'][0]['name'] = 'Father\'s day 12% OFF'
95-
body['order']['discounts'][0]['percentage'] = '12'
96-
97-
body['order']['discounts'].append({})
98-
body['order']['discounts'][1]['name'] = 'Global Sales $55 OFF'
99-
41+
body['order']['order'] = {}
42+
body['order']['order']['location_id'] = 'location_id'
43+
body['order']['order']['reference_id'] = 'reference_id'
44+
body['order']['order']['customer_id'] = 'customer_id'
45+
body['order']['order']['line_items'] = []
46+
47+
body['order']['order']['line_items'].append({})
48+
body['order']['order']['line_items'][0]['name'] = 'Printed T Shirt'
49+
body['order']['order']['line_items'][0]['quantity'] = '2'
50+
body['order']['order']['line_items'][0]['applied_taxes'] = []
51+
52+
body['order']['order']['line_items'][0]['applied_taxes'].append({})
53+
body['order']['order']['line_items'][0]['applied_taxes'][0]['tax_uid'] = '38ze1696-z1e3-5628-af6d-f1e04d947fg3'
54+
55+
body['order']['order']['line_items'][0]['applied_discounts'] = []
56+
57+
body['order']['order']['line_items'][0]['applied_discounts'].append({})
58+
body['order']['order']['line_items'][0]['applied_discounts'][0]['discount_uid'] = '56ae1696-z1e3-9328-af6d-f1e04d947gd4'
59+
60+
body['order']['order']['line_items'][0]['base_price_money'] = {}
61+
body['order']['order']['line_items'][0]['base_price_money']['amount'] = 1500
62+
body['order']['order']['line_items'][0]['base_price_money']['currency'] = 'USD'
63+
64+
body['order']['order']['line_items'].append({})
65+
body['order']['order']['line_items'][1]['name'] = 'Slim Jeans'
66+
body['order']['order']['line_items'][1]['quantity'] = '1'
67+
body['order']['order']['line_items'][1]['base_price_money'] = {}
68+
body['order']['order']['line_items'][1]['base_price_money']['amount'] = 2500
69+
body['order']['order']['line_items'][1]['base_price_money']['currency'] = 'USD'
70+
71+
body['order']['order']['line_items'].append({})
72+
body['order']['order']['line_items'][2]['name'] = 'Woven Sweater'
73+
body['order']['order']['line_items'][2]['quantity'] = '3'
74+
body['order']['order']['line_items'][2]['base_price_money'] = {}
75+
body['order']['order']['line_items'][2]['base_price_money']['amount'] = 3500
76+
body['order']['order']['line_items'][2]['base_price_money']['currency'] = 'USD'
77+
78+
body['order']['order']['taxes'] = []
79+
80+
body['order']['order']['taxes'].append({})
81+
body['order']['order']['taxes'][0]['uid'] = '38ze1696-z1e3-5628-af6d-f1e04d947fg3'
82+
body['order']['order']['taxes'][0]['type'] = 'INCLUSIVE'
83+
body['order']['order']['taxes'][0]['percentage'] = '7.75'
84+
body['order']['order']['taxes'][0]['scope'] = 'LINE_ITEM'
85+
86+
body['order']['order']['discounts'] = []
87+
88+
body['order']['order']['discounts'].append({})
89+
body['order']['order']['discounts'][0]['uid'] = '56ae1696-z1e3-9328-af6d-f1e04d947gd4'
90+
body['order']['order']['discounts'][0]['type'] = 'FIXED_AMOUNT'
91+
body['order']['order']['discounts'][0]['amount_money'] = {}
92+
body['order']['order']['discounts'][0]['amount_money']['amount'] = 100
93+
body['order']['order']['discounts'][0]['amount_money']['currency'] = 'USD'
94+
body['order']['order']['discounts'][0]['scope'] = 'LINE_ITEM'
95+
96+
body['order']['idempotency_key'] = '12ae1696-z1e3-4328-af6d-f1e04d947gd4'
10097
body['ask_for_shipping_address'] = True
10198
body['merchant_support_email'] = 'merchant+support@website.com'
10299
body['pre_populate_buyer_email'] = 'example@email.com'

0 commit comments

Comments
 (0)