Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.idea/
env/
.venv/
.python-version
15 changes: 10 additions & 5 deletions OrangeData/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def __init__(self, inn, api_url, sign_private_key, client_key, client_cert, ca_c
self.__ca_cert = ca_cert
self.__client_cert_pass = client_cert_pass

def create_order(self, id_, type_, customer_contact, taxation_system, group=None, key=None):
def create_order(self, id_, type_, customer_contact, taxation_system, group=None, key=None, callback_url=None):
"""
Создание чека
:param id_: Идентификатор документа (Строка от 1 до 32 символов)
Expand All @@ -55,12 +55,14 @@ def create_order(self, id_, type_, customer_contact, taxation_system, group=None
:param group: Группа устройств, с помощью которых будет пробит чек (не всегда является обязательным полем)
:param key: Название ключа который должен быть использован для проверки подпись (Строка от 1 до 32 символов
либо None)
:param callback_url: URL для отправки результатов обработки чека POST запросом
:type id_: str
:type type_: int
:type customer_contact: str
:type taxation_system: int
:type group: str or None
:type key: str or None
:type callback_url: str or None
:return:
"""
self.__order_request = dict()
Expand Down Expand Up @@ -93,6 +95,9 @@ def create_order(self, id_, type_, customer_contact, taxation_system, group=None
else:
raise OrangeDataClientValidationError('Incorrect customer Contact')

if callback_url:
self.__order_request['callbackUrl'] = callback_url

def add_position_to_order(self, quantity, price, tax, text, payment_method_type=4,
payment_subject_type=1, supplier_inn=None,
supplier_phone_numbers=None, supplier_name=None, agent_type=None,
Expand Down Expand Up @@ -501,11 +506,11 @@ def send_order(self):
def get_order_status(self, id_):
"""
Проверка состояния чека
:param id_: Идентификатор документа (Строка от 1 до 32 символов)
:param id_: Идентификатор документа (Строка от 1 до 64 символов)
:type id_: str
:return:
"""
if not length_is_valid(id_, 1, 32):
if not length_is_valid(id_, 1, 64):
raise OrangeDataClientValidationError('Invalid order identifier')

url = urllib.parse.urljoin(
Expand Down Expand Up @@ -648,11 +653,11 @@ def post_correction(self):
def get_correction_status(self, id_):
"""
Проверка состояния чека-коррекции
:param id_: Идентификатор документа (Строка от 1 до 32 символов)
:param id_: Идентификатор документа (Строка от 1 до 64 символов)
:type id_: str
:return:
"""
if not length_is_valid(id_, 1, 32):
if not length_is_valid(id_, 1, 64):
raise OrangeDataClientValidationError('Invalid order identifier')

url = urllib.parse.urljoin(
Expand Down