diff --git a/models/intermediate/resolutions/int_resolutions__incidents.sql b/models/intermediate/resolutions/int_resolutions__incidents.sql index 371d672..7159ff5 100644 --- a/models/intermediate/resolutions/int_resolutions__incidents.sql +++ b/models/intermediate/resolutions/int_resolutions__incidents.sql @@ -189,20 +189,27 @@ select -- Resolutions calculator i.protection_name, - i.was_overriden, i.waiver_or_deposit_name, i.guest_verification_status, i.lower_protection_limit_usd, i.upper_protection_limit_usd, i.calculated_payout_amount_in_txn_currency, i.calculated_payout_currency, - i.calculated_payout_amount_in_usd, (i.calculated_payout_amount_in_usd * cer.rate)::decimal( 19, 4 ) as calculated_payout_amount_in_gbp, + i.submitted_payout_amount_in_txn_currency, + i.submitted_payout_currency, + (i.submitted_payout_amount_in_usd * cer.rate)::decimal( + 19, 4 + ) as submitted_payout_amount_in_gbp, + i.calculated_guest_charge_amount_in_txn_currency, + i.calculated_guest_charge_currency, + (i.calculated_guest_charge_amount_in_usd * cer.rate)::decimal( + 19, 4 + ) as calculated_guest_charge_amount_in_gbp, i.submitted_guest_charge_amount_in_txn_currency, i.submitted_guest_charge_currency, - i.submitted_guest_charge_amount_in_usd, (i.submitted_guest_charge_amount_in_usd * cer.rate)::decimal( 19, 4 ) as submitted_guest_charge_amount_in_gbp, diff --git a/models/intermediate/resolutions/schema.yml b/models/intermediate/resolutions/schema.yml index 02bba04..601b292 100644 --- a/models/intermediate/resolutions/schema.yml +++ b/models/intermediate/resolutions/schema.yml @@ -162,12 +162,6 @@ models: or asked_repair_amount_in_host_currency > 0 or accepted_amount_in_host_currency > 0" - - name: was_overriden - data_type: boolean - description: | - "Flag to indicate if the proposed settlement value from the - calculator was overridden." - - name: guest_verification_status data_type: text description: "Guest verification status for this booking." @@ -203,17 +197,55 @@ models: - not_null: where: "calculated_payout_amount_in_txn_currency > 0" - - name: calculated_payout_amount_in_usd + - name: calculated_payout_amount_in_gbp data_type: numeric - description: "Calculated payout amount in USD." + description: "Calculated payout amount in GBP." data_tests: - dbt_expectations.expect_column_values_to_be_between: min_value: 0 strictly: false - - name: calculated_payout_amount_in_gbp + - name: submitted_payout_amount_in_txn_currency data_type: numeric - description: "Calculated payout amount in GBP." + 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_gbp + data_type: numeric + description: "Submitted payout amount in GBP." + 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_gbp + data_type: numeric + description: "Calculated guest charge amount in GBP." data_tests: - dbt_expectations.expect_column_values_to_be_between: min_value: 0 @@ -234,14 +266,6 @@ models: - not_null: where: "submitted_guest_charge_amount_in_txn_currency > 0" - - name: submitted_guest_charge_amount_in_usd - data_type: numeric - description: "Submitted 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_gbp data_type: numeric description: "Submitted guest charge amount in GBP." diff --git a/models/reporting/resolutions/resolutions__incidents.sql b/models/reporting/resolutions/resolutions__incidents.sql index 0d9a803..5dd9376 100644 --- a/models/reporting/resolutions/resolutions__incidents.sql +++ b/models/reporting/resolutions/resolutions__incidents.sql @@ -30,7 +30,6 @@ select accepted_amount_in_gbp as accepted_amount_in_gbp, host_currency as host_currency, protection_name as protection_name, - was_overriden as was_overriden, waiver_or_deposit_name as waiver_or_deposit_name, guest_verification_status as guest_verification_status, lower_protection_limit_usd as lower_protection_limit_usd, @@ -38,12 +37,17 @@ select calculated_payout_amount_in_txn_currency as calculated_payout_amount_in_txn_currency, calculated_payout_currency as calculated_payout_currency, - calculated_payout_amount_in_usd as calculated_payout_amount_in_usd, calculated_payout_amount_in_gbp as calculated_payout_amount_in_gbp, + submitted_payout_amount_in_txn_currency as submitted_payout_amount_in_txn_currency, + submitted_payout_currency as submitted_payout_currency, + submitted_payout_amount_in_gbp as submitted_payout_amount_in_gbp, + calculated_guest_charge_amount_in_txn_currency + as calculated_guest_charge_amount_in_txn_currency, + calculated_guest_charge_currency as calculated_guest_charge_currency, + calculated_guest_charge_amount_in_gbp as calculated_guest_charge_amount_in_gbp, submitted_guest_charge_amount_in_txn_currency as submitted_guest_charge_amount_in_txn_currency, submitted_guest_charge_currency as submitted_guest_charge_currency, - submitted_guest_charge_amount_in_usd as submitted_guest_charge_amount_in_usd, submitted_guest_charge_amount_in_gbp as submitted_guest_charge_amount_in_gbp, id_user_host as id_user_host, host_account_name as host_account_name, diff --git a/models/reporting/resolutions/schema.yml b/models/reporting/resolutions/schema.yml index c44983a..4408ecc 100644 --- a/models/reporting/resolutions/schema.yml +++ b/models/reporting/resolutions/schema.yml @@ -162,12 +162,6 @@ models: or asked_repair_amount_in_host_currency > 0 or accepted_amount_in_host_currency > 0" - - name: was_overriden - data_type: boolean - description: | - "Flag to indicate if the proposed settlement value from the - calculator was overridden." - - name: guest_verification_status data_type: text description: "Guest verification status for this booking." @@ -203,17 +197,55 @@ models: - not_null: where: "calculated_payout_amount_in_txn_currency > 0" - - name: calculated_payout_amount_in_usd + - name: calculated_payout_amount_in_gbp data_type: numeric - description: "Calculated payout amount in USD." + description: "Calculated payout amount in GBP." data_tests: - dbt_expectations.expect_column_values_to_be_between: min_value: 0 strictly: false - - name: calculated_payout_amount_in_gbp + - name: submitted_payout_amount_in_txn_currency data_type: numeric - description: "Calculated payout amount in GBP." + 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_gbp + data_type: numeric + description: "Submitted payout amount in GBP." + 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_gbp + data_type: numeric + description: "Calculated guest charge amount in GBP." data_tests: - dbt_expectations.expect_column_values_to_be_between: min_value: 0 @@ -234,14 +266,6 @@ models: - not_null: where: "submitted_guest_charge_amount_in_txn_currency > 0" - - name: submitted_guest_charge_amount_in_usd - data_type: numeric - description: "Submitted 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_gbp data_type: numeric description: "Submitted guest charge amount in GBP." diff --git a/models/staging/resolutions/schema.yml b/models/staging/resolutions/schema.yml index 3e80918..2c93212 100644 --- a/models/staging/resolutions/schema.yml +++ b/models/staging/resolutions/schema.yml @@ -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." diff --git a/models/staging/resolutions/stg_resolutions__incidents.sql b/models/staging/resolutions/stg_resolutions__incidents.sql index e3c75ee..1787baa 100644 --- a/models/staging/resolutions/stg_resolutions__incidents.sql +++ b/models/staging/resolutions/stg_resolutions__incidents.sql @@ -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