parent
50901b818f
commit
9a90f18d58
|
@ -0,0 +1,22 @@
|
||||||
|
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
|
||||||
|
}
|
Loading…
Reference in New Issue