lib/app/total-helpers.go

39 lines
1.1 KiB
Go
Raw Normal View History

2021-01-14 06:36:35 +00:00
package app
import "code.tnxs.net/taxnexus/lib/api/ops/ops_models"
2021-01-18 03:13:54 +00:00
// MarshalToSwagger encodes first class object
2021-01-14 06:36:35 +00:00
func (obj *Total) MarshalToSwagger() *ops_models.Total {
var items []*ops_models.TotalItem
if obj.TotalItems != nil {
items = []*ops_models.TotalItem{}
for _, itm := range obj.TotalItems {
items = append(items, &ops_models.TotalItem{
ID: itm.ID,
Amount: itm.Amount,
Count: itm.Count,
DisplayName: itm.DisplayName,
TenantID: itm.TenantID,
})
}
}
return &ops_models.Total{
ID: obj.ID,
Amount: obj.Amount,
BusinessTax: obj.BusinessTax,
BusinessTaxRate: obj.BusinessTaxRate,
CannabisTax: obj.CannabisTax,
CannabisTaxRate: obj.CannabisTaxRate,
Items: items,
MonthlyAmount: obj.MonthlyAmount,
ObjectType: obj.ObjectType,
PurchaseAmount: obj.PurchaseAmount,
SalesTaxRate: obj.SalesTaxRate,
SalesTax: obj.SalesTax,
ShippingHandling: obj.ShippingHandling,
Subtotal: obj.Subtotal,
TelecomTax: obj.TelecomTax,
TelecomTaxRate: obj.TelecomTaxRate,
}
}