From 7f9c1e0862a1ddf8726cab73ead298b844ed9b24 Mon Sep 17 00:00:00 2001 From: CyberVitexus Date: Wed, 18 Dec 2024 13:02:25 +0100 Subject: [PATCH 1/5] work with foregin currency fixed --- debian/changelog | 11 +++++++++-- src/Pohoda/RaiffeisenBank/Statementor.php | 4 ++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/debian/changelog b/debian/changelog index 838aaab..9b505ea 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,15 @@ -pohoda-raiffeisenbank (1.2.0) UNRELEASED; urgency=medium +pohoda-raiffeisenbank (1.2.1) UNRELEASED; urgency=medium + * foregin currency use fix + + -- vitex Wed, 18 Dec 2024 13:02:20 +0100 + +pohoda-raiffeisenbank (1.2.0) jammy; urgency=medium + + [ vitezslav.dvorak@spojenet.cz ] * ACCOUNT_CURRENCY support added - -- Thu, 12 Dec 2024 19:46:43 +0100 + -- vitex Wed, 18 Dec 2024 13:01:26 +0100 pohoda-raiffeisenbank (1.1.3) jammy; urgency=medium diff --git a/src/Pohoda/RaiffeisenBank/Statementor.php b/src/Pohoda/RaiffeisenBank/Statementor.php index 147f45d..46b619f 100644 --- a/src/Pohoda/RaiffeisenBank/Statementor.php +++ b/src/Pohoda/RaiffeisenBank/Statementor.php @@ -105,12 +105,12 @@ public function getStatements(): array public function download(string $format): array { - return $this->obtainer->download($this->statementsDir, $this->getStatements(), $format); + return $this->obtainer->download($this->statementsDir, $this->getStatements(), $format, $this->currency); } public function downloadOne($statement, $format) { - return $this->obtainer->download($this->statementsDir, [$statement], $format); + return $this->obtainer->download($this->statementsDir, [$statement], $format, $this->currency); } /** From d72dbe882b635c72b610fb073249c39b5d1f9c6f Mon Sep 17 00:00:00 2001 From: CyberVitexus Date: Thu, 19 Dec 2024 01:28:18 +0100 Subject: [PATCH 2/5] log banner only in APP_DEBUG mode --- src/raiffeisenbank-statements-sharepoint-uploader.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/raiffeisenbank-statements-sharepoint-uploader.php b/src/raiffeisenbank-statements-sharepoint-uploader.php index 88d6cea..905c674 100644 --- a/src/raiffeisenbank-statements-sharepoint-uploader.php +++ b/src/raiffeisenbank-statements-sharepoint-uploader.php @@ -45,7 +45,9 @@ $engine->setCurrency(Shared::cfg('ACCOUNT_CURRENCY')); } -$engine->logBanner($engine->getAccount().' '.$engine->getCurrencyCode(), 'Scope: '.$engine->scope); +if(Shared::cfg('APP_DEBUG', false)){ + $engine->logBanner($engine->getAccount().' '.$engine->getCurrencyCode(), 'Scope: '.$engine->scope); +} $exitcode = 0; $fileUrls = []; $report = [ From f232047b38c733e4e2186f9d028f6e9d796cca7c Mon Sep 17 00:00:00 2001 From: CyberVitexus Date: Fri, 20 Dec 2024 11:12:35 +0100 Subject: [PATCH 3/5] release v1.2.2 --- composer.json | 2 +- debian/control | 2 +- src/pohoda-raiffeisenbank-setup.php | 5 +++-- src/pohoda-raiffeisenbank-statements.php | 2 +- src/pohoda-raiffeisenbank-transactions.php | 8 +++++--- src/pohodaSQL-raiffeisenbank-statements-sharepoint.php | 4 ++-- src/raiffeisenbank-statements-sharepoint-uploader.php | 3 ++- 7 files changed, 15 insertions(+), 11 deletions(-) diff --git a/composer.json b/composer.json index f1f79bb..c9ff160 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ "vgrem/php-spo": "^3", "vitexsoftware/pohoda-connector": "^0.5", "vitexsoftware/rbczpremiumapi": "dev-main", - "spojenet/pohoda-sql": "dev-main" + "spojenet/pohoda-sql": "^0.1" }, "autoload": { "psr-4": { diff --git a/debian/control b/debian/control index 51ab028..bbbd03f 100644 --- a/debian/control +++ b/debian/control @@ -9,7 +9,7 @@ Homepage: https://github.com/Spoje-NET/pohoda-raiffeisenbank Package: pohoda-raiffeisenbank Architecture: all Multi-Arch: foreign -Depends: ${misc:Depends}, ${shlibs:Depends}, php-vitexsoftware-rbczpremiumapi, php-spojenet-pohoda-sql, php-vitexsoftware-pohoda-connector (>= 0.5.0) +Depends: ${misc:Depends}, ${shlibs:Depends}, php-vitexsoftware-rbczpremiumapi (>=1.2.3), php-spojenet-pohoda-sql (>= 0.2), php-vitexsoftware-pohoda-connector (>= 0.5.0) Description: Import Raiffeisenbank statements into Pohoda See your Bank Account Statements in Pohoda diff --git a/src/pohoda-raiffeisenbank-setup.php b/src/pohoda-raiffeisenbank-setup.php index 201a2c9..f24c817 100644 --- a/src/pohoda-raiffeisenbank-setup.php +++ b/src/pohoda-raiffeisenbank-setup.php @@ -15,12 +15,13 @@ namespace Pohoda\RaiffeisenBank; +use Ease\Shared; + require_once '../vendor/autoload.php'; /** * Get List of bank accounts and import it into Pohoda. */ -\Ease\Shared::init(['POHODA_URL', 'POHODA_USERNAME', 'POHODA_PASSWORD', 'POHODA_ICO', 'CERT_FILE', 'CERT_PASS', 'XIBMCLIENTID'], $argv[1] ?? '../.env'); +Shared::init(['POHODA_URL', 'POHODA_USERNAME', 'POHODA_PASSWORD', 'POHODA_ICO', 'CERT_FILE', 'CERT_PASS', 'XIBMCLIENTID'], $argv[1] ?? '../.env'); $apiInstance = new \VitexSoftware\Raiffeisenbank\PremiumAPI\GetAccountsApi(); -$x_request_id = time(); // string | Unique request id provided by consumer application for reference and auditing. PohodaBankClient::checkCertificate(Shared::cfg('CERT_FILE'), Shared::cfg('CERT_PASS')); diff --git a/src/pohoda-raiffeisenbank-statements.php b/src/pohoda-raiffeisenbank-statements.php index 69680ae..295cebe 100644 --- a/src/pohoda-raiffeisenbank-statements.php +++ b/src/pohoda-raiffeisenbank-statements.php @@ -20,7 +20,7 @@ require_once '../vendor/autoload.php'; \define('APP_NAME', 'Pohoda RaiffeisenBank Statements'); - +$exitcode = 0; /** * Get today's Statements list. */ diff --git a/src/pohoda-raiffeisenbank-transactions.php b/src/pohoda-raiffeisenbank-transactions.php index 096fd1e..d49f6c5 100644 --- a/src/pohoda-raiffeisenbank-transactions.php +++ b/src/pohoda-raiffeisenbank-transactions.php @@ -15,14 +15,16 @@ namespace Pohoda\RaiffeisenBank; +use Ease\Shared; + \define('APP_NAME', 'PohodaRBTransactions'); require_once '../vendor/autoload.php'; /** * Get today's transactions list. */ -\Ease\Shared::init(['POHODA_URL', 'POHODA_USERNAME', 'POHODA_PASSWORD', 'POHODA_ICO', 'CERT_FILE', 'CERT_PASS', 'XIBMCLIENTID', 'ACCOUNT_NUMBER'], $argv[1] ?? '../.env'); +Shared::init(['POHODA_URL', 'POHODA_USERNAME', 'POHODA_PASSWORD', 'POHODA_ICO', 'CERT_FILE', 'CERT_PASS', 'XIBMCLIENTID', 'ACCOUNT_NUMBER'], $argv[1] ?? '../.env'); PohodaBankClient::checkCertificate(Shared::cfg('CERT_FILE'), Shared::cfg('CERT_PASS')); -$engine = new Transactor(\Ease\Shared::cfg('ACCOUNT_NUMBER')); -$engine->setScope(\Ease\Shared::cfg('IMPORT_SCOPE', 'yesterday')); +$engine = new Transactor(Shared::cfg('ACCOUNT_NUMBER')); +$engine->setScope(Shared::cfg('IMPORT_SCOPE', 'yesterday')); $engine->import(); diff --git a/src/pohodaSQL-raiffeisenbank-statements-sharepoint.php b/src/pohodaSQL-raiffeisenbank-statements-sharepoint.php index 192bae3..cefb3bb 100644 --- a/src/pohodaSQL-raiffeisenbank-statements-sharepoint.php +++ b/src/pohodaSQL-raiffeisenbank-statements-sharepoint.php @@ -108,7 +108,7 @@ } } } else { - if (null === $pdfStatements) { + if (is_null($pdfStatements) ) { $engine->addStatusMessage(_('Error obtaining PDF statements'), 'error'); $exitcode = 2; } else { @@ -127,7 +127,7 @@ } if ($xmlStatements) { - $inserted = $engine->import(\Ease\Shared::cfg('POHODA_BANK_IDS', '')); + $inserted = $engine->import(Shared::cfg('POHODA_BANK_IDS', '')); $report['pohoda'] = $inserted; if ($inserted) { diff --git a/src/raiffeisenbank-statements-sharepoint-uploader.php b/src/raiffeisenbank-statements-sharepoint-uploader.php index 905c674..5f58a7b 100644 --- a/src/raiffeisenbank-statements-sharepoint-uploader.php +++ b/src/raiffeisenbank-statements-sharepoint-uploader.php @@ -45,9 +45,10 @@ $engine->setCurrency(Shared::cfg('ACCOUNT_CURRENCY')); } -if(Shared::cfg('APP_DEBUG', false)){ +if (Shared::cfg('APP_DEBUG', false)) { $engine->logBanner($engine->getAccount().' '.$engine->getCurrencyCode(), 'Scope: '.$engine->scope); } + $exitcode = 0; $fileUrls = []; $report = [ From 4a1e42cfb57781e86d60e0a132ecb3782103d642 Mon Sep 17 00:00:00 2001 From: CyberVitexus Date: Fri, 20 Dec 2024 11:14:31 +0100 Subject: [PATCH 4/5] version up --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 9b505ea..b5f7744 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,8 @@ -pohoda-raiffeisenbank (1.2.1) UNRELEASED; urgency=medium +pohoda-raiffeisenbank (1.2.1) jammy; urgency=medium * foregin currency use fix - -- vitex Wed, 18 Dec 2024 13:02:20 +0100 + -- vitex Fri, 20 Dec 2024 11:13:04 +0100 pohoda-raiffeisenbank (1.2.0) jammy; urgency=medium From 1670028d1e0acd89d5c498f3c2f1ec05a1569a42 Mon Sep 17 00:00:00 2001 From: CyberVitexus Date: Sat, 21 Dec 2024 23:30:27 +0100 Subject: [PATCH 5/5] APP_DEBUG configuration added to MultiFlexi definition --- composer.json | 2 +- ...ohodasql_raiffeisenbank_sharepoint.multiflexi.app.json | 6 ++++++ ...ank_statements_sharepoint_uploader.multiflexi.app.json | 6 ++++++ src/pohodaSQL-raiffeisenbank-statements-sharepoint.php | 8 +++++--- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index c9ff160..f1f79bb 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ "vgrem/php-spo": "^3", "vitexsoftware/pohoda-connector": "^0.5", "vitexsoftware/rbczpremiumapi": "dev-main", - "spojenet/pohoda-sql": "^0.1" + "spojenet/pohoda-sql": "dev-main" }, "autoload": { "psr-4": { diff --git a/multiflexi/pohodasql_raiffeisenbank_sharepoint.multiflexi.app.json b/multiflexi/pohodasql_raiffeisenbank_sharepoint.multiflexi.app.json index 713a81e..c3db632 100644 --- a/multiflexi/pohodasql_raiffeisenbank_sharepoint.multiflexi.app.json +++ b/multiflexi/pohodasql_raiffeisenbank_sharepoint.multiflexi.app.json @@ -193,6 +193,12 @@ "defval": "", "required": false }, + "APP_DEBUG": { + "type": "checkbox", + "description": "Show debug messages", + "defval": "False", + "required": true + }, "RESULT_FILE": { "type": "string", "description": "write output json data to", diff --git a/multiflexi/raiffeisenbank_statements_sharepoint_uploader.multiflexi.app.json b/multiflexi/raiffeisenbank_statements_sharepoint_uploader.multiflexi.app.json index d224c9c..c654f3d 100644 --- a/multiflexi/raiffeisenbank_statements_sharepoint_uploader.multiflexi.app.json +++ b/multiflexi/raiffeisenbank_statements_sharepoint_uploader.multiflexi.app.json @@ -108,6 +108,12 @@ "defval": "bank_statement_upoad_{ACCOUNT_NUMBER}.json", "required": false }, + "APP_DEBUG": { + "type": "checkbox", + "description": "Show debug messages", + "defval": "False", + "required": true + }, "ZABBIX_KEY": { "type": "string", "description": "Default name for Zabbix Item key name", diff --git a/src/pohodaSQL-raiffeisenbank-statements-sharepoint.php b/src/pohodaSQL-raiffeisenbank-statements-sharepoint.php index cefb3bb..b582ef1 100644 --- a/src/pohodaSQL-raiffeisenbank-statements-sharepoint.php +++ b/src/pohodaSQL-raiffeisenbank-statements-sharepoint.php @@ -51,7 +51,10 @@ $engine->setCurrency(Shared::cfg('ACCOUNT_CURRENCY')); } -$engine->logBanner($engine->getAccount().' '.$engine->getCurrencyCode(), 'Scope: '.$engine->scope); +if (Shared::cfg('APP_DEBUG', false)) { + $engine->logBanner($engine->getAccount().' '.$engine->getCurrencyCode(), 'Scope: '.$engine->scope); +} + $exitcode = 0; $fileUrls = []; $report = [ @@ -76,7 +79,6 @@ if ($pdfStatements) { sleep(5); - $pdfStatements = $engine->getPdfStatements(); if (Shared::cfg('OFFICE365_USERNAME', false) && Shared::cfg('OFFICE365_PASSWORD', false)) { @@ -108,7 +110,7 @@ } } } else { - if (is_null($pdfStatements) ) { + if (null === $pdfStatements) { $engine->addStatusMessage(_('Error obtaining PDF statements'), 'error'); $exitcode = 2; } else {