Panly API docsstaging

Screens / Split bill

Split bill

Split bill (PAN-135), from the cart's Split bill button. Split equally into N parts or by item (quantities per part); the split is created with an Idempotency-Key reused on retry. Each part is paid on its own by cash (cash received, change shown) or QRIS (reference). Once a part is paid the order is locked (409 split_locked on edits). 409 part_paid / split_stale re-read the split; 422 items_mismatch, amount_mismatch and cash_insufficient are translated. When every part is paid it offers the receipt. Split by amount (PAN-141): the cashier types an amount per part (mode by_amount); Continue is enabled only when the parts add up to the order total including charges.

App routes
/orders/id/:orderId/split
Access
orders.complete
Screen code
lib/screens/split_bill/split_bill_page.dart
lib/screens/split_bill/split_bill_controller.dart
lib/screens/split_bill/widgets/split_mode_view.dart
lib/screens/split_bill/widgets/split_items_view.dart
lib/screens/split_bill/widgets/split_pay_view.dart
lib/screens/split_bill/widgets/split_done_view.dart
lib/domain/splits/split_rules.dart
lib/data/splits/split_body.dart
lib/screens/split_bill/widgets/split_amounts_editor.dart
Source
elmermj/panly-app @ pre-staging-test (72aaffd)

API calls (4)

CallWhy the screen makes itWhere in the app code
GET /v1/orders/{orderId}
Get order with items and balance
Load the order to split lib/screens/split_bill/split_bill_controller.dart:78
lib/domain/usecases/orders/orders_usecase.dart:15
lib/data/repositories/orders_repository.dart:30
lib/data/datasources/orders_remote.dart:34
GET /v1/orders/{orderId}/split
Current split with its parts (PAN-135)
Resume an existing split lib/screens/split_bill/split_bill_controller.dart:81
lib/domain/usecases/splits/split_usecase.dart:19
lib/data/repositories/split_repository.dart:22
POST /v1/orders/{orderId}/splits
Split the bill (PAN-135)
Create the split, equal parts or by item lib/screens/split_bill/split_bill_controller.dart:219
lib/screens/split_bill/split_bill_controller.dart:222
lib/screens/split_bill/split_bill_controller.dart:227
lib/domain/usecases/splits/split_usecase.dart:17
lib/data/repositories/split_repository.dart:16
POST /v1/orders/{orderId}/splits/{splitId}/parts/{partNo}/pay
Pay one part of a split (PAN-135)
Pay one part by cash or QRIS lib/screens/split_bill/split_bill_controller.dart:274
lib/domain/usecases/splits/split_usecase.dart:29
lib/data/repositories/split_repository.dart:36

Each call links to its operation in the API reference. Code locations are file:line in panly-app at 72aaffd, listed from the screen down to the line that sends the request.