From 78e7e37c5e5bac25efc77555e28f82773251ae1a Mon Sep 17 00:00:00 2001 From: Joaquin Ossa Date: Tue, 17 Sep 2024 15:07:00 +0200 Subject: [PATCH] Update model core__verification_payments to include amounts without taxes --- .../core/core__verification_payments.sql | 10 ++-- models/reporting/core/schema.yml | 54 ++++++++++++++++++- 2 files changed, 60 insertions(+), 4 deletions(-) diff --git a/models/reporting/core/core__verification_payments.sql b/models/reporting/core/core__verification_payments.sql index 5297fa0..d798780 100644 --- a/models/reporting/core/core__verification_payments.sql +++ b/models/reporting/core/core__verification_payments.sql @@ -1,6 +1,6 @@ with int_core__verification_payments as ( - select * from {{ ref("int_core__verification_payments") }} + select * from {{ ref("int_core__verification_payments", version=2) }} ) select vp.id_verification_to_payment as id_verification_to_payment, @@ -19,9 +19,13 @@ select vp.id_guest_user as id_guest_user, vp.id_verification as id_verification, vp.verification_payment_type as verification_payment_type, - vp.amount_in_txn_currency as amount_in_txn_currency, + vp.total_amount_in_txn_currency as amount_in_txn_currency, -- LEGACY + vp.total_amount_in_txn_currency as total_amount_in_txn_currency, + vp.amount_without_taxes_in_txn_currency as amount_without_taxes_in_txn_currency, vp.currency as currency, - vp.amount_in_gbp as amount_in_gbp, + vp.total_amount_in_gbp as amount_in_gbp, -- LEGACY + vp.total_amount_in_gbp as total_amount_in_gbp, + vp.amount_without_taxes_in_gbp as amount_without_taxes_in_gbp, vp.payment_status as payment_status, vp.notes as notes from int_core__verification_payments vp diff --git a/models/reporting/core/schema.yml b/models/reporting/core/schema.yml index 1b48715..359cbf8 100644 --- a/models/reporting/core/schema.yml +++ b/models/reporting/core/schema.yml @@ -29,10 +29,14 @@ models: - name: payment_due_at_utc data_type: timestamp without time zone description: The point in time at which this payment had to be paid. + tests: + - not_null - name: payment_due_date_utc data_type: date description: The date on which this payment had to be paid. + tests: + - not_null - name: payment_paid_at_utc data_type: timestamp without time zone @@ -83,30 +87,78 @@ models: - name: id_guest_user data_type: character varying description: The UUID of the guest user in the Superhog backend. + tests: + - not_null - name: id_verification data_type: bigint description: The ID of the verification that generated this payment. + tests: + - not_null - name: verification_payment_type data_type: character varying description: "The payment type. Can be one of: Waiver, Fee, Deposit, Reschedule, Cancellation." - name: amount_in_txn_currency + data_type: numeric + description: The payment amount in the currency in which the transaction actually happened. If the guest paid in Australian Dollars, this is measured in AUD. (To be decommissioned) + tests: + - dbt_expectations.expect_column_values_to_be_between: + min_value: 0 + strictly: false + + - name: total_amount_in_txn_currency data_type: numeric description: The payment amount in the currency in which the transaction actually happened. If the guest paid in Australian Dollars, this is measured in AUD. + tests: + - dbt_expectations.expect_column_values_to_be_between: + min_value: 0 + strictly: false + + - name: amount_without_taxes_in_txn_currency + data_type: numeric + description: The payment amount without taxes in the currency in which the transaction actually happened. If the guest paid in Australian Dollars, this is measured in AUD. (To be decommissioned) + tests: + - dbt_expectations.expect_column_values_to_be_between: + min_value: 0 + strictly: false - name: currency data_type: character varying description: The currency in which the transaction actually happened. If the guest paid in Australian Dollars, this is measured in AUD. + tests: + - not_null - name: amount_in_gbp data_type: numeric description: The payment amount value, converted to GBP, using the exchange rate for the day on which the payment happened. + tests: + - dbt_expectations.expect_column_values_to_be_between: + min_value: 0 + strictly: false + + - name: total_amount_in_gbp + data_type: numeric + description: The payment amount value, converted to GBP, using the exchange rate for the day on which the payment happened. + tests: + - dbt_expectations.expect_column_values_to_be_between: + min_value: 0 + strictly: false + + - name: amount_without_taxes_in_gbp + data_type: numeric + description: The payment amount value without taxes, converted to GBP, using the exchange rate for the day on which the payment happened. + tests: + - dbt_expectations.expect_column_values_to_be_between: + min_value: 0 + strictly: false - name: payment_status data_type: character varying - description: "The status of the payment. It can be one of: Paid, Refunded, Refund Failed." + description: "The status of the payment. It can be one of: Paid, Refunded, Refund Failed, Cancelled, Paid Manually, Unpaid." + tests: + - not_null - name: notes data_type: character varying