From ff962608adb6c2c0031c9eed9b56d810d553d8f6 Mon Sep 17 00:00:00 2001 From: Joaquin Ossa Date: Tue, 20 Aug 2024 09:27:49 +0200 Subject: [PATCH 1/2] Added Address_validation to int_core__vr_check_in_cover --- .../core/int_core__vr_check_in_cover.sql | 8 + models/intermediate/core/schema.yaml | 262 +++++++++++++++++- 2 files changed, 267 insertions(+), 3 deletions(-) diff --git a/models/intermediate/core/int_core__vr_check_in_cover.sql b/models/intermediate/core/int_core__vr_check_in_cover.sql index f55d2fd..6047d70 100644 --- a/models/intermediate/core/int_core__vr_check_in_cover.sql +++ b/models/intermediate/core/int_core__vr_check_in_cover.sql @@ -22,6 +22,9 @@ with where verification_payment_type = 'CheckInCover' -- 5 is check-in cover and payment_status in ('Paid', 'Refunded') + ), + int_core__address_validations as ( + select * from {{ ref("int_core__address_validations") }} ) select vr.id_verification_request, @@ -43,6 +46,8 @@ select and vr.is_verification_request_complete ) as is_awaiting_check_in, p.amount_in_txn_currency is not null as cover_was_purchased, + av.validation_passed, + av.notes, ( p.amount_in_txn_currency is null and vr.is_verification_request_complete ) as cover_was_rejected, @@ -103,6 +108,9 @@ left join left join int_core__check_in_cover_prices ccp on p.currency = ccp.local_currency_iso_4217 left join int_core__unified_user gu on gu.id_user = vr.id_user_guest +left join + int_core__address_validations av + on av.id_verification_request = vr.id_verification_request -- 15 is Check-in cover. -- Adding this condition results in only keeping guest journeys that offered the -- check-in cover diff --git a/models/intermediate/core/schema.yaml b/models/intermediate/core/schema.yaml index 7d96f2c..11ed314 100644 --- a/models/intermediate/core/schema.yaml +++ b/models/intermediate/core/schema.yaml @@ -140,13 +140,269 @@ models: - unique - name: int_core__vr_check_in_cover + description: + "This tables holds information on verification requests + with Ckeck-in Hero available for the guests." columns: - name: id_verification_request - data_type: character varying - description: The unique ID for the verification request. + data_type: bigint + description: + "Unique, incremental, internal ID for the related verification + request." tests: - - not_null - unique + - not_null + + - name: uuid_verification_request + data_type: text + description: "uuid for the related verification request" + + - name: id_verification_set + data_type: bigint + description: "" + + - name: id_superhog_verified_set + data_type: bigint + description: "" + + - name: id_payment_validation_set + data_type: bigint + description: "" + + - name: id_user_guest + data_type: character varying + description: Unique, incremental, internal ID for the guest user. + + - name: id_user_host + data_type: character varying + description: Unique, incremental, internal ID for the host user. + + - name: id_booking + data_type: bigint + description: "" + + - name: id_accommodation + data_type: bigint + description: "Id of the accommodation or listing." + + - name: is_verification_request_complete + data_type: boolean + description: + "True if the verification request is considered + complete, AKA the guest has finished the full guest journey." + + - name: is_past_check_in + data_type: boolean + description: "" + + - name: is_awaiting_check_in + data_type: boolean + description: "" + + - name: cover_was_purchased + data_type: boolean + description: + "Boolean to indicate if the cover was purchased by the guest or not." + + - name: validation_passed + data_type: boolean + description: + "Boolean to indicate if the validation was approved or not. + In case there was a problem with the validation it will be Null" + + - name: notes + data_type: character varying + description: "Notes in case there was some problem with the validation." + + - name: cover_was_rejected + data_type: boolean + description: "" + + - name: verification_url + data_type: character varying + description: "" + + - name: callback_url + data_type: character varying + description: "" + + - name: redirect_url + data_type: character varying + description: "" + + - name: logo + data_type: character varying + description: "" + + - name: guest_email + data_type: character varying + description: "The email of the guest" + + - name: last_name + data_type: character varying + description: The last name of the guest. + + - name: first_name + data_type: character varying + description: The first name of the guest. + + - name: guest_phone_number + data_type: character varying + description: The phone number of the guest. + + - name: telephone_code + data_type: character varying + description: The telephone code of the guest. + + - name: guest_phone_number_2 + data_type: character varying + description: "" + + - name: check_in_at_utc + data_type: timestamp without time zone + description: "" + + - name: check_in_date_utc + data_type: date + description: "" + + - name: check_out_at_utc + data_type: timestamp without time zone + description: "" + + - name: check_out_date_utc + data_type: date + description: "" + + - name: verification_start_at_utc + data_type: timestamp without time zone + description: "" + + - name: verification_start_date_utc + data_type: date + description: "" + + - name: verification_end_at_utc + data_type: timestamp without time zone + description: "" + + - name: verification_end_date_utc + data_type: date + description: "" + + - name: link_used_at_utc + data_type: timestamp without time zone + description: "" + + - name: link_used_date_utc + data_type: date + description: "" + + - name: expire_at_utc + data_type: timestamp without time zone + description: "" + + - name: expire_date_utc + data_type: date + description: "" + + - name: is_deleted + data_type: boolean + description: "" + + - name: redirect_name + data_type: character varying + description: "" + + - name: id_one_step_link + data_type: bigint + description: "" + + - name: success_message + data_type: character varying + description: "" + + - name: summary + data_type: character varying + description: "" + + - name: rejection_reason + data_type: character varying + description: "" + + - name: has_switched_to_mobile + data_type: boolean + description: "" + + - name: is_verifier_rejected + data_type: boolean + description: "" + + - name: config + data_type: character varying + description: "" + + - name: metadata + data_type: character varying + description: "" + + - name: created_at_utc + data_type: timestamp without time zone + description: "Date and time at which the validation was created." + + - name: created_date_utc + data_type: date + description: "" + + - name: updated_at_utc + data_type: timestamp without time zone + description: "Date and time at which the validation was last updated." + + - name: updated_date_utc + data_type: date + description: "" + + - name: dwh_extracted_at_utc + data_type: timestamp with time zone + description: "Date and time at which the record was extracted from the backend into the DWH." + + - 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." + + - name: currency + data_type: text + description: + "The currency in which the transaction actually happened." + + - 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." + + - name: payment_status + data_type: character varying + description: + "The status of the payment. It can be one of: Paid, Refunded, Refund Failed." + + - name: payment_paid_date_utc + data_type: date + description: "" + + - name: checkin_cover_limit_amount_local_curr + data_type: numeric + description: + "The amount for which the guest user is covered if he faces problems + during check-in in their local currency." + + - name: checkin_cover_limit_amount_in_gbp + data_type: numeric + description: + "The amount for which the guest user is covered if he faces problems + during check-in in GBP." - name: int_core__monthly_accommodation_history_by_deal description: | From 45f7f640bafa8fc1cc00e60fc9efd096e9eda7fe Mon Sep 17 00:00:00 2001 From: Joaquin Ossa Date: Tue, 20 Aug 2024 12:56:52 +0200 Subject: [PATCH 2/2] Changed names for easier understanding --- models/intermediate/core/int_core__vr_check_in_cover.sql | 4 ++-- models/intermediate/core/schema.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/models/intermediate/core/int_core__vr_check_in_cover.sql b/models/intermediate/core/int_core__vr_check_in_cover.sql index 6047d70..a2c0aae 100644 --- a/models/intermediate/core/int_core__vr_check_in_cover.sql +++ b/models/intermediate/core/int_core__vr_check_in_cover.sql @@ -46,8 +46,8 @@ select and vr.is_verification_request_complete ) as is_awaiting_check_in, p.amount_in_txn_currency is not null as cover_was_purchased, - av.validation_passed, - av.notes, + av.validation_passed as address_validation_passed, + av.notes as address_validation_notes, ( p.amount_in_txn_currency is null and vr.is_verification_request_complete ) as cover_was_rejected, diff --git a/models/intermediate/core/schema.yaml b/models/intermediate/core/schema.yaml index 321f6f0..56a7bac 100644 --- a/models/intermediate/core/schema.yaml +++ b/models/intermediate/core/schema.yaml @@ -204,13 +204,13 @@ models: description: "Boolean to indicate if the cover was purchased by the guest or not." - - name: validation_passed + - name: address_validation_passed data_type: boolean description: "Boolean to indicate if the validation was approved or not. In case there was a problem with the validation it will be Null" - - name: notes + - name: address_validation_notes data_type: character varying description: "Notes in case there was some problem with the validation."