Skip to content

Incorrect order completion trigger #1170

@Ahmed-Ghanam

Description

@Ahmed-Ghanam

Description

When a new delivery report arrives from Azure Communication Services or Link Mobility, the Notifications API retrieves the identifier of the order associated with the corresponding Email or SMS notification. It then checks the status of all related Email and SMS notifications.

If all Email and SMS notifications appear to have reached a final state, the API updates the corresponding order’s status to a final state (e.g., Completed).

However, the current logic can stop triggering this cycle on certain non-final statuses:

  • SMS notifications with status Accepted
  • Email notifications with status Succeeded

These states should not trigger the order completion cycle, as they do not represent a true delivery completion or failure.

Additionally, the logic that evaluates whether an order can be marked as completed currently executes within the delivery report handling flow. This coupling makes the delivery report processing unnecessarily heavy and could be improved by moving the completion check into a background service.

Proposed Solution

  1. Adjust completion logic
  2. Refactor processing flow if needed.

Acceptance Criteria

  • Non-final statuses Succeeded and Accepted does not trigger the order completion cycle.
  • Delivery report processing runs independently from order completion evaluation (if needed).

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueIssues that are easy to fix for new team members or external contributors (org-wide)

    Projects

    Status

    🌥 Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions