-
Notifications
You must be signed in to change notification settings - Fork 40
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
22063 - Allow multiple payment methods, also create multiple CFS accounts to support EFT/PAD switching #1597
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
Note: Need to do a few tests for this:
|
pay-api/migrations/versions/2024_07_08_f6990cf5ddf1_cfs_account_payment_method.py
Show resolved
Hide resolved
# Conflicts: # pay-admin/admin/__init__.py
@@ -175,13 +175,14 @@ def get_payment_methods_query(statement: StatementModel): | |||
.select_from(subquery) | |||
.where( | |||
and_( | |||
subquery.c.start_date != subquery.c.end_date, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this is enough on the real system yet
Are the history rows 5ms away from each other or exact like the unit test?
func.lag(union_query.c.end_date) | ||
.over(order_by=union_query.c.version.asc()) | ||
func.coalesce(func.lag(union_query.c.end_date) | ||
.over(order_by=union_query.c.version.asc()), datetime.min.date()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add in a default for start_date, being the min date
@@ -138,7 +138,7 @@ def get_payment_methods_query(statement: StatementModel): | |||
PaymentAccountModel.id, | |||
PaymentAccountModel.payment_method, | |||
PaymentAccountModel.version, | |||
literal(None).label('end_date') | |||
literal(datetime.max.date()).label('end_date') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
default for end_date
@@ -702,11 +702,22 @@ def test_statement_various_payment_methods_history(db, app): | |||
"""Unit test to test various payment methods over the life of a statement.""" | |||
# We aren't using the session fixture here because we want to test the history_cls | |||
# history_cls wont work on scoped session flush. | |||
# Freezegun etc doesn't work here. | |||
changed_column = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not super fun here...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Fixing pay jobs, then local testing |
Issue #:
bcgov/entity#22063
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the sbc-pay license (Apache 2.0).