Skip to content

Commit dc29a2a

Browse files
committed
v0.7.0 release
1 parent 85cffab commit dc29a2a

26 files changed

+3035
-91
lines changed

.openapi-generator/FILES

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ docs/Model/AccountRelatedAgents.md
1313
docs/Model/AccountRelationship.md
1414
docs/Model/AccountServicer.md
1515
docs/Model/AccountSuitableScope.md
16+
docs/Model/DownloadAccountStatement200Response.md
17+
docs/Model/DownloadAccountStatement200Response1.md
18+
docs/Model/DownloadAccountStatement200Response2.md
19+
docs/Model/DownloadAccountStatement400Response.md
20+
docs/Model/DownloadAccountStatement400ResponseErrorsInner.md
1621
docs/Model/GetAccountBalance200Response.md
1722
docs/Model/GetAccountBalance200ResponseBalancesInner.md
1823
docs/Model/GetAccountBalance200ResponseBalancesInnerAmount.md
@@ -85,6 +90,11 @@ lib/Model/AccountRelatedAgents.php
8590
lib/Model/AccountRelationship.php
8691
lib/Model/AccountServicer.php
8792
lib/Model/AccountSuitableScope.php
93+
lib/Model/DownloadAccountStatement200Response.php
94+
lib/Model/DownloadAccountStatement200Response1.php
95+
lib/Model/DownloadAccountStatement200Response2.php
96+
lib/Model/DownloadAccountStatement400Response.php
97+
lib/Model/DownloadAccountStatement400ResponseErrorsInner.php
8898
lib/Model/GetAccountBalance200Response.php
8999
lib/Model/GetAccountBalance200ResponseBalancesInner.php
90100
lib/Model/GetAccountBalance200ResponseBalancesInnerAmount.php
@@ -156,6 +166,11 @@ test/Model/AccountRelationshipTest.php
156166
test/Model/AccountServicerTest.php
157167
test/Model/AccountSuitableScopeTest.php
158168
test/Model/AccountTest.php
169+
test/Model/DownloadAccountStatement200Response1Test.php
170+
test/Model/DownloadAccountStatement200Response2Test.php
171+
test/Model/DownloadAccountStatement200ResponseTest.php
172+
test/Model/DownloadAccountStatement400ResponseErrorsInnerTest.php
173+
test/Model/DownloadAccountStatement400ResponseTest.php
159174
test/Model/GetAccountBalance200ResponseBalancesInnerAmountTest.php
160175
test/Model/GetAccountBalance200ResponseBalancesInnerDateTest.php
161176
test/Model/GetAccountBalance200ResponseBalancesInnerTest.php

.openapi-generator/templates/HeaderSelector.mustache

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
/**
44
* HeaderSelector
5-
* PHP version 7.4+
5+
* PHP version 8.1+
66
*
77
* @category Class
88
* @package {{invokerPackage}}
@@ -192,7 +192,7 @@ class HeaderSelector
192192
* @param bool $hasMoreThan28Headers
193193
* @return string[] array of adjusted "Accept" headers
194194
*/
195-
private function adjustWeight(array $headers, float &$currentWeight, bool $hasMoreThan28Headers): array
195+
private function adjustWeight(array $headers, int &$currentWeight, bool $hasMoreThan28Headers): array
196196
{
197197
usort($headers, function (array $a, array $b) {
198198
return $b['weight'] - $a['weight'];
@@ -260,6 +260,6 @@ class HeaderSelector
260260
return $currentWeight - 1;
261261
}
262262

263-
return $currentWeight - 10 ** floor(log10($currentWeight - 1));
263+
return (int)($currentWeight - 10 ** floor(log10($currentWeight - 1)));
264264
}
265265
}

.openapi-generator/templates/Statementor.mustache

Lines changed: 45 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Statementor extends \Ease\Sand
2525
use \Ease\Logger\Logging;
2626
public \DateTime $since;
2727
public \DateTime $until;
28-
private string $scope;
28+
public string $currency = 'CZK';
2929
3030
/**
3131
* DateTime Formating eg. 2021-08-01T10:00:00.0Z.
@@ -36,10 +36,14 @@ class Statementor extends \Ease\Sand
3636
* DateTime Formating eg. 2021-08-01T10:00:00.0Z.
3737
*/
3838
public static string $dateFormat = 'Y-m-d';
39+
private string $scope;
3940
private string $accountNumber = '';
40-
41-
public function __construct(string $accountNumber = '', string $scope = '')
41+
private string $accountUuid = '';
42+
43+
public function __construct(string $accountUuid, string $accountNumber = '', string $scope = '')
4244
{
45+
$this->setAccountUuid($accountUuid);
46+
4347
if ($accountNumber) {
4448
$this->setAccountNumber($accountNumber);
4549
}
@@ -67,7 +71,7 @@ class Statementor extends \Ease\Sand
6771
/**
6872
* Obtain Statements from ČSas.
6973
*
70-
* @param string $format pdf, xml, xml-data, abo-standard, abo-internal, abo-standard-extended, abo-internal-extended, csv-comma, csv-semicolon, mt940
74+
* @param string $format pdf, xml, xml-data, abo-standard, abo-internal, abo-standard-extended, abo-internal-extended, csv-comma, csv-semicolon, mt940
7175
*/
7276
public function getStatements($format = 'pdf'): array
7377
{
@@ -79,20 +83,14 @@ class Statementor extends \Ease\Sand
7983
try {
8084
do {
8185
82-
$result = $apiInstance->getAccountStatements($this->getAccountNumber(), $this->getSince()->format('Y-m-d'), $this->getUntil()->format('Y-m-d'),$format);
83-
84-
if (empty($result)) {
85-
$this->addStatusMessage(sprintf(_('No transactions from %s to %s'), $this->since->format(self::$dateFormat), $this->until->format(self::$dateFormat)));
86-
$result['lastPage'] = true;
87-
$result['last'] = true;
88-
}
86+
$result = $apiInstance->getAccountStatements($this->getAccountNumber(), $this->getSince()->format('Y-m-d'), $this->getUntil()->format('Y-m-d'), $format);
8987
90-
if (\array_key_exists('statements', $result)) {
91-
$statements = array_merge($statements, $result['statements']);
88+
if ($result->getAccountStatements()) {
89+
$statements = array_merge($statements, $result->getAccountStatements());
90+
} else {
91+
$this->addStatusMessage(sprintf(_('No transactions from %s to %s'), $this->since->format(self::$dateFormat), $this->until->format(self::$dateFormat)));
9292
}
93-
94-
sleep(1);
95-
} while ($result['last'] === false);
93+
} while ($result->getNextPage());
9694
} catch (\Ease\Exception $e) {
9795
echo 'Exception when calling GetTransactionListApi->getTransactionList: ', $e->getMessage(), \PHP_EOL;
9896
}
@@ -201,7 +199,9 @@ class Statementor extends \Ease\Sand
201199
$this->since = $this->since->setTime(0, 0);
202200
$this->until = $this->until->setTime(23, 59, 59, 999);
203201
}
202+
204203
$this->scope = $scope;
204+
205205
return $this->getScope();
206206
}
207207

