From ccd0eb413c72081c822d8dab03a95bdca8379c0a Mon Sep 17 00:00:00 2001 From: Rodrigo Barraza Date: Mon, 15 Jan 2024 08:48:28 -0800 Subject: [PATCH 01/11] Add NSF handling to payment-reconciliations --- .../reconciliations/payment_reconciliations.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/queue_services/payment-reconciliations/src/reconciliations/payment_reconciliations.py b/queue_services/payment-reconciliations/src/reconciliations/payment_reconciliations.py index 5c5fb0ac4..472a67726 100644 --- a/queue_services/payment-reconciliations/src/reconciliations/payment_reconciliations.py +++ b/queue_services/payment-reconciliations/src/reconciliations/payment_reconciliations.py @@ -45,6 +45,7 @@ from pay_api.models import Receipt as ReceiptModel from pay_api.models import db from pay_api.services.cfs_service import CFSService +from pay_api.services.non_sufficient_funds import NonSufficientFundsService from pay_api.services.payment_transaction import PaymentTransaction as PaymentTransactionService from pay_api.services.queue_publisher import publish from pay_api.utils.enums import ( @@ -448,16 +449,16 @@ def _process_failed_payments(row): # 5. Create invoice reference for the newly created NSF invoice. # 6. Adjust invoice in CFS to include NSF fees. inv_number = _get_row_value(row, Column.TARGET_TXN_NO) - # If there is a FAILED payment record for this; it means it's a duplicate event. Ignore it. - payment: PaymentModel = PaymentModel.find_payment_by_invoice_number_and_status( - inv_number, PaymentStatus.FAILED.value - ) - if payment: + payment_account: PaymentAccountModel = _get_payment_account(row) + + # If there is an NSF invoice with a remaining balance, it means it's a duplicate event. Ignore it. + non_sufficient_funds = NonSufficientFundsService.find_all_non_sufficient_funds_invoices( + account_id=payment_account.auth_account_id) + if non_sufficient_funds.total_amount_remaining > 0: logger.info('Ignoring duplicate NSF message for invoice : %s ', inv_number) return False # Set CFS Account Status. - payment_account: PaymentAccountModel = _get_payment_account(row) cfs_account: CfsAccountModel = CfsAccountModel.find_effective_by_account_id(payment_account.id) is_already_frozen = cfs_account.status == CfsAccountStatus.FREEZE.value logger.info('setting payment account id : %s status as FREEZE', payment_account.id) @@ -734,6 +735,9 @@ def _create_nsf_invoice(cfs_account: CfsAccountModel, inv_number: str, created_by='SYSTEM' ) invoice = invoice.save() + + NonSufficientFundsService.save_non_sufficient_funds(invoice_id=invoice.id, description='NSF') + distribution: DistributionCodeModel = DistributionCodeModel.find_by_active_for_fee_schedule( fee_schedule.fee_schedule_id) From 9ed45e830bdb5f84a43bdb25e2f9f8153b3ad40b Mon Sep 17 00:00:00 2001 From: Rodrigo Barraza Date: Mon, 15 Jan 2024 08:55:16 -0800 Subject: [PATCH 02/11] Flake8 fixes --- .../src/reconciliations/payment_reconciliations.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/queue_services/payment-reconciliations/src/reconciliations/payment_reconciliations.py b/queue_services/payment-reconciliations/src/reconciliations/payment_reconciliations.py index 472a67726..76655ae83 100644 --- a/queue_services/payment-reconciliations/src/reconciliations/payment_reconciliations.py +++ b/queue_services/payment-reconciliations/src/reconciliations/payment_reconciliations.py @@ -450,7 +450,7 @@ def _process_failed_payments(row): # 6. Adjust invoice in CFS to include NSF fees. inv_number = _get_row_value(row, Column.TARGET_TXN_NO) payment_account: PaymentAccountModel = _get_payment_account(row) - + # If there is an NSF invoice with a remaining balance, it means it's a duplicate event. Ignore it. non_sufficient_funds = NonSufficientFundsService.find_all_non_sufficient_funds_invoices( account_id=payment_account.auth_account_id) @@ -735,9 +735,9 @@ def _create_nsf_invoice(cfs_account: CfsAccountModel, inv_number: str, created_by='SYSTEM' ) invoice = invoice.save() - + NonSufficientFundsService.save_non_sufficient_funds(invoice_id=invoice.id, description='NSF') - + distribution: DistributionCodeModel = DistributionCodeModel.find_by_active_for_fee_schedule( fee_schedule.fee_schedule_id) From 9298c19417eed4bd42dc6e8eec0381e5f9090dc1 Mon Sep 17 00:00:00 2001 From: Rodrigo Barraza Date: Mon, 15 Jan 2024 09:03:36 -0800 Subject: [PATCH 03/11] Dictionary object fix --- .../src/reconciliations/payment_reconciliations.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/queue_services/payment-reconciliations/src/reconciliations/payment_reconciliations.py b/queue_services/payment-reconciliations/src/reconciliations/payment_reconciliations.py index 76655ae83..8d0730606 100644 --- a/queue_services/payment-reconciliations/src/reconciliations/payment_reconciliations.py +++ b/queue_services/payment-reconciliations/src/reconciliations/payment_reconciliations.py @@ -454,7 +454,7 @@ def _process_failed_payments(row): # If there is an NSF invoice with a remaining balance, it means it's a duplicate event. Ignore it. non_sufficient_funds = NonSufficientFundsService.find_all_non_sufficient_funds_invoices( account_id=payment_account.auth_account_id) - if non_sufficient_funds.total_amount_remaining > 0: + if non_sufficient_funds['total_amount_remaining'] > 0: logger.info('Ignoring duplicate NSF message for invoice : %s ', inv_number) return False From 70c445d111fd224f9488f77246335f07b9f9efeb Mon Sep 17 00:00:00 2001 From: Rodrigo Barraza Date: Mon, 22 Jan 2024 15:49:32 -0800 Subject: [PATCH 04/11] Cleanup --- .../pay_api/services/non_sufficient_funds.py | 7 ++++--- .../payment_reconciliations.py | 19 ++++++++++--------- .../test_payment_reconciliations.py | 4 ++++ 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/pay-api/src/pay_api/services/non_sufficient_funds.py b/pay-api/src/pay_api/services/non_sufficient_funds.py index 719598fbd..bad1f8ac7 100644 --- a/pay-api/src/pay_api/services/non_sufficient_funds.py +++ b/pay-api/src/pay_api/services/non_sufficient_funds.py @@ -88,6 +88,7 @@ def query_all_non_sufficient_funds_invoices(account_id: str): [(PaymentLineItemModel.description == ReverseOperation.NSF.value, PaymentLineItemModel.total)], else_=0)).label('total_amount')) .join(PaymentAccountModel, PaymentAccountModel.id == InvoiceModel.payment_account_id) + .outerjoin(NonSufficientFundsModel, NonSufficientFundsModel.invoice_id == InvoiceModel.id) .join(PaymentLineItemModel, PaymentLineItemModel.invoice_id == InvoiceModel.id) .filter(PaymentAccountModel.auth_account_id == account_id) ) @@ -111,8 +112,8 @@ def find_all_non_sufficient_funds_invoices(account_id: str): data = { 'total': total, 'invoices': new_invoices, - 'total_amount': float(aggregate_totals.total_amount), - 'total_amount_remaining': float(aggregate_totals.total_amount_remaining), + 'total_amount': float(aggregate_totals.total_amount) if total > 0 else 0, + 'total_amount_remaining': float(aggregate_totals.total_amount_remaining) if total > 0 else 0, 'nsf_amount': float(aggregate_totals.nsf_amount) } @@ -139,7 +140,7 @@ def create_non_sufficient_funds_statement_pdf(account_id: str, **kwargs): 'totalAmount': invoice['total_amount'], 'nsfAmount': invoice['nsf_amount'], 'invoices': invoice['invoices'], - 'invoiceNumber': invoice_reference.invoice_number, + 'invoiceNumber': invoice_reference.invoice_number if hasattr(invoice_reference, 'invoice_number') else None } invoice_pdf_dict = { diff --git a/queue_services/payment-reconciliations/src/reconciliations/payment_reconciliations.py b/queue_services/payment-reconciliations/src/reconciliations/payment_reconciliations.py index 8d0730606..b2a92ae62 100644 --- a/queue_services/payment-reconciliations/src/reconciliations/payment_reconciliations.py +++ b/queue_services/payment-reconciliations/src/reconciliations/payment_reconciliations.py @@ -442,20 +442,21 @@ def _process_partial_paid_invoices(inv_ref: InvoiceReferenceModel, row): def _process_failed_payments(row): """Handle failed payments.""" - # 1. Set the cfs_account status as FREEZE. - # 2. Call cfs api to Stop further PAD on this account. - # 3. Reverse the invoice_reference status to ACTIVE, invoice status to SETTLEMENT_SCHED, and delete receipt. - # 4. Create an NSF invoice for this account. - # 5. Create invoice reference for the newly created NSF invoice. - # 6. Adjust invoice in CFS to include NSF fees. + # 1. Check if there is an NSF record for this account, if there isn't, proceed. + # 2. SET cfs_account status to FREEZE. + # 3. Call CFS API to stop further PAD on this account. + # 4. Reverse the invoice_reference status to ACTIVE, invoice status to SETTLEMENT_SCHED, and delete receipt. + # 5. Create an NSF invoice for this account. + # 6. Create invoice reference for the newly created NSF invoice. + # 7. Adjust invoice in CFS to include NSF fees. inv_number = _get_row_value(row, Column.TARGET_TXN_NO) payment_account: PaymentAccountModel = _get_payment_account(row) - # If there is an NSF invoice with a remaining balance, it means it's a duplicate event. Ignore it. + # If there is an NSF invoice with a remaining nsf_amount balance, it means it's a duplicate NSF event. Ignore it. non_sufficient_funds = NonSufficientFundsService.find_all_non_sufficient_funds_invoices( account_id=payment_account.auth_account_id) - if non_sufficient_funds['total_amount_remaining'] > 0: - logger.info('Ignoring duplicate NSF message for invoice : %s ', inv_number) + if non_sufficient_funds['nsf_amount'] > 0: + logger.info('Ignoring duplicate NSF event for account: %s ', payment_account.auth_account_id) return False # Set CFS Account Status. diff --git a/queue_services/payment-reconciliations/tests/integration/test_payment_reconciliations.py b/queue_services/payment-reconciliations/tests/integration/test_payment_reconciliations.py index 10dff791d..68f49af74 100644 --- a/queue_services/payment-reconciliations/tests/integration/test_payment_reconciliations.py +++ b/queue_services/payment-reconciliations/tests/integration/test_payment_reconciliations.py @@ -28,6 +28,7 @@ from pay_api.models import Payment as PaymentModel from pay_api.models import PaymentAccount as PaymentAccountModel from pay_api.models import Receipt as ReceiptModel +from pay_api.services import NonSufficientFundsService from pay_api.utils.enums import CfsAccountStatus, InvoiceReferenceStatus, InvoiceStatus, PaymentMethod, PaymentStatus from reconciliations.enums import RecordType, SourceTransaction, Status, TargetTransaction @@ -569,6 +570,9 @@ async def test_pad_nsf_reconciliations(session, app, stan_server, event_loop, cl cfs_account: CfsAccountModel = CfsAccountModel.find_effective_by_account_id(pay_account_id) assert cfs_account.status == CfsAccountStatus.FREEZE.value + + non_sufficient_funds: NonSufficientFundsService.find_all_non_sufficient_funds_invoices(pay_account.auth_account_id) + assert non_sufficient_funds['nsf_amount'] > 0 @pytest.mark.asyncio From b6081ab085ccaa6380bc9c3fc5d9b2da09aadcc0 Mon Sep 17 00:00:00 2001 From: Rodrigo Barraza Date: Mon, 22 Jan 2024 17:11:21 -0800 Subject: [PATCH 05/11] Add invoice_number to non_sufficient_funds --- pay-api/src/pay_api/models/non_sufficient_funds.py | 8 ++++++-- pay-api/src/pay_api/services/non_sufficient_funds.py | 5 +++-- pay-api/tests/unit/api/test_non_sufficient_funds.py | 5 +++-- pay-api/tests/unit/models/test_non_sufficient_funds.py | 8 +++++--- pay-api/tests/unit/services/test_non_sufficient_funds.py | 8 +++++--- pay-api/tests/utilities/base_test.py | 4 ++-- 6 files changed, 24 insertions(+), 14 deletions(-) diff --git a/pay-api/src/pay_api/models/non_sufficient_funds.py b/pay-api/src/pay_api/models/non_sufficient_funds.py index d4a71abfc..d9bd62ecd 100644 --- a/pay-api/src/pay_api/models/non_sufficient_funds.py +++ b/pay-api/src/pay_api/models/non_sufficient_funds.py @@ -40,12 +40,14 @@ class NonSufficientFundsModel(BaseModel): # pylint: disable=too-many-instance-a 'id', 'description', 'invoice_id', + 'invoice_number' ] } id = db.Column(db.Integer, primary_key=True, autoincrement=True) description = db.Column(db.String(50), nullable=True) invoice_id = db.Column(db.Integer, ForeignKey('invoices.id'), nullable=False) + invoice_number = db.Column(db.String(50), nullable=True, index=True, comment='CFS Invoice number') @define @@ -53,8 +55,9 @@ class NonSufficientFundsSchema: # pylint: disable=too-few-public-methods """Used to search for NSF records.""" id: int - invoice_id: int description: str + invoice_id: int + invoice_number: str @classmethod def from_row(cls, row: NonSufficientFundsModel): @@ -62,4 +65,5 @@ def from_row(cls, row: NonSufficientFundsModel): https://www.attrs.org/en/stable/init.html """ - return cls(id=row.id, invoice_id=row.invoice_id, description=row.description) + return cls(id=row.id, invoice_id=row.invoice_id, invoice_number=row.invoice_number, + description=row.description) diff --git a/pay-api/src/pay_api/services/non_sufficient_funds.py b/pay-api/src/pay_api/services/non_sufficient_funds.py index bad1f8ac7..4df5ad6d0 100644 --- a/pay-api/src/pay_api/services/non_sufficient_funds.py +++ b/pay-api/src/pay_api/services/non_sufficient_funds.py @@ -53,13 +53,14 @@ def populate(value: NonSufficientFundsModel): return non_sufficient_funds_service @staticmethod - def save_non_sufficient_funds(invoice_id: int, description: str) -> NonSufficientFundsService: + def save_non_sufficient_funds(invoice_id: int, invoice_number: str, description: str) -> NonSufficientFundsService: """Create Non-Sufficient Funds record.""" current_app.logger.debug(' Date: Mon, 22 Jan 2024 17:26:11 -0800 Subject: [PATCH 06/11] Migration script --- .../versions/2024_01_22_fccdab259e05_.py | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 pay-api/migrations/versions/2024_01_22_fccdab259e05_.py diff --git a/pay-api/migrations/versions/2024_01_22_fccdab259e05_.py b/pay-api/migrations/versions/2024_01_22_fccdab259e05_.py new file mode 100644 index 000000000..962a51176 --- /dev/null +++ b/pay-api/migrations/versions/2024_01_22_fccdab259e05_.py @@ -0,0 +1,27 @@ +"""Adding invoice_number column to non_sufficient_funds table + +Revision ID: fccdab259e05 +Revises: b65365f7852b +Create Date: 2024-01-22 17:13:44.797905 + +""" +from alembic import op +import sqlalchemy as sa +from sqlalchemy.dialects import postgresql + +# revision identifiers, used by Alembic. +revision = 'fccdab259e05' +down_revision = 'b65365f7852b' +branch_labels = None +depends_on = None + + +def upgrade(): + op.add_column('non_sufficient_funds', sa.Column( + 'invoice_number', sa.String(length=50), nullable=True, comment='CFS Invoice number')) + op.create_index(op.f('ix_non_sufficient_funds_invoice_number'), 'non_sufficient_funds', ['invoice_number'], unique=False) + + +def downgrade(): + op.drop_index(op.f('ix_non_sufficient_funds_invoice_number'), table_name='non_sufficient_funds') + op.drop_column('non_sufficient_funds', 'invoice_number') From 1a38522323df295ed39bfd3a66048ca1e71f2a45 Mon Sep 17 00:00:00 2001 From: Rodrigo Barraza Date: Tue, 23 Jan 2024 07:56:37 -0800 Subject: [PATCH 07/11] Test fix --- .../tests/integration/test_payment_reconciliations.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/queue_services/payment-reconciliations/tests/integration/test_payment_reconciliations.py b/queue_services/payment-reconciliations/tests/integration/test_payment_reconciliations.py index 68f49af74..10dff791d 100644 --- a/queue_services/payment-reconciliations/tests/integration/test_payment_reconciliations.py +++ b/queue_services/payment-reconciliations/tests/integration/test_payment_reconciliations.py @@ -28,7 +28,6 @@ from pay_api.models import Payment as PaymentModel from pay_api.models import PaymentAccount as PaymentAccountModel from pay_api.models import Receipt as ReceiptModel -from pay_api.services import NonSufficientFundsService from pay_api.utils.enums import CfsAccountStatus, InvoiceReferenceStatus, InvoiceStatus, PaymentMethod, PaymentStatus from reconciliations.enums import RecordType, SourceTransaction, Status, TargetTransaction @@ -570,9 +569,6 @@ async def test_pad_nsf_reconciliations(session, app, stan_server, event_loop, cl cfs_account: CfsAccountModel = CfsAccountModel.find_effective_by_account_id(pay_account_id) assert cfs_account.status == CfsAccountStatus.FREEZE.value - - non_sufficient_funds: NonSufficientFundsService.find_all_non_sufficient_funds_invoices(pay_account.auth_account_id) - assert non_sufficient_funds['nsf_amount'] > 0 @pytest.mark.asyncio From 7c3724bf2b70c9fb8bf8314bc5ccde67b00e9214 Mon Sep 17 00:00:00 2001 From: Rodrigo Barraza Date: Tue, 23 Jan 2024 08:05:42 -0800 Subject: [PATCH 08/11] Assertion fix --- pay-api/tests/unit/models/test_non_sufficient_funds.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pay-api/tests/unit/models/test_non_sufficient_funds.py b/pay-api/tests/unit/models/test_non_sufficient_funds.py index 5d98c2bf8..8f88ce59f 100644 --- a/pay-api/tests/unit/models/test_non_sufficient_funds.py +++ b/pay-api/tests/unit/models/test_non_sufficient_funds.py @@ -36,4 +36,4 @@ def test_non_sufficient_funds(session): assert non_sufficient_funds.id is not None assert non_sufficient_funds.description == 'NSF' assert non_sufficient_funds.invoice_id is not None - assert non_sufficient_funds.invoice_number == '1234' + assert non_sufficient_funds.invoice_number == 'REG00000001' From e408dd5982db13d6fd40b062f56fc000f6507281 Mon Sep 17 00:00:00 2001 From: Rodrigo Barraza Date: Tue, 23 Jan 2024 08:31:37 -0800 Subject: [PATCH 09/11] Updating requirements.txt --- queue_services/payment-reconciliations/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/queue_services/payment-reconciliations/requirements.txt b/queue_services/payment-reconciliations/requirements.txt index ee2bb3ff2..5a6e456c2 100644 --- a/queue_services/payment-reconciliations/requirements.txt +++ b/queue_services/payment-reconciliations/requirements.txt @@ -1,6 +1,6 @@ -e git+https://github.com/bcgov/lear.git@30dba30463c99aaedfdcfd463213e71ba0d35b51#egg=entity_queue_common&subdirectory=queue_services/common -e git+https://github.com/bcgov/sbc-common-components.git@b93585ea3ac273b9e51c4dd5ddbc8190fd95da6a#egg=sbc_common_components&subdirectory=python --e git+https://github.com/bcgov/sbc-pay.git@a598989a6de74206ab26024d037d0128919e540e#egg=pay_api&subdirectory=pay-api +-e git+https://github.com/bcgov/sbc-pay.git@49bfe45bbf5b55187b5fc438098cd5dad80c5edb#egg=pay_api&subdirectory=pay-api Flask-Caching==2.0.2 Flask-Migrate==2.7.0 Flask-Moment==1.0.5 From 95153edb96e10e05aa0d2fe8ebfc4b72bea8d010 Mon Sep 17 00:00:00 2001 From: Rodrigo Barraza Date: Tue, 23 Jan 2024 11:06:56 -0800 Subject: [PATCH 10/11] PR feedback --- pay-api/src/pay_api/services/non_sufficient_funds.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pay-api/src/pay_api/services/non_sufficient_funds.py b/pay-api/src/pay_api/services/non_sufficient_funds.py index 4df5ad6d0..9d3a3981f 100644 --- a/pay-api/src/pay_api/services/non_sufficient_funds.py +++ b/pay-api/src/pay_api/services/non_sufficient_funds.py @@ -113,8 +113,8 @@ def find_all_non_sufficient_funds_invoices(account_id: str): data = { 'total': total, 'invoices': new_invoices, - 'total_amount': float(aggregate_totals.total_amount) if total > 0 else 0, - 'total_amount_remaining': float(aggregate_totals.total_amount_remaining) if total > 0 else 0, + 'total_amount': float(aggregate_totals.total_amount or 0), + 'total_amount_remaining': float(aggregate_totals.total_amount_remaining or 0), 'nsf_amount': float(aggregate_totals.nsf_amount) } @@ -141,7 +141,7 @@ def create_non_sufficient_funds_statement_pdf(account_id: str, **kwargs): 'totalAmount': invoice['total_amount'], 'nsfAmount': invoice['nsf_amount'], 'invoices': invoice['invoices'], - 'invoiceNumber': invoice_reference.invoice_number if hasattr(invoice_reference, 'invoice_number') else None + 'invoiceNumber': getattr(invoice_reference, 'invoice_number', None) } invoice_pdf_dict = { From 09388cb07de286cdabb89732146fa82dc8d60618 Mon Sep 17 00:00:00 2001 From: Rodrigo Barraza Date: Tue, 23 Jan 2024 11:42:12 -0800 Subject: [PATCH 11/11] Remove nullable from invoice_number in NSF --- pay-api/migrations/versions/2024_01_22_fccdab259e05_.py | 2 +- pay-api/src/pay_api/models/non_sufficient_funds.py | 2 +- .../src/reconciliations/payment_reconciliations.py | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pay-api/migrations/versions/2024_01_22_fccdab259e05_.py b/pay-api/migrations/versions/2024_01_22_fccdab259e05_.py index 962a51176..6d67b9eb2 100644 --- a/pay-api/migrations/versions/2024_01_22_fccdab259e05_.py +++ b/pay-api/migrations/versions/2024_01_22_fccdab259e05_.py @@ -18,7 +18,7 @@ def upgrade(): op.add_column('non_sufficient_funds', sa.Column( - 'invoice_number', sa.String(length=50), nullable=True, comment='CFS Invoice number')) + 'invoice_number', sa.String(length=50), comment='CFS Invoice number')) op.create_index(op.f('ix_non_sufficient_funds_invoice_number'), 'non_sufficient_funds', ['invoice_number'], unique=False) diff --git a/pay-api/src/pay_api/models/non_sufficient_funds.py b/pay-api/src/pay_api/models/non_sufficient_funds.py index d9bd62ecd..16bfed190 100644 --- a/pay-api/src/pay_api/models/non_sufficient_funds.py +++ b/pay-api/src/pay_api/models/non_sufficient_funds.py @@ -47,7 +47,7 @@ class NonSufficientFundsModel(BaseModel): # pylint: disable=too-many-instance-a id = db.Column(db.Integer, primary_key=True, autoincrement=True) description = db.Column(db.String(50), nullable=True) invoice_id = db.Column(db.Integer, ForeignKey('invoices.id'), nullable=False) - invoice_number = db.Column(db.String(50), nullable=True, index=True, comment='CFS Invoice number') + invoice_number = db.Column(db.String(50), nullable=False, index=True, comment='CFS Invoice number') @define diff --git a/queue_services/payment-reconciliations/src/reconciliations/payment_reconciliations.py b/queue_services/payment-reconciliations/src/reconciliations/payment_reconciliations.py index b2a92ae62..856135436 100644 --- a/queue_services/payment-reconciliations/src/reconciliations/payment_reconciliations.py +++ b/queue_services/payment-reconciliations/src/reconciliations/payment_reconciliations.py @@ -737,7 +737,8 @@ def _create_nsf_invoice(cfs_account: CfsAccountModel, inv_number: str, ) invoice = invoice.save() - NonSufficientFundsService.save_non_sufficient_funds(invoice_id=invoice.id, description='NSF') + NonSufficientFundsService.save_non_sufficient_funds(invoice_id=invoice.id, invoice_number=inv_number, + description='NSF') distribution: DistributionCodeModel = DistributionCodeModel.find_by_active_for_fee_schedule( fee_schedule.fee_schedule_id)