Repository navigation
Added
- Shoppers can cancel their own orders with
PATCH /v1/orders/:id/cancelthrough the newcancel_own_orderspermission, which the boot-time role sync grants to theCUSTOMERsystem role. A shopper can cancel while the order isPENDING_PAYMENT,PAYMENT_FAILEDorCONFIRMED. Onlymanage_orderscallers can also cancel aPROCESSINGorder. A payment that completes after an order was cancelled is recorded on it and refunded (#408).
Changed
- Order responses expose only
totalAmountfor the order total.totalPriceis removed from those HTTP bodies (#422). - Boot now refreshes system permission descriptions from the catalog, and
manage_ordersdescribes status transitions and cancel rather than create/update/delete (#421). - Cancelling a paid order with a zero total now returns code
REFUND_AMOUNT_INVALID(still HTTP 422) instead ofUSECASE_ERROR(#420). - OpenAPI shared error body documents common
codevalues (including"ORDER_NOT_FOUND","PAYMENT_NOT_FOUND","UNAUTHORIZED","FORBIDDEN") as a non-exhaustive string, not a closed enum (#417). - Refund jobs carry the amount as Money (minor units and currency) instead of a major-unit number (#415, #423).
PATCH /v1/orders/:id/cancelacceptsmanage_ordersorcancel_own_orders(it requiredmanage_orders). A missing order, or one the caller may not cancel, returns the same 404 body asGET /v1/orders/:id, and a caller with neither permission gets 403 (#408, #414).- Missing resources now return 404 with ORDER_NOT_FOUND, PAYMENT_NOT_FOUND, ROLE_NOT_FOUND, USER_ROLE_ASSIGNMENT_NOT_FOUND, CART_NOT_FOUND, PRODUCT_NOT_FOUND, USER_NOT_FOUND, CATEGORY_NOT_FOUND, ADDRESS_NOT_FOUND, CART_ITEM_NOT_FOUND or NOTIFICATION_NOT_FOUND (many returned 422, admin order transitions returned REPOSITORY_ERROR) (#414).
- Production dependencies: OpenTelemetry API 1.9.1 -> 1.10.0, SDK and OTLP gRPC exporter 0.223.0 -> 0.300.0, resources 2.12.0 -> 3.0.0, auto-instrumentations 0.81.2 -> 0.82.0, envalid 8.2.0 -> 9.0.0,
@nestjs/swagger12.0.2 -> 12.0.5, stripe 23.0.0 -> 23.0.1 (#394, #401, #402, #406).
Fixed
- Login matches the email case-insensitively, so users registered with uppercase letters can sign in (#416).
- 401, 403 and 429 responses return the codes UNAUTHORIZED, FORBIDDEN and TOO_MANY_REQUESTS instead of Unauthorized, Forbidden and INTERNAL_ERROR (#413).
- A payment that is not the one an order accepted (a second payment on a settled order, a different payment on a cancelled order, or a late payment on a payment-failed order) is now refunded in full instead of being dropped, and refund jobs are keyed per payment (#409).
Upgrade notes
- Breaking: API clients must read order totals from
totalAmount. ThetotalPriceproperty is no longer present on order responses (#422). - Before deploying, let the refund-payment queue finish (no waiting, active or delayed refund jobs), because queued refund jobs use the old payload and old order- job ids. Do not delete queued jobs (#415, #423).
- API clients that handle cancelling a paid order with a zero total must check for code
REFUND_AMOUNT_INVALIDinstead ofUSECASE_ERROR(HTTP 422 remains unchanged) (#420). - API clients must branch on HTTP 404 and the new
*_NOT_FOUNDcodes for missing path-addressed resources instead of 422,USECASE_ERRORorQUERY_ERROR(#414). - Clients that compare
codetoUnauthorizedorForbidden, or treat 429 asINTERNAL_ERROR, must useUNAUTHORIZED,FORBIDDENandTOO_MANY_REQUESTS. Other framework statuses without an explicit code now use their HTTP status names (for exampleMETHOD_NOT_ALLOWED,PAYLOAD_TOO_LARGE) (#412, #413). - Custom roles: no migration grants
cancel_own_orders. Every custom shopper role, existing or new, must be grantedcancel_own_ordersto let its users cancel their own orders. TheCUSTOMERsystem role gets it on boot (#408).
Full changelog: v0.13.0...v0.14.0