diff --git a/models/intermediate/core/int_core__booking_details.sql b/models/intermediate/core/int_core__booking_details.sql index 435b6ef..04800fe 100644 --- a/models/intermediate/core/int_core__booking_details.sql +++ b/models/intermediate/core/int_core__booking_details.sql @@ -73,7 +73,7 @@ select uh.company_name, b.guest_first_name, b.guest_last_name, - b.guest_email, + uu.guest_email, uu.billing_country_name as guest_billing_country, uu.billing_town as guest_billing_town, a.friendly_name, diff --git a/models/intermediate/core/int_core__payments.sql b/models/intermediate/core/int_core__payments.sql index 043e495..4f5be48 100644 --- a/models/intermediate/core/int_core__payments.sql +++ b/models/intermediate/core/int_core__payments.sql @@ -3,6 +3,7 @@ with select * from {{ ref("int_core__verification_payments") }} ), int_core__user_host as (select * from {{ ref("int_core__user_host") }}), + int_core__unified_user as (select * from {{ ref("int_core__unified_user") }}), int_core__payaway as (select * from {{ ref("int_core__payaway") }}), int_core__bookings as (select * from {{ ref("int_core__bookings") }}), int_core__accommodation as (select * from {{ ref("int_core__accommodation") }}), @@ -123,6 +124,9 @@ select vp.payment_status, vp.payment_due_date_utc, vp.payment_paid_date_utc, + vp.refund_payment_reference, + vp.refund_due_date_utc, + vp.payment_refunded_date_utc, vp.total_amount_in_txn_currency, vp.total_amount_in_gbp, vp.amount_without_taxes_in_txn_currency, @@ -137,14 +141,16 @@ select der.rate as exchange_rate_to_gbp, uh.id_user_host, uh.id_deal, - uh.first_name, - uh.last_name, - uh.email, + uh.first_name as host_first_name, + uh.last_name as host_last_name, + uh.email as host_email, uh.company_name, uh.billing_country_name as host_country, b.guest_first_name, b.guest_last_name, - b.guest_email, + uu.guest_email, + uu.billing_country_name as guest_billing_country, + uu.billing_town as guest_billing_town, a.friendly_name, a.address_line_1, b.check_in_date_utc, @@ -152,6 +158,7 @@ select uh.account_currency_iso4217 as host_currency from int_core__verification_payments vp left join int_core__user_host uh on vp.id_user_host = uh.id_user_host +left join int_core__unified_user uu on uu.id_user = b.id_user_guest left join payaways pa on vp.id_payment = pa.id_payment left join int_core__bookings b on vp.id_verification_request = b.id_verification_request left join int_core__accommodation a on b.id_accommodation = a.id_accommodation diff --git a/models/intermediate/core/schema.yml b/models/intermediate/core/schema.yml index af6c200..4cef264 100644 --- a/models/intermediate/core/schema.yml +++ b/models/intermediate/core/schema.yml @@ -5297,6 +5297,18 @@ models: data_type: date description: The date when the payment was successfully made, in UTC. + - name: refund_payment_reference + data_type: date + description: The reference code associated with the refund payment. + + - name: refund_due_date_utc + data_type: date + description: The due date for the refund payment, in UTC. + + - name: payment_refunded_date_utc + data_type: date + description: The date when the payment was refunded, in UTC. + - name: total_amount_in_txn_currency data_type: numeric description: | @@ -5386,15 +5398,15 @@ models: Main identifier of the B2B clients. A Deal can have multiple Hosts. A Host can have only 1 Deal or no Deal at all. This field can be null. - - name: first_name + - name: host_first_name data_type: character varying description: First name of the host receiving the payment. - - name: last_name + - name: host_last_name data_type: character varying description: Last name of the host receiving the payment. - - name: email + - name: host_email data_type: character varying description: Email address of the host receiving the payment. @@ -5420,6 +5432,16 @@ models: data_type: character varying description: Email address of the guest making the payment. + - name: guest_billing_country + data_type: text + description: | + The country name of the guest's billing address. + + - name: guest_billing_town + data_type: text + description: | + The town or city name of the guest's billing address. + - name: friendly_name data_type: character varying description: |