lib/active_shipping/carriers/usps.rb in active_shipping-1.6.4 vs lib/active_shipping/carriers/usps.rb in active_shipping-1.6.5
- old
+ new
@@ -628,10 +628,13 @@
end
end
shipment_events = shipment_events.sort_by(&:time)
+ # USPS defines a delivery attempt with code 55
+ attempted_delivery_date = shipment_events.detect{ |shipment_event| shipment_event.type_code=="55" }.try(:time)
+
if last_shipment = shipment_events.last
status = last_shipment.status
actual_delivery_date = last_shipment.time if last_shipment.delivered?
end
end
@@ -643,9 +646,10 @@
:shipment_events => shipment_events,
:destination => destination,
:tracking_number => tracking_number,
:status => status,
:actual_delivery_date => actual_delivery_date,
+ :attempted_delivery_date => attempted_delivery_date,
:scheduled_delivery_date => scheduled_delivery
)
end
def error_description_node(node)