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

Strip the error messages, so we dont bloat our database with empty fi… #1747

Merged
merged 1 commit into from
Sep 13, 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
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ def _query_order_status(cls, invoice: Invoice):
@classmethod
def _refund_error(cls, status: OrderStatus, invoice: Invoice):
"""Log error for rejected GL status."""
current_app.logger.error(f'Refund error - Invoice: {invoice.id} - detected RJCT on refund, contact PAYBC.')
current_app.logger.error(f'Refund error - Invoice: {invoice.id} - detected RJCT/DECLINED on refund,'
"contact PAYBC if it's RJCT.")
errors = ' '.join([refund_data.refundglerrormessage.strip() for revenue_line in status.revenue
for refund_data in revenue_line.refund_data])[:250]
current_app.logger.error(f'Refund error - Invoice: {invoice.id} - glerrormessage: {errors}')
Expand Down
12 changes: 6 additions & 6 deletions pay-queue/src/pay_queue/services/cgi_reconciliations.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def _process_ejv_feedback(group_batches) -> bool: # pylint:disable=too-many-loc
return_code = line[7:11]
return_message = line[11:161]
ejv_file.disbursement_status_code = _get_disbursement_status(return_code)
ejv_file.message = return_message
ejv_file.message = return_message.strip()
if ejv_file.disbursement_status_code == DisbursementStatus.ERRORED.value:
has_errors = True
elif is_jv_header:
Expand All @@ -129,7 +129,7 @@ def _process_ejv_feedback(group_batches) -> bool: # pylint:disable=too-many-loc
ejv_header_return_code = line[271:275]
ejv_header.disbursement_status_code = _get_disbursement_status(ejv_header_return_code)
ejv_header_error_message = line[275:425]
ejv_header.message = ejv_header_error_message
ejv_header.message = ejv_header_error_message.strip()
if ejv_header.disbursement_status_code == DisbursementStatus.ERRORED.value:
has_errors = True
# Create a payment record if its a gov account payment.
Expand Down Expand Up @@ -165,7 +165,7 @@ def _process_jv_details_feedback(ejv_file, has_errors, line, receipt_number): #
if line[104:105] == 'C' and ejv_file.file_type == EjvFileType.DISBURSEMENT.value:
disbursement_status = _get_disbursement_status(invoice_return_code)
invoice_link.disbursement_status_code = disbursement_status
invoice_link.message = invoice_return_message
invoice_link.message = invoice_return_message.strip()
current_app.logger.info('disbursement_status %s', disbursement_status)
if disbursement_status == DisbursementStatus.ERRORED.value:
has_errors = True
Expand All @@ -186,7 +186,7 @@ def _process_jv_details_feedback(ejv_file, has_errors, line, receipt_number): #
# This is for gov account payment JV.
invoice_link.disbursement_status_code = _get_disbursement_status(invoice_return_code)

invoice_link.message = invoice_return_message
invoice_link.message = invoice_return_message.strip()
current_app.logger.info('Invoice ID %s', invoice_id)
inv_ref: InvoiceReferenceModel = InvoiceReferenceModel.find_by_invoice_id_and_status(
invoice_id, InvoiceReferenceStatus.ACTIVE.value)
Expand Down Expand Up @@ -332,7 +332,7 @@ def _process_ap_feedback(group_batches) -> bool: # pylint:disable=too-many-loca
return_code = line[7:11]
return_message = line[11:161]
ejv_file.disbursement_status_code = _get_disbursement_status(return_code)
ejv_file.message = return_message
ejv_file.message = return_message.strip()
if ejv_file.disbursement_status_code == DisbursementStatus.ERRORED.value:
has_errors = True
elif is_ap_header:
Expand Down Expand Up @@ -384,7 +384,7 @@ def _process_ap_header_non_gov_disbursement(line, ejv_file: EjvFileModel) -> boo
.filter(EjvLinkModel.link_type == EJVLinkType.INVOICE.value) \
.one_or_none()
invoice_link.disbursement_status_code = disbursement_status
invoice_link.message = ap_header_error_message
invoice_link.message = ap_header_error_message.strip()
if disbursement_status == DisbursementStatus.ERRORED.value:
invoice.disbursement_status_code = disbursement_status
has_errors = True
Expand Down
Loading