24 lines
731 B
Go
24 lines
731 B
Go
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
|
|
}
|