forked from LiveCarta/PayPal-PHP-Server-SDK
Beta Release 0.5.0 (#3)
* Automated commit message * Automated commit message * Automated commit message * Automated commit message --------- Co-authored-by: PayPalServerSDKs <server-sdks@paypal.com>
This commit is contained in:
71
src/Exceptions/ApiException.php
Normal file
71
src/Exceptions/ApiException.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* PaypalServerSDKLib
|
||||
*
|
||||
* This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
|
||||
*/
|
||||
|
||||
namespace PaypalServerSDKLib\Exceptions;
|
||||
|
||||
use CoreInterfaces\Sdk\ExceptionInterface;
|
||||
use PaypalServerSDKLib\Http\HttpResponse;
|
||||
use PaypalServerSDKLib\Http\HttpRequest;
|
||||
|
||||
/**
|
||||
* Thrown when there is a network error or HTTP response status code is not okay.
|
||||
*/
|
||||
class ApiException extends \Exception implements ExceptionInterface
|
||||
{
|
||||
/**
|
||||
* HTTP request
|
||||
*
|
||||
* @var HttpRequest
|
||||
*/
|
||||
private $request;
|
||||
|
||||
/**
|
||||
* HTTP response
|
||||
*
|
||||
* @var HttpResponse|null
|
||||
*/
|
||||
private $response;
|
||||
|
||||
/**
|
||||
* @param string $reason the reason for raising an exception
|
||||
* @param HttpRequest $request
|
||||
* @param HttpResponse|null $response
|
||||
*/
|
||||
public function __construct(string $reason, HttpRequest $request, ?HttpResponse $response)
|
||||
{
|
||||
parent::__construct($reason, \is_null($response) ? 0 : $response->getStatusCode());
|
||||
$this->request = $request;
|
||||
$this->response = $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the HTTP request
|
||||
*/
|
||||
public function getHttpRequest(): HttpRequest
|
||||
{
|
||||
return $this->request;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the HTTP response
|
||||
*/
|
||||
public function getHttpResponse(): ?HttpResponse
|
||||
{
|
||||
return $this->response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the response available?
|
||||
*/
|
||||
public function hasResponse(): bool
|
||||
{
|
||||
return !\is_null($this->response);
|
||||
}
|
||||
}
|
||||
175
src/Exceptions/ErrorException.php
Normal file
175
src/Exceptions/ErrorException.php
Normal file
@@ -0,0 +1,175 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* PaypalServerSDKLib
|
||||
*
|
||||
* This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
|
||||
*/
|
||||
|
||||
namespace PaypalServerSDKLib\Exceptions;
|
||||
|
||||
/**
|
||||
* The error details.
|
||||
*/
|
||||
class ErrorException extends ApiException
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $messageProperty;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $debugId;
|
||||
|
||||
/**
|
||||
* @var \PaypalServerSDKLib\Models\ErrorDetails[]|null
|
||||
*/
|
||||
private $details;
|
||||
|
||||
/**
|
||||
* @var \PaypalServerSDKLib\Models\LinkDescription[]|null
|
||||
*/
|
||||
private $links;
|
||||
|
||||
/**
|
||||
* @param string $reason
|
||||
* @param \PaypalServerSDKLib\Http\HttpRequest $request
|
||||
* @param \PaypalServerSDKLib\Http\HttpResponse $response
|
||||
* @param string $name
|
||||
* @param string $messageProperty
|
||||
* @param string $debugId
|
||||
*/
|
||||
public function __construct(
|
||||
string $reason,
|
||||
\PaypalServerSDKLib\Http\HttpRequest $request,
|
||||
\PaypalServerSDKLib\Http\HttpResponse $response,
|
||||
string $name,
|
||||
string $messageProperty,
|
||||
string $debugId
|
||||
) {
|
||||
parent::__construct($reason, $request, $response);
|
||||
$this->name = $name;
|
||||
$this->messageProperty = $messageProperty;
|
||||
$this->debugId = $debugId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns Name.
|
||||
* The human-readable, unique name of the error.
|
||||
*/
|
||||
public function getName(): string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets Name.
|
||||
* The human-readable, unique name of the error.
|
||||
*
|
||||
* @required
|
||||
* @maps name
|
||||
*/
|
||||
public function setName(string $name): void
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns Message Property.
|
||||
* The message that describes the error.
|
||||
*/
|
||||
public function getMessageProperty(): string
|
||||
{
|
||||
return $this->messageProperty;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets Message Property.
|
||||
* The message that describes the error.
|
||||
*
|
||||
* @required
|
||||
* @maps message
|
||||
*/
|
||||
public function setMessageProperty(string $messageProperty): void
|
||||
{
|
||||
$this->messageProperty = $messageProperty;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns Debug Id.
|
||||
* The PayPal internal ID. Used for correlation purposes.
|
||||
*/
|
||||
public function getDebugId(): string
|
||||
{
|
||||
return $this->debugId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets Debug Id.
|
||||
* The PayPal internal ID. Used for correlation purposes.
|
||||
*
|
||||
* @required
|
||||
* @maps debug_id
|
||||
*/
|
||||
public function setDebugId(string $debugId): void
|
||||
{
|
||||
$this->debugId = $debugId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns Details.
|
||||
* An array of additional details about the error.
|
||||
*
|
||||
* @return \PaypalServerSDKLib\Models\ErrorDetails[]|null
|
||||
*/
|
||||
public function getDetails(): ?array
|
||||
{
|
||||
return $this->details;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets Details.
|
||||
* An array of additional details about the error.
|
||||
*
|
||||
* @maps details
|
||||
*
|
||||
* @param \PaypalServerSDKLib\Models\ErrorDetails[]|null $details
|
||||
*/
|
||||
public function setDetails(?array $details): void
|
||||
{
|
||||
$this->details = $details;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns Links.
|
||||
* An array of request-related [HATEOAS links](/api/rest/responses/#hateoas-links).
|
||||
*
|
||||
* @return \PaypalServerSDKLib\Models\LinkDescription[]|null
|
||||
*/
|
||||
public function getLinks(): ?array
|
||||
{
|
||||
return $this->links;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets Links.
|
||||
* An array of request-related [HATEOAS links](/api/rest/responses/#hateoas-links).
|
||||
*
|
||||
* @maps links
|
||||
*
|
||||
* @param \PaypalServerSDKLib\Models\LinkDescription[]|null $links
|
||||
*/
|
||||
public function setLinks(?array $links): void
|
||||
{
|
||||
$this->links = $links;
|
||||
}
|
||||
}
|
||||
114
src/Exceptions/OAuthProviderException.php
Normal file
114
src/Exceptions/OAuthProviderException.php
Normal file
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* PaypalServerSDKLib
|
||||
*
|
||||
* This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
|
||||
*/
|
||||
|
||||
namespace PaypalServerSDKLib\Exceptions;
|
||||
|
||||
/**
|
||||
* OAuth 2 Authorization endpoint exception.
|
||||
*/
|
||||
class OAuthProviderException extends ApiException
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $error;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
private $errorDescription;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
private $errorUri;
|
||||
|
||||
/**
|
||||
* @param string $reason
|
||||
* @param \PaypalServerSDKLib\Http\HttpRequest $request
|
||||
* @param \PaypalServerSDKLib\Http\HttpResponse $response
|
||||
* @param string $error
|
||||
*/
|
||||
public function __construct(
|
||||
string $reason,
|
||||
\PaypalServerSDKLib\Http\HttpRequest $request,
|
||||
\PaypalServerSDKLib\Http\HttpResponse $response,
|
||||
string $error
|
||||
) {
|
||||
parent::__construct($reason, $request, $response);
|
||||
$this->error = $error;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns Error.
|
||||
* Gets or sets error code.
|
||||
*/
|
||||
public function getError(): string
|
||||
{
|
||||
return $this->error;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets Error.
|
||||
* Gets or sets error code.
|
||||
*
|
||||
* @required
|
||||
* @maps error
|
||||
* @factory \PaypalServerSDKLib\Models\OAuthProviderError::checkValue
|
||||
*/
|
||||
public function setError(string $error): void
|
||||
{
|
||||
$this->error = $error;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns Error Description.
|
||||
* Gets or sets human-readable text providing additional information on error.
|
||||
* Used to assist the client developer in understanding the error that occurred.
|
||||
*/
|
||||
public function getErrorDescription(): ?string
|
||||
{
|
||||
return $this->errorDescription;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets Error Description.
|
||||
* Gets or sets human-readable text providing additional information on error.
|
||||
* Used to assist the client developer in understanding the error that occurred.
|
||||
*
|
||||
* @maps error_description
|
||||
*/
|
||||
public function setErrorDescription(?string $errorDescription): void
|
||||
{
|
||||
$this->errorDescription = $errorDescription;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns Error Uri.
|
||||
* Gets or sets a URI identifying a human-readable web page with information about the error, used to
|
||||
* provide the client developer with additional information about the error.
|
||||
*/
|
||||
public function getErrorUri(): ?string
|
||||
{
|
||||
return $this->errorUri;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets Error Uri.
|
||||
* Gets or sets a URI identifying a human-readable web page with information about the error, used to
|
||||
* provide the client developer with additional information about the error.
|
||||
*
|
||||
* @maps error_uri
|
||||
*/
|
||||
public function setErrorUri(?string $errorUri): void
|
||||
{
|
||||
$this->errorUri = $errorUri;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user