Skip to content

Commit 831a541

Browse files
committed
feat: add is_customs_rate_guaranteed metadata to shipment response
Extract is_rate_guaranteed from shipment.rate.customs_charge_data and include it in shipment meta to indicate if customs charges are guaranteed. Refs #8
1 parent 9411a40 commit 831a541

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

  • plugins/freightcom_rest/karrio/providers/freightcom_rest/shipment

plugins/freightcom_rest/karrio/providers/freightcom_rest/shipment/create.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,12 @@ def _extract_details(
110110
freightcom_service_id = rate.service_id if hasattr(rate, 'service_id') else ""
111111
freightcom_unique_id = shipment.unique_id if hasattr(shipment, 'unique_id') else ""
112112

113+
is_customs_rate_guaranteed = (
114+
rate.customs_charge_data.is_rate_guaranteed
115+
if hasattr(rate, 'customs_charge_data') and rate.customs_charge_data and hasattr(rate.customs_charge_data, 'is_rate_guaranteed')
116+
else None
117+
)
118+
113119
else:
114120
tracking_number = ""
115121
shipment_id = ""
@@ -125,6 +131,7 @@ def _extract_details(
125131
carrier_tracking_link = ""
126132
freightcom_service_id = ""
127133
freightcom_unique_id = ""
134+
is_customs_rate_guaranteed = None
128135

129136
documents = models.Documents(
130137
label=label_base64,
@@ -149,7 +156,8 @@ def _extract_details(
149156
service_name=service_name,
150157
freightcom_service_id=freightcom_service_id,
151158
freightcom_unique_id=freightcom_unique_id,
152-
freightcom_shipment_identifier=shipment_id
159+
freightcom_shipment_identifier=shipment_id,
160+
is_customs_rate_guaranteed=is_customs_rate_guaranteed,
153161
),
154162
)
155163

0 commit comments

Comments
 (0)