karrio-server-manager 2025.5.3__py3-none-any.whl → 2025.5.5__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.
- karrio/server/manager/migrations/0067_rename_customs_commodities_table.py +56 -0
- karrio/server/manager/serializers/__init__.py +1 -0
- karrio/server/manager/serializers/shipment.py +16 -1
- karrio/server/manager/tests/test_shipments.py +11 -0
- karrio/server/manager/tests/test_trackers.py +2 -0
- karrio/server/manager/views/shipments.py +9 -4
- {karrio_server_manager-2025.5.3.dist-info → karrio_server_manager-2025.5.5.dist-info}/METADATA +1 -1
- {karrio_server_manager-2025.5.3.dist-info → karrio_server_manager-2025.5.5.dist-info}/RECORD +10 -9
- {karrio_server_manager-2025.5.3.dist-info → karrio_server_manager-2025.5.5.dist-info}/WHEEL +0 -0
- {karrio_server_manager-2025.5.3.dist-info → karrio_server_manager-2025.5.5.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Generated migration to fix ManyToMany junction table names
|
|
2
|
+
# The RenameField in migration 0010 didn't properly rename the ManyToMany junction tables
|
|
3
|
+
# This is a long-standing bug that's now being fixed
|
|
4
|
+
|
|
5
|
+
from django.db import migrations
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
# Mapping of old table names to new table names
|
|
9
|
+
TABLE_RENAMES = [
|
|
10
|
+
('customs_shipment_commodities', 'customs_commodities'),
|
|
11
|
+
('shipment_shipment_parcels', 'shipment_parcels'),
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def rename_junction_tables(_apps, schema_editor):
|
|
16
|
+
"""
|
|
17
|
+
Rename ManyToMany junction tables from old names to new names.
|
|
18
|
+
Uses Django's introspection API for database-agnostic table detection.
|
|
19
|
+
"""
|
|
20
|
+
connection = schema_editor.connection
|
|
21
|
+
existing_tables = connection.introspection.table_names()
|
|
22
|
+
|
|
23
|
+
for old_table, new_table in TABLE_RENAMES:
|
|
24
|
+
if old_table in existing_tables and new_table not in existing_tables:
|
|
25
|
+
schema_editor.execute(
|
|
26
|
+
schema_editor.sql_rename_table % {
|
|
27
|
+
"old_table": schema_editor.quote_name(old_table),
|
|
28
|
+
"new_table": schema_editor.quote_name(new_table),
|
|
29
|
+
}
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def reverse_rename(_apps, schema_editor):
|
|
34
|
+
"""Reverse the table renames."""
|
|
35
|
+
connection = schema_editor.connection
|
|
36
|
+
existing_tables = connection.introspection.table_names()
|
|
37
|
+
|
|
38
|
+
for old_table, new_table in TABLE_RENAMES:
|
|
39
|
+
if new_table in existing_tables and old_table not in existing_tables:
|
|
40
|
+
schema_editor.execute(
|
|
41
|
+
schema_editor.sql_rename_table % {
|
|
42
|
+
"old_table": schema_editor.quote_name(new_table),
|
|
43
|
+
"new_table": schema_editor.quote_name(old_table),
|
|
44
|
+
}
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class Migration(migrations.Migration):
|
|
49
|
+
|
|
50
|
+
dependencies = [
|
|
51
|
+
('manager', '0066_commodity_image_url_commodity_product_id_and_more'),
|
|
52
|
+
]
|
|
53
|
+
|
|
54
|
+
operations = [
|
|
55
|
+
migrations.RunPython(rename_junction_tables, reverse_rename),
|
|
56
|
+
]
|
|
@@ -33,6 +33,7 @@ from karrio.server.core.serializers import (
|
|
|
33
33
|
SHIPMENT_STATUS,
|
|
34
34
|
LABEL_TYPES,
|
|
35
35
|
ShipmentCancelRequest,
|
|
36
|
+
ShippingDocument,
|
|
36
37
|
ShipmentDetails,
|
|
37
38
|
ShipmentStatus,
|
|
38
39
|
TrackerStatus,
|
|
@@ -575,6 +576,16 @@ class ShipmentCancelSerializer(Shipment):
|
|
|
575
576
|
return instance
|
|
576
577
|
|
|
577
578
|
|
|
579
|
+
@validators.shipment_documents_accessor(include_base64=True)
|
|
580
|
+
class PurchasedShipment(Shipment):
|
|
581
|
+
shipping_documents = ShippingDocument(
|
|
582
|
+
required=False,
|
|
583
|
+
many=True,
|
|
584
|
+
default=[],
|
|
585
|
+
help_text="The list of shipping documents",
|
|
586
|
+
)
|
|
587
|
+
|
|
588
|
+
|
|
578
589
|
def fetch_shipment_rates(
|
|
579
590
|
shipment: models.Shipment,
|
|
580
591
|
context: typing.Any,
|
|
@@ -683,7 +694,11 @@ def buy_shipment_label(
|
|
|
683
694
|
merged_meta = {
|
|
684
695
|
**(shipment.meta or {}),
|
|
685
696
|
**(response_details.get("meta") or {}),
|
|
686
|
-
**(
|
|
697
|
+
**(
|
|
698
|
+
{"rule_activity": kwargs.get("rule_activity")}
|
|
699
|
+
if kwargs.get("rule_activity")
|
|
700
|
+
else {}
|
|
701
|
+
),
|
|
687
702
|
}
|
|
688
703
|
|
|
689
704
|
purchased_shipment = lib.identity(
|
|
@@ -517,6 +517,7 @@ SHIPMENT_RESPONSE = {
|
|
|
517
517
|
"created_at": ANY,
|
|
518
518
|
"test_mode": True,
|
|
519
519
|
"messages": [],
|
|
520
|
+
"shipping_documents": [],
|
|
520
521
|
}
|
|
521
522
|
|
|
522
523
|
SHIPMENT_OPTIONS = {
|
|
@@ -747,6 +748,14 @@ PURCHASED_SHIPMENT = {
|
|
|
747
748
|
"test_mode": True,
|
|
748
749
|
"label_url": ANY,
|
|
749
750
|
"invoice_url": None,
|
|
751
|
+
"shipping_documents": [
|
|
752
|
+
{
|
|
753
|
+
"category": "label",
|
|
754
|
+
"format": "PDF",
|
|
755
|
+
"url": ANY,
|
|
756
|
+
"base64": "==apodifjoefr",
|
|
757
|
+
}
|
|
758
|
+
],
|
|
750
759
|
}
|
|
751
760
|
|
|
752
761
|
CANCEL_RESPONSE = {
|
|
@@ -885,6 +894,7 @@ CANCEL_RESPONSE = {
|
|
|
885
894
|
"test_mode": True,
|
|
886
895
|
"label_url": None,
|
|
887
896
|
"invoice_url": None,
|
|
897
|
+
"shipping_documents": [],
|
|
888
898
|
}
|
|
889
899
|
|
|
890
900
|
CANCEL_PURCHASED_RESPONSE = {
|
|
@@ -1023,6 +1033,7 @@ CANCEL_PURCHASED_RESPONSE = {
|
|
|
1023
1033
|
"test_mode": True,
|
|
1024
1034
|
"label_url": None,
|
|
1025
1035
|
"invoice_url": None,
|
|
1036
|
+
"shipping_documents": [],
|
|
1026
1037
|
}
|
|
1027
1038
|
|
|
1028
1039
|
SINGLE_CALL_LABEL_DATA = {
|
|
@@ -129,6 +129,7 @@ TRACKING_RESPONSE = {
|
|
|
129
129
|
"time": "10:39",
|
|
130
130
|
"latitude": None,
|
|
131
131
|
"longitude": None,
|
|
132
|
+
"reason": None,
|
|
132
133
|
}
|
|
133
134
|
],
|
|
134
135
|
"messages": [],
|
|
@@ -180,6 +181,7 @@ UPDATE_TRACKING_RESPONSE = {
|
|
|
180
181
|
"location": "BONN",
|
|
181
182
|
"longitude": None,
|
|
182
183
|
"time": "20:34",
|
|
184
|
+
"reason": None,
|
|
183
185
|
}
|
|
184
186
|
],
|
|
185
187
|
"delivered": False,
|
|
@@ -34,6 +34,7 @@ from karrio.server.manager.serializers import (
|
|
|
34
34
|
ShipmentPurchaseData,
|
|
35
35
|
ShipmentCancelSerializer,
|
|
36
36
|
ShippingDocument,
|
|
37
|
+
PurchasedShipment,
|
|
37
38
|
)
|
|
38
39
|
|
|
39
40
|
ENDPOINT_ID = "$$$$$" # This endpoint id is used to make operation ids unique make sure not to duplicate
|
|
@@ -92,7 +93,9 @@ class ShipmentList(GenericAPIView):
|
|
|
92
93
|
ShipmentSerializer.map(data=request.data, context=request).save().instance
|
|
93
94
|
)
|
|
94
95
|
|
|
95
|
-
return Response(
|
|
96
|
+
return Response(
|
|
97
|
+
PurchasedShipment(shipment).data, status=status.HTTP_201_CREATED
|
|
98
|
+
)
|
|
96
99
|
|
|
97
100
|
|
|
98
101
|
class ShipmentDetails(APIView):
|
|
@@ -167,7 +170,7 @@ class ShipmentCancel(APIView):
|
|
|
167
170
|
request=None,
|
|
168
171
|
responses={
|
|
169
172
|
200: Shipment(),
|
|
170
|
-
|
|
173
|
+
304: Shipment(),
|
|
171
174
|
404: ErrorResponse(),
|
|
172
175
|
400: ErrorResponse(),
|
|
173
176
|
409: ErrorResponse(),
|
|
@@ -261,7 +264,7 @@ class ShipmentPurchase(APIView):
|
|
|
261
264
|
data=process_dictionaries_mutations(["metadata"], payload, shipment),
|
|
262
265
|
)
|
|
263
266
|
|
|
264
|
-
return Response(
|
|
267
|
+
return Response(PurchasedShipment(update).data)
|
|
265
268
|
|
|
266
269
|
|
|
267
270
|
class ShipmentDocs(VirtualDownloadView):
|
|
@@ -283,7 +286,9 @@ class ShipmentDocs(VirtualDownloadView):
|
|
|
283
286
|
|
|
284
287
|
query_params = request.GET.dict()
|
|
285
288
|
|
|
286
|
-
self.shipment = models.Shipment.objects.filter(
|
|
289
|
+
self.shipment = models.Shipment.objects.filter(
|
|
290
|
+
pk=pk, label__isnull=False
|
|
291
|
+
).first()
|
|
287
292
|
|
|
288
293
|
if self.shipment is None:
|
|
289
294
|
return Response(
|
{karrio_server_manager-2025.5.3.dist-info → karrio_server_manager-2025.5.5.dist-info}/RECORD
RENAMED
|
@@ -72,8 +72,9 @@ karrio/server/manager/migrations/0063_alter_commodity_value_currency.py,sha256=8
|
|
|
72
72
|
karrio/server/manager/migrations/0064_shipment_shipment_created_at_idx_and_more.py,sha256=EzCPxG54nk3PkT7hlS-W3oJxie6OlfMZu6Jh6tCJthQ,728
|
|
73
73
|
karrio/server/manager/migrations/0065_alter_address_city_alter_address_company_name_and_more.py,sha256=m0KQSz8cnJzaXUlaAKdqU0duZ8wSQeTYQCIeam3Wivw,6279
|
|
74
74
|
karrio/server/manager/migrations/0066_commodity_image_url_commodity_product_id_and_more.py,sha256=Jw7bEBmqzDSp6zw0xcAiKc9aDCsa3Wrw-oTM8r9Pqfc,997
|
|
75
|
+
karrio/server/manager/migrations/0067_rename_customs_commodities_table.py,sha256=WPACK9Ab5QUdcX9yxBkV6_MXTAkB9F8vETDOlVqOrT4,1933
|
|
75
76
|
karrio/server/manager/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
76
|
-
karrio/server/manager/serializers/__init__.py,sha256=
|
|
77
|
+
karrio/server/manager/serializers/__init__.py,sha256=FyL9pqzoV7umSJut5P2KzqPFxn1ZWu07Qx7I58H2AQc,1454
|
|
77
78
|
karrio/server/manager/serializers/address.py,sha256=yGKvZiNukeI15LEDdbo1ycqqK8QW77ak_vyLMIKyglI,2779
|
|
78
79
|
karrio/server/manager/serializers/commodity.py,sha256=PKrW-xAYkiNByk5RF8up_Bt1Z8mJV_BGW0mPWT9w4ME,1658
|
|
79
80
|
karrio/server/manager/serializers/customs.py,sha256=gMGC4TJMykjgELBLFHL6v7kPQ5YQKe7cQcMnOGBLL84,2872
|
|
@@ -82,7 +83,7 @@ karrio/server/manager/serializers/manifest.py,sha256=mSneCk_7HMXpi64_7hggWvkR7Ma
|
|
|
82
83
|
karrio/server/manager/serializers/parcel.py,sha256=733Bg26lVbEkoWtAVM5Qt2IRBS2QDuVxhG40Hiqh3bw,2621
|
|
83
84
|
karrio/server/manager/serializers/pickup.py,sha256=sX0VmcQxGkXn3IEosMuFwdXh4HhdkPcuBOp79O8PoDQ,9233
|
|
84
85
|
karrio/server/manager/serializers/rate.py,sha256=7vYK_v8iWEDnswqYHG2Lir16_UhHTOxW5rdC6lw3lzA,652
|
|
85
|
-
karrio/server/manager/serializers/shipment.py,sha256=
|
|
86
|
+
karrio/server/manager/serializers/shipment.py,sha256=ByVrnexMI_fgSGBWO95qOPQn65Xzcfb8Vna9nF3k7Bk,37004
|
|
86
87
|
karrio/server/manager/serializers/tracking.py,sha256=ixrAjIiZQsvSt4y0qtisGkt6TFOJ3ORNkJAQVt6YQrA,12483
|
|
87
88
|
karrio/server/manager/tests/__init__.py,sha256=Y1UNteEE60vWdUAkjbldu_r_-h4u0He8-UoiBgTjKcU,391
|
|
88
89
|
karrio/server/manager/tests/test_addresses.py,sha256=pNkZC_yJyb29ZlEOtOAs4blcEYiOarw0zhZIZC5uj1w,3111
|
|
@@ -91,8 +92,8 @@ karrio/server/manager/tests/test_errors.py,sha256=x2-mSsXknHkE4V7TajEu8d3rpqV38T
|
|
|
91
92
|
karrio/server/manager/tests/test_manifests.py,sha256=X35ZTXTFEM4Gxdjz598yiNNkOOKZGpILjHWRC0oM5U4,2764
|
|
92
93
|
karrio/server/manager/tests/test_parcels.py,sha256=lVLBOsHzXgXQvYjHIUy5oiPvrMfxYpueVvvhtuhstWk,2559
|
|
93
94
|
karrio/server/manager/tests/test_pickups.py,sha256=8jxddwTnBvBM9FOyWxW9TtZ-GOVYUje7HQ2EZjsbtD8,10681
|
|
94
|
-
karrio/server/manager/tests/test_shipments.py,sha256=
|
|
95
|
-
karrio/server/manager/tests/test_trackers.py,sha256=
|
|
95
|
+
karrio/server/manager/tests/test_shipments.py,sha256=I9DIx4l7zrHZ_vEvAKgdrnIx_euZtreSj9W40fouqSU,39725
|
|
96
|
+
karrio/server/manager/tests/test_trackers.py,sha256=VIGT8OVH51mf_6F2HEr5C-kYvsMnhUods_rpq543RbI,7207
|
|
96
97
|
karrio/server/manager/views/__init__.py,sha256=kDFUaORRQ3Xh0ZPm-Jk88Ss8dgGYM57iUFXb9TPMzh0,401
|
|
97
98
|
karrio/server/manager/views/addresses.py,sha256=7YCAs2ZYgd1icYwMcGGWfX7A7vZEL4BEAbU4eIxhiMY,4620
|
|
98
99
|
karrio/server/manager/views/customs.py,sha256=-ZreiKyJ1xeLeNVG53nMfRQFeURduWr1QkDItdLPnE8,4875
|
|
@@ -100,9 +101,9 @@ karrio/server/manager/views/documents.py,sha256=znW54qJ_k7WInIut5FBZFDT93CioozXT
|
|
|
100
101
|
karrio/server/manager/views/manifests.py,sha256=bk-8XoGLVqgjDfpTZbTKjXW7r8DYNDp2ce2xGG73sbI,7012
|
|
101
102
|
karrio/server/manager/views/parcels.py,sha256=hZY45rg6SrTWfQqyJ38MGKSor1yqgPUEVHtu16aG37g,4594
|
|
102
103
|
karrio/server/manager/views/pickups.py,sha256=gmpxz9ot1OR-BP1qh-0MXU3kUJi1ht_74hfaLJzJ42w,5503
|
|
103
|
-
karrio/server/manager/views/shipments.py,sha256=
|
|
104
|
+
karrio/server/manager/views/shipments.py,sha256=YOFcZy-ymn3YfIKtcfNjFO4R_tPocrmEqMkQUXSSDCM,13083
|
|
104
105
|
karrio/server/manager/views/trackers.py,sha256=3oGn2qDpHgk8GZvuz-Cb93Fc0j_h_HbXQR692Zhfiok,12363
|
|
105
|
-
karrio_server_manager-2025.5.
|
|
106
|
-
karrio_server_manager-2025.5.
|
|
107
|
-
karrio_server_manager-2025.5.
|
|
108
|
-
karrio_server_manager-2025.5.
|
|
106
|
+
karrio_server_manager-2025.5.5.dist-info/METADATA,sha256=fj_XMA52xNVPSCUZYh2CywQdx6mZSiqtMP0DJ51gtrQ,730
|
|
107
|
+
karrio_server_manager-2025.5.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
108
|
+
karrio_server_manager-2025.5.5.dist-info/top_level.txt,sha256=D1D7x8R3cTfjF_15mfiO7wCQ5QMtuM4x8GaPr7z5i78,12
|
|
109
|
+
karrio_server_manager-2025.5.5.dist-info/RECORD,,
|
|
File without changes
|
{karrio_server_manager-2025.5.3.dist-info → karrio_server_manager-2025.5.5.dist-info}/top_level.txt
RENAMED
|
File without changes
|