diff --git a/src/App/Service/KoinService.php b/src/App/Service/KoinService.php index 7b5243a..b3d2081 100644 --- a/src/App/Service/KoinService.php +++ b/src/App/Service/KoinService.php @@ -21,7 +21,7 @@ class KoinService * 4 - currency * 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 @@ -72,7 +72,7 @@ class KoinService $this->saveTransaction( intval(str_replace(".","", $otpMatches[3])), $otpMatches[4], - "20${datePart} ${otpMatches['2']}", + "20${datePart}", $this->getExpenseCategory($otpMatches[5]), $this->getExpenseTags($otpMatches[5]) ); @@ -86,6 +86,14 @@ class KoinService */ 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; } @@ -95,7 +103,17 @@ class KoinService */ 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; } /**