turnstile

Drupal paywall plugin
Log | Files | Refs | README | LICENSE

TalerBackendErrorKind.php (1119B)


      1 <?php
      2 
      3 /**
      4  * @file
      5  * Location: src/TalerBackendErrorKind.php
      6  *
      7  * Coarse classification of merchant-backend call outcomes. Used by
      8  * TalerBackendResult to let callers render a precise user-facing
      9  * message and decide whether to retry, refuse, or fall back.
     10  */
     11 
     12 namespace Drupal\taler_turnstile;
     13 
     14 enum TalerBackendErrorKind: string {
     15 
     16   /** Request succeeded (HTTP 2xx). */
     17   case OK = 'ok';
     18 
     19   /** Backend URL or access token not configured at all. */
     20   case NOT_CONFIGURED = 'not_configured';
     21 
     22   /**
     23    * No HTTP response was received: DNS, ECONNREFUSED, TLS error,
     24    * timeout, etc. The transport field carries the underlying message.
     25    */
     26   case UNREACHABLE = 'unreachable';
     27 
     28   /** HTTP 401 or 403 from the backend. */
     29   case AUTH_FAILED = 'auth_failed';
     30 
     31   /** HTTP 404 from the backend (instance/order/template unknown). */
     32   case NOT_FOUND = 'not_found';
     33 
     34   /** HTTP 5xx from the backend. */
     35   case SERVER_ERROR = 'server_error';
     36 
     37   /**
     38    * Anything else: unexpected HTTP status, malformed JSON, missing
     39    * required fields, wrong /config "name", etc.
     40    */
     41   case PROTOCOL_ERROR = 'protocol_error';
     42 
     43 }