Skip to content

Commit

Permalink
Merge pull request #43 from Komtet/feature/tests_for_product_practica…
Browse files Browse the repository at this point in the history
…l_in_order_positions

Тесты для подакцизного товара в позиции заказа
  • Loading branch information
a1723 authored Jul 28, 2023
2 parents 7c32f53 + aa2a871 commit 54f6d37
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 24 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ Changelog
Unreleased
----------

7.1.3 (25.07.2023)
------------------
- Тесты для подакцизного товара в позиции заказа

7.1.2 (30.12.2022)
------------------
- Поддержка типа маркировки `gs10` на v2
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='komtet_kassa_sdk',
version='7.1.2',
version='7.1.3',
license='MIT',
description='Python SDK for KOMTET Kassa',

Expand Down Expand Up @@ -37,4 +37,4 @@
install_requires=[
'requests'
]
)
)
2 changes: 1 addition & 1 deletion src/komtet_kassa_sdk/v2/agent.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

# coding: utf-8

class AgentType(object):
"""Типы признака агента по предмету расчета"""
Expand Down
18 changes: 9 additions & 9 deletions tests/v1/order/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def test_order(self):
order.add_position(oid='1', type='product', name='position name1', price=555.0)
order.add_position(oid='2', type='product', name='position name2', price=100.0,
quantity=5, vat=VatRate.RATE_10, measure_name='kg')
order.add_position(oid='3', type='product', name='position name3', price=555.0,
order.add_position(oid='3', type='product_practical', name='position name3', price=555.0,
excise=19.89, country_code='643',
declaration_number='10129000/220817/0211234')

Expand Down Expand Up @@ -63,7 +63,7 @@ def test_order(self):
},
{
"order_item_id": '3',
"type": "product",
"type": "product_practical",
"name": "position name3",
"price": 555.0,
"quantity": 1,
Expand Down Expand Up @@ -92,7 +92,7 @@ def test_order_with_callback_url(self):
date_end="2018-02-28 15:20")
order.set_description('Комментарий к заказу')
order.add_position(oid='1', type='product', name='position name1', price=555.0)
order.add_position(oid='2', type='product', name='position name2', price=100.0,
order.add_position(oid='2', type='product_practical', name='position name2', price=100.0,
quantity=5, vat=VatRate.RATE_10, measure_name='kg')

order.add_callback_url('https://callback_url.ru')
Expand Down Expand Up @@ -123,7 +123,7 @@ def test_order_with_callback_url(self):
},
{
"order_item_id": '2',
"type": "product",
"type": "product_practical",
"name": "position name2",
"price": 100.0,
"quantity": 5,
Expand Down Expand Up @@ -220,7 +220,7 @@ def test_create_order_success(self):
date_end='2019-04-12 13:00')
order.add_position(oid='1', type='product', name='Демо-товар 2', vat='10', quantity=5,
price=1500.0, total=1500.0)
order.add_position(oid='2', type='delivery', name="Доставка", price=500)
order.add_position(oid='2', type='service', name="Доставка", price=500)

order_info = self.client.create_order(order)
self.assertIsInstance(order_info, OrderInfo)
Expand Down Expand Up @@ -260,7 +260,7 @@ def test_update_order_success(self):
date_end='2019-04-12 13:00')
order.add_position(oid='1', type='product', name='Демо-товар 2', vat='10', quantity=5,
price=1500.0, total=1500.0)
order.add_position(oid='2', type='delivery', name="Доставка", price=500)
order.add_position(oid='2', type='service', name="Доставка", price=500)

order_info = self.client.update_order(775, order)
self.assertIsInstance(order_info, OrderInfo)
Expand Down Expand Up @@ -311,7 +311,7 @@ def test_create_order_with_callback_url_success(self):
date_end='2019-04-12 13:00')
order.add_position(oid='1', type='product', name='Демо-товар 2', vat='10', quantity=5,
price=1500.0, total=1500.0)
order.add_position(oid='2', type='delivery', name="Доставка", price=500)
order.add_position(oid='2', type='service', name="Доставка", price=500)

order.add_callback_url('https://calback_url.ru')

Expand Down Expand Up @@ -363,7 +363,7 @@ def test_apply_correction_positions(self):

order.add_position(oid='1', type='product', name='Позиция 1', vat='10', quantity=2,
price=Decimal('42.4'), total=Decimal(84.5))
order.add_position(oid='2', type='delivery', name="Доставка", price=10)
order.add_position(oid='2', type='service', name="Доставка", price=10)
order.apply_correction_positions()
self.assertEqual(len(order['items']), 3)

Expand Down Expand Up @@ -489,7 +489,7 @@ def test_create_order_success(self):
order.add_position(oid='1', type='product', name='Демо-товар 2', vat='10', quantity=5,
price=1500.0, total=1500.0, agent=agent)

order.add_position(oid='2', type='delivery', name="Доставка", price=500)
order.add_position(oid='2', type='service', name="Доставка", price=500)

