diff --git a/src/App/Service/KoinService.php b/src/App/Service/KoinService.php index 572865d..47bd5ec 100644 --- a/src/App/Service/KoinService.php +++ b/src/App/Service/KoinService.php @@ -22,7 +22,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#msiu'; + 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 @@ -76,7 +76,7 @@ class KoinService $datePart = implode("-", sscanf($otpMatches[1], '%2c%2c%2c')); $this->saveTransaction( - intval(str_replace(".", "", $otpMatches[3])), + str_replace(",", ".", str_replace(".", "", $otpMatches[3])), $otpMatches[4], "20${datePart}", $this->getExpenseCategory($otpMatches[5]), @@ -223,14 +223,14 @@ class KoinService } /** - * @param int $amount + * @param string $amount * @param string $currency * @param string $date * @param string $category * @param array $tags * @return int */ - public function saveTransaction(int $amount, + public function saveTransaction(string $amount, string $currency = 'HUF', string $date, string $category, @@ -323,14 +323,14 @@ class KoinService } /** - * @param int $amount + * @param string $amount * @param string $currency * @param string $date * @param string $category * @param string $tags * @return int */ - private function postData(int $amount, string $currency = 'HUF', string $date, string $category, string $tags): int + private function postData(string $amount, string $currency = 'HUF', string $date, string $category, string $tags): int { $saveResponse = $this->httpClient ->post(self::BASE_URI . "/main/save-transaction", [