File: /var/www/vhosts/uyarreklam.com.tr/httpdocs/Exceptions.tar
InvalidCartException.php 0000644 00000002747 15155617276 0011365 0 ustar 00 <?php
namespace Automattic\WooCommerce\StoreApi\Exceptions;
use WP_Error;
/**
* InvalidCartException class.
*
* @internal This exception is thrown if the cart is in an erroneous state.
*/
class InvalidCartException extends \Exception {
/**
* Sanitized error code.
*
* @var string
*/
public $error_code;
/**
* Additional error data.
*
* @var array
*/
public $additional_data = [];
/**
* All errors to display to the user.
*
* @var WP_Error
*/
public $error;
/**
* Setup exception.
*
* @param string $error_code Machine-readable error code, e.g `woocommerce_invalid_product_id`.
* @param WP_Error $error The WP_Error object containing all errors relating to stock availability.
* @param array $additional_data Extra data (key value pairs) to expose in the error response.
*/
public function __construct( $error_code, WP_Error $error, $additional_data = [] ) {
$this->error_code = $error_code;
$this->error = $error;
$this->additional_data = array_filter( (array) $additional_data );
parent::__construct( '', 409 );
}
/**
* Returns the error code.
*
* @return string
*/
public function getErrorCode() {
return $this->error_code;
}
/**
* Returns the list of messages.
*
* @return WP_Error
*/
public function getError() {
return $this->error;
}
/**
* Returns additional error data.
*
* @return array
*/
public function getAdditionalData() {
return $this->additional_data;
}
}
InvalidStockLevelsInCartException.php 0000644 00000003041 15155617277 0014020 0 ustar 00 <?php
namespace Automattic\WooCommerce\StoreApi\Exceptions;
use WP_Error;
/**
* InvalidStockLevelsInCartException class.
*
* This exception is thrown if any items are out of stock after each product on a draft order has been stock checked.
*/
class InvalidStockLevelsInCartException extends \Exception {
/**
* Sanitized error code.
*
* @var string
*/
public $error_code;
/**
* Additional error data.
*
* @var array
*/
public $additional_data = [];
/**
* All errors to display to the user.
*
* @var WP_Error
*/
public $error;
/**
* Setup exception.
*
* @param string $error_code Machine-readable error code, e.g `woocommerce_invalid_product_id`.
* @param WP_Error $error The WP_Error object containing all errors relating to stock availability.
* @param array $additional_data Extra data (key value pairs) to expose in the error response.
*/
public function __construct( $error_code, $error, $additional_data = [] ) {
$this->error_code = $error_code;
$this->error = $error;
$this->additional_data = array_filter( (array) $additional_data );
parent::__construct( '', 409 );
}
/**
* Returns the error code.
*
* @return string
*/
public function getErrorCode() {
return $this->error_code;
}
/**
* Returns the list of messages.
*
* @return WP_Error
*/
public function getError() {
return $this->error;
}
/**
* Returns additional error data.
*
* @return array
*/
public function getAdditionalData() {
return $this->additional_data;
}
}
NotPurchasableException.php 0000644 00000000400 15155617277 0012060 0 ustar 00 <?php
namespace Automattic\WooCommerce\StoreApi\Exceptions;
/**
* NotPurchasableException class.
*
* This exception is thrown when an item in the cart is not able to be purchased.
*/
class NotPurchasableException extends StockAvailabilityException {}
OutOfStockException.php 0000644 00000000374 15155617277 0011220 0 ustar 00 <?php
namespace Automattic\WooCommerce\StoreApi\Exceptions;
/**
* OutOfStockException class.
*
* This exception is thrown when an item in a draft order is out of stock completely.
*/
class OutOfStockException extends StockAvailabilityException {}
PartialOutOfStockException.php 0000644 00000000446 15155617277 0012535 0 ustar 00 <?php
namespace Automattic\WooCommerce\StoreApi\Exceptions;
/**
* PartialOutOfStockException class.
*
* This exception is thrown when an item in a draft order has a quantity greater than what is available in stock.
*/
class PartialOutOfStockException extends StockAvailabilityException {}
RouteException.php 0000644 00000002371 15155617277 0010255 0 ustar 00 <?php
namespace Automattic\WooCommerce\StoreApi\Exceptions;
/**
* RouteException class.
*/
class RouteException extends \Exception {
/**
* Sanitized error code.
*
* @var string
*/
public $error_code;
/**
* Additional error data.
*
* @var array
*/
public $additional_data = [];
/**
* Setup exception.
*
* @param string $error_code Machine-readable error code, e.g `woocommerce_invalid_product_id`.
* @param string $message User-friendly translated error message, e.g. 'Product ID is invalid'.
* @param int $http_status_code Proper HTTP status code to respond with, e.g. 400.
* @param array $additional_data Extra data (key value pairs) to expose in the error response.
*/
public function __construct( $error_code, $message, $http_status_code = 400, $additional_data = [] ) {
$this->error_code = $error_code;
$this->additional_data = array_filter( (array) $additional_data );
parent::__construct( $message, $http_status_code );
}
/**
* Returns the error code.
*
* @return string
*/
public function getErrorCode() {
return $this->error_code;
}
/**
* Returns additional error data.
*
* @return array
*/
public function getAdditionalData() {
return $this->additional_data;
}
}
StockAvailabilityException.php 0000644 00000003044 15155617277 0012573 0 ustar 00 <?php
namespace Automattic\WooCommerce\StoreApi\Exceptions;
/**
* StockAvailabilityException class.
*
* This exception is thrown when more than one of a product that can only be purchased individually is in a cart.
*/
class StockAvailabilityException extends \Exception {
/**
* Sanitized error code.
*
* @var string
*/
public $error_code;
/**
* The name of the product that can only be purchased individually.
*
* @var string
*/
public $product_name;
/**
* Additional error data.
*
* @var array
*/
public $additional_data = [];
/**
* Setup exception.
*
* @param string $error_code Machine-readable error code, e.g `woocommerce_invalid_product_id`.
* @param string $product_name The name of the product that can only be purchased individually.
* @param array $additional_data Extra data (key value pairs) to expose in the error response.
*/
public function __construct( $error_code, $product_name, $additional_data = [] ) {
$this->error_code = $error_code;
$this->product_name = $product_name;
$this->additional_data = array_filter( (array) $additional_data );
parent::__construct();
}
/**
* Returns the error code.
*
* @return string
*/
public function getErrorCode() {
return $this->error_code;
}
/**
* Returns additional error data.
*
* @return array
*/
public function getAdditionalData() {
return $this->additional_data;
}
/**
* Returns the product name.
*
* @return string
*/
public function getProductName() {
return $this->product_name;
}
}
TooManyInCartException.php 0000644 00000000436 15155617300 0011631 0 ustar 00 <?php
namespace Automattic\WooCommerce\StoreApi\Exceptions;
/**
* TooManyInCartException class.
*
* This exception is thrown when more than one of a product that can only be purchased individually is in a cart.
*/
class TooManyInCartException extends StockAvailabilityException {}