fix(billing): use tier_id instead of tier_code for feature limit endpoints
Some checks failed
CI / ruff (push) Successful in 10s
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

Tier codes are not unique across platforms (e.g., "essential" exists for
OMS, marketplace, and loyalty). Using tier_code caused feature limits to
be saved to the wrong tier. Switched to tier_id (unique PK) in routes,
service, and frontend JS. Added comprehensive unit and integration tests
including cross-platform isolation regression tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-24 13:06:18 +01:00
parent f47c680cb8
commit 2833ff1476
5 changed files with 661 additions and 21 deletions

View File

@@ -273,7 +273,7 @@ function adminSubscriptionTiers() {
try {
// Load tier's current feature limits
const data = await apiClient.get(`/admin/subscriptions/features/tiers/${tier.code}/limits`);
const data = await apiClient.get(`/admin/subscriptions/features/tiers/${tier.id}/limits`);
// data is TierFeatureLimitEntry[]: [{feature_code, limit_value, enabled}]
this.selectedFeatures = [];
for (const entry of (data || [])) {
@@ -327,7 +327,7 @@ function adminSubscriptionTiers() {
}));
await apiClient.put(
`/admin/subscriptions/features/tiers/${this.selectedTierForFeatures.code}/limits`,
`/admin/subscriptions/features/tiers/${this.selectedTierForFeatures.id}/limits`,
entries
);