ticketswitch

package module
v0.0.0-...-583d3db Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: MIT Imports: 14 Imported by: 0

README

goticketswitch.v2

A Go api wrapper for the f13 ticketswitch api. The Ingresso API docs may be found here: https://docs.ingresso.co.uk/

Work in Progress

This library is likely to change without notice.

Documentation

Index

Constants

View Source
const (
	// SortMostPopular sorts results based on sales across all partners over
	// the last 48 hours
	SortMostPopular = "most_popular"
	// SortAlphabetic sorts results alphabetically by event description
	SortAlphabetic = "alphabetic"
	// SortCostAscending sorts results by minimum total price with the lowest
	// price first
	SortCostAscending = "cost_ascending"
	// SortCostDescending sorts results by maximum total price with the highest
	// price first
	SortCostDescending = "cost_descending"
	// SortCriticRating sorts results by the average critic rating with the
	// highest rating first
	SortCriticRating = "critic_rating"
	// SortRecent sorts results by the date they were added to the system with
	// the newest result first.
	SortRecent = "recent"
	// SortLastSale sorts results by the products that sold the most recently.
	SortLastSale = "last_sale"
)
View Source
const F13AuthErrorCode int = 3

F13AuthErrorCode is the error code that gets returned for Authentication errors

Variables

View Source
var (
	// IndentOutput controls wether or not JSON output is indented.
	IndentOutput = true
	// EscapeHTML controls wether json output is HTML escaped.
	EscapeHTML = false
)
View Source
var ErrEventNotFound = errors.New("ticketswitch: event not found")

ErrEventNotFound will be returned when a specific event has been requested but didn't get a result back in response with that ID

Functions

func DateRange

func DateRange(from, to time.Time) string

DateRange returns a string representation of a date range between two time.Times

func GetSessionTrackingID

func GetSessionTrackingID(ctx context.Context) (string, bool)

GetSessionTrackingID gets the tracking id from the context

func SetSessionTrackingID

func SetSessionTrackingID(ctx context.Context, trackingId string) context.Context

SetSessionTrackingID saves a tracking id into a context

Types

type AgentCost

type AgentCost struct {
	CurrencyCode   string          `json:"currency_code"`
	TotalAgentCost decimal.Decimal `json:"total_agent_cost"`
}

type AvailDetails

type AvailDetails struct {
	AvailDetailsTicketTypes []AvailDetailsTicketType `json:"ticket_type"`
}

type AvailDetailsTicketType

type AvailDetailsTicketType struct {
	Code       string           `json:"ticket_type_code"`
	Desc       string           `json:"ticket_type_desc"`
	PriceBands []EventPriceBand `json:"price_band"`
}

type Availability

type Availability struct {
	TicketTypes []TicketType `json:"ticket_type"`
}

Availability holds the details of the available tickets

type AvailabilityDetail

type AvailabilityDetail struct {
	AvailabilityCurrencyCode string          `json:"avail_currency_code"`
	AvailableDates           AvailableDates  `json:"available_dates"`
	AvailableWeekdays        int             `json:"available_weekdays_bitmask"`
	CombinedTaxComponent     decimal.Decimal `json:"combined_tax_component"`
	// CombinedTaxComponentInDesired     decimal.Decimal `json:"combined_tax_component_in_desired"`
	// DesiredCurrencyCode      string          `json:"desired_currency_code"`
	DiscountSemanticType string          `json:"discount_semantic_type"`
	Seatprice            decimal.Decimal `json:"seatprice"`
	// SeatpriceInDesired       decimal.Decimal `json:"seatprice_in_desired"`
	SuffixedPriceBandCode string          `json:"suffixed_price_band_code"`
	Surcharge             decimal.Decimal `json:"surcharge"`
	// SurchargeInDesired       decimal.Decimal `json:"surcharge_in_desired"`
	SurchargeTaxSubComponent decimal.Decimal `json:"surcharge_tax_sub_component"`
	// SurchargeTaxSubComponentInDesired decimal.Decimal `json:"surcharge_tax_sub_component_in_desired"`
	ValidQuantities       []int `json:"valid_quantities"`
	CachedNumberAvailable int   `json:"cached_number_available"`
}

type AvailabilityDetails

type AvailabilityDetails struct {
	// ticket type array, if present
	TicketType []TicketType `json:"ticket_type"`
	// identifier of the ticket type.
	TicketTypeCode string
	// human readable description of the ticket type.
	TicketTypeDescription string
	// identifier of the price band.
	PriceBandCode string
	// human readable description of the price band.
	PriceBandDescription string
	// price of an individual seat.
	SeatPrice decimal.Decimal
	// additional charges per seat.
	Surcharge decimal.Decimal
	// the non-offer price of an individual seat.
	FullSeatPrice decimal.Decimal
	// the non-offer additional charges per seat.
	FullSurcharge decimal.Decimal
	// the currency of the prices.
	CurrencyCode string
	// the first date and time this combination of ticket type and price
	// band is available from.
	FirstDate time.Time
	// the latest date and time this combination of ticket type and price
	// band is available from.
	LastDate time.Time
	// list of valid number of tickets available for selection.
	ValidQuantities []int
}

AvailabilityDetails describes an availability summary for a performance. This information is generated using cached data.

type AvailabilityResult

type AvailabilityResult struct {
	Availability                Availability        `json:"availability"`
	BackendIsBroken             bool                `json:"backend_is_broken"`
	BackendIsDown               bool                `json:"backend_is_down"`
	BackendThrottleFailed       bool                `json:"backend_throttle_failed"`
	ContiguousSeatSelectionOnly bool                `json:"contiguous_seat_selection_only"`
	CurrencyCode                string              `json:"currency_code"`
	CurrencyDetails             map[string]Currency `json:"currency_details"`
	ValidQuantities             []int               `json:"valid_quantities"`
}

