Added fees in gbp

This commit is contained in:
Joaquin Ossa 2025-01-20 15:14:57 +01:00
parent b58d165eff
commit 31e4feb593
3 changed files with 34 additions and 2 deletions

View file

@ -4,7 +4,8 @@ with
), ),
int_core__check_in_hero_users as ( int_core__check_in_hero_users as (
select * from {{ ref("int_core__check_in_hero_users") }} select * from {{ ref("int_core__check_in_hero_users") }}
) ),
int_simple_exchange_rates as (select * from {{ ref("int_simple_exchange_rates") }})
select select
c.id_record, c.id_record,
@ -14,6 +15,8 @@ select
chu.id_currency, chu.id_currency,
chu.currency_code, chu.currency_code,
chu.booking_fee_in_local_currency, chu.booking_fee_in_local_currency,
ser.rate as exchange_rate_to_gbp,
ser.rate * chu.booking_fee_in_local_currency as booking_fee_in_gbp,
c.guest_last_name, c.guest_last_name,
c.guest_first_name, c.guest_first_name,
c.guest_email, c.guest_email,
@ -41,3 +44,7 @@ select
c.created_date_utc c.created_date_utc
from stg_check_in_hero__checkins c from stg_check_in_hero__checkins c
inner join int_core__check_in_hero_users chu on c.id_user_partner = chu.id_apim_user inner join int_core__check_in_hero_users chu on c.id_user_partner = chu.id_apim_user
left join
int_simple_exchange_rates ser
on c.reservation_currency = ser.from_currency
and c.created_date_utc = ser.rate_date_utc

View file

@ -10,8 +10,9 @@ select
id_currency, id_currency,
currency_code, currency_code,
sum(booking_fee_in_local_currency) as total_fee_in_local_currency, sum(booking_fee_in_local_currency) as total_fee_in_local_currency,
sum(booking_fee_in_gbp) as total_fee_in_gbp,
count(distinct id_record) as number_of_requests, count(distinct id_record) as number_of_requests,
company_name, company_name,
user_email user_email
from int_check_in_hero__checkins from int_check_in_hero__checkins
group by 1, 2, 3, 4, 5, 8, 9 group by 1, 2, 3, 4, 5, 9, 10

View file

@ -55,6 +55,22 @@ models:
min_value: 0 min_value: 0
strictly: true strictly: true
- name: exchange_rate_to_gbp
data_type: numeric
description: "Exchange rate used to convert the local currency to GBP."
data_tests:
- dbt_expectations.expect_column_values_to_be_between:
min_value: 0
strictly: true
- name: booking_fee_in_gbp
data_type: numeric
description: "Total fee charged to the user for the month in gbp."
data_tests:
- dbt_expectations.expect_column_values_to_be_between:
min_value: 0
strictly: true
- name: guest_last_name - name: guest_last_name
data_type: text data_type: text
description: Last name of the guest checking in. description: Last name of the guest checking in.
@ -235,6 +251,14 @@ models:
min_value: 0 min_value: 0
strictly: true strictly: true
- name: total_fee_in_gbp
data_type: numeric
description: "Total fee charged to the user for the month in gbp."
data_tests:
- dbt_expectations.expect_column_values_to_be_between:
min_value: 0
strictly: true
- name: number_of_requests - name: number_of_requests
data_type: numeric data_type: numeric
description: "Count of requests created by the user partner for the month." description: "Count of requests created by the user partner for the month."