data-dwh-dbt-project/models/intermediate/core
Oriol Roqué Paniagua ac73138cf1 Merged PR 5171: First version of Guest Product Payments
# Description

First model for Guest Product Payments. It only contains CIH from Verification Payments (so, the "old" CIH).

Some notes:
* It does not handle taxes computation.
* It converts guest product name to upper case, as the guest product tables are in upper case. I also apply it for payment status, as well as an UNKNOWN status for whenever it's null - we'd need to consider this for the rest of the refactor.
* Computation is placed within a CTE. This is intended since at some point this will include also Guest Product Payments that come from Guest Product related tables.
* Enhanced documentation with respect to Verification Payments V2.

Audit performed:

```
-- THIS GOES INTO AN AUDIT FILE
{% set old_query %}
  select
    *
  from dwh_hybrid.intermediate.int_core__guest_product_payments
{% endset %}

{% set new_query %}
  select
    id_verification_to_payment,
    id_payment,
    is_refundable,
    created_at_utc,
    updated_at_utc,
    payment_due_at_utc,
    payment_due_date_utc,
    payment_paid_at_utc,
    payment_paid_date_utc,
    payment_reference,
    refund_due_at_utc,
    refund_due_date_utc,
    payment_refunded_at_utc,
    payment_refunded_date_utc,
    refund_payment_reference,
    id_user_host,
    id_guest_user as id_user_guest,
    id_verification,
    id_verification_request,
    upper(verification_payment_type) as guest_product_name,
    currency,
    total_amount_in_txn_currency,
    total_amount_in_gbp,
    coalesce(upper(payment_status),'UNKNOWN') as payment_status,
    notes
  from dwh_hybrid.intermediate.int_core__verification_payments_v2
  where verification_payment_type = 'CheckInCover'
{% endset %}

{{
    audit_helper.compare_and_classify_query_results(
        old_query,
        new_query,
        primary_key_columns=["id_verification_to_payment"],
        columns=[
            "id_verification_to_payment",
            "id_payment",
            "is_refundable",
            "created_at_utc",
            "updated_at_utc",
            "payment_due_at_utc",
            "payment_due_date_utc",
            "payment_paid_at_utc",
            "payment_paid_date_utc",
            "payment_reference",
            "refund_due_at_utc",
            "refund_due_date_utc",
            "payment_refunded_at_utc",
            "payment_refunded_date_utc",
            "refund_payment_reference",
            "id_user_host",
            "id_user_guest",
            "id_verification",
            "id_verification_request",
            "guest_product_name",
            "currency",
            "total_amount_in_txn_currency",
            "total_amount_in_gbp",
            "payment_status",
            "notes",
        ],
        sample_limit=10000000,
    )
}}
```

