improve callback update status

This commit is contained in:
osaajani 2021-05-26 15:46:50 +02:00
parent eef74f1e9c
commit 3d19c4decb
2 changed files with 11 additions and 3 deletions

View File

@ -1 +1 @@
v3.1.2
v3.1.3

View File

@ -120,14 +120,22 @@ use Monolog\Logger;
return false;
}
//Do not update if current status is delivered or failed
if (\models\Sended::STATUS_DELIVERED === $sended['status'] || \models\Sended::STATUS_FAILED === $sended['status'])
//Do not update if current status is delivered
if (\models\Sended::STATUS_DELIVERED === $sended['status'])
{
$this->logger->info('Callback status update message ignore because status is already ' . $sended['status'] . '.');
return false;
}
//Do not update if current status is failed and new status is unknown
if (\models\Sended::STATUS_FAILED === $sended['status'] && \models\Sended::STATUS_UNKNOWN == $callback_return['status'])
{
$this->logger->info('Callback status update message ignore because status is already ' . $sended['status'] . ' and new status is ' . $callback_return['status'] . '.');
return false;
}
$this->logger->info('Callback status update message with uid ' . $callback_return['uid'] . ' to ' . $callback_return['status'] . '.');
$this->internal_sended->update_status_for_user($this->user['id'], $sended['id'], $callback_return['status']);