[FIX] delivery_ups_hibou: ground rating if it isn't the initial service

This commit is contained in:
Jared Kipe
2022-03-11 08:58:07 -08:00
parent ec45c79940
commit b79c5c43c5

View File

@@ -165,13 +165,12 @@ def patched_get_shipping_price(self, shipment_info, packages, shipper, ship_from
_logger.warning('exception during the UPS Time In Transit request. ' + str(e)) _logger.warning('exception during the UPS Time In Transit request. ' + str(e))
tnt_ready = False tnt_ready = False
tnt_response = '-1' tnt_response = '-1'
if tnt_ready and hasattr(tnt_response, 'TransitReponse') and hasattr(tnt_response.TransitResponse, 'ServiceSummary'): if tnt_ready and hasattr(tnt_response, 'TransitResponse') and hasattr(tnt_response.TransitResponse, 'ServiceSummary'):
for service in tnt_response.TransitResponse.ServiceSummary: for service in tnt_response.TransitResponse.ServiceSummary:
if TNT_CODE_MAP.get(service.Service.Code) == service_type: if TNT_CODE_MAP.get(service.Service.Code) == res['service_code']:
if hasattr(service, 'EstimatedArrival') and hasattr(service.EstimatedArrival, 'BusinessDaysInTransit'): if hasattr(service, 'EstimatedArrival') and hasattr(service.EstimatedArrival, 'BusinessDaysInTransit'):
res['transit_days'] = int(service.EstimatedArrival.BusinessDaysInTransit) res['transit_days'] = int(service.EstimatedArrival.BusinessDaysInTransit)
break break
# use TNT API to
result.append(res) result.append(res)
else: else:
result = {} result = {}