AvailabilityResult describes the current state of available seats for a Performance

type AvailableDates

type AvailableDates struct {
	First string `json:"first_yyyymmdd"`
	Last  string `json:"last_yyyymmdd"`
}

type Bundle

type Bundle struct {
	OrderCount     int             `json:"bundle_order_count"`
	SourceCode     string          `json:"bundle_source_code"`
	SourceDesc     string          `json:"bundle_source_desc"`
	TotalCost      decimal.Decimal `json:"bundle_total_cost"`
	TotalSeatprice decimal.Decimal `json:"bundle_total_seatprice"`
	TotalSendCost  decimal.Decimal `json:"bundle_total_send_cost"`
	TotalSurcharge decimal.Decimal `json:"bundle_total_surcharge"`
	CurrencyCode   string          `json:"currency_code"`
	Orders         []Order         `json:"order"`
	PurchaseResult PurchaseResult  `json:"purchase_result"`
}

type Callout

type Callout struct {
	Code            string                 `json:"bundle_source_code"`
	Description     string                 `json:"bundle_source_desc"`
	Total           decimal.Decimal        `json:"bundle_total_cost"`
	Type            string                 `json:"callout_type"`
	Destination     string                 `json:"callout_destination_url"`
	Parameters      map[string]string      `json:"callout_parameters"`
	IntegrationData map[string]interface{} `json:"callout_integration_data"`
	Debitor         Debitor                `json:"debitor"`
	CurrencyCode    string                 `json:"currency_code"`
	ReturnToken     string                 `json:"return_token"`
}

Callout describes how a customer should be redirected in order to provide additional data, for example for 3D secure, or logging into paypal.

type CancelItemsList

type CancelItemsList []int

func (CancelItemsList) String

func (items CancelItemsList) String() string

type CancellationParams

type CancellationParams struct {
	UniversalParams
	TransactionUUID string
	CancelItemsList CancelItemsList
}

func (*CancellationParams) Params

func (params *CancellationParams) Params() map[string]string

type CancellationResult

type CancellationResult struct {
	//nolint:misspell
	CancelledItemNumbers []int               `json:"cancelled_item_numbers"`
	MustAlsoCancel       []Order             `json:"must_also_cancel"`
	Trolley              Trolley             `json:"trolley_contents"`
	CurrencyDetails      map[string]Currency `json:"currency_details"`
}

CancellationResult contains the results of the cancel API call.

func (*CancellationResult) IsFullyCancelled

func (result *CancellationResult) IsFullyCancelled() bool

IsFullyCancelled checks the CancellationResult to see if the cancellation successfully canceled all orders within the Trolley. If some orders are canceled and others aren't then this will return false.

type Circle

type Circle struct {
	geo.Point
	Radius float64
}

Circle represents a geographical point and an area around it.

func NewCircle

func NewCircle(lat, long, radius float64) *Circle

NewCircle returns a pointer to a newly created GeoArea

func NewCircleWithPoint

func NewCircleWithPoint(point geo.Point, radius float64) *Circle

NewCircleWithPoint returns a pointer to a newly created GeoArea using an existing geo.Point

func (*Circle) Param

func (area *Circle) Param() string

Param returns a string representation of a set of coordinates and a radius for consumption by the API.

func (*Circle) Valid

func (area *Circle) Valid() bool

Valid checks if the Circle is valid

type Client

type Client struct {
	Config     *Config
	HTTPClient *http.Client
}

Client wraps the ticketswitch f13 API.

func NewClient

func NewClient(config *Config) *Client

NewClient returns a pointer to a newly created client.

func (*Client) Cancel

func (client *Client) Cancel(ctx context.Context, params *CancellationParams) (*CancellationResult, error)

nolint:dupl Cancel cancels transactions via the API

func (*Client) Do

func (client *Client) Do(ctx context.Context, req *Request) (resp *http.Response, err error)

Do make a request to the API

func (*Client) EmailCheck

func (client *Client) EmailCheck(ctx context.Context, params *EmailCheckParams) error

EmailCheck will check whether email passed meets RFC822 standard, returning error if not.

func (*Client) GetAvailability

func (client *Client) GetAvailability(ctx context.Context, perf string, params *GetAvailabilityParams) (*AvailabilityResult, error)

GetAvailability fetches availability for a performce from the API

func (*Client) GetDiscounts

func (client *Client) GetDiscounts(ctx context.Context, perf, ticketTypeCode, priceBandCode string, params *UniversalParams) (*DiscountsResult, error)

GetDiscounts fetches the Discounts for a particular performance, ticket type and price band from the API

func (*Client) GetEvent

func (client *Client) GetEvent(ctx context.Context, eventID string, params *UniversalParams) (*Event, error)

GetEvent returns an Event fetched from the API

func (*Client) GetEvents

func (client *Client) GetEvents(ctx context.Context, eventIDs []string, params *UniversalParams) (map[string]*Event, error)

GetEvents returns a map of events index by event ID from the API.

func (*Client) GetSendMethods

func (client *Client) GetSendMethods(ctx context.Context, perf string, params *UniversalParams) (*SendMethodsResults, error)

nolint:dupl GetSendMethods fetches the available send methods for a performance from the API

func (*Client) GetSources

func (client *Client) GetSources(ctx context.Context, params *UniversalParams) (*SourcesResult, error)

GetSources fetches the available sources (a.k.a. backend systems) from the API

func (*Client) GetStatus

func (client *Client) GetStatus(ctx context.Context, params *TransactionParams) (*StatusResult, error)

nolint:dupl GetStatus retrieves the transaction from the API

func (*Client) ListEvents

func (client *Client) ListEvents(ctx context.Context, params *ListEventsParams) (*ListEventsResults, error)

ListEvents returns a paginated slice of Events from the API.

func (*Client) ListPerformanceTimes

func (client *Client) ListPerformanceTimes(ctx context.Context, params *ListPerformancesParams) (*ListPerformanceTimesResults, error)

ListPerformanceTimes fetches a slice of unique performance times from the API

func (*Client) ListPerformances

func (client *Client) ListPerformances(ctx context.Context, params *ListPerformancesParams) (*ListPerformancesResults, error)

ListPerformances fetches a slice of performances from the API

func (*Client) MakePurchase

func (client *Client) MakePurchase(ctx context.Context, params *MakePurchaseParams) (*MakePurchaseResult, error)

MakePurchase attempts to purchase a previously reserved transaction via the API

func (*Client) MakeReservation

func (client *Client) MakeReservation(ctx context.Context, params *MakeReservationParams) (*ReservationResult, error)

MakeReservation places a hold on products in the inventory via the API

func (*Client) ReleaseReservation

func (client *Client) ReleaseReservation(ctx context.Context, params *TransactionParams) (success bool, err error)

ReleaseReservation makes a best effort attempt to release any reservations made on backend systems for a transaction.

func (*Client) Test

func (client *Client) Test(ctx context.Context) (*User, error)

Test tests the API connection returning a User on success

type Config

type Config struct {
	BaseURL     string
	User        string
	Password    string
	SubUser     string
	Language    string
	CryptoBlock string
	DebugMode   bool
}

Config defines the credentials used to access the API

func NewConfig

func NewConfig(user, password string) *Config

NewConfig returns a pointer to a newly created Config.

type Content

type Content struct {
	Name  string
	Value string
	HTML  string
}

Content represents some plain text and HTML content

type CostRange

type CostRange struct {
	// list of valid quanities available for purchase.
	ValidQuanities []int `json:"valid_quanities"`

	// the minimum cost per seat the customer might be expected to pay.
	MinSeatPrice decimal.Decimal `json:"min_seatprice"`
	// the maximum cost per seat the customer might be expected to pay.
	MaxSeatPrice decimal.Decimal `json:"max_seatprice"`
	// the minimum surcharge per seat the customer might be expected to pay.
	MinSurcharge decimal.Decimal `json:"min_surcharge"`
	// the maximum surcharge per seat the customer might be expected to pay.
	MaxSurcharge decimal.Decimal `json:"max_surcharge"`

	// currency the cost range and offer prices are in.
	CurrencyCode string   `json:"currency_code"`
	Currency     Currency `json:"currency"`

	// offer with the highest percentage saving.
	BestValueOffer Offer `json:"best_value_offer"`

	// offer with the highest absolute saving.
	MaxSavingOffer Offer `json:"max_saving_offer"`

	// offer with the lowest cost.
	MinCostOffer Offer `json:"min_cost_offer"`

	//  offer with the top price.
	TopPrice Offer `json:"top_price"`
}

CostRange gives summarized pricing for events and performances.

This information is returned from cached data collected when making actual calls to the backend system, and should not be considered accurate.

type CostRangeDetails

type CostRangeDetails struct {
	TicketTypeCode     string    `json:"ticket_type_code"`
	PriceBandCode      string    `json:"price_band_code"`
	TicketTypeDesc     string    `json:"ticket_type_desc"`
	PriceBandDesc      string    `json:"price_band_desc"`
	CostRange          CostRange `json:"cost_range"`
	NoSinglesCostRange CostRange `json:"no_singles_cost_range"`
}

CostRangeDetails Summarizes pricing by ticket types and price bands for an event/performance

This information is returned from cached data collected when making actual calls to the backend system, and should not be considered accurate.

type Country

type Country struct {
	Code string `json:"country_code"`
	Desc string `json:"country_desc"`
}

type Currency

type Currency struct {
	//  ISO 4217 currency code.
	Code string `json:"currency_code"`
	// precision of decimal numbers.
	Places int `json:"currency_places"`
	// a symbol to place before the digits of a price.
	PreSymbol string `json:"currency_pre_symbol"`
	// a symbol to place after the digits of a price.
	PostSymbol string `json:"currency_post_symbol"`
	// arbitrary scale factor, can be used to roughly convert from one currency
	// to another.
	Factor int `json:"currency_factor"`
	//  internal identifier.
	Number int `json:"currency_number"`
}

Currency contains the information about a currency.

type Customer

type Customer struct {
	AgentReference             string `json:"agent_ref"`
	FirstName                  string `json:"first_name"`
	LastName                   string `json:"last_name"`
	CountryCode                string `json:"country_code"`
	Title                      string `json:"title"`
	Initials                   string `json:"initials"`
	Suffix                     string `json:"suffix"`
	Postcode                   string `json:"postcode"`
	Town                       string `json:"town"`
	County                     string `json:"county"`
	EmailAddress               string `json:"email_addr"`
	Phone                      string `json:"phone"`
	WorkPhone                  string `json:"work_phone"`
	HomePhone                  string `json:"home_phone"`
	AddressLineOne             string `json:"addr_line_one"`
	AddressLineTwo             string `json:"addr_line_two"`
	SupplierCanUseCustomerData bool   `json:"supplier_can_use_customer_data"`
	UserCanUseCustomerData     bool   `json:"user_can_use_customer_data"`
	WorldCanUseCustomerData    bool   `json:"world_can_use_customer_data"`
}

Customer contains information about the customer that bought tickets

func (*Customer) Params

func (customer *Customer) Params() map[string]string

Params returns the customer data as a map

type Debitor

type Debitor struct {
	Type            string                 `json:"debitor_type"`
	Name            string                 `json:"debitor_name"`
	Description     string                 `json:"debitor_desc"`
	IntegrationData map[string]interface{} `json:"debitor_integration_data"`
	AggregrationKey string                 `json:"debitor_aggregration_key"`
}

Debitor represents information about a 3rd party that will take payment from your customer.

This information is primarily used for bypassing callouts and integrating directly with payment providers on the front end.

When your account is set up to sell on credit (i.e. you are always taking payment from the customer in your application directly), this information will not be present, and it should not be relevant.

When the source system is taking payment this information will not be present.

When debitor information is not present or you are not front end integrating you should refer to the Reservation.NeedsPaymentCard, Reservation.NeedsEmailAddress, and Reservation.NeedsAgentReference as to what information you need to pass back to the API for purchasing tickets.

Regardless of the debitor it's advisable to implement the full purchase/callout/callback process in the event that your front end integration goes awry.

type Discount

type Discount struct {
	AbsoluteSaving           decimal.Decimal `json:"absolute_saving"`
	AllowsLeavingSingleSeats string          `json:"allows_leaving_single_seats"`
	Code                     string          `json:"discount_code"`
	Description              string          `json:"discount_desc"`
	MinimumEligibleAge       int             `json:"discount_minimum_eligible_age"`
	MaximumEligibleAge       int             `json:"discount_maximum_eligible_age"`
	SemanticType             string          `json:"discount_semantic_type"`
	IsOffer                  bool            `json:"is_offer"`
	NonOfferSeatprice        decimal.Decimal `json:"non_offer_sale_seatprice"`
	NonOfferSurcharge        decimal.Decimal `json:"non_offer_sale_surcharge"`
	NonOfferCombined         decimal.Decimal `json:"non_offer_sale_combined"`
	NumberAvailable          int             `json:"number_available"`
	PercentageSaving         decimal.Decimal `json:"percentage_saving"`
	PriceBandCode            string          `json:"price_band_code"`
	Seatprice                decimal.Decimal `json:"sale_seatprice"`
	Surcharge                decimal.Decimal `json:"sale_surcharge"`
	Combined                 decimal.Decimal `json:"sale_combined"`
}

Discount contains all the information about the discount from the API

type DiscountsHolder

type DiscountsHolder struct {
	Discounts []Discount `json:"discount"`
}

DiscountsHolder is the intermediary discounts' holder -- an artifact of the API

type DiscountsResult

type DiscountsResult struct {
	DiscountsHolder DiscountsHolder     `json:"discounts"`
	CurrencyCode    string              `json:"currency_code"`
	CurrencyDetails map[string]Currency `json:"currency_details"`
}

DiscountsResult contains all the information from the GetDiscounts API call

type EmailCheckParams

type EmailCheckParams struct {
	UniversalParams
	EmailAddress string
}

EmailCheckParams represents payload to be sent to email-check endpoint to validate given email.

func (*EmailCheckParams) Params

func (params *EmailCheckParams) Params() map[string]string

type Error

type Error struct {
	Code                int    `json:"error_code"`
	Description         string `json:"error_desc"`
	AuthenticationError bool
	CallbackGoneError   bool
}

Error represents an error returned by the API

func (Error) Error

func (err Error) Error() string

type Event

type Event struct {
	// the identifier for the event.
	ID string `json:"event_id"`
	// status of the event.
	Status string `json:"event_status"`
	// human-readable name for the event.
	Description string `json:"event_desc"`
	// the backend system from which the event originates.
	Source string `json:"source_desc"`
	// the internal code for the backend system.
	SourceCode string `json:"source_code"`
	// the type of the event.
	EventType string `json:"event_type"`
	// a human-readable description of the venue.
	Venue string `json:"venue_desc"`
	// a dictionary of class descriptions that the event belongs to keyed on
	// class identifier.
	Classes map[string]string `json:"classes"`
	// a list of filters that the event belongs to.
	Filters []string `json:"custom_filter"`
	// venue post code.
	Postcode string `json:"postcode"`
	// venue geographical data.
	GeoData GeoData `json:"geo_data"`
	// human-readable venue city.
	City string `json:"city_desc"`
	// venue city code
	CityCode string `json:"city_code"`
	// human-readable country name.
	Country string `json:"country_desc"`
	// ISO 3166-1 country code.
	CountryCode string `json:"country_code"`
	// maximum running time of a performance in minutes.
	MaxRunningTime int `json:"max_running_time"`
	// minimum running time of a performance in minutes.
	MinRunningTime int `json:"min_running_time"`
	// indicates that the performance time for this event is relevant and
	// should be shown.
	ShowPerformanceTime bool `json:"show_perf_time"`
	// indicates that the event has no performances.
	HasNoPerformances bool `json:"has_no_perfs"`
	// indicates the event is seated.
	IsSeated bool `json:"is_seated"`
	// indicates that ticket purchases for this event will require a departure
	// date.
	NeedsDepartureDate bool `json:"needs_departure_date"`
	// indicates that ticket purchases for this event will require a duration.
	NeedsDuration bool `json:"needs_duration"`
	// indicates that ticket purchases for this event will require a
	// performance id.
	NeedsPerformance bool `json:"needs_performance"`
	// list of related event id's for upselling.
	UpsellList UpsellList `json:"event_upsell_list"`
	// pricing summary from cached availability. Only present when requested.
	CostRange CostRange `json:"cost_range"`
	// pricing summary from cached availability. Only present when requested.
	NoSinglesCostRange CostRange `json:"no_singles_cost_range"`
	// summary pricing information broken down by availability. This is cached
	// data. Only present when requested.
	CostRangeDetails CostRangeDetails `json:"cost_range_details"`
	// indexed on content name. Only present when requested.
	Content map[string]Content `json:"content"`
	// fields indexed on field name. Only present when requested.
	Fields map[string]Field `json:"fields"`
	// event info in plain text. Only present when requested.
	EventInfo string `json:"event_info"`
	// event info as HTML. Only present when requested.
	EventInfoHTML string `json:"event_info_html"`
	// venue address in plain text. Only present when requested.
	VenueAddr string `json:"venue_addr"`
	// venue address as HTML. Only present when requested.
	VenueAddrHTML string `json:"venue_addr_html"`
	// venue info in plain text. Only present when requested.
	VenueInfo string `json:"venue_info"`
	// venue info as HTML. Only present when requested.
	VenueInfoHTML string `json:"venue_info_html"`
	// media items indexed on media name. Only present when requested.
	Media map[string]Media `json:"media"`
	// reviews of this product Only present when requested.
	Reviews []Review `json:"reviews"`
	// summary of critic review star rating.  rated from 1 (lowest) to 5
	// (highest).
	CriticReviewPercent float64 `json:"critic_review_percent"`
	// summary of availability details from cached data. Only
	// present when requested.
	AvailabilityDetails AvailabilityDetails `json:"availability_details"`
	// avail details
	AvailDetails AvailDetails `json:"avail_details"`
	// list of Event objects that comprise a meta event
	ComponentEvents []Event `json:"component_events"`
	// list of valid qualities available for purchase. from cached data, only
	// available when requested by **get_events** or **get_event**
	ValidQuantities []int `json:"valid_quantities"`
	// indicates that the event is an addon product to another event
	IsAddon bool `json:"is_add_on"`
	// AreaCode is for internal use only
	AreaCode string `json:"area_code"`
	// Code is for internal use only
	Code string `json:"event_code"`
	// VenueCode is for internal use only
	VenueCode string `json:"venue_code"`
}

Event represents a product in the ticketswitch system.

type EventPriceBand

type EventPriceBand struct {
	Code               string               `json:"price_band_code"`
	Desc               string               `json:"price_band_desc"`
	AvailabilityDetail []AvailabilityDetail `json:"avail_detail"`
}

type Field

type Field struct {
	// the name of the field
	Name string
	// human readable name of the field
	Label string
	// the field data
	Data string
}

Describes a custom field for an event

type FunctionParams

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

type GeoData

type GeoData struct {
	// latitude of the venue.
	Latitude float64 `json:"latitude"`
	// longitude of the venue.
	Longitude float64 `json:"longitude"`
}

GeoData contains the longitude and latitude of the Venue

type GetAvailabilityParams

type GetAvailabilityParams struct {
	UniversalParams
	NumberOfSeats  int
	Discounts      bool
	ExampleSeats   bool
	SeatBlocks     bool
	UserCommission bool
}

GetAvailabilityParams are parameters that can be passed to the GetAvailability call.

func (*GetAvailabilityParams) Params

func (params *GetAvailabilityParams) Params() map[string]string

Params returns the call parameters as a map

type GrossCommission

type GrossCommission struct {
	IncVat       decimal.Decimal `json:"amount_excluding_vat"`
	ExVat        decimal.Decimal `json:"amount_including_vat"`
	CurrencyCode string          `json:"commission_currency_code"`
}

GrossCommission describes the total commission to be shared between Ingresso and the user

type ListEventsParams

type ListEventsParams struct {
	UniversalParams
	PaginationParams
	Keywords    []string
	StartDate   time.Time
	EndDate     time.Time
	CountryCode string
	CityCode    string
	Circle      *Circle
	IncludeDead bool
	SortOrder   string
}

ListEventsParams are parameters that can be passed to the ListEvents call.

func (*ListEventsParams) Params

func (params *ListEventsParams) Params() map[string]string

Params returns the call parameters as a map

type ListEventsResults

type ListEventsResults struct {
	// map of Currency objects
	Currencies map[string]Currency
	// when an object doesn't explicitly state a currency code, this code
	// should be assumed.
	DefaultCurrencyCode string
	// the code of currency the user is expecting
	DesiredCurrencyCode string

	// the current status of the pagination of the result set
	PagingStatus PagingStatus `json:"paging_status"`

	// performances returned by the call
	Events []Event `json:"event"`
}

ListEventsResults represents a set of events returned by the API

type ListPerformanceTimesResults

type ListPerformanceTimesResults struct {
	// Performance times returned by the call
	Times []PerformanceTime `json:"time,omitempty"`
}

ListPerformanceTimesResults represents the results from a ListPerformanceTimes call.

type ListPerformanceTimesTopLevel

type ListPerformanceTimesTopLevel struct {
	Results ListPerformanceTimesResults `json:"results,omitempty"`
}

ListPerformanceTimesTopLevel represents the top level of the ListPerfanceTimes call's json response.

type ListPerformancesParams

type ListPerformancesParams struct {
	UniversalParams
	PaginationParams
	EventID             string
	StartDate           time.Time
	EndDate             time.Time
	PerformanceTime     string
	RequireCostRange    bool
	RequestAvailDetails bool
}

ListPerformancesParams are parameters that can be passed to the ListPerformances call.

func (*ListPerformancesParams) Params

func (params *ListPerformancesParams) Params() map[string]string

Params returns the call parameters as a map

type ListPerformancesResults

type ListPerformancesResults struct {
	// indicates that the related performances have names
	HasPerfNames bool `json:"has_perf_names"`

	// the current status of the pagination of the result set
	PagingStatus PagingStatus `json:"paging_status"`

	// performances returned by the call
	Performances []Performance `json:"performance"`
}

ListPerformancesResults represents the results from a ListPerformance call

type ListPerformancesTopLevel

type ListPerformancesTopLevel struct {
	// indicates that the performance list will contain only one performance
	// and this performance should be automatically selected for the customer.
	AutoSelect bool `json:"autoselect_this_performance"`

	// contains the ListPerformancesResults
	Results ListPerformancesResults `json:"results"`
}

ListPerformancesTopLevel is the top level of the json response from a ListPerformance call

type MakePurchaseParams

type MakePurchaseParams struct {
	UniversalParams
	TransactionUUID       string
	AgentReference        string
	Customer              Customer
	PaymentMethod         PaymentMethod
	SendConfirmationEmail bool
}

MakePurchaseParams are the parameters that are passed into the MakePurchase call. A purchase must include the transaction UUID for an existing reserved transaction and some customer information. Optionally a payment method can be specified to provide payment details to the API when not purchasing on credit. If you require the API to send a confirmation email then set the SendConfirmationEmail flag to true (requires an email address to be specified in the customer information).

func (*MakePurchaseParams) Params

func (params *MakePurchaseParams) Params() map[string]string

Params returns the parameters needed to make the purchase call.

type MakePurchaseResult

type MakePurchaseResult struct {
	Status           string              `json:"transaction_status"`
	Callout          *Callout            `json:"callout,omitempty"`
	PendingCallout   *Callout            `json:"pending_callout,omitempty"`
	Currency         map[string]Currency `json:"currency_details"`
	Trolley          Trolley             `json:"trolley_contents"`
	Customer         Customer            `json:"customer"`
	ReserveDatetime  time.Time           `json:"reserve_iso8601_date_and_time"`
	PurchaseDatetime time.Time           `json:"purchase_iso8601_date_and_time"`
	ReserveUser      User                `json:"reserve_user"`
	Languages        []string            `json:"language_list"`
}

MakePurchaseResult is the result from the MakePurchase client call.

type MakeReservationParams

type MakeReservationParams struct {
	UniversalParams
	DepartureDate  time.Time
	Discounts      []string
	NumberOfSeats  int    // Required
	PerformanceID  string // Required
	PriceBandCode  string // Required
	Seats          []string
	SendMethod     string
	SourceCode     string // Required if specifying the send method
	TicketTypeCode string // Required
	TrolleyToken   string
	UserCommission bool
}

MakeReservationParams stores the parameters for making a reservation

func (*MakeReservationParams) Params

func (params *MakeReservationParams) Params() map[string]string

Params returns the call parameters as a map

type Media

type Media struct {
	// caption in plain text describing the asset.
	Caption string
	// caption as html describing the asset.
	CaptionHTML string
	// name of the asset.
	Name string
	// url for the asset.
	URL string
	// indicates if the assert url is secure or not.
	Secure bool
	// width of the asset in pixels. Only present on the video
	Width int
	// height of the asset in pixels. Only present on the video asset.
	Height int
}

Media describes some event media asset

type Offer

type Offer struct {
	// the price per seat/ticket.
	SeatPrice decimal.Decimal `json:"offer_seatprice"`
	// the additional charges per seat/ticket.
	Surcharge decimal.Decimal `json:"offer_surcharge"`
	// the original price per seat/ticket.
	FullSeatPrice decimal.Decimal `json:"full_seatprice"`
	// the original additional charges per seat/ticket.
	FullSurcharge decimal.Decimal `json:"full_surcharge"`
	// the amount of money saved by this offer.
	AbsoluteSaving decimal.Decimal `json:"absolute_saving"`
	// the amount of money saved by this offer, as a percentage of the original
	// price.
	PercentageSaving decimal.Decimal `json:"percentage_saving"`
}

type Order

type Order struct {
	Event                        Event              `json:"event"`
	CancellationComment          string             `json:"cancellation_comment"`
	CancellationStatus           string             `json:"cancellation_status"`
	GotRequestedSeats            bool               `json:"got_requested_seats"`
	ItemNumber                   int                `json:"item_number"`
	Performance                  Performance        `json:"performance"`
	PriceBandCode                string             `json:"price_band_code"`
	RequestedSeatIDs             []string           `json:"requested_seat_ids"`
	ReserveFailureComment        string             `json:"reserve_failure_comment"`
	SeatRequestStatus            string             `json:"seat_request_status"`
	SendMethod                   SendMethod         `json:"send_method"`
	BarcodeAllowsEntry           bool               `json:"barcode_allows_entry"`
	SupportedBarcodeTypes        []string           `json:"supported_barcode_types"`
	TicketOrdersHolder           TicketOrdersHolder `json:"ticket_orders"`
	TicketTypeCode               string             `json:"ticket_type_code"`
	TicketTypeDesc               string             `json:"ticket_type_desc"`
	TotalNumberOfSeats           int                `json:"total_no_of_seats"`
	TotalSaleSeatprice           decimal.Decimal    `json:"total_sale_seatprice"`
	TotalSaleSurcharge           decimal.Decimal    `json:"total_sale_surcharge"`
	UserCommission               UserCommission     `json:"user_commission"`
	GrossCommission              GrossCommission    `json:"gross_commission"`
	BackendPurchaseReference     string             `json:"backend_purchase_reference"`
	BackendCancellationReference string             `json:"backend_cancellation_reference"`
}

type PaginationParams

type PaginationParams struct {
	PageLength int
	PageNumber int
}

PaginationParams are parameters that can be passed to any call that paginates it's response

func (*PaginationParams) Pagination

func (params *PaginationParams) Pagination() map[string]string

Pagination returns the pagination parameters as a map.

type PagingStatus

type PagingStatus struct {
	PageLength       int `json:"page_length"`
	PageNumber       int `json:"page_number"`
	PagesRemaining   int `json:"pages_remaining"`
	ResultsRemaining int `json:"results_remaining"`
	TotalResults     int `json:"total_unpaged_results"`
}

PagingStatus describes the current status of the pagination of a result set

type PaymentMethod

type PaymentMethod interface {
	PaymentParams() map[string]string
}

PaymentMethod defines an interface that can be used for supplying payment parameters to the API

type Performance

