Calculator changes

This commit is contained in:
Joaquin Ossa 2025-02-28 12:19:24 +01:00
parent eeb47cf6d8
commit b20cb44779
6 changed files with 176 additions and 52 deletions

View file

@ -313,11 +313,6 @@ models:
description: "Indicates the selected booking protection plan,
e.g., Damage Protection Plan."
- name: was_overriden
data_type: boolean
description: "Flag to indicate if the proposed settlement value from
the calculator was overriden."
- name: waiver_or_deposit_name
data_type: text
description: "Indicates whether the guest selected Deposit or Waiver as their cover."
@ -365,6 +360,52 @@ models:
min_value: 0
strictly: false
- name: submitted_payout_amount_in_txn_currency
data_type: numeric
description: "Submitted payout amount in local currency."
data_tests:
- dbt_expectations.expect_column_values_to_be_between:
min_value: 0
strictly: false
- name: submitted_payout_currency
data_type: text
description: "Currency of the submitted payout amount."
data_tests:
- not_null:
where: "submitted_payout_amount_in_txn_currency > 0"
- name: submitted_payout_amount_in_usd
data_type: numeric
description: "Submitted payout amount in USD."
data_tests:
- dbt_expectations.expect_column_values_to_be_between:
min_value: 0
strictly: false
- name: calculated_guest_charge_amount_in_txn_currency
data_type: numeric
description: "Calculated guest charge amount in local currency."
data_tests:
- dbt_expectations.expect_column_values_to_be_between:
min_value: 0
strictly: false
- name: calculated_guest_charge_currency
data_type: text
description: "Currency of the calculated guest charge amount."
data_tests:
- not_null:
where: "calculated_guest_charge_amount_in_txn_currency > 0"
- name: calculated_guest_charge_amount_in_usd
data_type: numeric
description: "Calculated guest charge amount in USD."
data_tests:
- dbt_expectations.expect_column_values_to_be_between:
min_value: 0
strictly: false
- name: submitted_guest_charge_amount_in_txn_currency
data_type: numeric
description: "Submitted guest charge amount in local currency."

View file

@ -200,8 +200,6 @@ select
{{ adapter.quote("documents") }}
-> 'SavedCalculation'
->> 'ProtectionName' as protection_name,
({{ adapter.quote("documents") }} -> 'SavedCalculation' ->> 'WasOverriden')::boolean
as was_overriden,
{{ adapter.quote("documents") }}
-> 'SavedCalculation'
->> 'WaiverOrDepositName' as waiver_or_deposit_name,
@ -221,16 +219,42 @@ select
(
{{ adapter.quote("documents") }}
-> 'SavedCalculation'
->> 'SubmittedHostPayoutAmount'
->> 'CalculatedHostPayoutAmountTheirCurrency'
)::numeric as calculated_payout_amount_in_txn_currency,
{{ adapter.quote("documents") }}
-> 'SavedCalculation'
->> 'SubmittedHostPayoutCurrency' as calculated_payout_currency,
->> 'CalculatedHostPayoutCurrency' as calculated_payout_currency,
(
{{ adapter.quote("documents") }}
-> 'SavedCalculation'
->> 'CalculatedHostPayoutAmountInUsd'
)::numeric as calculated_payout_amount_in_usd,
(
{{ adapter.quote("documents") }}
-> 'SavedCalculation'
->> 'SubmittedHostPayoutAmount'
)::numeric as submitted_payout_amount_in_txn_currency,
{{ adapter.quote("documents") }}
-> 'SavedCalculation'
->> 'SubmittedHostPayoutCurrency' as submitted_payout_currency,
(
{{ adapter.quote("documents") }}
-> 'SavedCalculation'
->> 'SubmittedHostPayoutAmountUsd'
)::numeric as submitted_payout_amount_in_usd,
(
{{ adapter.quote("documents") }}
-> 'SavedCalculation'
->> 'CalculatedGuestChargeAmountTheirCurrency'
)::numeric as calculated_guest_charge_amount_in_txn_currency,
{{ adapter.quote("documents") }}
-> 'SavedCalculation'
->> 'CalculatedGuestChargeCurrency' as calculated_guest_charge_currency,
(
{{ adapter.quote("documents") }}
-> 'SavedCalculation'
->> 'CalculatedGuestChargeAmountInUsd'
)::numeric as calculated_guest_charge_amount_in_usd,
(
{{ adapter.quote("documents") }}
-> 'SavedCalculation'
@ -242,7 +266,7 @@ select
(
{{ adapter.quote("documents") }}
-> 'SavedCalculation'
->> 'SubmittedGuestChargeAmountInUsd'
->> 'SubmittedGuestChargeAmountUsd'
)::numeric as submitted_guest_charge_amount_in_usd,
-- Third Party Compensation Claim