channel-app 0.0.147__py3-none-any.whl → 0.0.148__py3-none-any.whl

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.
@@ -162,16 +162,19 @@ class GetOrCreateAddress(OmnitronCommandInterface):
162
162
  district_pk = district.pk
163
163
  return country_pk, city_pk, township_pk, district_pk
164
164
 
165
- def get_mapping_object(self, code, endpoint):
165
+ def get_mapping_object(self, code, endpoint, extra_filters=None):
166
166
  """
167
167
  :param code: Identifier code for the City and Country on the Sales Channel. This is
168
168
  prefix with channel_id as integration_code
169
169
  :param endpoint: omnitron sdk endpoint
170
+ :param extra_filters: extra filters for the endpoint, dict or None
170
171
  :return: mapped objects E.g (City, Country)
171
172
  """
172
173
  integration_code = f"{self.integration.channel_id}_{code}"
173
174
  params = {"mapping__code__exact": integration_code,
174
175
  "mapping__integration_type": INTEGRATION_TYPE}
176
+ if extra_filters:
177
+ params.update(extra_filters)
175
178
  objects = endpoint.list(params=params)
176
179
  if len(objects) != 1:
177
180
  raise IntegrationMappingException(params={"code": integration_code})
@@ -235,7 +238,8 @@ class GetOrCreateAddress(OmnitronCommandInterface):
235
238
  if len(townships) == 1:
236
239
  return townships[0]
237
240
  try:
238
- townships = self.get_mapping_object(township_name, endpoint)
241
+ extra_filters = {"city": city.pk, "is_active": True}
242
+ townships = self.get_mapping_object(township_name, endpoint, extra_filters)
239
243
  except IntegrationMappingException as exc:
240
244
  raise TownshipException(
241
245
  params={"type": ErrorType.township.value,
@@ -264,7 +268,8 @@ class GetOrCreateAddress(OmnitronCommandInterface):
264
268
  if len(districts) == 1:
265
269
  return districts[0]
266
270
  try:
267
- districts = self.get_mapping_object(district_name, endpoint)
271
+ extra_filters = {"city": city.pk, "township": township.pk, "is_active": True}
272
+ districts = self.get_mapping_object(district_name, endpoint, extra_filters)
268
273
  except IntegrationMappingException as exc:
269
274
  raise DistrictException(
270
275
  params={"type": ErrorType.district.value,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: channel_app
3
- Version: 0.0.147
3
+ Version: 0.0.148
4
4
  Summary: Channel app for Sales Channels
5
5
  Home-page: https://github.com/akinon/channel_app
6
6
  Author: akinonteam
@@ -48,7 +48,7 @@ channel_app/omnitron/commands/product_stocks.py,sha256=va2LbTtFMLe99kJr5aFceYLi2
48
48
  channel_app/omnitron/commands/products.py,sha256=As8Hnw3h6dOfPdxPBPUs-Hdip_9IaQXQyLAMsAylMTs,32098
49
49
  channel_app/omnitron/commands/setup.py,sha256=dcbvvIFDKKeDVziwR2qWJhVd92IlVLEoYIbMrxKjWDE,35220
50
50
  channel_app/omnitron/commands/orders/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
51
- channel_app/omnitron/commands/orders/addresses.py,sha256=b_2mqb0-6KUf-DgQNf3-o1p03SDNraMsxn-WjxyDbDQ,12011
51
+ channel_app/omnitron/commands/orders/addresses.py,sha256=FS63zncxP1hHjObq0Yjr9mq1voixzL52YdKt17Q0uV0,12358
52
52
  channel_app/omnitron/commands/orders/cargo_companies.py,sha256=pTyOgsoIBLHUIj7F2eB_y3NXS8p8Qi0rsqjIZ7AZiWs,1308
53
53
  channel_app/omnitron/commands/orders/customers.py,sha256=bBE5o3KFyReaMQm4dTrcZm7u0FEq3u-_YpVt5ru3_B8,3446
54
54
  channel_app/omnitron/commands/orders/orders.py,sha256=MJP3nAhBqOYfe028tjn7TOzxrjojcFNAIUScTxm2zXw,22755
@@ -58,7 +58,7 @@ channel_app/omnitron/commands/tests/test_product_images.py,sha256=y6tmiJ00kd2GTq
58
58
  channel_app/omnitron/commands/tests/test_product_prices.py,sha256=5HPX9PmjGw6gk3oNrwtWLqdrOkfeNx1mYP-pYwOesZU,3496
59
59
  channel_app/omnitron/commands/tests/test_product_stocks.py,sha256=q4RGlrCNUUJyN5CBL1fzrvdd4Q3xt816mbMRQT0XEd0,3496
60
60
  channel_app/omnitron/commands/tests/test_products.py,sha256=DUUdB7pKe-wj8H1N-otKhR-97z37Q3Mh0QgROlnrKTQ,102028
61
- channel_app-0.0.147.dist-info/METADATA,sha256=deyoP8mVB6inYFOANy0bZmaE4mY8w_RCVBnMjxPSWsY,309
62
- channel_app-0.0.147.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
63
- channel_app-0.0.147.dist-info/top_level.txt,sha256=JT-gM6L5Cwxr1xEoN7NHrREDs-d6iGFGfRnK-NrJ3tU,12
64
- channel_app-0.0.147.dist-info/RECORD,,
61
+ channel_app-0.0.148.dist-info/METADATA,sha256=4z7ZPV0_H7HL_j3rZjKgc6ROo4azRlDW26c_m339WWw,309
62
+ channel_app-0.0.148.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
63
+ channel_app-0.0.148.dist-info/top_level.txt,sha256=JT-gM6L5Cwxr1xEoN7NHrREDs-d6iGFGfRnK-NrJ3tU,12
64
+ channel_app-0.0.148.dist-info/RECORD,,