Use rohlik-api 0.3.0 (shared shop list, minimum order value); 1.0.0-beta4 - #93
Conversation
- Bump rohlik-api to 0.3.0 (manifest and test requirements). - Take the shop presets (base URL, name, currency, timezone) from rohlik_api.SITES instead of a local copy in const.py. The codes stored on config entries (cz, de, at, hu, ro) are the same, so existing entries are unaffected. - Cart Total sensor: new "Minimum Order Price" attribute from Cart.minimum_order_price, present only when the shop reports it. "Can Order" stays as is; it also needs checkout details, so it is not a minimum check. - Cart to-do items show each item's own currency, falling back to the shop's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0135WLPbnfESWnAJmw4P8uRH
…o currency - hub.py imports Site directly from rohlik_api rather than through const. - Test that the translated shop options match rohlik_api.SITES, so a shop added in a later rohlik-api release cannot appear without a label. - Test the cart to-do item currency and its fallback to the shop's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0135WLPbnfESWnAJmw4P8uRH
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0135WLPbnfESWnAJmw4P8uRH
|
@claude review this PR. Focus on correctness with rohlik-api 0.3.0 (the Generated by Claude Code |
|
Claude finished @dvejsada's task in 3m 2s —— View job Review of PR #93
|
Why
rohlik-api 0.3.0, now on PyPI, ships the Rohlík Group shop presets (
SITES), a currency on cart models, and the shop's minimum order value (Cart.minimum_order_price). The integration kept its own copy of the shop table from #92 and had no way to show the minimum.Changes
rohlik-apibumped from 0.2.0 to 0.3.0 inmanifest.jsonandrequirements_test.txt.rohlik_api.SITES, and the local copy inconst.pyis removed. The codes stored on config entries (cz,de,at,hu,ro) are unchanged, so existing entries are unaffected.Minimum Order Priceattribute, present only when the shop reports a minimum.Can Orderis unchanged. It mirrorssubmitConditionPassed, which also needs checkout details such as a delivery slot, so it can't tell you whether the minimum is met.Code review
A code review ran on the branch, and its fixes are in the second commit:
hub.pyimportsSitedirectly fromrohlik_api.en/cs) must matchrohlik_api.SITES. If a future library release adds a shop, CI fails instead of the setup screen showing an option without a label.Two findings were deliberately left as they are:
get_site()still falls back to Rohlík.cz. Changing that would change existing behavior; the new translation test partly guards against the shop list drifting.Minimum Order Priceis shown even when it is0. Anonymous carts report 0, but nothing shows that a logged-in cart does, so filtering it out would be guesswork.Follow-ups (not in this PR)
min_orderoption. It should prefer the newMinimum Order Priceattribute when present.Testing
python -m pytest tests/: 79 passed, against rohlik-api 0.3.0 from PyPI. The new tests cover the attribute being present or absent, the to-do currency, and the translation/SITESconsistency.🤖 Generated with Claude Code
https://claude.ai/code/session_0135WLPbnfESWnAJmw4P8uRH
Generated by Claude Code