Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion atmn/src/compose/models/planModels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ type PriceWithTiers = PriceBaseFields & {
/** Tiered pricing structure based on usage ranges */
tiers: Array<{ to: number | "inf"; amount: number }>;
/** Required when tiers is defined: how tiers are applied */
tierBehaviour: "graduated" | "volume";
tierBehavior: "graduated" | "volume";
};

// Price must have either amount OR tiers (not both, not neither)
Expand Down
2 changes: 1 addition & 1 deletion atmn/src/lib/transforms/apiToSdk/planItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const planItemTransformer = createTransformer<
billingUnits: api.price.billing_units,
maxPurchase: api.price.max_purchase ?? undefined,
billingMethod: api.price.billing_method,
tierBehaviour: api.price.tier_behaviour,
tierBehavior: api.price.tier_behaviour,
// Map API price.interval directly to SDK price.interval
interval: api.price.interval,
...(api.price.interval_count !== undefined && {
Expand Down
6 changes: 3 additions & 3 deletions atmn/src/lib/transforms/sdkToApi/plan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ function transformPlanItem(planItem: PlanItem): ApiPlanItemParams {
billingUnits?: number;
billingMethod?: string;
maxPurchase?: number;
tierBehaviour?: string;
tierBehavior?: string;
};

result.price = {
Expand All @@ -113,8 +113,8 @@ function transformPlanItem(planItem: PlanItem): ApiPlanItemParams {
...(priceWithBilling.maxPurchase !== undefined && {
max_purchase: priceWithBilling.maxPurchase,
}),
...(priceWithBilling.tierBehaviour !== undefined && {
tier_behaviour: priceWithBilling.tierBehaviour,
...(priceWithBilling.tierBehavior !== undefined && {
tier_behaviour: priceWithBilling.tierBehavior,
}),
};
}
Expand Down
6 changes: 3 additions & 3 deletions atmn/src/lib/transforms/sdkToCode/planItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export function buildPlanItemCode(
billingUnits?: number;
billingMethod?: string;
maxPurchase?: number;
tierBehaviour?: string;
tierBehavior?: string;
};

if (priceWithBilling.billingUnits !== undefined) {
Expand All @@ -82,8 +82,8 @@ export function buildPlanItemCode(
lines.push(`\t\t\t\tmaxPurchase: ${priceWithBilling.maxPurchase},`);
}

if (priceWithBilling.tierBehaviour !== undefined) {
lines.push(`\t\t\t\ttierBehaviour: '${priceWithBilling.tierBehaviour}',`);
if (priceWithBilling.tierBehavior !== undefined) {
lines.push(`\t\t\t\ttierBehavior: '${priceWithBilling.tierBehavior}',`);
}

// Handle price.interval and price.intervalCount (from PriceWithInterval type)
Expand Down
2 changes: 1 addition & 1 deletion typegen/genUtils/atmnTypeHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ type PriceWithTiers = PriceBaseFields & {
/** Tiered pricing structure based on usage ranges */
tiers: Array<{ to: number | "inf"; amount: number }>;
/** Required when tiers is defined: how tiers are applied */
tierBehaviour: "graduated" | "volume";
tierBehavior: "graduated" | "volume";
};

// Price must have either amount OR tiers (not both, not neither)
Expand Down