|
|
@@ -61,6 +61,16 @@ class WooviWebhookController
|
|
|
return ResponseLib::sendFail('Pagamento não encontrado', ['correlation_id' => $correlationId], 'E_NOT_FOUND')->withStatus(404);
|
|
|
}
|
|
|
|
|
|
+ if ((int)($payment['status_id'] ?? 0) !== PaymentModel::STATUS_PENDING) {
|
|
|
+ return ResponseLib::sendOk([
|
|
|
+ 'payment_id' => (int)$payment['payment_id'],
|
|
|
+ 'correlation_id' => $correlationId,
|
|
|
+ 'status' => $status,
|
|
|
+ 'status_id' => (int)($payment['status_id'] ?? 0),
|
|
|
+ 'updated' => false,
|
|
|
+ ], 'S_PAYMENT_ALREADY_UPDATED');
|
|
|
+ }
|
|
|
+
|
|
|
try {
|
|
|
$this->paymentModel->updateStatusId((int)$payment['payment_id'], 1);
|
|
|
} catch (\Throwable $e) {
|
|
|
@@ -79,6 +89,6 @@ class WooviWebhookController
|
|
|
private function isPaidStatus(string $status): bool
|
|
|
{
|
|
|
$normalized = strtoupper(trim($status));
|
|
|
- return in_array($normalized, ['PAID', 'COMPLETED', 'CONFIRMED', 'APPROVED'], true);
|
|
|
+ return in_array($normalized, ['PAID', 'COMPLETED'], true);
|
|
|
}
|
|
|
}
|