CanRefund
Magento\Sales\Model\Order\Validation\CanRefund
What it does
This validator checks if a Magento order can have a credit memo (refund) created for it.
Developers use this class to validate refund eligibility by checking the order's state (not in payment review, held, canceled, or closed) and ensuring sufficient paid amount exists for refunding.
It handles edge cases like zero grand total orders and floating-point precision issues in payment calculations.
Public Methods
- validate()