cal-itp/data-infra

Payments: Some Littlepay Customers Have Improper Principal Links

Closed this issue · 0 comments

Describe the bug

We bring a principal_customer_id through from stg_littlepay__customer_funding_source to other models. In doing so, we assume that a principal customer ID can only exist one level above a given customer ID - if a customer ID is a principal to another customer ID, it must have itself as its principal customer ID. This doesn't seem to hold in some of our data, as evidenced by Sentry issues #71485 and #71486.

To Reproduce

The linked Sentry issues provide some test queries that can be run to surface the unexpected relationships.

Expected behavior

We initially interpreted these relationships through guesswork, so it's possible that multiple levels of principal customer ID relationships could exist. However, we don't believe that should be the case. Ideally, we should be able to identify customer ID relationships to correct or to suppress (if we determine that we have flawed source data, malformed or used for testing purposes), as we did in #3021.