Skip to content

TRK-006 β€” Gate Pass PDF with QR Code πŸ”΄Β #34

Description

@hajk1

Generate a gate pass document that authorizes a container to enter or leave a port terminal. This is
a standard document in freight operations.

New endpoint:

  • GET /api/v1/freight-orders/{id}/gate-pass β€” returns PDF (Content-Type: application/pdf)

Gate pass should include:

  • Gate pass number (auto-generated, e.g. GP-2025-00042)
  • QR code encoding the tracking URL for the order
  • Container code with Code 128 barcode
  • Container size and type
  • Voyage number, vessel name
  • Departure port and arrival port
  • Customer company name
  • Agent name (if AGT-001 is done, otherwise orderedBy)
  • Valid date range (departure date Β± 3 days for buffer)
  • Large bold text: GATE IN or GATE OUT (request param: direction=IN|OUT)

New endpoint parameter:

  • GET /api/v1/freight-orders/{id}/gate-pass?direction=IN

Gate pass layout suggestion:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚         *** GATE IN PASS ***        β”‚
β”‚         GP-2025-00042               β”‚
β”‚                                     β”‚
β”‚  Container: MSCU1234567             β”‚
β”‚  |||||||||||||||||||||||| (Code128) β”‚
β”‚  Size: 20ft    Type: DRY           β”‚
β”‚                                     β”‚
β”‚  Voyage: VOY-2025-001              β”‚
β”‚  Vessel: MV Freight Star           β”‚
β”‚  Route: Jebel Ali β†’ Shanghai       β”‚
β”‚                                     β”‚
β”‚  Customer: Acme Trading LLC        β”‚
β”‚  Valid: 2025-03-29 to 2025-04-04   β”‚
β”‚                                     β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”                       β”‚
β”‚  β”‚  QR     β”‚  Scan to track        β”‚
β”‚  β”‚  Code   β”‚                       β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Business rules:

  • Gate pass can only be generated for orders with status PENDING, CONFIRMED, or IN_TRANSIT
  • Return 409 if order is CANCELLED or DELIVERED
  • direction parameter is required, return 400 if missing

Acceptance criteria:

  • PDF generates with both barcode and QR code
  • Direction (IN/OUT) shown prominently
  • Valid date range calculated from voyage departure
  • Returns 409 for cancelled/delivered orders
  • Returns 400 for missing direction parameter
  • Test verifies PDF generation for both directions
  • Code is formatted

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions