fourth_pos

package module
v0.0.0-...-334dbba Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 20, 2025 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BaseURL = url.URL{
		Scheme: "https",
		Host:   "api.fourth.com",
		Path:   "api/eposgateway",
	}
)

Functions

func CheckResponse

func CheckResponse(r *http.Response) error

CheckResponse checks the Client response for errors, and returns them if present. A response is considered an error if it has a status code outside the 200 range. Client error responses are expected to have either no response body, or a json response body that maps to ErrorResponse. Any other response body will be silently ignored.

func CreateFormFile

func CreateFormFile(w *multipart.Writer, data io.Reader, fieldname, filename string) (io.Writer, error)

func GetFileContentType

func GetFileContentType(file io.Reader) (string, error)

Types

type BoolToNumber

type BoolToNumber bool

func (BoolToNumber) MarshalSchema

func (b BoolToNumber) MarshalSchema() string

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client manages communication with InvoiceXpress Client

func NewClient

func NewClient(httpClient *http.Client) *Client

func (*Client) BaseURL

func (c *Client) BaseURL() url.URL

func (*Client) Charset

func (c *Client) Charset() string

func (*Client) Debug

func (c *Client) Debug() bool

func (*Client) Do

func (c *Client) Do(req *http.Request, responseBody interface{}) (*http.Response, error)

Do sends an Client request and returns the Client response. The Client response is json decoded and stored in the value pointed to by v, or returned as an error if an Client error has occurred. If v implements the io.Writer interface, the raw response will be written to v, without attempting to decode it.

func (*Client) GetEndpointURL

func (c *Client) GetEndpointURL(relative string, pathParams PathParams) url.URL

func (*Client) MediaType

func (c *Client) MediaType() string

func (*Client) NewRequest

func (c *Client) NewRequest(ctx context.Context, req Request) (*http.Request, error)

func (*Client) NewSendFilesFormParams

func (c *Client) NewSendFilesFormParams() *SendFilesFormParams

func (*Client) NewSendFilesPathParams

func (c *Client) NewSendFilesPathParams() *SendFilesPathParams

func (*Client) NewSendFilesQueryParams

func (c *Client) NewSendFilesQueryParams() *SendFilesQueryParams

func (*Client) NewSendFilesRequest

func (c *Client) NewSendFilesRequest() SendFilesRequest

func (*Client) NewSendFilesRequestBody

func (s *Client) NewSendFilesRequestBody() SendFilesRequestBody

func (*Client) PMSCode

func (c *Client) PMSCode() string

func (*Client) SetBaseURL

func (c *Client) SetBaseURL(baseURL url.URL)

func (*Client) SetCharset

func (c *Client) SetCharset(charset string)

func (*Client) SetDebug

func (c *Client) SetDebug(debug bool)

func (*Client) SetDisallowUnknownFields

func (c *Client) SetDisallowUnknownFields(disallowUnknownFields bool)

func (*Client) SetMediaType

func (c *Client) SetMediaType(mediaType string)

func (*Client) SetPMSCode

func (c *Client) SetPMSCode(pmsCode string)

func (*Client) SetUserAgent

func (c *Client) SetUserAgent(userAgent string)

func (*Client) Unmarshal

func (c *Client) Unmarshal(r io.Reader, vv ...interface{}) error

func (*Client) UserAgent

func (c *Client) UserAgent() string

type Date

type Date struct {
	time.Time
}

func (*Date) MarshalJSON

func (d *Date) MarshalJSON() ([]byte, error)

func (Date) MarshalSchema

func (d Date) MarshalSchema() string

type DateTime

type DateTime struct {
	time.Time
}

func (DateTime) MarshalSchema

func (d DateTime) MarshalSchema() string

func (*DateTime) UnmarshalJSON

func (d *DateTime) UnmarshalJSON(text []byte) error

type ErrorResponse

type ErrorResponse struct {
	// HTTP response that caused this error
	Response *http.Response

	ValidationErrors []ValidationError
	Errors           Errors `json:"errors"`
	Message          string `json:"message"`
	Type             string `json:"type"`
	Title            string `json:"title"`
	Status           int    `json:"status"`
	TraceID          string `json:"traceId"`
}

func (*ErrorResponse) Error

func (r *ErrorResponse) Error() string

func (*ErrorResponse) UnmarshalJSON

func (r *ErrorResponse) UnmarshalJSON(data []byte) error

type Errors

type Errors struct {
	SequenceID []string `json:"sequenceId"`
}

type FileMetaData

type FileMetaData struct {
	Category string `json:"category"`
	Folder   string `json:"folder"`
	Register string `json:"register"`
}

type Form

type Form interface {
	IsMultiPart() bool
	Values() url.Values
	Files() map[string]FormFile
}

type FormFile

type FormFile struct {
	Filename string
	Content  io.Reader
}

type IntString

type IntString string

func (*IntString) UnmarshalJSON

func (f *IntString) UnmarshalJSON(text []byte) (err error)

