From 77fd62e706d7bdcb820457779e55292fccf59ee4 Mon Sep 17 00:00:00 2001 From: Florian da Costa Date: Wed, 13 Dec 2023 12:52:34 +0100 Subject: [PATCH 1/2] [IMP] Port delivery_instruction from python 2 old branch for dpd --- roulier/api.py | 6 ++++++ roulier/carriers/dpd_fr_soap/templates/dpd_addressInfo.xml | 2 ++ .../dpd_fr_soap/templates/dpd_createShipmentWithLabels.xml | 3 +++ 3 files changed, 11 insertions(+) diff --git a/roulier/api.py b/roulier/api.py index 73a5664..3862cf1 100644 --- a/roulier/api.py +++ b/roulier/api.py @@ -174,6 +174,12 @@ def _to_address(self): address["country"].update({"required": True, "empty": False}) address["city"].update({"required": True, "empty": False}) address["zip"].update({"required": True, "empty": False}) + address["delivery_instruction"] = { + "type": "string", + "default": "", + "required": False, + "empty": True, + } return address def _parcel(self): diff --git a/roulier/carriers/dpd_fr_soap/templates/dpd_addressInfo.xml b/roulier/carriers/dpd_fr_soap/templates/dpd_addressInfo.xml index 4f21557..1170b3c 100644 --- a/roulier/carriers/dpd_fr_soap/templates/dpd_addressInfo.xml +++ b/roulier/carriers/dpd_fr_soap/templates/dpd_addressInfo.xml @@ -3,3 +3,5 @@ {{ address.digicode1 }} {{ address.digicode2 }} {{ address.intercom }} +{{ address.delivery_instruction[0:35] }} +{{ address.delivery_instruction[35:70] }} diff --git a/roulier/carriers/dpd_fr_soap/templates/dpd_createShipmentWithLabels.xml b/roulier/carriers/dpd_fr_soap/templates/dpd_createShipmentWithLabels.xml index 356b579..6ad3b1b 100644 --- a/roulier/carriers/dpd_fr_soap/templates/dpd_createShipmentWithLabels.xml +++ b/roulier/carriers/dpd_fr_soap/templates/dpd_createShipmentWithLabels.xml @@ -1,6 +1,9 @@ {% with address = receiver_address %} + + {{ address.delivery_instruction }} + {% include "dpd_address.xml" %} From 925f71219a681b72e558c4f3d11324fb1e14c7d7 Mon Sep 17 00:00:00 2001 From: Florian da Costa Date: Mon, 29 Jan 2024 12:11:22 +0100 Subject: [PATCH 2/2] [FIX] Remove useless warnings before raise --- roulier/carriers/dpd_fr_soap/transport.py | 1 - roulier/codec.py | 1 - 2 files changed, 2 deletions(-) diff --git a/roulier/carriers/dpd_fr_soap/transport.py b/roulier/carriers/dpd_fr_soap/transport.py index 104dafc..afcf311 100755 --- a/roulier/carriers/dpd_fr_soap/transport.py +++ b/roulier/carriers/dpd_fr_soap/transport.py @@ -41,7 +41,6 @@ def _get_requests_headers(self, payload=None): def handle_500(self, response): """Handle reponse in case of ERROR 500 type.""" - log.warning("Dpd error 500") obj = objectify.fromstring(response.content) error_id = (obj.xpath("//ErrorId") or obj.xpath("//faultcode"))[0] error_message = (obj.xpath("//ErrorMessage") or obj.xpath("//faultstring"))[0] diff --git a/roulier/codec.py b/roulier/codec.py index e3e5ad0..963b4e3 100755 --- a/roulier/codec.py +++ b/roulier/codec.py @@ -22,7 +22,6 @@ def encode(self, input_payload): """Transform input from external app to compatible input for carrier webservice.""" validator = self.config.api(self.config) if not validator.validate(input_payload): - _logger.warning("api call exception:") raise InvalidApiInput( {"api_call_exception": validator.errors(input_payload)} )