diff --git a/src/QUI/ERP/Order/AbstractOrder.php b/src/QUI/ERP/Order/AbstractOrder.php index 9d80675b2c53da6b62d1d2d6efd2c164e996e06d..93f6afaa1cbe7da93fbd9d0dcb9905d038ffc334 100644 --- a/src/QUI/ERP/Order/AbstractOrder.php +++ b/src/QUI/ERP/Order/AbstractOrder.php @@ -1695,6 +1695,15 @@ public function addTransaction(Transaction $Transaction): void ] ); + /* + * If the paid status was erroneous and a new transaction is added to the order, + * we have to change the status to open because otherwise the payment status + * would not be set to "successful" by the calculation service. + */ + if ($this->getAttribute('paid_status') === QUI\ERP\Constants::PAYMENT_STATUS_ERROR) { + $this->setAttribute('paid_status', QUI\ERP\Constants::PAYMENT_STATUS_OPEN); + } + $this->calculatePayments(); QUI::getEvents()->fireEvent(