type Oauth2Config

type Oauth2Config struct {
	oauth2.Config
}

func NewOauth2Config

func NewOauth2Config() *Oauth2Config

func (*Oauth2Config) SetBaseURL

func (c *Oauth2Config) SetBaseURL(baseURL *url.URL)

type Oauth2PasswordConfig

type Oauth2PasswordConfig struct {
	passwordcredentials.Config
}

func NewOauth2PasswordConfig

func NewOauth2PasswordConfig() *Oauth2PasswordConfig

func (*Oauth2PasswordConfig) SetBaseURL

func (c *Oauth2PasswordConfig) SetBaseURL(baseURL *url.URL)

type PathParams

type PathParams interface {
	Params() map[string]string
}

type QueryParams

type QueryParams interface {
	ToURLValues() (url.Values, error)
}

type Request

type Request interface {
	Method() string
	// QueryParams() QueryParams
	PathParamsInterface() PathParams
	RequestBodyInterface() interface{}
	URL() *url.URL
}

type RequestCompletionCallback

type RequestCompletionCallback func(*http.Request, *http.Response)

RequestCompletionCallback defines the type of the request callback function

type SendFilesFormParams

type SendFilesFormParams struct {
	ExtfFile FormFile
}

func (SendFilesFormParams) Files

func (p SendFilesFormParams) Files() map[string]FormFile

func (SendFilesFormParams) IsMultiPart

func (p SendFilesFormParams) IsMultiPart() bool

func (SendFilesFormParams) Values

func (p SendFilesFormParams) Values() url.Values

type SendFilesPathParams

type SendFilesPathParams struct {
}

func (*SendFilesPathParams) Params

func (p *SendFilesPathParams) Params() map[string]string

type SendFilesQueryParams

type SendFilesQueryParams struct{}

func (SendFilesQueryParams) ToURLValues

func (p SendFilesQueryParams) ToURLValues() (url.Values, error)

type SendFilesRequest

type SendFilesRequest struct {
	// contains filtered or unexported fields
}

func (*SendFilesRequest) Do

func (*SendFilesRequest) FormParams

func (r *SendFilesRequest) FormParams() *SendFilesFormParams

func (*SendFilesRequest) FormParamsInterface

func (r *SendFilesRequest) FormParamsInterface() Form

func (*SendFilesRequest) Method

func (r *SendFilesRequest) Method() string

func (*SendFilesRequest) NewResponseBody

func (r *SendFilesRequest) NewResponseBody() *SendFilesResponseBody

func (*SendFilesRequest) PathParams

func (r *SendFilesRequest) PathParams() *SendFilesPathParams

func (*SendFilesRequest) PathParamsInterface

func (r *SendFilesRequest) PathParamsInterface() PathParams

func (*SendFilesRequest) QueryParams

func (r *SendFilesRequest) QueryParams() *SendFilesQueryParams

func (*SendFilesRequest) RequestBody

func (r *SendFilesRequest) RequestBody() *SendFilesRequestBody

func (*SendFilesRequest) RequestBodyInterface

func (r *SendFilesRequest) RequestBodyInterface() interface{}

func (*SendFilesRequest) SetMethod

func (r *SendFilesRequest) SetMethod(method string)

func (*SendFilesRequest) SetRequestBody

func (r *SendFilesRequest) SetRequestBody(body SendFilesRequestBody)

func (*SendFilesRequest) URL

func (r *SendFilesRequest) URL() *url.URL

type SendFilesRequestBody

type SendFilesRequestBody struct{}

type SendFilesResponse

type SendFilesResponse struct {
	Name             string `json:"Name"`
	ContainerName    string `json:"ContainerName"`
	Size             int    `json:"Size"`
	ContentType      string `json:"ContentType"`
	Location         string `json:"Location"`
	ModifiedDateTime string `json:"ModifiedDateTime"`
	DataLoadBatchID  string `json:"DataLoadBatchId"`
}

type SendFilesResponseBody

type SendFilesResponseBody []SendFilesResponse

type StatusErrorResponse

type StatusErrorResponse struct {
	// HTTP response that caused this error
	Response *http.Response
}

func (*StatusErrorResponse) Error

func (r *StatusErrorResponse) Error() string

type StringFloat

type StringFloat float64

func (*StringFloat) UnmarshalJSON

func (f *StringFloat) UnmarshalJSON(text []byte) (err error)

type StringInt

type StringInt int

func (*StringInt) UnmarshalJSON

func (f *StringInt) UnmarshalJSON(text []byte) (err error)

type Time

type Time struct {
	time.Time
}

func (Time) MarshalCSV

func (d Time) MarshalCSV() (string, error)

Convert the internal date as CSV string

func (*Time) MarshalJSON

func (d *Time) MarshalJSON() ([]byte, error)

func (Time) MarshalSchema

func (d Time) MarshalSchema() string

func (*Time) UnmarshalJSON

