channel-app 0.0.153__py3-none-any.whl → 0.0.155__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.
channel_app/core/data.py CHANGED
@@ -199,6 +199,7 @@ class CancellationRequestDto:
199
199
  order_item: str # remote item number
200
200
  reason: str # reason code
201
201
  remote_id: str
202
+ description: str
202
203
  cancellation_type: Optional[str] = "cancel"
203
204
 
204
205
 
@@ -60,8 +60,8 @@ class GetOrCreateAddress(OmnitronCommandInterface):
60
60
  data = {
61
61
  "email": address.email[:254],
62
62
  "phone_number": address.phone_number[:128],
63
- "first_name": customer.first_name[:255],
64
- "last_name": customer.last_name[:255],
63
+ "first_name": (address.first_name or customer.first_name)[:255],
64
+ "last_name": (address.last_name or customer.last_name)[:255],
65
65
  "customer": customer.pk,
66
66
  "country": country_pk,
67
67
  "city": city_pk,
@@ -8,10 +8,19 @@ from omnisdk.omnitron.endpoints import (
8
8
  ChannelOrderItemEndpoint,
9
9
  ChannelCancellationRequestEndpoint,
10
10
  ChannelBatchRequestEndpoint)
11
- from omnisdk.omnitron.models import CancellationRequest
12
-
13
- from channel_app.core.data import CancellationRequestDto, CustomerDto, OrderBatchRequestResponseDto
11
+ from omnisdk.omnitron.models import (
12
+ CancellationRequest,
13
+ Customer
14
+ )
15
+
16
+ from channel_app.core.data import (
17
+ AddressDto,
18
+ CancellationRequestDto,
19
+ CustomerDto,
20
+ OrderBatchRequestResponseDto,
21
+ )
14
22
  from channel_app.core.tests import BaseTestCaseMixin
23
+ from channel_app.omnitron.commands.orders.addresses import GetOrCreateAddress
15
24
  from channel_app.omnitron.commands.orders.cargo_companies import GetCargoCompany
16
25
  from channel_app.omnitron.commands.orders.customers import GetOrCreateCustomer
17
26
  from channel_app.omnitron.commands.orders.orders import (
@@ -20,11 +29,12 @@ from channel_app.omnitron.commands.orders.orders import (
20
29
  GetOrderItems,
21
30
  GetOrderItemsWithOrder,
22
31
  ProcessOrderBatchRequests,
23
- ChannelIntegrationActionEndpoint)
32
+ )
24
33
  from channel_app.omnitron.constants import (
25
34
  BatchRequestStatus,
26
35
  CancellationType,
27
- CustomerIdentifierField)
36
+ CustomerIdentifierField
37
+ )
28
38
 
29
39
 
30
40
  class TestProcessOrderBatchRequests(BaseTestCaseMixin):
@@ -338,6 +348,49 @@ class TestGetOrCreateCustomer(BaseTestCaseMixin):
338
348
  self.assertEqual(getattr(customer, key), value)
339
349
 
340
350
 
351
+ class TestGetOrCreateAddress(BaseTestCaseMixin):
352
+ """
353
+ Test case for GetOrCreateAddress
354
+
355
+ run: python -m unittest channel_app.omnitron.commands.tests.test_orders.TestGetOrCreateAddress
356
+ """
357
+
358
+ def setUp(self) -> None:
359
+ self.instance = GetOrCreateAddress(
360
+ integration=self.mock_integration,
361
+ )
362
+ self.instance.objects = {}
363
+ self.instance.objects["address"]: AddressDto = AddressDto(
364
+ email="john.doe@akinon.com",
365
+ phone_number="05556667788",
366
+ first_name="John",
367
+ last_name="Doe",
368
+ country="1",
369
+ city="80",
370
+ line="Hemen sahil kenarı"
371
+ )
372
+ self.instance.objects["customer"]: Customer = Customer(
373
+ pk="1",
374
+ first_name="Customer John",
375
+ last_name="Customer Doe",
376
+ )
377
+
378
+
379
+ @patch.object(GetOrCreateAddress, 'get_location_objects')
380
+ def test_get_data(self, mock_get_location_objects):
381
+ mock_get_location_objects.return_value = (1, 80, None, None)
382
+ data = self.instance.get_data()
383
+
384
+ self.assertEqual(
385
+ data["first_name"],
386
+ self.instance.objects["address"].first_name
387
+ )
388
+ self.assertEqual(
389
+ data["last_name"],
390
+ self.instance.objects["address"].last_name
391
+ )
392
+
393
+
341
394
  class TestGetCargoCompany(BaseTestCaseMixin):
