New waiver fees model
This commit is contained in:
parent
f846656989
commit
bc17ee7b4b
4 changed files with 87 additions and 12 deletions
|
|
@ -1,4 +1,8 @@
|
||||||
-- {{ config(materialized="table") }}
|
-- Model to obtain amount due to host and superhog fee.
|
||||||
|
-- This depends on their payaway plan at the moment of the payment.
|
||||||
|
-- If they don't have a payaway plan, then superhog is taking the risk.
|
||||||
|
-- For more details on the calculation, please refer to the documentation.
|
||||||
|
-- https://www.notion.so/truvi/Guest-Services-Taxes-How-to-calculate-a5ab4c049d61427fafab669dbbffb3a2?pvs=4
|
||||||
with
|
with
|
||||||
stg_core__verification_to_payment as (
|
stg_core__verification_to_payment as (
|
||||||
select * from {{ ref("stg_core__verification_to_payment") }}
|
select * from {{ ref("stg_core__verification_to_payment") }}
|
||||||
|
|
@ -17,11 +21,6 @@ with
|
||||||
select * from {{ ref("stg_seed__guest_services_vat_rates_by_country") }}
|
select * from {{ ref("stg_seed__guest_services_vat_rates_by_country") }}
|
||||||
),
|
),
|
||||||
int_core__payaway as (select * from {{ ref("int_core__payaway") }})
|
int_core__payaway as (select * from {{ ref("int_core__payaway") }})
|
||||||
-- CTE to obtain amount due to host and superhog fee.
|
|
||||||
-- This depends on their payaway plan at the moment of the payment.
|
|
||||||
-- If they don't have a payaway plan, then superhog is taking the risk.
|
|
||||||
-- For more details on the calculation, please refer to the documentation.
|
|
||||||
-- https://www.notion.so/truvi/Guest-Services-Taxes-How-to-calculate-a5ab4c049d61427fafab669dbbffb3a2?pvs=4
|
|
||||||
select
|
select
|
||||||
vtp.id_payment,
|
vtp.id_payment,
|
||||||
pa.payaway_percentage,
|
pa.payaway_percentage,
|
||||||
|
|
|
||||||
|
|
@ -5503,3 +5503,52 @@ models:
|
||||||
description: |
|
description: |
|
||||||
The currency in which the host receives their payment (may differ from
|
The currency in which the host receives their payment (may differ from
|
||||||
the transaction currency).
|
the transaction currency).
|
||||||
|
|
||||||
|
- name: int_core__waiver_fees
|
||||||
|
description: |
|
||||||
|
"This model contains the fees charged for the Waiver service. It includes
|
||||||
|
the percentage of the payment that goes to Superhog, the minimum fee around
|
||||||
|
the amount charged in both local currency and GBP"
|
||||||
|
columns:
|
||||||
|
- name: id_payment
|
||||||
|
data_type: bigint
|
||||||
|
description: Unique identifier for the payment.
|
||||||
|
data_tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: payaway_percentage
|
||||||
|
data_type: numeric
|
||||||
|
description: Percentage of the payment that goes to Superhog.
|
||||||
|
data_tests:
|
||||||
|
- dbt_expectations.expect_column_values_to_be_between:
|
||||||
|
min_value: 0
|
||||||
|
max_value: 0.99
|
||||||
|
strictly: false
|
||||||
|
|
||||||
|
- name: payaway_minimum_commission_local_curr
|
||||||
|
data_type: numeric
|
||||||
|
description: Minimum commission amount in local currency.
|
||||||
|
|
||||||
|
- name: is_host_taking_waiver_risk
|
||||||
|
data_type: boolean
|
||||||
|
description: Boolean indicating whether the host is taking the risk
|
||||||
|
|
||||||
|
- name: amount_due_to_host_in_txn_currency
|
||||||
|
data_type: numeric
|
||||||
|
description: |
|
||||||
|
The amount payable to the host, in local currency.
|
||||||
|
|
||||||
|
- name: amount_due_to_host_in_gbp
|
||||||
|
data_type: numeric
|
||||||
|
description: |
|
||||||
|
The amount payable to the host, in GBP.
|
||||||
|
|
||||||
|
- name: superhog_fee_in_txn_currency
|
||||||
|
data_type: numeric
|
||||||
|
description: |
|
||||||
|
The service fee charged by Superhog, in local currency.
|
||||||
|
|
||||||
|
- name: superhog_fee_in_gbp
|
||||||
|
data_type: numeric
|
||||||
|
description: |
|
||||||
|
The service fee charged by Superhog, in GBP.
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,9 @@ select
|
||||||
payment_status as payment_status,
|
payment_status as payment_status,
|
||||||
payment_due_date_utc as payment_due_date_utc,
|
payment_due_date_utc as payment_due_date_utc,
|
||||||
payment_paid_date_utc as payment_paid_date_utc,
|
payment_paid_date_utc as payment_paid_date_utc,
|
||||||
|
refund_payment_reference as refund_payment_reference,
|
||||||
|
refund_due_date_utc as refund_due_date_utc,
|
||||||
|
payment_refunded_date_utc as payment_refunded_date_utc,
|
||||||
total_amount_in_txn_currency as total_amount_in_txn_currency,
|
total_amount_in_txn_currency as total_amount_in_txn_currency,
|
||||||
total_amount_in_gbp as total_amount_in_gbp,
|
total_amount_in_gbp as total_amount_in_gbp,
|
||||||
amount_without_taxes_in_txn_currency as amount_without_taxes_in_txn_currency,
|
amount_without_taxes_in_txn_currency as amount_without_taxes_in_txn_currency,
|
||||||
|
|
@ -23,14 +26,16 @@ select
|
||||||
exchange_rate_to_gbp as exchange_rate_to_gbp,
|
exchange_rate_to_gbp as exchange_rate_to_gbp,
|
||||||
id_user_host as id_user_host,
|
id_user_host as id_user_host,
|
||||||
id_deal as id_deal,
|
id_deal as id_deal,
|
||||||
first_name as first_name,
|
host_first_name as host_first_name,
|
||||||
last_name as last_name,
|
host_last_name as host_last_name,
|
||||||
email as email,
|
host_email as host_email,
|
||||||
company_name as company_name,
|
company_name as company_name,
|
||||||
host_country as host_country,
|
host_country as host_country,
|
||||||
guest_first_name as guest_first_name,
|
guest_first_name as guest_first_name,
|
||||||
guest_last_name as guest_last_name,
|
guest_last_name as guest_last_name,
|
||||||
guest_email as guest_email,
|
guest_email as guest_email,
|
||||||
|
guest_billing_country as guest_billing_country,
|
||||||
|
guest_billing_town as guest_billing_town,
|
||||||
friendly_name as friendly_name,
|
friendly_name as friendly_name,
|
||||||
address_line_1 as address_line_1,
|
address_line_1 as address_line_1,
|
||||||
check_in_date_utc as check_in_date_utc,
|
check_in_date_utc as check_in_date_utc,
|
||||||
|
|
|
||||||
|
|
@ -1692,6 +1692,18 @@ models:
|
||||||
data_type: date
|
data_type: date
|
||||||
description: The date when the payment was successfully made, in UTC.
|
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
|
- name: total_amount_in_txn_currency
|
||||||
data_type: numeric
|
data_type: numeric
|
||||||
description: |
|
description: |
|
||||||
|
|
@ -1781,15 +1793,15 @@ models:
|
||||||
Main identifier of the B2B clients. A Deal can have multiple Hosts.
|
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.
|
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
|
data_type: character varying
|
||||||
description: First name of the host receiving the payment.
|
description: First name of the host receiving the payment.
|
||||||
|
|
||||||
- name: last_name
|
- name: host_last_name
|
||||||
data_type: character varying
|
data_type: character varying
|
||||||
description: Last name of the host receiving the payment.
|
description: Last name of the host receiving the payment.
|
||||||
|
|
||||||
- name: email
|
- name: host_email
|
||||||
data_type: character varying
|
data_type: character varying
|
||||||
description: Email address of the host receiving the payment.
|
description: Email address of the host receiving the payment.
|
||||||
|
|
||||||
|
|
@ -1815,6 +1827,16 @@ models:
|
||||||
data_type: character varying
|
data_type: character varying
|
||||||
description: Email address of the guest making the payment.
|
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
|
- name: friendly_name
|
||||||
data_type: character varying
|
data_type: character varying
|
||||||
description: |
|
description: |
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue