Use BillThirdParty tag when requesting UPS to bill charge to customs agent
It is not allowed to use BillShipper or BillReceiver with different accounts for different charges. Closes #15105
This commit is contained in:
@@ -421,17 +421,29 @@ class CreateShippingUPS_Customs_Incoterm(metaclass=PoolMeta):
|
||||
if (shipment.customs_international
|
||||
and shipment.incoterm
|
||||
and shipment.incoterm.import_duties == 'seller'):
|
||||
if customs_agent := shipment.customs_agent:
|
||||
account_number = customs_agent.ups_account_number
|
||||
else:
|
||||
account_number = credential.account_number
|
||||
payment_information['ShipmentCharge'].append({
|
||||
# Type 02 is for Duties and Taxes
|
||||
'Type': '02',
|
||||
'BillShipper': {
|
||||
'AccountNumber': account_number,
|
||||
charge = {
|
||||
# Type 02 is for Duties and Taxes
|
||||
'Type': '02',
|
||||
}
|
||||
if ((customs_agent := shipment.customs_agent)
|
||||
and (customs_agent.ups_account_number
|
||||
!= credential.account_number)):
|
||||
address = customs_agent.address
|
||||
charge['BillThirdParty'] = {
|
||||
'AccountNumber': customs_agent.ups_account_number,
|
||||
'Address': {
|
||||
'CountryCode': (
|
||||
address.country.code if address.country else ''),
|
||||
},
|
||||
})
|
||||
}
|
||||
if address.postal_code:
|
||||
charge['BillThirdParty']['Address']['PostalCode'] = (
|
||||
(address.postal_code or '').replace(' ', '')[:9])
|
||||
else:
|
||||
charge['BillShipper'] = {
|
||||
'AccountNumber': credential.account_number,
|
||||
}
|
||||
payment_information['ShipmentCharge'].append(charge)
|
||||
return payment_information
|
||||
|
||||
def get_international_form(self, shipment, credential):
|
||||
|
||||
Reference in New Issue
Block a user