Skip to content

Feature request: expose the minimum order value (if the API returns it) #9

Description

@dvejsada

What

Expose Rohlík's minimum order value (the threshold under which an order cannot be submitted) on a typed model, if any of the endpoints the client already calls returns it.

Why

The Home Assistant integration (HA-RohlikCZ) and the dashboard cards (rohlik-cz-HA-cards) currently have no way to tell a user whether the cart is above the minimum. The cards therefore fall back to a manually configured min_order option.

The only related field the client exposes today is Cart.can_make_order, taken from submitConditionPassed in Cart.from_api (rohlik_api/models.py). That flag only turns true once a delivery slot, address and payment are all set at checkout, so it is not usable as a minimum-order indicator.

Where it might be

Not verified against a live response yet, so this needs a look at the raw JSON of:

  • POST /services/frontend-service/login (client.login()), which the integration keeps raw; the user.premium.premiumLimits.ordersWithoutPriceLimit structure suggests a "price limit" concept exists somewhere in the account data.
  • GET /services/frontend-service/v2/cart (CartService.get_content()): Cart.from_api keeps only totalPrice, items and submitConditionPassed; the payload may carry a minimum / price-limit field (or a structured list of submit conditions) that is currently dropped.
  • GET /services/frontend-service/first-delivery?reasonableDeliveryTime=true (DeliveryService.get_info()).

Proposed shape

  • Cart.minimum_order_price: float | None (CZK), None when the API does not provide it, plus Cart.currency if available.
  • Optionally the same value on whatever account/delivery model is the natural home for it, and a note in the README on which endpoint it comes from.

Once available, the integration can publish it as an attribute on the cart-price sensor and the cards will prefer it automatically over the manual option.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions