Updated model

This commit is contained in:
Joaquin Ossa 2025-02-11 10:44:19 +01:00
parent bc17ee7b4b
commit 125325fcf2
6 changed files with 101 additions and 37 deletions

View file

@ -30,8 +30,12 @@ select
vp.tax_amount_in_gbp, vp.tax_amount_in_gbp,
vp.amount_due_to_host_in_txn_currency, vp.amount_due_to_host_in_txn_currency,
vp.amount_due_to_host_in_gbp, vp.amount_due_to_host_in_gbp,
vp.amount_due_to_host_without_taxes_in_txn_currency,
vp.amount_due_to_host_without_taxes_in_gbp,
vp.superhog_fee_in_txn_currency, vp.superhog_fee_in_txn_currency,
vp.superhog_fee_in_gbp, vp.superhog_fee_in_gbp,
vp.superhog_fee_without_taxes_in_txn_currency,
vp.superhog_fee_without_taxes_in_gbp,
vp.currency, vp.currency,
der.rate as exchange_rate_to_gbp, der.rate as exchange_rate_to_gbp,
uh.id_user_host, uh.id_user_host,

View file

@ -243,9 +243,21 @@ select
vat.is_service_subject_to_vat, vat.is_service_subject_to_vat,
vat.is_vat_taxed, vat.is_vat_taxed,
wf.amount_due_to_host_in_txn_currency, wf.amount_due_to_host_in_txn_currency,
(wf.amount_due_to_host_in_txn_currency / (1 + vat.vat_rate))::decimal(
19, 4
) as amount_due_to_host_without_taxes_in_txn_currency,
wf.amount_due_to_host_in_gbp, wf.amount_due_to_host_in_gbp,
(wf.amount_due_to_host_in_gbp / (1 + vat.vat_rate))::decimal(
19, 4
) as amount_due_to_host_without_taxes_in_gbp,
wf.superhog_fee_in_txn_currency, wf.superhog_fee_in_txn_currency,
(wf.superhog_fee_in_txn_currency / (1 + vat.vat_rate))::decimal(
19, 4
) as superhog_fee_without_taxes_in_txn_currency,
wf.superhog_fee_in_gbp, wf.superhog_fee_in_gbp,
(wf.superhog_fee_in_txn_currency / (1 + vat.vat_rate))::decimal(
19, 4
) as superhog_fee_without_taxes_in_gbp,
vat.is_missing_user_country, vat.is_missing_user_country,
vat.are_user_details_deleted, vat.are_user_details_deleted,
vat.is_missing_vat_rate_for_country, vat.is_missing_vat_rate_for_country,

View file

