* utf8 regexp support
* some basic matching added
This commit is contained in:
parent
12b7acaeda
commit
9fe07c3a62
@ -21,7 +21,7 @@ class KoinService
|
|||||||
* 4 - currency
|
* 4 - currency
|
||||||
* 5 - pos info
|
* 5 - pos info
|
||||||
*/
|
*/
|
||||||
const OTP_SMS_PATTERN = '#([0-9]{6}) ([0-9]{1,2}:[0-9]{1,2}) K[áà]rty[áà]s v[áà]s[áà]rl[áà]s/z[áà]rol[áà]s: -([0-9.]+) ([A-Z]{2,3}); (.*?); K[áà]rtyasz[áà]m: ...[0-9]{4}; Egyenleg: \+[0-9.]+ HUF - OTPdirekt#msi';
|
const OTP_SMS_PATTERN = '#([0-9]{6}) ([0-9]{1,2}:[0-9]{1,2}) K[áà]rty[áà]s v[áà]s[áà]rl[áà]s/z[áà]rol[áà]s: -([0-9.]+) ([A-Z]{2,3}); (.*?); K[áà]rtyasz[áà]m: ...[0-9]{4}; Egyenleg: \+[0-9.]+ HUF - OTPdirekt#msiu';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
@ -72,7 +72,7 @@ class KoinService
|
|||||||
$this->saveTransaction(
|
$this->saveTransaction(
|
||||||
intval(str_replace(".","", $otpMatches[3])),
|
intval(str_replace(".","", $otpMatches[3])),
|
||||||
$otpMatches[4],
|
$otpMatches[4],
|
||||||
"20${datePart} ${otpMatches['2']}",
|
"20${datePart}",
|
||||||
$this->getExpenseCategory($otpMatches[5]),
|
$this->getExpenseCategory($otpMatches[5]),
|
||||||
$this->getExpenseTags($otpMatches[5])
|
$this->getExpenseTags($otpMatches[5])
|
||||||
);
|
);
|
||||||
@ -86,6 +86,14 @@ class KoinService
|
|||||||
*/
|
*/
|
||||||
private function getExpenseCategory(string $posInfo): string
|
private function getExpenseCategory(string $posInfo): string
|
||||||
{
|
{
|
||||||
|
if(false !== strpos($posInfo,"MCDHU")) {
|
||||||
|
return 'Étel';
|
||||||
|
}
|
||||||
|
|
||||||
|
if(false !== strpos($posInfo,"GYOGYSZER")) {
|
||||||
|
return 'Egészség';
|
||||||
|
}
|
||||||
|
|
||||||
return self::DEFAULT_EXPENSE;
|
return self::DEFAULT_EXPENSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,7 +103,17 @@ class KoinService
|
|||||||
*/
|
*/
|
||||||
private function getExpenseTags(string $posInfo): array
|
private function getExpenseTags(string $posInfo): array
|
||||||
{
|
{
|
||||||
return [];
|
$tags = [];
|
||||||
|
|
||||||
|
if(false !== strpos($posInfo,"MCDHU")) {
|
||||||
|
$tags[] = 'Junk food';
|
||||||
|
}
|
||||||
|
if(false !== strpos($posInfo,"GYOGYSZER")) {
|
||||||
|
$tags[] = 'Gyógyszer';
|
||||||
|
}
|
||||||
|
|
||||||
|
$tags[] = 'Auto';
|
||||||
|
return $tags;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user