diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0a0a6b67..bcd6d5c8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,7 @@
# Change Log
+For general API and SDK changelogs, see [Square APIs and SDKs Release Notes](https://developer.squareup.com/docs/changelog/connect).
+
## Version 17.0.0.20211215 (2021-12-15)
### API updates
diff --git a/LICENSE b/LICENSE
index 68e1bf6c..6863d491 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-Copyright 2021 Square, Inc.
+Copyright 2022 Square, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
diff --git a/README.md b/README.md
index eed20b7a..5060eafa 100644
--- a/README.md
+++ b/README.md
@@ -31,7 +31,7 @@ python setup.py install --user
In Python 2, you can install via pip:
```sh
-pip install -r requirement.txt
+pip install -r requirements.txt
pip install -r test-requirements.txt
```
diff --git a/doc/api/bookings.md b/doc/api/bookings.md
index c539ddf8..f981fd05 100644
--- a/doc/api/bookings.md
+++ b/doc/api/bookings.md
@@ -25,6 +25,9 @@ bookings_api = client.bookings
Retrieve a collection of bookings.
+To call this endpoint with buyer-level permissions, set `APPOINTMENTS_READ` for the OAuth scope.
+To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` for the OAuth scope.
+
```python
def list_bookings(self,
limit=None,
@@ -73,6 +76,9 @@ elif result.is_error():
Creates a booking.
+To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope.
+To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope.
+
```python
def create_booking(self,
body)
@@ -113,6 +119,9 @@ elif result.is_error():
Searches for availabilities for booking.
+To call this endpoint with buyer-level permissions, set `APPOINTMENTS_READ` for the OAuth scope.
+To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` for the OAuth scope.
+
```python
def search_availability(self,
body)
@@ -206,8 +215,8 @@ def list_team_member_booking_profiles(self,
| Parameter | Type | Tags | Description |
| --- | --- | --- | --- |
| `bookable_only` | `bool` | Query, Optional | Indicates whether to include only bookable team members in the returned result (`true`) or not (`false`).
**Default**: `False` |
-| `limit` | `int` | Query, Optional | The maximum number of results to return. |
-| `cursor` | `string` | Query, Optional | The cursor for paginating through the results. |
+| `limit` | `int` | Query, Optional | The maximum number of results to return in a paged response. |
+| `cursor` | `string` | Query, Optional | The pagination cursor from the preceding response to return the next page of the results. Do not set this when retrieving the first page of the results. |
| `location_id` | `string` | Query, Optional | Indicates whether to include only team members enabled at the given location in the returned result. |
## Response Type
@@ -268,6 +277,9 @@ elif result.is_error():
Retrieves a booking.
+To call this endpoint with buyer-level permissions, set `APPOINTMENTS_READ` for the OAuth scope.
+To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` for the OAuth scope.
+
```python
def retrieve_booking(self,
booking_id)
@@ -301,6 +313,9 @@ elif result.is_error():
Updates a booking.
+To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope.
+To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope.
+
```python
def update_booking(self,
booking_id,
@@ -344,6 +359,9 @@ elif result.is_error():
Cancels an existing booking.
+To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope.
+To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope.
+
```python
def cancel_booking(self,
booking_id,
diff --git a/doc/api/checkout.md b/doc/api/checkout.md
index eb8666de..2f14b815 100644
--- a/doc/api/checkout.md
+++ b/doc/api/checkout.md
@@ -160,8 +160,6 @@ body['pre_populate_shipping_address']['sublocality'] = 'sublocality0'
body['pre_populate_shipping_address']['administrative_district_level_1'] = 'CA'
body['pre_populate_shipping_address']['postal_code'] = '94103'
body['pre_populate_shipping_address']['country'] = 'US'
-body['pre_populate_shipping_address']['first_name'] = 'Jane'
-body['pre_populate_shipping_address']['last_name'] = 'Doe'
body['redirect_url'] = 'https://merchant.website.com/order-confirm'
body['additional_recipients'] = []
diff --git a/doc/api/locations.md b/doc/api/locations.md
index 2260da93..96014012 100644
--- a/doc/api/locations.md
+++ b/doc/api/locations.md
@@ -18,7 +18,7 @@ locations_api = client.locations
# List Locations
-Provides details about all of the seller's locations,
+Provides details about all of the seller's [locations](https://developer.squareup.com/docs/locations-api),
including those with an inactive status.
```python
@@ -131,7 +131,7 @@ elif result.is_error():
# Update Location
-Updates a location.
+Updates a [location](https://developer.squareup.com/docs/locations-api).
```python
def update_location(self,
diff --git a/doc/api/loyalty.md b/doc/api/loyalty.md
index 9f6b7908..2badd425 100644
--- a/doc/api/loyalty.md
+++ b/doc/api/loyalty.md
@@ -164,9 +164,6 @@ Adds points to a loyalty account.
[CalculateLoyaltyPoints](/doc/api/loyalty.md#calculate-loyalty-points) to compute the points
that you provide to this endpoint.
-__Note:__ The country of the seller's Square account determines whether tax is included in the purchase amount when accruing points for spend-based and visit-based programs.
-For more information, see [Availability of Square Loyalty](https://developer.squareup.com/docs/loyalty-api/overview#loyalty-market-availability).
-
```python
def accumulate_loyalty_points(self,
account_id,
@@ -374,7 +371,7 @@ elif result.is_error():
Calculates the points a purchase earns.
-- If you are using the Orders API to manage orders, you provide `order_id` in the request. The
+- If you are using the Orders API to manage orders, you provide the `order_id` in the request. The
endpoint calculates the points by reading the order.
- If you are not using the Orders API to manage orders, you provide the purchase amount in
the request for the endpoint to calculate the points.
@@ -382,8 +379,7 @@ Calculates the points a purchase earns.
An application might call this endpoint to show the points that a buyer can earn with the
specific purchase.
-__Note:__ The country of the seller's Square account determines whether tax is included in the purchase amount when accruing points for spend-based and visit-based programs.
-For more information, see [Availability of Square Loyalty](https://developer.squareup.com/docs/loyalty-api/overview#loyalty-market-availability).
+For spend-based and visit-based programs, the `tax_mode` setting of the accrual rule indicates how taxes should be treated for loyalty points accrual.
```python
def calculate_loyalty_points(self,
diff --git a/doc/api/refunds.md b/doc/api/refunds.md
index 79bb9ca5..837d114f 100644
--- a/doc/api/refunds.md
+++ b/doc/api/refunds.md
@@ -46,7 +46,7 @@ def list_payment_refunds(self,
| `cursor` | `string` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this cursor to retrieve the next set of results for the original query.
For more information, see [Pagination](https://developer.squareup.com/docs/basics/api101/pagination). |
| `location_id` | `string` | Query, Optional | Limit results to the location supplied. By default, results are returned
for all locations associated with the seller. |
| `status` | `string` | Query, Optional | If provided, only refunds with the given status are returned.
For a list of refund status values, see [PaymentRefund](/doc/models/payment-refund.md).
Default: If omitted, refunds are returned regardless of their status. |
-| `source_type` | `string` | Query, Optional | If provided, only refunds with the given source type are returned.
- `CARD` - List refunds only for payments where `CARD` was specified as the payment
source.
Default: If omitted, refunds are returned regardless of the source type. |
+| `source_type` | `string` | Query, Optional | If provided, only returns refunds whose payments have the indicated source type.
Current values include `CARD`, `BANK_ACCOUNT`, `WALLET`, `CASH`, and `EXTERNAL`.
For information about these payment source types, see
[Take Payments](https://developer.squareup.com/docs/payments-api/take-payments).
Default: If omitted, refunds are returned regardless of the source type. |
| `limit` | `int` | Query, Optional | The maximum number of results to be returned in a single page.
It is possible to receive fewer results than the specified limit on a given page.
If the supplied value is greater than 100, no more than 100 results are returned.
Default: 100 |
## Response Type
diff --git a/doc/client.md b/doc/client.md
index 2d630180..f8ea50ca 100644
--- a/doc/client.md
+++ b/doc/client.md
@@ -5,8 +5,7 @@ The following parameters are configurable for the API Client:
| Parameter | Type | Description |
| --- | --- | --- |
-| `square_version` | `string` | Square Connect API versions
*Default*: `'2021-12-15'` |
-| `access_token` | `string` | The OAuth 2.0 Access Token to use for API requests. |
+| `square_version` | `string` | Square Connect API versions
*Default*: `'2022-01-20'` |
| `custom_url` | `string` | Sets the base URL requests are made to. Defaults to `https://connect.squareup.com`
*Default*: `'https://connect.squareup.com'` |
| `environment` | `string` | The API environment.
**Default: `production`** |
| `http_client_instance` | `HttpClient` | The Http Client passed from the sdk user for making requests |
@@ -25,8 +24,7 @@ The API client can be initialized as follows:
from square.client import Client
client = Client(
- square_version='2021-12-15',
- access_token='AccessToken',
+ square_version='2022-01-20',
environment='production',
custom_url = 'https://connect.squareup.com',)
```
@@ -50,8 +48,7 @@ API calls return an `ApiResponse` object that includes the following fields:
from square.client import Client
client = Client(
- square_version='2021-12-15',
- access_token='AccessToken',)
+ square_version='2022-01-20',)
locations_api = client.locations
result = locations_api.list_locations()
diff --git a/doc/models/address.md b/doc/models/address.md
index 90ff1943..70f45530 100644
--- a/doc/models/address.md
+++ b/doc/models/address.md
@@ -1,34 +1,8 @@
# Address
-Represents a postal address in a country. The address format is based
-on an [open-source library from Google](https://github.com/google/libaddressinput). For more information,
-see [AddressValidationMetadata](https://github.com/google/libaddressinput/wiki/AddressValidationMetadata).
-This format has dedicated fields for four address components: postal code,
-locality (city), administrative district (state, prefecture, or province), and
-sublocality (town or village). These components have dedicated fields in the
-`Address` object because software sometimes behaves differently based on them.
-For example, sales tax software may charge different amounts of sales tax
-based on the postal code, and some software is only available in
-certain states due to compliance reasons.
-
-For the remaining address components, the `Address` type provides the
-`address_line_1` and `address_line_2` fields for free-form data entry.
-These fields are free-form because the remaining address components have
-too many variations around the world and typical software does not parse
-these components. These fields enable users to enter anything they want.
-
-Note that, in the current implementation, all other `Address` type fields are blank.
-These include `address_line_3`, `sublocality_2`, `sublocality_3`,
-`administrative_district_level_2`, `administrative_district_level_3`,
-`first_name`, `last_name`, and `organization`.
-
-When it comes to localization, the seller's language preferences
-(see [Language preferences](https://developer.squareup.com/docs/locations-api#location-specific-and-seller-level-language-preferences))
-are ignored for addresses. Even though Square products (such as Square Point of Sale
-and the Seller Dashboard) mostly use a seller's language preference in
-communication, when it comes to addresses, they will use English for a US address,
-Japanese for an address in Japan, and so on.
+Represents a postal address in a country.
+For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses).
## Structure
@@ -41,18 +15,11 @@ Japanese for an address in Japan, and so on.
| `address_line_1` | `string` | Optional | The first line of the address.
Fields that start with `address_line` provide the address's most specific
details, like street number, street name, and building name. They do *not*
provide less specific details like city, state/province, or country (these
details are provided in other fields). |
| `address_line_2` | `string` | Optional | The second line of the address, if any. |
| `address_line_3` | `string` | Optional | The third line of the address, if any. |
-| `locality` | `string` | Optional | The city or town of the address. |
+| `locality` | `string` | Optional | The city or town of the address. For a full list of field meanings by country, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). |
| `sublocality` | `string` | Optional | A civil region within the address's `locality`, if any. |
-| `sublocality_2` | `string` | Optional | A civil region within the address's `sublocality`, if any. |
-| `sublocality_3` | `string` | Optional | A civil region within the address's `sublocality_2`, if any. |
-| `administrative_district_level_1` | `string` | Optional | A civil entity within the address's country. In the US, this
is the state. |
-| `administrative_district_level_2` | `string` | Optional | A civil entity within the address's `administrative_district_level_1`.
In the US, this is the county. |
-| `administrative_district_level_3` | `string` | Optional | A civil entity within the address's `administrative_district_level_2`,
if any. |
-| `postal_code` | `string` | Optional | The address's postal code. |
+| `administrative_district_level_1` | `string` | Optional | A civil entity within the address's country. In the US, this
is the state. For a full list of field meanings by country, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). |
+| `postal_code` | `string` | Optional | The address's postal code. For a full list of field meanings by country, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). |
| `country` | [`str (Country)`](/doc/models/country.md) | Optional | Indicates the country associated with another entity, such as a business.
Values are in [ISO 3166-1-alpha-2 format](http://www.iso.org/iso/home/standards/country_codes.htm). |
-| `first_name` | `string` | Optional | Optional first name when it's representing recipient. |
-| `last_name` | `string` | Optional | Optional last name when it's representing recipient. |
-| `organization` | `string` | Optional | Optional organization name when it's representing recipient. |
## Example (as JSON)
diff --git a/doc/models/appointment-segment.md b/doc/models/appointment-segment.md
index 19b2de12..a8225250 100644
--- a/doc/models/appointment-segment.md
+++ b/doc/models/appointment-segment.md
@@ -15,6 +15,9 @@ Defines an appointment segment of a booking.
| `service_variation_id` | `string` | Required | The ID of the [CatalogItemVariation](/doc/models/catalog-item-variation.md) object representing the service booked in this segment.
**Constraints**: *Minimum Length*: `1` |
| `team_member_id` | `string` | Required | The ID of the [TeamMember](/doc/models/team-member.md) object representing the team member booked in this segment.
**Constraints**: *Minimum Length*: `1` |
| `service_variation_version` | `long\|int` | Required | The current version of the item variation representing the service booked in this segment. |
+| `intermission_minutes` | `int` | Optional | Time between the end of this segment and the beginning of the subsequent segment. |
+| `any_team_member` | `bool` | Optional | Whether the customer accepts any team member, instead of a specific one, to serve this segment. |
+| `resource_ids` | `List of string` | Optional | The IDs of the seller-accessible resources used for this appointment segment. |
## Example (as JSON)
@@ -23,7 +26,13 @@ Defines an appointment segment of a booking.
"duration_minutes": 144,
"service_variation_id": "service_variation_id6",
"team_member_id": "team_member_id0",
- "service_variation_version": 56
+ "service_variation_version": 56,
+ "intermission_minutes": 62,
+ "any_team_member": false,
+ "resource_ids": [
+ "resource_ids0",
+ "resource_ids1"
+ ]
}
```
diff --git a/doc/models/availability.md b/doc/models/availability.md
index e5783007..d7c2c63e 100644
--- a/doc/models/availability.md
+++ b/doc/models/availability.md
@@ -1,7 +1,7 @@
# Availability
-Describes a slot available for booking, encapsulating appointment segments, the location and starting time.
+Defines an appointment slot that encapsulates the appointment segments, location and starting time avaialable for booking.
## Structure
@@ -26,7 +26,13 @@ Describes a slot available for booking, encapsulating appointment segments, the
"duration_minutes": 4,
"service_variation_id": "service_variation_id4",
"team_member_id": "team_member_id0",
- "service_variation_version": 172
+ "service_variation_version": 172,
+ "intermission_minutes": 178,
+ "any_team_member": false,
+ "resource_ids": [
+ "resource_ids0",
+ "resource_ids1"
+ ]
}
]
}
diff --git a/doc/models/bank-account.md b/doc/models/bank-account.md
index d3ba1d01..c4ded40f 100644
--- a/doc/models/bank-account.md
+++ b/doc/models/bank-account.md
@@ -1,10 +1,6 @@
# Bank Account
-Represents a bank account. For more information about
-linking a bank account to a Square account, see
-[Bank Accounts API](https://developer.squareup.com/docs/bank-accounts-api).
-
## Structure
`Bank Account`
diff --git a/doc/models/booking-booking-source.md b/doc/models/booking-booking-source.md
new file mode 100644
index 00000000..ad779401
--- /dev/null
+++ b/doc/models/booking-booking-source.md
@@ -0,0 +1,18 @@
+
+# Booking Booking Source
+
+Supported sources a booking was created from.
+
+## Enumeration
+
+`Booking Booking Source`
+
+## Fields
+
+| Name | Description |
+| --- | --- |
+| `FIRST_PARTY_MERCHANT` | The booking was created by a seller from a Square Appointments application, such as the Square Appointments Dashboard or a Square Appointments mobile app. |
+| `FIRST_PARTY_BUYER` | The booking was created by a buyer from a Square Appointments application, such as Square Online Booking Site. |
+| `THIRD_PARTY_BUYER` | The booking was created by a buyer created from a third-party application. |
+| `API` | The booking was created by a seller or a buyer from the Square Bookings API. |
+
diff --git a/doc/models/booking-creator-details-creator-type.md b/doc/models/booking-creator-details-creator-type.md
new file mode 100644
index 00000000..c36af2b2
--- /dev/null
+++ b/doc/models/booking-creator-details-creator-type.md
@@ -0,0 +1,16 @@
+
+# Booking Creator Details Creator Type
+
+Supported types of a booking creator.
+
+## Enumeration
+
+`Booking Creator Details Creator Type`
+
+## Fields
+
+| Name | Description |
+| --- | --- |
+| `TEAM_MEMBER` | The creator is of the seller type. |
+| `CUSTOMER` | The creator is of the buyer type. |
+
diff --git a/doc/models/booking-creator-details.md b/doc/models/booking-creator-details.md
new file mode 100644
index 00000000..bfe65f0d
--- /dev/null
+++ b/doc/models/booking-creator-details.md
@@ -0,0 +1,27 @@
+
+# Booking Creator Details
+
+Information about a booking creator.
+
+## Structure
+
+`Booking Creator Details`
+
+## Fields
+
+| Name | Type | Tags | Description |
+| --- | --- | --- | --- |
+| `creator_type` | [`str (Booking Creator Details Creator Type)`](/doc/models/booking-creator-details-creator-type.md) | Optional | Supported types of a booking creator. |
+| `team_member_id` | `string` | Optional | The ID of the team member who created the booking, when the booking creator is of the `TEAM_MEMBER` type.
Access to this field requires seller-level permissions. |
+| `customer_id` | `string` | Optional | The ID of the customer who created the booking, when the booking creator is of the `CUSTOMER` type.
Access to this field requires seller-level permissions. |
+
+## Example (as JSON)
+
+```json
+{
+ "creator_type": "TEAM_MEMBER",
+ "team_member_id": "team_member_id0",
+ "customer_id": "customer_id8"
+}
+```
+
diff --git a/doc/models/booking.md b/doc/models/booking.md
index 738aabdd..d1e1855f 100644
--- a/doc/models/booking.md
+++ b/doc/models/booking.md
@@ -15,14 +15,19 @@ at a given location to a requesting customer in one or more appointment segments
| `id` | `string` | Optional | A unique ID of this object representing a booking. |
| `version` | `int` | Optional | The revision number for the booking used for optimistic concurrency. |
| `status` | [`str (Booking Status)`](/doc/models/booking-status.md) | Optional | Supported booking statuses. |
-| `created_at` | `string` | Optional | The timestamp specifying the creation time of this booking, in RFC 3339 format. |
-| `updated_at` | `string` | Optional | The timestamp specifying the most recent update time of this booking, in RFC 3339 format. |
-| `start_at` | `string` | Optional | The timestamp specifying the starting time of this booking, in RFC 3339 format. |
+| `created_at` | `string` | Optional | The RFC 3339 timestamp specifying the creation time of this booking. |
+| `updated_at` | `string` | Optional | The RFC 3339 timestamp specifying the most recent update time of this booking. |
+| `start_at` | `string` | Optional | The RFC 3339 timestamp specifying the starting time of this booking. |
| `location_id` | `string` | Optional | The ID of the [Location](/doc/models/location.md) object representing the location where the booked service is provided. |
| `customer_id` | `string` | Optional | The ID of the [Customer](/doc/models/customer.md) object representing the customer receiving the booked service. |
| `customer_note` | `string` | Optional | The free-text field for the customer to supply notes about the booking. For example, the note can be preferences that cannot be expressed by supported attributes of a relevant [CatalogObject](/doc/models/catalog-object.md) instance.
**Constraints**: *Maximum Length*: `4096` |
| `seller_note` | `string` | Optional | The free-text field for the seller to supply notes about the booking. For example, the note can be preferences that cannot be expressed by supported attributes of a specific [CatalogObject](/doc/models/catalog-object.md) instance.
This field should not be visible to customers.
**Constraints**: *Maximum Length*: `4096` |
| `appointment_segments` | [`List of Appointment Segment`](/doc/models/appointment-segment.md) | Optional | A list of appointment segments for this booking. |
+| `transition_time_minutes` | `int` | Optional | Additional time at the end of a booking.
Applications should not make this field visible to customers of a seller. |
+| `all_day` | `bool` | Optional | Whether the booking is of a full business day. |
+| `location_type` | [`str (Business Appointment Settings Booking Location Type)`](/doc/models/business-appointment-settings-booking-location-type.md) | Optional | Supported types of location where service is provided. |
+| `creator_details` | [`Booking Creator Details`](/doc/models/booking-creator-details.md) | Optional | Information about a booking creator. |
+| `source` | [`str (Booking Booking Source)`](/doc/models/booking-booking-source.md) | Optional | Supported sources a booking was created from. |
## Example (as JSON)
diff --git a/doc/models/business-appointment-settings-booking-location-type.md b/doc/models/business-appointment-settings-booking-location-type.md
index 0c2293a0..de336334 100644
--- a/doc/models/business-appointment-settings-booking-location-type.md
+++ b/doc/models/business-appointment-settings-booking-location-type.md
@@ -1,7 +1,7 @@
# Business Appointment Settings Booking Location Type
-Types of location where service is provided.
+Supported types of location where service is provided.
## Enumeration
diff --git a/doc/models/business-hours-period.md b/doc/models/business-hours-period.md
index e932deab..90d78b0b 100644
--- a/doc/models/business-hours-period.md
+++ b/doc/models/business-hours-period.md
@@ -12,8 +12,8 @@ Represents a period of time during which a business location is open.
| Name | Type | Tags | Description |
| --- | --- | --- | --- |
| `day_of_week` | [`str (Day of Week)`](/doc/models/day-of-week.md) | Optional | Indicates the specific day of the week. |
-| `start_local_time` | `string` | Optional | The start time of a business hours period, specified in local time using partial-time
RFC 3339 format. |
-| `end_local_time` | `string` | Optional | The end time of a business hours period, specified in local time using partial-time
RFC 3339 format. |
+| `start_local_time` | `string` | Optional | The start time of a business hours period, specified in local time using partial-time
RFC 3339 format. For example, `8:30:00` for a period starting at 8:30 in the morning.
Note that the seconds value will always be :00, but it is appended for conformance to the RFC. |
+| `end_local_time` | `string` | Optional | The end time of a business hours period, specified in local time using partial-time
RFC 3339 format. For example, `21:00:00` for a period ending at 9:00 in the evening.
Note that the seconds value will always be :00, but it is appended for conformance to the RFC. |
## Example (as JSON)
diff --git a/doc/models/cancel-booking-response.md b/doc/models/cancel-booking-response.md
index f92de8d1..fe0a790b 100644
--- a/doc/models/cancel-booking-response.md
+++ b/doc/models/cancel-booking-response.md
@@ -10,7 +10,7 @@
| Name | Type | Tags | Description |
| --- | --- | --- | --- |
| `booking` | [`Booking`](/doc/models/booking.md) | Optional | Represents a booking as a time-bound service contract for a seller's staff member to provide a specified service
at a given location to a requesting customer in one or more appointment segments. |
-| `errors` | [`List of Error`](/doc/models/error.md) | Optional | Any errors that occurred during the request. |
+| `errors` | [`List of Error`](/doc/models/error.md) | Optional | Errors that occurred during the request. |
## Example (as JSON)
diff --git a/doc/models/card.md b/doc/models/card.md
index bb5bdab7..6440c0c2 100644
--- a/doc/models/card.md
+++ b/doc/models/card.md
@@ -18,7 +18,7 @@ details are determined by the payment token generated by Web Payments SDK.
| `exp_month` | `long\|int` | Optional | The expiration month of the associated card as an integer between 1 and 12. |
| `exp_year` | `long\|int` | Optional | The four-digit year of the card's expiration date. |
| `cardholder_name` | `string` | Optional | The name of the cardholder.
**Constraints**: *Maximum Length*: `96` |
-| `billing_address` | [`Address`](/doc/models/address.md) | Optional | Represents a postal address in a country. The address format is based
on an [open-source library from Google](https://github.com/google/libaddressinput). For more information,
see [AddressValidationMetadata](https://github.com/google/libaddressinput/wiki/AddressValidationMetadata).
This format has dedicated fields for four address components: postal code,
locality (city), administrative district (state, prefecture, or province), and
sublocality (town or village). These components have dedicated fields in the
`Address` object because software sometimes behaves differently based on them.
For example, sales tax software may charge different amounts of sales tax
based on the postal code, and some software is only available in
certain states due to compliance reasons.
For the remaining address components, the `Address` type provides the
`address_line_1` and `address_line_2` fields for free-form data entry.
These fields are free-form because the remaining address components have
too many variations around the world and typical software does not parse
these components. These fields enable users to enter anything they want.
Note that, in the current implementation, all other `Address` type fields are blank.
These include `address_line_3`, `sublocality_2`, `sublocality_3`,
`administrative_district_level_2`, `administrative_district_level_3`,
`first_name`, `last_name`, and `organization`.
When it comes to localization, the seller's language preferences
(see [Language preferences](https://developer.squareup.com/docs/locations-api#location-specific-and-seller-level-language-preferences))
are ignored for addresses. Even though Square products (such as Square Point of Sale
and the Seller Dashboard) mostly use a seller's language preference in
communication, when it comes to addresses, they will use English for a US address,
Japanese for an address in Japan, and so on. |
+| `billing_address` | [`Address`](/doc/models/address.md) | Optional | Represents a postal address in a country.
For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). |
| `fingerprint` | `string` | Optional | Intended as a Square-assigned identifier, based
on the card number, to identify the card across multiple locations within a
single application.
**Constraints**: *Maximum Length*: `255` |
| `customer_id` | `string` | Optional | The ID of a customer created using the Customers API to be associated with the card. |
| `merchant_id` | `string` | Optional | The ID of the merchant associated with the card. |
diff --git a/doc/models/catalog-discount.md b/doc/models/catalog-discount.md
index eb85d5f4..2c80bcc0 100644
--- a/doc/models/catalog-discount.md
+++ b/doc/models/catalog-discount.md
@@ -18,6 +18,7 @@ A discount applicable to items.
| `pin_required` | `bool` | Optional | Indicates whether a mobile staff member needs to enter their PIN to apply the
discount to a payment in the Square Point of Sale app. |
| `label_color` | `string` | Optional | The color of the discount display label in the Square Point of Sale app. This must be a valid hex color code. |
| `modify_tax_basis` | [`str (Catalog Discount Modify Tax Basis)`](/doc/models/catalog-discount-modify-tax-basis.md) | Optional | - |
+| `maximum_amount_money` | [`Money`](/doc/models/money.md) | Optional | Represents an amount of money. `Money` fields can be signed or unsigned.
Fields that do not explicitly define whether they are signed or unsigned are
considered unsigned and can only hold positive amounts. For signed fields, the
sign of the value indicates the purpose of the money transfer. See
[Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts)
for more information. |
## Example (as JSON)
diff --git a/doc/models/charge-request.md b/doc/models/charge-request.md
index 688f03e8..87421396 100644
--- a/doc/models/charge-request.md
+++ b/doc/models/charge-request.md
@@ -22,8 +22,8 @@ Deprecated - recommend using [CreatePayment](/doc/api/payments.md#create-payment
| `reference_id` | `string` | Optional | An optional ID you can associate with the transaction for your own
purposes (such as to associate the transaction with an entity ID in your
own database).
This value cannot exceed 40 characters.
**Constraints**: *Maximum Length*: `40` |
| `note` | `string` | Optional | An optional note to associate with the transaction.
This value cannot exceed 60 characters.
**Constraints**: *Maximum Length*: `60` |
| `customer_id` | `string` | Optional | The ID of the customer to associate this transaction with. This field
is required if you provide a value for `customer_card_id`, and optional
otherwise.
**Constraints**: *Maximum Length*: `50` |
-| `billing_address` | [`Address`](/doc/models/address.md) | Optional | Represents a postal address in a country. The address format is based
on an [open-source library from Google](https://github.com/google/libaddressinput). For more information,
see [AddressValidationMetadata](https://github.com/google/libaddressinput/wiki/AddressValidationMetadata).
This format has dedicated fields for four address components: postal code,
locality (city), administrative district (state, prefecture, or province), and
sublocality (town or village). These components have dedicated fields in the
`Address` object because software sometimes behaves differently based on them.
For example, sales tax software may charge different amounts of sales tax
based on the postal code, and some software is only available in
certain states due to compliance reasons.
For the remaining address components, the `Address` type provides the
`address_line_1` and `address_line_2` fields for free-form data entry.
These fields are free-form because the remaining address components have
too many variations around the world and typical software does not parse
these components. These fields enable users to enter anything they want.
Note that, in the current implementation, all other `Address` type fields are blank.
These include `address_line_3`, `sublocality_2`, `sublocality_3`,
`administrative_district_level_2`, `administrative_district_level_3`,
`first_name`, `last_name`, and `organization`.
When it comes to localization, the seller's language preferences
(see [Language preferences](https://developer.squareup.com/docs/locations-api#location-specific-and-seller-level-language-preferences))
are ignored for addresses. Even though Square products (such as Square Point of Sale
and the Seller Dashboard) mostly use a seller's language preference in
communication, when it comes to addresses, they will use English for a US address,
Japanese for an address in Japan, and so on. |
-| `shipping_address` | [`Address`](/doc/models/address.md) | Optional | Represents a postal address in a country. The address format is based
on an [open-source library from Google](https://github.com/google/libaddressinput). For more information,
see [AddressValidationMetadata](https://github.com/google/libaddressinput/wiki/AddressValidationMetadata).
This format has dedicated fields for four address components: postal code,
locality (city), administrative district (state, prefecture, or province), and
sublocality (town or village). These components have dedicated fields in the
`Address` object because software sometimes behaves differently based on them.
For example, sales tax software may charge different amounts of sales tax
based on the postal code, and some software is only available in
certain states due to compliance reasons.
For the remaining address components, the `Address` type provides the
`address_line_1` and `address_line_2` fields for free-form data entry.
These fields are free-form because the remaining address components have
too many variations around the world and typical software does not parse
these components. These fields enable users to enter anything they want.
Note that, in the current implementation, all other `Address` type fields are blank.
These include `address_line_3`, `sublocality_2`, `sublocality_3`,
`administrative_district_level_2`, `administrative_district_level_3`,
`first_name`, `last_name`, and `organization`.
When it comes to localization, the seller's language preferences
(see [Language preferences](https://developer.squareup.com/docs/locations-api#location-specific-and-seller-level-language-preferences))
are ignored for addresses. Even though Square products (such as Square Point of Sale
and the Seller Dashboard) mostly use a seller's language preference in
communication, when it comes to addresses, they will use English for a US address,
Japanese for an address in Japan, and so on. |
+| `billing_address` | [`Address`](/doc/models/address.md) | Optional | Represents a postal address in a country.
For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). |
+| `shipping_address` | [`Address`](/doc/models/address.md) | Optional | Represents a postal address in a country.
For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). |
| `buyer_email_address` | `string` | Optional | The buyer's email address, if available. This value is optional,
but this transaction is ineligible for chargeback protection if it is not
provided. |
| `order_id` | `string` | Optional | The ID of the order to associate with this transaction.
If you provide this value, the `amount_money` value of your request must
__exactly match__ the value of the order's `total_money` field.
**Constraints**: *Maximum Length*: `192` |
| `additional_recipients` | [`List of Charge Request Additional Recipient`](/doc/models/charge-request-additional-recipient.md) | Optional | The basic primitive of multi-party transaction. The value is optional.
The transaction facilitated by you can be split from here.
If you provide this value, the `amount_money` value in your additional_recipients
must not be more than 90% of the `amount_money` value in the charge request.
The `location_id` must be the valid location of the app owner merchant.
This field requires the `PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS` OAuth permission.
This field is currently not supported in sandbox. |
diff --git a/doc/models/checkout.md b/doc/models/checkout.md
index 1096fd5b..f40ac51c 100644
--- a/doc/models/checkout.md
+++ b/doc/models/checkout.md
@@ -17,7 +17,7 @@ payment types using a checkout workflow hosted on squareup.com.
| `ask_for_shipping_address` | `bool` | Optional | If `true`, Square Checkout will collect shipping information on your
behalf and store that information with the transaction information in your
Square Dashboard.
Default: `false`. |
| `merchant_support_email` | `string` | Optional | The email address to display on the Square Checkout confirmation page
and confirmation email that the buyer can use to contact the merchant.
If this value is not set, the confirmation page and email will display the
primary email address associated with the merchant's Square account.
Default: none; only exists if explicitly set. |
| `pre_populate_buyer_email` | `string` | Optional | If provided, the buyer's email is pre-populated on the checkout page
as an editable text field.
Default: none; only exists if explicitly set. |
-| `pre_populate_shipping_address` | [`Address`](/doc/models/address.md) | Optional | Represents a postal address in a country. The address format is based
on an [open-source library from Google](https://github.com/google/libaddressinput). For more information,
see [AddressValidationMetadata](https://github.com/google/libaddressinput/wiki/AddressValidationMetadata).
This format has dedicated fields for four address components: postal code,
locality (city), administrative district (state, prefecture, or province), and
sublocality (town or village). These components have dedicated fields in the
`Address` object because software sometimes behaves differently based on them.
For example, sales tax software may charge different amounts of sales tax
based on the postal code, and some software is only available in
certain states due to compliance reasons.
For the remaining address components, the `Address` type provides the
`address_line_1` and `address_line_2` fields for free-form data entry.
These fields are free-form because the remaining address components have
too many variations around the world and typical software does not parse
these components. These fields enable users to enter anything they want.
Note that, in the current implementation, all other `Address` type fields are blank.
These include `address_line_3`, `sublocality_2`, `sublocality_3`,
`administrative_district_level_2`, `administrative_district_level_3`,
`first_name`, `last_name`, and `organization`.
When it comes to localization, the seller's language preferences
(see [Language preferences](https://developer.squareup.com/docs/locations-api#location-specific-and-seller-level-language-preferences))
are ignored for addresses. Even though Square products (such as Square Point of Sale
and the Seller Dashboard) mostly use a seller's language preference in
communication, when it comes to addresses, they will use English for a US address,
Japanese for an address in Japan, and so on. |
+| `pre_populate_shipping_address` | [`Address`](/doc/models/address.md) | Optional | Represents a postal address in a country.
For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). |
| `redirect_url` | `string` | Optional | The URL to redirect to after checkout is completed with `checkoutId`,
Square's `orderId`, `transactionId`, and `referenceId` appended as URL
parameters. For example, if the provided redirect_url is
`http://www.example.com/order-complete`, a successful transaction redirects
the customer to:
http://www.example.com/order-complete?checkoutId=xxxxxx&orderId=xxxxxx&referenceId=xxxxxx&transactionId=xxxxxx
If you do not provide a redirect URL, Square Checkout will display an order
confirmation page on your behalf; however Square strongly recommends that
you provide a redirect URL so you can verify the transaction results and
finalize the order through your existing/normal confirmation workflow. |
| `order` | [`Order`](/doc/models/order.md) | Optional | Contains all information related to a single order to process with Square,
including line items that specify the products to purchase. `Order` objects also
include information about any associated tenders, refunds, and returns.
All Connect V2 Transactions have all been converted to Orders including all associated
itemization data. |
| `created_at` | `string` | Optional | The time when the checkout was created, in RFC 3339 format. |
diff --git a/doc/models/create-booking-response.md b/doc/models/create-booking-response.md
index 844ee374..2d997eba 100644
--- a/doc/models/create-booking-response.md
+++ b/doc/models/create-booking-response.md
@@ -10,7 +10,7 @@
| Name | Type | Tags | Description |
| --- | --- | --- | --- |
| `booking` | [`Booking`](/doc/models/booking.md) | Optional | Represents a booking as a time-bound service contract for a seller's staff member to provide a specified service
at a given location to a requesting customer in one or more appointment segments. |
-| `errors` | [`List of Error`](/doc/models/error.md) | Optional | Any errors that occurred during the request. |
+| `errors` | [`List of Error`](/doc/models/error.md) | Optional | Errors that occurred during the request. |
## Example (as JSON)
diff --git a/doc/models/create-checkout-request.md b/doc/models/create-checkout-request.md
index 561316fa..1f58bd28 100644
--- a/doc/models/create-checkout-request.md
+++ b/doc/models/create-checkout-request.md
@@ -17,7 +17,7 @@ a request to the `CreateCheckout` endpoint.
| `ask_for_shipping_address` | `bool` | Optional | If `true`, Square Checkout collects shipping information on your behalf and stores
that information with the transaction information in the Square Seller Dashboard.
Default: `false`. |
| `merchant_support_email` | `string` | Optional | The email address to display on the Square Checkout confirmation page
and confirmation email that the buyer can use to contact the seller.
If this value is not set, the confirmation page and email display the
primary email address associated with the seller's Square account.
Default: none; only exists if explicitly set.
**Constraints**: *Maximum Length*: `254` |
| `pre_populate_buyer_email` | `string` | Optional | If provided, the buyer's email is prepopulated on the checkout page
as an editable text field.
Default: none; only exists if explicitly set.
**Constraints**: *Maximum Length*: `254` |
-| `pre_populate_shipping_address` | [`Address`](/doc/models/address.md) | Optional | Represents a postal address in a country. The address format is based
on an [open-source library from Google](https://github.com/google/libaddressinput). For more information,
see [AddressValidationMetadata](https://github.com/google/libaddressinput/wiki/AddressValidationMetadata).
This format has dedicated fields for four address components: postal code,
locality (city), administrative district (state, prefecture, or province), and
sublocality (town or village). These components have dedicated fields in the
`Address` object because software sometimes behaves differently based on them.
For example, sales tax software may charge different amounts of sales tax
based on the postal code, and some software is only available in
certain states due to compliance reasons.
For the remaining address components, the `Address` type provides the
`address_line_1` and `address_line_2` fields for free-form data entry.
These fields are free-form because the remaining address components have
too many variations around the world and typical software does not parse
these components. These fields enable users to enter anything they want.
Note that, in the current implementation, all other `Address` type fields are blank.
These include `address_line_3`, `sublocality_2`, `sublocality_3`,
`administrative_district_level_2`, `administrative_district_level_3`,
`first_name`, `last_name`, and `organization`.
When it comes to localization, the seller's language preferences
(see [Language preferences](https://developer.squareup.com/docs/locations-api#location-specific-and-seller-level-language-preferences))
are ignored for addresses. Even though Square products (such as Square Point of Sale
and the Seller Dashboard) mostly use a seller's language preference in
communication, when it comes to addresses, they will use English for a US address,
Japanese for an address in Japan, and so on. |
+| `pre_populate_shipping_address` | [`Address`](/doc/models/address.md) | Optional | Represents a postal address in a country.
For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). |
| `redirect_url` | `string` | Optional | The URL to redirect to after the checkout is completed with `checkoutId`,
`transactionId`, and `referenceId` appended as URL parameters. For example,
if the provided redirect URL is `http://www.example.com/order-complete`, a
successful transaction redirects the customer to:
http://www.example.com/order-complete?checkoutId=xxxxxx&referenceId=xxxxxx&transactionId=xxxxxx
If you do not provide a redirect URL, Square Checkout displays an order
confirmation page on your behalf; however, it is strongly recommended that
you provide a redirect URL so you can verify the transaction results and
finalize the order through your existing/normal confirmation workflow.
Default: none; only exists if explicitly set.
**Constraints**: *Maximum Length*: `800` |
| `additional_recipients` | [`List of Charge Request Additional Recipient`](/doc/models/charge-request-additional-recipient.md) | Optional | The basic primitive of a multi-party transaction. The value is optional.
The transaction facilitated by you can be split from here.
If you provide this value, the `amount_money` value in your `additional_recipients` field
cannot be more than 90% of the `total_money` calculated by Square for your order.
The `location_id` must be a valid seller location where the checkout is occurring.
This field requires `PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS` OAuth permission.
This field is currently not supported in the Square Sandbox. |
| `note` | `string` | Optional | An optional note to associate with the `checkout` object.
This value cannot exceed 60 characters.
**Constraints**: *Maximum Length*: `60` |
diff --git a/doc/models/create-customer-card-request.md b/doc/models/create-customer-card-request.md
index e724f82f..c8f13835 100644
--- a/doc/models/create-customer-card-request.md
+++ b/doc/models/create-customer-card-request.md
@@ -13,7 +13,7 @@ to the `CreateCustomerCard` endpoint.
| Name | Type | Tags | Description |
| --- | --- | --- | --- |
| `card_nonce` | `string` | Required | A card nonce representing the credit card to link to the customer.
Card nonces are generated by the Square payment form when customers enter
their card information. For more information, see
[Walkthrough: Integrate Square Payments in a Website](https://developer.squareup.com/docs/web-payments/take-card-payment).
__NOTE:__ Card nonces generated by digital wallets (such as Apple Pay)
cannot be used to create a customer card. |
-| `billing_address` | [`Address`](/doc/models/address.md) | Optional | Represents a postal address in a country. The address format is based
on an [open-source library from Google](https://github.com/google/libaddressinput). For more information,
see [AddressValidationMetadata](https://github.com/google/libaddressinput/wiki/AddressValidationMetadata).
This format has dedicated fields for four address components: postal code,
locality (city), administrative district (state, prefecture, or province), and
sublocality (town or village). These components have dedicated fields in the
`Address` object because software sometimes behaves differently based on them.
For example, sales tax software may charge different amounts of sales tax
based on the postal code, and some software is only available in
certain states due to compliance reasons.
For the remaining address components, the `Address` type provides the
`address_line_1` and `address_line_2` fields for free-form data entry.
These fields are free-form because the remaining address components have
too many variations around the world and typical software does not parse
these components. These fields enable users to enter anything they want.
Note that, in the current implementation, all other `Address` type fields are blank.
These include `address_line_3`, `sublocality_2`, `sublocality_3`,
`administrative_district_level_2`, `administrative_district_level_3`,
`first_name`, `last_name`, and `organization`.
When it comes to localization, the seller's language preferences
(see [Language preferences](https://developer.squareup.com/docs/locations-api#location-specific-and-seller-level-language-preferences))
are ignored for addresses. Even though Square products (such as Square Point of Sale
and the Seller Dashboard) mostly use a seller's language preference in
communication, when it comes to addresses, they will use English for a US address,
Japanese for an address in Japan, and so on. |
+| `billing_address` | [`Address`](/doc/models/address.md) | Optional | Represents a postal address in a country.
For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). |
| `cardholder_name` | `string` | Optional | The full name printed on the credit card. |
| `verification_token` | `string` | Optional | An identifying token generated by [Payments.verifyBuyer()](https://developer.squareup.com/reference/sdks/web/payments/objects/Payments#Payments.verifyBuyer).
Verification tokens encapsulate customer device information and 3-D Secure
challenge results to indicate that Square has verified the buyer identity. |
diff --git a/doc/models/create-customer-request.md b/doc/models/create-customer-request.md
index b74a1c4b..ab1c710b 100644
--- a/doc/models/create-customer-request.md
+++ b/doc/models/create-customer-request.md
@@ -18,7 +18,7 @@ Defines the body parameters that can be included in a request to the
| `company_name` | `string` | Optional | A business name associated with the customer profile. |
| `nickname` | `string` | Optional | A nickname for the customer profile. |
| `email_address` | `string` | Optional | The email address associated with the customer profile. |
-| `address` | [`Address`](/doc/models/address.md) | Optional | Represents a postal address in a country. The address format is based
on an [open-source library from Google](https://github.com/google/libaddressinput). For more information,
see [AddressValidationMetadata](https://github.com/google/libaddressinput/wiki/AddressValidationMetadata).
This format has dedicated fields for four address components: postal code,
locality (city), administrative district (state, prefecture, or province), and
sublocality (town or village). These components have dedicated fields in the
`Address` object because software sometimes behaves differently based on them.
For example, sales tax software may charge different amounts of sales tax
based on the postal code, and some software is only available in
certain states due to compliance reasons.
For the remaining address components, the `Address` type provides the
`address_line_1` and `address_line_2` fields for free-form data entry.
These fields are free-form because the remaining address components have
too many variations around the world and typical software does not parse
these components. These fields enable users to enter anything they want.
Note that, in the current implementation, all other `Address` type fields are blank.
These include `address_line_3`, `sublocality_2`, `sublocality_3`,
`administrative_district_level_2`, `administrative_district_level_3`,
`first_name`, `last_name`, and `organization`.
When it comes to localization, the seller's language preferences
(see [Language preferences](https://developer.squareup.com/docs/locations-api#location-specific-and-seller-level-language-preferences))
are ignored for addresses. Even though Square products (such as Square Point of Sale
and the Seller Dashboard) mostly use a seller's language preference in
communication, when it comes to addresses, they will use English for a US address,
Japanese for an address in Japan, and so on. |
+| `address` | [`Address`](/doc/models/address.md) | Optional | Represents a postal address in a country.
For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). |
| `phone_number` | `string` | Optional | The 11-digit phone number associated with the customer profile. |
| `reference_id` | `string` | Optional | An optional second ID used to associate the customer profile with an
entity in another system. |
| `note` | `string` | Optional | A custom note associated with the customer profile. |
diff --git a/doc/models/create-payment-request.md b/doc/models/create-payment-request.md
index ed4b959a..eb0593d1 100644
--- a/doc/models/create-payment-request.md
+++ b/doc/models/create-payment-request.md
@@ -27,8 +27,8 @@ Describes a request to create a payment using
| `verification_token` | `string` | Optional | An identifying token generated by [payments.verifyBuyer()](https://developer.squareup.com/reference/sdks/web/payments/objects/Payments#Payments.verifyBuyer).
Verification tokens encapsulate customer device information and 3-D Secure
challenge results to indicate that Square has verified the buyer identity.
For more information, see [SCA Overview](https://developer.squareup.com/docs/sca-overview). |
| `accept_partial_authorization` | `bool` | Optional | If set to `true` and charging a Square Gift Card, a payment might be returned with
`amount_money` equal to less than what was requested. For example, a request for $20 when charging
a Square Gift Card with a balance of $5 results in an APPROVED payment of $5. You might choose
to prompt the buyer for an additional payment to cover the remainder or cancel the Gift Card
payment. This field cannot be `true` when `autocomplete = true`.
For more information, see
[Partial amount with Square Gift Cards](https://developer.squareup.com/docs/payments-api/take-payments#partial-payment-gift-card).
Default: false |
| `buyer_email_address` | `string` | Optional | The buyer's email address.
**Constraints**: *Maximum Length*: `255` |
-| `billing_address` | [`Address`](/doc/models/address.md) | Optional | Represents a postal address in a country. The address format is based
on an [open-source library from Google](https://github.com/google/libaddressinput). For more information,
see [AddressValidationMetadata](https://github.com/google/libaddressinput/wiki/AddressValidationMetadata).
This format has dedicated fields for four address components: postal code,
locality (city), administrative district (state, prefecture, or province), and
sublocality (town or village). These components have dedicated fields in the
`Address` object because software sometimes behaves differently based on them.
For example, sales tax software may charge different amounts of sales tax
based on the postal code, and some software is only available in
certain states due to compliance reasons.
For the remaining address components, the `Address` type provides the
`address_line_1` and `address_line_2` fields for free-form data entry.
These fields are free-form because the remaining address components have
too many variations around the world and typical software does not parse
these components. These fields enable users to enter anything they want.
Note that, in the current implementation, all other `Address` type fields are blank.
These include `address_line_3`, `sublocality_2`, `sublocality_3`,
`administrative_district_level_2`, `administrative_district_level_3`,
`first_name`, `last_name`, and `organization`.
When it comes to localization, the seller's language preferences
(see [Language preferences](https://developer.squareup.com/docs/locations-api#location-specific-and-seller-level-language-preferences))
are ignored for addresses. Even though Square products (such as Square Point of Sale
and the Seller Dashboard) mostly use a seller's language preference in
communication, when it comes to addresses, they will use English for a US address,
Japanese for an address in Japan, and so on. |
-| `shipping_address` | [`Address`](/doc/models/address.md) | Optional | Represents a postal address in a country. The address format is based
on an [open-source library from Google](https://github.com/google/libaddressinput). For more information,
see [AddressValidationMetadata](https://github.com/google/libaddressinput/wiki/AddressValidationMetadata).
This format has dedicated fields for four address components: postal code,
locality (city), administrative district (state, prefecture, or province), and
sublocality (town or village). These components have dedicated fields in the
`Address` object because software sometimes behaves differently based on them.
For example, sales tax software may charge different amounts of sales tax
based on the postal code, and some software is only available in
certain states due to compliance reasons.
For the remaining address components, the `Address` type provides the
`address_line_1` and `address_line_2` fields for free-form data entry.
These fields are free-form because the remaining address components have
too many variations around the world and typical software does not parse
these components. These fields enable users to enter anything they want.
Note that, in the current implementation, all other `Address` type fields are blank.
These include `address_line_3`, `sublocality_2`, `sublocality_3`,
`administrative_district_level_2`, `administrative_district_level_3`,
`first_name`, `last_name`, and `organization`.
When it comes to localization, the seller's language preferences
(see [Language preferences](https://developer.squareup.com/docs/locations-api#location-specific-and-seller-level-language-preferences))
are ignored for addresses. Even though Square products (such as Square Point of Sale
and the Seller Dashboard) mostly use a seller's language preference in
communication, when it comes to addresses, they will use English for a US address,
Japanese for an address in Japan, and so on. |
+| `billing_address` | [`Address`](/doc/models/address.md) | Optional | Represents a postal address in a country.
For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). |
+| `shipping_address` | [`Address`](/doc/models/address.md) | Optional | Represents a postal address in a country.
For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). |
| `note` | `string` | Optional | An optional note to be entered by the developer when creating a payment.
**Constraints**: *Maximum Length*: `500` |
| `statement_description_identifier` | `string` | Optional | Optional additional payment information to include on the customer's card statement
as part of the statement description. This can be, for example, an invoice number, ticket number,
or short description that uniquely identifies the purchase.
Note that the `statement_description_identifier` might get truncated on the statement description
to fit the required information including the Square identifier (SQ *) and name of the
seller taking the payment.
**Constraints**: *Maximum Length*: `20` |
| `cash_details` | [`Cash Payment Details`](/doc/models/cash-payment-details.md) | Optional | Stores details about a cash payment. Contains only non-confidential information. For more information, see
[Take Cash Payments](https://developer.squareup.com/docs/payments-api/take-payments/cash-payments). |
diff --git a/doc/models/customer.md b/doc/models/customer.md
index 7756e029..3d5abd47 100644
--- a/doc/models/customer.md
+++ b/doc/models/customer.md
@@ -20,7 +20,7 @@ Represents a Square customer profile in the Customer Directory of a Square selle
| `nickname` | `string` | Optional | A nickname for the customer profile. |
| `company_name` | `string` | Optional | A business name associated with the customer profile. |
| `email_address` | `string` | Optional | The email address associated with the customer profile. |
-| `address` | [`Address`](/doc/models/address.md) | Optional | Represents a postal address in a country. The address format is based
on an [open-source library from Google](https://github.com/google/libaddressinput). For more information,
see [AddressValidationMetadata](https://github.com/google/libaddressinput/wiki/AddressValidationMetadata).
This format has dedicated fields for four address components: postal code,
locality (city), administrative district (state, prefecture, or province), and
sublocality (town or village). These components have dedicated fields in the
`Address` object because software sometimes behaves differently based on them.
For example, sales tax software may charge different amounts of sales tax
based on the postal code, and some software is only available in
certain states due to compliance reasons.
For the remaining address components, the `Address` type provides the
`address_line_1` and `address_line_2` fields for free-form data entry.
These fields are free-form because the remaining address components have
too many variations around the world and typical software does not parse
these components. These fields enable users to enter anything they want.
Note that, in the current implementation, all other `Address` type fields are blank.
These include `address_line_3`, `sublocality_2`, `sublocality_3`,
`administrative_district_level_2`, `administrative_district_level_3`,
`first_name`, `last_name`, and `organization`.
When it comes to localization, the seller's language preferences
(see [Language preferences](https://developer.squareup.com/docs/locations-api#location-specific-and-seller-level-language-preferences))
are ignored for addresses. Even though Square products (such as Square Point of Sale
and the Seller Dashboard) mostly use a seller's language preference in
communication, when it comes to addresses, they will use English for a US address,
Japanese for an address in Japan, and so on. |
+| `address` | [`Address`](/doc/models/address.md) | Optional | Represents a postal address in a country.
For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). |
| `phone_number` | `string` | Optional | The 11-digit phone number associated with the customer profile. |
| `birthday` | `string` | Optional | The birthday associated with the customer profile, in RFC 3339 format. The year is optional. The timezone and time are not allowed.
For example, `0000-09-21T00:00:00-00:00` represents a birthday on September 21 and `1998-09-21T00:00:00-00:00` represents a birthday on September 21, 1998. |
| `reference_id` | `string` | Optional | An optional second ID used to associate the customer profile with an
entity in another system. |
diff --git a/doc/models/get-bank-account-by-v1-id-response.md b/doc/models/get-bank-account-by-v1-id-response.md
index 873abd97..97ce902c 100644
--- a/doc/models/get-bank-account-by-v1-id-response.md
+++ b/doc/models/get-bank-account-by-v1-id-response.md
@@ -12,7 +12,7 @@ Response object returned by GetBankAccountByV1Id.
| Name | Type | Tags | Description |
| --- | --- | --- | --- |
| `errors` | [`List of Error`](/doc/models/error.md) | Optional | Information on errors encountered during the request. |
-| `bank_account` | [`Bank Account`](/doc/models/bank-account.md) | Optional | Represents a bank account. For more information about
linking a bank account to a Square account, see
[Bank Accounts API](https://developer.squareup.com/docs/bank-accounts-api). |
+| `bank_account` | [`Bank Account`](/doc/models/bank-account.md) | Optional | - |
## Example (as JSON)
diff --git a/doc/models/get-bank-account-response.md b/doc/models/get-bank-account-response.md
index 331f683d..dc0bbff2 100644
--- a/doc/models/get-bank-account-response.md
+++ b/doc/models/get-bank-account-response.md
@@ -12,7 +12,7 @@ Response object returned by `GetBankAccount`.
| Name | Type | Tags | Description |
| --- | --- | --- | --- |
| `errors` | [`List of Error`](/doc/models/error.md) | Optional | Information on errors encountered during the request. |
-| `bank_account` | [`Bank Account`](/doc/models/bank-account.md) | Optional | Represents a bank account. For more information about
linking a bank account to a Square account, see
[Bank Accounts API](https://developer.squareup.com/docs/bank-accounts-api). |
+| `bank_account` | [`Bank Account`](/doc/models/bank-account.md) | Optional | - |
## Example (as JSON)
diff --git a/doc/models/invoice-recipient.md b/doc/models/invoice-recipient.md
index e4ac019e..713a7b97 100644
--- a/doc/models/invoice-recipient.md
+++ b/doc/models/invoice-recipient.md
@@ -20,7 +20,7 @@ Square updates the customer ID in response to a merge operation, but does not up
| `given_name` | `string` | Optional | The recipient's given (that is, first) name. |
| `family_name` | `string` | Optional | The recipient's family (that is, last) name. |
| `email_address` | `string` | Optional | The recipient's email address. |
-| `address` | [`Address`](/doc/models/address.md) | Optional | Represents a postal address in a country. The address format is based
on an [open-source library from Google](https://github.com/google/libaddressinput). For more information,
see [AddressValidationMetadata](https://github.com/google/libaddressinput/wiki/AddressValidationMetadata).
This format has dedicated fields for four address components: postal code,
locality (city), administrative district (state, prefecture, or province), and
sublocality (town or village). These components have dedicated fields in the
`Address` object because software sometimes behaves differently based on them.
For example, sales tax software may charge different amounts of sales tax
based on the postal code, and some software is only available in
certain states due to compliance reasons.
For the remaining address components, the `Address` type provides the
`address_line_1` and `address_line_2` fields for free-form data entry.
These fields are free-form because the remaining address components have
too many variations around the world and typical software does not parse
these components. These fields enable users to enter anything they want.
Note that, in the current implementation, all other `Address` type fields are blank.
These include `address_line_3`, `sublocality_2`, `sublocality_3`,
`administrative_district_level_2`, `administrative_district_level_3`,
`first_name`, `last_name`, and `organization`.
When it comes to localization, the seller's language preferences
(see [Language preferences](https://developer.squareup.com/docs/locations-api#location-specific-and-seller-level-language-preferences))
are ignored for addresses. Even though Square products (such as Square Point of Sale
and the Seller Dashboard) mostly use a seller's language preference in
communication, when it comes to addresses, they will use English for a US address,
Japanese for an address in Japan, and so on. |
+| `address` | [`Address`](/doc/models/address.md) | Optional | Represents a postal address in a country.
For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). |
| `phone_number` | `string` | Optional | The recipient's phone number. |
| `company_name` | `string` | Optional | The name of the recipient's company. |
| `tax_ids` | [`Invoice Recipient Tax Ids`](/doc/models/invoice-recipient-tax-ids.md) | Optional | Represents the tax IDs for an invoice recipient. The country of the seller account determines
whether the corresponding `tax_ids` field is available for the customer. For more information,
see [Invoice recipient tax IDs](https://developer.squareup.com/docs/invoices-api/overview#recipient-tax-ids). |
diff --git a/doc/models/list-bookings-response.md b/doc/models/list-bookings-response.md
index 47aaaf7d..5d438a6a 100644
--- a/doc/models/list-bookings-response.md
+++ b/doc/models/list-bookings-response.md
@@ -10,8 +10,8 @@
| Name | Type | Tags | Description |
| --- | --- | --- | --- |
| `bookings` | [`List of Booking`](/doc/models/booking.md) | Optional | The list of targeted bookings. |
-| `cursor` | `string` | Optional | The pagination cursor to be used in the following request to get the next page of the results. Stop retrieving the next page of the results when the cursor is not set. |
-| `errors` | [`List of Error`](/doc/models/error.md) | Optional | Any errors that occurred during the request. |
+| `cursor` | `string` | Optional | The pagination cursor to be used in the subsequent request to get the next page of the results. Stop retrieving the next page of the results when the cursor is not set. |
+| `errors` | [`List of Error`](/doc/models/error.md) | Optional | Errors that occurred during the request. |
## Example (as JSON)
diff --git a/doc/models/list-loyalty-programs-response.md b/doc/models/list-loyalty-programs-response.md
index 855762bb..769b960f 100644
--- a/doc/models/list-loyalty-programs-response.md
+++ b/doc/models/list-loyalty-programs-response.md
@@ -23,18 +23,21 @@ A response that contains all loyalty programs.
"accrual_rules": [
{
"accrual_type": "SPEND",
- "excluded_category_ids": [
- "7ZERJKO5PVYXCVUHV2JCZ2UG",
- "FQKAOJE5C4FIMF5A2URMLW6V"
- ],
- "excluded_item_variation_ids": [
- "CBZXBUVVTYUBZGQO44RHMR6B",
- "EDILT24Z2NISEXDKGY6HP7XV"
- ],
"points": 1,
- "spend_amount_money": {
- "amount": 100,
- "currency": "USD"
+ "spend_data": {
+ "amount_money": {
+ "amount": 100,
+ "currency": "USD"
+ },
+ "excluded_category_ids": [
+ "7ZERJKO5PVYXCVUHV2JCZ2UG",
+ "FQKAOJE5C4FIMF5A2URMLW6V"
+ ],
+ "excluded_item_variation_ids": [
+ "CBZXBUVVTYUBZGQO44RHMR6B",
+ "EDILT24Z2NISEXDKGY6HP7XV"
+ ],
+ "tax_mode": "BEFORE_TAX"
}
}
],
diff --git a/doc/models/list-merchants-response.md b/doc/models/list-merchants-response.md
index 118a0b93..6fd2f4c9 100644
--- a/doc/models/list-merchants-response.md
+++ b/doc/models/list-merchants-response.md
@@ -23,6 +23,7 @@ The response object returned by the [ListMerchant](/doc/api/merchants.md#list-me
{
"business_name": "Apple A Day",
"country": "US",
+ "created_at": "2021-12-10T19:25:52.484Z",
"currency": "USD",
"id": "DM7VKY8Q63GNP",
"language_code": "en-US",
diff --git a/doc/models/list-payment-refunds-request.md b/doc/models/list-payment-refunds-request.md
index 678a627d..20aedc60 100644
--- a/doc/models/list-payment-refunds-request.md
+++ b/doc/models/list-payment-refunds-request.md
@@ -20,7 +20,7 @@ The maximum results per page is 100.
| `cursor` | `string` | Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this cursor to retrieve the next set of results for the original query.
For more information, see [Pagination](https://developer.squareup.com/docs/basics/api101/pagination). |
| `location_id` | `string` | Optional | Limit results to the location supplied. By default, results are returned
for all locations associated with the seller. |
| `status` | `string` | Optional | If provided, only refunds with the given status are returned.
For a list of refund status values, see [PaymentRefund](/doc/models/payment-refund.md).
Default: If omitted, refunds are returned regardless of their status. |
-| `source_type` | `string` | Optional | If provided, only refunds with the given source type are returned.
- `CARD` - List refunds only for payments where `CARD` was specified as the payment
source.
Default: If omitted, refunds are returned regardless of the source type. |
+| `source_type` | `string` | Optional | If provided, only returns refunds whose payments have the indicated source type.
Current values include `CARD`, `BANK_ACCOUNT`, `WALLET`, `CASH`, and `EXTERNAL`.
For information about these payment source types, see
[Take Payments](https://developer.squareup.com/docs/payments-api/take-payments).
Default: If omitted, refunds are returned regardless of the source type. |
| `limit` | `int` | Optional | The maximum number of results to be returned in a single page.
It is possible to receive fewer results than the specified limit on a given page.
If the supplied value is greater than 100, no more than 100 results are returned.
Default: 100 |
## Example (as JSON)
diff --git a/doc/models/list-team-member-booking-profiles-request.md b/doc/models/list-team-member-booking-profiles-request.md
index 025f8ad6..1c72064b 100644
--- a/doc/models/list-team-member-booking-profiles-request.md
+++ b/doc/models/list-team-member-booking-profiles-request.md
@@ -10,8 +10,8 @@
| Name | Type | Tags | Description |
| --- | --- | --- | --- |
| `bookable_only` | `bool` | Optional | Indicates whether to include only bookable team members in the returned result (`true`) or not (`false`). |
-| `limit` | `int` | Optional | The maximum number of results to return.
**Constraints**: `>= 1`, `<= 100` |
-| `cursor` | `string` | Optional | The cursor for paginating through the results. |
+| `limit` | `int` | Optional | The maximum number of results to return in a paged response.
**Constraints**: `>= 1`, `<= 100` |
+| `cursor` | `string` | Optional | The pagination cursor from the preceding response to return the next page of the results. Do not set this when retrieving the first page of the results. |
| `location_id` | `string` | Optional | Indicates whether to include only team members enabled at the given location in the returned result. |
## Example (as JSON)
diff --git a/doc/models/list-team-member-booking-profiles-response.md b/doc/models/list-team-member-booking-profiles-response.md
index a2530f97..625e58c2 100644
--- a/doc/models/list-team-member-booking-profiles-response.md
+++ b/doc/models/list-team-member-booking-profiles-response.md
@@ -10,8 +10,8 @@
| Name | Type | Tags | Description |
| --- | --- | --- | --- |
| `team_member_booking_profiles` | [`List of Team Member Booking Profile`](/doc/models/team-member-booking-profile.md) | Optional | The list of team member booking profiles. |
-| `cursor` | `string` | Optional | The cursor for paginating through the results. |
-| `errors` | [`List of Error`](/doc/models/error.md) | Optional | Any errors that occurred during the request. |
+| `cursor` | `string` | Optional | The pagination cursor to be used in the subsequent request to get the next page of the results. Stop retrieving the next page of the results when the cursor is not set. |
+| `errors` | [`List of Error`](/doc/models/error.md) | Optional | Errors that occurred during the request. |
## Example (as JSON)
diff --git a/doc/models/location.md b/doc/models/location.md
index a653f441..a15d4a11 100644
--- a/doc/models/location.md
+++ b/doc/models/location.md
@@ -11,33 +11,33 @@ Represents one of a business's [locations](https://developer.squareup.com/docs/l
| Name | Type | Tags | Description |
| --- | --- | --- | --- |
-| `id` | `string` | Optional | A short, generated string of letters and numbers that uniquely identifies this location instance. |
-| `name` | `string` | Optional | The name of the location.
This information appears in the dashboard as the nickname.
A location name must be unique within a seller account. |
-| `address` | [`Address`](/doc/models/address.md) | Optional | Represents a postal address in a country. The address format is based
on an [open-source library from Google](https://github.com/google/libaddressinput). For more information,
see [AddressValidationMetadata](https://github.com/google/libaddressinput/wiki/AddressValidationMetadata).
This format has dedicated fields for four address components: postal code,
locality (city), administrative district (state, prefecture, or province), and
sublocality (town or village). These components have dedicated fields in the
`Address` object because software sometimes behaves differently based on them.
For example, sales tax software may charge different amounts of sales tax
based on the postal code, and some software is only available in
certain states due to compliance reasons.
For the remaining address components, the `Address` type provides the
`address_line_1` and `address_line_2` fields for free-form data entry.
These fields are free-form because the remaining address components have
too many variations around the world and typical software does not parse
these components. These fields enable users to enter anything they want.
Note that, in the current implementation, all other `Address` type fields are blank.
These include `address_line_3`, `sublocality_2`, `sublocality_3`,
`administrative_district_level_2`, `administrative_district_level_3`,
`first_name`, `last_name`, and `organization`.
When it comes to localization, the seller's language preferences
(see [Language preferences](https://developer.squareup.com/docs/locations-api#location-specific-and-seller-level-language-preferences))
are ignored for addresses. Even though Square products (such as Square Point of Sale
and the Seller Dashboard) mostly use a seller's language preference in
communication, when it comes to addresses, they will use English for a US address,
Japanese for an address in Japan, and so on. |
-| `timezone` | `string` | Optional | The [IANA Timezone](https://www.iana.org/time-zones) identifier for
the timezone of the location. For example, `"America/Los_Angeles"`. |
+| `id` | `string` | Optional | A short, generated string of letters and numbers that uniquely identifies this location instance.
**Constraints**: *Maximum Length*: `32` |
+| `name` | `string` | Optional | The name of the location.
This information appears in the dashboard as the nickname.
A location name must be unique within a seller account.
**Constraints**: *Maximum Length*: `255` |
+| `address` | [`Address`](/doc/models/address.md) | Optional | Represents a postal address in a country.
For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). |
+| `timezone` | `string` | Optional | The [IANA Timezone](https://www.iana.org/time-zones) identifier for
the timezone of the location. For example, `America/Los_Angeles`.
**Constraints**: *Maximum Length*: `30` |
| `capabilities` | [`List of str (Location Capability)`](/doc/models/location-capability.md) | Optional | The Square features that are enabled for the location.
See [LocationCapability](/doc/models/location-capability.md) for possible values.
See [LocationCapability](#type-locationcapability) for possible values |
| `status` | [`str (Location Status)`](/doc/models/location-status.md) | Optional | A location's status. |
-| `created_at` | `string` | Optional | The time when the location was created, in RFC 3339 format.
For more information, see [Working with Dates](https://developer.squareup.com/docs/build-basics/working-with-dates). |
-| `merchant_id` | `string` | Optional | The ID of the merchant that owns the location. |
+| `created_at` | `string` | Optional | The time when the location was created, in RFC 3339 format.
For more information, see [Working with Dates](https://developer.squareup.com/docs/build-basics/working-with-dates).
**Constraints**: *Minimum Length*: `20`, *Maximum Length*: `25` |
+| `merchant_id` | `string` | Optional | The ID of the merchant that owns the location.
**Constraints**: *Maximum Length*: `32` |
| `country` | [`str (Country)`](/doc/models/country.md) | Optional | Indicates the country associated with another entity, such as a business.
Values are in [ISO 3166-1-alpha-2 format](http://www.iso.org/iso/home/standards/country_codes.htm). |
-| `language_code` | `string` | Optional | The language associated with the location, in
[BCP 47 format](https://tools.ietf.org/html/bcp47#appendix-A).
For more information, see [Location language code](https://developer.squareup.com/docs/locations-api#location-language-code). |
+| `language_code` | `string` | Optional | The language associated with the location, in
[BCP 47 format](https://tools.ietf.org/html/bcp47#appendix-A).
For more information, see [Location language code](https://developer.squareup.com/docs/locations-api#location-language-code).
**Constraints**: *Minimum Length*: `5`, *Maximum Length*: `5` |
| `currency` | [`str (Currency)`](/doc/models/currency.md) | Optional | Indicates the associated currency for an amount of money. Values correspond
to [ISO 4217](https://wikipedia.org/wiki/ISO_4217). |
-| `phone_number` | `string` | Optional | The phone number of the location in human readable format. For example, `+353 80 0 098 8099`. |
-| `business_name` | `string` | Optional | The business name of the location, visible to the location's customers. |
+| `phone_number` | `string` | Optional | The phone number of the location. For example, `+1 855-700-6000`.
**Constraints**: *Maximum Length*: `17` |
+| `business_name` | `string` | Optional | The business name of the location.
**Constraints**: *Maximum Length*: `255` |
| `type` | [`str (Location Type)`](/doc/models/location-type.md) | Optional | A location's type. |
-| `website_url` | `string` | Optional | The website URL of the location. For example, `https://squareup.com`. |
+| `website_url` | `string` | Optional | The website URL of the location. For example, `https://squareup.com`.
**Constraints**: *Maximum Length*: `255` |
| `business_hours` | [`Business Hours`](/doc/models/business-hours.md) | Optional | The hours of operation for a location. |
-| `business_email` | `string` | Optional | The email address of the location, visible to the location's customers.
This can be unique to the location, and is not always the email address for the business owner or admin. |
-| `description` | `string` | Optional | The description of the location. For example, `Main Street location`. |
-| `twitter_username` | `string` | Optional | The Twitter username of the location without the '@' symbol. For example, `Square`. |
-| `instagram_username` | `string` | Optional | The Instagram username of the location without the '@' symbol. For example, `square`. |
-| `facebook_url` | `string` | Optional | The Facebook profile URL of the location. The URL should begin with 'facebook.com/'. For example, `https://www.facebook.com/square`. |
+| `business_email` | `string` | Optional | The email address of the location. This can be unique to the location, and is not always the email address for the business owner or admin.
**Constraints**: *Maximum Length*: `255` |
+| `description` | `string` | Optional | The description of the location. For example, `Main Street location`.
**Constraints**: *Maximum Length*: `1024` |
+| `twitter_username` | `string` | Optional | The Twitter username of the location without the '@' symbol. For example, `Square`.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `15` |
+| `instagram_username` | `string` | Optional | The Instagram username of the location without the '@' symbol. For example, `square`.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `30` |
+| `facebook_url` | `string` | Optional | The Facebook profile URL of the location. The URL should begin with 'facebook.com/'. For example, `https://www.facebook.com/square`.
**Constraints**: *Maximum Length*: `255` |
| `coordinates` | [`Coordinates`](/doc/models/coordinates.md) | Optional | Latitude and longitude coordinates. |
-| `logo_url` | `string` | Optional | The URL of the logo image for the location. When configured in the Seller
dashboard (Receipts section), the logo appears on transactions (such as receipts and invoices)
that Square generates on behalf of the Seller. This image should have a roughly square (1:1) aspect ratio
and is recommended to be at least 200x200 pixels. |
-| `pos_background_url` | `string` | Optional | The URL of the Point of Sale background image for the location. |
-| `mcc` | `string` | Optional | A four-digit number that describes the kind of goods or services sold at the location.
The merchant category code (MCC) of the location is standardized by ISO 18245.
For example, `5045`. |
+| `logo_url` | `string` | Optional | The URL of the logo image for the location. When configured in the Seller
dashboard (Receipts section), the logo appears on transactions (such as receipts and invoices)
that Square generates on behalf of the Seller. This image should have a roughly square (1:1) aspect ratio
and is recommended to be at least 200x200 pixels.
**Constraints**: *Maximum Length*: `255` |
+| `pos_background_url` | `string` | Optional | The URL of the Point of Sale background image for the location.
**Constraints**: *Maximum Length*: `255` |
+| `mcc` | `string` | Optional | A four-digit number that describes the kind of goods or services sold at the location.
The [merchant category code (MCC)](https://developer.squareup.com/docs/locations-api#initialize-a-merchant-category-code) of the location as standardized by ISO 18245.
For example, `5045`, for a location that sells computer goods and software.
**Constraints**: *Minimum Length*: `4`, *Maximum Length*: `4` |
| `full_format_logo_url` | `string` | Optional | The URL of a full-format logo image for the location. When configured in the Seller
dashboard (Receipts section), the logo appears on transactions (such as receipts and invoices)
that Square generates on behalf of the Seller. This image can be wider than it is tall,
and is recommended to be at least 1280x648 pixels. |
-| `tax_ids` | [`Tax Ids`](/doc/models/tax-ids.md) | Optional | The tax IDs that a Location is operating under. |
+| `tax_ids` | [`Tax Ids`](/doc/models/tax-ids.md) | Optional | Identifiers for the location used by various governments for tax purposes. |
## Example (as JSON)
diff --git a/doc/models/loyalty-program-accrual-rule-category-data.md b/doc/models/loyalty-program-accrual-rule-category-data.md
new file mode 100644
index 00000000..9f5649f1
--- /dev/null
+++ b/doc/models/loyalty-program-accrual-rule-category-data.md
@@ -0,0 +1,23 @@
+
+# Loyalty Program Accrual Rule Category Data
+
+Represents additional data for rules with the `CATEGORY` accrual type.
+
+## Structure
+
+`Loyalty Program Accrual Rule Category Data`
+
+## Fields
+
+| Name | Type | Tags | Description |
+| --- | --- | --- | --- |
+| `category_id` | `string` | Required | The ID of the `CATEGORY` [catalog object](/doc/models/catalog-object.md) that buyers can purchase to earn
points.
**Constraints**: *Minimum Length*: `1` |
+
+## Example (as JSON)
+
+```json
+{
+ "category_id": "category_id8"
+}
+```
+
diff --git a/doc/models/loyalty-program-accrual-rule-item-variation-data.md b/doc/models/loyalty-program-accrual-rule-item-variation-data.md
new file mode 100644
index 00000000..e6711256
--- /dev/null
+++ b/doc/models/loyalty-program-accrual-rule-item-variation-data.md
@@ -0,0 +1,23 @@
+
+# Loyalty Program Accrual Rule Item Variation Data
+
+Represents additional data for rules with the `ITEM_VARIATION` accrual type.
+
+## Structure
+
+`Loyalty Program Accrual Rule Item Variation Data`
+
+## Fields
+
+| Name | Type | Tags | Description |
+| --- | --- | --- | --- |
+| `item_variation_id` | `string` | Required | The ID of the `ITEM_VARIATION` [catalog object](/doc/models/catalog-object.md) that buyers can purchase to earn
points.
**Constraints**: *Minimum Length*: `1` |
+
+## Example (as JSON)
+
+```json
+{
+ "item_variation_id": "item_variation_id4"
+}
+```
+
diff --git a/doc/models/loyalty-program-accrual-rule-spend-data.md b/doc/models/loyalty-program-accrual-rule-spend-data.md
new file mode 100644
index 00000000..f0d5db07
--- /dev/null
+++ b/doc/models/loyalty-program-accrual-rule-spend-data.md
@@ -0,0 +1,39 @@
+
+# Loyalty Program Accrual Rule Spend Data
+
+Represents additional data for rules with the `SPEND` accrual type.
+
+## Structure
+
+`Loyalty Program Accrual Rule Spend Data`
+
+## Fields
+
+| Name | Type | Tags | Description |
+| --- | --- | --- | --- |
+| `amount_money` | [`Money`](/doc/models/money.md) | Required | Represents an amount of money. `Money` fields can be signed or unsigned.
Fields that do not explicitly define whether they are signed or unsigned are
considered unsigned and can only hold positive amounts. For signed fields, the
sign of the value indicates the purpose of the money transfer. See
[Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts)
for more information. |
+| `excluded_category_ids` | `List of string` | Optional | The IDs of any `CATEGORY` catalog objects that are excluded from points accrual.
You can use the [BatchRetrieveCatalogObjects](/doc/api/catalog.md#batch-retrieve-catalog-objects)
endpoint to retrieve information about the excluded categories. |
+| `excluded_item_variation_ids` | `List of string` | Optional | The IDs of any `ITEM_VARIATION` catalog objects that are excluded from points accrual.
You can use the [BatchRetrieveCatalogObjects](/doc/api/catalog.md#batch-retrieve-catalog-objects)
endpoint to retrieve information about the excluded item variations. |
+| `tax_mode` | [`str (Loyalty Program Accrual Rule Tax Mode)`](/doc/models/loyalty-program-accrual-rule-tax-mode.md) | Required | Indicates how taxes should be treated when calculating the purchase amount used for loyalty points accrual.
This setting applies only to `SPEND` accrual rules or `VISIT` accrual rules that have a minimum spend requirement. |
+
+## Example (as JSON)
+
+```json
+{
+ "amount_money": {
+ "amount": 186,
+ "currency": "NGN"
+ },
+ "excluded_category_ids": [
+ "excluded_category_ids8",
+ "excluded_category_ids9"
+ ],
+ "excluded_item_variation_ids": [
+ "excluded_item_variation_ids1",
+ "excluded_item_variation_ids2",
+ "excluded_item_variation_ids3"
+ ],
+ "tax_mode": "BEFORE_TAX"
+}
+```
+
diff --git a/doc/models/loyalty-program-accrual-rule-tax-mode.md b/doc/models/loyalty-program-accrual-rule-tax-mode.md
new file mode 100644
index 00000000..1064c762
--- /dev/null
+++ b/doc/models/loyalty-program-accrual-rule-tax-mode.md
@@ -0,0 +1,17 @@
+
+# Loyalty Program Accrual Rule Tax Mode
+
+Indicates how taxes should be treated when calculating the purchase amount used for loyalty points accrual.
+This setting applies only to `SPEND` accrual rules or `VISIT` accrual rules that have a minimum spend requirement.
+
+## Enumeration
+
+`Loyalty Program Accrual Rule Tax Mode`
+
+## Fields
+
+| Name | Description |
+| --- | --- |
+| `BEFORE_TAX` | Exclude taxes from the purchase amount used for loyalty points accrual. |
+| `AFTER_TAX` | Include taxes in the purchase amount used for loyalty points accrual. |
+
diff --git a/doc/models/loyalty-program-accrual-rule-visit-data.md b/doc/models/loyalty-program-accrual-rule-visit-data.md
new file mode 100644
index 00000000..47b04f56
--- /dev/null
+++ b/doc/models/loyalty-program-accrual-rule-visit-data.md
@@ -0,0 +1,28 @@
+
+# Loyalty Program Accrual Rule Visit Data
+
+Represents additional data for rules with the `VISIT` accrual type.
+
+## Structure
+
+`Loyalty Program Accrual Rule Visit Data`
+
+## Fields
+
+| Name | Type | Tags | Description |
+| --- | --- | --- | --- |
+| `minimum_amount_money` | [`Money`](/doc/models/money.md) | Optional | Represents an amount of money. `Money` fields can be signed or unsigned.
Fields that do not explicitly define whether they are signed or unsigned are
considered unsigned and can only hold positive amounts. For signed fields, the
sign of the value indicates the purpose of the money transfer. See
[Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts)
for more information. |
+| `tax_mode` | [`str (Loyalty Program Accrual Rule Tax Mode)`](/doc/models/loyalty-program-accrual-rule-tax-mode.md) | Required | Indicates how taxes should be treated when calculating the purchase amount used for loyalty points accrual.
This setting applies only to `SPEND` accrual rules or `VISIT` accrual rules that have a minimum spend requirement. |
+
+## Example (as JSON)
+
+```json
+{
+ "minimum_amount_money": {
+ "amount": 146,
+ "currency": "UYI"
+ },
+ "tax_mode": "BEFORE_TAX"
+}
+```
+
diff --git a/doc/models/loyalty-program-accrual-rule.md b/doc/models/loyalty-program-accrual-rule.md
index ea0d177c..81d21587 100644
--- a/doc/models/loyalty-program-accrual-rule.md
+++ b/doc/models/loyalty-program-accrual-rule.md
@@ -13,11 +13,10 @@ Defines an accrual rule, which is how buyers can earn points.
| --- | --- | --- | --- |
| `accrual_type` | [`str (Loyalty Program Accrual Rule Type)`](/doc/models/loyalty-program-accrual-rule-type.md) | Required | The type of the accrual rule that defines how buyers can earn points. |
| `points` | `int` | Optional | The number of points that
buyers earn based on the `accrual_type`.
**Constraints**: `>= 1` |
-| `visit_minimum_amount_money` | [`Money`](/doc/models/money.md) | Optional | Represents an amount of money. `Money` fields can be signed or unsigned.
Fields that do not explicitly define whether they are signed or unsigned are
considered unsigned and can only hold positive amounts. For signed fields, the
sign of the value indicates the purpose of the money transfer. See
[Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts)
for more information. |
-| `spend_amount_money` | [`Money`](/doc/models/money.md) | Optional | Represents an amount of money. `Money` fields can be signed or unsigned.
Fields that do not explicitly define whether they are signed or unsigned are
considered unsigned and can only hold positive amounts. For signed fields, the
sign of the value indicates the purpose of the money transfer. See
[Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts)
for more information. |
-| `catalog_object_id` | `string` | Optional | When the accrual rule is item-based or category-based, this field specifies the ID
of the [catalog object](/doc/models/catalog-object.md) that buyers can purchase to earn points.
If `accrual_type` is `ITEM_VARIATION`, the object is an item variation.
If `accrual_type` is `CATEGORY`, the object is a category. |
-| `excluded_category_ids` | `List of string` | Optional | When the accrual rule is spend-based (`accrual_type` is `SPEND`), this field
lists the IDs of any `CATEGORY` catalog objects that are excluded from points accrual.
You can use the [BatchRetrieveCatalogObjects](/doc/api/catalog.md#batch-retrieve-catalog-objects)
endpoint to retrieve information about the excluded categories. |
-| `excluded_item_variation_ids` | `List of string` | Optional | When the accrual rule is spend-based (`accrual_type` is `SPEND`), this field
lists the IDs of any `ITEM_VARIATION` catalog objects that are excluded from points accrual.
You can use the [BatchRetrieveCatalogObjects](/doc/api/catalog.md#batch-retrieve-catalog-objects)
endpoint to retrieve information about the excluded item variations. |
+| `visit_data` | [`Loyalty Program Accrual Rule Visit Data`](/doc/models/loyalty-program-accrual-rule-visit-data.md) | Optional | Represents additional data for rules with the `VISIT` accrual type. |
+| `spend_data` | [`Loyalty Program Accrual Rule Spend Data`](/doc/models/loyalty-program-accrual-rule-spend-data.md) | Optional | Represents additional data for rules with the `SPEND` accrual type. |
+| `item_variation_data` | [`Loyalty Program Accrual Rule Item Variation Data`](/doc/models/loyalty-program-accrual-rule-item-variation-data.md) | Optional | Represents additional data for rules with the `ITEM_VARIATION` accrual type. |
+| `category_data` | [`Loyalty Program Accrual Rule Category Data`](/doc/models/loyalty-program-accrual-rule-category-data.md) | Optional | Represents additional data for rules with the `CATEGORY` accrual type. |
## Example (as JSON)
@@ -25,19 +24,33 @@ Defines an accrual rule, which is how buyers can earn points.
{
"accrual_type": "ITEM_VARIATION",
"points": 236,
- "visit_minimum_amount_money": {
- "amount": 118,
- "currency": "BTN"
+ "visit_data": {
+ "minimum_amount_money": {
+ "amount": 24,
+ "currency": "GEL"
+ },
+ "tax_mode": "BEFORE_TAX"
},
- "spend_amount_money": {
- "amount": 218,
- "currency": "GNF"
+ "spend_data": {
+ "amount_money": {
+ "amount": 248,
+ "currency": "MXV"
+ },
+ "excluded_category_ids": [
+ "excluded_category_ids4"
+ ],
+ "excluded_item_variation_ids": [
+ "excluded_item_variation_ids3",
+ "excluded_item_variation_ids4"
+ ],
+ "tax_mode": "BEFORE_TAX"
},
- "catalog_object_id": "catalog_object_id6",
- "excluded_category_ids": [
- "excluded_category_ids8",
- "excluded_category_ids9"
- ]
+ "item_variation_data": {
+ "item_variation_id": "item_variation_id0"
+ },
+ "category_data": {
+ "category_id": "category_id4"
+ }
}
```
diff --git a/doc/models/loyalty-program.md b/doc/models/loyalty-program.md
index 6195fa66..55e7a107 100644
--- a/doc/models/loyalty-program.md
+++ b/doc/models/loyalty-program.md
@@ -101,37 +101,67 @@ For more information, see [Loyalty Program Overview](https://developer.squareup.
{
"accrual_type": "ITEM_VARIATION",
"points": 100,
- "visit_minimum_amount_money": {
- "amount": 238,
- "currency": "ISK"
+ "visit_data": {
+ "minimum_amount_money": {
+ "amount": 160,
+ "currency": "TTD"
+ },
+ "tax_mode": "BEFORE_TAX"
+ },
+ "spend_data": {
+ "amount_money": {
+ "amount": 128,
+ "currency": "BHD"
+ },
+ "excluded_category_ids": [
+ "excluded_category_ids2",
+ "excluded_category_ids3",
+ "excluded_category_ids4"
+ ],
+ "excluded_item_variation_ids": [
+ "excluded_item_variation_ids5",
+ "excluded_item_variation_ids4",
+ "excluded_item_variation_ids3"
+ ],
+ "tax_mode": "BEFORE_TAX"
},
- "spend_amount_money": {
- "amount": 98,
- "currency": "UGX"
+ "item_variation_data": {
+ "item_variation_id": "item_variation_id8"
},
- "catalog_object_id": "catalog_object_id8",
- "excluded_category_ids": [
- "excluded_category_ids6",
- "excluded_category_ids5"
- ]
+ "category_data": {
+ "category_id": "category_id4"
+ }
},
{
"accrual_type": "SPEND",
"points": 99,
- "visit_minimum_amount_money": {
- "amount": 237,
- "currency": "JMD"
+ "visit_data": {
+ "minimum_amount_money": {
+ "amount": 161,
+ "currency": "TWD"
+ },
+ "tax_mode": "AFTER_TAX"
+ },
+ "spend_data": {
+ "amount_money": {
+ "amount": 129,
+ "currency": "BIF"
+ },
+ "excluded_category_ids": [
+ "excluded_category_ids3"
+ ],
+ "excluded_item_variation_ids": [
+ "excluded_item_variation_ids6",
+ "excluded_item_variation_ids5"
+ ],
+ "tax_mode": "AFTER_TAX"
},
- "spend_amount_money": {
- "amount": 99,
- "currency": "USD"
+ "item_variation_data": {
+ "item_variation_id": "item_variation_id9"
},
- "catalog_object_id": "catalog_object_id7",
- "excluded_category_ids": [
- "excluded_category_ids5",
- "excluded_category_ids4",
- "excluded_category_ids3"
- ]
+ "category_data": {
+ "category_id": "category_id5"
+ }
}
]
}
diff --git a/doc/models/merchant.md b/doc/models/merchant.md
index 3524cd91..1906b695 100644
--- a/doc/models/merchant.md
+++ b/doc/models/merchant.md
@@ -18,6 +18,7 @@ Represents a Square seller.
| `currency` | [`str (Currency)`](/doc/models/currency.md) | Optional | Indicates the associated currency for an amount of money. Values correspond
to [ISO 4217](https://wikipedia.org/wiki/ISO_4217). |
| `status` | [`str (Merchant Status)`](/doc/models/merchant-status.md) | Optional | - |
| `main_location_id` | `string` | Optional | The ID of the main `Location` for this merchant. |
+| `created_at` | `string` | Optional | The time when the merchant was created, in RFC 3339 format.
For more information, see [Working with Dates](https://developer.squareup.com/docs/build-basics/working-with-dates). |
## Example (as JSON)
diff --git a/doc/models/order-fulfillment-recipient.md b/doc/models/order-fulfillment-recipient.md
index 30e14012..35b6177a 100644
--- a/doc/models/order-fulfillment-recipient.md
+++ b/doc/models/order-fulfillment-recipient.md
@@ -15,7 +15,7 @@ Contains information about the recipient of a fulfillment.
| `display_name` | `string` | Optional | The display name of the fulfillment recipient.
If provided, the display name overrides the value pulled from the customer profile indicated by `customer_id`.
**Constraints**: *Maximum Length*: `255` |
| `email_address` | `string` | Optional | The email address of the fulfillment recipient.
If provided, the email address overrides the value pulled from the customer profile indicated by `customer_id`.
**Constraints**: *Maximum Length*: `255` |
| `phone_number` | `string` | Optional | The phone number of the fulfillment recipient.
If provided, the phone number overrides the value pulled from the customer profile indicated by `customer_id`.
**Constraints**: *Maximum Length*: `17` |
-| `address` | [`Address`](/doc/models/address.md) | Optional | Represents a postal address in a country. The address format is based
on an [open-source library from Google](https://github.com/google/libaddressinput). For more information,
see [AddressValidationMetadata](https://github.com/google/libaddressinput/wiki/AddressValidationMetadata).
This format has dedicated fields for four address components: postal code,
locality (city), administrative district (state, prefecture, or province), and
sublocality (town or village). These components have dedicated fields in the
`Address` object because software sometimes behaves differently based on them.
For example, sales tax software may charge different amounts of sales tax
based on the postal code, and some software is only available in
certain states due to compliance reasons.
For the remaining address components, the `Address` type provides the
`address_line_1` and `address_line_2` fields for free-form data entry.
These fields are free-form because the remaining address components have
too many variations around the world and typical software does not parse
these components. These fields enable users to enter anything they want.
Note that, in the current implementation, all other `Address` type fields are blank.
These include `address_line_3`, `sublocality_2`, `sublocality_3`,
`administrative_district_level_2`, `administrative_district_level_3`,
`first_name`, `last_name`, and `organization`.
When it comes to localization, the seller's language preferences
(see [Language preferences](https://developer.squareup.com/docs/locations-api#location-specific-and-seller-level-language-preferences))
are ignored for addresses. Even though Square products (such as Square Point of Sale
and the Seller Dashboard) mostly use a seller's language preference in
communication, when it comes to addresses, they will use English for a US address,
Japanese for an address in Japan, and so on. |
+| `address` | [`Address`](/doc/models/address.md) | Optional | Represents a postal address in a country.
For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). |
## Example (as JSON)
diff --git a/doc/models/payment.md b/doc/models/payment.md
index bf9d7689..bd03e98a 100644
--- a/doc/models/payment.md
+++ b/doc/models/payment.md
@@ -25,7 +25,7 @@ Represents a payment processed by the Square API.
| `delay_duration` | `string` | Optional | The duration of time after the payment's creation when Square automatically applies the
`delay_action` to the payment. This automatic `delay_action` applies only to payments that
do not reach a terminal state (COMPLETED, CANCELED, or FAILED) before the `delay_duration`
time period.
This field is specified as a time duration, in RFC 3339 format.
Notes:
This feature is only supported for card payments.
Default:
- Card-present payments: "PT36H" (36 hours) from the creation time.
- Card-not-present payments: "P7D" (7 days) from the creation time. |
| `delay_action` | `string` | Optional | The action to be applied to the payment when the `delay_duration` has elapsed. This field
is read-only.
Current values include `CANCEL`. |
| `delayed_until` | `string` | Optional | The read-only timestamp of when the `delay_action` is automatically applied,
in RFC 3339 format.
Note that this field is calculated by summing the payment's `delay_duration` and `created_at`
fields. The `created_at` field is generated by Square and might not exactly match the
time on your local machine. |
-| `source_type` | `string` | Optional | The source type for this payment.
Current values include `CARD`, `BANK_ACCOUNT`, `WALLET`, `BUY_NOW_PAY_LATER`, `CASH`, or
`EXTERNAL`.
**Constraints**: *Maximum Length*: `50` |
+| `source_type` | `string` | Optional | The source type for this payment.
Current values include `CARD`, `BANK_ACCOUNT`, `WALLET`, `BUY_NOW_PAY_LATER`, `CASH`, or
`EXTERNAL`. For information about these payment source types,
see [Take Payments](https://developer.squareup.com/docs/payments-api/take-payments).
**Constraints**: *Maximum Length*: `50` |
| `card_details` | [`Card Payment Details`](/doc/models/card-payment-details.md) | Optional | Reflects the current status of a card payment. Contains only non-confidential information. |
| `cash_details` | [`Cash Payment Details`](/doc/models/cash-payment-details.md) | Optional | Stores details about a cash payment. Contains only non-confidential information. For more information, see
[Take Cash Payments](https://developer.squareup.com/docs/payments-api/take-payments/cash-payments). |
| `bank_account_details` | [`Bank Account Payment Details`](/doc/models/bank-account-payment-details.md) | Optional | Additional details about BANK_ACCOUNT type payments. |
@@ -40,8 +40,8 @@ Represents a payment processed by the Square API.
| `refund_ids` | `List of string` | Optional | A list of `refund_id`s identifying refunds for the payment. |
| `risk_evaluation` | [`Risk Evaluation`](/doc/models/risk-evaluation.md) | Optional | Represents fraud risk information for the associated payment.
When you take a payment through Square's Payments API (using the `CreatePayment`
endpoint), Square evaluates it and assigns a risk level to the payment. Sellers
can use this information to determine the course of action (for example,
provide the goods/services or refund the payment). |
| `buyer_email_address` | `string` | Optional | The buyer's email address.
**Constraints**: *Maximum Length*: `255` |
-| `billing_address` | [`Address`](/doc/models/address.md) | Optional | Represents a postal address in a country. The address format is based
on an [open-source library from Google](https://github.com/google/libaddressinput). For more information,
see [AddressValidationMetadata](https://github.com/google/libaddressinput/wiki/AddressValidationMetadata).
This format has dedicated fields for four address components: postal code,
locality (city), administrative district (state, prefecture, or province), and
sublocality (town or village). These components have dedicated fields in the
`Address` object because software sometimes behaves differently based on them.
For example, sales tax software may charge different amounts of sales tax
based on the postal code, and some software is only available in
certain states due to compliance reasons.
For the remaining address components, the `Address` type provides the
`address_line_1` and `address_line_2` fields for free-form data entry.
These fields are free-form because the remaining address components have
too many variations around the world and typical software does not parse
these components. These fields enable users to enter anything they want.
Note that, in the current implementation, all other `Address` type fields are blank.
These include `address_line_3`, `sublocality_2`, `sublocality_3`,
`administrative_district_level_2`, `administrative_district_level_3`,
`first_name`, `last_name`, and `organization`.
When it comes to localization, the seller's language preferences
(see [Language preferences](https://developer.squareup.com/docs/locations-api#location-specific-and-seller-level-language-preferences))
are ignored for addresses. Even though Square products (such as Square Point of Sale
and the Seller Dashboard) mostly use a seller's language preference in
communication, when it comes to addresses, they will use English for a US address,
Japanese for an address in Japan, and so on. |
-| `shipping_address` | [`Address`](/doc/models/address.md) | Optional | Represents a postal address in a country. The address format is based
on an [open-source library from Google](https://github.com/google/libaddressinput). For more information,
see [AddressValidationMetadata](https://github.com/google/libaddressinput/wiki/AddressValidationMetadata).
This format has dedicated fields for four address components: postal code,
locality (city), administrative district (state, prefecture, or province), and
sublocality (town or village). These components have dedicated fields in the
`Address` object because software sometimes behaves differently based on them.
For example, sales tax software may charge different amounts of sales tax
based on the postal code, and some software is only available in
certain states due to compliance reasons.
For the remaining address components, the `Address` type provides the
`address_line_1` and `address_line_2` fields for free-form data entry.
These fields are free-form because the remaining address components have
too many variations around the world and typical software does not parse
these components. These fields enable users to enter anything they want.
Note that, in the current implementation, all other `Address` type fields are blank.
These include `address_line_3`, `sublocality_2`, `sublocality_3`,
`administrative_district_level_2`, `administrative_district_level_3`,
`first_name`, `last_name`, and `organization`.
When it comes to localization, the seller's language preferences
(see [Language preferences](https://developer.squareup.com/docs/locations-api#location-specific-and-seller-level-language-preferences))
are ignored for addresses. Even though Square products (such as Square Point of Sale
and the Seller Dashboard) mostly use a seller's language preference in
communication, when it comes to addresses, they will use English for a US address,
Japanese for an address in Japan, and so on. |
+| `billing_address` | [`Address`](/doc/models/address.md) | Optional | Represents a postal address in a country.
For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). |
+| `shipping_address` | [`Address`](/doc/models/address.md) | Optional | Represents a postal address in a country.
For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). |
| `note` | `string` | Optional | An optional note to include when creating a payment.
**Constraints**: *Maximum Length*: `500` |
| `statement_description_identifier` | `string` | Optional | Additional payment information that gets added to the customer's card statement
as part of the statement description.
Note that the `statement_description_identifier` might get truncated on the statement description
to fit the required information including the Square identifier (SQ *) and the name of the
seller taking the payment. |
| `capabilities` | `List of string` | Optional | Actions that can be performed on this payment:
- `EDIT_AMOUNT_UP` - The payment amount can be edited up.
- `EDIT_AMOUNT_DOWN` - The payment amount can be edited down.
- `EDIT_TIP_AMOUNT_UP` - The tip amount can be edited up.
- `EDIT_TIP_AMOUNT_DOWN` - The tip amount can be edited down. |
diff --git a/doc/models/retrieve-booking-response.md b/doc/models/retrieve-booking-response.md
index 48f428f6..d559b8fe 100644
--- a/doc/models/retrieve-booking-response.md
+++ b/doc/models/retrieve-booking-response.md
@@ -10,7 +10,7 @@
| Name | Type | Tags | Description |
| --- | --- | --- | --- |
| `booking` | [`Booking`](/doc/models/booking.md) | Optional | Represents a booking as a time-bound service contract for a seller's staff member to provide a specified service
at a given location to a requesting customer in one or more appointment segments. |
-| `errors` | [`List of Error`](/doc/models/error.md) | Optional | Any errors that occurred during the request. |
+| `errors` | [`List of Error`](/doc/models/error.md) | Optional | Errors that occurred during the request. |
## Example (as JSON)
diff --git a/doc/models/retrieve-business-booking-profile-response.md b/doc/models/retrieve-business-booking-profile-response.md
index 26e17856..72c96b7f 100644
--- a/doc/models/retrieve-business-booking-profile-response.md
+++ b/doc/models/retrieve-business-booking-profile-response.md
@@ -10,7 +10,7 @@
| Name | Type | Tags | Description |
| --- | --- | --- | --- |
| `business_booking_profile` | [`Business Booking Profile`](/doc/models/business-booking-profile.md) | Optional | - |
-| `errors` | [`List of Error`](/doc/models/error.md) | Optional | Any errors that occurred during the request. |
+| `errors` | [`List of Error`](/doc/models/error.md) | Optional | Errors that occurred during the request. |
## Example (as JSON)
diff --git a/doc/models/retrieve-loyalty-program-response.md b/doc/models/retrieve-loyalty-program-response.md
index 54a54e96..531ba7aa 100644
--- a/doc/models/retrieve-loyalty-program-response.md
+++ b/doc/models/retrieve-loyalty-program-response.md
@@ -22,18 +22,21 @@ A response that contains the loyalty program.
"accrual_rules": [
{
"accrual_type": "SPEND",
- "excluded_category_ids": [
- "7ZERJKO5PVYXCVUHV2JCZ2UG",
- "FQKAOJE5C4FIMF5A2URMLW6V"
- ],
- "excluded_item_variation_ids": [
- "CBZXBUVVTYUBZGQO44RHMR6B",
- "EDILT24Z2NISEXDKGY6HP7XV"
- ],
"points": 1,
- "spend_amount_money": {
- "amount": 100,
- "currency": "USD"
+ "spend_data": {
+ "amount_money": {
+ "amount": 100,
+ "currency": "USD"
+ },
+ "excluded_category_ids": [
+ "7ZERJKO5PVYXCVUHV2JCZ2UG",
+ "FQKAOJE5C4FIMF5A2URMLW6V"
+ ],
+ "excluded_item_variation_ids": [
+ "CBZXBUVVTYUBZGQO44RHMR6B",
+ "EDILT24Z2NISEXDKGY6HP7XV"
+ ],
+ "tax_mode": "BEFORE_TAX"
}
}
],
diff --git a/doc/models/retrieve-merchant-response.md b/doc/models/retrieve-merchant-response.md
index b24f3301..9b2640e7 100644
--- a/doc/models/retrieve-merchant-response.md
+++ b/doc/models/retrieve-merchant-response.md
@@ -21,6 +21,7 @@ The response object returned by the [RetrieveMerchant](/doc/api/merchants.md#ret
"merchant": {
"business_name": "Apple A Day",
"country": "US",
+ "created_at": "2021-12-10T19:25:52.484Z",
"currency": "USD",
"id": "DM7VKY8Q63GNP",
"language_code": "en-US",
diff --git a/doc/models/retrieve-team-member-booking-profile-response.md b/doc/models/retrieve-team-member-booking-profile-response.md
index 6ef26dec..0c95bfe5 100644
--- a/doc/models/retrieve-team-member-booking-profile-response.md
+++ b/doc/models/retrieve-team-member-booking-profile-response.md
@@ -10,7 +10,7 @@
| Name | Type | Tags | Description |
| --- | --- | --- | --- |
| `team_member_booking_profile` | [`Team Member Booking Profile`](/doc/models/team-member-booking-profile.md) | Optional | The booking profile of a seller's team member, including the team member's ID, display name, description and whether the team member can be booked as a service provider. |
-| `errors` | [`List of Error`](/doc/models/error.md) | Optional | Any errors that occurred during the request. |
+| `errors` | [`List of Error`](/doc/models/error.md) | Optional | Errors that occurred during the request. |
## Example (as JSON)
diff --git a/doc/models/search-availability-filter.md b/doc/models/search-availability-filter.md
index 8995f3bd..9a24a957 100644
--- a/doc/models/search-availability-filter.md
+++ b/doc/models/search-availability-filter.md
@@ -1,7 +1,7 @@
# Search Availability Filter
-A query filter to search for availabilities by.
+A query filter to search for buyer-accessible availabilities by.
## Structure
@@ -12,9 +12,9 @@ A query filter to search for availabilities by.
| Name | Type | Tags | Description |
| --- | --- | --- | --- |
| `start_at_range` | [`Time Range`](/doc/models/time-range.md) | Required | Represents a generic time range. The start and end values are
represented in RFC 3339 format. Time ranges are customized to be
inclusive or exclusive based on the needs of a particular endpoint.
Refer to the relevant endpoint-specific documentation to determine
how time ranges are handled. |
-| `location_id` | `string` | Optional | The query expression to search for availabilities matching the specified seller location IDs.
This query expression is not applicable when `booking_id` is present. |
-| `segment_filters` | [`List of Segment Filter`](/doc/models/segment-filter.md) | Optional | The list of segment filters to apply. A query with `n` segment filters returns availabilities with `n` segments per
availability. It is not applicable when `booking_id` is present. |
-| `booking_id` | `string` | Optional | The query expression to search for availabilities for an existing booking by matching the specified `booking_id` value.
This is commonly used to reschedule an appointment.
If this expression is specified, the `location_id` and `segment_filters` expressions are not allowed. |
+| `location_id` | `string` | Optional | The query expression to search for buyer-accessible availabilities with their location IDs matching the specified location ID.
This query expression cannot be set if `booking_id` is set. |
+| `segment_filters` | [`List of Segment Filter`](/doc/models/segment-filter.md) | Optional | The query expression to search for buyer-accessible availabilities matching the specified list of segment filters.
If the size of the `segment_filters` list is `n`, the search returns availabilities with `n` segments per availability.
This query expression cannot be set if `booking_id` is set. |
+| `booking_id` | `string` | Optional | The query expression to search for buyer-accessible availabilities for an existing booking by matching the specified `booking_id` value.
This is commonly used to reschedule an appointment.
If this expression is set, the `location_id` and `segment_filters` expressions cannot be set. |
## Example (as JSON)
diff --git a/doc/models/search-availability-query.md b/doc/models/search-availability-query.md
index fab72978..9b8d6502 100644
--- a/doc/models/search-availability-query.md
+++ b/doc/models/search-availability-query.md
@@ -1,7 +1,7 @@
# Search Availability Query
-Query conditions to search for availabilities of bookings.
+The query used to search for buyer-accessible availabilities of bookings.
## Structure
@@ -11,7 +11,7 @@ Query conditions to search for availabilities of bookings.
| Name | Type | Tags | Description |
| --- | --- | --- | --- |
-| `filter` | [`Search Availability Filter`](/doc/models/search-availability-filter.md) | Required | A query filter to search for availabilities by. |
+| `filter` | [`Search Availability Filter`](/doc/models/search-availability-filter.md) | Required | A query filter to search for buyer-accessible availabilities by. |
## Example (as JSON)
diff --git a/doc/models/search-availability-request.md b/doc/models/search-availability-request.md
index 7a6ca728..6dc487e8 100644
--- a/doc/models/search-availability-request.md
+++ b/doc/models/search-availability-request.md
@@ -9,7 +9,7 @@
| Name | Type | Tags | Description |
| --- | --- | --- | --- |
-| `query` | [`Search Availability Query`](/doc/models/search-availability-query.md) | Required | Query conditions to search for availabilities of bookings. |
+| `query` | [`Search Availability Query`](/doc/models/search-availability-query.md) | Required | The query used to search for buyer-accessible availabilities of bookings. |
## Example (as JSON)
diff --git a/doc/models/search-availability-response.md b/doc/models/search-availability-response.md
index b00edfbf..c49e8dab 100644
--- a/doc/models/search-availability-response.md
+++ b/doc/models/search-availability-response.md
@@ -9,8 +9,8 @@
| Name | Type | Tags | Description |
| --- | --- | --- | --- |
-| `availabilities` | [`List of Availability`](/doc/models/availability.md) | Optional | List of slots available for booking. |
-| `errors` | [`List of Error`](/doc/models/error.md) | Optional | Any errors that occurred during the request. |
+| `availabilities` | [`List of Availability`](/doc/models/availability.md) | Optional | List of appointment slots available for booking. |
+| `errors` | [`List of Error`](/doc/models/error.md) | Optional | Errors that occurred during the request. |
## Example (as JSON)
diff --git a/doc/models/segment-filter.md b/doc/models/segment-filter.md
index aa407af1..c99cf1ca 100644
--- a/doc/models/segment-filter.md
+++ b/doc/models/segment-filter.md
@@ -1,7 +1,7 @@
# Segment Filter
-A query filter to search for appointment segments by.
+A query filter to search for buyer-accessible appointment segments by.
## Structure
@@ -11,7 +11,7 @@ A query filter to search for appointment segments by.
| Name | Type | Tags | Description |
| --- | --- | --- | --- |
-| `service_variation_id` | `string` | Required | The ID of the [CatalogItemVariation](/doc/models/catalog-item-variation.md) representing the service booked in this segment.
**Constraints**: *Minimum Length*: `1` |
+| `service_variation_id` | `string` | Required | The ID of the [CatalogItemVariation](/doc/models/catalog-item-variation.md) object representing the service booked in this segment.
**Constraints**: *Minimum Length*: `1` |
| `team_member_id_filter` | [`Filter Value`](/doc/models/filter-value.md) | Optional | A filter to select resources based on an exact field value. For any given
value, the value can only be in one property. Depending on the field, either
all properties can be set or only a subset will be available.
Refer to the documentation of the field. |
## Example (as JSON)
diff --git a/doc/models/tax-ids.md b/doc/models/tax-ids.md
index df2fa900..9a4a0dd3 100644
--- a/doc/models/tax-ids.md
+++ b/doc/models/tax-ids.md
@@ -1,7 +1,7 @@
# Tax Ids
-The tax IDs that a Location is operating under.
+Identifiers for the location used by various governments for tax purposes.
## Structure
@@ -11,9 +11,9 @@ The tax IDs that a Location is operating under.
| Name | Type | Tags | Description |
| --- | --- | --- | --- |
-| `eu_vat` | `string` | Optional | The EU VAT number for this location. For example, "IE3426675K".
If the EU VAT number is present, it is well-formed and has been
validated with VIES, the VAT Information Exchange System. |
-| `fr_siret` | `string` | Optional | The SIRET (Système d'Identification du Répertoire des Entreprises et de leurs Etablissements)
number is a 14 digits code issued by the French INSEE. For example, "39922799000021". |
-| `fr_naf` | `string` | Optional | The French government uses the NAF (Nomenclature des Activités Françaises) to display and
track economic statistical data. This is also called the APE (Activite Principale de l’Entreprise) code.
For example, 6910Z. |
+| `eu_vat` | `string` | Optional | The EU VAT number for this location. For example, `IE3426675K`.
If the EU VAT number is present, it is well-formed and has been
validated with VIES, the VAT Information Exchange System. |
+| `fr_siret` | `string` | Optional | The SIRET (Système d'Identification du Répertoire des Entreprises et de leurs Etablissements)
number is a 14 digit code issued by the French INSEE. For example, `39922799000021`. |
+| `fr_naf` | `string` | Optional | The French government uses the NAF (Nomenclature des Activités Françaises) to display and
track economic statistical data. This is also called the APE (Activite Principale de l’Entreprise) code.
For example, `6910Z`. |
## Example (as JSON)
diff --git a/doc/models/transaction.md b/doc/models/transaction.md
index d1340641..f98eb2cd 100644
--- a/doc/models/transaction.md
+++ b/doc/models/transaction.md
@@ -23,7 +23,7 @@ the transaction.
| `reference_id` | `string` | Optional | If the transaction was created with the [Charge]($e/Transactions/Charge)
endpoint, this value is the same as the value provided for the `reference_id`
parameter in the request to that endpoint. Otherwise, it is not set.
**Constraints**: *Maximum Length*: `40` |
| `product` | [`str (Transaction Product)`](/doc/models/transaction-product.md) | Optional | Indicates the Square product used to process a transaction. |
| `client_id` | `string` | Optional | If the transaction was created in the Square Point of Sale app, this value
is the ID generated for the transaction by Square Point of Sale.
This ID has no relationship to the transaction's canonical `id`, which is
generated by Square's backend servers. This value is generated for bookkeeping
purposes, in case the transaction cannot immediately be completed (for example,
if the transaction is processed in offline mode).
It is not currently possible with the Connect API to perform a transaction
lookup by this value.
**Constraints**: *Maximum Length*: `192` |
-| `shipping_address` | [`Address`](/doc/models/address.md) | Optional | Represents a postal address in a country. The address format is based
on an [open-source library from Google](https://github.com/google/libaddressinput). For more information,
see [AddressValidationMetadata](https://github.com/google/libaddressinput/wiki/AddressValidationMetadata).
This format has dedicated fields for four address components: postal code,
locality (city), administrative district (state, prefecture, or province), and
sublocality (town or village). These components have dedicated fields in the
`Address` object because software sometimes behaves differently based on them.
For example, sales tax software may charge different amounts of sales tax
based on the postal code, and some software is only available in
certain states due to compliance reasons.
For the remaining address components, the `Address` type provides the
`address_line_1` and `address_line_2` fields for free-form data entry.
These fields are free-form because the remaining address components have
too many variations around the world and typical software does not parse
these components. These fields enable users to enter anything they want.
Note that, in the current implementation, all other `Address` type fields are blank.
These include `address_line_3`, `sublocality_2`, `sublocality_3`,
`administrative_district_level_2`, `administrative_district_level_3`,
`first_name`, `last_name`, and `organization`.
When it comes to localization, the seller's language preferences
(see [Language preferences](https://developer.squareup.com/docs/locations-api#location-specific-and-seller-level-language-preferences))
are ignored for addresses. Even though Square products (such as Square Point of Sale
and the Seller Dashboard) mostly use a seller's language preference in
communication, when it comes to addresses, they will use English for a US address,
Japanese for an address in Japan, and so on. |
+| `shipping_address` | [`Address`](/doc/models/address.md) | Optional | Represents a postal address in a country.
For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). |
| `order_id` | `string` | Optional | The order_id is an identifier for the order associated with this transaction, if any.
**Constraints**: *Maximum Length*: `192` |
## Example (as JSON)
diff --git a/doc/models/update-booking-response.md b/doc/models/update-booking-response.md
index 97e41299..e4e38fdd 100644
--- a/doc/models/update-booking-response.md
+++ b/doc/models/update-booking-response.md
@@ -10,7 +10,7 @@
| Name | Type | Tags | Description |
| --- | --- | --- | --- |
| `booking` | [`Booking`](/doc/models/booking.md) | Optional | Represents a booking as a time-bound service contract for a seller's staff member to provide a specified service
at a given location to a requesting customer in one or more appointment segments. |
-| `errors` | [`List of Error`](/doc/models/error.md) | Optional | Any errors that occurred during the request. |
+| `errors` | [`List of Error`](/doc/models/error.md) | Optional | Errors that occurred during the request. |
## Example (as JSON)
diff --git a/doc/models/update-customer-request.md b/doc/models/update-customer-request.md
index e52a1871..65d1ffc3 100644
--- a/doc/models/update-customer-request.md
+++ b/doc/models/update-customer-request.md
@@ -17,7 +17,7 @@ Defines the body parameters that can be included in a request to the
| `company_name` | `string` | Optional | A business name associated with the customer profile. |
| `nickname` | `string` | Optional | A nickname for the customer profile. |
| `email_address` | `string` | Optional | The email address associated with the customer profile. |
-| `address` | [`Address`](/doc/models/address.md) | Optional | Represents a postal address in a country. The address format is based
on an [open-source library from Google](https://github.com/google/libaddressinput). For more information,
see [AddressValidationMetadata](https://github.com/google/libaddressinput/wiki/AddressValidationMetadata).
This format has dedicated fields for four address components: postal code,
locality (city), administrative district (state, prefecture, or province), and
sublocality (town or village). These components have dedicated fields in the
`Address` object because software sometimes behaves differently based on them.
For example, sales tax software may charge different amounts of sales tax
based on the postal code, and some software is only available in
certain states due to compliance reasons.
For the remaining address components, the `Address` type provides the
`address_line_1` and `address_line_2` fields for free-form data entry.
These fields are free-form because the remaining address components have
too many variations around the world and typical software does not parse
these components. These fields enable users to enter anything they want.
Note that, in the current implementation, all other `Address` type fields are blank.
These include `address_line_3`, `sublocality_2`, `sublocality_3`,
`administrative_district_level_2`, `administrative_district_level_3`,
`first_name`, `last_name`, and `organization`.
When it comes to localization, the seller's language preferences
(see [Language preferences](https://developer.squareup.com/docs/locations-api#location-specific-and-seller-level-language-preferences))
are ignored for addresses. Even though Square products (such as Square Point of Sale
and the Seller Dashboard) mostly use a seller's language preference in
communication, when it comes to addresses, they will use English for a US address,
Japanese for an address in Japan, and so on. |
+| `address` | [`Address`](/doc/models/address.md) | Optional | Represents a postal address in a country.
For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). |
| `phone_number` | `string` | Optional | The 11-digit phone number associated with the customer profile. |
| `reference_id` | `string` | Optional | An optional second ID used to associate the customer profile with an
entity in another system. |
| `note` | `string` | Optional | A custom note associated with the customer profile. |
diff --git a/doc/models/v1-order.md b/doc/models/v1-order.md
index d1181c34..15a57f9e 100644
--- a/doc/models/v1-order.md
+++ b/doc/models/v1-order.md
@@ -17,7 +17,7 @@ V1Order
| `recipient_name` | `string` | Optional | The name of the order's buyer. |
| `recipient_phone_number` | `string` | Optional | The phone number to use for the order's delivery. |
| `state` | [`str (V1 Order State)`](/doc/models/v1-order-state.md) | Optional | - |
-| `shipping_address` | [`Address`](/doc/models/address.md) | Optional | Represents a postal address in a country. The address format is based
on an [open-source library from Google](https://github.com/google/libaddressinput). For more information,
see [AddressValidationMetadata](https://github.com/google/libaddressinput/wiki/AddressValidationMetadata).
This format has dedicated fields for four address components: postal code,
locality (city), administrative district (state, prefecture, or province), and
sublocality (town or village). These components have dedicated fields in the
`Address` object because software sometimes behaves differently based on them.
For example, sales tax software may charge different amounts of sales tax
based on the postal code, and some software is only available in
certain states due to compliance reasons.
For the remaining address components, the `Address` type provides the
`address_line_1` and `address_line_2` fields for free-form data entry.
These fields are free-form because the remaining address components have
too many variations around the world and typical software does not parse
these components. These fields enable users to enter anything they want.
Note that, in the current implementation, all other `Address` type fields are blank.
These include `address_line_3`, `sublocality_2`, `sublocality_3`,
`administrative_district_level_2`, `administrative_district_level_3`,
`first_name`, `last_name`, and `organization`.
When it comes to localization, the seller's language preferences
(see [Language preferences](https://developer.squareup.com/docs/locations-api#location-specific-and-seller-level-language-preferences))
are ignored for addresses. Even though Square products (such as Square Point of Sale
and the Seller Dashboard) mostly use a seller's language preference in
communication, when it comes to addresses, they will use English for a US address,
Japanese for an address in Japan, and so on. |
+| `shipping_address` | [`Address`](/doc/models/address.md) | Optional | Represents a postal address in a country.
For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). |
| `subtotal_money` | [`V1 Money`](/doc/models/v1-money.md) | Optional | - |
| `total_shipping_money` | [`V1 Money`](/doc/models/v1-money.md) | Optional | - |
| `total_tax_money` | [`V1 Money`](/doc/models/v1-money.md) | Optional | - |
diff --git a/setup.py b/setup.py
index cbaf771d..eb81dcc1 100644
--- a/setup.py
+++ b/setup.py
@@ -12,7 +12,7 @@
setup(
name='squareup',
- version='17.0.0.20211215',
+ version='17.1.0.20220120',
description='Use Square APIs to manage and run business including payment, customer, product, inventory, and employee management.',
long_description=long_description,
long_description_content_type="text/markdown",
diff --git a/square/api/apple_pay_api.py b/square/api/apple_pay_api.py
index 4125a666..94ca0dc2 100644
--- a/square/api/apple_pay_api.py
+++ b/square/api/apple_pay_api.py
@@ -3,15 +3,13 @@
from square.api_helper import APIHelper
from square.http.api_response import ApiResponse
from square.api.base_api import BaseApi
-from square.http.auth.o_auth_2 import OAuth2
class ApplePayApi(BaseApi):
"""A Controller to access Endpoints in the square API."""
-
- def __init__(self, config, call_back=None):
- super(ApplePayApi, self).__init__(config, call_back)
+ def __init__(self, config, auth_managers, call_back=None):
+ super(ApplePayApi, self).__init__(config, auth_managers, call_back)
def register_domain(self,
body):
@@ -61,7 +59,9 @@ def register_domain(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
diff --git a/square/api/bank_accounts_api.py b/square/api/bank_accounts_api.py
index 82df347f..f1449c09 100644
--- a/square/api/bank_accounts_api.py
+++ b/square/api/bank_accounts_api.py
@@ -3,15 +3,13 @@
from square.api_helper import APIHelper
from square.http.api_response import ApiResponse
from square.api.base_api import BaseApi
-from square.http.auth.o_auth_2 import OAuth2
class BankAccountsApi(BaseApi):
"""A Controller to access Endpoints in the square API."""
-
- def __init__(self, config, call_back=None):
- super(BankAccountsApi, self).__init__(config, call_back)
+ def __init__(self, config, auth_managers, call_back=None):
+ super(BankAccountsApi, self).__init__(config, auth_managers, call_back)
def list_bank_accounts(self,
cursor=None,
@@ -71,7 +69,9 @@ def list_bank_accounts(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -125,7 +125,9 @@ def get_bank_account_by_v1_id(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -175,7 +177,9 @@ def get_bank_account(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
diff --git a/square/api/base_api.py b/square/api/base_api.py
index 27983ed9..673686bb 100644
--- a/square/api/base_api.py
+++ b/square/api/base_api.py
@@ -15,6 +15,7 @@ class BaseApi(object):
as well.
http_call_back (HttpCallBack): An object which holds call back
methods to be called before and after the execution of an HttpRequest.
+ auth_managers (dict): A dictionary which holds the instances of authentication managers.
global_headers (dict): The global headers of the API which are sent with
every request.
@@ -26,8 +27,9 @@ def global_headers(self):
'Square-Version': self.config.square_version
}
- def __init__(self, config, call_back=None):
+ def __init__(self, config, auth_managers, call_back=None):
self._config = config
+ self._auth_managers = auth_managers
self._http_call_back = call_back
@property
@@ -38,6 +40,10 @@ def config(self):
def http_call_back(self):
return self._http_call_back
+ @property
+ def auth_managers(self):
+ return self._auth_managers
+
def validate_parameters(self, **kwargs):
"""Validates required parameters of an endpoint.
@@ -81,9 +87,36 @@ def execute_request(self, request, binary=False):
return response
def get_user_agent(self):
- user_agent = 'Square-Python-SDK/17.0.0.20211215'
+ user_agent = 'Square-Python-SDK/17.1.0.20220120 ({api-version}) {engine}/{engine-version} ({os-info}) {detail}'
parameters = {
+ 'engine': {'value': platform.python_implementation(), 'encode': False},
+ 'engine-version': {'value': "", 'encode': False},
+ 'os-info': {'value': platform.system(), 'encode': False},
+ 'api-version': {'value': self.config.square_version, 'encode': False},
+ 'detail': {'value': self.config.user_agent_detail, 'encode': True},
}
agent = APIHelper.append_url_with_template_parameters(user_agent, parameters)
return agent.replace(' ', ' ')
+
+
+ def apply_auth_schemes(self, request, *auth_options):
+ auth_error_message = []
+ # traverse all options for OR auth
+ for option in auth_options:
+ # split the option for AND auths
+ schemes = option.split()
+ # check if all AND auth credentials exist in auth managers
+ if all(scheme in self.auth_managers and self.auth_managers[scheme].validate_arguments() for scheme in schemes):
+ # apply each auth scheme in AND case to request then break
+ for scheme in schemes:
+ self.auth_managers[scheme].apply(request)
+ break
+ else:
+ for scheme in schemes:
+ if scheme in self.auth_managers:
+ auth_error_message.append(self.auth_managers[scheme].error_message())
+ #if the auth credentials for this auth option are missing then move to next
+ ## or if this is the last/only option then throw exception with reasonable message
+ if option is auth_options[-1]:
+ raise PermissionError("Required authentication is missing for: " + " and ".join(auth_error_message))
diff --git a/square/api/bookings_api.py b/square/api/bookings_api.py
index 0e5a29ae..2078ab00 100644
--- a/square/api/bookings_api.py
+++ b/square/api/bookings_api.py
@@ -3,15 +3,13 @@
from square.api_helper import APIHelper
from square.http.api_response import ApiResponse
from square.api.base_api import BaseApi
-from square.http.auth.o_auth_2 import OAuth2
class BookingsApi(BaseApi):
"""A Controller to access Endpoints in the square API."""
-
- def __init__(self, config, call_back=None):
- super(BookingsApi, self).__init__(config, call_back)
+ def __init__(self, config, auth_managers, call_back=None):
+ super(BookingsApi, self).__init__(config, auth_managers, call_back)
def list_bookings(self,
limit=None,
@@ -22,7 +20,11 @@ def list_bookings(self,
start_at_max=None):
"""Does a GET request to /v2/bookings.
- Retrieve a collection of bookings.
+ Retrieve a collection of bookings.
+ To call this endpoint with buyer-level permissions, set
+ `APPOINTMENTS_READ` for the OAuth scope.
+ To call this endpoint with seller-level permissions, set
+ `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` for the OAuth scope.
Args:
limit (int, optional): The maximum number of results per page to
@@ -80,7 +82,9 @@ def list_bookings(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -95,7 +99,12 @@ def create_booking(self,
body):
"""Does a POST request to /v2/bookings.
- Creates a booking.
+ Creates a booking.
+ To call this endpoint with buyer-level permissions, set
+ `APPOINTMENTS_WRITE` for the OAuth scope.
+ To call this endpoint with seller-level permissions, set
+ `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth
+ scope.
Args:
body (CreateBookingRequest): An object containing the fields to
@@ -128,7 +137,9 @@ def create_booking(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -143,7 +154,11 @@ def search_availability(self,
body):
"""Does a POST request to /v2/bookings/availability/search.
- Searches for availabilities for booking.
+ Searches for availabilities for booking.
+ To call this endpoint with buyer-level permissions, set
+ `APPOINTMENTS_READ` for the OAuth scope.
+ To call this endpoint with seller-level permissions, set
+ `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` for the OAuth scope.
Args:
body (SearchAvailabilityRequest): An object containing the fields
@@ -176,7 +191,9 @@ def search_availability(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -217,7 +234,9 @@ def retrieve_business_booking_profile(self):
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -241,9 +260,11 @@ def list_team_member_booking_profiles(self,
bookable_only (bool, optional): Indicates whether to include only
bookable team members in the returned result (`true`) or not
(`false`).
- limit (int, optional): The maximum number of results to return.
- cursor (string, optional): The cursor for paginating through the
- results.
+ limit (int, optional): The maximum number of results to return in
+ a paged response.
+ cursor (string, optional): The pagination cursor from the
+ preceding response to return the next page of the results. Do
+ not set this when retrieving the first page of the results.
location_id (string, optional): Indicates whether to include only
team members enabled at the given location in the returned
result.
@@ -283,7 +304,9 @@ def list_team_member_booking_profiles(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -331,7 +354,9 @@ def retrieve_team_member_booking_profile(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -346,7 +371,11 @@ def retrieve_booking(self,
booking_id):
"""Does a GET request to /v2/bookings/{booking_id}.
- Retrieves a booking.
+ Retrieves a booking.
+ To call this endpoint with buyer-level permissions, set
+ `APPOINTMENTS_READ` for the OAuth scope.
+ To call this endpoint with seller-level permissions, set
+ `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` for the OAuth scope.
Args:
booking_id (string): The ID of the [Booking]($m/Booking) object
@@ -380,7 +409,9 @@ def retrieve_booking(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -396,7 +427,12 @@ def update_booking(self,
body):
"""Does a PUT request to /v2/bookings/{booking_id}.
- Updates a booking.
+ Updates a booking.
+ To call this endpoint with buyer-level permissions, set
+ `APPOINTMENTS_WRITE` for the OAuth scope.
+ To call this endpoint with seller-level permissions, set
+ `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth
+ scope.
Args:
booking_id (string): The ID of the [Booking]($m/Booking) object
@@ -434,7 +470,9 @@ def update_booking(self,
# Prepare and execute request
_request = self.config.http_client.put(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -450,7 +488,12 @@ def cancel_booking(self,
body):
"""Does a POST request to /v2/bookings/{booking_id}/cancel.
- Cancels an existing booking.
+ Cancels an existing booking.
+ To call this endpoint with buyer-level permissions, set
+ `APPOINTMENTS_WRITE` for the OAuth scope.
+ To call this endpoint with seller-level permissions, set
+ `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth
+ scope.
Args:
booking_id (string): The ID of the [Booking]($m/Booking) object
@@ -488,7 +531,9 @@ def cancel_booking(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
diff --git a/square/api/cards_api.py b/square/api/cards_api.py
index e89e76b9..02c7a6f4 100644
--- a/square/api/cards_api.py
+++ b/square/api/cards_api.py
@@ -3,15 +3,13 @@
from square.api_helper import APIHelper
from square.http.api_response import ApiResponse
from square.api.base_api import BaseApi
-from square.http.auth.o_auth_2 import OAuth2
class CardsApi(BaseApi):
"""A Controller to access Endpoints in the square API."""
-
- def __init__(self, config, call_back=None):
- super(CardsApi, self).__init__(config, call_back)
+ def __init__(self, config, auth_managers, call_back=None):
+ super(CardsApi, self).__init__(config, auth_managers, call_back)
def list_cards(self,
cursor=None,
@@ -78,7 +76,9 @@ def list_cards(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -126,7 +126,9 @@ def create_card(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -174,7 +176,9 @@ def retrieve_card(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -223,7 +227,9 @@ def disable_card(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
diff --git a/square/api/cash_drawers_api.py b/square/api/cash_drawers_api.py
index 61ba181b..0963b3cd 100644
--- a/square/api/cash_drawers_api.py
+++ b/square/api/cash_drawers_api.py
@@ -3,15 +3,13 @@
from square.api_helper import APIHelper
from square.http.api_response import ApiResponse
from square.api.base_api import BaseApi
-from square.http.auth.o_auth_2 import OAuth2
class CashDrawersApi(BaseApi):
"""A Controller to access Endpoints in the square API."""
-
- def __init__(self, config, call_back=None):
- super(CashDrawersApi, self).__init__(config, call_back)
+ def __init__(self, config, auth_managers, call_back=None):
+ super(CashDrawersApi, self).__init__(config, auth_managers, call_back)
def list_cash_drawer_shifts(self,
location_id,
@@ -77,7 +75,9 @@ def list_cash_drawer_shifts(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -137,7 +137,9 @@ def retrieve_cash_drawer_shift(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -203,7 +205,9 @@ def list_cash_drawer_shift_events(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
diff --git a/square/api/catalog_api.py b/square/api/catalog_api.py
index ef3292bc..e048733b 100644
--- a/square/api/catalog_api.py
+++ b/square/api/catalog_api.py
@@ -4,15 +4,13 @@
from square.http.api_response import ApiResponse
from square.utilities.file_wrapper import FileWrapper
from square.api.base_api import BaseApi
-from square.http.auth.o_auth_2 import OAuth2
class CatalogApi(BaseApi):
"""A Controller to access Endpoints in the square API."""
-
- def __init__(self, config, call_back=None):
- super(CatalogApi, self).__init__(config, call_back)
+ def __init__(self, config, auth_managers, call_back=None):
+ super(CatalogApi, self).__init__(config, auth_managers, call_back)
def batch_delete_catalog_objects(self,
body):
@@ -64,7 +62,9 @@ def batch_delete_catalog_objects(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -120,7 +120,9 @@ def batch_retrieve_catalog_objects(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -183,7 +185,9 @@ def batch_upsert_catalog_objects(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -254,7 +258,9 @@ def create_catalog_image(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, files=_files)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -326,7 +332,9 @@ def update_catalog_image(self,
# Prepare and execute request
_request = self.config.http_client.put(_query_url, headers=_headers, files=_files)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -369,7 +377,9 @@ def catalog_info(self):
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -461,7 +471,9 @@ def list_catalog(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -509,7 +521,9 @@ def upsert_catalog_object(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -569,7 +583,9 @@ def delete_catalog_object(self,
# Prepare and execute request
_request = self.config.http_client.delete(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -658,7 +674,9 @@ def retrieve_catalog_object(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -723,7 +741,9 @@ def search_catalog_objects(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -788,7 +808,9 @@ def search_catalog_items(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -839,7 +861,9 @@ def update_item_modifier_lists(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -889,7 +913,9 @@ def update_item_taxes(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
diff --git a/square/api/checkout_api.py b/square/api/checkout_api.py
index f2e1e000..af1758c9 100644
--- a/square/api/checkout_api.py
+++ b/square/api/checkout_api.py
@@ -3,15 +3,13 @@
from square.api_helper import APIHelper
from square.http.api_response import ApiResponse
from square.api.base_api import BaseApi
-from square.http.auth.o_auth_2 import OAuth2
class CheckoutApi(BaseApi):
"""A Controller to access Endpoints in the square API."""
-
- def __init__(self, config, call_back=None):
- super(CheckoutApi, self).__init__(config, call_back)
+ def __init__(self, config, auth_managers, call_back=None):
+ super(CheckoutApi, self).__init__(config, auth_managers, call_back)
def create_checkout(self,
location_id,
@@ -58,7 +56,9 @@ def create_checkout(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
diff --git a/square/api/customer_groups_api.py b/square/api/customer_groups_api.py
index bbd4e2c9..95bc52c4 100644
--- a/square/api/customer_groups_api.py
+++ b/square/api/customer_groups_api.py
@@ -3,15 +3,13 @@
from square.api_helper import APIHelper
from square.http.api_response import ApiResponse
from square.api.base_api import BaseApi
-from square.http.auth.o_auth_2 import OAuth2
class CustomerGroupsApi(BaseApi):
"""A Controller to access Endpoints in the square API."""
-
- def __init__(self, config, call_back=None):
- super(CustomerGroupsApi, self).__init__(config, call_back)
+ def __init__(self, config, auth_managers, call_back=None):
+ super(CustomerGroupsApi, self).__init__(config, auth_managers, call_back)
def list_customer_groups(self,
cursor=None,
@@ -68,7 +66,9 @@ def list_customer_groups(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -117,7 +117,9 @@ def create_customer_group(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -165,7 +167,9 @@ def delete_customer_group(self,
# Prepare and execute request
_request = self.config.http_client.delete(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -214,7 +218,9 @@ def retrieve_customer_group(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -267,7 +273,9 @@ def update_customer_group(self,
# Prepare and execute request
_request = self.config.http_client.put(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
diff --git a/square/api/customer_segments_api.py b/square/api/customer_segments_api.py
index a7429c5b..d263ac91 100644
--- a/square/api/customer_segments_api.py
+++ b/square/api/customer_segments_api.py
@@ -3,15 +3,13 @@
from square.api_helper import APIHelper
from square.http.api_response import ApiResponse
from square.api.base_api import BaseApi
-from square.http.auth.o_auth_2 import OAuth2
class CustomerSegmentsApi(BaseApi):
"""A Controller to access Endpoints in the square API."""
-
- def __init__(self, config, call_back=None):
- super(CustomerSegmentsApi, self).__init__(config, call_back)
+ def __init__(self, config, auth_managers, call_back=None):
+ super(CustomerSegmentsApi, self).__init__(config, auth_managers, call_back)
def list_customer_segments(self,
cursor=None,
@@ -68,7 +66,9 @@ def list_customer_segments(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -118,7 +118,9 @@ def retrieve_customer_segment(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
diff --git a/square/api/customers_api.py b/square/api/customers_api.py
index 9a561fb5..6be187aa 100644
--- a/square/api/customers_api.py
+++ b/square/api/customers_api.py
@@ -4,15 +4,13 @@
from square.api_helper import APIHelper
from square.http.api_response import ApiResponse
from square.api.base_api import BaseApi
-from square.http.auth.o_auth_2 import OAuth2
class CustomersApi(BaseApi):
"""A Controller to access Endpoints in the square API."""
-
- def __init__(self, config, call_back=None):
- super(CustomersApi, self).__init__(config, call_back)
+ def __init__(self, config, auth_managers, call_back=None):
+ super(CustomersApi, self).__init__(config, auth_managers, call_back)
def list_customers(self,
cursor=None,
@@ -84,7 +82,9 @@ def list_customers(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -140,7 +140,9 @@ def create_customer(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -199,7 +201,9 @@ def search_customers(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -271,7 +275,9 @@ def delete_customer(self,
# Prepare and execute request
_request = self.config.http_client.delete(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -319,7 +325,9 @@ def retrieve_customer(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -383,7 +391,9 @@ def update_customer(self,
# Prepare and execute request
_request = self.config.http_client.put(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -443,7 +453,9 @@ def create_customer_card(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -496,7 +508,9 @@ def delete_customer_card(self,
# Prepare and execute request
_request = self.config.http_client.delete(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -551,7 +565,9 @@ def remove_group_from_customer(self,
# Prepare and execute request
_request = self.config.http_client.delete(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -605,7 +621,9 @@ def add_group_to_customer(self,
# Prepare and execute request
_request = self.config.http_client.put(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
diff --git a/square/api/devices_api.py b/square/api/devices_api.py
index b1bbbf88..2b678c40 100644
--- a/square/api/devices_api.py
+++ b/square/api/devices_api.py
@@ -3,15 +3,13 @@
from square.api_helper import APIHelper
from square.http.api_response import ApiResponse
from square.api.base_api import BaseApi
-from square.http.auth.o_auth_2 import OAuth2
class DevicesApi(BaseApi):
"""A Controller to access Endpoints in the square API."""
-
- def __init__(self, config, call_back=None):
- super(DevicesApi, self).__init__(config, call_back)
+ def __init__(self, config, auth_managers, call_back=None):
+ super(DevicesApi, self).__init__(config, auth_managers, call_back)
def list_device_codes(self,
cursor=None,
@@ -73,7 +71,9 @@ def list_device_codes(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -123,7 +123,9 @@ def create_device_code(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -171,7 +173,9 @@ def get_device_code(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
diff --git a/square/api/disputes_api.py b/square/api/disputes_api.py
index 6c4d6502..65b0ce20 100644
--- a/square/api/disputes_api.py
+++ b/square/api/disputes_api.py
@@ -4,15 +4,13 @@
from square.http.api_response import ApiResponse
from square.utilities.file_wrapper import FileWrapper
from square.api.base_api import BaseApi
-from square.http.auth.o_auth_2 import OAuth2
class DisputesApi(BaseApi):
"""A Controller to access Endpoints in the square API."""
-
- def __init__(self, config, call_back=None):
- super(DisputesApi, self).__init__(config, call_back)
+ def __init__(self, config, auth_managers, call_back=None):
+ super(DisputesApi, self).__init__(config, auth_managers, call_back)
def list_disputes(self,
cursor=None,
@@ -73,7 +71,9 @@ def list_disputes(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -122,7 +122,9 @@ def retrieve_dispute(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -176,7 +178,9 @@ def accept_dispute(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -238,7 +242,9 @@ def list_dispute_evidence(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -309,7 +315,9 @@ def create_dispute_evidence_file(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, files=_files)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -363,7 +371,9 @@ def create_dispute_evidence_text(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -419,7 +429,9 @@ def delete_dispute_evidence(self,
# Prepare and execute request
_request = self.config.http_client.delete(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -475,7 +487,9 @@ def retrieve_dispute_evidence(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -532,7 +546,9 @@ def submit_evidence(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
diff --git a/square/api/employees_api.py b/square/api/employees_api.py
index bbf5ef17..f2cf08b1 100644
--- a/square/api/employees_api.py
+++ b/square/api/employees_api.py
@@ -4,15 +4,13 @@
from square.api_helper import APIHelper
from square.http.api_response import ApiResponse
from square.api.base_api import BaseApi
-from square.http.auth.o_auth_2 import OAuth2
class EmployeesApi(BaseApi):
"""A Controller to access Endpoints in the square API."""
-
- def __init__(self, config, call_back=None):
- super(EmployeesApi, self).__init__(config, call_back)
+ def __init__(self, config, auth_managers, call_back=None):
+ super(EmployeesApi, self).__init__(config, auth_managers, call_back)
@deprecated()
def list_employees(self,
@@ -68,7 +66,9 @@ def list_employees(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -117,7 +117,9 @@ def retrieve_employee(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
diff --git a/square/api/gift_card_activities_api.py b/square/api/gift_card_activities_api.py
index 08e7d7e0..893ae9ed 100644
--- a/square/api/gift_card_activities_api.py
+++ b/square/api/gift_card_activities_api.py
@@ -3,15 +3,13 @@
from square.api_helper import APIHelper
from square.http.api_response import ApiResponse
from square.api.base_api import BaseApi
-from square.http.auth.o_auth_2 import OAuth2
class GiftCardActivitiesApi(BaseApi):
"""A Controller to access Endpoints in the square API."""
-
- def __init__(self, config, call_back=None):
- super(GiftCardActivitiesApi, self).__init__(config, call_back)
+ def __init__(self, config, auth_managers, call_back=None):
+ super(GiftCardActivitiesApi, self).__init__(config, auth_managers, call_back)
def list_gift_card_activities(self,
gift_card_id=None,
@@ -109,7 +107,9 @@ def list_gift_card_activities(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -162,7 +162,9 @@ def create_gift_card_activity(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
diff --git a/square/api/gift_cards_api.py b/square/api/gift_cards_api.py
index 6e47584e..baf8300c 100644
--- a/square/api/gift_cards_api.py
+++ b/square/api/gift_cards_api.py
@@ -3,15 +3,13 @@
from square.api_helper import APIHelper
from square.http.api_response import ApiResponse
from square.api.base_api import BaseApi
-from square.http.auth.o_auth_2 import OAuth2
class GiftCardsApi(BaseApi):
"""A Controller to access Endpoints in the square API."""
-
- def __init__(self, config, call_back=None):
- super(GiftCardsApi, self).__init__(config, call_back)
+ def __init__(self, config, auth_managers, call_back=None):
+ super(GiftCardsApi, self).__init__(config, auth_managers, call_back)
def list_gift_cards(self,
mtype=None,
@@ -86,7 +84,9 @@ def list_gift_cards(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -139,7 +139,9 @@ def create_gift_card(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -187,7 +189,9 @@ def retrieve_gift_card_from_gan(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -236,7 +240,9 @@ def retrieve_gift_card_from_nonce(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -290,7 +296,9 @@ def link_customer_to_gift_card(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -344,7 +352,9 @@ def unlink_customer_from_gift_card(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -392,7 +402,9 @@ def retrieve_gift_card(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
diff --git a/square/api/inventory_api.py b/square/api/inventory_api.py
index 50eccb18..5352d711 100644
--- a/square/api/inventory_api.py
+++ b/square/api/inventory_api.py
@@ -4,15 +4,13 @@
from square.api_helper import APIHelper
from square.http.api_response import ApiResponse
from square.api.base_api import BaseApi
-from square.http.auth.o_auth_2 import OAuth2
class InventoryApi(BaseApi):
"""A Controller to access Endpoints in the square API."""
-
- def __init__(self, config, call_back=None):
- super(InventoryApi, self).__init__(config, call_back)
+ def __init__(self, config, auth_managers, call_back=None):
+ super(InventoryApi, self).__init__(config, auth_managers, call_back)
@deprecated()
def deprecated_retrieve_inventory_adjustment(self,
@@ -56,7 +54,9 @@ def deprecated_retrieve_inventory_adjustment(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -106,7 +106,9 @@ def retrieve_inventory_adjustment(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -158,7 +160,9 @@ def deprecated_batch_change_inventory(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -210,7 +214,9 @@ def deprecated_batch_retrieve_inventory_changes(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -262,7 +268,9 @@ def deprecated_batch_retrieve_inventory_counts(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -313,7 +321,9 @@ def batch_change_inventory(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -367,7 +377,9 @@ def batch_retrieve_inventory_changes(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -426,7 +438,9 @@ def batch_retrieve_inventory_counts(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -480,7 +494,9 @@ def deprecated_retrieve_inventory_physical_count(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -531,7 +547,9 @@ def retrieve_inventory_physical_count(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -581,7 +599,9 @@ def retrieve_inventory_transfer(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -651,7 +671,9 @@ def retrieve_inventory_count(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -733,7 +755,9 @@ def retrieve_inventory_changes(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
diff --git a/square/api/invoices_api.py b/square/api/invoices_api.py
index 1188f53c..9ddaa552 100644
--- a/square/api/invoices_api.py
+++ b/square/api/invoices_api.py
@@ -3,15 +3,13 @@
from square.api_helper import APIHelper
from square.http.api_response import ApiResponse
from square.api.base_api import BaseApi
-from square.http.auth.o_auth_2 import OAuth2
class InvoicesApi(BaseApi):
"""A Controller to access Endpoints in the square API."""
-
- def __init__(self, config, call_back=None):
- super(InvoicesApi, self).__init__(config, call_back)
+ def __init__(self, config, auth_managers, call_back=None):
+ super(InvoicesApi, self).__init__(config, auth_managers, call_back)
def list_invoices(self,
location_id,
@@ -70,7 +68,9 @@ def list_invoices(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -122,7 +122,9 @@ def create_invoice(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -179,7 +181,9 @@ def search_invoices(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -243,7 +247,9 @@ def delete_invoice(self,
# Prepare and execute request
_request = self.config.http_client.delete(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -291,7 +297,9 @@ def get_invoice(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -351,7 +359,9 @@ def update_invoice(self,
# Prepare and execute request
_request = self.config.http_client.put(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -408,7 +418,9 @@ def cancel_invoice(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -473,7 +485,9 @@ def publish_invoice(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
diff --git a/square/api/labor_api.py b/square/api/labor_api.py
index e24c1d96..9d39cd03 100644
--- a/square/api/labor_api.py
+++ b/square/api/labor_api.py
@@ -4,15 +4,13 @@
from square.api_helper import APIHelper
from square.http.api_response import ApiResponse
from square.api.base_api import BaseApi
-from square.http.auth.o_auth_2 import OAuth2
class LaborApi(BaseApi):
"""A Controller to access Endpoints in the square API."""
-
- def __init__(self, config, call_back=None):
- super(LaborApi, self).__init__(config, call_back)
+ def __init__(self, config, auth_managers, call_back=None):
+ super(LaborApi, self).__init__(config, auth_managers, call_back)
def list_break_types(self,
location_id=None,
@@ -66,7 +64,9 @@ def list_break_types(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -126,7 +126,9 @@ def create_break_type(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -175,7 +177,9 @@ def delete_break_type(self,
# Prepare and execute request
_request = self.config.http_client.delete(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -223,7 +227,9 @@ def get_break_type(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -276,7 +282,9 @@ def update_break_type(self,
# Prepare and execute request
_request = self.config.http_client.put(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -339,7 +347,9 @@ def list_employee_wages(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -388,7 +398,9 @@ def get_employee_wage(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -453,7 +465,9 @@ def create_shift(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -513,7 +527,9 @@ def search_shifts(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -561,7 +577,9 @@ def delete_shift(self,
# Prepare and execute request
_request = self.config.http_client.delete(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -609,7 +627,9 @@ def get_shift(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -668,7 +688,9 @@ def update_shift(self,
# Prepare and execute request
_request = self.config.http_client.put(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -732,7 +754,9 @@ def list_team_member_wages(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -780,7 +804,9 @@ def get_team_member_wage(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -837,7 +863,9 @@ def list_workweek_configs(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -891,7 +919,9 @@ def update_workweek_config(self,
# Prepare and execute request
_request = self.config.http_client.put(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
diff --git a/square/api/locations_api.py b/square/api/locations_api.py
index 0899d169..727832ac 100644
--- a/square/api/locations_api.py
+++ b/square/api/locations_api.py
@@ -3,20 +3,19 @@
from square.api_helper import APIHelper
from square.http.api_response import ApiResponse
from square.api.base_api import BaseApi
-from square.http.auth.o_auth_2 import OAuth2
class LocationsApi(BaseApi):
"""A Controller to access Endpoints in the square API."""
-
- def __init__(self, config, call_back=None):
- super(LocationsApi, self).__init__(config, call_back)
+ def __init__(self, config, auth_managers, call_back=None):
+ super(LocationsApi, self).__init__(config, auth_managers, call_back)
def list_locations(self):
"""Does a GET request to /v2/locations.
- Provides details about all of the seller's locations,
+ Provides details about all of the seller's
+ [locations](https://developer.squareup.com/docs/locations-api),
including those with an inactive status.
Returns:
@@ -44,7 +43,9 @@ def list_locations(self):
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -103,7 +104,9 @@ def create_location(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -155,7 +158,9 @@ def retrieve_location(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -171,7 +176,8 @@ def update_location(self,
body):
"""Does a PUT request to /v2/locations/{location_id}.
- Updates a location.
+ Updates a
+ [location](https://developer.squareup.com/docs/locations-api).
Args:
location_id (string): The ID of the location to update.
@@ -208,7 +214,9 @@ def update_location(self,
# Prepare and execute request
_request = self.config.http_client.put(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
diff --git a/square/api/loyalty_api.py b/square/api/loyalty_api.py
index 14d0d38a..1b405928 100644
--- a/square/api/loyalty_api.py
+++ b/square/api/loyalty_api.py
@@ -4,15 +4,13 @@
from square.api_helper import APIHelper
from square.http.api_response import ApiResponse
from square.api.base_api import BaseApi
-from square.http.auth.o_auth_2 import OAuth2
class LoyaltyApi(BaseApi):
"""A Controller to access Endpoints in the square API."""
-
- def __init__(self, config, call_back=None):
- super(LoyaltyApi, self).__init__(config, call_back)
+ def __init__(self, config, auth_managers, call_back=None):
+ super(LoyaltyApi, self).__init__(config, auth_managers, call_back)
def create_loyalty_account(self,
body):
@@ -53,7 +51,9 @@ def create_loyalty_account(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -105,7 +105,9 @@ def search_loyalty_accounts(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -154,7 +156,9 @@ def retrieve_loyalty_account(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -180,13 +184,7 @@ def accumulate_loyalty_points(self,
For spend-based and visit-based programs, you can first call
[CalculateLoyaltyPoints]($e/Loyalty/CalculateLoyaltyPoints) to compute
the points
- that you provide to this endpoint.
- __Note:__ The country of the seller's Square account determines
- whether tax is included in the purchase amount when accruing points
- for spend-based and visit-based programs.
- For more information, see [Availability of Square
- Loyalty](https://developer.squareup.com/docs/loyalty-api/overview#loyal
- ty-market-availability).
+ that you provide to this endpoint.
Args:
account_id (string): The [loyalty account]($m/LoyaltyAccount) ID
@@ -224,7 +222,9 @@ def accumulate_loyalty_points(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -282,7 +282,9 @@ def adjust_loyalty_points(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -337,7 +339,9 @@ def search_loyalty_events(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -387,7 +391,9 @@ def list_loyalty_programs(self):
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -443,7 +449,9 @@ def retrieve_loyalty_program(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -460,7 +468,7 @@ def calculate_loyalty_points(self,
"""Does a POST request to /v2/loyalty/programs/{program_id}/calculate.
Calculates the points a purchase earns.
- - If you are using the Orders API to manage orders, you provide
+ - If you are using the Orders API to manage orders, you provide the
`order_id` in the request. The
endpoint calculates the points by reading the order.
- If you are not using the Orders API to manage orders, you provide
@@ -469,12 +477,9 @@ def calculate_loyalty_points(self,
An application might call this endpoint to show the points that a
buyer can earn with the
specific purchase.
- __Note:__ The country of the seller's Square account determines
- whether tax is included in the purchase amount when accruing points
- for spend-based and visit-based programs.
- For more information, see [Availability of Square
- Loyalty](https://developer.squareup.com/docs/loyalty-api/overview#loyal
- ty-market-availability).
+ For spend-based and visit-based programs, the `tax_mode` setting of
+ the accrual rule indicates how taxes should be treated for loyalty
+ points accrual.
Args:
program_id (string): The [loyalty program]($m/LoyaltyProgram) ID,
@@ -512,7 +517,9 @@ def calculate_loyalty_points(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -568,7 +575,9 @@ def create_loyalty_reward(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -621,7 +630,9 @@ def search_loyalty_rewards(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -677,7 +688,9 @@ def delete_loyalty_reward(self,
# Prepare and execute request
_request = self.config.http_client.delete(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -726,7 +739,9 @@ def retrieve_loyalty_reward(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -787,7 +802,9 @@ def redeem_loyalty_reward(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
diff --git a/square/api/merchants_api.py b/square/api/merchants_api.py
index 720d335c..f30570d4 100644
--- a/square/api/merchants_api.py
+++ b/square/api/merchants_api.py
@@ -3,15 +3,13 @@
from square.api_helper import APIHelper
from square.http.api_response import ApiResponse
from square.api.base_api import BaseApi
-from square.http.auth.o_auth_2 import OAuth2
class MerchantsApi(BaseApi):
"""A Controller to access Endpoints in the square API."""
-
- def __init__(self, config, call_back=None):
- super(MerchantsApi, self).__init__(config, call_back)
+ def __init__(self, config, auth_managers, call_back=None):
+ super(MerchantsApi, self).__init__(config, auth_managers, call_back)
def list_merchants(self,
cursor=None):
@@ -63,7 +61,9 @@ def list_merchants(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -113,7 +113,9 @@ def retrieve_merchant(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
diff --git a/square/api/mobile_authorization_api.py b/square/api/mobile_authorization_api.py
index d026fe57..46ddd696 100644
--- a/square/api/mobile_authorization_api.py
+++ b/square/api/mobile_authorization_api.py
@@ -3,15 +3,13 @@
from square.api_helper import APIHelper
from square.http.api_response import ApiResponse
from square.api.base_api import BaseApi
-from square.http.auth.o_auth_2 import OAuth2
class MobileAuthorizationApi(BaseApi):
"""A Controller to access Endpoints in the square API."""
-
- def __init__(self, config, call_back=None):
- super(MobileAuthorizationApi, self).__init__(config, call_back)
+ def __init__(self, config, auth_managers, call_back=None):
+ super(MobileAuthorizationApi, self).__init__(config, auth_managers, call_back)
def create_mobile_authorization_code(self,
body):
@@ -62,7 +60,9 @@ def create_mobile_authorization_code(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
diff --git a/square/api/o_auth_api.py b/square/api/o_auth_api.py
index 55de81e8..5d5f349e 100644
--- a/square/api/o_auth_api.py
+++ b/square/api/o_auth_api.py
@@ -9,9 +9,8 @@
class OAuthApi(BaseApi):
"""A Controller to access Endpoints in the square API."""
-
- def __init__(self, config, call_back=None):
- super(OAuthApi, self).__init__(config, call_back)
+ def __init__(self, config, auth_managers, call_back=None):
+ super(OAuthApi, self).__init__(config, auth_managers, call_back)
@deprecated()
def renew_token(self,
diff --git a/square/api/orders_api.py b/square/api/orders_api.py
index 6cefadd1..fe706944 100644
--- a/square/api/orders_api.py
+++ b/square/api/orders_api.py
@@ -3,15 +3,13 @@
from square.api_helper import APIHelper
from square.http.api_response import ApiResponse
from square.api.base_api import BaseApi
-from square.http.auth.o_auth_2 import OAuth2
class OrdersApi(BaseApi):
"""A Controller to access Endpoints in the square API."""
-
- def __init__(self, config, call_back=None):
- super(OrdersApi, self).__init__(config, call_back)
+ def __init__(self, config, auth_managers, call_back=None):
+ super(OrdersApi, self).__init__(config, auth_managers, call_back)
def create_order(self,
body):
@@ -57,7 +55,9 @@ def create_order(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -107,7 +107,9 @@ def batch_retrieve_orders(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -156,7 +158,9 @@ def calculate_order(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -207,7 +211,9 @@ def clone_order(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -275,7 +281,9 @@ def search_orders(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -323,7 +331,9 @@ def retrieve_order(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -395,7 +405,9 @@ def update_order(self,
# Prepare and execute request
_request = self.config.http_client.put(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -466,7 +478,9 @@ def pay_order(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
diff --git a/square/api/payments_api.py b/square/api/payments_api.py
index 9843f654..5eebd9c1 100644
--- a/square/api/payments_api.py
+++ b/square/api/payments_api.py
@@ -3,15 +3,13 @@
from square.api_helper import APIHelper
from square.http.api_response import ApiResponse
from square.api.base_api import BaseApi
-from square.http.auth.o_auth_2 import OAuth2
class PaymentsApi(BaseApi):
"""A Controller to access Endpoints in the square API."""
-
- def __init__(self, config, call_back=None):
- super(PaymentsApi, self).__init__(config, call_back)
+ def __init__(self, config, auth_managers, call_back=None):
+ super(PaymentsApi, self).__init__(config, auth_managers, call_back)
def list_payments(self,
begin_time=None,
@@ -103,7 +101,9 @@ def list_payments(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -158,7 +158,9 @@ def create_payment(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -221,7 +223,9 @@ def cancel_payment_by_idempotency_key(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -269,7 +273,9 @@ def get_payment(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -324,7 +330,9 @@ def update_payment(self,
# Prepare and execute request
_request = self.config.http_client.put(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -374,7 +382,9 @@ def cancel_payment(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -432,7 +442,9 @@ def complete_payment(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
diff --git a/square/api/refunds_api.py b/square/api/refunds_api.py
index bf1d9765..652f9fb3 100644
--- a/square/api/refunds_api.py
+++ b/square/api/refunds_api.py
@@ -3,15 +3,13 @@
from square.api_helper import APIHelper
from square.http.api_response import ApiResponse
from square.api.base_api import BaseApi
-from square.http.auth.o_auth_2 import OAuth2
class RefundsApi(BaseApi):
"""A Controller to access Endpoints in the square API."""
-
- def __init__(self, config, call_back=None):
- super(RefundsApi, self).__init__(config, call_back)
+ def __init__(self, config, auth_managers, call_back=None):
+ super(RefundsApi, self).__init__(config, auth_managers, call_back)
def list_payment_refunds(self,
begin_time=None,
@@ -53,11 +51,14 @@ def list_payment_refunds(self,
given status are returned. For a list of refund status values,
see [PaymentRefund]($m/PaymentRefund). Default: If omitted,
refunds are returned regardless of their status.
- source_type (string, optional): If provided, only refunds with the
- given source type are returned. - `CARD` - List refunds only
- for payments where `CARD` was specified as the payment source.
- Default: If omitted, refunds are returned regardless of the
- source type.
+ source_type (string, optional): If provided, only returns refunds
+ whose payments have the indicated source type. Current values
+ include `CARD`, `BANK_ACCOUNT`, `WALLET`, `CASH`, and
+ `EXTERNAL`. For information about these payment source types,
+ see [Take
+ Payments](https://developer.squareup.com/docs/payments-api/take
+ -payments). Default: If omitted, refunds are returned
+ regardless of the source type.
limit (int, optional): The maximum number of results to be
returned in a single page. It is possible to receive fewer
results than the specified limit on a given page. If the
@@ -103,7 +104,9 @@ def list_payment_refunds(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -157,7 +160,9 @@ def refund_payment(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -206,7 +211,9 @@ def get_payment_refund(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
diff --git a/square/api/sites_api.py b/square/api/sites_api.py
index 989589b8..7520b321 100644
--- a/square/api/sites_api.py
+++ b/square/api/sites_api.py
@@ -3,15 +3,13 @@
from square.api_helper import APIHelper
from square.http.api_response import ApiResponse
from square.api.base_api import BaseApi
-from square.http.auth.o_auth_2 import OAuth2
class SitesApi(BaseApi):
"""A Controller to access Endpoints in the square API."""
-
- def __init__(self, config, call_back=None):
- super(SitesApi, self).__init__(config, call_back)
+ def __init__(self, config, auth_managers, call_back=None):
+ super(SitesApi, self).__init__(config, auth_managers, call_back)
def list_sites(self):
"""Does a GET request to /v2/sites.
@@ -49,7 +47,9 @@ def list_sites(self):
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
diff --git a/square/api/snippets_api.py b/square/api/snippets_api.py
index e65fb5f6..518cad60 100644
--- a/square/api/snippets_api.py
+++ b/square/api/snippets_api.py
@@ -3,15 +3,13 @@
from square.api_helper import APIHelper
from square.http.api_response import ApiResponse
from square.api.base_api import BaseApi
-from square.http.auth.o_auth_2 import OAuth2
class SnippetsApi(BaseApi):
"""A Controller to access Endpoints in the square API."""
-
- def __init__(self, config, call_back=None):
- super(SnippetsApi, self).__init__(config, call_back)
+ def __init__(self, config, auth_managers, call_back=None):
+ super(SnippetsApi, self).__init__(config, auth_managers, call_back)
def delete_snippet(self,
site_id):
@@ -57,7 +55,9 @@ def delete_snippet(self,
# Prepare and execute request
_request = self.config.http_client.delete(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -114,7 +114,9 @@ def retrieve_snippet(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -179,7 +181,9 @@ def upsert_snippet(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
diff --git a/square/api/subscriptions_api.py b/square/api/subscriptions_api.py
index 20eac9c0..e6fcd8ba 100644
--- a/square/api/subscriptions_api.py
+++ b/square/api/subscriptions_api.py
@@ -3,15 +3,13 @@
from square.api_helper import APIHelper
from square.http.api_response import ApiResponse
from square.api.base_api import BaseApi
-from square.http.auth.o_auth_2 import OAuth2
class SubscriptionsApi(BaseApi):
"""A Controller to access Endpoints in the square API."""
-
- def __init__(self, config, call_back=None):
- super(SubscriptionsApi, self).__init__(config, call_back)
+ def __init__(self, config, auth_managers, call_back=None):
+ super(SubscriptionsApi, self).__init__(config, auth_managers, call_back)
def create_subscription(self,
body):
@@ -58,7 +56,9 @@ def create_subscription(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -122,7 +122,9 @@ def search_subscriptions(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -182,7 +184,9 @@ def retrieve_subscription(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -236,7 +240,9 @@ def update_subscription(self,
# Prepare and execute request
_request = self.config.http_client.put(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -288,7 +294,9 @@ def delete_subscription_action(self,
# Prepare and execute request
_request = self.config.http_client.delete(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -340,7 +348,9 @@ def cancel_subscription(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -412,7 +422,9 @@ def list_subscription_events(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -465,7 +477,9 @@ def pause_subscription(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -519,7 +533,9 @@ def resume_subscription(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -574,7 +590,9 @@ def swap_plan(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
diff --git a/square/api/team_api.py b/square/api/team_api.py
index 8194e9cd..fd7f3365 100644
--- a/square/api/team_api.py
+++ b/square/api/team_api.py
@@ -3,15 +3,13 @@
from square.api_helper import APIHelper
from square.http.api_response import ApiResponse
from square.api.base_api import BaseApi
-from square.http.auth.o_auth_2 import OAuth2
class TeamApi(BaseApi):
"""A Controller to access Endpoints in the square API."""
-
- def __init__(self, config, call_back=None):
- super(TeamApi, self).__init__(config, call_back)
+ def __init__(self, config, auth_managers, call_back=None):
+ super(TeamApi, self).__init__(config, auth_managers, call_back)
def create_team_member(self,
body):
@@ -58,7 +56,9 @@ def create_team_member(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -115,7 +115,9 @@ def bulk_create_team_members(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -172,7 +174,9 @@ def bulk_update_team_members(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -223,7 +227,9 @@ def search_team_members(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -274,7 +280,9 @@ def retrieve_team_member(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -331,7 +339,9 @@ def update_team_member(self,
# Prepare and execute request
_request = self.config.http_client.put(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -384,7 +394,9 @@ def retrieve_wage_setting(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -445,7 +457,9 @@ def update_wage_setting(self,
# Prepare and execute request
_request = self.config.http_client.put(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
diff --git a/square/api/terminal_api.py b/square/api/terminal_api.py
index 65dd4579..58aef43e 100644
--- a/square/api/terminal_api.py
+++ b/square/api/terminal_api.py
@@ -3,15 +3,13 @@
from square.api_helper import APIHelper
from square.http.api_response import ApiResponse
from square.api.base_api import BaseApi
-from square.http.auth.o_auth_2 import OAuth2
class TerminalApi(BaseApi):
"""A Controller to access Endpoints in the square API."""
-
- def __init__(self, config, call_back=None):
- super(TerminalApi, self).__init__(config, call_back)
+ def __init__(self, config, auth_managers, call_back=None):
+ super(TerminalApi, self).__init__(config, auth_managers, call_back)
def create_terminal_checkout(self,
body):
@@ -52,7 +50,9 @@ def create_terminal_checkout(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -101,7 +101,9 @@ def search_terminal_checkouts(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -150,7 +152,9 @@ def get_terminal_checkout(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -200,7 +204,9 @@ def cancel_terminal_checkout(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -249,7 +255,9 @@ def create_terminal_refund(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -298,7 +306,9 @@ def search_terminal_refunds(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -347,7 +357,9 @@ def get_terminal_refund(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -397,7 +409,9 @@ def cancel_terminal_refund(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
diff --git a/square/api/transactions_api.py b/square/api/transactions_api.py
index 1886ac40..4b7518cd 100644
--- a/square/api/transactions_api.py
+++ b/square/api/transactions_api.py
@@ -4,15 +4,13 @@
from square.api_helper import APIHelper
from square.http.api_response import ApiResponse
from square.api.base_api import BaseApi
-from square.http.auth.o_auth_2 import OAuth2
class TransactionsApi(BaseApi):
"""A Controller to access Endpoints in the square API."""
-
- def __init__(self, config, call_back=None):
- super(TransactionsApi, self).__init__(config, call_back)
+ def __init__(self, config, auth_managers, call_back=None):
+ super(TransactionsApi, self).__init__(config, auth_managers, call_back)
@deprecated()
def list_transactions(self,
@@ -91,7 +89,9 @@ def list_transactions(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -144,7 +144,9 @@ def retrieve_transaction(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -202,7 +204,9 @@ def capture_transaction(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -260,7 +264,9 @@ def void_transaction(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
diff --git a/square/api/v1_transactions_api.py b/square/api/v1_transactions_api.py
index aed02568..d9fe83bd 100644
--- a/square/api/v1_transactions_api.py
+++ b/square/api/v1_transactions_api.py
@@ -4,15 +4,13 @@
from square.api_helper import APIHelper
from square.http.api_response import ApiResponse
from square.api.base_api import BaseApi
-from square.http.auth.o_auth_2 import OAuth2
class V1TransactionsApi(BaseApi):
"""A Controller to access Endpoints in the square API."""
-
- def __init__(self, config, call_back=None):
- super(V1TransactionsApi, self).__init__(config, call_back)
+ def __init__(self, config, auth_managers, call_back=None):
+ super(V1TransactionsApi, self).__init__(config, auth_managers, call_back)
@deprecated()
def list_orders(self,
@@ -72,7 +70,9 @@ def list_orders(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -126,7 +126,9 @@ def retrieve_order(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -185,7 +187,9 @@ def update_order(self,
# Prepare and execute request
_request = self.config.http_client.put(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -284,7 +288,9 @@ def list_payments(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -341,7 +347,9 @@ def retrieve_payment(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -427,7 +435,9 @@ def list_refunds(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -494,7 +504,9 @@ def create_refund(self,
# Prepare and execute request
_request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -586,7 +598,9 @@ def list_settlements(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
@@ -659,7 +673,9 @@ def retrieve_settlement(self,
# Prepare and execute request
_request = self.config.http_client.get(_query_url, headers=_headers)
- OAuth2.apply(self.config, _request)
+ # Apply authentication scheme on request
+ self.apply_auth_schemes(_request, 'global')
+
_response = self.execute_request(_request)
decoded = APIHelper.json_deserialize(_response.text)
diff --git a/square/client.py b/square/client.py
index fea49998..9ef934c3 100644
--- a/square/client.py
+++ b/square/client.py
@@ -2,6 +2,7 @@
from square.decorators import lazy_property
from square.configuration import Configuration
+from square.http.auth.o_auth_2 import OAuth2
from square.api.mobile_authorization_api import MobileAuthorizationApi
from square.api.o_auth_api import OAuthApi
from square.api.v1_transactions_api import V1TransactionsApi
@@ -41,155 +42,157 @@ class Client(object):
@staticmethod
def sdk_version():
- return '17.0.0.20211215'
+ return '17.1.0.20220120'
@staticmethod
def square_version():
- return '2021-12-15'
+ return '2022-01-20'
def user_agent_detail(self):
return self.config.user_agent_detail
+ auth = OAuth2
+
@lazy_property
def mobile_authorization(self):
- return MobileAuthorizationApi(self.config)
+ return MobileAuthorizationApi(self.config, self.auth_managers)
@lazy_property
def o_auth(self):
- return OAuthApi(self.config)
+ return OAuthApi(self.config, self.auth_managers)
@lazy_property
def v1_transactions(self):
- return V1TransactionsApi(self.config)
+ return V1TransactionsApi(self.config, self.auth_managers)
@lazy_property
def apple_pay(self):
- return ApplePayApi(self.config)
+ return ApplePayApi(self.config, self.auth_managers)
@lazy_property
def bank_accounts(self):
- return BankAccountsApi(self.config)
+ return BankAccountsApi(self.config, self.auth_managers)
@lazy_property
def bookings(self):
- return BookingsApi(self.config)
+ return BookingsApi(self.config, self.auth_managers)
@lazy_property
def cards(self):
- return CardsApi(self.config)
+ return CardsApi(self.config, self.auth_managers)
@lazy_property
def cash_drawers(self):
- return CashDrawersApi(self.config)
+ return CashDrawersApi(self.config, self.auth_managers)
@lazy_property
def catalog(self):
- return CatalogApi(self.config)
+ return CatalogApi(self.config, self.auth_managers)
@lazy_property
def customers(self):
- return CustomersApi(self.config)
+ return CustomersApi(self.config, self.auth_managers)
@lazy_property
def customer_groups(self):
- return CustomerGroupsApi(self.config)
+ return CustomerGroupsApi(self.config, self.auth_managers)
@lazy_property
def customer_segments(self):
- return CustomerSegmentsApi(self.config)
+ return CustomerSegmentsApi(self.config, self.auth_managers)
@lazy_property
def devices(self):
- return DevicesApi(self.config)
+ return DevicesApi(self.config, self.auth_managers)
@lazy_property
def disputes(self):
- return DisputesApi(self.config)
+ return DisputesApi(self.config, self.auth_managers)
@lazy_property
def employees(self):
- return EmployeesApi(self.config)
+ return EmployeesApi(self.config, self.auth_managers)
@lazy_property
def gift_cards(self):
- return GiftCardsApi(self.config)
+ return GiftCardsApi(self.config, self.auth_managers)
@lazy_property
def gift_card_activities(self):
- return GiftCardActivitiesApi(self.config)
+ return GiftCardActivitiesApi(self.config, self.auth_managers)
@lazy_property
def inventory(self):
- return InventoryApi(self.config)
+ return InventoryApi(self.config, self.auth_managers)
@lazy_property
def invoices(self):
- return InvoicesApi(self.config)
+ return InvoicesApi(self.config, self.auth_managers)
@lazy_property
def labor(self):
- return LaborApi(self.config)
+ return LaborApi(self.config, self.auth_managers)
@lazy_property
def locations(self):
- return LocationsApi(self.config)
+ return LocationsApi(self.config, self.auth_managers)
@lazy_property
def checkout(self):
- return CheckoutApi(self.config)
+ return CheckoutApi(self.config, self.auth_managers)
@lazy_property
def transactions(self):
- return TransactionsApi(self.config)
+ return TransactionsApi(self.config, self.auth_managers)
@lazy_property
def loyalty(self):
- return LoyaltyApi(self.config)
+ return LoyaltyApi(self.config, self.auth_managers)
@lazy_property
def merchants(self):
- return MerchantsApi(self.config)
+ return MerchantsApi(self.config, self.auth_managers)
@lazy_property
def orders(self):
- return OrdersApi(self.config)
+ return OrdersApi(self.config, self.auth_managers)
@lazy_property
def payments(self):
- return PaymentsApi(self.config)
+ return PaymentsApi(self.config, self.auth_managers)
@lazy_property
def refunds(self):
- return RefundsApi(self.config)
+ return RefundsApi(self.config, self.auth_managers)
@lazy_property
def sites(self):
- return SitesApi(self.config)
+ return SitesApi(self.config, self.auth_managers)
@lazy_property
def snippets(self):
- return SnippetsApi(self.config)
+ return SnippetsApi(self.config, self.auth_managers)
@lazy_property
def subscriptions(self):
- return SubscriptionsApi(self.config)
+ return SubscriptionsApi(self.config, self.auth_managers)
@lazy_property
def team(self):
- return TeamApi(self.config)
+ return TeamApi(self.config, self.auth_managers)
@lazy_property
def terminal(self):
- return TerminalApi(self.config)
+ return TerminalApi(self.config, self.auth_managers)
def __init__(self, http_client_instance=None,
override_http_client_configuration=False, timeout=60,
max_retries=0, backoff_factor=2,
retry_statuses=[408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
retry_methods=['GET', 'PUT'], environment='production',
- custom_url='https://connect.squareup.com',
- square_version='2021-12-15', access_token='',
- additional_headers={}, user_agent_detail='', config=None):
+ custom_url='https://connect.squareup.com', access_token='',
+ square_version='2022-01-20', additional_headers={},
+ user_agent_detail='', config=None):
if config is None:
self.config = Configuration(
http_client_instance=http_client_instance,
@@ -201,9 +204,15 @@ def __init__(self, http_client_instance=None,
retry_methods=retry_methods,
environment=environment,
custom_url=custom_url,
- square_version=square_version,
access_token=access_token,
+ square_version=square_version,
additional_headers=additional_headers,
user_agent_detail=user_agent_detail)
else:
self.config = config
+ self.initialize_auth_managers(self.config)
+
+ def initialize_auth_managers(self, config):
+ self.auth_managers = { key: None for key in ['global']}
+ self.auth_managers['global'] = OAuth2(config.access_token)
+ return self.auth_managers
diff --git a/square/configuration.py b/square/configuration.py
index 692f6e20..5320b871 100644
--- a/square/configuration.py
+++ b/square/configuration.py
@@ -49,14 +49,14 @@ def environment(self):
def custom_url(self):
return self._custom_url
- @property
- def square_version(self):
- return self._square_version
-
@property
def access_token(self):
return self._access_token
+ @property
+ def square_version(self):
+ return self._square_version
+
@property
def additional_headers(self):
return deepcopy(self._additional_headers)
@@ -71,8 +71,9 @@ def __init__(
backoff_factor=2,
retry_statuses=[408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
retry_methods=['GET', 'PUT'], environment='production',
- custom_url='https://connect.squareup.com', square_version='2021-12-15',
- access_token='', additional_headers={}, user_agent_detail=''
+ custom_url='https://connect.squareup.com', access_token='',
+ square_version='2022-01-20', additional_headers={},
+ user_agent_detail=''
):
# The Http Client passed from the sdk user for making requests
self._http_client_instance = http_client_instance
@@ -103,15 +104,18 @@ def __init__(
# Sets the base URL requests are made to. Defaults to `https://connect.squareup.com`
self._custom_url = custom_url
- # Square Connect API versions
- self._square_version = square_version
-
# The OAuth 2.0 Access Token to use for API requests.
self._access_token = access_token
+ # Square Connect API versions
+ self._square_version = square_version
+
# Additional headers to add to each API request
self._additional_headers = deepcopy(additional_headers)
+ # User agent detail, to be appended with user-agent header.
+ self._user_agent_detail = Configuration.validate_user_agent(user_agent_detail)
+
# The Http Client to use for making requests.
self._http_client = self.create_http_client()
@@ -119,7 +123,7 @@ def clone_with(self, http_client_instance=None,
override_http_client_configuration=None, timeout=None,
max_retries=None, backoff_factor=None, retry_statuses=None,
retry_methods=None, environment=None, custom_url=None,
- square_version=None, access_token=None,
+ access_token=None, square_version=None,
additional_headers=None, user_agent_detail=None):
http_client_instance = http_client_instance or self.http_client_instance
override_http_client_configuration = override_http_client_configuration or self.override_http_client_configuration
@@ -130,8 +134,8 @@ def clone_with(self, http_client_instance=None,
retry_methods = retry_methods or self.retry_methods
environment = environment or self.environment
custom_url = custom_url or self.custom_url
- square_version = square_version or self.square_version
access_token = access_token or self.access_token
+ square_version = square_version or self.square_version
additional_headers = additional_headers or self.additional_headers
user_agent_detail = user_agent_detail or self.user_agent_detail
@@ -141,8 +145,8 @@ def clone_with(self, http_client_instance=None,
timeout=timeout, max_retries=max_retries,
backoff_factor=backoff_factor, retry_statuses=retry_statuses,
retry_methods=retry_methods, environment=environment,
- custom_url=custom_url, square_version=square_version,
- access_token=access_token, additional_headers=additional_headers,
+ custom_url=custom_url, access_token=access_token,
+ square_version=square_version, additional_headers=additional_headers,
user_agent_detail=user_agent_detail
)
@@ -187,3 +191,9 @@ def get_base_uri(self, server='default'):
return APIHelper.append_url_with_template_parameters(
self.environments[self.environment][server], parameters
)
+
+ @staticmethod
+ def validate_user_agent(user_agent):
+ if len(user_agent) > 128:
+ raise ValueError('The length of user-agent detail should not exceed 128 characters.')
+ return user_agent
diff --git a/square/http/auth/o_auth_2.py b/square/http/auth/o_auth_2.py
index 7486b50c..d0f06aab 100644
--- a/square/http/auth/o_auth_2.py
+++ b/square/http/auth/o_auth_2.py
@@ -3,16 +3,27 @@
class OAuth2:
- @staticmethod
- def apply(config, http_request):
+ def __init__(self, access_token, o_auth_scopes=None):
+ self._access_token = access_token
+ self._o_auth_scopes = o_auth_scopes
+
+ def validate_arguments(self):
+ if self._access_token:
+ return True
+
+ def apply(self, http_request):
""" Add OAuth2 authentication to the request.
- Args:
- config (Configuration): The Configuration object which holds the
- authentication information.
http_request (HttpRequest): The HttpRequest object to which
authentication header will be added.
"""
- token = config.access_token
+ token = self._access_token
http_request.headers['Authorization'] = "Bearer {}".format(token)
+
+ def error_message(self):
+ """Display error message on occurrence of authentication faliure
+ in BearerAuth
+
+ """
+ return "BearerAuth: _access_token is undefined."
diff --git a/tests/api/api_test_base.py b/tests/api/api_test_base.py
index 9115fb82..0e0ebf49 100644
--- a/tests/api/api_test_base.py
+++ b/tests/api/api_test_base.py
@@ -17,8 +17,8 @@ def setUpClass(cls):
cls.request_timeout = 30
cls.assert_precision = 0.01
cls.config = ApiTestBase.create_configuration()
- cls.client = Client()
-
+ cls.client = Client(access_token=cls.config.access_token)
+ cls.auth_managers = cls.client.auth_managers
@staticmethod
def create_configuration():
return Configuration(access_token=os.environ['SQUARE_SANDBOX_TOKEN'],
diff --git a/tests/api/test_catalog_api.py b/tests/api/test_catalog_api.py
index b253a57a..babc64f6 100644
--- a/tests/api/test_catalog_api.py
+++ b/tests/api/test_catalog_api.py
@@ -16,7 +16,7 @@ class CatalogApiTests(ApiTestBase):
def setUpClass(cls):
super(CatalogApiTests, cls).setUpClass()
cls.response_catcher = HttpResponseCatcher()
- cls.controller = CatalogApi(cls.config, cls.response_catcher)
+ cls.controller = CatalogApi(cls.config, cls.auth_managers, cls.response_catcher)
# Returns information about the Square Catalog API, such as batch size
#limits for `BatchUpsertCatalogObjects`.
diff --git a/tests/api/test_customers_api.py b/tests/api/test_customers_api.py
index 73176ec9..8a5dbdd8 100644
--- a/tests/api/test_customers_api.py
+++ b/tests/api/test_customers_api.py
@@ -18,7 +18,7 @@ class CustomersApiTests(ApiTestBase):
def setUpClass(cls):
super(CustomersApiTests, cls).setUpClass()
cls.response_catcher = HttpResponseCatcher()
- cls.controller = CustomersApi(cls.config, cls.response_catcher)
+ cls.controller = CustomersApi(cls.config, cls.auth_managers, cls.response_catcher)
# Creates a new customer for a business, which can have associated cards on file.
#
diff --git a/tests/api/test_employees_api.py b/tests/api/test_employees_api.py
index 9c4483b5..c1531a1f 100644
--- a/tests/api/test_employees_api.py
+++ b/tests/api/test_employees_api.py
@@ -18,7 +18,7 @@ class EmployeesApiTests(ApiTestBase):
def setUpClass(cls):
super(EmployeesApiTests, cls).setUpClass()
cls.response_catcher = HttpResponseCatcher()
- cls.controller = EmployeesApi(cls.config, cls.response_catcher)
+ cls.controller = EmployeesApi(cls.config, cls.auth_managers, cls.response_catcher)
# Gets a list of `Employee` objects for a business.
def test_test_list_employees(self):
diff --git a/tests/api/test_labor_api.py b/tests/api/test_labor_api.py
index f5520581..021b7880 100644
--- a/tests/api/test_labor_api.py
+++ b/tests/api/test_labor_api.py
@@ -18,7 +18,7 @@ class LaborApiTests(ApiTestBase):
def setUpClass(cls):
super(LaborApiTests, cls).setUpClass()
cls.response_catcher = HttpResponseCatcher()
- cls.controller = LaborApi(cls.config, cls.response_catcher)
+ cls.controller = LaborApi(cls.config, cls.auth_managers, cls.response_catcher)
# Returns a paginated list of `BreakType` instances for a business.
def test_list_break_types(self):
diff --git a/tests/api/test_locations_api.py b/tests/api/test_locations_api.py
index 76c85e4e..2eb967c2 100644
--- a/tests/api/test_locations_api.py
+++ b/tests/api/test_locations_api.py
@@ -16,9 +16,9 @@ class LocationsApiTests(ApiTestBase):
def setUpClass(cls):
super(LocationsApiTests, cls).setUpClass()
cls.response_catcher = HttpResponseCatcher()
- cls.controller = LocationsApi(cls.config, cls.response_catcher)
+ cls.controller = LocationsApi(cls.config, cls.auth_managers, cls.response_catcher)
- # Provides details about all of the seller's locations,
+ # Provides details about all of the seller's [locations](https://developer.squareup.com/docs/locations-api),
#including those with an inactive status.
def test_list_locations(self):
diff --git a/tests/api/test_merchants_api.py b/tests/api/test_merchants_api.py
index 7b9b8f28..9b69dfe1 100644
--- a/tests/api/test_merchants_api.py
+++ b/tests/api/test_merchants_api.py
@@ -18,7 +18,7 @@ class MerchantsApiTests(ApiTestBase):
def setUpClass(cls):
super(MerchantsApiTests, cls).setUpClass()
cls.response_catcher = HttpResponseCatcher()
- cls.controller = MerchantsApi(cls.config, cls.response_catcher)
+ cls.controller = MerchantsApi(cls.config, cls.auth_managers, cls.response_catcher)
# Returns `Merchant` information for a given access token.
#
diff --git a/tests/api/test_payments_api.py b/tests/api/test_payments_api.py
index 40405952..8c2fbbe2 100644
--- a/tests/api/test_payments_api.py
+++ b/tests/api/test_payments_api.py
@@ -18,7 +18,7 @@ class PaymentsApiTests(ApiTestBase):
def setUpClass(cls):
super(PaymentsApiTests, cls).setUpClass()
cls.response_catcher = HttpResponseCatcher()
- cls.controller = PaymentsApi(cls.config, cls.response_catcher)
+ cls.controller = PaymentsApi(cls.config, cls.auth_managers, cls.response_catcher)
# Retrieves a list of payments taken by the account making the request.
#
diff --git a/tests/api/test_refunds_api.py b/tests/api/test_refunds_api.py
index 611e891d..536adda0 100644
--- a/tests/api/test_refunds_api.py
+++ b/tests/api/test_refunds_api.py
@@ -18,7 +18,7 @@ class RefundsApiTests(ApiTestBase):
def setUpClass(cls):
super(RefundsApiTests, cls).setUpClass()
cls.response_catcher = HttpResponseCatcher()
- cls.controller = RefundsApi(cls.config, cls.response_catcher)
+ cls.controller = RefundsApi(cls.config, cls.auth_managers, cls.response_catcher)
# Retrieves a list of refunds for the account making the request.
#
diff --git a/tests/api/v2_endpoints_tests.py b/tests/api/v2_endpoints_tests.py
index 40e6729b..5234b11e 100644
--- a/tests/api/v2_endpoints_tests.py
+++ b/tests/api/v2_endpoints_tests.py
@@ -18,7 +18,7 @@ class V2EndpointsTests(ApiTestBase):
def setUpClass(cls):
super(V2EndpointsTests, cls).setUpClass()
cls.response_catcher = HttpResponseCatcher()
- cls.controller = CustomersApi(cls.config, cls.response_catcher)
+ cls.controller = CustomersApi(cls.config, cls.auth_managers, cls.response_catcher)
def test_v2_endpoints_journey(self):
phone_number, phone_number2 = "1-212-555-4240", "1-917-500-1000"