Add conditional validation to ProductRatePlanChargeTier.price
Problem
As part of Product catalog sync is failing due to blank pr... (#10885 - closed) we remove the presence validation for Zuora::Local::ProductRatePlanChargeTier.price
and the not null constrain from its respective database column.
While the Zuora schema specifies that the price
attribute is required it looks like this isn't the case given some errors that we get recently.
From this comment:
It looks like there could be different scenarios when we should validate the
price
attribute. We must validate theprice
attribute when the charge is a flat fee, or the price of each unit in the tier if the charge model is tiered pricing. We do allownull
values in theprice
column https://gitlab.com/gitlab-org/customers-gitlab-com/-/blob/4b72e82dcfe5f60a67333a531e1fcf642105f8ff/app/models/zuora/local/product_rate_plan_charge_tier.rb#L17.
Proposal
- Determine all the circumstances where the
price
attribute is required. - Include a conditional presence validation for
ProductRatePlanChargeTier.price
aligned with 1.