Skip to content

fix(deliveroo): handle UK API type differences#3

Open
Paul-Simpson wants to merge 1 commit intosteipete:mainfrom
Paul-Simpson:fix/deliveroo-uk-type-mismatch
Open

fix(deliveroo): handle UK API type differences#3
Paul-Simpson wants to merge 1 commit intosteipete:mainfrom
Paul-Simpson:fix/deliveroo-uk-type-mismatch

Conversation

@Paul-Simpson
Copy link

Summary

Fixes JSON unmarshaling errors when using ordercli deliveroo history with UK accounts.

Problem

The UK Deliveroo API returns different types than expected:

  • order_number: returned as int, model expected string
  • total: returned as string (e.g., "19.64"), model expected *float64

This caused errors like:

json: cannot unmarshal number into Go struct field Order.orders.order_number of type string

Changes

  • internal/deliveroo/model.go: Changed OrderNumber to int, Total/OriginalTotal to string
  • internal/deliveroo/format.go: Updated Summary() to handle new types
  • internal/deliveroo/format_test.go: Updated test fixtures

Testing

Tested with a real UK Deliveroo account:

$ ordercli deliveroo history --limit 3
id=50547707756 number=7756 status=DELIVERED restaurant=Sacro Cuore total=£19.64
id=50502752644 number=2644 status=DELIVERED restaurant=Thai Express total=£45.18
id=50500420138 number=138 status=DELIVERED restaurant=Sacro Cuore total=£37.95

Fixes #2

The UK Deliveroo API returns:
- order_number as int (not string)
- total as string (not float64)

This fixes JSON unmarshaling errors when using ordercli with UK accounts.

Fixes steipete#2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deliveroo UK: order_number type mismatch (int vs string)

1 participant