TshieldWebhookModel.php 684 B

1234567891011121314151617181920212223242526
  1. <?php
  2. namespace Models;
  3. class TshieldWebhookModel
  4. {
  5. private \PDO $pdo;
  6. public function __construct()
  7. {
  8. if (!isset($GLOBALS['pdo']) || !($GLOBALS['pdo'] instanceof \PDO)) {
  9. throw new \RuntimeException('Database connection not initialized.');
  10. }
  11. $this->pdo = $GLOBALS['pdo'];
  12. }
  13. public function approveByExternalId(string $externalId): bool
  14. {
  15. $stmt = $this->pdo->prepare(
  16. 'UPDATE "user" SET user_kyc = 1 WHERE kyc_external_id = :external_id AND user_flag = \'a\''
  17. );
  18. $stmt->execute(['external_id' => $externalId]);
  19. return $stmt->rowCount() > 0;
  20. }
  21. }