-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from fivetran/feature/credit-card-payments
Feature/credit card payments
- Loading branch information
Showing
18 changed files
with
234 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: 'check docs' | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
changed-files: | ||
runs-on: ubuntu-latest | ||
name: test changed-files | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Get changed files | ||
id: changed-files | ||
uses: tj-actions/changed-files@v29.0.4 | ||
with: | ||
files: docs/** | ||
|
||
- name: Check to see if docs folder hasn't changed | ||
if: steps.changed-files.outputs.any_changed == 'false' | ||
run: | | ||
echo "Docs have not been regenerated." | ||
exit 1 | ||
- name: Check if docs folder has changed | ||
if: steps.changed-files.outputs.any_changed == 'true' | ||
run: | | ||
echo "Docs have been regenerated!" | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,4 @@ | |
target/ | ||
dbt_modules/ | ||
logs/ | ||
|
||
dbt_packages/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
target/ | ||
dbt_modules/ | ||
dbt_packages/ | ||
logs/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
id,amount,bank_account_id,credit_card_account_id,created_at,updated_at,currency_id,transaction_date,_fivetran_deleted | ||
1111,5,5,7,2022-07-21 09:57:41,2022-07-21 09:57:41,USD,2022-07-21,FALSE | ||
2222,10.02,5,7,2020-05-24 19:39:23,2020-05-24 19:39:23,USD,2020-05-19,FALSE | ||
3333,13.52,5,7,2022-09-06 12:12:07,2022-09-06 12:12:07,USD,2022-09-04,FALSE | ||
4444,65.22,5,7,2022-01-05 22:22:11,2022-01-05 22:22:11,USD,2022-01-04,FALSE | ||
5555,94.1,5,7,2022-07-09 21:15:24,2022-07-09 21:15:24,USD,2022-06-18,FALSE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{% macro get_credit_card_payment_txn_columns() %} | ||
|
||
{% set columns = [ | ||
{"name": "id", "datatype": dbt_utils.type_string()}, | ||
{"name": "_fivetran_deleted", "datatype": "boolean"}, | ||
{"name": "_fivetran_synced", "datatype": dbt_utils.type_timestamp()}, | ||
{"name": "amount", "datatype": dbt_utils.type_float()}, | ||
{"name": "bank_account_id", "datatype": dbt_utils.type_string()}, | ||
{"name": "created_at", "datatype": dbt_utils.type_timestamp()}, | ||
{"name": "credit_card_account_id", "datatype": dbt_utils.type_string()}, | ||
{"name": "currency_id", "datatype": dbt_utils.type_string()}, | ||
{"name": "sync_token", "datatype": dbt_utils.type_string()}, | ||
{"name": "transaction_date", "datatype": "date"}, | ||
{"name": "updated_at", "datatype": dbt_utils.type_timestamp()} | ||
|
||
] %} | ||
|
||
{{ return(columns) }} | ||
|
||
{% endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--To enable this model, set the using_invoice_bundle variable within your dbt_project.yml file to True. | ||
{{ config(enabled=var('using_credit_card_payment_txn', False)) }} | ||
|
||
with base as ( | ||
|
||
select * | ||
from {{ ref('stg_quickbooks__credit_card_payment_txn_tmp') }} | ||
), | ||
|
||
fields as ( | ||
|
||
select | ||
{{ | ||
fivetran_utils.fill_staging_columns( | ||
source_columns=adapter.get_columns_in_relation(ref('stg_quickbooks__credit_card_payment_txn_tmp')), | ||
staging_columns=get_credit_card_payment_txn_columns() | ||
) | ||
}} | ||
from base | ||
), | ||
|
||
final as ( | ||
|
||
select | ||
cast(id as {{ dbt_utils.type_string() }}) as credit_card_payment_id, | ||
amount, | ||
bank_account_id, | ||
credit_card_account_id, | ||
created_at, | ||
updated_at, | ||
currency_id, | ||
transaction_date, | ||
_fivetran_deleted, | ||
row_number() over (partition by id, updated_at order by updated_at desc) = 1 as is_most_recent_record | ||
from fields | ||
) | ||
|
||
select * | ||
from final | ||
where not coalesce(_fivetran_deleted, false) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--To enable this model, set the using_credit_card_payment_txn variable within your dbt_project.yml file to True. | ||
{{ config(enabled=var('using_credit_card_payment_txn', False)) }} | ||
|
||
select * | ||
from {{ var('credit_card_payment_txn') }} |