Skip to content

Commit

Permalink
Merge pull request #310 from Ubiquiti-App/feature/fio-plugin-90-day-fix
Browse files Browse the repository at this point in the history
FIO plugin fix for new 90 day limit
  • Loading branch information
janprochazkacz authored Oct 31, 2023
2 parents 7776fd2 + 94dcd1f commit c401676
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 13 deletions.
Binary file modified plugins/fio_cz/fio_cz.zip
Binary file not shown.
24 changes: 15 additions & 9 deletions plugins/fio_cz/src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"displayName": "Fio bank payment import",
"description": "This plugin enables you to import payments from Fio bank to UCRM. See https://www.fio.cz/bankovni-sluzby/api-bankovnictvi",
"url": "https://github.com/Ubiquiti-App/UCRM-plugins/tree/master/plugins/fio_cz",
"version": "1.2.0",
"version": "1.2.8",
"unmsVersionCompliancy": {
"min": "2.1.0",
"max": null
Expand All @@ -17,37 +17,43 @@
"key": "token",
"label": "Fio token",
"description": "Token obtained from Fio bank internet banking. NOTE: the bank can issue the token with an expiration date, or without one (expired tokens will result in error 500, brand new tokens will return error 500 for a few minutes). Please do not reuse one token for multiple apps - generate one token for each, Fio bank's API usage limits are per token (exceeding limits will result in error 409).",
"required": 1
"required": 1,
"type": "text"
},
{
"key": "startDate",
"label": "Payments start date",
"description": "Payments older than this date will be ignored. Use d.m.Y format.",
"required": 1
"description": "Payments older than this date will be ignored. Import of payments older than 90 days must be enabled in the Fio bank interface.",
"required": 1,
"type": "datetime"
},
{
"key": "paymentMatchAttribute",
"label": "Match attribute from payment variable symbol to UCRM",
"description": "Can be 'invoiceNumber', 'clientId', 'clientUserIdent' or a custom attribute key.",
"required": 1
"required": 1,
"type": "text"
},
{
"key": "importUnattached",
"label": "Import all payments. (0|1)",
"label": "Import all payments.",
"description": "Import all payments. Payments without match will be imported as \"Unattached payments\". Fill 1 to enable or 0 to disable this feature (when disabled, the unmatched payment will only be logged and skipped).",
"required": 1
"required": 1,
"type": "checkbox"
},
{
"key": "lastProcessedPayment",
"label": "Last processed payment",
"description": "Internal payment tracking to avoid duplicate processing of the same payment",
"required": 0
"required": 0,
"type": "text"
},
{
"key": "lastProcessedTimestamp",
"label": "Last time the payment list was requested",
"description": "Internal timestamp tracking to politely avoid API request rate limits",
"required": 0
"required": 0,
"type": "text"
}
]
}
5 changes: 5 additions & 0 deletions plugins/fio_cz/src/src/Data/PluginData.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,9 @@ class PluginData extends UcrmData
* @var string
*/
public $importUnattached;

/**
* @var string
*/
public $lastProcessedPaymentDateTime;
}
1 change: 1 addition & 0 deletions plugins/fio_cz/src/src/Facade/UcrmFacade.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public function import(
);

$optionsData->lastProcessedPayment = $transaction['id'];
$optionsData->lastProcessedPaymentDateTime = $transaction['date'];
$this->optionsManager->updateOptions();
$this->logger->debug(sprintf('lastProcessedPayment set to %s', $optionsData->lastProcessedPayment));

Expand Down
4 changes: 4 additions & 0 deletions plugins/fio_cz/src/src/Importer.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ public function import(): void
return;
}

if ($optionsData->lastProcessedPaymentDateTime !== null) {
$startDate = new \DateTimeImmutable($optionsData->lastProcessedPaymentDateTime);
}

$this->logger->debug('Processing range: ', [
'startDate' => $startDate->format($this->dateFormat),
'endDate' => $endDate->format($this->dateFormat),
Expand Down
2 changes: 1 addition & 1 deletion plugins_2.1.x.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"displayName": "Fio bank payment import",
"description": "This plugin enables you to import payments from Fio bank to UCRM. See https:\/\/www.fio.cz\/bankovni-sluzby\/api-bankovnictvi",
"url": "https:\/\/github.com\/Ubiquiti-App\/UCRM-plugins\/tree\/master\/plugins\/fio_cz",
"version": "1.2.7",
"version": "1.2.8",
"unmsVersionCompliancy": {
"min": "2.1.0",
"max": null
Expand Down
2 changes: 1 addition & 1 deletion plugins_2.2.x.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"displayName": "Fio bank payment import",
"description": "This plugin enables you to import payments from Fio bank to UCRM. See https:\/\/www.fio.cz\/bankovni-sluzby\/api-bankovnictvi",
"url": "https:\/\/github.com\/Ubiquiti-App\/UCRM-plugins\/tree\/master\/plugins\/fio_cz",
"version": "1.2.7",
"version": "1.2.8",
"unmsVersionCompliancy": {
"min": "2.1.0",
"max": null
Expand Down
2 changes: 1 addition & 1 deletion plugins_2.3.x.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"displayName": "Fio bank payment import",
"description": "This plugin enables you to import payments from Fio bank to UCRM. See https:\/\/www.fio.cz\/bankovni-sluzby\/api-bankovnictvi",
"url": "https:\/\/github.com\/Ubiquiti-App\/UCRM-plugins\/tree\/master\/plugins\/fio_cz",
"version": "1.2.7",
"version": "1.2.8",
"unmsVersionCompliancy": {
"min": "2.1.0",
"max": null
Expand Down
2 changes: 1 addition & 1 deletion plugins_2.4.x.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"displayName": "Fio bank payment import",
"description": "This plugin enables you to import payments from Fio bank to UCRM. See https:\/\/www.fio.cz\/bankovni-sluzby\/api-bankovnictvi",
"url": "https:\/\/github.com\/Ubiquiti-App\/UCRM-plugins\/tree\/master\/plugins\/fio_cz",
"version": "1.2.7",
"version": "1.2.8",
"unmsVersionCompliancy": {
"min": "2.1.0",
"max": null
Expand Down

0 comments on commit c401676

Please sign in to comment.