type Performance struct {
	// identifier for the performance.
	ID string `json:"perf_id"`

	// the name of the performance.
	Name string `json:"perf_name"`

	// identifier for the event.
	EventID string `json:"event_id"`

	// the localized date and time for the performance.
	Datetime time.Time `json:"iso8601_date_and_time"`
	// a human-readable description of the date of the performance.
	DateDesc string `json:"date_desc"`
	// a human-readable description of the time of the performance.
	TimeDesc string `json:"time_desc"`
	// the number of minutes the performance is expected to run for.
	RunningTime int `json:"running_time"`

	// the performance has pool seats available.
	HasPoolSeats bool `json:"has_pool_seats"`
	// the performance has limited availability.
	IsLimited bool `json:"is_limited"`
	// the performance is a ghost performance and is no longer available.
	IsGhost bool `json:"is_ghost"`

	// the maximum number of seats available to book in a single order. This
	// value is cached and may not be accurate.
	CachedMaxSeats int `json:"cached_max_seats"`

	// pricing summary, may also include offers.
	CostRange CostRange `json:"cost_range"`
	// pricing summary when no leaving single seats, may also include offers.
	NoSinglesCostRange CostRange `json:"no_singles_cost_range"`

	// summarized availability data for the performance. This data is cached
	// from previous availability calls and may not be accurate.
	AvailabilityDetails AvailabilityDetails `json:"avail_details"`
}

Performance describes an occurrence of an Event.

type PerformanceTime

type PerformanceTime struct {
	// the localized date and time for the performance.
	Datetime time.Time `json:"iso8601_date_and_time,omitempty"`

	// Human-readable description of performance time.
	TimeDesc string `json:"time_desc,omitempty"`
}

PerformanceTime describes a possible date and time of a Performance.

type PermittedCountries

type PermittedCountries struct {
	Countries []Country `json:"country"`
}

type PriceBand

type PriceBand struct {
	Code                     string                `json:"price_band_code"`
	Desc                     string                `json:"price_band_description"`
	DiscountCode             string                `json:"discount_code"`
	DiscountDesc             string                `json:"discount_desc"`
	NumberAvailable          int                   `json:"number_available"`
	Seatprice                decimal.Decimal       `json:"sale_seatprice"`
	Surcharge                decimal.Decimal       `json:"sale_surcharge"`
	AllowsLeavingSingleSeats string                `json:"allows_leaving_single_seats"`
	IsOffer                  bool                  `json:"is_offer"`
	NonOfferSeatprice        decimal.Decimal       `json:"non_offer_sale_seatprice"`
	NonOfferSurcharge        decimal.Decimal       `json:"non_offer_sale_surcharge"`
	PercentageSaving         decimal.Decimal       `json:"percentage_saving"`
	AbsoluteSaving           decimal.Decimal       `json:"absolute_saving"`
	FreeSeatBlocksRaw        map[string][][]string `json:"free_seat_blocks"`
	RestrictedViewSeatsRaw   []string              `json:"restricted_view_seats_raw"`
	SeatsByTextMessageRaw    []string              `json:"seats_by_text_message_raw"`
	PredictedUserCommission  UserCommission        `json:"predicted_user_commission"`
	PossibleDiscounts        DiscountsHolder       `json:"possible_discounts"`
	AvailDetails             []AvailabilityDetail  `json:"avail_detail"`
}

PriceBand describes a subset of available tickets within a ticket type defined by price point. The price of a price band is defined by its default discount code, this is normally the most expensive discount option available

type PurchaseResult

type PurchaseResult struct {
	IsPartial    bool      `json:"is_partial"`
	Success      bool      `json:"success"`
	AgentCost    AgentCost `json:"agent_cost"`
	IsSemiCredit bool      `json:"is_semi_credit"`
}

type Request

type Request struct {
	Method   string
	Endpoint string
	Header   http.Header
	Values   url.Values
	Body     interface{}
	Puzzled  bool
	LogRaw   bool
}

Request represents a request to the API

func NewRequest

func NewRequest(method, endpoint string, body interface{}) *Request

NewRequest returns a pointer to a new created Request

func (*Request) SetValues

func (req *Request) SetValues(params map[string]string)

SetValues set the parameters as url parameters in a set of values.

type ReservationResult

type ReservationResult struct {
	AllowedCountries               map[string]string   `json:"allowed_countries"`
	CanEditAddress                 bool                `json:"can_edit_address"`
	CurrencyDetails                map[string]Currency `json:"currency_details"`
	InputContainedUnavailableOrder bool                `json:"input_contained_unavailable_order"`
	Languages                      []string            `json:"language_list"`
	MinutesLeftOnReserve           float64             `json:"minutes_left_on_reserve"`
	NeedsAgentReference            bool                `json:"needs_agent_reference"`
	NeedsEmailAddress              bool                `json:"needs_email_address"`
	NeedsPaymentCard               bool                `json:"needs_payment_card"`
	PrefilledAddress               map[string]string   `json:"prefilled_address"`
	ReserveTime                    time.Time           `json:"reserve_iso8601_date_and_time"`
	Status                         string              `json:"transaction_status"`
	Trolley                        Trolley             `json:"trolley_contents"`
	UnreservedOrders               []Order             `json:"unreserved_orders"`
}

ReservationResult contains the results of MakeReservation call

type Review

type Review struct {
	// review test.
	Body string
	// date and time of the review.
	DateTime time.Time
	// rating on a scale of 1-5, with 1 being the lowest rating and 5 being the highest rating.
	StarRating int
	// the IETF language tag for the review.
	Language string
	// a review title if available.
	Title string
	// the review was made by a user not a critic.
	IsUser bool
	// the authors name.
	Author string
	// the original url.
	URL string
}

type Seat

type Seat struct {
	ColumnID         string `json:"col_id"`
	FullID           string `json:"full_id"`
	IsRestrictedView bool   `json:"is_restricted_view"`
	RowID            string `json:"row_id"`
	SeatText         string `json:"seat_text"`
	SeatSubdata      string `json:"seat_subdata"`
	Barcode          string `json:"barcode"`
}

type SendMethod

