Merged PR 2877: Update model core__verification_payments to include amounts without taxes

# Description

Update model core__verification_payments to include guest payment amounts without taxes

# Checklist

- [x] The edited models and dependants run properly with production data.
- [x] The edited models are sufficiently documented.
- [x] 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.
This commit is contained in:
Joaquin Ossa 2024-09-18 14:30:23 +00:00
commit 01eca0dbcc
6 changed files with 101 additions and 6 deletions

View file

@ -932,7 +932,7 @@ models:
date before a starting date. date before a starting date.
- name: int_core__verification_payments - name: int_core__verification_payments
latest_version: 1 latest_version: 2
description: >- description: >-
A simplified table that holds guest journey payments with details around A simplified table that holds guest journey payments with details around
when they happen, what service was being paid, what was the related when they happen, what service was being paid, what was the related
@ -1020,6 +1020,8 @@ models:
versions: versions:
- v: 1 - v: 1
deprecation_date: 2024-10-15 00:00:00.00+00:00 deprecation_date: 2024-10-15 00:00:00.00+00:00
config:
alias: int_core__verification_payments
- v: 2 - v: 2
columns: columns:

View file

@ -1,6 +1,6 @@
with with
int_core__verification_payments as ( int_core__verification_payments as (
select * from {{ ref("int_core__verification_payments") }} select * from {{ ref("int_core__verification_payments", version=1) }}
) )
select select
vp.id_verification_to_payment as id_verification_to_payment, vp.id_verification_to_payment as id_verification_to_payment,

View file

@ -0,0 +1,29 @@
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

@ -2,6 +2,7 @@ version: 2
models: models:
- name: core__verification_payments - name: core__verification_payments
latest_version: 2
description: | description: |
Payments that have happened as part of the Guest Journey. Payments that have happened as part of the Guest Journey.
@ -29,10 +30,14 @@ models:
- name: payment_due_at_utc - name: payment_due_at_utc
data_type: timestamp without time zone data_type: timestamp without time zone
description: The point in time at which this payment had to be paid. description: The point in time at which this payment had to be paid.
tests:
- not_null
- name: payment_due_date_utc - name: payment_due_date_utc
data_type: date data_type: date
description: The date on which this payment had to be paid. description: The date on which this payment had to be paid.
tests:
- not_null
- name: payment_paid_at_utc - name: payment_paid_at_utc
data_type: timestamp without time zone data_type: timestamp without time zone
@ -83,10 +88,14 @@ models:
- name: id_guest_user - name: id_guest_user
data_type: character varying data_type: character varying
description: The UUID of the guest user in the Superhog backend. description: The UUID of the guest user in the Superhog backend.
tests:
- not_null
- name: id_verification - name: id_verification
data_type: bigint data_type: bigint
description: The ID of the verification that generated this payment. description: The ID of the verification that generated this payment.
tests:
- not_null
- name: verification_payment_type - name: verification_payment_type
data_type: character varying data_type: character varying
@ -94,24 +103,79 @@ models:
- name: amount_in_txn_currency - name: amount_in_txn_currency
data_type: numeric 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. 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: currency - name: currency
data_type: character varying 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. 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 - name: amount_in_gbp
data_type: numeric data_type: numeric
description: The payment amount value, converted to GBP, using the exchange rate for the day on which the payment happened. 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: payment_status - name: payment_status
data_type: character varying 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 - name: notes
data_type: character varying data_type: character varying
description: Free text description on the payment. Typically, contains explanations for integration issues with the payment processor. description: Free text description on the payment. Typically, contains explanations for integration issues with the payment processor.
versions:
- v: 1
deprecation_date: 2024-10-15 00:00:00.00+00:00
config:
alias: core__verification_payments
- 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.
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: 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
- include: all
exclude: [amount_in_txn_currency, amount_in_gbp]
- name: core__bookings - name: core__bookings
description: | description: |
@ -128,7 +192,7 @@ models:
description: The unique, Superhog generated id for this booking. description: The unique, Superhog generated id for this booking.
tests: tests:
- unique - unique
- not_null - not_nullgit p
- name: id_user_guest - name: id_user_guest
data_type: character varying data_type: character varying

View file

@ -12,7 +12,7 @@ exposures:
depends_on: depends_on:
- ref('dates') - ref('dates')
- ref('core__verification_payments') - ref('core__verification_payments', version=1)
owner: owner:
name: Pablo Martin name: Pablo Martin