From 802352135f9cb0ebc50ff5eaa3290411ad3bfa8f Mon Sep 17 00:00:00 2001 From: Connect API Specification Generator Date: Tue, 27 Mar 2018 15:27:24 +0000 Subject: [PATCH] Release 2.6.0 --- .travis.yml | 5 +- CHANGES.md | 12 ++++ docs/CatalogCategory.md | 2 +- docs/CatalogDiscount.md | 2 +- docs/CatalogItem.md | 2 +- docs/CatalogModifier.md | 2 +- docs/CatalogModifierList.md | 2 +- docs/CatalogTax.md | 2 +- docs/CreateOrderRequestModifier.md | 6 +- docs/ErrorCode.md | 2 + docs/Order.md | 4 +- docs/OrderLineItem.md | 2 +- docs/OrdersApi.md | 2 +- docs/TransactionsApi.md | 2 +- setup.py | 2 +- squareconnect/api_client.py | 2 - squareconnect/apis/orders_api.py | 2 +- squareconnect/apis/transactions_api.py | 2 +- squareconnect/configuration.py | 2 +- squareconnect/models/catalog_category.py | 5 -- squareconnect/models/catalog_discount.py | 5 -- squareconnect/models/catalog_item.py | 5 -- .../models/catalog_item_variation.py | 4 +- squareconnect/models/catalog_modifier.py | 5 -- squareconnect/models/catalog_modifier_list.py | 5 -- squareconnect/models/catalog_tax.py | 5 -- .../models/create_order_request_discount.py | 4 +- .../models/create_order_request_line_item.py | 12 ++-- .../models/create_order_request_modifier.py | 65 +++++++++++++++++-- .../models/create_order_request_tax.py | 4 +- squareconnect/models/order.py | 10 +++ squareconnect/models/order_line_item.py | 27 ++++++++ .../models/order_line_item_discount.py | 15 +++++ .../models/order_line_item_modifier.py | 10 +++ squareconnect/models/order_line_item_tax.py | 15 +++++ squareconnect/rest.py | 5 +- 36 files changed, 188 insertions(+), 70 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9328287..af38976 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,10 +13,9 @@ before_install: -in ./travis-ci/accounts.enc -out ./travis-ci/accounts.json -d deploy: provider: pypi - user: "tpan_square" + user: square-developers password: - secure: rngvPf7jkMGuL/REyGSEKKdRxDLUEMLtCx6PQJMaA/V5LqD2LK+QOLZkMH0c44VDfVAt28A+CKa/mrx3kdPWJGvn3kQS/avoNiQiIO98gFVIUxxPZpuHoLK7ip6lp/10NjQyVqknFzk5xYvdp/4Ff4P76+oIe+cWRidNXW+lgqNo4cdL4d1KFHq/OMofdqIrpj3cEeiBb4QT1J6vfOl8nItJ70Byzg2GyudMrFC7IN8e1pdKEmgQ/+9Rtt5Kw3lXesOLz+U6/aDMiVDfwE/Lg8lhJnK7YGB0T8yDIEpncV39NJ2N6BLGqg7jgmqw85bwGCO2U0/0yg5l2zoPs8QuXhKTkgX8c8hdl7xlKYDjcdkr/Wmav2pYBwLBkQnsqZ4OlpBqaXOWyTEfUDCxTmMLOjf4gv9INUYZls3TEYAi2PMLEqrarBwCWB12y8SvvoZ0dwKsW1I6F38rlk0hzJqSgJDyj/lmPQRAzp4lvDGZrDLuc0hQB6fub/QiKvUQLdWiNcK0pB7tYx5W8as2W5FWijMVHHor+yOsG1q5R2lKZ5j2vjJFECXukVncuagKJWBRJ0gIRdeRp8geDT6yQrtage5P3vwqfv3F5ZYeMG1KmVyTzljvUaWIBuWPksrD8Ugqn1kESV3mXqAEMfCT/AA0ZsZs0hUKa5p85J457n2vz0A= + secure: er/LmuRiJPiGNr60bWJXtwbwpbd6AxxnJOF3Rps6NIs8d1o9w7rd5d8Fe0OjMKHYStjF9LZPUQAVddQC9ZB56p56Brjm20+aG2o12MKqH4GRRhZZ5oM92g3331QZkeSS4Op5JWJc5eNEohyIcWNzMyi8dX7C281aCta+gL4GsfxeMr83WvHSulsU+J4eszFkPKqha+5H+xHT57/NWfUVM3j06jsasAauivT12JvD4BLmxVEfoCLDlC3Q/vFHXjDPTQPi38SzQXd3pb7SwFRx8cJpf8y9E6oaKLEH/ZGr/6AA0xKSUWh/N4dl9FuqTDZdOCARZvAFub8CzRJIO1UoxOTVz5fEWTiHLWAr4ENj0R9u/fdUOztlPAhpP+0gVkfUm6jeEZCOkEazUH2IUw7WX2XhmwhGMVdeG85CjGYvdJat2mEFg1qz2ACW7N2mJfoMmtGzSB5p7bU6hZrfbb4cT9vrwQXHYl7BRGalNaLN5tKrqNtGgUXYGWylQT2ILWnkJRWYD2ygvNE73VWR0f/rIMzHjzcJCTQiqV4ZvQV3ppWmJYbgfjFGvhxPEO2VlksPbL+hafhRzoKBofcvUNFHJKo3p/ABOA3g/YQK6ClVZebUsFWwnFPn8Fas0EsfyXS1N7jyESVkfu2dsQw3PRYXJF7kv3XwPQKAipsmA6BWHcc= on: branch: master repo: square/connect-python-sdk - diff --git a/CHANGES.md b/CHANGES.md index b5be1d7..fd9a7b7 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,17 @@ # Change Log +## Version 2.6.0 (2018-03-27) + +### Improvements: Orders API + +* `BatchRetrieveOrders` will now return uncharged orders. + +### New features: Orders API + +* For Catalog-backed line items, setting `CreateOrderRequestLineItem.base_price_money` will now override + the catalog item variation's price. +* `CreateOrderRequestModifier`s may now be created ad hoc using the new `name` and `base_price_money` fields. + ## Version 2.5.1 (2017-11-10) * `ordinal` is added to `CatalogItemVariation` diff --git a/docs/CatalogCategory.md b/docs/CatalogCategory.md index 7ac319f..61fdfd0 100644 --- a/docs/CatalogCategory.md +++ b/docs/CatalogCategory.md @@ -8,7 +8,7 @@ A category to which an [CatalogItem](#type-catalogitem) belongs in the Catalog o ## Properties Name | Type | Notes ------------ | ------------- | ------------- -**name** | **str** | +**name** | **str** | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/CatalogDiscount.md b/docs/CatalogDiscount.md index 5173eb6..2df12b9 100644 --- a/docs/CatalogDiscount.md +++ b/docs/CatalogDiscount.md @@ -8,7 +8,7 @@ A discount in the Catalog object model. ## Properties Name | Type | Notes ------------ | ------------- | ------------- -**name** | **str** | +**name** | **str** | [optional] **discount_type** | **str** | [optional] **percentage** | **str** | [optional] **amount_money** | [**Money**](Money.md) | [optional] diff --git a/docs/CatalogItem.md b/docs/CatalogItem.md index d45c1c3..e423239 100644 --- a/docs/CatalogItem.md +++ b/docs/CatalogItem.md @@ -8,7 +8,7 @@ An item (i.e., product family) in the Catalog object model. ## Properties Name | Type | Notes ------------ | ------------- | ------------- -**name** | **str** | +**name** | **str** | [optional] **description** | **str** | [optional] **abbreviation** | **str** | [optional] **label_color** | **str** | [optional] diff --git a/docs/CatalogModifier.md b/docs/CatalogModifier.md index af01b07..5ea8c7c 100644 --- a/docs/CatalogModifier.md +++ b/docs/CatalogModifier.md @@ -8,7 +8,7 @@ A modifier in the Catalog object model. ## Properties Name | Type | Notes ------------ | ------------- | ------------- -**name** | **str** | +**name** | **str** | [optional] **price_money** | [**Money**](Money.md) | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/CatalogModifierList.md b/docs/CatalogModifierList.md index b324d33..3441003 100644 --- a/docs/CatalogModifierList.md +++ b/docs/CatalogModifierList.md @@ -8,7 +8,7 @@ A modifier list in the Catalog object model. A [CatalogModifierList](#type-catal ## Properties Name | Type | Notes ------------ | ------------- | ------------- -**name** | **str** | +**name** | **str** | [optional] **selection_type** | **str** | [optional] **modifiers** | [**list[CatalogObject]**](CatalogObject.md) | [optional] diff --git a/docs/CatalogTax.md b/docs/CatalogTax.md index 8801e25..1d776be 100644 --- a/docs/CatalogTax.md +++ b/docs/CatalogTax.md @@ -8,7 +8,7 @@ A tax in the Catalog object model. ## Properties Name | Type | Notes ------------ | ------------- | ------------- -**name** | **str** | +**name** | **str** | [optional] **calculation_phase** | **str** | [optional] **inclusion_type** | **str** | [optional] **percentage** | **str** | [optional] diff --git a/docs/CreateOrderRequestModifier.md b/docs/CreateOrderRequestModifier.md index 840911e..8ee763b 100644 --- a/docs/CreateOrderRequestModifier.md +++ b/docs/CreateOrderRequestModifier.md @@ -3,12 +3,14 @@ ### Description -Represents a modifier applied to a single line item. +Represents a modifier applied to a single line item. Modifiers can reference existing objects in a merchant catalog or be constructed ad hoc at the time of purchase by providing a name and price. ## Properties Name | Type | Notes ------------ | ------------- | ------------- -**catalog_object_id** | **str** | +**catalog_object_id** | **str** | [optional] +**name** | **str** | [optional] +**base_price_money** | [**Money**](Money.md) | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/ErrorCode.md b/docs/ErrorCode.md index 0737298..5c9c817 100644 --- a/docs/ErrorCode.md +++ b/docs/ErrorCode.md @@ -70,6 +70,7 @@ Name | Type **REFUND_ALREADY_PENDING** | string **PAYMENT_NOT_REFUNDABLE** | string **INVALID_CARD_DATA** | string +**LOCATION_MISMATCH** | string **IDEMPOTENCY_KEY_REUSED** | string **UNEXPECTED_VALUE** | string **SANDBOX_NOT_SUPPORTED** | string @@ -88,6 +89,7 @@ Name | Type **RATE_LIMITED** | string **NOT_IMPLEMENTED** | string **SERVICE_UNAVAILABLE** | string +**GATEWAY_TIMEOUT** | string [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/Order.md b/docs/Order.md index 6f2800c..99b5f0b 100644 --- a/docs/Order.md +++ b/docs/Order.md @@ -9,9 +9,9 @@ Contains all information related to a single order to process with Square, inclu Name | Type | Notes ------------ | ------------- | ------------- **id** | **str** | [optional] -**location_id** | **str** | [optional] +**location_id** | **str** | **reference_id** | **str** | [optional] -**line_items** | [**list[OrderLineItem]**](OrderLineItem.md) | [optional] +**line_items** | [**list[OrderLineItem]**](OrderLineItem.md) | **total_money** | [**Money**](Money.md) | [optional] **total_tax_money** | [**Money**](Money.md) | [optional] **total_discount_money** | [**Money**](Money.md) | [optional] diff --git a/docs/OrderLineItem.md b/docs/OrderLineItem.md index 906db49..15358d4 100644 --- a/docs/OrderLineItem.md +++ b/docs/OrderLineItem.md @@ -9,7 +9,7 @@ Represents a line item in an order. Each line item describes a different product Name | Type | Notes ------------ | ------------- | ------------- **name** | **str** | [optional] -**quantity** | **str** | [optional] +**quantity** | **str** | **note** | **str** | [optional] **catalog_object_id** | **str** | [optional] **variation_name** | **str** | [optional] diff --git a/docs/OrdersApi.md b/docs/OrdersApi.md index d4918f4..ffe0747 100644 --- a/docs/OrdersApi.md +++ b/docs/OrdersApi.md @@ -15,7 +15,7 @@ Method | HTTP request ### Description -Retrieves a set of [Order](#type-order)s by their IDs. Only orders that have been successfully charged are included in the response. If any of the order IDs in the request do not exist, or are associated with uncharged orders, then those orders will not be included in the set of orders in the response. Note that in the future, uncharged orders may be returned by this endpoint. +Retrieves a set of [Order](#type-order)s by their IDs. If a provided Order ID does not exist, it is ignored instead of resulting in an error. ### Parameters diff --git a/docs/TransactionsApi.md b/docs/TransactionsApi.md index 2641a8a..9d0f700 100644 --- a/docs/TransactionsApi.md +++ b/docs/TransactionsApi.md @@ -44,7 +44,7 @@ Assign your **Access Token** from developer portal to the authorization paramete ### Description -Charges a card represented by a card nonce or a customer's card on file. Your request to this endpoint must include _either_: - A value for the `card_nonce` parameter (to charge a card nonce generated with the `SqPaymentForm`) - Values for the `customer_card_id` and `customer_id` parameters (to charge a customer's card on file) In order for an e-commerce payment to potentially qualify for [Square chargeback protection](https://squareup.com/help/article/5394), you _must_ provide values for the following parameters in your request: - `buyer_email_address` - At least one of `billing_address` or `shipping_address` When this response is returned, the amount of Square's processing fee might not yet be calculated. To obtain the processing fee, wait about ten seconds and call [RetrieveTransaction](#endpoint-retrievetransaction). See the `processing_fee_money` field of each [Tender included](#type-tender) in the transaction. +Charges a card represented by a card nonce or a customer's card on file. Your request to this endpoint must include _either_: - A value for the `card_nonce` parameter (to charge a card nonce generated with the `SqPaymentForm`) - Values for the `customer_card_id` and `customer_id` parameters (to charge a customer's card on file) In order for an eCommerce payment to potentially qualify for [Square chargeback protection](https://squareup.com/help/article/5394), you _must_ provide values for the following parameters in your request: - `buyer_email_address` - At least one of `billing_address` or `shipping_address` When this response is returned, the amount of Square's processing fee might not yet be calculated. To obtain the processing fee, wait about ten seconds and call [RetrieveTransaction](#endpoint-retrievetransaction). See the `processing_fee_money` field of each [Tender included](#type-tender) in the transaction. ### Parameters diff --git a/setup.py b/setup.py index a2a8bad..b263123 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ from setuptools import setup, find_packages NAME = "squareconnect" -VERSION = "2.5.1" +VERSION = "2.6.0" diff --git a/squareconnect/api_client.py b/squareconnect/api_client.py index 484839b..359fe74 100644 --- a/squareconnect/api_client.py +++ b/squareconnect/api_client.py @@ -137,8 +137,6 @@ def __call_api(self, resource_path, method, # body if body: body = self.sanitize_for_serialization(body) - else: - body = json.loads('{}') # request url url = self.host + resource_path diff --git a/squareconnect/apis/orders_api.py b/squareconnect/apis/orders_api.py index e3cfb56..d6ea2f0 100644 --- a/squareconnect/apis/orders_api.py +++ b/squareconnect/apis/orders_api.py @@ -49,7 +49,7 @@ def __init__(self, api_client=None): def batch_retrieve_orders(self, location_id, body, **kwargs): """ BatchRetrieveOrders - Retrieves a set of [Order](#type-order)s by their IDs. Only orders that have been successfully charged are included in the response. If any of the order IDs in the request do not exist, or are associated with uncharged orders, then those orders will not be included in the set of orders in the response. Note that in the future, uncharged orders may be returned by this endpoint. + Retrieves a set of [Order](#type-order)s by their IDs. If a provided Order ID does not exist, it is ignored instead of resulting in an error. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function diff --git a/squareconnect/apis/transactions_api.py b/squareconnect/apis/transactions_api.py index d73d96c..d51e902 100644 --- a/squareconnect/apis/transactions_api.py +++ b/squareconnect/apis/transactions_api.py @@ -133,7 +133,7 @@ def capture_transaction(self, location_id, transaction_id, **kwargs): def charge(self, location_id, body, **kwargs): """ Charge - Charges a card represented by a card nonce or a customer's card on file. Your request to this endpoint must include _either_: - A value for the `card_nonce` parameter (to charge a card nonce generated with the `SqPaymentForm`) - Values for the `customer_card_id` and `customer_id` parameters (to charge a customer's card on file) In order for an e-commerce payment to potentially qualify for [Square chargeback protection](https://squareup.com/help/article/5394), you _must_ provide values for the following parameters in your request: - `buyer_email_address` - At least one of `billing_address` or `shipping_address` When this response is returned, the amount of Square's processing fee might not yet be calculated. To obtain the processing fee, wait about ten seconds and call [RetrieveTransaction](#endpoint-retrievetransaction). See the `processing_fee_money` field of each [Tender included](#type-tender) in the transaction. + Charges a card represented by a card nonce or a customer's card on file. Your request to this endpoint must include _either_: - A value for the `card_nonce` parameter (to charge a card nonce generated with the `SqPaymentForm`) - Values for the `customer_card_id` and `customer_id` parameters (to charge a customer's card on file) In order for an eCommerce payment to potentially qualify for [Square chargeback protection](https://squareup.com/help/article/5394), you _must_ provide values for the following parameters in your request: - `buyer_email_address` - At least one of `billing_address` or `shipping_address` When this response is returned, the amount of Square's processing fee might not yet be calculated. To obtain the processing fee, wait about ten seconds and call [RetrieveTransaction](#endpoint-retrievetransaction). See the `processing_fee_money` field of each [Tender included](#type-tender) in the transaction. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function diff --git a/squareconnect/configuration.py b/squareconnect/configuration.py index 81fd6d5..6eb1327 100644 --- a/squareconnect/configuration.py +++ b/squareconnect/configuration.py @@ -242,5 +242,5 @@ def to_debug_report(self): "OS: {env}\n"\ "Python Version: {pyversion}\n"\ "Version of the API: 2.0\n"\ - "SDK Package Version: 2.5.1".\ + "SDK Package Version: 2.6.0".\ format(env=sys.platform, pyversion=sys.version) diff --git a/squareconnect/models/catalog_category.py b/squareconnect/models/catalog_category.py index 752654b..0095b69 100644 --- a/squareconnect/models/catalog_category.py +++ b/squareconnect/models/catalog_category.py @@ -67,11 +67,6 @@ def name(self, name): :type: str """ - if name is None: - raise ValueError("Invalid value for `name`, must not be `None`") - if len(name) < 1: - raise ValueError("Invalid value for `name`, length must be greater than or equal to `1`") - self._name = name def to_dict(self): diff --git a/squareconnect/models/catalog_discount.py b/squareconnect/models/catalog_discount.py index 37dec41..a75a599 100644 --- a/squareconnect/models/catalog_discount.py +++ b/squareconnect/models/catalog_discount.py @@ -82,11 +82,6 @@ def name(self, name): :type: str """ - if name is None: - raise ValueError("Invalid value for `name`, must not be `None`") - if len(name) < 1: - raise ValueError("Invalid value for `name`, length must be greater than or equal to `1`") - self._name = name @property diff --git a/squareconnect/models/catalog_item.py b/squareconnect/models/catalog_item.py index 4cfe4eb..3a68641 100644 --- a/squareconnect/models/catalog_item.py +++ b/squareconnect/models/catalog_item.py @@ -106,11 +106,6 @@ def name(self, name): :type: str """ - if name is None: - raise ValueError("Invalid value for `name`, must not be `None`") - if len(name) < 1: - raise ValueError("Invalid value for `name`, length must be greater than or equal to `1`") - self._name = name @property diff --git a/squareconnect/models/catalog_item_variation.py b/squareconnect/models/catalog_item_variation.py index fd66d44..2327da2 100644 --- a/squareconnect/models/catalog_item_variation.py +++ b/squareconnect/models/catalog_item_variation.py @@ -155,7 +155,7 @@ def sku(self, sku): def upc(self): """ Gets the upc of this CatalogItemVariation. - The item variation's UPC, if any. Searchable. + The item variation's UPC, if any. Searchable in the Connect API. This field is only exposed in the Connect API. It is not exposed in Square's Dashboard, Square Point of Sale app or Retail Point of Sale app. :return: The upc of this CatalogItemVariation. :rtype: str @@ -166,7 +166,7 @@ def upc(self): def upc(self, upc): """ Sets the upc of this CatalogItemVariation. - The item variation's UPC, if any. Searchable. + The item variation's UPC, if any. Searchable in the Connect API. This field is only exposed in the Connect API. It is not exposed in Square's Dashboard, Square Point of Sale app or Retail Point of Sale app. :param upc: The upc of this CatalogItemVariation. :type: str diff --git a/squareconnect/models/catalog_modifier.py b/squareconnect/models/catalog_modifier.py index 33b7a01..c8aa9ec 100644 --- a/squareconnect/models/catalog_modifier.py +++ b/squareconnect/models/catalog_modifier.py @@ -70,11 +70,6 @@ def name(self, name): :type: str """ - if name is None: - raise ValueError("Invalid value for `name`, must not be `None`") - if len(name) < 1: - raise ValueError("Invalid value for `name`, length must be greater than or equal to `1`") - self._name = name @property diff --git a/squareconnect/models/catalog_modifier_list.py b/squareconnect/models/catalog_modifier_list.py index 6299c54..29f93d0 100644 --- a/squareconnect/models/catalog_modifier_list.py +++ b/squareconnect/models/catalog_modifier_list.py @@ -73,11 +73,6 @@ def name(self, name): :type: str """ - if name is None: - raise ValueError("Invalid value for `name`, must not be `None`") - if len(name) < 1: - raise ValueError("Invalid value for `name`, length must be greater than or equal to `1`") - self._name = name @property diff --git a/squareconnect/models/catalog_tax.py b/squareconnect/models/catalog_tax.py index 266aa30..5e4f90b 100644 --- a/squareconnect/models/catalog_tax.py +++ b/squareconnect/models/catalog_tax.py @@ -82,11 +82,6 @@ def name(self, name): :type: str """ - if name is None: - raise ValueError("Invalid value for `name`, must not be `None`") - if len(name) < 1: - raise ValueError("Invalid value for `name`, length must be greater than or equal to `1`") - self._name = name @property diff --git a/squareconnect/models/create_order_request_discount.py b/squareconnect/models/create_order_request_discount.py index 79b17af..e77f159 100644 --- a/squareconnect/models/create_order_request_discount.py +++ b/squareconnect/models/create_order_request_discount.py @@ -59,7 +59,7 @@ def __init__(self, catalog_object_id=None, name=None, percentage=None, amount_mo def catalog_object_id(self): """ Gets the catalog_object_id of this CreateOrderRequestDiscount. - Only used for catalog taxes. The catalog object ID from exsiting [CatalogDiscount](#type-catalogdiscount). Do not provide a value for this field if you provide values in other fields for an ad hoc discount. + Only used for catalog discounts. The catalog object ID for an existing [CatalogDiscount](#type-catalogdiscount). Do not provide a value for this field if you provide values in other fields for an ad hoc discount. :return: The catalog_object_id of this CreateOrderRequestDiscount. :rtype: str @@ -70,7 +70,7 @@ def catalog_object_id(self): def catalog_object_id(self, catalog_object_id): """ Sets the catalog_object_id of this CreateOrderRequestDiscount. - Only used for catalog taxes. The catalog object ID from exsiting [CatalogDiscount](#type-catalogdiscount). Do not provide a value for this field if you provide values in other fields for an ad hoc discount. + Only used for catalog discounts. The catalog object ID for an existing [CatalogDiscount](#type-catalogdiscount). Do not provide a value for this field if you provide values in other fields for an ad hoc discount. :param catalog_object_id: The catalog_object_id of this CreateOrderRequestDiscount. :type: str diff --git a/squareconnect/models/create_order_request_line_item.py b/squareconnect/models/create_order_request_line_item.py index 086aa12..fbfbcb8 100644 --- a/squareconnect/models/create_order_request_line_item.py +++ b/squareconnect/models/create_order_request_line_item.py @@ -74,7 +74,7 @@ def __init__(self, name=None, quantity=None, base_price_money=None, variation_na def name(self): """ Gets the name of this CreateOrderRequestLineItem. - Only used for ad hoc line items. The name of the line item. This value cannot exceed 500 characters. Do not provide a value for this field if you provide values in catalog_object_id. + Only used for ad hoc line items. The name of the line item. This value cannot exceed 500 characters. Do not provide a value for this field if you provide a value for `catalog_object_id`. :return: The name of this CreateOrderRequestLineItem. :rtype: str @@ -85,7 +85,7 @@ def name(self): def name(self, name): """ Sets the name of this CreateOrderRequestLineItem. - Only used for ad hoc line items. The name of the line item. This value cannot exceed 500 characters. Do not provide a value for this field if you provide values in catalog_object_id. + Only used for ad hoc line items. The name of the line item. This value cannot exceed 500 characters. Do not provide a value for this field if you provide a value for `catalog_object_id`. :param name: The name of this CreateOrderRequestLineItem. :type: str @@ -132,7 +132,7 @@ def quantity(self, quantity): def base_price_money(self): """ Gets the base_price_money of this CreateOrderRequestLineItem. - Only used for ad hoc line items. The base price for a single unit of the line item's associated variation. Do not provide a value for this field if you provide a value for the `catalog_object_id`. + The base price for a single unit of the line item. `base_price_money` is required for ad hoc line items and variable priced [CatalogItemVariation](#type-catalogitemvariation)s. If both `catalog_object_id` and `base_price_money` are set, `base_price_money` will override the CatalogItemVariation's price. :return: The base_price_money of this CreateOrderRequestLineItem. :rtype: Money @@ -143,7 +143,7 @@ def base_price_money(self): def base_price_money(self, base_price_money): """ Sets the base_price_money of this CreateOrderRequestLineItem. - Only used for ad hoc line items. The base price for a single unit of the line item's associated variation. Do not provide a value for this field if you provide a value for the `catalog_object_id`. + The base price for a single unit of the line item. `base_price_money` is required for ad hoc line items and variable priced [CatalogItemVariation](#type-catalogitemvariation)s. If both `catalog_object_id` and `base_price_money` are set, `base_price_money` will override the CatalogItemVariation's price. :param base_price_money: The base_price_money of this CreateOrderRequestLineItem. :type: Money @@ -211,7 +211,7 @@ def note(self, note): def catalog_object_id(self): """ Gets the catalog_object_id of this CreateOrderRequestLineItem. - Only used for Catalog line items. The catalog object ID from existing [CatalogItemVariation](#type-catalogitemvariation). Do not provide a value for this field if you provide a value for `name` and `base_price_money`. + Only used for Catalog line items. The catalog object ID for an existing [CatalogItemVariation](#type-catalogitemvariation). Do not provide a value for this field if you provide a value for `name` and `base_price_money`. :return: The catalog_object_id of this CreateOrderRequestLineItem. :rtype: str @@ -222,7 +222,7 @@ def catalog_object_id(self): def catalog_object_id(self, catalog_object_id): """ Sets the catalog_object_id of this CreateOrderRequestLineItem. - Only used for Catalog line items. The catalog object ID from existing [CatalogItemVariation](#type-catalogitemvariation). Do not provide a value for this field if you provide a value for `name` and `base_price_money`. + Only used for Catalog line items. The catalog object ID for an existing [CatalogItemVariation](#type-catalogitemvariation). Do not provide a value for this field if you provide a value for `name` and `base_price_money`. :param catalog_object_id: The catalog_object_id of this CreateOrderRequestLineItem. :type: str diff --git a/squareconnect/models/create_order_request_modifier.py b/squareconnect/models/create_order_request_modifier.py index 90f3aac..e51a022 100644 --- a/squareconnect/models/create_order_request_modifier.py +++ b/squareconnect/models/create_order_request_modifier.py @@ -27,7 +27,7 @@ class CreateOrderRequestModifier(object): NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ - def __init__(self, catalog_object_id=None): + def __init__(self, catalog_object_id=None, name=None, base_price_money=None): """ CreateOrderRequestModifier - a model defined in Swagger @@ -37,14 +37,20 @@ def __init__(self, catalog_object_id=None): and the value is json key in definition. """ self.swagger_types = { - 'catalog_object_id': 'str' + 'catalog_object_id': 'str', + 'name': 'str', + 'base_price_money': 'Money' } self.attribute_map = { - 'catalog_object_id': 'catalog_object_id' + 'catalog_object_id': 'catalog_object_id', + 'name': 'name', + 'base_price_money': 'base_price_money' } self._catalog_object_id = catalog_object_id + self._name = name + self._base_price_money = base_price_money @property def catalog_object_id(self): @@ -71,11 +77,60 @@ def catalog_object_id(self, catalog_object_id): raise ValueError("Invalid value for `catalog_object_id`, must not be `None`") if len(catalog_object_id) > 192: raise ValueError("Invalid value for `catalog_object_id`, length must be less than `192`") - if len(catalog_object_id) < 1: - raise ValueError("Invalid value for `catalog_object_id`, length must be greater than or equal to `1`") self._catalog_object_id = catalog_object_id + @property + def name(self): + """ + Gets the name of this CreateOrderRequestModifier. + Only used for ad hoc modifiers. The name of the modifier. `name` cannot exceed 255 characters. Do not provide a value for `name` if you provide a value for `catalog_object_id`. + + :return: The name of this CreateOrderRequestModifier. + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """ + Sets the name of this CreateOrderRequestModifier. + Only used for ad hoc modifiers. The name of the modifier. `name` cannot exceed 255 characters. Do not provide a value for `name` if you provide a value for `catalog_object_id`. + + :param name: The name of this CreateOrderRequestModifier. + :type: str + """ + + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") + if len(name) > 255: + raise ValueError("Invalid value for `name`, length must be less than `255`") + + self._name = name + + @property + def base_price_money(self): + """ + Gets the base_price_money of this CreateOrderRequestModifier. + Only used for ad hoc modifiers. The base price for the modifier. Do not provide a value for `base_price_money` if you provide a value for `catalog_object_id`. + + :return: The base_price_money of this CreateOrderRequestModifier. + :rtype: Money + """ + return self._base_price_money + + @base_price_money.setter + def base_price_money(self, base_price_money): + """ + Sets the base_price_money of this CreateOrderRequestModifier. + Only used for ad hoc modifiers. The base price for the modifier. Do not provide a value for `base_price_money` if you provide a value for `catalog_object_id`. + + :param base_price_money: The base_price_money of this CreateOrderRequestModifier. + :type: Money + """ + + self._base_price_money = base_price_money + def to_dict(self): """ Returns the model properties as a dict diff --git a/squareconnect/models/create_order_request_tax.py b/squareconnect/models/create_order_request_tax.py index b024b9c..fc9220e 100644 --- a/squareconnect/models/create_order_request_tax.py +++ b/squareconnect/models/create_order_request_tax.py @@ -87,7 +87,7 @@ def catalog_object_id(self, catalog_object_id): def name(self): """ Gets the name of this CreateOrderRequestTax. - Only used for ad hoc taxes. The tax's name. Do not provide a value for this field if you set catalog_object_id. + Only used for ad hoc taxes. The tax's name. Do not provide a value for this field if you set `catalog_object_id`. :return: The name of this CreateOrderRequestTax. :rtype: str @@ -98,7 +98,7 @@ def name(self): def name(self, name): """ Sets the name of this CreateOrderRequestTax. - Only used for ad hoc taxes. The tax's name. Do not provide a value for this field if you set catalog_object_id. + Only used for ad hoc taxes. The tax's name. Do not provide a value for this field if you set `catalog_object_id`. :param name: The name of this CreateOrderRequestTax. :type: str diff --git a/squareconnect/models/order.py b/squareconnect/models/order.py index e7e7ef1..cfc3db2 100644 --- a/squareconnect/models/order.py +++ b/squareconnect/models/order.py @@ -108,6 +108,11 @@ def location_id(self, location_id): :type: str """ + if location_id is None: + raise ValueError("Invalid value for `location_id`, must not be `None`") + if len(location_id) < 1: + raise ValueError("Invalid value for `location_id`, length must be greater than or equal to `1`") + self._location_id = location_id @property @@ -131,6 +136,11 @@ def reference_id(self, reference_id): :type: str """ + if reference_id is None: + raise ValueError("Invalid value for `reference_id`, must not be `None`") + if len(reference_id) > 40: + raise ValueError("Invalid value for `reference_id`, length must be less than `40`") + self._reference_id = reference_id @property diff --git a/squareconnect/models/order_line_item.py b/squareconnect/models/order_line_item.py index 670a1db..e29c0ee 100644 --- a/squareconnect/models/order_line_item.py +++ b/squareconnect/models/order_line_item.py @@ -103,6 +103,11 @@ def name(self, name): :type: str """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") + if len(name) > 500: + raise ValueError("Invalid value for `name`, length must be less than `500`") + self._name = name @property @@ -126,6 +131,13 @@ def quantity(self, quantity): :type: str """ + if quantity is None: + raise ValueError("Invalid value for `quantity`, must not be `None`") + if len(quantity) > 5: + raise ValueError("Invalid value for `quantity`, length must be less than `5`") + if len(quantity) < 1: + raise ValueError("Invalid value for `quantity`, length must be greater than or equal to `1`") + self._quantity = quantity @property @@ -149,6 +161,11 @@ def note(self, note): :type: str """ + if note is None: + raise ValueError("Invalid value for `note`, must not be `None`") + if len(note) > 50: + raise ValueError("Invalid value for `note`, length must be less than `50`") + self._note = note @property @@ -172,6 +189,11 @@ def catalog_object_id(self, catalog_object_id): :type: str """ + if catalog_object_id is None: + raise ValueError("Invalid value for `catalog_object_id`, must not be `None`") + if len(catalog_object_id) > 192: + raise ValueError("Invalid value for `catalog_object_id`, length must be less than `192`") + self._catalog_object_id = catalog_object_id @property @@ -195,6 +217,11 @@ def variation_name(self, variation_name): :type: str """ + if variation_name is None: + raise ValueError("Invalid value for `variation_name`, must not be `None`") + if len(variation_name) > 255: + raise ValueError("Invalid value for `variation_name`, length must be less than `255`") + self._variation_name = variation_name @property diff --git a/squareconnect/models/order_line_item_discount.py b/squareconnect/models/order_line_item_discount.py index 9ac8c96..d8ffb56 100644 --- a/squareconnect/models/order_line_item_discount.py +++ b/squareconnect/models/order_line_item_discount.py @@ -85,6 +85,11 @@ def catalog_object_id(self, catalog_object_id): :type: str """ + if catalog_object_id is None: + raise ValueError("Invalid value for `catalog_object_id`, must not be `None`") + if len(catalog_object_id) > 192: + raise ValueError("Invalid value for `catalog_object_id`, length must be less than `192`") + self._catalog_object_id = catalog_object_id @property @@ -108,6 +113,11 @@ def name(self, name): :type: str """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") + if len(name) > 255: + raise ValueError("Invalid value for `name`, length must be less than `255`") + self._name = name @property @@ -154,6 +164,11 @@ def percentage(self, percentage): :type: str """ + if percentage is None: + raise ValueError("Invalid value for `percentage`, must not be `None`") + if len(percentage) > 10: + raise ValueError("Invalid value for `percentage`, length must be less than `10`") + self._percentage = percentage @property diff --git a/squareconnect/models/order_line_item_modifier.py b/squareconnect/models/order_line_item_modifier.py index ece2f72..d17674c 100644 --- a/squareconnect/models/order_line_item_modifier.py +++ b/squareconnect/models/order_line_item_modifier.py @@ -76,6 +76,11 @@ def catalog_object_id(self, catalog_object_id): :type: str """ + if catalog_object_id is None: + raise ValueError("Invalid value for `catalog_object_id`, must not be `None`") + if len(catalog_object_id) > 192: + raise ValueError("Invalid value for `catalog_object_id`, length must be less than `192`") + self._catalog_object_id = catalog_object_id @property @@ -99,6 +104,11 @@ def name(self, name): :type: str """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") + if len(name) > 255: + raise ValueError("Invalid value for `name`, length must be less than `255`") + self._name = name @property diff --git a/squareconnect/models/order_line_item_tax.py b/squareconnect/models/order_line_item_tax.py index 064fa4a..ac46b3a 100644 --- a/squareconnect/models/order_line_item_tax.py +++ b/squareconnect/models/order_line_item_tax.py @@ -79,6 +79,11 @@ def catalog_object_id(self, catalog_object_id): :type: str """ + if catalog_object_id is None: + raise ValueError("Invalid value for `catalog_object_id`, must not be `None`") + if len(catalog_object_id) > 192: + raise ValueError("Invalid value for `catalog_object_id`, length must be less than `192`") + self._catalog_object_id = catalog_object_id @property @@ -102,6 +107,11 @@ def name(self, name): :type: str """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") + if len(name) > 255: + raise ValueError("Invalid value for `name`, length must be less than `255`") + self._name = name @property @@ -148,6 +158,11 @@ def percentage(self, percentage): :type: str """ + if percentage is None: + raise ValueError("Invalid value for `percentage`, must not be `None`") + if len(percentage) > 10: + raise ValueError("Invalid value for `percentage`, length must be less than `10`") + self._percentage = percentage @property diff --git a/squareconnect/rest.py b/squareconnect/rest.py index 7b3aff2..991221c 100644 --- a/squareconnect/rest.py +++ b/squareconnect/rest.py @@ -170,8 +170,11 @@ def request(self, method, url, query_params=None, headers=None, if query_params: url += '?' + urlencode(query_params) if headers['Content-Type'] == 'application/json': + request_body = None + if body is not None: + request_body = json.dumps(body) r = self.pool_manager.request(method, url, - body=json.dumps(body), + body=request_body, headers=headers) if headers['Content-Type'] == 'application/x-www-form-urlencoded': r = self.pool_manager.request(method, url,