2024-03-08 18:08:05 +01:00
|
|
|
with
|
|
|
|
|
stg_core__verification_to_payment as (
|
|
|
|
|
select * from {{ ref("stg_core__verification_to_payment") }}
|
|
|
|
|
),
|
|
|
|
|
stg_core__verification_payment_type as (
|
|
|
|
|
select * from {{ ref("stg_core__verification_payment_type") }}
|
2024-03-08 18:38:47 +01:00
|
|
|
),
|
|
|
|
|
stg_core__payment as (select * from {{ ref("stg_core__payment") }}),
|
|
|
|
|
stg_core__payment_status as (select * from {{ ref("stg_core__payment_status") }})
|
2024-03-08 18:08:05 +01:00
|
|
|
select
|
|
|
|
|
vtp.id_verification_to_payment,
|
|
|
|
|
vtp.id_payment,
|
|
|
|
|
vtp.is_refundable,
|
|
|
|
|
vtp.created_at_utc,
|
|
|
|
|
vtp.updated_at_utc,
|
|
|
|
|
vtp.payment_due_at_utc,
|
2024-03-08 18:38:47 +01:00
|
|
|
p.paid_at_utc as payment_paid_at_utc,
|
|
|
|
|
p.payment_reference,
|
|
|
|
|
vtp.refund_due_at_utc,
|
|
|
|
|
p.refunded_at_utc as payment_refunded_at_utc,
|
|
|
|
|
p.refund_payment_reference,
|
|
|
|
|
vtp.id_guest_user,
|
2024-03-08 18:08:05 +01:00
|
|
|
vtp.id_verification,
|
2024-03-08 18:38:47 +01:00
|
|
|
vpt.verification_payment_type,
|
|
|
|
|
p.amount,
|
|
|
|
|
p.currency,
|
|
|
|
|
ps.payment_status
|
2024-03-08 18:08:05 +01:00
|
|
|
from stg_core__verification_to_payment vtp
|
2024-03-08 18:38:47 +01:00
|
|
|
left join stg_core__payment p on vtp.id_payment = p.id_payment
|
2024-03-08 18:08:05 +01:00
|
|
|
left join
|
|
|
|
|
stg_core__verification_payment_type vpt
|
|
|
|
|
on vtp.id_verification_payment_type = vpt.id_verification_payment_type
|
2024-03-08 18:38:47 +01:00
|
|
|
left join stg_core__payment_status ps on p.id_payment_status = ps.id_payment_status
|