auto: 일일 백업 2026-06-29 02:00
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -135,8 +135,32 @@ KAKAOBANK_RE = re.compile(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
KAKAOBANK_CARD_RE = re.compile(
|
||||||
|
r"\[Web발신\]\s*\[카카오뱅크\]\s+카드결제\s+"
|
||||||
|
r"(?P<card>\S+)\s+"
|
||||||
|
r"(?P<md>\d{2}/\d{2})\s+(?P<hm>\d{2}:\d{2})\s+"
|
||||||
|
r"(?P<amount>[\d,]+)원\s+"
|
||||||
|
r"(?P<merchant>[^\n]+?)"
|
||||||
|
r"(?:\s+잔액\s+(?P<balance>[\d,]+)원?)?\s*$",
|
||||||
|
re.DOTALL,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def parse_kakao_bank(raw: str, created_at: str) -> "dict | None":
|
def parse_kakao_bank(raw: str, created_at: str) -> "dict | None":
|
||||||
text = _normalize(raw)
|
text = _normalize(raw)
|
||||||
|
card = KAKAOBANK_CARD_RE.search(text)
|
||||||
|
if card:
|
||||||
|
result = {
|
||||||
|
"kind": "withdrawal",
|
||||||
|
"entry_date": _iso_to_kst_date(created_at),
|
||||||
|
"amount": int(card.group("amount").replace(",", "")),
|
||||||
|
"merchant": _normalize(card.group("merchant")).split("\n")[0].strip() or "(메모없음)",
|
||||||
|
"raw": raw,
|
||||||
|
}
|
||||||
|
if card.group("balance"):
|
||||||
|
result["balance"] = int(card.group("balance").replace(",", ""))
|
||||||
|
return result
|
||||||
|
|
||||||
m = KAKAOBANK_RE.search(text)
|
m = KAKAOBANK_RE.search(text)
|
||||||
if not m:
|
if not m:
|
||||||
return None
|
return None
|
||||||
|
|||||||
Reference in New Issue
Block a user