fix(loyalty): accept store_id in body for merchant PIN create
Some checks failed
CI / ruff (push) Successful in 15s
CI / validate (push) Has been cancelled
CI / dependency-scanning (push) Has been cancelled
CI / docs (push) Has been cancelled
CI / deploy (push) Has been cancelled
CI / pytest (push) Has been cancelled

The merchant /pins POST was reading store_id as a query parameter, but
the shared loyalty pins JS factory sends the form (including store_id)
as a JSON body — matching the store-side endpoint, which gets store_id
from the JWT and ignores any body field. Result: a 422 "Field
required" on every PIN create from /merchants/loyalty/pins.

Add PinCreateForMerchant (PinCreate + store_id) and switch the
endpoint to it. Validation that the store belongs to the merchant is
unchanged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-05 21:25:01 +02:00
parent 573b0ef483
commit cb8e6a0ec3
3 changed files with 19 additions and 6 deletions

View File

@@ -39,6 +39,7 @@ from app.modules.loyalty.schemas.card import (
from app.modules.loyalty.schemas.pin import (
# Staff PIN
PinCreate,
PinCreateForMerchant,
PinDetailListResponse,
PinDetailResponse,
PinListResponse,
@@ -131,6 +132,7 @@ __all__ = [
"PointsAdjustResponse",
# PIN
"PinCreate",
"PinCreateForMerchant",
"PinUpdate",
"PinResponse",
"PinDetailResponse",