From cb37bf20443ee9d15c0c73c8be3d24a771caa9ec Mon Sep 17 00:00:00 2001 From: Stephen Astels Date: Thu, 9 May 2024 13:56:07 -0400 Subject: [PATCH] deal with SUCCESSFUL pinpoint receipts --- app/celery/process_pinpoint_receipts_tasks.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/celery/process_pinpoint_receipts_tasks.py b/app/celery/process_pinpoint_receipts_tasks.py index 5e9148b2cd..9f4dc0f8ac 100644 --- a/app/celery/process_pinpoint_receipts_tasks.py +++ b/app/celery/process_pinpoint_receipts_tasks.py @@ -53,6 +53,10 @@ def process_pinpoint_results(self, response): provider_response = receipt["messageStatusDescription"] notification_status = determine_pinpoint_status(status, provider_response) + + if notification_status == NOTIFICATION_SENT: + return # we don't want to update the status to sent if it's already sent + if not notification_status: current_app.logger.warning(f"unhandled provider response for reference {reference}, received '{provider_response}'") notification_status = NOTIFICATION_TECHNICAL_FAILURE # revert to tech failure by default @@ -125,6 +129,8 @@ def determine_pinpoint_status(status: str, provider_response: str) -> Union[str, if status == "DELIVERED": return NOTIFICATION_DELIVERED + elif status == "SUCCESSFUL": # carrier has accepted the message but it hasn't gone to the phone yet + return NOTIFICATION_SENT response_lower = provider_response.lower()