kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
pull/715/head
rodzic
2656f75b1d
commit
dd795be893
|
@ -182,11 +182,6 @@ export async function upsertStripePricing({
|
|||
400,
|
||||
`Invalid pricing plan metric "${pricingPlanLineItemSlug}" for pricing plan "${pricingPlanSlug}": tiered billing schemes must have at least one tier.`
|
||||
)
|
||||
assert(
|
||||
!pricingPlanLineItem.transformQuantity,
|
||||
400,
|
||||
`Invalid pricing plan metric "${pricingPlanLineItemSlug}" for pricing plan "${pricingPlanSlug}": tiered billing schemes cannot have transformQuantity.`
|
||||
)
|
||||
|
||||
priceParams.tiers_mode = pricingPlanLineItem.tiersMode
|
||||
priceParams.tiers = pricingPlanLineItem.tiers.map((tierData) => {
|
||||
|
@ -215,11 +210,6 @@ export async function upsertStripePricing({
|
|||
400,
|
||||
`Invalid pricing plan metric "${pricingPlanLineItemSlug}" for pricing plan "${pricingPlanSlug}": unitAmount is required for per_unit billing schemes.`
|
||||
)
|
||||
assert(
|
||||
!(pricingPlanLineItem as any).tiers,
|
||||
400,
|
||||
`Invalid pricing plan metric "${pricingPlanLineItemSlug}" for pricing plan "${pricingPlanSlug}": per_unit billing schemes cannot have tiers.`
|
||||
)
|
||||
|
||||
priceParams.unit_amount_decimal =
|
||||
pricingPlanLineItem.unitAmount.toFixed(12)
|
||||
|
|
|
@ -170,12 +170,11 @@ export function validatePricing({
|
|||
`Invalid PricingPlan "${pricingPlan.slug}": metered LineItem "${lineItem.slug}" must specify a valid "tiersMode" when using "tiered" billing scheme.`
|
||||
)
|
||||
|
||||
// TODO: Not sure if this is a valid requirement or not. If it is, update
|
||||
// the corresponding type in the schemas package.
|
||||
// assert(
|
||||
// lineItem.transformQuantity === undefined,
|
||||
// `Invalid pricingPlan "${pricingPlan.slug}": metered LineItem "${lineItem.slug}" must not specify "transformQuantity" when using "tiered" billing scheme.`
|
||||
// )
|
||||
// TODO: Not sure if this is a valid requirement or not.
|
||||
assert(
|
||||
(lineItem as any).transformQuantity === undefined,
|
||||
`Invalid pricingPlan "${pricingPlan.slug}": metered LineItem "${lineItem.slug}" must not specify "transformQuantity" when using "tiered" billing scheme.`
|
||||
)
|
||||
break
|
||||
|
||||
default:
|
||||
|
|
|
@ -225,7 +225,7 @@ export const pricingPlanMeteredLineItemSchema =
|
|||
*
|
||||
* This field requires `billingScheme` to be set to `tiered`.
|
||||
*/
|
||||
tiers: z.array(pricingPlanTierSchema).optional(),
|
||||
tiers: z.array(pricingPlanTierSchema).nonempty().optional(),
|
||||
|
||||
// TODO: add support for tiered rate limits?
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue