Skip to main content

Approve delivery changes

PUT 

/company/delivery/aprove/:service_code

Approves changes made by the carrier in a rescheduled shipment. The status must be 'replanned' with replannedBy === 'trucker'.

Objective

Allow companies to accept modifications requested by the carrier, finalizing the change negotiation process.

Use Cases

  • Confirm date changes requested by the carrier
  • Approve modifications to the cargo (weight, pallets, temperature)
  • Accept changes in linear meters or cargo height
  • Finalize the change negotiation process

Approval Flow

flowchart LR
A[Trucker Edits] -->|replannedBy=trucker| B[Status: replanned]
B --> C{Company Reviews}
C -->|Approve| D[PUT /aprove]
D -->|replannedBy=aproved| E[Status: planned]
C -->|Reject| F[Manual Revert]

Validation Logic

flowchart TD
A[Receive Approval] --> B{Delivery Exists?}
B -->|No| C[404 NOT_FOUND]
B -->|Yes| D{Company Owns Delivery?}
D -->|No| E[404 NOT_ALLOWED]
D -->|Yes| F{Is Final Status?}
F -->|Yes| G[401 NOT_ALLOWED]
F -->|No| H{Already Approved?}
H -->|replannedBy=aproved| I[400 ALREADY_APROVED]
H -->|No| J{Must Approve Trucker?}
J -->|replannedBy≠trucker| K[401 MUST_APROVE_TRUCKER]
J -->|Yes| L[Set status=planned]
L --> M[Set replannedBy=aproved]
M --> N[Save - 200]

Notes

  • The shipment must be in 'replanned' status
  • replannedBy must be 'trucker' (cannot be 'aproved' or empty)
  • Cannot be a final status (delivered, claimed, canceled)
  • Only the owning company can approve
  • status changes to 'planned' (not to 'approved')
  • replannedBy changes to 'aproved'

Request

Responses

Changes approved successfully