RestAPI
in package
implements
ConnectorInterface
PayU RestAPI connector class.
Interfaces, Classes, Traits and Enums
- ConnectorInterface
- PayU connector interface.
Table of Contents
- CREATE_ORDER_SUCCESS_HTTP_CODE = 302
- RESULT_SUCCESS_CODE = 'SUCCESS'
- API body success code
- $client : Client|null
- $config : array<string|int, mixed>
- __construct() : mixed
- Construct.
- authenticate() : void
- Authenticate connector.
- cancelOrder() : void
- {@inheritDoc} {@see https://developers.payu.com/en/restapi.html#cancellation}.
- createOrder() : CreateResponseDto
- {@inheritDoc} {@see https://developers.payu.com/en/restapi.html#creating_new_order}.
- getOrder() : OrderDto
- {@inheritDoc} {@see https://developers.payu.com/en/restapi.html#order_data_retrieve}.
- configureClient() : void
- Configure http client.
- isAuthenticated() : bool
- Check if connector is authenticated to api.
- request() : ResponseInterface
- Base method for making requests.
- validateResponse() : mixed|string
- Validate response.
Constants
CREATE_ORDER_SUCCESS_HTTP_CODE
private
int
CREATE_ORDER_SUCCESS_HTTP_CODE
= 302
Success http code in create order response
RESULT_SUCCESS_CODE
API body success code
private
mixed
RESULT_SUCCESS_CODE
= 'SUCCESS'
Properties
$client
private
Client|null
$client
= null
$config
private
array<string|int, mixed>
$config
with api connection details
Methods
__construct()
Construct.
public
__construct(array<string|int, mixed> $config) : mixed
Parameters
- $config : array<string|int, mixed>
Return values
mixed —authenticate()
Authenticate connector.
public
authenticate() : void
Tags
Return values
void —cancelOrder()
{@inheritDoc} {@see https://developers.payu.com/en/restapi.html#cancellation}.
public
cancelOrder(string $orderId) : void
Parameters
- $orderId : string
Return values
void —createOrder()
{@inheritDoc} {@see https://developers.payu.com/en/restapi.html#creating_new_order}.
public
createOrder(OrderDto $order) : CreateResponseDto
Parameters
- $order : OrderDto
Return values
CreateResponseDto —getOrder()
{@inheritDoc} {@see https://developers.payu.com/en/restapi.html#order_data_retrieve}.
public
getOrder(string $orderId) : OrderDto
Parameters
- $orderId : string
Return values
OrderDto —configureClient()
Configure http client.
private
configureClient(string $token) : void
Parameters
- $token : string
Return values
void —isAuthenticated()
Check if connector is authenticated to api.
private
isAuthenticated() : bool
Return values
bool —request()
Base method for making requests.
private
request(string $method, string $uri, array<string|int, mixed> $options) : ResponseInterface
Parameters
- $method : string
- $uri : string
- $options : array<string|int, mixed>
Tags
Return values
ResponseInterface —validateResponse()
Validate response.
private
validateResponse(ResponseInterface $response, int $expectedHttpCode) : mixed|string
Parameters
- $response : ResponseInterface
- $expectedHttpCode : int