a few more details

This commit is contained in:
Pablo Martin 2024-05-03 17:24:35 +02:00
parent 180c005e3c
commit 3b1301ff6e
2 changed files with 23 additions and 7 deletions

View file

@ -5,6 +5,10 @@ with
stg_core__verification_set_to_verification_type as (
select * from {{ ref("stg_core__verification_set_to_verification_type") }}
),
int_core__bookings as (select * from {{ ref("int_core__bookings") }}),
int_core__check_in_cover_prices as (
select * from {{ ref("int_core__check_in_cover_prices") }}
),
check_in_cover_payments as (
select
id_verification_request,
@ -17,9 +21,6 @@ with
where
verification_payment_type = 'CheckInCover' -- 5 is check-in cover
and payment_status in ('Paid', 'Refunded')
),
int_core__check_in_cover_prices as (
select * from {{ ref("int_core__check_in_cover_prices") }}
)
select
vr.id_verification_request,
@ -41,8 +42,9 @@ select
and vr.is_verification_request_complete
) as is_awaiting_check_in,
p.amount_in_txn_currency is not null as cover_was_purchased,
p.amount_in_txn_currency is null
and vr.is_verification_request_complete as cover_was_rejected,
(
p.amount_in_txn_currency is null and vr.is_verification_request_complete
) as cover_was_rejected,
vr.verification_url,
vr.callback_url,
vr.redirect_url,
@ -85,9 +87,11 @@ select
p.amount_in_gbp,
p.payment_status,
p.payment_paid_date_utc,
ccp.checkin_cover_cover_amount_local_curr,
ccp.checkin_cover_cover_amount_local_curr
* (p.amount_in_gbp / p.amount_in_txn_currency) as checkin_cover_cover_amount_in_gbp
from int_core__verification_requests vr
left join int_core__booking b on vr.id_verification_request = b.id_verification_request
left join int_core__bookings b on vr.id_verification_request = b.id_verification_request
left join
stg_core__verification_set_to_verification_type vstvt
on vr.id_verification_set = vstvt.id_verification_set