a few more details
This commit is contained in:
parent
180c005e3c
commit
3b1301ff6e
2 changed files with 23 additions and 7 deletions
|
|
@ -5,6 +5,10 @@ with
|
||||||
stg_core__verification_set_to_verification_type as (
|
stg_core__verification_set_to_verification_type as (
|
||||||
select * from {{ ref("stg_core__verification_set_to_verification_type") }}
|
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 (
|
check_in_cover_payments as (
|
||||||
select
|
select
|
||||||
id_verification_request,
|
id_verification_request,
|
||||||
|
|
@ -17,9 +21,6 @@ with
|
||||||
where
|
where
|
||||||
verification_payment_type = 'CheckInCover' -- 5 is check-in cover
|
verification_payment_type = 'CheckInCover' -- 5 is check-in cover
|
||||||
and payment_status in ('Paid', 'Refunded')
|
and payment_status in ('Paid', 'Refunded')
|
||||||
),
|
|
||||||
int_core__check_in_cover_prices as (
|
|
||||||
select * from {{ ref("int_core__check_in_cover_prices") }}
|
|
||||||
)
|
)
|
||||||
select
|
select
|
||||||
vr.id_verification_request,
|
vr.id_verification_request,
|
||||||
|
|
@ -41,8 +42,9 @@ select
|
||||||
and vr.is_verification_request_complete
|
and vr.is_verification_request_complete
|
||||||
) as is_awaiting_check_in,
|
) as is_awaiting_check_in,
|
||||||
p.amount_in_txn_currency is not null as cover_was_purchased,
|
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.verification_url,
|
||||||
vr.callback_url,
|
vr.callback_url,
|
||||||
vr.redirect_url,
|
vr.redirect_url,
|
||||||
|
|
@ -85,9 +87,11 @@ select
|
||||||
p.amount_in_gbp,
|
p.amount_in_gbp,
|
||||||
p.payment_status,
|
p.payment_status,
|
||||||
p.payment_paid_date_utc,
|
p.payment_paid_date_utc,
|
||||||
|
ccp.checkin_cover_cover_amount_local_curr,
|
||||||
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
|
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
|
left join
|
||||||
stg_core__verification_set_to_verification_type vstvt
|
stg_core__verification_set_to_verification_type vstvt
|
||||||
on vr.id_verification_set = vstvt.id_verification_set
|
on vr.id_verification_set = vstvt.id_verification_set
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,23 @@ select
|
||||||
uuid_verification_request as uuid_verification_request,
|
uuid_verification_request as uuid_verification_request,
|
||||||
id_user_guest as id_user_guest,
|
id_user_guest as id_user_guest,
|
||||||
id_user_host as id_user_host,
|
id_user_host as id_user_host,
|
||||||
|
id_booking as id_booking,
|
||||||
|
id_accommodation as id_accommodation,
|
||||||
is_verification_request_complete as is_verification_request_complete,
|
is_verification_request_complete as is_verification_request_complete,
|
||||||
|
is_past_check_in as is_past_check_in,
|
||||||
|
is_awaiting_check_in as is_awaiting_check_in,
|
||||||
|
cover_was_purchased as cover_was_purchased,
|
||||||
|
cover_was_rejected as cover_was_rejected,
|
||||||
guest_email as guest_email,
|
guest_email as guest_email,
|
||||||
last_name as last_name,
|
last_name as last_name,
|
||||||
first_name as first_name,
|
first_name as first_name,
|
||||||
guest_phone_number as guest_phone_number,
|
guest_phone_number as guest_phone_number,
|
||||||
telephone_code as telephone_code,
|
telephone_code as telephone_code,
|
||||||
guest_phone_number_2 as guest_phone_number_2,
|
guest_phone_number_2 as guest_phone_number_2,
|
||||||
|
check_in_at_utc as check_in_at_utc,
|
||||||
|
check_in_date_utc as check_in_date_utc,
|
||||||
|
check_out_at_utc as check_out_at_utc,
|
||||||
|
check_out_date_utc as check_out_date_utc,
|
||||||
verification_start_at_utc as verification_start_at_utc,
|
verification_start_at_utc as verification_start_at_utc,
|
||||||
verification_start_date_utc as verification_start_date_utc,
|
verification_start_date_utc as verification_start_date_utc,
|
||||||
verification_end_at_utc as verification_end_at_utc,
|
verification_end_at_utc as verification_end_at_utc,
|
||||||
|
|
@ -19,5 +29,7 @@ select
|
||||||
currency as currency,
|
currency as currency,
|
||||||
amount_in_gbp as amount_in_gbp,
|
amount_in_gbp as amount_in_gbp,
|
||||||
payment_status as payment_status,
|
payment_status as payment_status,
|
||||||
payment_paid_date_utc as payment_paid_date_utc
|
payment_paid_date_utc as payment_paid_date_utc,
|
||||||
|
checkin_cover_cover_amount_local_curr as checkin_cover_cover_amount_local_curr,
|
||||||
|
checkin_cover_cover_amount_in_gbp as checkin_cover_cover_amount_in_gbp
|
||||||
from core__vr_check_in_cover
|
from core__vr_check_in_cover
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue