From 9a90f18d58a84f3d7812b17fc9d6ad62b1527f62 Mon Sep 17 00:00:00 2001 From: Vernon Keenan Date: Mon, 1 Feb 2021 21:13:14 -0800 Subject: [PATCH] je --- app/journalentry-services.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 app/journalentry-services.go 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 +}