order_info = self.client.create_order(order)
self.assertIsInstance(order_info, OrderInfo)
Expand Down
24 changes: 12 additions & 12 deletions tests/v2/order/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def test_order(self):
order.add_item(OrderItem(id=2, name='Пицца пеперони', price=600, quantity=5,
measure=0, total=3000, type='product', vat=VatRate.RATE_10))
order.add_item(OrderItem(id=3, name='Пицца барбекю', price=555, quantity=1,
measure=0, type='product', excise=19.89, country_code='643',
measure=0, type='product_practical', excise=19.89, country_code='643',
declaration_number='10129000/220817/0211234'))

expected = {
Expand Down Expand Up @@ -84,7 +84,7 @@ def test_order(self):
'price': 555,
'quantity': 1,
'total': 555,
'type': 'product',
'type': 'product_practical',
'vat': 'no'
}
],
Expand All @@ -108,7 +108,7 @@ def test_order_with_callback_url(self):
order.set_delivery_time('01.01.2021 12:00', '01.01.2021 13:00')
order.set_description('Комментарий к заказу')
order.add_item(OrderItem(id=1, name='Пицца маргарита', price=500, quantity=1, product_id=15,
measure=0, total=500, type='product', external_id=10,
measure=0, total=500, type='product_practical', external_id=10,
user_data='Дополнительный реквизит предмета расчета'))

order.add_callback_url('https://callback_url.ru')
Expand Down Expand Up @@ -146,7 +146,7 @@ def test_order_with_callback_url(self):
'price': 500,
'quantity': 1,
'total': 500,
'type': 'product',
'type': 'product_practical',
'vat': 'no',
'product_id': 15,
'user_data': 'Дополнительный реквизит предмета расчета'
Expand Down Expand Up @@ -410,7 +410,7 @@ def setUp(self):
'price': 500.0,
'quantity': 1.0,
'total': 500.0,
'type': 'delivery',
'type': 'service',
'vat': 'no'
}],
'amount': 8000.0,
Expand All @@ -433,7 +433,7 @@ def test_create_order_success(self):
order.set_delivery_time(date_start='2019-04-12 07:00', date_end='2019-04-12 13:00')
order.add_item(OrderItem(id=1, name='Демо-товар 2', price=1500, quantity=5,
measure=0, total=7500, vat='10', type='product'))
order.add_item(OrderItem(id=2, name='Доставка', price=500, type='delivery'))
order.add_item(OrderItem(id=2, name='Доставка', price=500, type='service'))

order_info = self.client.create_order(order)

Expand All @@ -459,7 +459,7 @@ def test_create_order_success(self):
'price': 500.0,
'quantity': 1.0,
'total': 500.0,
'type': 'delivery',
'type': 'service',
'vat': 'no'
})

Expand All @@ -478,7 +478,7 @@ def test_update_order_success(self):
order.set_delivery_time(date_start='2019-04-12 07:00', date_end='2019-04-12 13:00')
order.add_item(OrderItem(id=1, name='Демо-товар 2', price=1500, quantity=5,
measure=0, total=7500, vat='10', type='product'))
order.add_item(OrderItem(id=2, name='Доставка', price=500, type='delivery'))
order.add_item(OrderItem(id=2, name='Доставка', price=500, type='service'))

order_info = self.client.update_order(775, order)
self.assertIsInstance(order_info, OrderInfo)
Expand Down Expand Up @@ -515,7 +515,7 @@ def test_get_order_info_success(self):
'price': 500.0,
'quantity': 1.0,
'total': 500.0,
'type': 'delivery',
'type': 'service',
'vat': 'no'
})

Expand All @@ -531,7 +531,7 @@ def test_create_order_with_callback_url_success(self):
order.set_delivery_time(date_start='2019-04-12 07:00', date_end='2019-04-12 13:00')
order.add_item(OrderItem(id=1, name='Демо-товар 2', price=1500, quantity=5,
measure=0, total=7500, vat='10', type='product'))
order.add_item(OrderItem(id=2, name='Доставка', price=500, type='delivery'))
order.add_item(OrderItem(id=2, name='Доставка', price=500, type='service'))
order.add_callback_url('https://calback_url.ru')

order_info = self.client.create_order(order)
Expand Down Expand Up @@ -559,7 +559,7 @@ def test_create_order_with_callback_url_success(self):
'price': 500.0,
'quantity': 1.0,
'total': 500.0,
'type': 'delivery',
'type': 'service',
'vat': 'no'
})

Expand All @@ -583,7 +583,7 @@ def test_apply_correction_positions(self):
order = Order(12, state='new', is_pay_to_courier=False, payment_type=PaymentType.CARD)
order.add_item(OrderItem(id=1, name='Позиция 1', price=Decimal('42.4'), quantity=2,
measure=0, vat='10', total=Decimal(84.5), type='product'))
order.add_item(OrderItem(id=2, name='Доставка', price=10, type='delivery'))
order.add_item(OrderItem(id=2, name='Доставка', price=10, type='service'))

order.apply_correction_positions()
self.assertEqual(len(order['items']), 3)
Expand Down

0 comments on commit 54f6d37

Please sign in to comment.