lib/api/metrc-gw/metrc_gw_models/sales_receipt.go

162 lines
3.7 KiB
Go
Raw Normal View History

2021-01-08 17:40:28 +00:00
// Code generated by go-swagger; DO NOT EDIT.
2021-01-19 16:58:40 +00:00
// All Code Copyright(c) 2018-2021 by Taxnexus, Inc.
2021-01-08 17:40:28 +00:00
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed
package metrc_gw_models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
2021-02-09 16:56:57 +00:00
"context"
2021-01-08 17:40:28 +00:00
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// SalesReceipt sales receipt
//
// swagger:model SalesReceipt
type SalesReceipt struct {
// archived date
2021-02-09 16:56:57 +00:00
// Example: string
2021-01-08 17:40:28 +00:00
ArchivedDate string `json:"ArchivedDate,omitempty"`
// caregiver license number
CaregiverLicenseNumber string `json:"CaregiverLicenseNumber,omitempty"`
// Id
2021-02-09 16:56:57 +00:00
// Example: 38304110
2021-01-08 17:40:28 +00:00
ID float64 `json:"Id,omitempty"`
// identification method
IdentificationMethod string `json:"IdentificationMethod,omitempty"`
// is final
2021-02-09 16:56:57 +00:00
// Example: false
2021-01-08 17:40:28 +00:00
IsFinal bool `json:"IsFinal,omitempty"`
// last modified
2021-02-09 16:56:57 +00:00
// Example: 2019-02-14T23:52:31+00:00
2021-01-08 17:40:28 +00:00
LastModified string `json:"LastModified,omitempty"`
// patient license number
PatientLicenseNumber string `json:"PatientLicenseNumber,omitempty"`
// receipt number
2021-02-09 16:56:57 +00:00
// Example: 38304110
2021-01-08 17:40:28 +00:00
ReceiptNumber string `json:"ReceiptNumber,omitempty"`
// sales customer type
2021-02-09 16:56:57 +00:00
// Example: Consumer
2021-01-08 17:40:28 +00:00
SalesCustomerType string `json:"SalesCustomerType,omitempty"`
// sales date time
2021-02-09 16:56:57 +00:00
// Example: 2019-02-14T15:50:45.000
2021-01-08 17:40:28 +00:00
SalesDateTime string `json:"SalesDateTime,omitempty"`
// total packages
2021-02-09 16:56:57 +00:00
// Example: 3
2021-01-08 17:40:28 +00:00
TotalPackages float64 `json:"TotalPackages,omitempty"`
// total price
2021-02-09 16:56:57 +00:00
// Example: 60.83
2021-01-08 17:40:28 +00:00
TotalPrice float64 `json:"TotalPrice,omitempty"`
// transactions
Transactions []*Transaction `json:"Transactions"`
}
// Validate validates this sales receipt
func (m *SalesReceipt) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateTransactions(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *SalesReceipt) validateTransactions(formats strfmt.Registry) error {
if swag.IsZero(m.Transactions) { // not required
return nil
}
for i := 0; i < len(m.Transactions); i++ {
if swag.IsZero(m.Transactions[i]) { // not required
continue
}
if m.Transactions[i] != nil {
if err := m.Transactions[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Transactions" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
2021-02-09 16:56:57 +00:00
// ContextValidate validate this sales receipt based on the context it is used
func (m *SalesReceipt) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateTransactions(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *SalesReceipt) contextValidateTransactions(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(m.Transactions); i++ {
if m.Transactions[i] != nil {
if err := m.Transactions[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Transactions" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
2021-01-08 17:40:28 +00:00
// MarshalBinary interface implementation
func (m *SalesReceipt) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *SalesReceipt) UnmarshalBinary(b []byte) error {
var res SalesReceipt
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}