Describe the bug
The bug is coming from the point that the Karrio fedex create shipment provider is always sending the payor details when the Duties payment is set to "RECIPIENT". From the fedex API docs we can see that the account number is conditional and it is required whenever you are sending the payor details along with the duties payment
In this file https://github.com/karrioapi/karrio/blob/main/modules/connectors/fedex/karrio/providers/fedex/shipment/create.py
between lines 440 and 455 you can see that it is set to None
if there is no duty_billing_address
, but if you go up to the assignment of that variable you can see that it is always said based on the shipper, recipient or duty billing address data so this condition is never going into the else clause.
To Reproduce
Send an API POST request to https://apis.fedex.com/ship/v1/shipments
To reproduce the bug you need to send the duties payment set to recipient and have some payor info
"dutiesPayment": {
"paymentType": "RECIPIENT",
"payor": {
"responsibleParty": {
"address": {
"city": "Cairo",
"countryCode": "EG",
"postalCode": "313123",
"residential": false,
"streetLines": [
"Al Muskat"
]
},
"contact": {
"personName": "Test",
"phoneNumber": "+9665555555"
}
}
}
},
This results in the api responding in
{
"transactionId": "6df71513-36bd-4a5c-8a14-175f21f3db10",
"errors": [
{
"code": "ACCOUNT.NUMBER.INVALID",
"message": "Account number not found. Please provide a valid account number."
}
]
}
In order to have a successful response with the shipment being created and the duties to be set to recipient you either send the full data of the recipient payor info + the account number or you leave the payor info empty
"dutiesPayment": {
"paymentType": "RECIPIENT",
"payor": {
"responsibleParty": {
}
}
},
Expected behavior
The duties payment can be set to recipient without sending a specific account number
Using latest karrio version
Additional context
I can help with debugging if you need help. I have a simple flat python file to test with if you need, but the bug is pretty straight forward.
@danh91
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too