* indent fix

* added some more reoccuring pos info
This commit is contained in:
Danyi Dávid 2017-10-01 13:39:18 +02:00
parent 65a5757df9
commit 1ee6969b0e

View File

@ -76,7 +76,7 @@ class KoinService
$datePart = implode("-", sscanf($otpMatches[1], '%2c%2c%2c'));
$this->saveTransaction(
intval(str_replace(".","", $otpMatches[3])),
intval(str_replace(".", "", $otpMatches[3])),
$otpMatches[4],
"20${datePart}",
$this->getExpenseCategory($otpMatches[5]),
@ -92,18 +92,55 @@ class KoinService
*/
private function getExpenseCategory(string $posInfo): string
{
if(false !== strpos($posInfo, "TESCO")) {
return 'Bevásárlás';
}
if(false !== strpos($posInfo, "MCDHU")) {
if (false !== strpos($posInfo, "STOCZEK ETTEREM")) {
return 'Étel';
}
if(false !== strpos($posInfo, "GYOGYSZER")) {
if (false !== strpos($posInfo, "BKK AUTOMATA")) {
return 'Közlekedés';
}
if (false !== strpos($posInfo, "TESCO")) {
return 'Bevásárlás';
}
if (false !== strpos($posInfo, "SPAR MAGYARORSZAG")) {
return 'Étel';
}
if (false !== strpos($posInfo, "SZLOVàK ABC")) {
return 'Bevásárlás';
}
if (false !== strpos($posInfo, "MCDHU")) {
return 'Étel';
}
if (false !== strpos($posInfo, "OSMANI DÖNER KEBAB")) {
return 'Étel';
}
if (false !== strpos($posInfo, "Princess Bakery")) {
return 'Étel';
}
if (false !== strpos($posInfo, "PIROG-DA")) {
return 'Étel';
}
if (false !== strpos($posInfo, "GYOGYSZER")) {
return 'Egészség';
}
if (false !== strpos($posInfo, "GOOGLE *Google Music")) {
return 'Szórakozás';
}
if (false !== strpos($posInfo, "Aqua Electromax")) {
return 'Szórakozás';
}
return self::DEFAULT_EXPENSE;
}
@ -115,16 +152,64 @@ class KoinService
{
$tags = [];
if(false !== strpos($posInfo, "TESCO")) {
if (false !== strpos($posInfo, "SCIENCE PARK ÉTTEREM")) {
$tags[] = 'Science Park';
$tags[] = 'Menza';
}
if (false !== strpos($posInfo, "STOCZEK ETTEREM")) {
$tags[] = "Stoczek";
$tags[] = "Menza";
}
if (false !== strpos($posInfo, "BKK AUTOMATA")) {
$tags[] = "Bérlet";
$tags[] = "BKV";
}
if (false !== strpos($posInfo, "SPAR MAGYARORSZAG")) {
$tags[] = 'Spar';
}
if (false !== strpos($posInfo, "TESCO")) {
$tags[] = 'Tesco';
}
if(false !== strpos($posInfo, "MCDHU")) {
if (false !== strpos($posInfo, "SZLOVàK ABC")) {
$tags[] = 'Szlovák ABC';
}
if (false !== strpos($posInfo, "MCDHU")) {
$tags[] = 'Junk food';
}
if(false !== strpos($posInfo, "GYOGYSZER")) {
if (false !== strpos($posInfo, "OSMANI DÖNER KEBAB")) {
$tags[] = 'Kebab';
$tags[] = 'Junk food';
}
if (false !== strpos($posInfo, "Princess Bakery")) {
$tags[] = 'Pricess Bakery';
$tags[] = 'Junk food';
}
if (false !== strpos($posInfo, "PIROG-DA")) {
$tags[] = 'Pirog-da';
$tags[] = 'Junk food';
}
if (false !== strpos($posInfo, "GYOGYSZER")) {
$tags[] = 'Gyógyszer';
}
if (false !== strpos($posInfo, "GOOGLE *Google Music")) {
$tags[] = 'Google play';
}
if (false !== strpos($posInfo, "Aqua Electromax")) {
$tags[] = 'Aqua';
}
$tags[] = 'Auto';
return $tags;
}
@ -137,7 +222,11 @@ class KoinService
* @param array $tags
* @return int
*/
public function saveTransaction(int $amount, string $currency = 'HUF', string $date, string $category, array $tags): int
public function saveTransaction(int $amount,
string $currency = 'HUF',
string $date,
string $category,
array $tags): int
{
$pageData = $this->login($this->config['koin.user'], $this->config['koin.pass']);
@ -266,7 +355,7 @@ class KoinService
*/
private function getCategoryId(string $category): string
{
if(in_array($category, array_keys($this->expenseCategories))) {
if (in_array($category, array_keys($this->expenseCategories))) {
return $this->expenseCategories[$category];
}
return $this->expenseCategories[self::DEFAULT_EXPENSE];