From 36217a0040467240ceba5cc42a073b9a64f37109 Mon Sep 17 00:00:00 2001 From: Jacob Shilitz Date: Wed, 11 Sep 2024 20:33:18 -0400 Subject: [PATCH] Fix shipment identifier assignment in create shipment This change corrects the assignment of the shipment identifier to use `info.shipment_id` instead of `info.tracking_pin`. This ensures that the shipment identifier is correctly set, allowing proper tracking and management of shipments. --- .../karrio/providers/canadapost/shipment/create.py | 2 +- .../canadapost/tests/canadapost/test_shipment.py | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/connectors/canadapost/karrio/providers/canadapost/shipment/create.py b/modules/connectors/canadapost/karrio/providers/canadapost/shipment/create.py index e2f9fecc88..1a34664c81 100644 --- a/modules/connectors/canadapost/karrio/providers/canadapost/shipment/create.py +++ b/modules/connectors/canadapost/karrio/providers/canadapost/shipment/create.py @@ -49,7 +49,7 @@ def _extract_shipment( carrier_name=settings.carrier_name, carrier_id=settings.carrier_id, tracking_number=info.tracking_pin, - shipment_identifier=info.tracking_pin, + shipment_identifier=info.shipment_id, docs=models.Documents(label=label), label_type=ctx["label_type"], meta=lib.to_dict( diff --git a/modules/connectors/canadapost/tests/canadapost/test_shipment.py b/modules/connectors/canadapost/tests/canadapost/test_shipment.py index 2e1eb5115e..44f94e3b75 100644 --- a/modules/connectors/canadapost/tests/canadapost/test_shipment.py +++ b/modules/connectors/canadapost/tests/canadapost/test_shipment.py @@ -87,11 +87,11 @@ def test_cancel_shipment(self): info_call, cancel_call = mocks.call_args_list self.assertEqual( info_call[1]["url"], - f"{gateway.settings.server_url}/rs/2004381/2004381/shipment/123456789012", + f"{gateway.settings.server_url}/rs/2004381/2004381/shipment/545021584835957806", ) self.assertEqual( cancel_call[1]["url"], - f"{gateway.settings.server_url}/rs/2004381/2004381/shipment/123456789012", + f"{gateway.settings.server_url}/rs/2004381/2004381/shipment/545021584835957806", ) def test_cancel_transmitted_shipment(self): @@ -103,11 +103,11 @@ def test_cancel_transmitted_shipment(self): info_call, refund_call = mocks.call_args_list self.assertEqual( info_call[1]["url"], - f"{gateway.settings.server_url}/rs/2004381/2004381/shipment/123456789012", + f"{gateway.settings.server_url}/rs/2004381/2004381/shipment/545021584835957806", ) self.assertEqual( refund_call[1]["url"], - f"{gateway.settings.server_url}/rs/2004381/2004381/shipment/123456789012/refund", + f"{gateway.settings.server_url}/rs/2004381/2004381/shipment/545021584835957806/refund", ) def test_parse_shipment_response(self): @@ -156,7 +156,7 @@ def test_parse_multi_piece_shipment_response(self): shipment_cancel_data = { - "shipment_identifier": "123456789012", + "shipment_identifier": "545021584835957806", "options": {"email": "test@test.com"}, } @@ -292,7 +292,7 @@ def test_parse_multi_piece_shipment_response(self): "carrier_name": "canadapost", "carrier_id": "canadapost", "tracking_number": "123456789012", - "shipment_identifier": "123456789012", + "shipment_identifier": "545021584835957806", "label_type": "PDF", "docs": {"label": ANY}, "meta": { @@ -317,7 +317,7 @@ def test_parse_multi_piece_shipment_response(self): "manifest_required": False, }, "label_type": "PDF", - "shipment_identifier": "123456789012", + "shipment_identifier": "545021584835957806", "tracking_number": "123456789012", }, [],