lib/app/invoice-services.go

24 lines
731 B
Go
Raw Normal View History

2021-01-28 18:05:25 +00:00
package app
import (
"code.tnxs.net/taxnexus/lib/api/ops/ops_client/invoice"
"code.tnxs.net/taxnexus/lib/api/ops/ops_models"
)
// GetInvoiceByID is a first class object retrieval method
func GetInvoiceByID(recordID string, principal *User) (*ops_models.Invoice, error) {
sugar.Debugf("app.getFilingByID: 📥")
opsParams := invoice.NewGetInvoicesParamsWithTimeout(getTimeout)
opsParams.InvoiceID = &recordID
response, err := opsClient.Invoice.GetInvoices(opsParams, principal.Auth)
if err != nil {
sugar.Errorf("app.getInvoiceByID: 💣 ⛔ opsClient.Invoice.GetInvoices error %w", err)
return nil, err
}
swag := &ops_models.Invoice{}
for _, itm := range response.Payload.Data {
swag = itm
}
return swag, nil
}