@ -23,6 +23,7 @@ with
int_core__payaway as (select * from {{ ref("int_core__payaway") }}) int_core__payaway as (select * from {{ ref("int_core__payaway") }})
select select
vtp.id_payment, vtp.id_payment,
uu.billing_country_iso_3,
pa.payaway_percentage, pa.payaway_percentage,
pa.payaway_minimum_commission_local_curr pa.payaway_minimum_commission_local_curr
* cer.rate as payaway_minimum_commission_local_curr, * cer.rate as payaway_minimum_commission_local_curr,
@ -51,16 +52,7 @@ select
else 0 else 0
end as amount_due_to_host_in_gbp, end as amount_due_to_host_in_gbp,
case case
when pa.id_payaway_plan is not null and uu.billing_country_iso_3 = 'GBR' when pa.id_payaway_plan is not null
then
(
greatest(
p.amount * pa.payaway_percentage,
pa.payaway_minimum_commission_local_curr * cer.rate
)
)
/ (vat.vat_rate + 1)
when pa.id_payaway_plan is not null and uu.billing_country_iso_3 <> 'GBR'
then then
greatest( greatest(
p.amount * pa.payaway_percentage, p.amount * pa.payaway_percentage,
@ -69,17 +61,7 @@ select
else p.amount else p.amount
end as superhog_fee_in_txn_currency, end as superhog_fee_in_txn_currency,
case case
when pa.id_payaway_plan is not null and uu.billing_country_iso_3 = 'GBR' when pa.id_payaway_plan is not null
then
(
greatest(
p.amount * pa.payaway_percentage,
pa.payaway_minimum_commission_local_curr * cer.rate
)
)
/ (vat.vat_rate + 1)
* ser.rate
when pa.id_payaway_plan is not null and uu.billing_country_iso_3 <> 'GBR'
then then
( (
greatest( greatest(

View file

@ -879,22 +879,42 @@ models:
- name: amount_due_to_host_in_txn_currency - name: amount_due_to_host_in_txn_currency
data_type: numeric data_type: numeric
description: | description: |
The amount payable to the host, in local currency. The amount payable to the host with taxes, in local currency.
- name: amount_due_to_host_in_gbp - name: amount_due_to_host_in_gbp
data_type: numeric data_type: numeric
description: | description: |
The amount payable to the host, in GBP. The amount payable to the host with taxes, in GBP.
- name: amount_due_to_host_without_taxes_in_txn_currency
data_type: numeric
description: |
The amount payable to the host without taxes, in local currency.
- name: amount_due_to_host_without_taxes_in_gbp
data_type: numeric
description: |
The amount payable to the host without taxes, in GBP.
- name: superhog_fee_in_txn_currency - name: superhog_fee_in_txn_currency
data_type: numeric data_type: numeric
description: | description: |
The service fee charged by Superhog, in local currency. The service fee charged by Superhog with taxes, in local currency.
- name: superhog_fee_in_gbp - name: superhog_fee_in_gbp
data_type: numeric data_type: numeric
description: | description: |
The service fee charged by Superhog, in GBP. The service fee charged by Superhog with taxes, in GBP.
- name: superhog_fee_without_taxes_in_txn_currency
data_type: numeric
description: |
The service fee charged by Superhog without taxes, in local currency.
- name: superhog_fee_without_taxes_in_gbp
data_type: numeric
description: |
The service fee charged by Superhog without taxes, in GBP.
- name: is_missing_user_country - name: is_missing_user_country
data_type: boolean data_type: boolean
@ -5395,22 +5415,42 @@ models:
- name: amount_due_to_host_in_txn_currency - name: amount_due_to_host_in_txn_currency
data_type: numeric data_type: numeric
description: | description: |
The amount payable to the host, in local currency. The amount payable to the host with taxes, in local currency.
- name: amount_due_to_host_in_gbp - name: amount_due_to_host_in_gbp
data_type: numeric data_type: numeric
description: | description: |
The amount payable to the host, in GBP. The amount payable to the host with taxes, in GBP.
- name: amount_due_to_host_without_taxes_in_txn_currency
data_type: numeric
description: |
The amount payable to the host without taxes, in local currency.
- name: amount_due_to_host_without_taxes_in_gbp
data_type: numeric
description: |
The amount payable to the host without taxes, in GBP.
- name: superhog_fee_in_txn_currency - name: superhog_fee_in_txn_currency
data_type: numeric data_type: numeric
description: | description: |
The service fee charged by Superhog, in local currency. The service fee charged by Superhog with taxes, in local currency.
- name: superhog_fee_in_gbp - name: superhog_fee_in_gbp
data_type: numeric data_type: numeric
description: | description: |
The service fee charged by Superhog, in GBP. The service fee charged by Superhog with taxes, in GBP.
- name: superhog_fee_without_taxes_in_txn_currency
data_type: numeric
description: |
The service fee charged by Superhog without taxes, in local currency.
- name: superhog_fee_without_taxes_in_gbp
data_type: numeric
description: |
The service fee charged by Superhog without taxes, in GBP.
- name: currency - name: currency
data_type: text data_type: text
@ -5536,19 +5576,19 @@ models:
- name: amount_due_to_host_in_txn_currency - name: amount_due_to_host_in_txn_currency
data_type: numeric data_type: numeric
description: | description: |
The amount payable to the host, in local currency. The amount payable to the host with taxes, in local currency.
- name: amount_due_to_host_in_gbp - name: amount_due_to_host_in_gbp
data_type: numeric data_type: numeric
description: | description: |
The amount payable to the host, in GBP. The amount payable to the host with taxes, in GBP.
- name: superhog_fee_in_txn_currency - name: superhog_fee_in_txn_currency
data_type: numeric data_type: numeric
description: | description: |
The service fee charged by Superhog, in local currency. The service fee charged by Superhog with taxes, in local currency.
- name: superhog_fee_in_gbp - name: superhog_fee_in_gbp
data_type: numeric data_type: numeric
description: | description: |
The service fee charged by Superhog, in GBP. The service fee charged by Superhog with taxes, in GBP.

View file

@ -20,8 +20,14 @@ select
tax_amount_in_gbp as tax_amount_in_gbp, tax_amount_in_gbp as tax_amount_in_gbp,
amount_due_to_host_in_txn_currency as amount_due_to_host_in_txn_currency, amount_due_to_host_in_txn_currency as amount_due_to_host_in_txn_currency,
amount_due_to_host_in_gbp as amount_due_to_host_in_gbp, amount_due_to_host_in_gbp as amount_due_to_host_in_gbp,
amount_due_to_host_without_taxes_in_txn_currency
as amount_due_to_host_without_taxes_in_txn_currency,
amount_due_to_host_without_taxes_in_gbp as amount_due_to_host_without_taxes_in_gbp,
superhog_fee_in_txn_currency as superhog_fee_in_txn_currency, superhog_fee_in_txn_currency as superhog_fee_in_txn_currency,
superhog_fee_in_gbp as superhog_fee_in_gbp, superhog_fee_in_gbp as superhog_fee_in_gbp,
superhog_fee_without_taxes_in_txn_currency
as superhog_fee_without_taxes_in_txn_currency,
superhog_fee_without_taxes_in_gbp as superhog_fee_without_taxes_in_gbp,
currency as currency, currency as currency,
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,

View file

@ -1753,22 +1753,42 @@ models:
- name: amount_due_to_host_in_txn_currency - name: amount_due_to_host_in_txn_currency
data_type: numeric data_type: numeric
description: | description: |
The amount payable to the host, in local currency. The amount payable to the host with taxes, in local currency.
- name: amount_due_to_host_in_gbp - name: amount_due_to_host_in_gbp
data_type: numeric data_type: numeric
description: | description: |
The amount payable to the host, in GBP. The amount payable to the host with taxes, in GBP.
- name: amount_due_to_host_without_taxes_in_txn_currency
data_type: numeric
description: |
The amount payable to the host without taxes, in local currency.
- name: amount_due_to_host_without_taxes_in_gbp
data_type: numeric
description: |
The amount payable to the host without taxes, in GBP.
- name: superhog_fee_in_txn_currency - name: superhog_fee_in_txn_currency
data_type: numeric data_type: numeric
description: | description: |
The service fee charged by Superhog, in local currency. The service fee charged by Superhog with taxes, in local currency.
- name: superhog_fee_in_gbp - name: superhog_fee_in_gbp
data_type: numeric data_type: numeric
description: | description: |
The service fee charged by Superhog, in GBP. The service fee charged by Superhog with taxes, in GBP.
- name: superhog_fee_without_taxes_in_txn_currency
data_type: numeric
description: |
The service fee charged by Superhog without taxes, in local currency.
- name: superhog_fee_without_taxes_in_gbp
data_type: numeric
description: |
The service fee charged by Superhog without taxes, in GBP.
- name: currency - name: currency
data_type: text data_type: text