Skip to content

Conversation

@vladimir-8
Copy link
Contributor

@vladimir-8 vladimir-8 commented Nov 5, 2025

  • Recalculate order price on task cancellation
  • Introduce 'order:price_updated' event
  • Don't modify manually applied prices
  • Don't apply to foodtech and B2C delivery orders
  • Handle per distance recalculation: Exclude cancelled tasks from a route (distance, duration, polyline)
  • Handle per packages recalculation: Exclude cancelled tasks from the sum of packages and weight
  • Don't assign cancelled tasks to a messenger
  • Display 'order:price_updated' in the order history
Screenshot 2025-11-20 at 15 46 23

@r0xsh r0xsh changed the base branch from feature/540-order-details-incidents to master November 7, 2025 10:15
@vladimir-8 vladimir-8 changed the title Feature: recalculate price on task cancellation Recalculate price on task cancellation Nov 20, 2025
@vladimir-8 vladimir-8 marked this pull request as ready for review November 20, 2025 23:50
taxTotal={event.data.new_tax_total}
/>
</div>
) : null}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the type check should be performed on the TotalPrice component, it'll make OrderHistory.tsx cleaner and TotalPrice more error resilient

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, these type checks are mostly a workaround to avoid TypeScript warnings, because event.data has type data?: Record<string, unknown>;

I think a better solution is to define types for all possible objects inside event.data (one day 😄 )

return;
}

$this->deliveryManager->calculateRoute($delivery);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is prone to throwing :/

  • Minimalist approach: wrap this in a try/catch and notify the user that the price could not be recalculated.
  • The "Yikes" way: I’ll move this into an async worker job for two reasons:
    1. The combined cancel-recalculation + route calculation can be quite long (especially the route calculation).
    2. If calculateRoute throws, I can easily retry the failed job(s).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 238cb77

Base automatically changed from feature/order-history to master November 26, 2025 18:34
@vladimir-8 vladimir-8 requested a review from r0xsh November 27, 2025 03:24
@vladimir-8 vladimir-8 merged commit a33bfd2 into master Nov 27, 2025
8 checks passed
@vladimir-8 vladimir-8 deleted the feature/567-task-cancellation branch November 27, 2025 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make prices in CC reflect non cancelled tasks sum

3 participants