Skip to content

Commit

Permalink
Fix shipment identifier assignment in create shipment
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jacobshilitz committed Sep 12, 2024
1 parent d9afa1f commit 36217a0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
14 changes: 7 additions & 7 deletions modules/connectors/canadapost/tests/canadapost/test_shipment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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):
Expand Down Expand Up @@ -156,7 +156,7 @@ def test_parse_multi_piece_shipment_response(self):


shipment_cancel_data = {
"shipment_identifier": "123456789012",
"shipment_identifier": "545021584835957806",
"options": {"email": "[email protected]"},
}

Expand Down Expand Up @@ -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": {
Expand All @@ -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",
},
[],
Expand Down

0 comments on commit 36217a0

Please sign in to comment.