Merged PR 2865: Propagate tax exclusive check in hero payments

# Description

This PR propagates tax exclusive check in hero payments for the reporting of Check in Hero.
Additionally, it keeps propagating the amounts with tax inclusiveness in case, at some point, we need them. These are with the new naming convention.

In order not to break anything, the previous amounts are duplicated and aliased in reporting.

Lastly, I spent some time adding some clarifications and documenting payments set to currency and the dependant used for check in hero.

# 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: #20046
This commit is contained in:
Oriol Roqué Paniagua 2024-09-17 07:25:09 +00:00
parent cc837ecd7a
commit 7b9ba021c1
5 changed files with 144 additions and 15 deletions

View file

@ -98,7 +98,7 @@ models:
data_type: date
description: "{{ doc('dwh_extracted_date_utc_desc')}}"
- name: stg_core_superhog_user
- name: stg_core__superhog_user
description: "The staging version of Core's SuperhogUser table. Do not confuse with User."
columns:
- name: id_superhoguser
@ -274,3 +274,120 @@ models:
- name: dwh_extracted_at_utc
data_type: timestamp with time zone
description: "Timestamp of when data was extracted to DWH"
- name: stg_core__payment_validation_set_to_currency
description: |
This table contains the prices to be applied for each
host among the different payment services that will apply
to guests.
Each host can have multiple currencies with a different price
set per service. These prices are therefore in the local currency,
not necessarily in GBP. Be aware that services prices are tax
inclusive to those countries in which taxes apply. Lastly, cover
options, understood as protection, do not have taxes because of
the nature of it.
Important note: at this stage, it's not known how are we able to
determine which payment validation set, and therefore, the prices linked
to it for a given verification request.
columns:
- name: id_payment_validation_set_to_currency
data_type: bigint
description: Record id for this table
tests:
- unique
- not_null
- name: id_payment_validation_set
data_type: bigint
description: |
Identifier of the user payment validation set. This id will
appear as many times as different currencies are set per
validation set.
- name: guest_fee_local_curr
data_type: numeric
description: |
The deposit fee to be paid by the guest. This fee gets not refunded.
Tax inclusive in local currency.
- name: deposit_amount_local_curr
data_type: numeric
description: |
The deposit amount that Superhog takes and pays back if there has been no issues.
In local currency.
- name: waiver_guest_fee_amount_local_curr
data_type: numeric
description: |
The waiver fee to be paid by the guest. This fee gets not refunded.
Tax inclusive in local currency.
- name: waiver_protection_amount_local_curr
data_type: numeric
description: |
The protection amount per waiver.
In local currency.
- name: checkin_cover_guest_fee_local_curr
data_type: numeric
description: |
The check in hero fee to be paid by the guest. This fee gets not refunded.
Tax inclusive in local currency.
- name: checkin_cover_limit_amount_local_curr
data_type: numeric
description: |
The cover amount for check in hero.
In local currency.
- name: local_currency_iso_4217
data_type: char(3)
description: |
Three-letter ISO code assigned to the currency used by user.
- name: is_fee_refundable
data_type: boolean
description: |
Whether a fee is refundable or not.
- name: disabled_validation_options
data_type: integer
description: |
Integer corresponding to the sum of services that are disabled.
This is a very tricky field. The way to know which services are
configured is as follows:
CASE WHEN disabled_validation_options & 1 > 0 THEN 0 ELSE 1 END AS [Fee(1)],
CASE WHEN disabled_validation_options & 2 > 0 THEN 0 ELSE 1 END AS [Membership(2)],
CASE WHEN disabled_validation_options & 4 > 0 THEN 0 ELSE 1 END AS [FeeWithDeposit(4)],
CASE WHEN disabled_validation_options & 8 > 0 THEN 0 ELSE 1 END AS [Waiver(8)],
CASE WHEN disabled_validation_options & 16 > 0 THEN 0 ELSE 1 END AS [NoCover(16)]
Note that membership is a legacy validation that no longer exists.
- name: created_at_utc
data_type: timestamp
description: |
Timestamp of when the payment validation set to currency was created
- name: created_date_utc
data_type: date
description: |
Date of when the payment validation set to currency was created
- name: updated_at_utc
data_type: timestamp
description: |
Timestamp of when the payment validation set to currency was last updated
- name: updated_date_utc
data_type: date
description: |
Date of when the payment validation set to currency was last updated
- name: dwh_extracted_at_utc
data_type: timestamp
description: |
Timestamp of when this data was extracted into DWH.