Revision: 4380 Author: hans URL: http://bknr.net/trac/changeset/4380
Send bank account updates through SMS
A trunk/projects/poll-postbank.lisp/ A trunk/projects/poll-postbank.lisp/poll-postbank.lisp
Added: trunk/projects/poll-postbank.lisp/poll-postbank.lisp =================================================================== --- trunk/projects/poll-postbank.lisp/poll-postbank.lisp (rev 0) +++ trunk/projects/poll-postbank.lisp/poll-postbank.lisp 2009-04-16 06:25:46 UTC (rev 4380) @@ -0,0 +1,35 @@ + +(defun poll-postbank (kontonummer password) + (let ((headers (nth-value 2 + (drakma:http-request "https://banking.postbank.de/app/login.do" + :method :post + :parameters (list (cons "accountNumber" kontonummer) + (cons "pinNumber" password)))))) + (cl-ppcre:register-groups-bind (jsessionid) (".*jsessionid=([^;]*)" + (or (cdr (assoc :location headers)) + (error "no Location header found in response"))) + (flexi-streams:octets-to-string + (drakma:http-request (format nil "https://banking.postbank.de/app/kontoumsatz.umsatz.init.do;jsessionid=~A?~ + action=download&cache=true&konto=~A" + jsessionid kontonummer)))))) + +(defun umsatz-xml (kontonummer password) + (cxml:with-xml-output (cxml:make-character-stream-sink *standard-output*) + (cxml:with-element "Kontostatus" + (let ((in-header t)) + (cl-ppcre:do-matches-as-strings (line ".*(?>\r?\n)" (poll-postbank kontonummer password)) + (cond + (in-header + (cond + ((cl-ppcre:scan "^Datum" line) + (setf in-header nil)))) + (t + (cxml:with-element "Umsatz" + (loop + for name in '("Datum" "Wertstellung" "Art" "Buchungshinweis" "Auftraggeber" "Empfaenger" "Betrag" "Saldo") + for value in (cl-ppcre:split "\t" line) + do (cxml:with-element name + (cxml:text value))))))))))) + +(defun umsatz-plist (kontonummer password) + ) \ No newline at end of file