Skip to content

Commit e3cf227

Browse files
author
Vítězslav Dvořák
committed
Adds method to fetch account by UUID
Introduces a static method `getAccountById` to retrieve account details based on a UUID. Enhances usability by allowing direct access to specific accounts through the API. Improves code readability and alignment by cleaning up formatting in comments. No breaking changes introduced.
1 parent 2001731 commit e3cf227

File tree

2 files changed

+38
-4
lines changed

2 files changed

+38
-4
lines changed

.openapi-generator/templates/Statementor.mustache

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -289,12 +289,12 @@ class Statementor extends \Ease\Sand
289289
{
290290
return $this->accountUuid;
291291
}
292-
292+
293293
/**
294294
* IBAN=>UUID listing of accounts
295-
*
295+
*
296296
* @param Accounts\DefaultApi $apiInstance
297-
*
297+
*
298298
* @return array<string,string>
299299
*/
300300
public static function getAccountIDs(Accounts\DefaultApi $apiInstance): array
@@ -342,5 +342,21 @@ class Statementor extends \Ease\Sand
342342

343343
return $account;
344344
}
345-
345+
346+
public static function getAccountById(Accounts\DefaultApi $apiInstance, string $uuid): ?\SpojeNet\CSas\Model\Account
347+
{
348+
$accountsRaw = $apiInstance->getAccounts()->getAccounts();
349+
$account = null;
350+
351+
if (isset($accountsRaw) && \is_array($accountsRaw)) {
352+
foreach ($accountsRaw as $account) {
353+
if ($account->getIdentification()->getId() === $uuid) {
354+
break;
355+
}
356+
}
357+
}
358+
359+
return $account;
360+
}
361+
346362
}

lib/Statementor.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,4 +343,22 @@ public static function getAccountByIban(Accounts\DefaultApi $apiInstance, string
343343

344344
return $account;
345345
}
346+
347+
public static function getAccountById(Accounts\DefaultApi $apiInstance, string $uuid): ?\SpojeNet\CSas\Model\Account
348+
{
349+
$accountsRaw = $apiInstance->getAccounts()->getAccounts();
350+
$account = null;
351+
352+
if (isset($accountsRaw) && \is_array($accountsRaw)) {
353+
foreach ($accountsRaw as $account) {
354+
if ($account->getIdentification()->getId() === $uuid) {
355+
break;
356+
}
357+
}
358+
}
359+
360+
return $account;
361+
}
362+
363+
346364
}

0 commit comments

Comments
 (0)