Skip to content

Discount helpers on the builders; release 0.1.0a5 - #6

Merged
sandervanhooft merged 1 commit into
mainfrom
discount-helpers
Nov 30, 2026
Merged

sandervanhooft merged 1 commit into
mainfrom
discount-helpers

Conversation

@sandervanhooft

Copy link
Copy Markdown
Member

Adds with_percentage_discount(percentage, description=None) and with_amount_discount(amount: EurMoney | str, description=None) to the checkout and subscription builders. They match fluent-php (vatly/vatly-fluent-php#115).

  • Each call appends to the checkout discounts list. The SDK model allows one entry for now, so a second raises FluentError before sending. That leaves room for stacking, recurring durations or coupons later without breaking calls.
  • A string amount is sent in EUR, on the products' tax basis, including on the first payment after a trial. A Decimal percentage is sent as a string.
  • Pins the released vatly-api-python==0.1.0a5 and drops the git [tool.uv.sources] override, as Development.md asked once the SDK shipped add_version_string.
  • Docs: an "Add a discount" section with an executed example, plus the builder table. Release 0.1.0a5 in the CHANGELOG.

published-docs checks the docs against the already-released vatly-fluent-python==0.1.0a4, so it fails on the new example until 0.1.0a5 is on PyPI. The pin moves after release, as with the SDK.

Checks: 65 tests pass (coverage 87%), ruff and mypy are clean, and the build passes twine check and check_package.py.

….1.0a5

Adds with_percentage_discount() and with_amount_discount(), and pins the
released vatly-api-python 0.1.0a5 instead of the git source.

Amp-Thread-ID: https://ampcode.com/threads/T-3f59dfd0-1f6e-41a8-b940-15b496a7ab0c
Co-authored-by: Amp <amp@ampcode.com>
@sandervanhooft
sandervanhooft merged commit 5a19137 into main Nov 30, 2026
10 of 12 checks passed
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.

1 participant