lib/api/sf-gate/sf_gate_models/purchase_order.go

290 lines
6.4 KiB
Go
Raw Permalink 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 sf_gate_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"
)
// PurchaseOrder purchase order
//
// swagger:model PurchaseOrder
type PurchaseOrder struct {
// accountid
Accountid string `json:"accountid,omitempty"`
// creditcardid
Creditcardid string `json:"creditcardid,omitempty"`
// Date Expires
DateExpires string `json:"date_expires,omitempty"`
// Date Promised
DatePromised string `json:"date_promised,omitempty"`
// Date Requested
DateRequested string `json:"date_requested,omitempty"`
// Description
Description string `json:"description,omitempty"`
// Due Date
Duedate string `json:"duedate,omitempty"`
// enduserid
Enduserid string `json:"enduserid,omitempty"`
// Grand Total
GrandTotal float64 `json:"grand_total,omitempty"`
// Taxnexus Record Id
ID string `json:"id,omitempty"`
// items
Items []*PurchaseOrderItem `json:"items"`
// Line Item Count
Lineitemcount int64 `json:"lineitemcount,omitempty"`
// Opportunity Name
Opportunityid string `json:"opportunityid,omitempty"`
// Order Number
Orderid string `json:"orderid,omitempty"`
// The record identifier from the source system
Parentfk string `json:"parentfk,omitempty"`
// Payment Terms
Paymentterms string `json:"paymentterms,omitempty"`
// Date
Podate string `json:"podate,omitempty"`
// Number
Ponumber string `json:"ponumber,omitempty"`
// Posted
Posted bool `json:"posted,omitempty"`
// Quote Name
Quoteid string `json:"quoteid,omitempty"`
// Addl Tax
SalesTax float64 `json:"sales_tax,omitempty"`
// Sales Regulation Type (Medicinal or Recreational)
Salesregulation string `json:"salesregulation,omitempty"`
// Service Term
ServiceTerm string `json:"service_term,omitempty"`
// Ship Date
ShipDate string `json:"ship_date,omitempty"`
// Shipping Country
ShippingCountry string `json:"shipping_country,omitempty"`
// Shipping Special Instructions
ShippingSpecialInstructions string `json:"shipping_special_instructions,omitempty"`
// Shipping Address
Shippingaddress string `json:"shippingaddress,omitempty"`
// Shipping City
Shippingcity string `json:"shippingcity,omitempty"`
// shippingcontactid
Shippingcontactid string `json:"shippingcontactid,omitempty"`
// Shipping & Handling
Shippinghandling float64 `json:"shippinghandling,omitempty"`
// Shipping Postal Code
Shippingpostalcode string `json:"shippingpostalcode,omitempty"`
// Shipping State
Shippingstate string `json:"shippingstate,omitempty"`
// Shipping Street
Shippingstreet string `json:"shippingstreet,omitempty"`
// Status
Status string `json:"status,omitempty"`
// Subtotal
Subtotal float64 `json:"subtotal,omitempty"`
// Taxable?
Taxable string `json:"taxable,omitempty"`
// The taxes associated with this Purchase Order
Taxitems []*TaxTransaction `json:"taxitems"`
// tenant identifier
Tenantid string `json:"tenantid,omitempty"`
// Total Price
Totalprice float64 `json:"totalprice,omitempty"`
// Type
Type string `json:"type,omitempty"`
// vendorid
Vendorid string `json:"vendorid,omitempty"`
// Vendor Quote Number
Vendorquotenumber string `json:"vendorquotenumber,omitempty"`
}
// Validate validates this purchase order
func (m *PurchaseOrder) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateItems(formats); err != nil {
res = append(res, err)
}
if err := m.validateTaxitems(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *PurchaseOrder) validateItems(formats strfmt.Registry) error {
if swag.IsZero(m.Items) { // not required
return nil
}
for i := 0; i < len(m.Items); i++ {
if swag.IsZero(m.Items[i]) { // not required
continue
}
if m.Items[i] != nil {
if err := m.Items[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("items" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *PurchaseOrder) validateTaxitems(formats strfmt.Registry) error {
if swag.IsZero(m.Taxitems) { // not required
return nil
}
for i := 0; i < len(m.Taxitems); i++ {
if swag.IsZero(m.Taxitems[i]) { // not required
continue
}
if m.Taxitems[i] != nil {
if err := m.Taxitems[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("taxitems" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
2021-02-09 16:56:57 +00:00
// ContextValidate validate this purchase order based on the context it is used
func (m *PurchaseOrder) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateItems(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateTaxitems(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *PurchaseOrder) contextValidateItems(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(m.Items); i++ {
if m.Items[i] != nil {
if err := m.Items[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("items" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *PurchaseOrder) contextValidateTaxitems(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(m.Taxitems); i++ {
if m.Taxitems[i] != nil {
if err := m.Taxitems[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("taxitems" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
2021-01-08 17:40:28 +00:00
// MarshalBinary interface implementation
func (m *PurchaseOrder) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *PurchaseOrder) UnmarshalBinary(b []byte) error {
var res PurchaseOrder
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}