@@ -224,21 +224,27 @@ class Statementor extends \Ease\Sand
224224
public function download(string $saveTo, array $statements, string $format = 'pdf', string $currencyCode = 'CZK'): array
225225
{
226226
$saved = [];
227-
$apiInstance = new PremiumAPI\DownloadStatementApi();
227+
$apiInstance = new \SpojeNet\CSas\Accounts\DefaultApi();
228228
$success = 0;
229229
230230
foreach ($statements as $statement) {
231-
$statementFilename = str_replace('/', '_', $statement->statementNumber).'_'.
232-
$statement->accountNumber.'_'.
233-
$statement->accountId.'_'.
234-
$statement->currency.'_'.$statement->dateFrom.'.'.$format;
235-
$requestBody = new \VitexSoftware\Raiffeisenbank\Model\DownloadStatementRequest([
236-
'accountNumber' => $this->accountNumber,
237-
'currency' => $currencyCode,
238-
'statementId' => $statement->statementId,
239-
'statementFormat' => $format]);
240-
$pdfStatementRaw = $apiInstance->downloadStatement(ApiClient::getxRequestId(), 'cs', $requestBody);
241-
sleep(1);
231+
// 'accountStatementId' => 'getAccountStatementId',
232+
// 'year' => 'getYear',
233+
// 'month' => 'getMonth',
234+
// 'sequenceNumber' => 'getSequenceNumber',
235+
// 'period' => 'getPeriod',
236+
// 'dateFrom' => 'getDateFrom',
237+
// 'dateTo' => 'getDateTo',
238+
// 'formats' => 'getFormats',
239+
240+
$statementFilename =
241+
$statement->getSequenceNumber().'_'.
242+
$this->getAccountNumber().'_'.
243+
$statement->getAccountStatementId().'_'.
244+
$this->currency.'_'.$statement->getDateFrom()->format('Y-m-d').'.'.$format;
245+
246+
$pdfStatementRaw = $apiInstance->downloadAccountStatement($this->getAccountUuid(), $statement->getAccountStatementId(), $format);
247+
242248
243249
if (file_put_contents($saveTo.'/'.$statementFilename, $pdfStatementRaw->fread($pdfStatementRaw->getSize()))) {
244250
$saved[$statementFilename] = $saveTo.'/'.$statementFilename;
@@ -269,8 +275,18 @@ class Statementor extends \Ease\Sand
269275
return $this->until;
270276
}
271277

272-
public function getAccountNumber(): string {
278+
public function getAccountNumber(): string
279+
{
273280
return $this->accountNumber;
274281
}
275282

283+
public function setAccountUuid($accountUuid): void
284+
{
285+
$this->accountUuid = $accountUuid;
286+
}
287+
288+
public function getAccountUuid(): string
289+
{
290+
return $this->accountUuid;
291+
}
276292
}

.openapi-generator/templates/api.mustache

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,9 @@ use {{invokerPackage}}\ObjectSerializer;
321321
$content = $response->getBody(); //stream goes to serializer
322322
} else {
323323
$content = (string) $response->getBody();
324-
if ('{{{dataType}}}' !== 'string') {
324+
$contentType = $response->getHeaderLine('Content-Type');
325+
326+
if ($contentType == 'application/json') {
325327
try {
326328
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
327329
} catch (\JsonException $exception) {
@@ -634,7 +636,7 @@ use {{invokerPackage}}\ObjectSerializer;
634636
// verify the required parameter '{{paramName}}' is set
635637
if (${{paramName}} === null || (is_array(${{paramName}}) && count(${{paramName}}) === 0)) {
636638
throw new \InvalidArgumentException(
637-
'Missing the required parameter ${{paramName}} when calling {{operationId}}'
639+
'Missing the required parameter ${{paramName}} when calling {{operationId}}',
638640
);
639641
}
640642
{{/required}}
@@ -746,7 +748,7 @@ use {{invokerPackage}}\ObjectSerializer;
746748
$headers = $this->headerSelector->selectHeaders(
747749
[{{#produces}}'{{{mediaType}}}', {{/produces}}],
748750
$contentType,
749-
$multipart
751+
$multipart,
750752
);
751753

752754
// for model (json/xml)
@@ -770,7 +772,7 @@ use {{invokerPackage}}\ObjectSerializer;
770772
foreach ($formParamValueItems as $formParamValueItem) {
771773
$multipartContents[] = [
772774
'name' => $formParamName,
773-
'contents' => $formParamValueItem
775+
'contents' => $formParamValueItem,
774776
];
775777
}
776778
}
@@ -804,27 +806,28 @@ use {{invokerPackage}}\ObjectSerializer;
804806
{{#isBasicBearer}}
805807
// this endpoint requires Bearer{{#bearerFormat}} ({{{.}}}){{/bearerFormat}} authentication (access token)
806808
if (!empty($this->config->getAccessToken())) {
807-
$headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
809+
$headers['Authorization'] = 'Bearer '.$this->config->getAccessToken();
808810
}
809811
{{/isBasicBearer}}
810812
{{/isBasic}}
811813
{{#isOAuth}}
812814
// this endpoint requires OAuth (access token)
813815
if (!empty($this->config->getAccessToken())) {
814-
$headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
816+
$headers['Authorization'] = 'Bearer '.$this->config->getAccessToken();
815817
}
816818
{{/isOAuth}}
817819
{{/authMethods}}
818820

819821
$defaultHeaders = [];
822+
820823
if ($this->config->getUserAgent()) {
821824
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
822825
}
823826

824827
$headers = array_merge(
825828
$defaultHeaders,
826829
$headerParams,
827-
$headers
830+
$headers,
828831
);
829832

830833
{{#servers.0}}
@@ -844,11 +847,12 @@ use {{invokerPackage}}\ObjectSerializer;
844847
$operationHost = $this->config->getHost();
845848
{{/servers.0}}
846849
$query = ObjectSerializer::buildQuery($queryParams);
850+
847851
return new Request(
848852
'{{httpMethod}}',
849-
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
853+
$operationHost.$resourcePath.($query ? "?{$query}" : ''),
850854
$headers,
851-
$httpBody
855+
$httpBody,
852856
);
853857
}
854858

@@ -894,18 +898,21 @@ use {{invokerPackage}}\ObjectSerializer;
894898
{{/servers.0}}
895899
{{/operation}}
896900
/**
897-
* Create http client option
901+
* Create http client option.
898902
*
899903
* @throws \RuntimeException on file opening failure
904+
*
900905
* @return array of http client options
901906
*/
902907
protected function createHttpClientOption()
903908
{
904909
$options = [];
910+
905911
if ($this->config->getDebug()) {
906-
$options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
912+
$options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'ab');
913+
907914
if (!$options[RequestOptions::DEBUG]) {
908-
throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
915+
throw new \RuntimeException('Failed to open the debug file: '.$this->config->getDebugFile());
909916
}
910917
}
911918

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,11 @@ Class | Method | HTTP request | Description
100100
- [AccountRelationship](docs/Model/AccountRelationship.md)
101101
- [AccountServicer](docs/Model/AccountServicer.md)
102102
- [AccountSuitableScope](docs/Model/AccountSuitableScope.md)
103+
- [DownloadAccountStatement200Response](docs/Model/DownloadAccountStatement200Response.md)
104+
- [DownloadAccountStatement200Response1](docs/Model/DownloadAccountStatement200Response1.md)
105+
- [DownloadAccountStatement200Response2](docs/Model/DownloadAccountStatement200Response2.md)
106+
- [DownloadAccountStatement400Response](docs/Model/DownloadAccountStatement400Response.md)
107+
- [DownloadAccountStatement400ResponseErrorsInner](docs/Model/DownloadAccountStatement400ResponseErrorsInner.md)
103108
- [GetAccountBalance200Response](docs/Model/GetAccountBalance200Response.md)
104109
- [GetAccountBalance200ResponseBalancesInner](docs/Model/GetAccountBalance200ResponseBalancesInner.md)
105110
- [GetAccountBalance200ResponseBalancesInnerAmount](docs/Model/GetAccountBalance200ResponseBalancesInnerAmount.md)

debian/changelog

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1-
php-spojenet-csas-accountsapi (0.6.0) UNRELEASED; urgency=medium
1+
php-spojenet-csas-accountsapi (0.7.0) UNRELEASED; urgency=medium
2+
3+
* Statements downloading
4+
5+
-- vitex <info@vitexsoftware.cz> Mon, 17 Mar 2025 21:56:04 +0100
6+
7+
php-spojenet-csas-accountsapi (0.6.0) noble; urgency=medium
28

39
* Config prefix CSAS_ used
410

5-
-- vitex <info@vitexsoftware.cz> Sat, 08 Mar 2025 20:52:35 +0100
11+
-- vitex <info@vitexsoftware.cz> Mon, 17 Mar 2025 21:55:47 +0100
612

713
php-spojenet-csas-accountsapi (0.5.0) noble; urgency=medium
814

docs/Api/DefaultApi.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ try {
7474
### HTTP request headers
7575

7676
- **Content-Type**: Not defined
77-
- **Accept**: `application/pdf`, `application/xml`, `text/csv`, `application/json`
77+
- **Accept**: `application/pdf`, `application/xml`, `application/xml-data`, `application/abo-standard`, `application/abo-internal`, `application/abo-standard-extended`, `application/abo-internal-extended`, `text/csv`, `text/csv-comma`, `text/csv-semicolon`, `application/mt940`, `application/json`
7878

7979
[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
8080
[[Back to Model list]](../../README.md#models)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# # DownloadAccountStatement200Response
2+
3+
## Properties
4+
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**data** | **\SplFileObject** | Account statement file in the csv-comma format | [optional]
8+
9+
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# # DownloadAccountStatement200Response1
2+
3+
## Properties
4+
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**data** | **\SplFileObject** | Account statement file in the csv-semicolon format | [optional]
8+
9+
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# # DownloadAccountStatement200Response2
2+
3+
## Properties
4+
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**data** | **\SplFileObject** | Account statement file in the mt940 format | [optional]
8+
9+
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

0 commit comments

Comments
 (0)