Skip to content

Commit cf47ae0

Browse files
committed
Generate BalanceControl models
1 parent d6085d5 commit cf47ae0

File tree

5 files changed

+9
-34
lines changed

5 files changed

+9
-34
lines changed

src/Adyen/Model/BalanceControl/Amount.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ public function getModelName()
235235
* @param mixed[] $data Associated array of property values
236236
* initializing the model
237237
*/
238-
public function __construct(array $data = null)
238+
public function __construct(?array $data = null)
239239
{
240240
$this->setIfExists('currency', $data ?? [], null);
241241
$this->setIfExists('value', $data ?? [], null);
@@ -302,7 +302,7 @@ public function getCurrency()
302302
/**
303303
* Sets currency
304304
*
305-
* @param string $currency The three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes).
305+
* @param string $currency The three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes#currency-codes).
306306
*
307307
* @return self
308308
*/
@@ -326,7 +326,7 @@ public function getValue()
326326
/**
327327
* Sets value
328328
*
329-
* @param int $value The amount of the transaction, in [minor units](https://docs.adyen.com/development-resources/currency-codes).
329+
* @param int $value The amount of the transaction, in [minor units](https://docs.adyen.com/development-resources/currency-codes#minor-units).
330330
*
331331
* @return self
332332
*/

src/Adyen/Model/BalanceControl/BalanceTransferRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ public function getTypeAllowableValues()
281281
* @param mixed[] $data Associated array of property values
282282
* initializing the model
283283
*/
284-
public function __construct(array $data = null)
284+
public function __construct(?array $data = null)
285285
{
286286
$this->setIfExists('amount', $data ?? [], null);
287287
$this->setIfExists('description', $data ?? [], null);

src/Adyen/Model/BalanceControl/BalanceTransferResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ public function getTypeAllowableValues()
317317
* @param mixed[] $data Associated array of property values
318318
* initializing the model
319319
*/
320-
public function __construct(array $data = null)
320+
public function __construct(?array $data = null)
321321
{
322322
$this->setIfExists('amount', $data ?? [], null);
323323
$this->setIfExists('createdAt', $data ?? [], null);

src/Adyen/Model/BalanceControl/ObjectSerializer.php

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public static function sanitizeForSerialization($data, $type = null, $format = n
8181
}
8282
}
8383
} else {
84-
foreach ($data as $property => $value) {
84+
foreach($data as $property => $value) {
8585
$values[$property] = self::sanitizeForSerialization($value);
8686
}
8787
}
@@ -117,9 +117,7 @@ public static function sanitizeFilename($filename)
117117
*/
118118
public static function sanitizeTimestamp($timestamp)
119119
{
120-
if (!is_string($timestamp)) {
121-
return $timestamp;
122-
}
120+
if (!is_string($timestamp)) return $timestamp;
123121

124122
return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp);
125123
}
@@ -236,30 +234,6 @@ public static function deserialize($data, $class, $httpHeaders = null)
236234
}
237235
}
238236

239-
if ($class === '\SplFileObject') {
240-
$data = Utils::streamFor($data);
241-
242-
/** @var \Psr\Http\Message\StreamInterface $data */
243-
244-
// determine file name
245-
if (is_array($httpHeaders)
246-
&& array_key_exists('Content-Disposition', $httpHeaders)
247-
&& preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match)
248-
) {
249-
$filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]);
250-
} else {
251-
$filename = tempnam(Configuration::getDefaultConfiguration()->getTempFolderPath(), '');
252-
}
253-
254-
$file = fopen($filename, 'w');
255-
while ($chunk = $data->read(200)) {
256-
fwrite($file, $chunk);
257-
}
258-
fclose($file);
259-
260-
return new \SplFileObject($filename, 'r');
261-
}
262-
263237
/** @psalm-suppress ParadoxicalCondition */
264238
if (in_array($class, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) {
265239
settype($data, $class);

src/Adyen/Service/BalanceControlApi.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,13 @@ public function __construct(Client $client)
4242
/**
4343
* Start a balance transfer
4444
*
45+
* @deprecated since Adyen Balance Control API v1.
4546
* @param \Adyen\Model\BalanceControl\BalanceTransferRequest $balanceTransferRequest
4647
* @param array|null $requestOptions
4748
* @return \Adyen\Model\BalanceControl\BalanceTransferResponse
4849
* @throws AdyenException
4950
*/
50-
public function balanceTransfer(\Adyen\Model\BalanceControl\BalanceTransferRequest $balanceTransferRequest, array $requestOptions = null): \Adyen\Model\BalanceControl\BalanceTransferResponse
51+
public function balanceTransfer(\Adyen\Model\BalanceControl\BalanceTransferRequest $balanceTransferRequest, ?array $requestOptions = null): \Adyen\Model\BalanceControl\BalanceTransferResponse
5152
{
5253
$endpoint = $this->baseURL . "/balanceTransfer";
5354
$response = $this->requestHttp($endpoint, strtolower('POST'), (array) $balanceTransferRequest->jsonSerialize(), $requestOptions);

0 commit comments

Comments
 (0)