channel-app 0.0.151__tar.gz → 0.0.153__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {channel_app-0.0.151/channel_app.egg-info → channel_app-0.0.153}/PKG-INFO +1 -1
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/app/order/service.py +2 -2
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/omnitron/commands/orders/orders.py +3 -3
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/omnitron/commands/product_stocks.py +1 -1
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/omnitron/commands/products.py +9 -3
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/omnitron/commands/tests/test_products.py +44 -2
- {channel_app-0.0.151 → channel_app-0.0.153/channel_app.egg-info}/PKG-INFO +1 -1
- {channel_app-0.0.151 → channel_app-0.0.153}/setup.py +1 -1
- {channel_app-0.0.151 → channel_app-0.0.153}/.gitignore +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/.vscode/settings.json +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/Makefile +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/Procfile-dist +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/README.md +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/akinon.json-dist +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/bitbucket-pipelines.yml +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/build.sh-dist +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/__init__.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/app/__init__.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/app/order/__init__.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/app/product/__init__.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/app/product/service.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/app/product_image/__init__.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/app/product_image/service.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/app/product_price/__init__.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/app/product_price/service.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/app/product_stock/__init__.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/app/product_stock/service.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/app/setup/__init__.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/app/setup/service.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/channel/__init__.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/channel/commands/__init__.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/channel/commands/orders/__init__.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/channel/commands/orders/orders.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/channel/commands/product_categories.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/channel/commands/product_images.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/channel/commands/product_prices.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/channel/commands/product_stocks.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/channel/commands/products.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/channel/commands/setup.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/channel/integration.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/core/__init__.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/core/clients.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/core/commands.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/core/data.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/core/integration.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/core/products.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/core/settings.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/core/tests.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/core/utilities.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/omnitron/__init__.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/omnitron/batch_request.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/omnitron/commands/__init__.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/omnitron/commands/batch_requests.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/omnitron/commands/error_reports.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/omnitron/commands/integration_actions.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/omnitron/commands/orders/__init__.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/omnitron/commands/orders/addresses.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/omnitron/commands/orders/cargo_companies.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/omnitron/commands/orders/customers.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/omnitron/commands/product_categories.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/omnitron/commands/product_images.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/omnitron/commands/product_prices.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/omnitron/commands/setup.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/omnitron/commands/tests/__init__.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/omnitron/commands/tests/test_orders.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/omnitron/commands/tests/test_product_images.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/omnitron/commands/tests/test_product_prices.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/omnitron/commands/tests/test_product_stocks.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/omnitron/constants.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/omnitron/exceptions.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app/omnitron/integration.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app.egg-info/SOURCES.txt +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app.egg-info/dependency_links.txt +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app.egg-info/requires.txt +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/channel_app.egg-info/top_level.txt +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/docs/Makefile +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/docs/make.bat +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/docs/requirements.txt +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/docs/source/architecture.rst +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/docs/source/command_reference.rst +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/docs/source/conf.py +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/docs/source/flows.rst +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/docs/source/images/async.png +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/docs/source/images/batch_request_state_machine.png +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/docs/source/images/sync.png +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/docs/source/index.rst +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/docs/source/installation_and_usage.rst +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/docs/source/terminology.rst +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/requirements-dev.txt +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/requirements.txt +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/setup.cfg +0 -0
- {channel_app-0.0.151 → channel_app-0.0.153}/tox.ini +0 -0
@@ -440,8 +440,8 @@ class OrderService(object):
|
|
440
440
|
# configuration icinde yer alan reason_mapping anahtari bir json objesi,
|
441
441
|
# key channel_reason value omnitron_reason olan bir dict objesinden
|
442
442
|
# channel_reason'u döndürür
|
443
|
-
for channel_reason,
|
444
|
-
if omnitron_reason ==
|
443
|
+
for channel_reason, omni_reason in configuration.get("reason_mapping", {}):
|
444
|
+
if omnitron_reason == omni_reason:
|
445
445
|
return channel_reason
|
446
446
|
|
447
447
|
return "10"
|
@@ -409,7 +409,7 @@ class CreateOrderCancel(OmnitronCommandInterface):
|
|
409
409
|
channel_id=self.integration.channel_id)
|
410
410
|
params = {"channel": self.integration.channel_id,
|
411
411
|
"content_type_name": ContentType.order.value,
|
412
|
-
"
|
412
|
+
"remote_id__exact": order_remote_id}
|
413
413
|
integration_actions = end_point.list(params=params)
|
414
414
|
if not integration_actions:
|
415
415
|
raise Exception(
|
@@ -438,7 +438,7 @@ class CreateOrderCancel(OmnitronCommandInterface):
|
|
438
438
|
for order_item_remote_id in cancel_items:
|
439
439
|
params = {"channel": self.integration.channel_id,
|
440
440
|
"content_type_name": ContentType.order_item.value,
|
441
|
-
"
|
441
|
+
"remote_id__exact": order_item_remote_id,
|
442
442
|
"sort": "id"}
|
443
443
|
integration_actions = end_point.list(params=params)
|
444
444
|
for item in end_point.iterator:
|
@@ -686,7 +686,7 @@ class UpdateOrderItems(OmnitronCommandInterface):
|
|
686
686
|
channel_id=self.integration.channel_id)
|
687
687
|
params = {"channel": self.integration.channel_id,
|
688
688
|
"content_type_name": ContentType.order_item.value,
|
689
|
-
"
|
689
|
+
"remote_id__exact": order_item_remote_id}
|
690
690
|
integration_actions = end_point.list(params=params)
|
691
691
|
if not integration_actions and len(integration_actions) != 1:
|
692
692
|
return
|
@@ -246,7 +246,7 @@ class GetProductPricesFromProductStocks(OmnitronCommandInterface):
|
|
246
246
|
if isinstance(ps.product, Product):
|
247
247
|
product_ids.append(str(ps.product.pk))
|
248
248
|
else:
|
249
|
-
product_ids.append(ps.product)
|
249
|
+
product_ids.append(str(ps.product))
|
250
250
|
|
251
251
|
prices = []
|
252
252
|
for chunk in split_list(product_ids, self.CHUNK_SIZE):
|
@@ -338,7 +338,6 @@ class GetMappedProducts(OmnitronCommandInterface):
|
|
338
338
|
headers = {"Accept-Language": language}
|
339
339
|
else:
|
340
340
|
headers = {}
|
341
|
-
|
342
341
|
mapped_product_endpoint = self.endpoint(
|
343
342
|
channel_id=self.integration.channel_id)
|
344
343
|
|
@@ -347,11 +346,18 @@ class GetMappedProducts(OmnitronCommandInterface):
|
|
347
346
|
attributes = mapped_product_endpoint.retrieve(headers=headers,
|
348
347
|
id=product.pk)
|
349
348
|
product.mapped_attributes = attributes
|
350
|
-
except HTTPError:
|
349
|
+
except HTTPError as http_err:
|
350
|
+
if http_err.response is not None and http_err.response.status_code == 406:
|
351
|
+
try:
|
352
|
+
error_content = http_err.response.json()
|
353
|
+
fail_message = str(error_content.get('error', error_content))
|
354
|
+
except ValueError:
|
355
|
+
fail_message = http_err.response.text
|
356
|
+
|
351
357
|
product.mapped_attributes = {}
|
352
358
|
product.failed_reason_type = FailedReasonType.mapping.value
|
353
359
|
self.failed_object_list.append(
|
354
|
-
(product, ContentType.product.value,
|
360
|
+
(product, ContentType.product.value, fail_message))
|
355
361
|
continue
|
356
362
|
|
357
363
|
return products
|
{channel_app-0.0.151 → channel_app-0.0.153}/channel_app/omnitron/commands/tests/test_products.py
RENAMED
@@ -1,5 +1,5 @@
|
|
1
|
-
from typing import List
|
2
1
|
from unittest.mock import MagicMock, patch
|
2
|
+
from requests import HTTPError
|
3
3
|
from omnisdk.base_client import BaseClient
|
4
4
|
from omnisdk.omnitron.endpoints import (
|
5
5
|
ChannelBatchRequestEndpoint,
|
@@ -11,7 +11,8 @@ from omnisdk.omnitron.endpoints import (
|
|
11
11
|
ChannelProductPriceEndpoint,
|
12
12
|
ChannelProductStockEndpoint,
|
13
13
|
ChannelExtraProductStockEndpoint,
|
14
|
-
ChannelExtraProductPriceEndpoint
|
14
|
+
ChannelExtraProductPriceEndpoint,
|
15
|
+
ChannelMappedProductEndpoint,
|
15
16
|
)
|
16
17
|
from omnisdk.omnitron.models import (
|
17
18
|
ChannelAttributeConfig,
|
@@ -471,6 +472,47 @@ class TestGetMappedProducts(BaseTestCaseMixin):
|
|
471
472
|
mock_get_mapping.return_value = []
|
472
473
|
result = self.get_mapped_products.get_mapping([])
|
473
474
|
self.assertEqual(result, [])
|
475
|
+
|
476
|
+
@patch.object(BaseClient, 'get_instance')
|
477
|
+
def test_get_mapping_raise_http_error(
|
478
|
+
self,
|
479
|
+
mock_get_instance
|
480
|
+
):
|
481
|
+
mock_response = MagicMock()
|
482
|
+
mock_response.status_code = 406
|
483
|
+
mock_response.json.return_value = {"error": "Test error"}
|
484
|
+
|
485
|
+
http_error = HTTPError(response=mock_response)
|
486
|
+
mock_endpoint = MagicMock()
|
487
|
+
mock_endpoint.retrieve.side_effect = http_error
|
488
|
+
|
489
|
+
with patch.object(
|
490
|
+
ChannelMappedProductEndpoint,
|
491
|
+
'__new__',
|
492
|
+
return_value=mock_endpoint
|
493
|
+
):
|
494
|
+
test_product = Product(pk=1)
|
495
|
+
products = self.get_mapped_products.get_mapping([test_product])
|
496
|
+
|
497
|
+
self.assertEqual(products[0].mapped_attributes, {})
|
498
|
+
self.assertEqual(
|
499
|
+
products[0].failed_reason_type,
|
500
|
+
FailedReasonType.mapping.value
|
501
|
+
)
|
502
|
+
|
503
|
+
self.assertEqual(len(self.get_mapped_products.failed_object_list), 1)
|
504
|
+
self.assertEqual(
|
505
|
+
self.get_mapped_products.failed_object_list[0][0],
|
506
|
+
test_product
|
507
|
+
)
|
508
|
+
self.assertEqual(
|
509
|
+
self.get_mapped_products.failed_object_list[0][1],
|
510
|
+
ContentType.product.value
|
511
|
+
)
|
512
|
+
self.assertEqual(
|
513
|
+
self.get_mapped_products.failed_object_list[0][2],
|
514
|
+
"Test error"
|
515
|
+
)
|
474
516
|
|
475
517
|
|
476
518
|
class TestGetMappedProductsWithOutCommit(TestGetMappedProducts):
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{channel_app-0.0.151 → channel_app-0.0.153}/channel_app/channel/commands/product_categories.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{channel_app-0.0.151 → channel_app-0.0.153}/channel_app/omnitron/commands/integration_actions.py
RENAMED
File without changes
|
{channel_app-0.0.151 → channel_app-0.0.153}/channel_app/omnitron/commands/orders/__init__.py
RENAMED
File without changes
|
{channel_app-0.0.151 → channel_app-0.0.153}/channel_app/omnitron/commands/orders/addresses.py
RENAMED
File without changes
|
{channel_app-0.0.151 → channel_app-0.0.153}/channel_app/omnitron/commands/orders/cargo_companies.py
RENAMED
File without changes
|
{channel_app-0.0.151 → channel_app-0.0.153}/channel_app/omnitron/commands/orders/customers.py
RENAMED
File without changes
|
{channel_app-0.0.151 → channel_app-0.0.153}/channel_app/omnitron/commands/product_categories.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{channel_app-0.0.151 → channel_app-0.0.153}/channel_app/omnitron/commands/tests/test_orders.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{channel_app-0.0.151 → channel_app-0.0.153}/docs/source/images/batch_request_state_machine.png
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|