Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IMP] Port delivery_instruction from python 2 old branch for dpd #170

Merged
merged 2 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions roulier/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 2 additions & 0 deletions roulier/carriers/dpd_fr_soap/templates/dpd_addressInfo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
<car:digicode1>{{ address.digicode1 }}</car:digicode1>
<car:digicode2>{{ address.digicode2 }}</car:digicode2>
<car:intercomid>{{ address.intercom }}</car:intercomid>
<car:vinfo1>{{ address.delivery_instruction[0:35] }}</car:vinfo1>
<car:vinfo2>{{ address.delivery_instruction[35:70] }}</car:vinfo2>
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<car:CreateShipmentWithLabels{{ '' if legacy else 'Bc'}} xmlns:car="http://www.cargonet.software">
<car:request>
{% with address = receiver_address %}
<car:customLabelText>
{{ address.delivery_instruction }}
</car:customLabelText>
<car:receiveraddress>
{% include "dpd_address.xml" %}
</car:receiveraddress>
Expand Down
1 change: 0 additions & 1 deletion roulier/carriers/dpd_fr_soap/transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
1 change: 0 additions & 1 deletion roulier/codec.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)}
)
Expand Down
Loading