Skip to content

Commit 119649c

Browse files
author
Wolfgang Schuster
authored
Merge pull request #60 from square/release/12.0.0.20210616
Generated PR for Release: 12.0.0.20210616
2 parents 5d30eea + 228f7c5 commit 119649c

177 files changed

Lines changed: 3989 additions & 422 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: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,66 @@
11
# Change Log
22

3+
## Version 12.0.0.20210616 (2021-06-16)
4+
## New API releases
5+
* **Gift Cards API and Gift Card Activities API.** Gift card support is integrated in the [Square Seller Dashboard](https://squareup.com/dashboard/) and the [Square Point of Sale](https://squareup.com/us/en/point-of-sale) application. Sellers can sell, redeem, track, and reload Square gift cards. Now developers can use the [Gift Cards API](https://developer.squareup.com/reference/square_2021-06-16/gift-cards-api) and the [Gift Card Activities API](https://developer.squareup.com/reference/square_2021-06-16/gift-card-activities-api) to integrate Square gift cards into third-party applications. For more information, see [Gift Cards API Overview.](https://developer.squareup.com/docs/gift-cards/using-gift-cards-api)
6+
7+
* **Cards API.** The [Cards API](https://developer.squareup.com/reference/square_2021-06-16/cards-api) replaces the deprecated `CreateCustomerCard` and `DeleteCustomerCard` endpoints and lets an application save a customer payment card on file along with other card management operations. For more information, see [Cards API Overview.](https://developer.squareup.com/docs/cards-api/overview)
8+
9+
## API updates
10+
* **Catalog API:**
11+
* [CatalogPricingRule](https://developer.squareup.com/reference/square_2021-06-16/objects/CatalogPricingRule). Support of the [customer group discount](https://developer.squareup.com/reference/square_2021-06-16/objects/CatalogPricingRule#definition__property-customer_group_ids_any) becomes GA. For more information, see [CreateCustomerGroupDiscounts.](https://developer.squareup.com/docs/catalog-api/configure-customer-group-discounts)
12+
* [CatalogItemVariation](https://developer.squareup.com/reference/square_2021-06-16/objects/CatalogItemVariation). Offers Beta support of the [stockable](https://developer.squareup.com/reference/square_2021-06-16/objects/CatalogItemVariation#definition__property-stockable) and [stockable_conversion](https://developer.squareup.com/reference/square_2021-06-16/objects/CatalogItemVariation#definition__property-stockable_conversion) attributes to enable sales of a product in multiple measurement units.
13+
* [UpsertCatalogObject](https://developer.squareup.com/reference/square_2021-06-16/catalog-api/upsert-catalog-object) and [BatchUpsertCatalogObjects](https://developer.squareup.com/reference/square_2021-06-16/catalog-api/batch-upsert-catalog-objects). Support creating an item with stockable and non-stockable variations with a specified stock conversion between the two. For more information, see [Enable Stock Conversion.](https://developer.squareup.com/docs/inventory-api/enable-stock-conversion)
14+
* [UpsertCatalogObject](https://developer.squareup.com/reference/square_2021-06-16/catalog-api/upsert-catalog-object) and [BatchUpsertCatalogObjects](https://developer.squareup.com/reference/square_2021-06-16/catalog-api/batch-upsert-catalog-objects). Require that an item be created with at least one variation. Otherwise, an `INVALID_REQUEST` error is returned.
15+
16+
* **Customers API:**
17+
* Using the Customers API to manage cards on file is deprecated:
18+
* The [CreateCustomerCard](https://developer.squareup.com/reference/square_2021-06-16/customers-api/create-customer-card) endpoint is deprecated and replaced by the [CreateCard](https://developer.squareup.com/reference/square_2021-06-16/cards-api/create-card) and [LinkCustomerToGiftCard](https://developer.squareup.com/reference/square_2021-06-16/gift-cards-api/link-customer-to-gift-card) endpoints.
19+
* The [DeleteCustomerCard](https://developer.squareup.com/reference/square_2021-06-16/customers-api/delete-customer-card) endpoint is deprecated and replaced by the [DisableCard](https://developer.squareup.com/reference/square_2021-06-16/cards-api/disable-card) and [UnlinkCustomerFromGiftCard](https://developer.squareup.com/reference/square_2021-06-16/gift-cards-api/unlink-customer-from-gift-card) endpoints.
20+
* The `cards` field in the [Customer](https://developer.squareup.com/reference/square_2021-06-16/objects/Customer) object is deprecated and replaced by the following endpoints:
21+
* [ListCards](https://developer.squareup.com/reference/square_2021-06-16/cards-api/list-cards) to retrieve credit and debit cards on file.
22+
* [ListGiftCards](https://developer.squareup.com/reference/square_2021-06-16/gift-cards-api/list-gift-cards) to retrieve gift cards on file.
23+
24+
For more information, see [Migrate to the Cards API and Gift Cards API.](https://developer.squareup.com/docs/customers-api/use-the-api/integrate-with-other-services#migrate-customer-cards)
25+
26+
* [Customer](https://developer.squareup.com/reference/square_2021-06-16/objects/Customer) object. In the `cards` field, the IDs for gift cards now have a `gftc:` prefix followed by the card number. This is a service-level change that applies to all Square API versions.
27+
28+
* **Disputes API:**
29+
* The Disputes API is now GA.
30+
* `RemoveDisputeEvidence`. Renamed to [DeleteDisputeEvidence](https://developer.squareup.com/reference/square_2021-06-16/objects/DeleteDisputeEvidence).
31+
* [CreateDisputeEvidenceFile.](https://developer.squareup.com/reference/square_2021-06-16/objects/CreateDisputeEvidenceFile) The URL is changed from `/v2/disputes/{dispute_id}/evidence_file` to `/v2/disputes/{dispute_id}/evidence-files`.
32+
* [CreateDisputeEvidenceText.](https://developer.squareup.com/reference/square_2021-06-16/objects/CreateDisputeEvidenceText) The URL is changed from `/v2/disputes/{dispute_id}/evidence_text` to `/v2/disputes/{dispute_id}/evidence-text`.
33+
* [ListDisputeEvidence.](https://developer.squareup.com/reference/square_2021-06-16/objects/ListDisputeEvidence) The endpoint now returns a pagination cursor and accepts a pagination cursor in requests.
34+
* `DISPUTES_READ` and `DISPUTES_WRITE` permissions are required for all Disputes API endpoints instead of `PAYMENTS_READ` and `PAYMENTS_WRITE`.
35+
* [DisputeEvidence.](https://developer.squareup.com/reference/square_2021-06-16/objects/DisputeEvidence) The `evidence_id` field is deprecated and replaced by the `id` field.
36+
* The `dispute.state.changed` webhook is renamed to `dispute.state.updated`.
37+
* [Dispute](https://developer.squareup.com/reference/square_2021-06-16/objects/Dispute) object. The following breaking changes are made:
38+
* The `dispute_id` field is deprecated and replaced by the `id` field.
39+
* The `reported_date` field is deprecated and replaced by the `reported_at` field.
40+
* The `evidence_ids` field is deprecated with no replacement.
41+
42+
For more information about the GA release of the Disputes API, see [Disputes Overview.](https://developer.squareup.com/docs/disputes-api/overview)
43+
44+
45+
* **Inventory API:**
46+
* [CatalogStockConversion](https://developer.squareup.com/docs/{SQUARE_TECH_REF}/objects/CatalogStockConversion) (Beta). Enables selling a product in multiple measurement units and lets Square sellers manage inventory counts of the product's stockable and a non-stockable variations in a self-consistent manner. For more information, see [Enable Stock Conversion.](https://developer.squareup.com/docs/inventory-api/enable-stock-conversion)
47+
48+
* **Invoices API:**
49+
* [CreateInvoice.](https://developer.squareup.com/reference/square_2021-06-16/invoices-api/create-invoice) The `location_id` field is now optional and defaults to the location ID of the associated order. If specified in the request, the value must match the location ID of the associated order. This is a service-level change that applies to all Square API versions.
50+
51+
* **Loyalty API:**
52+
* [LoyaltyProgramAccrualRule](https://developer.squareup.com/reference/square_2021-06-16/objects/LoyaltyProgramAccrualRule) object. New `excluded_category_ids` and `excluded_item_variation_ids` fields that represent any categories and items that are excluded from accruing points in spend-based loyalty programs.
53+
54+
* **Subscriptions API:**
55+
* [Subscription.](https://developer.squareup.com/reference/square_2021-06-16/objects/Subscription) The `paid_until_date` field is renamed to `charge_through_date`.
56+
* [UpdateSubscription.](https://developer.squareup.com/reference/square_2021-06-16/subscriptions-api/update-subscription) The `version` field is now optional because it can update only the latest version of a subscription.
57+
58+
* [CreateSubscription.](https://developer.squareup.com/reference/square_2021-06-16/subscriptions-api/create-subscription) The `idempotency_key` field is now optional in the request. If you do not provide it, each `CreateSubscription` assumes a unique (never used before) value and creates a subscription for each call.
59+
60+
## Documentation updates
61+
* [Order fee structure.](https://developer.squareup.com/docs/payments-pricing#orders-api-fee-structure) Documented the transaction fee related to using the Orders API with a non-Square payments provider.
62+
63+
364
## Version 11.0.0.20210513 (2021-05-13)
465
## New API releases
566

doc/api/cards.md

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
# Cards
2+
3+
```python
4+
cards_api = client.cards
5+
```
6+
7+
## Class Name
8+
9+
`CardsApi`
10+
11+
## Methods
12+
13+
* [List Cards](/doc/api/cards.md#list-cards)
14+
* [Create Card](/doc/api/cards.md#create-card)
15+
* [Retrieve Card](/doc/api/cards.md#retrieve-card)
16+
* [Disable Card](/doc/api/cards.md#disable-card)
17+
18+
19+
# List Cards
20+
21+
Retrieves a list of cards owned by the account making the request.
22+
A max of 25 cards will be returned.
23+
24+
```python
25+
def list_cards(self,
26+
cursor=None,
27+
customer_id=None,
28+
include_disabled=False,
29+
reference_id=None,
30+
sort_order=None)
31+
```
32+
33+
## Parameters
34+
35+
| Parameter | Type | Tags | Description |
36+
| --- | --- | --- | --- |
37+
| `cursor` | `string` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.<br>Provide this to retrieve the next set of results for your original query.<br><br>See [Pagination](https://developer.squareup.com/docs/basics/api101/pagination) for more information. |
38+
| `customer_id` | `string` | Query, Optional | Limit results to cards associated with the customer supplied.<br>By default, all cards owned by the merchant are returned. |
39+
| `include_disabled` | `bool` | Query, Optional | Includes disabled cards.<br>By default, all enabled cards owned by the merchant are returned.<br>**Default**: `False` |
40+
| `reference_id` | `string` | Query, Optional | Limit results to cards associated with the reference_id supplied. |
41+
| `sort_order` | [`str (Sort Order)`](/doc/models/sort-order.md) | Query, Optional | Sorts the returned list by when the card was created with the specified order.<br>This field defaults to ASC. |
42+
43+
## Response Type
44+
45+
[`List Cards Response`](/doc/models/list-cards-response.md)
46+
47+
## Example Usage
48+
49+
```python
50+
cursor = 'cursor6'
51+
customer_id = 'customer_id8'
52+
include_disabled = False
53+
reference_id = 'reference_id2'
54+
sort_order = 'DESC'
55+
56+
result = cards_api.list_cards(cursor, customer_id, include_disabled, reference_id, sort_order)
57+
58+
if result.is_success():
59+
print(result.body)
60+
elif result.is_error():
61+
print(result.errors)
62+
```
63+
64+
65+
# Create Card
66+
67+
Adds a card on file to an existing merchant.
68+
69+
```python
70+
def create_card(self,
71+
body)
72+
```
73+
74+
## Parameters
75+
76+
| Parameter | Type | Tags | Description |
77+
| --- | --- | --- | --- |
78+
| `body` | [`Create Card Request`](/doc/models/create-card-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
79+
80+
## Response Type
81+
82+
[`Create Card Response`](/doc/models/create-card-response.md)
83+
84+
## Example Usage
85+
86+
```python
87+
body = {}
88+
body['idempotency_key'] = '4935a656-a929-4792-b97c-8848be85c27c'
89+
body['source_id'] = 'cnon:uIbfJXhXETSP197M3GB'
90+
body['verification_token'] = 'verification_token0'
91+
body['card'] = {}
92+
body['card']['id'] = 'id0'
93+
body['card']['card_brand'] = 'INTERAC'
94+
body['card']['last_4'] = 'last_42'
95+
body['card']['exp_month'] = 236
96+
body['card']['exp_year'] = 60
97+
body['card']['cardholder_name'] = 'Amelia Earhart'
98+
body['card']['billing_address'] = {}
99+
body['card']['billing_address']['address_line_1'] = '500 Electric Ave'
100+
body['card']['billing_address']['address_line_2'] = 'Suite 600'
101+
body['card']['billing_address']['address_line_3'] = 'address_line_34'
102+
body['card']['billing_address']['locality'] = 'New York'
103+
body['card']['billing_address']['sublocality'] = 'sublocality8'
104+
body['card']['billing_address']['administrative_district_level_1'] = 'NY'
105+
body['card']['billing_address']['postal_code'] = '10003'
106+
body['card']['billing_address']['country'] = 'US'
107+
body['card']['customer_id'] = 'VDKXEEKPJN48QDG3BGGFAK05P8'
108+
body['card']['reference_id'] = 'user-id-1'
109+
110+
result = cards_api.create_card(body)
111+
112+
if result.is_success():
113+
print(result.body)
114+
elif result.is_error():
115+
print(result.errors)
116+
```
117+
118+
119+
# Retrieve Card
120+
121+
Retrieves details for a specific Card.
122+
123+
```python
124+
def retrieve_card(self,
125+
card_id)
126+
```
127+
128+
## Parameters
129+
130+
| Parameter | Type | Tags | Description |
131+
| --- | --- | --- | --- |
132+
| `card_id` | `string` | Template, Required | Unique ID for the desired Card. |
133+
134+
## Response Type
135+
136+
[`Retrieve Card Response`](/doc/models/retrieve-card-response.md)
137+
138+
## Example Usage
139+
140+
```python
141+
card_id = 'card_id4'
142+
143+
result = cards_api.retrieve_card(card_id)
144+
145+
if result.is_success():
146+
print(result.body)
147+
elif result.is_error():
148+
print(result.errors)
149+
```
150+
151+
152+
# Disable Card
153+
154+
Disables the card, preventing any further updates or charges.
155+
Disabling an already disabled card is allowed but has no effect.
156+
157+
```python
158+
def disable_card(self,
159+
card_id)
160+
```
161+
162+
## Parameters
163+
164+
| Parameter | Type | Tags | Description |
165+
| --- | --- | --- | --- |
166+
| `card_id` | `string` | Template, Required | Unique ID for the desired Card. |
167+
168+
## Response Type
169+
170+
[`Disable Card Response`](/doc/models/disable-card-response.md)
171+
172+
## Example Usage
173+
174+
```python
175+
card_id = 'card_id4'
176+
177+
result = cards_api.disable_card(card_id)
178+
179+
if result.is_success():
180+
print(result.body)
181+
elif result.is_error():
182+
print(result.errors)
183+
```
184+

doc/api/catalog.md

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ def list_catalog(self,
445445
| Parameter | Type | Tags | Description |
446446
| --- | --- | --- | --- |
447447
| `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. |
448-
| `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`. |
448+
| `types` | `string` | Query, Optional | An optional case-insensitive, comma-separated list of object types to retrieve.<br><br>The valid values are defined in the [CatalogObjectType](/doc/models/catalog-object-type.md) enum, including<br>`ITEM`, `ITEM_VARIATION`, `CATEGORY`, `DISCOUNT`, `TAX`,<br>`MODIFIER`, `MODIFIER_LIST`, or `IMAGE`.<br><br>If this is unspecified, the operation returns objects of all the types at the version of the Square API used to make the request. |
449449
| `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
@@ -515,10 +515,65 @@ body['object']['catalog_v1_ids'][2]['location_id'] = 'location_id2'
515515

516516
body['object']['item_data'] = {}
517517
body['object']['item_data']['name'] = 'Cocoa'
518-
body['object']['item_data']['description'] = 'Hot chocolate'
518+
body['object']['item_data']['description'] = 'Hot Chocolate'
519519
body['object']['item_data']['abbreviation'] = 'Ch'
520520
body['object']['item_data']['label_color'] = 'label_color4'
521521
body['object']['item_data']['available_online'] = False
522+
body['object']['item_data']['variations'] = []
523+
524+
body['object']['item_data']['variations'].append({})
525+
body['object']['item_data']['variations'][0]['type'] = 'ITEM_VARIATION'
526+
body['object']['item_data']['variations'][0]['id'] = '#Small'
527+
body['object']['item_data']['variations'][0]['updated_at'] = 'updated_at9'
528+
body['object']['item_data']['variations'][0]['version'] = 69
529+
body['object']['item_data']['variations'][0]['is_deleted'] = True
530+
body['object']['item_data']['variations'][0]['custom_attribute_values'] = {}
531+
body['object']['item_data']['variations'][0]['catalog_v1_ids'] = []
532+
533+
body['object']['item_data']['variations'][0]['catalog_v1_ids'].append({})
534+
body['object']['item_data']['variations'][0]['catalog_v1_ids'][0]['catalog_v1_id'] = 'catalog_v1_id9'
535+
body['object']['item_data']['variations'][0]['catalog_v1_ids'][0]['location_id'] = 'location_id9'
536+
537+
body['object']['item_data']['variations'][0]['item_variation_data'] = {}
538+
body['object']['item_data']['variations'][0]['item_variation_data']['item_id'] = '#Cocoa'
539+
body['object']['item_data']['variations'][0]['item_variation_data']['name'] = 'Small'
540+
body['object']['item_data']['variations'][0]['item_variation_data']['sku'] = 'sku3'
541+
body['object']['item_data']['variations'][0]['item_variation_data']['upc'] = 'upc1'
542+
body['object']['item_data']['variations'][0]['item_variation_data']['ordinal'] = 119
543+
body['object']['item_data']['variations'][0]['item_variation_data']['pricing_type'] = 'VARIABLE_PRICING'
544+
545+
body['object']['item_data']['variations'].append({})
546+
body['object']['item_data']['variations'][1]['type'] = 'ITEM_VARIATION'
547+
body['object']['item_data']['variations'][1]['id'] = '#Large'
548+
body['object']['item_data']['variations'][1]['updated_at'] = 'updated_at0'
549+
body['object']['item_data']['variations'][1]['version'] = 68
550+
body['object']['item_data']['variations'][1]['is_deleted'] = False
551+
body['object']['item_data']['variations'][1]['custom_attribute_values'] = {}
552+
body['object']['item_data']['variations'][1]['catalog_v1_ids'] = []
553+
554+
body['object']['item_data']['variations'][1]['catalog_v1_ids'].append({})
555+
body['object']['item_data']['variations'][1]['catalog_v1_ids'][0]['catalog_v1_id'] = 'catalog_v1_id8'
556+
body['object']['item_data']['variations'][1]['catalog_v1_ids'][0]['location_id'] = 'location_id8'
557+
558+
body['object']['item_data']['variations'][1]['catalog_v1_ids'].append({})
559+
body['object']['item_data']['variations'][1]['catalog_v1_ids'][1]['catalog_v1_id'] = 'catalog_v1_id9'
560+
body['object']['item_data']['variations'][1]['catalog_v1_ids'][1]['location_id'] = 'location_id9'
561+
562+
body['object']['item_data']['variations'][1]['catalog_v1_ids'].append({})
563+
body['object']['item_data']['variations'][1]['catalog_v1_ids'][2]['catalog_v1_id'] = 'catalog_v1_id0'
564+
body['object']['item_data']['variations'][1]['catalog_v1_ids'][2]['location_id'] = 'location_id0'
565+
566+
body['object']['item_data']['variations'][1]['item_variation_data'] = {}
567+
body['object']['item_data']['variations'][1]['item_variation_data']['item_id'] = '#Cocoa'
568+
body['object']['item_data']['variations'][1]['item_variation_data']['name'] = 'Large'
569+
body['object']['item_data']['variations'][1]['item_variation_data']['sku'] = 'sku4'
570+
body['object']['item_data']['variations'][1]['item_variation_data']['upc'] = 'upc2'
571+
body['object']['item_data']['variations'][1]['item_variation_data']['ordinal'] = 118
572+
body['object']['item_data']['variations'][1]['item_variation_data']['pricing_type'] = 'FIXED_PRICING'
573+
body['object']['item_data']['variations'][1]['item_variation_data']['price_money'] = {}
574+
body['object']['item_data']['variations'][1]['item_variation_data']['price_money']['amount'] = 400
575+
body['object']['item_data']['variations'][1]['item_variation_data']['price_money']['currency'] = 'USD'
576+
522577

523578
result = catalog_api.upsert_catalog_object(body)
524579

0 commit comments

Comments
 (0)