diff --git a/app/journalentry-services.go b/app/journalentry-services.go new file mode 100644 index 0000000..77441d5 --- /dev/null +++ b/app/journalentry-services.go @@ -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 +}