Add "--monobank-transaction" command

This commit is contained in:
2024-03-30 16:49:51 +02:00
parent f81bcdcadf
commit 876edee3a7
3 changed files with 43 additions and 12 deletions

View File

@ -85,7 +85,12 @@ func handleWebhook(w http.ResponseWriter, r *http.Request) {
}
// find matching transaction to delete
isDeleted := false
for _, tRows := range oldTransactions.Data {
if isDeleted {
break
}
for _, tRow := range tRows.Attributes.Transactions {
// validate notes is json
notesBytes := bytes.NewBufferString(tRow.Notes).Bytes()
@ -107,6 +112,8 @@ func handleWebhook(w http.ResponseWriter, r *http.Request) {
// delete transaction
opts := firefly3.TransactionsApiDeleteTransactionOpts{}
firefly3Client.TransactionsApi.DeleteTransaction(context.Background(), tRows.Id, &opts)
isDeleted = true
}
}
}