29 lines
832 B
Go
29 lines
832 B
Go
|
package app
|
||
|
|
||
|
import (
|
||
|
"code.tnxs.net/taxnexus/lib/api/regs/regs_client/transaction"
|
||
|
"code.tnxs.net/taxnexus/lib/api/regs/regs_models"
|
||
|
)
|
||
|
|
||
|
// PostTransactions is a first class object type storage method
|
||
|
func PostTransactions(objList []*TaxTransaction, principal *User) error {
|
||
|
swagList := []*regs_models.Transaction{}
|
||
|
for _, itm := range objList {
|
||
|
swagList = append(swagList, ®s_models.Transaction{
|
||
|
AccountID: itm.AccountID,
|
||
|
TaxTransactionID: itm.ID,
|
||
|
TaxTypeID: itm.TaxTypeID,
|
||
|
Valid: true,
|
||
|
})
|
||
|
}
|
||
|
regsParams := transaction.NewPostTransactionsParamsWithTimeout(postTimeout)
|
||
|
regsParams.TransactionRequest = ®s_models.TransactionRequest{
|
||
|
Data: swagList,
|
||
|
}
|
||
|
_, err := regsClient.Transaction.PostTransactions(regsParams, principal.Auth)
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
return nil
|
||
|
}
|