channel-app 0.0.152__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.
Files changed (92) hide show
  1. {channel_app-0.0.152/channel_app.egg-info → channel_app-0.0.153}/PKG-INFO +1 -1
  2. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/app/order/service.py +2 -2
  3. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/omnitron/commands/orders/orders.py +3 -3
  4. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/omnitron/commands/products.py +9 -3
  5. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/omnitron/commands/tests/test_products.py +44 -2
  6. {channel_app-0.0.152 → channel_app-0.0.153/channel_app.egg-info}/PKG-INFO +1 -1
  7. {channel_app-0.0.152 → channel_app-0.0.153}/setup.py +1 -1
  8. {channel_app-0.0.152 → channel_app-0.0.153}/.gitignore +0 -0
  9. {channel_app-0.0.152 → channel_app-0.0.153}/.vscode/settings.json +0 -0
  10. {channel_app-0.0.152 → channel_app-0.0.153}/Makefile +0 -0
  11. {channel_app-0.0.152 → channel_app-0.0.153}/Procfile-dist +0 -0
  12. {channel_app-0.0.152 → channel_app-0.0.153}/README.md +0 -0
  13. {channel_app-0.0.152 → channel_app-0.0.153}/akinon.json-dist +0 -0
  14. {channel_app-0.0.152 → channel_app-0.0.153}/bitbucket-pipelines.yml +0 -0
  15. {channel_app-0.0.152 → channel_app-0.0.153}/build.sh-dist +0 -0
  16. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/__init__.py +0 -0
  17. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/app/__init__.py +0 -0
  18. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/app/order/__init__.py +0 -0
  19. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/app/product/__init__.py +0 -0
  20. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/app/product/service.py +0 -0
  21. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/app/product_image/__init__.py +0 -0
  22. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/app/product_image/service.py +0 -0
  23. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/app/product_price/__init__.py +0 -0
  24. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/app/product_price/service.py +0 -0
  25. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/app/product_stock/__init__.py +0 -0
  26. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/app/product_stock/service.py +0 -0
  27. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/app/setup/__init__.py +0 -0
  28. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/app/setup/service.py +0 -0
  29. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/channel/__init__.py +0 -0
  30. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/channel/commands/__init__.py +0 -0
  31. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/channel/commands/orders/__init__.py +0 -0
  32. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/channel/commands/orders/orders.py +0 -0
  33. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/channel/commands/product_categories.py +0 -0
  34. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/channel/commands/product_images.py +0 -0
  35. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/channel/commands/product_prices.py +0 -0
  36. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/channel/commands/product_stocks.py +0 -0
  37. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/channel/commands/products.py +0 -0
  38. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/channel/commands/setup.py +0 -0
  39. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/channel/integration.py +0 -0
  40. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/core/__init__.py +0 -0
  41. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/core/clients.py +0 -0
  42. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/core/commands.py +0 -0
  43. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/core/data.py +0 -0
  44. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/core/integration.py +0 -0
  45. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/core/products.py +0 -0
  46. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/core/settings.py +0 -0
  47. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/core/tests.py +0 -0
  48. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/core/utilities.py +0 -0
  49. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/omnitron/__init__.py +0 -0
  50. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/omnitron/batch_request.py +0 -0
  51. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/omnitron/commands/__init__.py +0 -0
  52. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/omnitron/commands/batch_requests.py +0 -0
  53. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/omnitron/commands/error_reports.py +0 -0
  54. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/omnitron/commands/integration_actions.py +0 -0
  55. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/omnitron/commands/orders/__init__.py +0 -0
  56. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/omnitron/commands/orders/addresses.py +0 -0
  57. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/omnitron/commands/orders/cargo_companies.py +0 -0
  58. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/omnitron/commands/orders/customers.py +0 -0
  59. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/omnitron/commands/product_categories.py +0 -0
  60. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/omnitron/commands/product_images.py +0 -0
  61. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/omnitron/commands/product_prices.py +0 -0
  62. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/omnitron/commands/product_stocks.py +0 -0
  63. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/omnitron/commands/setup.py +0 -0
  64. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/omnitron/commands/tests/__init__.py +0 -0
  65. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/omnitron/commands/tests/test_orders.py +0 -0
  66. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/omnitron/commands/tests/test_product_images.py +0 -0
  67. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/omnitron/commands/tests/test_product_prices.py +0 -0
  68. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/omnitron/commands/tests/test_product_stocks.py +0 -0
  69. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/omnitron/constants.py +0 -0
  70. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/omnitron/exceptions.py +0 -0
  71. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app/omnitron/integration.py +0 -0
  72. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app.egg-info/SOURCES.txt +0 -0
  73. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app.egg-info/dependency_links.txt +0 -0
  74. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app.egg-info/requires.txt +0 -0
  75. {channel_app-0.0.152 → channel_app-0.0.153}/channel_app.egg-info/top_level.txt +0 -0
  76. {channel_app-0.0.152 → channel_app-0.0.153}/docs/Makefile +0 -0
  77. {channel_app-0.0.152 → channel_app-0.0.153}/docs/make.bat +0 -0
  78. {channel_app-0.0.152 → channel_app-0.0.153}/docs/requirements.txt +0 -0
  79. {channel_app-0.0.152 → channel_app-0.0.153}/docs/source/architecture.rst +0 -0
  80. {channel_app-0.0.152 → channel_app-0.0.153}/docs/source/command_reference.rst +0 -0
  81. {channel_app-0.0.152 → channel_app-0.0.153}/docs/source/conf.py +0 -0
  82. {channel_app-0.0.152 → channel_app-0.0.153}/docs/source/flows.rst +0 -0
  83. {channel_app-0.0.152 → channel_app-0.0.153}/docs/source/images/async.png +0 -0
  84. {channel_app-0.0.152 → channel_app-0.0.153}/docs/source/images/batch_request_state_machine.png +0 -0
  85. {channel_app-0.0.152 → channel_app-0.0.153}/docs/source/images/sync.png +0 -0
  86. {channel_app-0.0.152 → channel_app-0.0.153}/docs/source/index.rst +0 -0
  87. {channel_app-0.0.152 → channel_app-0.0.153}/docs/source/installation_and_usage.rst +0 -0
  88. {channel_app-0.0.152 → channel_app-0.0.153}/docs/source/terminology.rst +0 -0
  89. {channel_app-0.0.152 → channel_app-0.0.153}/requirements-dev.txt +0 -0
  90. {channel_app-0.0.152 → channel_app-0.0.153}/requirements.txt +0 -0
  91. {channel_app-0.0.152 → channel_app-0.0.153}/setup.cfg +0 -0
  92. {channel_app-0.0.152 → channel_app-0.0.153}/tox.ini +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: channel_app
3
- Version: 0.0.152
3
+ Version: 0.0.153
4
4
  Summary: Channel app for Sales Channels
5
5
  Home-page: https://github.com/akinon/channel_app
6
6
  Author: akinonteam
@@ -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, omnitron_reason in configuration.get("reason_mapping", {}):
444
- if omnitron_reason == 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
- "remote_id": order_remote_id}
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
- "remote_id": order_item_remote_id,
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
- "remote_id": order_item_remote_id}
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
@@ -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, "MappingError"))
360
+ (product, ContentType.product.value, fail_message))
355
361
  continue
356
362
 
357
363
  return products
@@ -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):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: channel_app
3
- Version: 0.0.152
3
+ Version: 0.0.153
4
4
  Summary: Channel app for Sales Channels
5
5
  Home-page: https://github.com/akinon/channel_app
6
6
  Author: akinonteam
@@ -5,7 +5,7 @@ with open("README.md") as f:
5
5
 
6
6
  setup(
7
7
  name="channel_app",
8
- version="0.0.152",
8
+ version="0.0.153",
9
9
  packages=find_packages(),
10
10
  url="https://github.com/akinon/channel_app",
11
11
  description="Channel app for Sales Channels",
File without changes
File without changes
File without changes
File without changes
File without changes