New waiver fees model

This commit is contained in:
Joaquin Ossa 2025-02-10 18:42:15 +01:00
parent f846656989
commit bc17ee7b4b
4 changed files with 87 additions and 12 deletions

View file

@ -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
stg_core__verification_to_payment as (
select * from {{ ref("stg_core__verification_to_payment") }}
@ -17,11 +21,6 @@ with
select * from {{ ref("stg_seed__guest_services_vat_rates_by_country") }}
),
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
vtp.id_payment,
pa.payaway_percentage,

View file

@ -5503,3 +5503,52 @@ models:
description: |
The currency in which the host receives their payment (may differ from
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.