Create Zuora::Local::ProductRatePlan model
Background
As part of [Product Catalog] Phase 1: Build Zuora Cache Mo... (&13852) we want to create a CustomersDot cached Product Catalog that is aligned with Zuora Product Catalog.
For this we need to create the database tables + ActiveRecord models to locally represent the CustomersDot Product Catalog related objects:
Product
ProductRatePlan
ProductRatePlanCharge
ProductRatePlanChargeTier
Proposal
Create a new Zuora::Local::ProductRatePlan
cache for Zuora ProductRatePlan:
- Create a database table
zuora_product_rate_plan
- Set
zuora_id
as the primary key - A proposed list of the columns can be found in the Table columns section.
- Set
- Create an
ActiveRecord
modelZuora::Local::ProductRatePlan
- Create the model under
app/models/zuora/local
. - Include any validations and constrains that are supported by Zuora for ProductRatePlan.
- Create a spec file under
spec/models/zuora/local
and make sure to cover all validations - Create a factory under
spec/models/zuora/local
- Create the model under
Additional notes
- The timezone for Zuora Billing is configured as Pacific Time. Let's account for this timezone as we sync data from Zuora into CDot's cached models to allow for more accurate comparisons.
Zuora Resources
Table columns
This is a list of proposed columns based on Zuora resources documentation + CustomersDot imported schema + excluded_fields.yml
and code usage.
-
Review the proposed columns against the sources listed above as a validation step before moving on with the table creation: details in #9598 (comment 1911188160)
Object attributes / table columns
KEEP:
- Id
- ProductId
- Description
- EffectiveEndDate
- EffectiveStartDate
- LegacyTierUIDisplay__c
- Name
- CreatedById
- CreatedDate
- UpdatedById
- UpdatedDate
IGNORE:
- ExternalIdSourceSystem
- ExternalRatePlanIds
- Grade
- GuidedSelling__c
- PRPCategory__c
- ProductRatePlanNumber
- ActiveCurrencies
Object .remote view
{
:created_by_id=>"4991efe1c9c33359baeb12e7537fc109",
:created_date=>"2021-01-11T11:42:39-0800",
:effective_end_date=>"2099-12-31",
:effective_start_date=>"2021-01-01",
:guided_selling__c=>"Display",
:id=>"2c92a0ff76f0d5250176f2f8c86f305a",
:legacy_tier_ui_display__c=>"Previously Gold",
:name=>"SaaS - Ultimate - 1 Year",
:product_rate_plan_number=>"PRP-00000263",
:prp_category__c=>"Base Products",
:updated_by_id=>"3e07ae1ff17930a588cbcf829bb5de89",
:updated_date=>"2023-08-17T10:22:41-0700",
:product_id=>"2c92a00e76f0c6910176f298a76c10ea"
}
🐾 Delivery plan
-
Add Zuora::Local::ProductRatePlan
model and migration: https://gitlab.com/gitlab-org/customers-gitlab-com/-/merge_requests/10051 -
Define relationships between Zuora::Local::ProductRatePlan
andZuora::Local::Product
and update factories.
Edited by Vladlena Shumilo