Merged PR 5201: Eliminates Verification Payments v2 + updates exposures

# Description

Eliminates Verification Payments v2 + updates exposures

# Checklist

- [X] Project compiles

Related work items: #30024
This commit is contained in:
Oriol Roqué Paniagua 2025-05-13 14:48:34 +00:00
parent 4cac5aefa5
commit d5dd6df1c1
5 changed files with 2 additions and 793 deletions

View file

@ -1,29 +0,0 @@
with
int_core__verification_payments as (
select * from {{ ref("int_core__verification_payments", version=2) }}
)
select
vp.id_verification_to_payment as id_verification_to_payment,
vp.id_payment as id_payment,
vp.is_refundable as is_refundable,
vp.payment_due_at_utc as payment_due_at_utc,
vp.payment_due_date_utc as payment_due_date_utc,
vp.payment_paid_at_utc as payment_paid_at_utc,
vp.payment_paid_date_utc as payment_paid_date_utc,
vp.payment_reference as payment_reference,
vp.refund_due_at_utc as refund_due_at_utc,
vp.refund_due_date_utc as refund_due_date_utc,
vp.payment_refunded_at_utc as payment_refunded_at_utc,
vp.payment_refunded_date_utc as payment_refunded_date_utc,
vp.refund_payment_reference as refund_payment_reference,
vp.id_guest_user as id_guest_user,
vp.id_verification as id_verification,
vp.verification_payment_type as verification_payment_type,
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.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

View file

@ -1,176 +1,6 @@
version: 2
models:
- name: core__verification_payments
latest_version: 2
description: |
Payments that have happened as part of the Guest Journey.
Each record matches one payment in a guest journey. For example, if a guest pays a fee and a deposit for a booking, this table will hold two records.
Lookups to dimensions have been denormalized.
The data is mostly coming from Superhog, with money conversion happening through hardcoded rates.
columns:
- name: id_verification_to_payment
data_type: bigint
description: Superhog id for the record that relates this Payment to a Verification.
- name: id_payment
data_type: bigint
description: Superhog id for this Payment.
data_tests:
- unique
- not_null
- name: is_refundable
data_type: boolean
description: Whether they payment is refundable or not.
- name: payment_due_at_utc
data_type: timestamp without time zone
description: The point in time at which this payment had to be paid.
data_tests:
- not_null
- name: payment_due_date_utc
data_type: date
description: The date on which this payment had to be paid.
data_tests:
- not_null
- name: payment_paid_at_utc
data_type: timestamp without time zone
description: The point in time at which this payment was paid.
- name: payment_paid_date_utc
data_type: date
description: The date on which this payment was paid.
- name: payment_reference
data_type: character varying
description: |
The payment reference code in the payment processor.
For Acquired, this is typically and 10-12 digits number.
For Stripe, this is a payment intent code. This is formatted as `pi_3OieViJK46Ulzq6A16IWxeW5`, with the part after `pi_` being 24 digits long.
You can use the Stripe code to match this payment with our Stripe records.
- name: refund_due_at_utc
data_type: timestamp without time zone
description: The point in time at which this payment had to be refunded.
- name: refund_due_date_utc
data_type: date
description: The date on which this payment had to be refunded.
- name: payment_refunded_at_utc
data_type: timestamp without time zone
description: The point in time at which this payment was refunded.
- name: payment_refunded_date_utc
data_type: date
description: The date on which this payment was refunded.
- name: refund_payment_reference
data_type: character varying
description: |
The payment reference for the refund in the payment processor.
For Acquired, this is typically and 10-12 digits number.
For Stripe, this is a refund code. This is formatted as `pyr_3OieViJK46Ulzq6A16IWxeW5` or `re_3OfWeTJK46Ulzq6A02gVvZuk`.
You can use the Stripe code to match this refund with our Stripe records.
- name: id_guest_user
data_type: character varying
description: The UUID of the guest user in the Superhog backend.
data_tests:
- not_null
- name: id_verification
data_type: bigint
description: The ID of the verification that generated this payment.
data_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)
data_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.
data_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.
data_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, Cancelled, Paid Manually, Unpaid."
data_tests:
- not_null
- name: notes
data_type: character varying
description: Free text description on the payment. Typically, contains explanations for integration issues with the payment processor.
versions:
- v: 2
columns:
- 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.
data_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)
data_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.
data_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.
data_tests:
- dbt_expectations.expect_column_values_to_be_between:
min_value: 0
strictly: false
- include: all
exclude: [amount_in_txn_currency, amount_in_gbp]
- name: core__bookings
description: |