Merged PR 4423: Logic for Billable Bookings in New Dash Bookings
# Description Changes: * Tags services to be billed (invoiced to host) in the staging models of product_service and protection_plan * Propagates into booking_service_detail master table. This also computes billable dates. * Propagates into booking_summary master table. This has the final determination of a booking being billable or not, and when the first and last billing should occur. # Checklist - [X] The edited models and dependants run properly with production data. - [X] The edited models are sufficiently documented. - [X] The edited models contain PK tests, and I've ran and passed them. - [X] I have checked for DRY opportunities with other models and docs. - [X] I've picked the right materialization for the affected models. # Other - [ ] Check if a full-refresh is required after this PR is merged. Related work items: #27619
This commit is contained in:
parent
399feba9af
commit
a3793121af
6 changed files with 160 additions and 6 deletions
|
|
@ -576,6 +576,15 @@ models:
|
|||
data_tests:
|
||||
- not_null
|
||||
|
||||
- name: is_billable_service
|
||||
data_type: boolean
|
||||
description: |
|
||||
Flag that determines if the service is billable or not.
|
||||
If the service is billable, it is supposed to be included in the
|
||||
invoice to the host.
|
||||
data_tests:
|
||||
- not_null
|
||||
|
||||
- name: dwh_extracted_at_utc
|
||||
data_type: timestamp
|
||||
description: |
|
||||
|
|
@ -775,6 +784,14 @@ models:
|
|||
or an upgraded service (False).
|
||||
data_tests:
|
||||
- not_null
|
||||
- name: is_billable_service
|
||||
data_type: boolean
|
||||
description: |
|
||||
Flag that determines if the service is billable or not.
|
||||
If the service is billable, it is supposed to be included in the
|
||||
invoice to the host.
|
||||
data_tests:
|
||||
- not_null
|
||||
- name: dwh_extracted_at_utc
|
||||
data_type: timestamp
|
||||
description: |
|
||||
|
|
|
|||
|
|
@ -49,5 +49,17 @@ select
|
|||
then true
|
||||
else false
|
||||
end as is_default_service,
|
||||
case
|
||||
when
|
||||
id_product_service not in (
|
||||
1, -- 'BASIC SCREENING'
|
||||
5, -- 'BASIC DAMAGE DEPOSIT'
|
||||
6, -- 'DAMAGE DEPOSIT PLUS'
|
||||
7, -- 'BASIC WAIVER'
|
||||
8 -- 'WAIVER PLUS'
|
||||
)
|
||||
then true
|
||||
else false
|
||||
end as is_billable_service,
|
||||
dwh_extracted_at_utc
|
||||
from stg_core__product_service
|
||||
|
|
|
|||
|
|
@ -51,6 +51,14 @@ select
|
|||
then true
|
||||
else false
|
||||
end as is_default_service,
|
||||
case
|
||||
when
|
||||
id_protection_plan not in (
|
||||
1 -- 'BASIC SCREENING'
|
||||
)
|
||||
then true
|
||||
else false
|
||||
end as is_billable_service,
|
||||
pp.dwh_extracted_at_utc
|
||||
from raw_protection_plan pp
|
||||
left join raw_protection p on pp.id_protection = p.id
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue