Closed danh91 closed 2 weeks ago
[!IMPORTANT]
Review skipped
Auto reviews are disabled on this repository.
Please check the settings in the CodeRabbit UI or the
.coderabbit.yaml
file in this repository. To trigger a single review, invoke the@coderabbitai review
command.You can disable this status message by setting the
reviews.review_status
tofalse
in the CodeRabbit configuration file.
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
@danh91 Hello Dan, is there a reason on why this is still not released as a tag ? If you are not planning to release it could you please tell me how to build a tag from it the easiest ? thanks
Hi @vangelow, The build was deployed, but I forgot to create the GitHub release. I will try to automate that in the future.
The release has been created now.
@danh91 Hello Now the problem is that is not sending the duties payment at all I am attaching the request that I build to Karrio and later the request that Karrio sends to fedex api
{
"carrier_ids": [
"fedex"
],
"customs": {
"certify": true,
"commodities": [
{
"quantity": 1,
"title": "Personal documents",
"value_amount": 1,
"value_currency": "USD",
"weight": 1,
"weight_unit": "KG"
}
],
"content_type": "documents",
"duty": {
"currency": "USD",
"declared_value": 1,
"paid_by": "recipient"
},
"incoterm": "DDU",
"signer": "test"
},
"label_type": "PDF",
"metadata": {
"shipment_request_id": "633e08cf-cb50-484a-97ca-34924cdf77a2"
},
"options": {
"currency": "USD",
"declared_value": 1,
"preferred_service": "fedex_international_economy"
},
"parcels": [
{
"description": "Personal documents",
"dimension_unit": "CM",
"height": 1,
"is_document": true,
"length": 1,
"weight": 1,
"weight_unit": "KG",
"width": 1
}
],
"payment": {
"currency": "USD",
"paid_by": "sender"
},
"recipient": {
"address_line1": "Al Muskat",
"city": "Riyadh",
"country_code": "SA",
"person_name": "Test",
"phone_number": "+PHONE_NUMBER",
"postal_code": "00000",
"residential": false,
"validate_location": false
},
"service": "fedex_international_economy",
"shipper": {
"address_line1": "Compound Villa 62",
"city": "Cairo",
"country_code": "EG",
"person_name": "test",
"phone_number": "+PHONE_NUMBER",
"postal_code": "00000",
"residential": false,
"validate_location": false
}
}
{
"accountNumber": {
"value": "ACCOUNT_NUMBER_ANONYMIZED"
},
"labelResponseOptions": "LABEL",
"oneLabelAtATime": false,
"requestedShipment": {
"blockInsightVisibility": false,
"customsClearanceDetail": {
"commercialInvoice": {
"customerReferences": [
null
],
"originatorName": "test",
"termsOfSale": "DDU"
},
"commodities": [
{
"countryOfManufacture": "EG",
"customsValue": {
"amount": 1,
"currency": "USD"
},
"description": "Personal documents",
"name": "Personal documents",
"numberOfPieces": 1,
"quantity": 1,
"quantityUnits": "PCS",
"unitPrice": {
"amount": 1,
"currency": "USD"
},
"weight": {
"units": "KG",
"value": 1
}
}
],
"insuranceCharge": {
"amount": 0,
"currency": "USD"
},
"isDocumentOnly": true,
"totalCustomsValue": {
"amount": 2,
"currency": "USD"
}
},
"emailNotificationDetail": {
"aggregationType": "PER_SHIPMENT",
"emailNotificationRecipients": [
{
"emailNotificationRecipientType": "RECIPIENT",
"name": "Test",
"notificationEventType": [
"ON_DELIVERY",
"ON_EXCEPTION",
"ON_SHIPMENT"
],
"notificationFormatType": "HTML",
"notificationType": "EMAIL"
}
]
},
"labelSpecification": {
"imageType": "PDF",
"labelFormatType": "COMMON2D",
"labelOrder": "SHIPPING_LABEL_FIRST",
"labelStockType": "STOCK_4X6"
},
"packagingType": "YOUR_PACKAGING",
"pickupType": "DROPOFF_AT_FEDEX_LOCATION",
"preferredCurrency": "USD",
"rateRequestType": [
"LIST",
"ACCOUNT",
"PREFERRED"
],
"recipients": [
{
"address": {
"city": "Riyadh",
"countryCode": "SA",
"postalCode": "00000",
"residential": false,
"streetLines": [
"Al Muskat"
]
},
"contact": {
"personName": "Test",
"phoneNumber": "+PHONE_NUMBER"
}
}
],
"requestedPackageLineItems": [
{
"declaredValue": {
"amount": 2,
"currency": "USD"
},
"dimensions": {
"height": 1,
"length": 1,
"units": "CM",
"width": 1
},
"groupPackageCount": 1,
"itemDescription": "Personal documents",
"packageSpecialServices": {
"signatureOptionType": "SERVICE_DEFAULT",
"specialServiceTypes": [
"SIGNATURE_OPTION"
]
},
"subPackagingType": "OTHER",
"weight": {
"units": "KG",
"value": 1
}
}
],
"serviceType": "INTERNATIONAL_ECONOMY",
"shipDatestamp": "2024-11-13",
"shipper": {
"address": {
"city": "Cairo",
"countryCode": "EG",
"postalCode": "00000",
"residential": false,
"streetLines": [
"62 Compound Villa"
]
},
"contact": {
"personName": "test",
"phoneNumber": "+PHONE_NUMBER"
}
},
"shippingChargesPayment": {
"paymentType": "SENDER"
},
"totalDeclaredValue": {
"amount": 1,
"currency": "USD"
},
"totalPackageCount": 1,
"totalWeight": 2.21
},
"shipAction": "CONFIRM"
}
It basically does not add the duties as a part of the request to fedex
dutiesPayment=lib.identity(
fedex.DutiesPaymentType(
paymentType=provider_units.PaymentType.map(
customs.duty.paid_by
).value,
payor=lib.identity(
fedex.PayorType(
responsibleParty=fedex.ResponsiblePartyType(
address=fedex.AddressType(
streetLines=duty_billing_address.address_lines,
city=duty_billing_address.city,
stateOrProvinceCode=provider_utils.state_code(
duty_billing_address
),
postalCode=duty_billing_address.postal_code,
countryCode=duty_billing_address.country_code,
residential=duty_billing_address.residential,
),
contact=fedex.ResponsiblePartyContactType(
personName=lib.text(
duty_billing_address.contact, max=35
),
emailAddress=duty_billing_address.email,
phoneNumber=duty_billing_address.phone_number,
phoneExtension=None,
companyName=lib.text(
duty_billing_address.company_name,
max=35,
),
faxNumber=None,
),
accountNumber=fedex.AccountNumberType(
value=customs.duty.account_number
),
tins=lib.identity(
fedex.TinType(
number=duty_billing_address.tax_id,
tinType="FEDERAL",
)
if duty_billing_address.has_tax_info
else []
),
)
)
if duty_billing_address.address
else None
),
)
if customs.duty.paid_by != "sender"
and customs.duty.account_number
else None
This piece of code should not remove the whole payment, it should just allow to send duties payment of type recipient
without an account number. Account number is not a mandatory field if you send only the payment type and not add address information.
A.k.a if you add
paymentType=provider_units.PaymentType.map(
customs.duty.paid_by
).value
But skip the payorType and responsibleParty the request can be made with PaymentType as RECIPIENT successfuly
Changes
Fix
fedex
payor info data mapping #718