Build a functional checkout page for DoorDash using SwiftUI or UIKit (for iOS) or Jetpack Compose or XML (for Android) that includes an item list, pricing breakdown, payment method selector, and a confirmation button.
For grading, model the checkout behavior with a pure function. Each item contains a name, unit price in cents, and quantity. Return the subtotal, fees, total, selected payment method, and whether confirmation is allowed.
Function: checkout_page(items, delivery_fee_cents, service_fee_cents, payment_methods, selected_payment_method, confirm_pressed)
Output: Return a dictionary with subtotal_cents, total_cents, selected_payment_method, and can_confirm. Confirmation is allowed only when the cart is non-empty, the selected method is available, and the button was pressed.
def checkout_page(items, delivery_fee_cents, service_fee_cents, payment_methods, selected_payment_method, confirm_pressed):