Merged PR 4354: ***ing decimals

# Description

It was the amount of decimals the values had because of the exchange rates apparently causing error in PBI

# Checklist

- [x] The edited models and dependants run properly with production data.
- [ ] The edited models are sufficiently documented.
- [ ] The edited models contain PK tests, and I've ran and passed them.
- [ ] I have checked for DRY opportunities with other models and docs.
- [ ] I've picked the right materialization for the affected models.

# Other

- [ ] Check if a full-refresh is required after this PR is merged.

***ing decimals

Related work items: #27178
This commit is contained in:
Joaquin Ossa 2025-02-11 16:15:05 +00:00
commit 4f2a34427f

View file

@ -33,15 +33,18 @@ select
case case
when pa.id_payaway_plan is not null when pa.id_payaway_plan is not null
then then
(
p.amount - greatest( p.amount - greatest(
p.amount * pa.payaway_percentage, p.amount * pa.payaway_percentage,
pa.payaway_minimum_commission_local_curr * cer.rate pa.payaway_minimum_commission_local_curr * cer.rate
) )
)::decimal(19, 4)
else 0 else 0
end as amount_due_to_host_in_txn_currency, end as amount_due_to_host_in_txn_currency,
case case
when pa.id_payaway_plan is not null when pa.id_payaway_plan is not null
then then
(
( (
p.amount - greatest( p.amount - greatest(
p.amount * pa.payaway_percentage, p.amount * pa.payaway_percentage,
@ -49,20 +52,24 @@ select
) )
) )
* ser.rate * ser.rate
)::decimal(19, 4)
else 0 else 0
end as amount_due_to_host_in_gbp, end as amount_due_to_host_in_gbp,
case
when pa.id_payaway_plan is not null
then
greatest(
p.amount * pa.payaway_percentage,
pa.payaway_minimum_commission_local_curr * cer.rate
)
else p.amount
end as superhog_fee_in_txn_currency,
case case
when pa.id_payaway_plan is not null when pa.id_payaway_plan is not null
then then
(
greatest(
p.amount * pa.payaway_percentage,
pa.payaway_minimum_commission_local_curr * cer.rate
)
)::decimal(19, 4)
else p.amount
end as superhog_fee_in_txn_currency,
case
when pa.id_payaway_plan is not null
then
(
( (
greatest( greatest(
p.amount * pa.payaway_percentage, p.amount * pa.payaway_percentage,
@ -70,7 +77,8 @@ select
) )
) )
* ser.rate * ser.rate
else p.amount * ser.rate )::decimal(19, 4)
else (p.amount * ser.rate)::decimal(19, 4)
end as superhog_fee_in_gbp end as superhog_fee_in_gbp
from stg_core__verification_to_payment vtp from stg_core__verification_to_payment vtp
left join stg_core__payment p on vtp.id_payment = p.id_payment left join stg_core__payment p on vtp.id_payment = p.id_payment