class-wc-rest-wccom-site-installer-errors.php
74 lines
| 1 | <?php |
| 2 | /** |
| 3 | * WCCOM Site Installer Errors Class |
| 4 | * |
| 5 | * @package WooCommerce\WCCom\API |
| 6 | * @since 3.9.0 |
| 7 | */ |
| 8 | |
| 9 | defined( 'ABSPATH' ) || exit; |
| 10 | |
| 11 | /** |
| 12 | * WCCOM Site Installer Errors Class |
| 13 | * |
| 14 | * Stores data for errors, returned by installer API. |
| 15 | */ |
| 16 | class WC_REST_WCCOM_Site_Installer_Errors { |
| 17 | |
| 18 | /** |
| 19 | * Not unauthenticated generic error |
| 20 | */ |
| 21 | const NOT_AUTHENTICATED_CODE = 'not_authenticated'; |
| 22 | const NOT_AUTHENTICATED_MESSAGE = 'Authentication required'; |
| 23 | const NOT_AUTHENTICATED_HTTP_CODE = 401; |
| 24 | |
| 25 | /** |
| 26 | * No access token provided |
| 27 | */ |
| 28 | const NO_ACCESS_TOKEN_CODE = 'no_access_token'; |
| 29 | const NO_ACCESS_TOKEN_MESSAGE = 'No access token provided'; |
| 30 | const NO_ACCESS_TOKEN_HTTP_CODE = 400; |
| 31 | |
| 32 | /** |
| 33 | * No signature provided |
| 34 | */ |
| 35 | const NO_SIGNATURE_CODE = 'no_signature'; |
| 36 | const NO_SIGNATURE_MESSAGE = 'No signature provided'; |
| 37 | const NO_SIGNATURE_HTTP_CODE = 400; |
| 38 | |
| 39 | /** |
| 40 | * Site not connected to WooCommerce.com |
| 41 | */ |
| 42 | const SITE_NOT_CONNECTED_CODE = 'site_not_connnected'; |
| 43 | const SITE_NOT_CONNECTED_MESSAGE = 'Site not connected to WooCommerce.com'; |
| 44 | const SITE_NOT_CONNECTED_HTTP_CODE = 401; |
| 45 | |
| 46 | /** |
| 47 | * Provided access token is not valid |
| 48 | */ |
| 49 | const INVALID_TOKEN_CODE = 'invalid_token'; |
| 50 | const INVALID_TOKEN_MESSAGE = 'Invalid access token provided'; |
| 51 | const INVALID_TOKEN_HTTP_CODE = 401; |
| 52 | |
| 53 | /** |
| 54 | * Request verification by provided signature failed |
| 55 | */ |
| 56 | const REQUEST_VERIFICATION_FAILED_CODE = 'request_verification_failed'; |
| 57 | const REQUEST_VERIFICATION_FAILED_MESSAGE = 'Request verification by signature failed'; |
| 58 | const REQUEST_VERIFICATION_FAILED_HTTP_CODE = 400; |
| 59 | |
| 60 | /** |
| 61 | * User doesn't exist |
| 62 | */ |
| 63 | const USER_NOT_FOUND_CODE = 'user_not_found'; |
| 64 | const USER_NOT_FOUND_MESSAGE = 'Token owning user not found'; |
| 65 | const USER_NOT_FOUND_HTTP_CODE = 401; |
| 66 | |
| 67 | /** |
| 68 | * No permissions error |
| 69 | */ |
| 70 | const NO_PERMISSION_CODE = 'forbidden'; |
| 71 | const NO_PERMISSION_MESSAGE = 'You do not have permission to install plugin or theme'; |
| 72 | const NO_PERMISSION_HTTP_CODE = 403; |
| 73 | } |
| 74 |