Merged PR 2744: verifications model for Guesty
# Description new model with Guesty verifications for business overview report, this one is a lot more simple since it only charges per nights of the booking. Though there is a slight problem that right now there are some verifications with bookings with 0 nights, those are being filtered out for the moment so they don't crash the model tests. # 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 and docs. - [x] I've picked the right materialization for the affected models. # Other - [ ] Check if a full-refresh is required after this PR is merged. Related work items: #20125
This commit is contained in:
commit
bc77e5df08
2 changed files with 149 additions and 0 deletions
|
|
@ -0,0 +1,96 @@
|
|||
{% set ok_status = "Approved" %}
|
||||
-- 2GBP/booked night if booking is approved, to be charged on checkout
|
||||
{% set cost_per_night = 2 %}
|
||||
-- verifications for bookings of 0 nights length (free verifications)
|
||||
{% set zero_nights_verifications = (
|
||||
"1e2_IdjTfE-5-63wsVvsLw",
|
||||
"1eyQxaOrik-tDDY-50yETw",
|
||||
"2QsxYXnp8Eqt9LvwF-RjQA",
|
||||
"3EwjbURya0CBcXPNiNd4AQ",
|
||||
"3HTQjfd8UEaQuOBjSM4r4A",
|
||||
"44kyxquKfEepksOaD3EkBA",
|
||||
"4kFxvTnhVkSITKCAsC_EcA",
|
||||
"5lmGMd2BMkSZWI-V1pMYQQ",
|
||||
"7Hcc3tvcw0G-yUs4TDdDUA",
|
||||
"7KkmuwFMfUmNxhhGkvesJQ",
|
||||
"8aQ48W3lWEGFOMJ6p-fbMA",
|
||||
"8XeRk5xhWkan_qWJY1f2lA",
|
||||
"8Y0Yt927Rk22O7PDIOytnw",
|
||||
"9Hz0ortDMUuXqoGHvv6abg",
|
||||
"a5bCsG937U6Z3yK9dMjrpA",
|
||||
"ackyLdyBrkC5artgEuKF4w",
|
||||
"ApP1uSQMC0qTHlBt6FD5fA",
|
||||
"aq6Jc-orvEOhMd7NRD7bqw",
|
||||
"ATVxKzqCpkqdq_L1YZ2pmA",
|
||||
"bZh2Y6wVbUytYP2LO8AN9A",
|
||||
"CbiQTmAoiEWRqdyGy7G_sw",
|
||||
"Dk1RUj8VYEWtH2o0SmST7w",
|
||||
"doZ9bEUtF0a89zd2y-W3fA",
|
||||
"E8Ja63GtoUiQnB-XVAmoDQ",
|
||||
"evZyKAB8VEuILahLMIxbvQ",
|
||||
"gDD04Xu0oUauqSmPXpp0Fg",
|
||||
"GmF3HSUuBUmy5AW13Xp9uQ",
|
||||
"GRNw1nCcOEamq-VzKTlgBA",
|
||||
"H08FsxtIKE-0g3SmBKRJDg",
|
||||
"hkquJggA2ESg1dgJxS4Qvg",
|
||||
"iVE0CddyJUKcyQ0vHomjkw",
|
||||
"Ji-bKUnbEUWu41uOaZZ7AA",
|
||||
"jTmvoTGQvEOKXYMTSJkHcw",
|
||||
"KEXvz4kCek2sHpkn1YQnTg",
|
||||
"kIugOX7Xa0G0Ji-fbupJmQ",
|
||||
"-kJtKe0ro0qJm5cJ3n4UJw",
|
||||
"KYknhrUET0ezwMlGVnW5bA",
|
||||
"L8J4vqxC3ku2Rl-JYISKcw",
|
||||
"lfUz7LE0fEqnh3FQCCnr7w",
|
||||
"lPAVUVnvC02S9Lk4KVJHoQ",
|
||||
"MmEI1qRyW0yDvG1XAa2nXA",
|
||||
"MRANOM0Nokyu-w5U217jGQ",
|
||||
"NC6aoxHnaUGRnmP3eBqARA",
|
||||
"nv3_ga2lZ0O0p_JAXg8GYw",
|
||||
"Os-O0qdGuESgsI2NSyS9SQ",
|
||||
"piu-gaC7wEyIVhq3oRwTvA",
|
||||
"pvIEp8oI3069WJpXvIs6vw",
|
||||
"QH4SEo6CwU6FZyZVFlInbw",
|
||||
"qLWsWLSuokC6ErtOJEQ2gw",
|
||||
"r-EfTfsrpEy0E3Z_zO7_Cg",
|
||||
"rRDE-bleRUmGjQIhfIegiA",
|
||||
"SdbeP3jDWku0s2KRXrPoTw",
|
||||
"t8zbERNeo0S8A0fyuLiifQ",
|
||||
"Ta22a2fewUC5XeIzBR-UbA",
|
||||
"TMXcAl1_YUSn95citKZqWA",
|
||||
"tqkrt7xWsEm10kO1dIX7Uw",
|
||||
"tsWypIaf7Uyt9JnacY7hfw",
|
||||
"txNanrgPi06rzn1zlhq6mQ",
|
||||
"tZPMh6UAM06pbO5ilj1_ZQ",
|
||||
"UbIXEWG02kOLtXy2YHOh7g",
|
||||
"UHXtpZ-wkk6vKZsgRnSV0w",
|
||||
"ujDpwnsj2EKOaTC-kcJlgw",
|
||||
"uu8hI2o8F021mT6Sd9torQ",
|
||||
"VJOEu3sK30mqE-TMx-rbGQ",
|
||||
"vvu12dqmH0-ly6dN_mm8ZA",
|
||||
"vxAGWHT3L0GWjvqn320DxA",
|
||||
"wqydvtLFo0GGOwn-rMzQyQ",
|
||||
"X2MZAlwNVUSmQO6__Y7Zyg",
|
||||
"xfq-t4w0cUGQz5_MuOUlnw",
|
||||
"Xht7NfpS50GinSKzzX_gQg",
|
||||
"Y0EG8skyB0y105hz-ayTSQ",
|
||||
"Y8LYI_4QE0W0ShG1jAVaDA",
|
||||
"ZpbBtHGa2E6JaLgX1LsYLQ",
|
||||
) %}
|
||||
with
|
||||
int_edeposit__verifications as (
|
||||
select * from {{ ref("int_edeposit__verifications") }}
|
||||
)
|
||||
select
|
||||
v.id_verification,
|
||||
v.id_booking,
|
||||
v.is_cancelled,
|
||||
v.number_nights * {{ cost_per_night }} as ok_status_fee_in_gbp,
|
||||
v.created_date_utc,
|
||||
v.checkout_date_utc
|
||||
from int_edeposit__verifications v
|
||||
where
|
||||
v.version = 'V1'
|
||||
and v.verification_status = '{{ ok_status }}'
|
||||
and v.id_booking is not null
|
||||
and v.id_verification not in {{ zero_nights_verifications }}
|
||||
|
|
@ -303,5 +303,58 @@ models:
|
|||
- name: created_date_utc
|
||||
data_type: date
|
||||
description: "Date of creation of the verification in the system"
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
- name: int_edeposit__guesty_verifications
|
||||
description:
|
||||
"This table shows all verification for Guesty.
|
||||
The charged fee is 2GBP per booked night if booking is approved,
|
||||
to be charged on checkout."
|
||||
columns:
|
||||
- name: id_verification
|
||||
data_type: text
|
||||
description: "unique Superhog generated id for this verification"
|
||||
tests:
|
||||
- unique
|
||||
- not_null
|
||||
|
||||
- name: id_booking
|
||||
data_type: text
|
||||
description:
|
||||
"unique Superhog generated id for a booking.
|
||||
note that this could be duplicated and both will be charged,
|
||||
it's up to the user to not generate or cancel duplicate verifications"
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
- name: is_cancelled
|
||||
data_type: boolean
|
||||
description: "indicates if the booking has been cancelled or not."
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
- name: ok_status_fee_in_gbp
|
||||
data_type: integer
|
||||
description:
|
||||
"total fee charged on checkout, this is only charged for approved verifications"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_between:
|
||||
min_value: 0
|
||||
strictly: true
|
||||
where: is_cancelled = false
|
||||
|
||||
- name: created_date_utc
|
||||
data_type: date
|
||||
description:
|
||||
"Date of creation of the verification in the system"
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
- name: checkout_date_utc
|
||||
data_type: date
|
||||
description:
|
||||
"Date of checkout for the booking"
|
||||
tests:
|
||||
- not_null
|
||||
Loading…
Add table
Add a link
Reference in a new issue