moving forward with the checkincover specific model

This commit is contained in:
Pablo Martin 2024-04-26 16:45:43 +02:00
parent fd9b241cb6
commit a55b355f11
2 changed files with 80 additions and 0 deletions

View file

@ -5,6 +5,7 @@ with
stg_core__verification_payment_type as (
select * from {{ ref("stg_core__verification_payment_type") }}
),
stg_core__verification as (select * from {{ ref("stg_core__verification") }}),
stg_core__payment as (select * from {{ ref("stg_core__payment") }}),
stg_core__payment_status as (select * from {{ ref("stg_core__payment_status") }}),
int_hardcoded_historical_currency_rates as (
@ -28,6 +29,7 @@ select
p.refund_payment_reference,
vtp.id_guest_user,
vtp.id_verification,
v.id_verification_request,
vpt.verification_payment_type,
p.amount as amount_in_txn_currency,
p.currency,
@ -36,6 +38,7 @@ select
p.notes
from stg_core__verification_to_payment vtp
left join stg_core__payment p on vtp.id_payment = p.id_payment
left join stg_core__verification v on vtp.id_verification = v.id_verification
left join
stg_core__verification_payment_type vpt
on vtp.id_verification_payment_type = vpt.id_verification_payment_type

View file

@ -0,0 +1,77 @@
with
int_core__verification_requests as (
select * from {{ ref("int_core__verification_requests") }}
),
stg_core__verification_set_to_verification_type as (
select * from {{ ref("stg_core__verification_set_to_verification_type") }}
),
check_in_cover_payments as (
select
id_verification_request,
amount_in_txn_currency,
currency,
amount_in_gbp,
payment_status,
payment_paid_date_utc
from {{ ref("int_core__verification_payments") }}
where
verification_payment_type = 'CheckInCover' -- 5 is check-in cover
and payment_status in ('Paid', 'Refunded')
)
select
vr.id_verification_request,
vr.uuid_verification_request,
vr.id_verification_set,
vr.id_superhog_verified_set,
vr.id_payment_validation_set,
vr.id_user_guest,
vr.id_user_host,
vr.is_verification_request_complete,
vr.verification_url,
vr.callback_url,
vr.redirect_url,
vr.logo,
vr.guest_email,
vr.last_name,
vr.first_name,
vr.guest_phone_number,
vr.telephone_code,
vr.guest_phone_number_2,
vr.verification_start_at_utc,
vr.verification_start_date_utc,
vr.verification_end_at_utc,
vr.verification_end_date_utc,
vr.link_used_at_utc,
vr.link_used_date_utc,
vr.expire_at_utc,
vr.expire_date_utc,
vr.is_deleted,
vr.redirect_name,
vr.id_one_step_link,
vr.success_message,
vr.summary,
vr.rejection_reason,
vr.has_switched_to_mobile,
vr.is_verifier_rejected,
vr.config,
vr.metadata,
vr.created_at_utc,
vr.created_date_utc,
vr.updated_at_utc,
vr.updated_date_utc,
vr.dwh_extracted_at_utc,
p.amount_in_txn_currency,
p.currency,
p.amount_in_gbp,
p.payment_status,
p.payment_paid_date_utc
from int_core__verification_requests vr
left join
stg_core__verification_set_to_verification_type vstvt
on vr.id_verification_set = vstvt.id_verification_set
left join
check_in_cover_payments p on vr.id_verification_request = p.id_verification_request
-- 15 is Check-in cover.
-- Adding this condition results in only keeping guest journeys that offered the
-- check-in cover
where vstvt.id_verification_type = 15