Initial xentral_oss_20.3.c9ffacf
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Modules\Dhl\Exception;
|
||||
|
||||
class ContentsDataException extends DhlBaseException
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Modules\Dhl\Exception;
|
||||
|
||||
class DhlBaseException extends \RuntimeException implements DhlExceptionInterface
|
||||
{
|
||||
public static function fromDhlStatusCode($code, $message)
|
||||
{
|
||||
switch ($code){
|
||||
case 118: return new InvalidCredentialsException($message);
|
||||
case 1101: return new InvalidRequestDataException($message);
|
||||
}
|
||||
return new DhlBaseException($message);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Xentral\Modules\Dhl\Exception;
|
||||
|
||||
|
||||
use Xentral\Core\Exception\ModuleExceptionInterface;
|
||||
|
||||
interface DhlExceptionInterface extends ModuleExceptionInterface
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Modules\Dhl\Exception;
|
||||
|
||||
use Throwable;
|
||||
|
||||
class InsufficientPermissionsException extends DhlBaseException
|
||||
{
|
||||
public function __construct($message = "Unzureichende Rechte", $code = 0, Throwable $previous = null)
|
||||
{
|
||||
parent::__construct($message, $code, $previous);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Modules\Dhl\Exception;
|
||||
|
||||
use Throwable;
|
||||
|
||||
class InvalidCredentialsException extends DhlBaseException
|
||||
{
|
||||
public function __construct($message, $code = 0, Throwable $previous = null)
|
||||
{
|
||||
parent::__construct("Fehlerhafte Zugangsdaten ({$message})", $code, $previous);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Modules\Dhl\Exception;
|
||||
|
||||
class InvalidRequestDataException extends DhlBaseException
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Modules\Dhl\Exception;
|
||||
|
||||
use Throwable;
|
||||
|
||||
class UnknownProductException extends DhlBaseException
|
||||
{
|
||||
public function __construct($message = "Falsch konfiguriertes Produkt", $code = 0, Throwable $previous = null)
|
||||
{
|
||||
parent::__construct($message, $code, $previous);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Modules\Dhl\Exception;
|
||||
|
||||
use Throwable;
|
||||
|
||||
class UnknownProductTypeException extends DhlBaseException
|
||||
{
|
||||
|
||||
static public function fromValid($validValues){
|
||||
return new UnknownProductTypeException("ProductType muss eines aus folgenden sein: {$validValues}");
|
||||
}
|
||||
static public function invalidDescription(){
|
||||
return new UnknownProductTypeException('Produktbeschreibung muss gegeben sein');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user