Add docker deploy
All checks were successful
build docker image / docker-build (push) Successful in 1m32s

This commit is contained in:
Illya Marchenko 2024-11-04 21:58:44 +02:00
parent 38b4e89a02
commit 686c46bf78
Signed by: stuzer05
GPG Key ID: A6ABAAA9268F9F4F

@ -9,6 +9,10 @@ import (
) )
func handleWebhook(w http.ResponseWriter, r *http.Request) { func handleWebhook(w http.ResponseWriter, r *http.Request) {
// Parse URL query parameters
queryParams := r.URL.Query()
isRetry := queryParams.Get("retry") == "true"
// read request body bytes // read request body bytes
body, err := io.ReadAll(r.Body) body, err := io.ReadAll(r.Body)
if err != nil { if err != nil {
@ -36,14 +40,16 @@ func handleWebhook(w http.ResponseWriter, r *http.Request) {
return return
} }
// check if transaction hs been logged // only check for logged transaction if not a retry
isTransactionAlreadyLogged, err := app.LogContainsTransactionID(monobankTransaction.Data.StatementItem.Id) if !isRetry {
if err != nil { isTransactionAlreadyLogged, err := app.LogContainsTransactionID(monobankTransaction.Data.StatementItem.Id)
app.LogString(err.Error()) if err != nil {
return app.LogString(err.Error())
} return
if isTransactionAlreadyLogged { }
return if isTransactionAlreadyLogged {
return
}
} }
err = app.ImportTransaction(monobankTransaction) err = app.ImportTransaction(monobankTransaction)