342
395
  """
343
396
  Test case for GetCargoCompany
@@ -570,7 +623,9 @@ class TestCreateCancellationRequest(BaseTestCaseMixin):
570
623
  order_item='1',
571
624
  reason='reason_code',
572
625
  remote_id='2',
573
- cancellation_type=CancellationType.refund.value)
626
+ cancellation_type=CancellationType.refund.value,
627
+ description='description',
628
+ )
574
629
  return super().setUp()
575
630
 
576
631
  @patch.object(BaseClient, 'get_instance')
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: channel_app
3
- Version: 0.0.153
3
+ Version: 0.0.155
4
4
  Summary: Channel app for Sales Channels
5
5
  Home-page: https://github.com/akinon/channel_app
6
6
  Author: akinonteam
@@ -26,7 +26,7 @@ channel_app/channel/commands/orders/orders.py,sha256=edBCmp0BBg5qNhduWnB7p2yAf0p
26
26
  channel_app/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
27
27
  channel_app/core/clients.py,sha256=o8OBkXwof8BobEyiiHPwmGsUcOlPb60u3oUeAUxo_hc,1591
28
28
  channel_app/core/commands.py,sha256=wM0ZlH_GHaYLKy2SWab_aKuZCsSahUuHeBa_tqi3W4A,14324
29
- channel_app/core/data.py,sha256=xiNQh_r_F3RXSO6jncHNEVLPO9sDVm_3A-MMOwdh6n8,6910
29
+ channel_app/core/data.py,sha256=SlsXB0MW0epC2nrM0uEnaCBYK3Nz0kXFXZ1n4t8iomg,6931
30
30
  channel_app/core/integration.py,sha256=OqpN8B3KBLsjjrbZXZaNVF6NtObejh7P_7kGFj1xU3o,2817
31
31
  channel_app/core/products.py,sha256=uInjFw-vze1XP8vWEeq4VWDZVQQIiatoe1YsQ6n_H5E,2092
32
32
  channel_app/core/settings.py,sha256=1KF8PhbjEqyZOWese9EFA_DnaSA1eVcscfShVIroTRo,1247
@@ -48,17 +48,17 @@ channel_app/omnitron/commands/product_stocks.py,sha256=tX3EpTYg2Y-l7hwZjPYPk_eUm
48
48
  channel_app/omnitron/commands/products.py,sha256=hzEedmOx5GRoPa69Clh5EYqm3Jxi1TuAxhwCngswHmw,32492
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=2wjYOyAv5TSZ6c7TUl2SWSFCYg5Vmihimj1Iz4Ybm_U,12566
51
+ channel_app/omnitron/commands/orders/addresses.py,sha256=crk4qwhGYBi6-jnJUQ7M7HloDAvaiGw_d3q40VcSR-E,12613
52
52
  channel_app/omnitron/commands/orders/cargo_companies.py,sha256=Q5RKIbP8cNLRa82GA7TyjrKZ2gIDWXscMTQTSJOvwGE,1386
53
53
  channel_app/omnitron/commands/orders/customers.py,sha256=1IbzZsQSIcroJagsinKy__q3vEU8kZj3LxNhxb-mWQ0,3450
54
54
  channel_app/omnitron/commands/orders/orders.py,sha256=Pv70cBMMs01oU6yvtPk7Xy9zAFd1RfmEtzI30dpliLk,27718
55
55
  channel_app/omnitron/commands/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
56
- channel_app/omnitron/commands/tests/test_orders.py,sha256=acndyE5vpWUYdIaAsa2TlJxxmtUNRKE0IDP7DJRMgTo,20451
56
+ channel_app/omnitron/commands/tests/test_orders.py,sha256=xEJ3iYV0fjlh75ru3YYSy5-k-0_9LfsRVPkqLOcQhzY,21921
57
57
  channel_app/omnitron/commands/tests/test_product_images.py,sha256=y6tmiJ00kd2GTqSv4MOCjUnXFFSAKhhAwsqQ0l0ccNk,3492
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=uj5KLaubY3XNu0hidOH-u-Djfboe81Hj7-lP--01Le0,103494
61
- channel_app-0.0.153.dist-info/METADATA,sha256=PycbO9Q7L8ABX4S_eAqQZbKoQUE_GH4LcqQf6AA3hOs,309
62
- channel_app-0.0.153.dist-info/WHEEL,sha256=Mdi9PDNwEZptOjTlUcAth7XJDFtKrHYaQMPulZeBCiQ,91
63
- channel_app-0.0.153.dist-info/top_level.txt,sha256=JT-gM6L5Cwxr1xEoN7NHrREDs-d6iGFGfRnK-NrJ3tU,12
64
- channel_app-0.0.153.dist-info/RECORD,,
61
+ channel_app-0.0.155.dist-info/METADATA,sha256=pLzTUbuNOFziN85eKGtfXQ9cU8IEWkpzBBRLxR-e2vg,309
62
+ channel_app-0.0.155.dist-info/WHEEL,sha256=Mdi9PDNwEZptOjTlUcAth7XJDFtKrHYaQMPulZeBCiQ,91
63
+ channel_app-0.0.155.dist-info/top_level.txt,sha256=JT-gM6L5Cwxr1xEoN7NHrREDs-d6iGFGfRnK-NrJ3tU,12
64
+ channel_app-0.0.155.dist-info/RECORD,,