type SendMethod struct {
	Code                 string             `json:"send_code"`
	Cost                 decimal.Decimal    `json:"send_cost"`
	Desc                 string             `json:"send_desc"`
	Type                 string             `json:"send_type"`
	PermittedCountries   PermittedCountries `json:"permitted_countries"`
	FinalType            string             `json:"send_final_tpe"`
	CanGenerateSelfPrint bool               `json:"CanGenerateSelfPrint"`
	SelfPrintVoucherURL  string             `json:"self_print_voucher_url"`
	HasHTMLPage          bool               `json:"has_html_page"`
}

type SendMethodsHolder

type SendMethodsHolder struct {
	SendMethods []SendMethod `json:"send_method"`
}

type SendMethodsResults

type SendMethodsResults struct {
	CurrencyDetails   map[string]Currency `json:"currency_details"`
	CurrencyCode      string              `json:"currency_code"`
	SourceCode        string              `json:"source_code"`
	SendMethodsHolder SendMethodsHolder   `json:"send_methods"`
}

type Source

type Source struct {
	// The code for the source
	Code string `json:"source_code"`
	// The description of the source
	Description string `json:"source_desc_from_config"`
	// The after sales email of the source
	Email string `json:"source_after_sales_email"`
	// Postal address of the source
	Address string `json:"source_postal_addr"`
	// Class of the source
	Class string `json:"source_system_class"`
	// Type of the string
	Type string `json:"source_system_type_string"`
	// Terms and Conditions
	TermsAndConditions string `json:"source_t_and_c"`
}

type SourcesResult

type SourcesResult struct {
	Sources []Source
}

type StatusResult

type StatusResult struct {
	Languages            []string            `json:"language_list"`
	MinutesLeftOnReserve float64             `json:"minutes_left_on_reserve"`
	Trolley              Trolley             `json:"trolley_contents"`
	ReserveDatetime      time.Time           `json:"reserve_iso8601_date_and_time"`
	PurchaseDatetime     time.Time           `json:"purchase_iso8601_date_and_time"`
	CurrencyDetails      map[string]Currency `json:"currency_details"`
	Customer             Customer            `json:"customer"`
	Status               string              `json:"transaction_status"`
}

StatusResult describes the current state of a transaction.

type TicketOrder

type TicketOrder struct {
	DiscountCode         string          `json:"discount_code"`
	DiscountSemanticType string          `json:"discount_semantic_type"`
	DiscountDesc         string          `json:"discount_desc"`
	NumberOfSeats        int             `json:"no_of_seats"`
	SaleSeatprice        decimal.Decimal `json:"sale_seatprice"`
	SaleSurcharge        decimal.Decimal `json:"sale_surcharge"`
	Seats                []Seat          `json:"seats"`
	TotalSaleSeatprice   decimal.Decimal `json:"total_sale_seatprice"`
	TotalSaleSurcharge   decimal.Decimal `json:"total_sale_surcharge"`
}

type TicketOrdersHolder

type TicketOrdersHolder struct {
	TicketOrders []TicketOrder `json:"ticket_order"`
}

type TicketType

type TicketType struct {
	Code       string      `json:"ticket_type_code"`
	Desc       string      `json:"ticket_type_desc"`
	PriceBands []PriceBand `json:"price_band"`
}

TicketType describes a sub set of available tickets defined by some non-price related parameters. Normally for venue based performances this will indicate a part of house or area within the venue.

type TransactionParams

type TransactionParams struct {
	UniversalParams
	TransactionUUID string
}

TransactionParams are parameters that can be passed into the ReleaseReservation and GetStatus calls.

func (*TransactionParams) Params

func (params *TransactionParams) Params() map[string]string

Params returns the call parameters as a map

type Trolley

type Trolley struct {
	Bundles         []Bundle       `json:"bundle"`
	TransactionUUID string         `json:"transaction_uuid"`
	TransactionID   string         `json:"transaction_id"`
	BundleCount     int            `json:"trolley_bundle_count"`
	OrderCount      int            `json:"trolley_order_count"`
	PurchaseResult  PurchaseResult `json:"purchase_result"`
}

type UniversalParams

type UniversalParams struct {
	AddCustomer                  bool
	Availability                 bool
	AvailabilityWithPerformances bool
	ExtraInfo                    bool
	Reviews                      bool
	Media                        bool
	CostRange                    bool
	BestValueOffer               bool
	MaxSavingOffer               bool
	MinCostOffer                 bool
	TopPriceOffer                bool
	NoSinglesData                bool
	CostRangeDetails             bool
	SourceInfo                   bool
	TrackingID                   string
	Misc                         map[string]string
}

UniversalParams are parameters that can be passed to any call

func (*UniversalParams) Universal

func (params *UniversalParams) Universal() map[string]string

Universal returns the parameters as a map of parameters

type UpsellList

type UpsellList struct {
	EventIds []string `json:"event_id"`
}

type User

type User struct {
	// the user identifier.
	ID string `json:"user_id"`
	// human readable name.
	Name string `json:"real_name"`
	// ISO 3166-1 country code.
	Country string `json:"default_country_code"`
	// the identifier of the sub user.
	SubUser string `json:"sub_user"`
	// indicates that the account is a b2b account.
	IsB2B bool `json:"is_b2b"`
	// what will appear on a customers bank statement when ingresso takes the
	// payment.
	StatementDescriptor string `json:"statement_descriptor"`
	// what product group a user belongs to. Users in the same backend_group
	// will see the same products.
	BackendGroup string `json:"backend_group"`
	// what content group a user belongs to. Users in the same content_group
	// will see the same textual and graphical content.
	ContentGroup string `json:"content_group"`
}

User describes a user of the API

type UserCommission

type UserCommission struct {
	IncVat       decimal.Decimal `json:"amount_excluding_vat"`
	ExVat        decimal.Decimal `json:"amount_including_vat"`
	CurrencyCode string          `json:"commission_currency_code"`
}

UserCommission describes how much a user will be paid for selling a ticket

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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