Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

payments: expose remaining elavon batch types and modify row access policy #3419

Merged
merged 1 commit into from
Aug 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions warehouse/macros/create_row_access_policy.sql
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ filter using (

{{ create_row_access_policy(
principals = ['serviceAccount:[email protected]',
'serviceAccount:metabase-payments-team@cal-itp-data-infra.iam.gserviceaccount.com',
'serviceAccount:[email protected]',
'serviceAccount:github-actions-services-accoun@cal-itp-data-infra.iam.gserviceaccount.com',
'group:[email protected]',
Expand Down Expand Up @@ -156,6 +157,7 @@ filter using (

{{ create_row_access_policy(
principals = ['serviceAccount:[email protected]',
'serviceAccount:metabase-payments-team@cal-itp-data-infra.iam.gserviceaccount.com',
'serviceAccount:[email protected]',
'serviceAccount:github-actions-services-accoun@cal-itp-data-infra.iam.gserviceaccount.com',
'group:[email protected]',
Expand Down
100 changes: 100 additions & 0 deletions warehouse/models/staging/payments/elavon/_elavon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,103 @@ models:
- name: ent_num
- name: dt
- name: execution_ts

- name: int_elavon__chargeback_transactions
description: Chargeback-specific transactions processed by Elavon
columns:
- name: payment_reference
- name: payment_date
- name: account_number
- name: routing_number
- name: fund_amt
- name: batch_reference
- name: batch_type
- name: customer_batch_reference
- name: customer_name
- name: merchant_number
- name: external_mid
- name: store_number
- name: chain
- name: batch_amt
- name: amount
- name: surchg_amount
- name: convnce_amt
- name: card_type
- name: charge_type
- name: charge_type_description
- name: card_plan
- name: card_no
- name: chk_num
- name: transaction_date
- name: settlement_date
- name: authorization_code
- name: chargeback_control_no
- name: roc_text
- name: trn_aci
- name: card_scheme_ref
- name: trn_ref_num
tests:
- unique
- name: settlement_method
- name: currency_code
- name: cb_acq_ref_id
- name: chgbk_rsn_code
- name: chgbk_rsn_desc
- name: mer_ref
- name: purch_id
- name: cust_cod
- name: trn_arn
- name: term_id
- name: ent_num
- name: dt
- name: execution_ts

- name: int_elavon__adjustment_transactions
description: Adjustment-specific transactions processed by Elavon
columns:
- name: payment_reference
- name: payment_date
- name: account_number
- name: routing_number
- name: fund_amt
- name: batch_reference
- name: batch_type
- name: customer_batch_reference
- name: customer_name
- name: merchant_number
- name: external_mid
- name: store_number
- name: chain
- name: batch_amt
- name: amount
- name: surchg_amount
- name: convnce_amt
- name: card_type
- name: charge_type
- name: charge_type_description
- name: card_plan
- name: card_no
- name: chk_num
- name: transaction_date
- name: settlement_date
- name: authorization_code
- name: chargeback_control_no
- name: roc_text
- name: trn_aci
- name: card_scheme_ref
- name: trn_ref_num
tests:
- unique
- name: settlement_method
- name: currency_code
- name: cb_acq_ref_id
- name: chgbk_rsn_code
- name: chgbk_rsn_desc
- name: mer_ref
- name: purch_id
- name: cust_cod
- name: trn_arn
- name: term_id
- name: ent_num
- name: dt
- name: execution_ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{{ config(materialized='table') }}

WITH

adjustment_transactions AS (

SELECT * FROM {{ ref('stg_elavon__transactions') }}
WHERE batch_type = 'A'

),

int_elavon__adjustment_transactions AS (

SELECT
payment_reference,
payment_date,
account_number,
routing_number,
fund_amt,
batch_reference,
batch_type,
customer_batch_reference,
customer_name,
merchant_number,
external_mid,
store_number,
chain,
batch_amt,
amount,
surchg_amount,
convnce_amt,
card_type,
charge_type,
charge_type_description,
card_plan,
card_no,
chk_num,
transaction_date,
settlement_date,
authorization_code,
chargeback_control_no,
roc_text,
trn_aci,
card_scheme_ref,
trn_ref_num,
settlement_method,
currency_code,
cb_acq_ref_id,
chgbk_rsn_code,
chgbk_rsn_desc,
mer_ref,
purch_id,
cust_cod,
trn_arn,
term_id,
ent_num,
dt,
execution_ts

FROM adjustment_transactions

)

SELECT * FROM int_elavon__adjustment_transactions
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
{{ config(materialized='table') }}

WITH

chargeback_transactions AS (

SELECT * FROM {{ ref('stg_elavon__transactions') }}
WHERE batch_type = 'C'

),

int_elavon__chargeback_transactions AS (

SELECT

payment_reference,
payment_date,
account_number,
routing_number,
fund_amt,
batch_reference,
batch_type,
customer_batch_reference,
customer_name,
merchant_number,
external_mid,
store_number,
chain,
batch_amt,
amount,
surchg_amount,
convnce_amt,
card_type,
charge_type,
charge_type_description,
card_plan,
card_no,
chk_num,
transaction_date,
settlement_date,
authorization_code,
chargeback_control_no,
roc_text,
trn_aci,
card_scheme_ref,
trn_ref_num,
settlement_method,
currency_code,
cb_acq_ref_id,
chgbk_rsn_code,
chgbk_rsn_desc,
mer_ref,
purch_id,
cust_cod,
trn_arn,
term_id,
ent_num,
dt,
execution_ts

-- if we remove the need for a union between billing and deposit data downstream, these are the columns to keep
-- (ie deposit-specific, always null columns are removed)
-- payment_reference,
-- payment_date,
-- account_number,
-- routing_number,
-- fund_amt,
-- batch_reference,
-- batch_type,
-- customer_name,
-- merchant_number,
-- external_mid,
-- chain,
-- batch_amt,
-- amount,
-- card_type,
-- charge_type,
-- charge_type_description,
-- card_plan,
-- settlement_method,
-- currency_code,
-- ent_num,
-- dt,
-- execution_ts

FROM chargeback_transactions

)

SELECT * FROM int_elavon__chargeback_transactions
Loading