Fix webhook transactions never been logging
This commit is contained in:
parent
25212fbd1c
commit
cd31de87e5
@ -29,15 +29,6 @@ func ImportTransaction(monobankTransaction monobank.WebHookResponse) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// check if transaction hs been logged
|
||||
isTransactionAlreadyLogged, err := LogContainsTransactionID(monobankTransaction.Data.StatementItem.Id)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if isTransactionAlreadyLogged {
|
||||
return nil
|
||||
}
|
||||
|
||||
// find accounts
|
||||
destAccount := App().Config.GetAccountByMonobankId(monobankTransaction.Data.Account)
|
||||
|
||||
|
10
webhook.go
10
webhook.go
@ -36,6 +36,16 @@ func handleWebhook(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
// check if transaction hs been logged
|
||||
isTransactionAlreadyLogged, err := app.LogContainsTransactionID(monobankTransaction.Data.StatementItem.Id)
|
||||
if err != nil {
|
||||
app.LogString(err.Error())
|
||||
return
|
||||
}
|
||||
if isTransactionAlreadyLogged {
|
||||
return
|
||||
}
|
||||
|
||||
err = app.ImportTransaction(monobankTransaction)
|
||||
if err != nil {
|
||||
app.LogString(err.Error())
|
||||
|
Loading…
x
Reference in New Issue
Block a user