lib/app/journalentry-services.go

23 lines
766 B
Go

package app
import (
"code.tnxs.net/taxnexus/lib/api/ledger/ledger_client/journal_entry"
"code.tnxs.net/taxnexus/lib/api/ledger/ledger_models"
)
// PostJournalEntries is a first class object helper method
func PostJournalEntries(objList []*ledger_models.JournalEntry, principal *User) error {
sugar.Debugf("ops.postJournalEntries: 📥 len=%d", len(objList))
params := journal_entry.NewPostJournalEntriesParamsWithTimeout(postTimeout)
params.JournalEntryRequest = &ledger_models.JournalEntryRequest{
Data: objList,
}
sugar.Debugf("ops.postJournalEntries: ⏱ wait for ledger")
_, err := ledgerClient.JournalEntry.PostJournalEntries(params, principal.Auth)
if err != nil {
return err
}
sugar.Infof("ops.postJournalEntries: 👍 📤")
return nil
}