-
Notifications
You must be signed in to change notification settings - Fork 108
/
Copy pathOrdersApi.php
86 lines (78 loc) · 3.07 KB
/
OrdersApi.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
/**
* Adyen Checkout API
*
* The version of the OpenAPI document: 71
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.0.1
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace Adyen\Service\Checkout;
use Adyen\AdyenException;
use Adyen\Client;
use Adyen\Service;
use Adyen\Model\Checkout\ObjectSerializer;
class OrdersApi extends Service
{
/**
* @var array|string|string[]
*/
private $baseURL;
/**
* OrdersApi constructor.
*
* @param \Adyen\Client $client
* @throws AdyenException
*/
public function __construct(Client $client)
{
parent::__construct($client);
// Create the baseUrl based on live/test and optional live-url-prefix
$this->baseURL = $this->createBaseUrl("https://checkout-test.adyen.com/v71");
}
/**
* Cancel an order
*
* @param \Adyen\Model\Checkout\CancelOrderRequest $cancelOrderRequest
* @param array|null $requestOptions
* @return \Adyen\Model\Checkout\CancelOrderResponse
* @throws AdyenException
*/
public function cancelOrder(\Adyen\Model\Checkout\CancelOrderRequest $cancelOrderRequest, array $requestOptions = null): \Adyen\Model\Checkout\CancelOrderResponse
{
$endpoint = $this->baseURL . "/orders/cancel";
$response = $this->requestHttp($endpoint, strtolower('POST'), (array) $cancelOrderRequest->jsonSerialize(), $requestOptions);
return ObjectSerializer::deserialize($response, \Adyen\Model\Checkout\CancelOrderResponse::class);
}
/**
* Get the balance of a gift card
*
* @param \Adyen\Model\Checkout\BalanceCheckRequest $balanceCheckRequest
* @param array|null $requestOptions
* @return \Adyen\Model\Checkout\BalanceCheckResponse
* @throws AdyenException
*/
public function getBalanceOfGiftCard(\Adyen\Model\Checkout\BalanceCheckRequest $balanceCheckRequest, array $requestOptions = null): \Adyen\Model\Checkout\BalanceCheckResponse
{
$endpoint = $this->baseURL . "/paymentMethods/balance";
$response = $this->requestHttp($endpoint, strtolower('POST'), (array) $balanceCheckRequest->jsonSerialize(), $requestOptions);
return ObjectSerializer::deserialize($response, \Adyen\Model\Checkout\BalanceCheckResponse::class);
}
/**
* Create an order
*
* @param \Adyen\Model\Checkout\CreateOrderRequest $createOrderRequest
* @param array|null $requestOptions
* @return \Adyen\Model\Checkout\CreateOrderResponse
* @throws AdyenException
*/
public function orders(\Adyen\Model\Checkout\CreateOrderRequest $createOrderRequest, array $requestOptions = null): \Adyen\Model\Checkout\CreateOrderResponse
{
$endpoint = $this->baseURL . "/orders";
$response = $this->requestHttp($endpoint, strtolower('POST'), (array) $createOrderRequest->jsonSerialize(), $requestOptions);
return ObjectSerializer::deserialize($response, \Adyen\Model\Checkout\CreateOrderResponse::class);
}
}