Skip to content

feat: add the Products, Prices and Tax rates APIs - #18

Merged
dnevzorov merged 2 commits into
masterfrom
feat/products-prices-tax-rates
Nov 16, 2026
Merged

dnevzorov merged 2 commits into
masterfrom
feat/products-prices-tax-rates

Conversation

@dnevzorov

@dnevzorov dnevzorov commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

Regenerated from OpenAPI v1.13.0 (spec source: https://github.com/MONEI/monei-openapi-schema/pull/176, fixes in https://github.com/MONEI/monei-openapi-schema/pull/178).

  • ProductsApi, PricesApi, TaxRatesApi, exposed as monei.products, monei.prices, monei.tax_rates: create, get, list, update
  • New models: Product, Price, TaxRate, their Create*Request / Update*Request / *List, PriceRecurring, TaxDetails, and constrained-field wrappers (ProductName, PriceInterval, TaxRatePercentage, ...)
  • price_id on CreateSubscriptionRequest, UpdateSubscriptionRequest, PreviewSubscriptionUpdateRequest; price_id, product_id, tax on Subscription
  • README: Product Catalog section
  • test/test_products_prices_tax_rates.py: HTTP-layer tests for path, method, body and query

order_id stays str.

One accepted break, released as minor (2.10.0): CreateSubscriptionRequest no longer takes amount, currency, interval as positional arguments (now optional, since price_id can replace them). Keyword calls are unchanged.

@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-16T16:04:37.826568Z
We couldn’t complete this review. Comment @codex review to try again.
74dd627 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@dnevzorov dnevzorov left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 blocking issues, see inline comments.

Unverified

  • Monei/model/product.py: Product.slug, default_price_id and tax_rate_id are not nullable, while UpdateProductRequest documents "Send null to remove". If the API returns null for a removed field rather than leaving it out, products.get/update raises ApiTypeError on that response.

Outside the diff

  • Monei/model_utils.py:908: the multipleOf check is (float(v) / multiple_of).is_integer(), which is where the tax-rate failure comes from.

Push a fix, or reply and re-request review from @dnevzorov, to get a re-check.


Generated by Claude Code

Comment thread Monei/model/create_payment_request.py Outdated
"amount": (int,), # noqa: E501
"currency": (str,), # noqa: E501
"order_id": (str,), # noqa: E501
"order_id": (PaymentOrderId,), # noqa: E501

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking: order_id changes from str to PaymentOrderId, which breaks every existing caller in a minor release.

  • Scenario: CreatePaymentRequest(amount=100, currency='EUR', order_id='123') raises ApiTypeError. payment.order_id == '123' is False. The same applies to RecurringPaymentRequest, Payment and Subscription.last_order_id.
  • Scenario: a response with an orderId over 40 characters, for example from an older payment, now raises ApiValueError in payments.get. Before, order_id had no client-side validation.
  • Fix: inline orderId in the spec, or add typeMappings/schemaMappings in config.json so it maps back to str. If it stays as it is, release it as a major.
  • Evidence: 8 tests fail locally with the same error, and the PR body says the same. A deserialize probe with a 41-character orderId raises.

Generated by Claude Code

("value",): {
"inclusive_maximum": 100,
"inclusive_minimum": 0,
"multiple_of": 0.00010,

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking: multipleOf: 0.0001 uses float division, so it rejects valid percentages on requests and on responses.

  • Scenario: TaxRatePercentage(8.1) (Swiss VAT), 0.7, 1.2, 1.15 and 9.975 raise ApiValueError: value must be a multiple of 0.0001.
  • Scenario: responses are validated too. tax_rates.get/list raises for such a rate, and so does subscriptions.get whenever tax carries it.
  • Fix: drop multipleOf from TaxRate-Percentage in the spec (the server already enforces it), or patch check_validations to compare with a tolerance. Then regenerate.
  • Evidence: probe on the PR head: 21.0, 2.1 and 6.5 pass, while 8.1, 0.7 and 1.2 fail. model_utils.py:908 does (float(v) / 0.0001).is_integer().

Generated by Claude Code

Comment thread Monei/model/payment_order_id.py Outdated
"max_length": 40,
"min_length": 1,
"regex": {
"pattern": r"", # noqa: E501

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional (non-blocking, your call): the generator dropped the spec pattern, so r"" matches everything.

  • Scenario: PaymentOrderId('has space') and ProductSlug('Not A Slug!') pass client-side and only fail later with a server 400. Meanwhile UpdateProductRequest.slug does enforce ^[a-z0-9]+(-[a-z0-9]+)*$.
  • Fix: check the generator output for extracted string schemas with a pattern. Also in Monei/model/product_slug.py:57.

Generated by Claude Code

@dnevzorov
dnevzorov merged commit 8e39723 into master Nov 16, 2026
9 checks passed
@dnevzorov
dnevzorov deleted the feat/products-prices-tax-rates branch November 16, 2026 17:04
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