Skip to content

Commit

Permalink
Fix 404 error on verify created direct_pay invoice (#1741)
Browse files Browse the repository at this point in the history
  • Loading branch information
seeker25 authored Sep 11, 2024
2 parents 80e0650 + 88306f1 commit e7cac81
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions jobs/payment-jobs/tasks/stale_payment_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from pay_api.services import PaymentService, TransactionService
from pay_api.services.direct_pay_service import DirectPayService
from pay_api.utils.enums import InvoiceReferenceStatus, PaymentStatus, TransactionStatus
from requests import HTTPError


STATUS_PAID = ('PAID', 'CMPLT')
Expand Down Expand Up @@ -113,5 +114,8 @@ def _verify_created_direct_pay_invoices(cls):
# check existing payment status in PayBC and save receipt
TransactionService.update_transaction(transaction.id, pay_response_url=None)

except Exception as err: # NOQA # pylint: disable=broad-except
current_app.logger.error(err, exc_info=True)
except HTTPError as http_err:
if http_err.response is not None and http_err.response.status_code == 404:
current_app.logger.info(f'Invoice not found (404). Skipping invoice id: {invoice.id}')
continue
current_app.logger.error(f'Error verifying invoice {invoice.id}: {http_err}', exc_info=True)

0 comments on commit e7cac81

Please sign in to comment.