From 9ba45e6de8ce095a8173e92ec206c7c05d3b6bcb Mon Sep 17 00:00:00 2001 From: Travis Semple Date: Mon, 9 Sep 2024 13:20:52 -0700 Subject: [PATCH 1/2] only reverse receipt number, if it exists --- jobs/payment-jobs/tasks/eft_task.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jobs/payment-jobs/tasks/eft_task.py b/jobs/payment-jobs/tasks/eft_task.py index f58cb3e78..94d36549b 100644 --- a/jobs/payment-jobs/tasks/eft_task.py +++ b/jobs/payment-jobs/tasks/eft_task.py @@ -323,7 +323,8 @@ def _rollback_receipt_and_invoice(cls, cfs_account: CfsAccountModel, f'not found for invoice id: {invoice.id} - {invoice.invoice_status_code}') is_invoice_refund = invoice.invoice_status_code == InvoiceStatus.REFUND_REQUESTED.value is_reversal = not is_invoice_refund - CFSService.reverse_rs_receipt_in_cfs(cfs_account, receipt_number, ReverseOperation.VOID.value) + if receipt_number: + CFSService.reverse_rs_receipt_in_cfs(cfs_account, receipt_number, ReverseOperation.VOID.value) if is_invoice_refund: cls._handle_invoice_refund(invoice, invoice_reference) else: From 80e0650d00afed0c724282c16481c9fb24574995 Mon Sep 17 00:00:00 2001 From: Travis Semple Date: Mon, 9 Sep 2024 17:06:34 -0700 Subject: [PATCH 2/2] Small fix for statement owing (#1736) --- pay-api/src/pay_api/services/eft_short_names.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pay-api/src/pay_api/services/eft_short_names.py b/pay-api/src/pay_api/services/eft_short_names.py index ec2d5b708..59c48e7b1 100644 --- a/pay-api/src/pay_api/services/eft_short_names.py +++ b/pay-api/src/pay_api/services/eft_short_names.py @@ -627,6 +627,10 @@ def get_statement_summary_query(): InvoiceModel.id == StatementInvoicesModel.invoice_id, InvoiceModel.payment_method_code == PaymentMethod.EFT.value ) + ).filter( + InvoiceModel.invoice_status_code.notin_([InvoiceStatus.CANCELLED.value, + InvoiceStatus.REFUND_REQUESTED.value, + InvoiceStatus.REFUNDED.value]) ).group_by(StatementModel.payment_account_id) @classmethod