Merged PR 3638: Propagates billing info to booking service detail and booking summary
# Description Changes: * Handles conversion to GBP directly in the models `int_core__product_service_billing_item` and `int_core__protection_plan_billing_item` . * Adds the newly created field of `is_missing_id_deal` in `int_core__booking_to_service`, to avoid manually computing downstream. * Computes total price per service in `int_core__booking_service_detail`. Since, technically, the same service can have different billing lines, I also retrieve some min/max charge dates and some booleans to help the identification. * Computes total price per booking in `int_core__booking_summary`. Since, technically, the same booking can have different services charged in different moments in time, I also retrieve some min/max charge dates. I also computed a very necessary `is_booking_charged` to understand if we're making money or not out of it. This PR should provide the necessary fields to start computing Revenue for New Dash. HOWEVER: 1) I still need to handle Guest Payments computation for Waiver/Deposit services. I'll do it in a separated PR. 2) while doing this exercise I noticed that the current data is not good / consistent with what I was expecting in terms of New Pricing documentation. I will check with Dash Squad so it's correctly filled, before reporting fake numbers... # 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: #20809
This commit is contained in:
parent
2ede94370b
commit
059c92b345
6 changed files with 194 additions and 76 deletions
|
|
@ -3336,6 +3336,12 @@ models:
|
|||
Iso 4217 currency code for the account of the Host.
|
||||
It can be null.
|
||||
|
||||
- name: is_missing_id_deal
|
||||
data_type: boolean
|
||||
description: |
|
||||
Flag to identify if the Host for this booking is missing
|
||||
the Id Deal or not.
|
||||
|
||||
- name: is_user_in_new_dash
|
||||
data_type: boolean
|
||||
description: |
|
||||
|
|
@ -3564,16 +3570,13 @@ models:
|
|||
- name: service_unit_price_in_gbp
|
||||
data_type: decimal
|
||||
description: |
|
||||
Identifies the service unit price converted to GBP with the rate
|
||||
of the date of charge. Can be null. Can vary over time until the
|
||||
charge date due to the currency rate estimation in the future.
|
||||
|
||||
- name: service_total_price_local_curr
|
||||
data_type: decimal
|
||||
description: |
|
||||
Identifies the current total price of that service in a given
|
||||
booking in the local currency. Can be null. Can vary over time
|
||||
depending on the service status, payments, etc.
|
||||
This is an informative field, use at your own risk.
|
||||
Identifies the service unit price converted to GBP. If the date of
|
||||
the charge exists, it will use the latest charge date for the exchange
|
||||
rate computation. If not, it will use the moment this service detail line
|
||||
was created. It can be null. It can vary over time due to the currency rate
|
||||
estimation in the future for charge dates, and can vary also because of
|
||||
changes in the date used.
|
||||
|
||||
- name: service_total_price_in_gbp
|
||||
data_type: decimal
|
||||
|
|
@ -3584,15 +3587,27 @@ models:
|
|||
time until the charge date due to the currency rate estimation in
|
||||
the future.
|
||||
|
||||
- name: service_charge_date_utc
|
||||
- name: service_first_charge_date_utc
|
||||
data_type: date
|
||||
description: |
|
||||
Identifies the moment in time in which the service is charged.
|
||||
Identifies the first date in which the billing item for this service
|
||||
is supposed to be charged. It can be null if no billing item is
|
||||
available. If there's only one billing item, this field will contain
|
||||
the same value as service_last_charge_date_utc.
|
||||
|
||||
- name: service_last_charge_date_utc
|
||||
data_type: date
|
||||
description: |
|
||||
Identifies the last date in which the billing item for this service
|
||||
is supposed to be charged. It can be null if no billing item is
|
||||
available. If there's only one billing item, this field will contain
|
||||
the same value as service_first_charge_date_utc.
|
||||
|
||||
- name: is_missing_currency_code
|
||||
data_type: boolean
|
||||
description: |
|
||||
Flag to identify if the applied service is missing the currency code.
|
||||
Cannot be null.
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
|
|
@ -3600,14 +3615,15 @@ models:
|
|||
data_type: boolean
|
||||
description: |
|
||||
Flag to identify if the booking has been cancelled or not.
|
||||
Cannot be null.
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
- name: is_paid_service
|
||||
data_type: boolean
|
||||
description: |
|
||||
Flag to identify it the service total price is strictly
|
||||
greater than 0 or not.
|
||||
Flag to identify it the service unit price is strictly
|
||||
greater than 0 or not. Cannot be null.
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
|
|
@ -3615,10 +3631,27 @@ models:
|
|||
data_type: boolean
|
||||
description: |
|
||||
Flag to identify if the service is an upgraded version,
|
||||
meaning, it's not a Basic Screening.
|
||||
meaning, it's not a Basic Screening. Cannot be null.
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
- name: is_missing_charge_date
|
||||
data_type: boolean
|
||||
description: |
|
||||
Flag to identify if the service has no charge date.
|
||||
Cannot be null.
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
- name: is_service_charged_in_a_single_date
|
||||
data_type: boolean
|
||||
description: |
|
||||
Flag to identify if the service is charged in a single date.
|
||||
If True, it means that service_first_charge_date_utc contains
|
||||
the same date as service_last_charge_date_utc. If False, these
|
||||
fields will contain different dates. It can be null, thus meaning
|
||||
there's no charge date at all.
|
||||
|
||||
- name: int_core__booking_summary
|
||||
description: |
|
||||
This model contains enriched information aggregated at Booking level regarding
|
||||
|
|
@ -3806,6 +3839,20 @@ models:
|
|||
Total number of Services different from Basic Screening
|
||||
applied to this Booking.
|
||||
|
||||
- name: is_booking_charged
|
||||
data_type: boolean
|
||||
description: |
|
||||
Flag to identify it the Booking is charged or not.
|
||||
In essence, it solves the question: are we getting money out
|
||||
of this booking, or not?
|
||||
To be considered as charged, a charge date needs to exist as
|
||||
well as the total price converted to GBP needs to be strictly
|
||||
greater than 0. The fact that a booking is not charged does
|
||||
not necessarily mean that it won't be in the future. It cannot
|
||||
be null.
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
- name: is_missing_currency_code_in_service_detail
|
||||
data_type: boolean
|
||||
description: |
|
||||
|
|
@ -3933,6 +3980,15 @@ models:
|
|||
tests:
|
||||
- not_null
|
||||
|
||||
- name: amount_in_gbp
|
||||
data_type: decimal
|
||||
description: |
|
||||
Price of the Billing Item, in GBP. It uses the exchange rate according to
|
||||
chargeable date. It can be positive or negative, depending on if the
|
||||
line aims to add or remove a previously created amount.
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
- name: chargeable_at_utc
|
||||
data_type: timestamp
|
||||
description: |
|
||||
|
|
@ -4050,6 +4106,15 @@ models:
|
|||
tests:
|
||||
- not_null
|
||||
|
||||
- name: amount_in_gbp
|
||||
data_type: decimal
|
||||
description: |
|
||||
Price of the Billing Item, in GBP. It uses the exchange rate according to
|
||||
chargeable date. It can be positive or negative, depending on if the
|
||||
line aims to add or remove a previously created amount.
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
- name: chargeable_at_utc
|
||||
data_type: timestamp
|
||||
description: |
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue