Hello, thank you for the great sdk. I'm running into an issues, that I've narrowed to what I think is a bug in the sdk.
throws an error because in this range there is a refunded order.
raceback (most recent call last):
File "/Users/eroncancio/dev/comidalista/python3/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "/Users/eroncancio/dev/comidalista/python3/lib/python3.7/site-packages/django/core/handlers/base.py", line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/Users/eroncancio/dev/comidalista/python3/lib/python3.7/site-packages/django/core/handlers/base.py", line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/Users/eroncancio/dev/comidalista/mysite/comidalista/views.py", line 65, in square_orders
square.refresh_orders(location)
File "/Users/eroncancio/dev/comidalista/mysite/comidalista/squareup.py", line 121, in refresh_orders
orders = api.search_orders(body=search_request).orders
File "/Users/eroncancio/dev/comidalista/python3/lib/python3.7/site-packages/squareconnect/apis/orders_api.py", line 287, in search_orders
callback=params.get('callback'))
File "/Users/eroncancio/dev/comidalista/python3/lib/python3.7/site-packages/squareconnect/api_client.py", line 316, in call_api
response_type, auth_settings, callback)
File "/Users/eroncancio/dev/comidalista/python3/lib/python3.7/site-packages/squareconnect/api_client.py", line 149, in __call_api
deserialized_data = self.deserialize(response_data, response_type)
File "/Users/eroncancio/dev/comidalista/python3/lib/python3.7/site-packages/squareconnect/api_client.py", line 236, in deserialize
return self.__deserialize(data, response_type)
File "/Users/eroncancio/dev/comidalista/python3/lib/python3.7/site-packages/squareconnect/api_client.py", line 279, in __deserialize
return self.__deserialize_model(data, klass)
File "/Users/eroncancio/dev/comidalista/python3/lib/python3.7/site-packages/squareconnect/api_client.py", line 569, in __deserialize_model
setattr(instance, attr, self.__deserialize(value, attr_type))
File "/Users/eroncancio/dev/comidalista/python3/lib/python3.7/site-packages/squareconnect/api_client.py", line 254, in __deserialize
for sub_data in data]
File "/Users/eroncancio/dev/comidalista/python3/lib/python3.7/site-packages/squareconnect/api_client.py", line 254, in <listcomp>
for sub_data in data]
File "/Users/eroncancio/dev/comidalista/python3/lib/python3.7/site-packages/squareconnect/api_client.py", line 279, in __deserialize
return self.__deserialize_model(data, klass)
File "/Users/eroncancio/dev/comidalista/python3/lib/python3.7/site-packages/squareconnect/api_client.py", line 569, in __deserialize_model
setattr(instance, attr, self.__deserialize(value, attr_type))
File "/Users/eroncancio/dev/comidalista/python3/lib/python3.7/site-packages/squareconnect/api_client.py", line 279, in __deserialize
return self.__deserialize_model(data, klass)
File "/Users/eroncancio/dev/comidalista/python3/lib/python3.7/site-packages/squareconnect/api_client.py", line 569, in __deserialize_model
setattr(instance, attr, self.__deserialize(value, attr_type))
File "/Users/eroncancio/dev/comidalista/python3/lib/python3.7/site-packages/squareconnect/api_client.py", line 279, in __deserialize
return self.__deserialize_model(data, klass)
File "/Users/eroncancio/dev/comidalista/python3/lib/python3.7/site-packages/squareconnect/api_client.py", line 569, in __deserialize_model
setattr(instance, attr, self.__deserialize(value, attr_type))
File "/Users/eroncancio/dev/comidalista/python3/lib/python3.7/site-packages/squareconnect/models/money.py", line 76, in amount
raise ValueError("Invalid value for `amount`, must be a value greater than or equal to `0`")
ValueError: Invalid value for `amount`, must be a value greater than or equal to `0`
{
"orders": [
{
"id": "5lz72ezvoM6ZP3nBUBbfcOmeV",
"location_id": "BVXZNP19P4B8M",
"created_at": "2019-05-18T04:50:13.000Z",
"updated_at": "2019-05-18T04:50:13.000Z",
"state": "COMPLETED",
"total_tax_money": {
"amount": 0,
"currency": "COP"
},
"total_discount_money": {
"amount": 0,
"currency": "COP"
},
"total_tip_money": {
"amount": 0,
"currency": "COP"
},
"total_money": {
"amount": 0,
"currency": "COP"
},
"closed_at": "2019-05-18T04:50:14.000Z",
"total_service_charge_money": {
"amount": 0,
"currency": "COP"
},
"returns": [
{
"source_order_id": "lfB1KZ2yjD5bUB20818Fbc0eV",
"return_line_items": [
{
"uid": "fbfdb44f-0915-4a28-8919-0d9b094ae45b:W0DbiIEocS2gwvsYty85S",
"source_line_item_uid": "2179bb79-91c8-49bc-b961-93973d1305ac",
"name": "Mazorcada",
"quantity": "1",
"catalog_object_id": "6AXBWS766ZTXVODWS5WNL4KE",
"variation_name": "9-59",
"return_taxes": [
{
"uid": "4a414b61-0429-410a-8be6-b80c6ad6414d",
"catalog_object_id": "5GMRKM2QFGT6YVGK3ZBZRKGI",
"name": "Ipoconsumo",
"type": "INCLUSIVE",
"percentage": "8",
"applied_money": {
"amount": 62992,
"currency": "COP"
},
"scope": "LINE_ITEM"
},
{
"uid": "d12cfe7d-da61-455d-b2b6-9fe13d49b8b2",
"catalog_object_id": "LE7U5EGXLAPW5AYWY5EOHSTG",
"name": "IVA",
"type": "INCLUSIVE",
"percentage": "19",
"applied_money": {
"amount": 149606,
"currency": "COP"
},
"scope": "LINE_ITEM"
}
],
"base_price_money": {
"amount": 1000000,
"currency": "COP"
},
"variation_total_price_money": {
"amount": 1000000,
"currency": "COP"
},
"gross_return_money": {
"amount": 787402,
"currency": "COP"
},
"total_tax_money": {
"amount": 212598,
"currency": "COP"
},
"total_discount_money": {
"amount": 0,
"currency": "COP"
},
"total_money": {
"amount": 1000000,
"currency": "COP"
}
},
{
"uid": "fbfdb44f-0915-4a28-8919-0d9b094ae45b:OucU6xkdpI2KqcMcBGA6S",
"source_line_item_uid": "26640888-31ad-4ef0-bfa0-5d4d4cc4806e",
"name": "Adición Pollo",
"quantity": "1",
"catalog_object_id": "D2NR5EFTBKZLNSA6ODARYFBQ",
"variation_name": "",
"return_taxes": [
{
"uid": "4a414b61-0429-410a-8be6-b80c6ad6414d",
"catalog_object_id": "5GMRKM2QFGT6YVGK3ZBZRKGI",
"name": "Ipoconsumo",
"type": "INCLUSIVE",
"percentage": "8",
"applied_money": {
"amount": 22222,
"currency": "COP"
},
"scope": "LINE_ITEM"
}
],
"base_price_money": {
"amount": 300000,
"currency": "COP"
},
"variation_total_price_money": {
"amount": 300000,
"currency": "COP"
},
"gross_return_money": {
"amount": 277778,
"currency": "COP"
},
"total_tax_money": {
"amount": 22222,
"currency": "COP"
},
"total_discount_money": {
"amount": 0,
"currency": "COP"
},
"total_money": {
"amount": 300000,
"currency": "COP"
}
},
{
"uid": "fbfdb44f-0915-4a28-8919-0d9b094ae45b:ED3XWoBHwQcwvce4V965S",
"source_line_item_uid": "ffcbd1c2-8398-4cee-bff5-35126ab063b5",
"name": "Tacos",
"quantity": "2",
"catalog_object_id": "CHQCX5K6EUHFXP33ZOR2YMPO",
"variation_name": "",
"return_taxes": [
{
"uid": "4a414b61-0429-410a-8be6-b80c6ad6414d",
"catalog_object_id": "5GMRKM2QFGT6YVGK3ZBZRKGI",
"name": "Ipoconsumo",
"type": "INCLUSIVE",
"percentage": "8",
"applied_money": {
"amount": 7407,
"currency": "COP"
},
"scope": "LINE_ITEM"
}
],
"base_price_money": {
"amount": 50000,
"currency": "COP"
},
"variation_total_price_money": {
"amount": 100000,
"currency": "COP"
},
"gross_return_money": {
"amount": 92593,
"currency": "COP"
},
"total_tax_money": {
"amount": 7407,
"currency": "COP"
},
"total_discount_money": {
"amount": 0,
"currency": "COP"
},
"total_money": {
"amount": 100000,
"currency": "COP"
}
},
{
"uid": "fbfdb44f-0915-4a28-8919-0d9b094ae45b:KaVbb0E4egQ2qctd6Pu5S",
"source_line_item_uid": "79375281-4a3c-494e-be3b-3d7b451e1747",
"name": "Adición Sobrebarriga",
"quantity": "1",
"catalog_object_id": "AEZPFVELAFRBB4Z57B7F7HLQ",
"variation_name": "Normal",
"return_taxes": [
{
"uid": "4a414b61-0429-410a-8be6-b80c6ad6414d",
"catalog_object_id": "5GMRKM2QFGT6YVGK3ZBZRKGI",
"name": "Ipoconsumo",
"type": "INCLUSIVE",
"percentage": "8",
"applied_money": {
"amount": 22222,
"currency": "COP"
},
"scope": "LINE_ITEM"
}
],
"base_price_money": {
"amount": 300000,
"currency": "COP"
},
"variation_total_price_money": {
"amount": 300000,
"currency": "COP"
},
"gross_return_money": {
"amount": 277778,
"currency": "COP"
},
"total_tax_money": {
"amount": 22222,
"currency": "COP"
},
"total_discount_money": {
"amount": 0,
"currency": "COP"
},
"total_money": {
"amount": 300000,
"currency": "COP"
}
},
{
"uid": "fbfdb44f-0915-4a28-8919-0d9b094ae45b:ojAo4lZrD3kcYvxHSHy5S",
"source_line_item_uid": "6f72ea40-ec2c-45c8-85a3-88e278e2d979",
"name": "Adición Pollo",
"quantity": "1",
"catalog_object_id": "D2NR5EFTBKZLNSA6ODARYFBQ",
"variation_name": "",
"return_taxes": [
{
"uid": "4a414b61-0429-410a-8be6-b80c6ad6414d",
"catalog_object_id": "5GMRKM2QFGT6YVGK3ZBZRKGI",
"name": "Ipoconsumo",
"type": "INCLUSIVE",
"percentage": "8",
"applied_money": {
"amount": 22223,
"currency": "COP"
},
"scope": "LINE_ITEM"
}
],
"base_price_money": {
"amount": 300000,
"currency": "COP"
},
"variation_total_price_money": {
"amount": 300000,
"currency": "COP"
},
"gross_return_money": {
"amount": 277777,
"currency": "COP"
},
"total_tax_money": {
"amount": 22223,
"currency": "COP"
},
"total_discount_money": {
"amount": 0,
"currency": "COP"
},
"total_money": {
"amount": 300000,
"currency": "COP"
}
}
],
"return_taxes": [
{
"uid": "4a414b61-0429-410a-8be6-b80c6ad6414d",
"catalog_object_id": "5GMRKM2QFGT6YVGK3ZBZRKGI",
"name": "Ipoconsumo",
"type": "INCLUSIVE",
"percentage": "8",
"applied_money": {
"amount": 137066,
"currency": "COP"
},
"scope": "LINE_ITEM"
},
{
"uid": "d12cfe7d-da61-455d-b2b6-9fe13d49b8b2",
"catalog_object_id": "LE7U5EGXLAPW5AYWY5EOHSTG",
"name": "IVA",
"type": "INCLUSIVE",
"percentage": "19",
"applied_money": {
"amount": 149606,
"currency": "COP"
},
"scope": "LINE_ITEM"
}
]
}
],
"return_amounts": {
"total_money": {
"amount": 2000000,
"currency": "COP"
},
"tax_money": {
"amount": 286672,
"currency": "COP"
},
"discount_money": {
"amount": 0,
"currency": "COP"
},
"tip_money": {
"amount": 0,
"currency": "COP"
},
"service_charge_money": {
"amount": 0,
"currency": "COP"
}
},
"net_amounts": {
"total_money": {
"amount": -2000000,
"currency": "COP"
},
"tax_money": {
"amount": -286672,
"currency": "COP"
},
"discount_money": {
"amount": 0,
"currency": "COP"
},
"tip_money": {
"amount": 0,
"currency": "COP"
},
"service_charge_money": {
"amount": 0,
"currency": "COP"
}
},
"refunds": [
{
"id": "8BmWczV2O6oietHro7q5S",
"location_id": "BVXZNP19P4B8M",
"transaction_id": "lfB1KZ2yjD5bUB20818Fbc0eV",
"tender_id": "xF7wXYLmlfKNsdMaZkltKQB",
"created_at": "2019-05-18T04:50:13Z",
"reason": "Cargo accidental",
"amount_money": {
"amount": 2000000,
"currency": "COP"
},
"status": "APPROVED"
}
]
}
]
}