Repository navigation
feat: add the Products, Prices and Tax rates APIs - #18
Conversation
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
dnevzorov
left a comment
There was a problem hiding this comment.
2 blocking issues, see inline comments.
Unverified
Monei/model/product.py:Product.slug,default_price_idandtax_rate_idare not nullable, whileUpdateProductRequestdocuments "Sendnullto remove". If the API returnsnullfor a removed field rather than leaving it out,products.get/updateraisesApiTypeErroron that response.
Outside the diff
Monei/model_utils.py:908: themultipleOfcheck 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
| "amount": (int,), # noqa: E501 | ||
| "currency": (str,), # noqa: E501 | ||
| "order_id": (str,), # noqa: E501 | ||
| "order_id": (PaymentOrderId,), # noqa: E501 |
There was a problem hiding this comment.
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')raisesApiTypeError.payment.order_id == '123'isFalse. The same applies toRecurringPaymentRequest,PaymentandSubscription.last_order_id. - Scenario: a response with an
orderIdover 40 characters, for example from an older payment, now raisesApiValueErrorinpayments.get. Before,order_idhad no client-side validation. - Fix: inline
orderIdin the spec, or addtypeMappings/schemaMappingsinconfig.jsonso it maps back tostr. 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
orderIdraises.
Generated by Claude Code
| ("value",): { | ||
| "inclusive_maximum": 100, | ||
| "inclusive_minimum": 0, | ||
| "multiple_of": 0.00010, |
There was a problem hiding this comment.
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.15and9.975raiseApiValueError: value must be a multiple of 0.0001. - Scenario: responses are validated too.
tax_rates.get/listraises for such a rate, and so doessubscriptions.getwhenevertaxcarries it. - Fix: drop
multipleOffromTaxRate-Percentagein the spec (the server already enforces it), or patchcheck_validationsto 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:908does(float(v) / 0.0001).is_integer().
Generated by Claude Code
| "max_length": 40, | ||
| "min_length": 1, | ||
| "regex": { | ||
| "pattern": r"", # noqa: E501 |
There was a problem hiding this comment.
Optional (non-blocking, your call): the generator dropped the spec pattern, so r"" matches everything.
- Scenario:
PaymentOrderId('has space')andProductSlug('Not A Slug!')pass client-side and only fail later with a server 400. MeanwhileUpdateProductRequest.slugdoes enforce^[a-z0-9]+(-[a-z0-9]+)*$. - Fix: check the generator output for extracted string schemas with a
pattern. Also inMonei/model/product_slug.py:57.
Generated by Claude Code
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 asmonei.products,monei.prices,monei.tax_rates:create,get,list,updateProduct,Price,TaxRate, theirCreate*Request/Update*Request/*List,PriceRecurring,TaxDetails, and constrained-field wrappers (ProductName,PriceInterval,TaxRatePercentage, ...)price_idonCreateSubscriptionRequest,UpdateSubscriptionRequest,PreviewSubscriptionUpdateRequest;price_id,product_id,taxonSubscriptiontest/test_products_prices_tax_rates.py: HTTP-layer tests for path, method, body and queryorder_idstaysstr.One accepted break, released as minor (2.10.0):
CreateSubscriptionRequestno longer takesamount,currency,intervalas positional arguments (now optional, sinceprice_idcan replace them). Keyword calls are unchanged.