func (d *Time) UnmarshalJSON(text []byte) (err error)

type TransactionDatasetRow

type TransactionDatasetRow struct {
	TransactionID        string   `csv:"transactionid"`
	UnitID               string   `csv:"unitid"`
	SiteLocationCode     string   `csv:"sitelocationcode"`
	TradingDate          DateTime `csv:"tradingdate"`
	Time                 Time     `csv:"time"`
	Timefact             string   `csv:"timefact"`
	TerminalCode         string   `csv:"terminalcode"`
	TerminalDesc         string   `csv:"terminaldesc"`
	RecordActivityCode   int      `csv:"recordactivitycode,omitempty"`
	ReceiptCode          string   `csv:"receiptcode"`
	CheckCode            string   `csv:"checkcode"`
	TableCode            string   `csv:"tablecode"`
	RevenueCentreCode    string   `csv:"revenuecentrecode"`
	RevenueCentreDesc    string   `csv:"revenuecentredesc"`
	TransactionTypeCode  string   `csv:"transactiontypecode"`
	SalesItemID          string   `csv:"salesitemid"`
	SalesItemPLU         string   `csv:"salesitemPLU"`
	SalesItemGUID        string   `csv:"salesitemGUID"`
	SalesItemDesc        string   `csv:"salesitemdesc"`
	TenderTypeCode       string   `csv:"tendertypecode"`
	TenderTypeDesc       string   `csv:"tendertypedesc"`
	DeductionCode        string   `csv:"deductioncode"`
	DeductionDesc        string   `csv:"deductiondesc"`
	Covers               int      `csv:"covers"`
	Qty                  float64  `csv:"qty"`
	Currency             string   `csv:"currency"`
	ListPrice            float64  `csv:"listprice"`
	Tax                  float64  `csv:"tax"`
	PricePaid            float64  `csv:"pricepaid"`
	Deduction            float64  `csv:"deduction"`
	TenderAmount         float64  `csv:"tenderamount"`
	CostPriceTheo        float64  `csv:"costpricetheo"`
	ListPriceConv        float64  `csv:"listpriceconv"`
	TaxConv              float64  `csv:"taxconv"`
	PricePaidConv        float64  `csv:"pricepaidconv"`
	DeductionConv        float64  `csv:"deductionconv"`
	TenderAmountConv     float64  `csv:"tenderamountconv"`
	CostPriceTheoConv    float64  `csv:"costpricetheoconv"`
	OrderTypeDesc        string   `csv:"ordertypedesc"`
	MenuBand             string   `csv:"menuband"`
	MajorGroupDesc       string   `csv:"majorgroupdesc"`
	FamilyGroupDesc      string   `csv:"familygroupdesc"`
	SubGroupDesc         string   `csv:"subgroupdesc"`
	TabOwner             string   `csv:"tabowner"`
	TabOwnerDesc         string   `csv:"tabownerdesc"`
	OriginalTabOwner     string   `csv:"originaltabowner"`
	OriginalTabOwnerDesc string   `csv:"originaltabownerdesc"`
	OldTableCode         string   `csv:"oldtablecode"`
	PrevTransactionCode  string   `csv:"prevtransactioncode"`
	AuthorisedBy         string   `csv:"authorisedby"`
	TextField            string   `csv:"textfield"`
	GuestDesc            string   `csv:"guestdesc"`
	GuestCode            string   `csv:"guestcode"`
	TimeSentToPrep       string   `csv:"timesenttoprep"`
	BumpTime             string   `csv:"bumptime"`
	UniversalTimesLotID  string   `csv:"universaltimeslotid"`
	TimeslotDesc         string   `csv:"timeslotdesc"`
	TransactionStartEnd  int      `csv:"transactionstartend"`
	IsDeleted            int      `csv:"isdeleted"`
	CustomField1         string   `csv:"customfield1"`
	CustomField2         string   `csv:"customfield2"`
	CustomField3         string   `csv:"customfield3"`
	CustomFact1          string   `csv:"customfact1"`
	CustomFact2          string   `csv:"customfact2"`
	DateFact             string   `csv:"datefact"`
}

type TransactionDatasetRows

type TransactionDatasetRows []TransactionDatasetRow

type ValidationError

type ValidationError struct {
	ErrorCode    *int   `json:"errorCode"`
	ErrorScopeID string `json:"errorScopeId"`
	Message      string `json:"message"`
	Reference    string `json:"reference"`
	SequentialID string `json:"sequentialId"`
	SourceHint   string `json:"sourceHint"`
}

[

{
  "errorCode": 1001004,
  "errorScopeId": "9ab8f26a-e31d-4b36-b3f3-26c5c5340abd",
  "message": "Invalid Voucher type, valid Values (Unspecified,SupplierInvoice,AutoVat,SupplierInvoicePayment,CustomerInvoice,CustomerInvoicePayment",
  "sequentialId": "00000000-0000-0000-0000-000000000000"
}

]

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL