diff --git a/models/intermediate/core/schema.yaml b/models/intermediate/core/schema.yaml index ee88552..b626a4c 100644 --- a/models/intermediate/core/schema.yaml +++ b/models/intermediate/core/schema.yaml @@ -349,7 +349,85 @@ models: description: estimated date from the timestamp of when the verification request was completed. - name: is_completed_at_overriden_with_used_link_at - data_type: boolean - description: | - boolean indicating if the estimated dates have been overriden with the used link since - the initial computation was still considering an end date before a starting date. \ No newline at end of file + data_type: boolean + description: > + boolean indicating if the estimated dates have been overriden with the + used link since the initial computation was still considering an end + date before a starting date. + + - name: int_core__verification_payments + description: >- + A simplified table that holds guest journey payments with details around + when they happen, what service was being paid, what was the related + verification request, etc. + + Currency rates are converted to GBP with our simple exchange rates view. + columns: + - name: id_verification_to_payment + data_type: bigint + description: Unique ID for the relation between the payment verification + and the payment at hand. + tests: + - unique + - not_null + - name: id_payment + data_type: bigint + description: Unique ID for the payment itself. + tests: + - unique + - not_null + - name: is_refundable + data_type: boolean + - name: created_at_utc + data_type: timestamp without time zone + - name: updated_at_utc + data_type: timestamp without time zone + - name: payment_due_at_utc + data_type: timestamp without time zone + tests: + - not_null + - name: payment_due_date_utc + data_type: date + tests: + - not_null + - name: payment_paid_at_utc + data_type: timestamp without time zone + - name: payment_paid_date_utc + data_type: date + - name: payment_reference + data_type: character varying + - name: refund_due_at_utc + data_type: timestamp without time zone + - name: refund_due_date_utc + data_type: date + - name: payment_refunded_at_utc + data_type: timestamp without time zone + - name: payment_refunded_date_utc + data_type: date + - name: refund_payment_reference + data_type: character varying + - name: id_guest_user + data_type: character varying + - name: id_verification + data_type: bigint + - name: id_verification_request + data_type: bigint + - name: verification_payment_type + data_type: character varying + - name: amount_in_txn_currency + data_type: numeric + tests: + - not_null + - name: currency + data_type: character varying + tests: + - not_null + - name: amount_in_gbp + data_type: numeric + tests: + - not_null + - name: payment_status + data_type: character varying + - name: notes + data_type: character varying + diff --git a/models/staging/core/stg_core__payment.sql b/models/staging/core/stg_core__payment.sql index e6dce40..8752380 100644 --- a/models/staging/core/stg_core__payment.sql +++ b/models/staging/core/stg_core__payment.sql @@ -12,7 +12,12 @@ with cast({{ adapter.quote("RefundDate") }} as date) as refunded_date_utc, {{ adapter.quote("CreatedDate") }} as created_at_utc, cast({{ adapter.quote("CreatedDate") }} as date) as created_date_utc, - {{ adapter.quote("CurrencyIso") }} as currency, + -- The field in SQL Server is this funny case insensitive shit that is + -- supposed to not be case sensitive due to the db collation but somehow + -- does store different cases. There is one pesky record where EUR is + -- stored as Eur. I placed this upper to save us from this and future + -- weird ones. + upper({{ adapter.quote("CurrencyIso") }}) as currency, {{ adapter.quote("PaymentDate") }} as paid_at_utc, cast({{ adapter.quote("PaymentDate") }} as date) as paid_date_utc, {{ adapter.quote("UpdatedDate") }} as updated_at_utc,