# 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.
- [X] I have checked for DRY opportunities with other models ...
2025-05-09 10:13:58 +00:00
..
int_core__ab_test_monitoring_guest_journey.sql Added timestamp to a/b test model 2025-02-25 14:48:37 +01:00
int_core__ab_test_tracking_guest_journey.sql Merged PR 3766: First version of ab_test_tracking_guest_journey 2024-12-04 07:58:14 +00:00
int_core__accommodation.sql Merged PR 3761: Remove no longer existing fields from Accommodation 2024-12-03 16:39:05 +00:00
int_core__accommodation_to_product_bundle.sql Merged PR 3539: Normalise service names and create booking to service table 2024-11-15 10:04:02 +00:00
int_core__accommodations_activity.sql Listings report model 2025-02-03 10:37:25 +01:00
int_core__active_property_managers_system.sql renamed field 2025-02-19 11:57:58 +01:00
int_core__booking_charge_events.sql Merged PR 2642: Booking Charge Events to have a similar logic as invoicing 2024-09-03 13:15:40 +00:00
int_core__booking_details.sql fix booking_detail model 2025-02-11 12:36:47 +01:00
int_core__booking_service_detail.sql Merged PR 5049: Set option with basic waiver as deposit management 2025-04-24 12:20:50 +00:00
int_core__booking_summary.sql upgraded screening 2025-04-08 12:09:08 +02:00
int_core__booking_to_product_bundle.sql Merged PR 3539: Normalise service names and create booking to service table 2024-11-15 10:04:02 +00:00
int_core__booking_to_service.sql Merged PR 4287: Bugfix - Ensure exclusion of test account at where condition 2025-02-05 15:54:19 +00:00
int_core__bookings.sql Merged PR 3825: Removing Booking fields soon to be dropped 2024-12-11 13:06:28 +00:00
int_core__check_in_cover_listings.sql fixed testing for core__check_in_cover_listings 2024-08-28 10:47:31 +02:00
int_core__check_in_cover_prices.sql Merged PR 2865: Propagate tax exclusive check in hero payments 2024-09-17 07:25:09 +00:00
int_core__check_in_cover_users.sql Merged PR 2201: Fixing errors raised by texts 2024-07-05 15:12:04 +00:00
int_core__check_in_hero_users.sql Added booking fee and currency to model 2025-01-15 09:00:36 +01:00
int_core__country.sql Merged PR 2077: Adding Country to intermediate 2024-06-19 15:34:15 +00:00
int_core__deal.sql Merged PR 4618: Bugfix - Ensure the PMS is active 2025-03-05 14:57:57 +00:00
int_core__duplicate_bookings.sql Thanks Uri for the catch, then when id_user_guest is NULL it won't be considered a duplicate. 2024-07-31 16:23:27 +02:00
int_core__guest_product_payments.sql Merged PR 5171: First version of Guest Product Payments 2025-05-09 10:13:58 +00:00
int_core__guest_product_price_plans.sql Removes configuration status and adds config id for further joins 2025-03-18 09:20:31 +01:00
int_core__guest_products.sql Merged PR 4699: Creates a master table for guest products 2025-03-14 13:04:46 +00:00
int_core__guest_satisfaction_responses.sql update int_core__guest_satisfaction_responses to version 2 of verification_payments 2024-09-17 17:12:46 +02:00
int_core__host_booking_fees.sql Merged PR 2725: Force id user field to lower in staging 2024-09-03 14:36:21 +00:00
int_core__invoicing_price_plans_per_month.sql Merged PR 2642: Booking Charge Events to have a similar logic as invoicing 2024-09-03 13:15:40 +00:00
int_core__new_dash_deal_since_date.sql Merged PR 4349: Xero metrics by Business Scope 2025-02-11 15:13:42 +00:00
int_core__new_dash_user_overview.sql Addressed comments 2025-04-03 16:23:58 +02:00
int_core__new_dash_users.sql Merged PR 3491: Allows possibility to retrieve claim as date or timestamp 2024-11-13 11:42:04 +00:00
int_core__payaway.sql model and docs 2024-09-17 12:16:52 +02:00
int_core__payaway_per_month_user.sql model and docs+tests 2024-09-17 15:47:45 +02:00
int_core__payments.sql new booking fields 2025-02-19 15:29:05 +01:00
int_core__price_plans.sql docs and moving stuff 2024-04-08 09:44:32 +02:00
int_core__product_service_billing_item.sql Merged PR 3638: Propagates billing info to booking service detail and booking summary 2024-11-22 13:50:30 +00:00
int_core__product_service_to_price.sql Merged PR 3578: First version of int_core__booking_service_detail 2024-11-19 08:24:32 +00:00
int_core__protection_plan_billing_item.sql Merged PR 3638: Propagates billing info to booking service detail and booking summary 2024-11-22 13:50:30 +00:00
int_core__protection_plan_cover.sql Merged PR 3539: Normalise service names and create booking to service table 2024-11-15 10:04:02 +00:00
int_core__protection_plan_to_price.sql Merged PR 3578: First version of int_core__booking_service_detail 2024-11-19 08:24:32 +00:00
int_core__screen_and_protect_users.sql Invoice model completed 2025-02-13 15:31:22 +01:00
int_core__unified_user.sql Merged PR 4687: Bugfix - Removal of SH fields that no longer exist 2025-03-13 12:25:13 +00:00
int_core__unique_accommodation_to_user.sql Merged PR 2125: Fixing accommodation host 2024-06-26 14:47:15 +00:00
int_core__user_host.sql Merged PR 4618: Bugfix - Ensure the PMS is active 2025-03-05 14:57:57 +00:00
int_core__user_product_bundle.sql Merged PR 4271: Adapts test account logic + New Dash exclusion 2025-02-05 09:51:30 +00:00
int_core__user_product_bundle_contains_services.sql changes tested 2025-03-26 10:19:49 +01:00
int_core__user_role.sql Merged PR 2516: Create host_user and user_role in intermediate 2024-08-07 14:28:34 +00:00
int_core__verification_payments_v2.sql Silly fix 2025-02-18 12:25:02 +01:00
int_core__verification_request_booking_source.sql Removed guests_id and modified query structure 2024-07-11 16:49:24 +02:00
int_core__verification_request_completed_date.sql Merged PR 2028: guest journey estimated completed date 2024-06-13 13:30:22 +00:00
int_core__verification_request_completeness.sql Merged PR 2020: Verification request completeness for intermediate steps + schema documentation 2024-06-13 08:14:11 +00:00
int_core__verification_requests.sql Added the new field to int_core__bookings and to int_core__verification_requests 2024-07-11 17:16:51 +02:00
int_core__vr_check_in_cover.sql Merged PR 3506: Remove Address Validation 2024-11-14 11:59:36 +00:00
int_core__waiver_fees.sql ***ing decimals 2025-02-11 17:10:07 +01:00
schema.yml Merged PR 5171: First version of Guest Product Payments 2025-05-09 10:13:58 +00:00