domainHotelCommon

package
v0.0.0-...-cc58ba3 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2019 License: GPL-3.0 Imports: 5 Imported by: 12

Documentation

Index

Constants

View Source
const (
	VI PaymentCardType = ""
	AX                 = ""
	BC                 = ""
	CA                 = ""
	CB                 = ""
	CU                 = ""
	DS                 = ""
	DC                 = ""
	T                  = ""
	R                  = ""
	N                  = ""
	L                  = ""
	E                  = ""
	JC                 = ""
	TO                 = ""
	S                  = ""
	EC                 = ""
	EU                 = ""
	TP                 = ""
	OP                 = ""
	ER                 = ""
	XS                 = ""
	O                  = ""
)

Variables

View Source
var UnknownType = fmt.Errorf("unknown input type")

Functions

func ToRateRulesType

func ToRateRulesType(s string) (access.RateRulesType, error)

Types

type Access

type Access struct {
	AccessId      string
	Configuration *access.AccessConfiguration
	Settings      *SettingsBase
}

type BasicOptionGrouper

type BasicOptionGrouper struct {
	// IndexFunc builds an index from an Option
	IndexFunc OptionIndexFunc
	// OptionGroupFunc takes a set of options and an option that results in another set of options
	GroupFunc     OptionGroupFunc
	GroupLenValue int
}

BasicOptionGrouper is a straightforward implementation of OptionGrouper that can be instanced with index and group functions, this package provides some of them

func (BasicOptionGrouper) Group

func (og BasicOptionGrouper) Group(idx string, opts Options, opt *Option) Options

func (BasicOptionGrouper) GroupLen

func (og BasicOptionGrouper) GroupLen() int

func (BasicOptionGrouper) Index

func (og BasicOptionGrouper) Index(opt *Option) string

type Bed

type Bed struct {
	Type        *string
	Description *string
	Count       *int
	Shared      *bool
}

type BookPax

type BookPax struct {
	Name    string
	Surname string
	Age     int32
}

type BookRoom

type BookRoom struct {
	OccupancyRefID int32
	Paxes          []BookPax
}

type BookingDetail

type BookingDetail struct {
	Reference    Reference
	Holder       *Holder
	Hotel        *BookingHotel
	Price        *Price
	CancelPolicy *CancelPolicy
	Remarks      *string
	Status       BookingStatusType
	Payable      *string
	Supplier     string
	OptionIDRq   *OptionID
}

func (*BookingDetail) Prices

func (o *BookingDetail) Prices() []*Price

type BookingHotel

type BookingHotel struct {
	CreationDate *string
	CheckIn      *string
	CheckOut     *string
	HotelCode    *string
	HotelName    *string
	BoardCode    *string
	Occupancies  *[]Occupancy
	Rooms        *[]BookingRoom
}

type BookingRoom

type BookingRoom struct {
	OccupancyRefId *int32
	Code           *string
	Description    *string
	Price          *Price
}

type BookingSearchType

type BookingSearchType int
const (
	Dates BookingSearchType = iota
	References
)

func (BookingSearchType) HotelApiDescription

func (dt BookingSearchType) HotelApiDescription() string

type BookingStatusType

type BookingStatusType string
const (
	BookKO BookingStatusType = "KO"
	BookOK BookingStatusType = "OK"
	BookRQ BookingStatusType = "ON_REQUEST"
	BookCN BookingStatusType = "CANCELLED"
	BookUN BookingStatusType = "UNKNOWN"
)

func ToBookingStatusType

func ToBookingStatusType(s string) (BookingStatusType, error)

type BusinessRules

type BusinessRules struct {
	OptionsQuota      *int
	BusinessRulesType *BusinessRulesType
}

type BusinessRulesType

type BusinessRulesType string
const (
	BusinessRulesTypeCheaperAmount BusinessRulesType = "CHEAPER_AMOUNT"
	BusinessRulesTypeRoomType      BusinessRulesType = "ROOM_TYPE"
)

func CheckBusinessRuleType

func CheckBusinessRuleType(s BusinessRulesType) (BusinessRulesType, error)

func (BusinessRulesType) Code

func (e BusinessRulesType) Code() (int, error)

func (BusinessRulesType) HotelApiDescription

func (brt BusinessRulesType) HotelApiDescription() string

func (BusinessRulesType) IsValid

func (e BusinessRulesType) IsValid() bool

func (BusinessRulesType) MarshalGQL

func (e BusinessRulesType) MarshalGQL(w io.Writer)

func (BusinessRulesType) String

func (e BusinessRulesType) String() string

func (*BusinessRulesType) UnmarshalGQL

func (e *BusinessRulesType) UnmarshalGQL(v interface{}) error

type CancelDetail

type CancelDetail struct {
	Reference             *Reference
	CancellationReference *string
	Status                *BookingStatusType
	Price                 *Price
}

func (*CancelDetail) Prices

func (cd *CancelDetail) Prices() []*Price

type CancelPenalty

type CancelPenalty struct {
	HoursBefore int               `json:"hoursBefore"`
	Type        CancelPenaltyType `json:"penaltyType" gqlgen:"penaltyType"`
	Currency    string            `json:"currency"`
	// Zechao: ha cambiado de amount a value, borra el comentario
	Value float64 `json:"value"`
}

type CancelPenaltyType

type CancelPenaltyType string
const (
	CancelPenaltyTypeNights  CancelPenaltyType = "NIGHTS"
	CancelPenaltyTypePercent CancelPenaltyType = "PERCENT"
	CancelPenaltyTypeImport  CancelPenaltyType = "IMPORT"
)

func ToCancelPenaltyType

func ToCancelPenaltyType(s string) (CancelPenaltyType, error)

func (CancelPenaltyType) IsValid

func (e CancelPenaltyType) IsValid() bool

func (CancelPenaltyType) MarshalGQL

func (e CancelPenaltyType) MarshalGQL(w io.Writer)

func (CancelPenaltyType) String

func (e CancelPenaltyType) String() string

func (*CancelPenaltyType) UnmarshalGQL

func (e *CancelPenaltyType) UnmarshalGQL(v interface{}) error

type CancelPolicy

type CancelPolicy struct {
	Refundable      bool            `json:"refundable"`
	CancelPenalties []CancelPenalty `json:"cancelPenalties"`
}

type ChargeType

type ChargeType string
const (
	ChargeTypeInclude ChargeType = "INCLUDE"
	ChargeTypeExclude ChargeType = "EXCLUDE"
)

func (ChargeType) IsValid

func (e ChargeType) IsValid() bool

func (ChargeType) MarshalGQL

func (e ChargeType) MarshalGQL(w io.Writer)

func (ChargeType) String

func (e ChargeType) String() string

func (*ChargeType) UnmarshalGQL

func (e *ChargeType) UnmarshalGQL(v interface{}) error

type DateType

type DateType int
const (
	ArrivalDate DateType = iota
	BookingCreationDate
)

func (DateType) HotelApiDescription

func (dt DateType) HotelApiDescription() string

type DeltaPrice

type DeltaPrice struct {
	Amount    *float64
	Percent   *float64
	ApplyBoth bool
}

type DurationType

type DurationType string
const (
	DurationTypeRange DurationType = "RANGE"
	DurationTypeOpen  DurationType = "OPEN"
)

func ToDurationType

func ToDurationType(s string) (DurationType, error)

func (DurationType) IsValid

func (e DurationType) IsValid() bool

func (DurationType) MarshalGQL

func (e DurationType) MarshalGQL(w io.Writer)

func (DurationType) String

func (e DurationType) String() string

func (*DurationType) UnmarshalGQL

func (e *DurationType) UnmarshalGQL(v interface{}) error

type Exchange

type Exchange struct {
	Currency string  `json:"currency"`
	Rate     float64 `json:"rate"`
}

type FilterPlugin

type FilterPlugin struct {
	Step PluginStepType
	Type PluginType
	Name string
}

type FilterPluginType

type FilterPluginType struct {
	Includes *[]FilterPlugin
	Excludes *[]FilterPlugin
}

type Holder

type Holder struct {
	Name    string
	Surname string
}

type HotelBaseRQ

type HotelBaseRQ struct {
	Settings *Settings `gqlgen:"settings"`
}

type IndexedOptions

type IndexedOptions map[string]Options

IndexedOptions is group of indexed sets of options

func (IndexedOptions) ToOptions

func (r IndexedOptions) ToOptions() Options

type Markup

type Markup struct {
	Channel  *string  `json:"channel"`
	Currency string   `json:"currency"`
	Binding  bool     `json:"binding"`
	Net      float64  `json:"net"`
	Gross    float64  `json:"gross"`
	Exchange Exchange `json:"exchange"`
	Rules    []Rule   `json:"rules"`
}

func (Markup) IsPriceable

func (Markup) IsPriceable()

type MarkupRuleType

type MarkupRuleType string
const (
	MarkupRuleTypePercent MarkupRuleType = "PERCENT"
	MarkupRuleTypeImport  MarkupRuleType = "IMPORT"
)

func (MarkupRuleType) IsValid

func (e MarkupRuleType) IsValid() bool

func (MarkupRuleType) MarshalGQL

func (e MarkupRuleType) MarshalGQL(w io.Writer)

func (MarkupRuleType) String

func (e MarkupRuleType) String() string

func (*MarkupRuleType) UnmarshalGQL

func (e *MarkupRuleType) UnmarshalGQL(v interface{}) error

type Occupancy

type Occupancy struct {
	Id    int   `json:"id"`
	Paxes []Pax `json:"paxes"`
}

type Option

type Option struct {
	Supplier          string        `json:"supplierCode" gqlgen:"supplierCode"`
	Access            string        `json:"accessCode" gqlgen:"accessCode"`
	Market            string        `json:"market"`
	HotelCode         string        `json:"hotelCode"`
	HotelName         *string       `json:"hotelName"`
	BoardCode         *string       `json:"boardCode"`
	BoardCodeOriginal string        `gqlgen:"boardCodeSupplier"`
	PaymentType       PaymentType   `json:"-"`
	Status            StatusType    `json:"status"`
	Occupancies       []Occupancy   `json:"occupancies"`
	Rooms             []Room        `json:"rooms"`
	Price             Price         `json:"price"`
	Supplements       []*Supplement `json:"supplements"`

	Surcharges   []Surcharge            `json:"surcharges"`
	RateRules    []access.RateRulesType `json:"rateRules"`
	CancelPolicy *CancelPolicy          `json:"cancelPolicy"`
	Remarks      *string                `json:"remarks"`
	OptionID     string                 `json:"id" gqlgen:"id"`
	Id           OptionID               `json:"-"`
	Token        string                 `json:"token"`
	Context      *string                `json:"-"`
	Group        *string                `json:"-"`
	RqDeepLink   *string                `json:"-"`
	Criteria     string                 `json:"-"`
}

func (*Option) HotelCodeSupplier

func (o *Option) HotelCodeSupplier() string

func (*Option) IsBookableOptionSearch

func (*Option) IsBookableOptionSearch()

func (*Option) PriceOption

func (o *Option) PriceOption() *Price

func (*Option) Prices

func (o *Option) Prices() []*Price

type OptionGroupFunc

type OptionGroupFunc func(string, Options, *Option) Options

OptionGroupFunc takes a set of options and an option that results in another set of options

func OptionLimitedAppend

func OptionLimitedAppend(groupLimit uint) OptionGroupFunc

OptionLimitedAppend appends the option to the set

type OptionGrouper

type OptionGrouper interface {
	// Index builds an option's index, two options with the same Index will be grouped
	Index(*Option) string
	// Group takes a set of options already grouped, a new option that belongs to this group, and a group result
	Group(string, Options, *Option) Options
	// GroupLen is the len used when instancing new groups
	GroupLen() int
}

OptionGrouper permits to make option groups given different patterns

type OptionID

type OptionID struct {
	StartDate     string
	EndDate       string
	HotelCode     string
	BoardCode     string
	PaymentType   PaymentType
	Market        string
	Nationality   string
	Language      string
	Currency      string
	OptionsQuota  *int32
	BusinessRules *BusinessRulesType
	AccessCode    string
	Rooms         []OptionIdRoom
	Parameters    []access.Parameter `json:"p"`
	Price         *OptionIdPrice
	// markup needed fields, we need codes in the context request in search
	ContextHC string
	// needs to be a pointer, its value is updated after parsing response, since OptionId is generated at resolving time
	// it will contain the correct value
	ContextBoard *string
	Rate         Rate
	// only from quote to book
	Refundable bool
}

type OptionIdPrice

type OptionIdPrice struct {
	Value                   string
	CommissionIntegration   string
	Binding                 string
	Currency                string
	CurrencyEx              string
	RateEx                  float64
	CommissionGross         float64
	CommissionNet           float64
	CommissionPluginApplied bool
	IsOldToken              bool
}

type OptionIdRoom

type OptionIdRoom struct {
	RefID int32
	ID    string
	Code  string
	Paxes []Pax
}

type OptionIndexFunc

type OptionIndexFunc func(*Option) string

OptionIndexFunc builds an index from an Option

type OptionQuote

type OptionQuote struct {
	OptionRefId  string
	Status       StatusType
	Price        Price
	CancelPolicy CancelPolicy
	Remarks      *string
	Surcharges   []Surcharge
	PaymentCards *[]string
	OptionId     *OptionID
	Supplier     string
}

func (*OptionQuote) Prices

func (o *OptionQuote) Prices() []*Price

type OptionType

type OptionType string
const (
	Hotel         OptionType = "HOTEL"
	HotelSkiPass  OptionType = "HOTEL_SKI_PASS"
	HotelEntrance OptionType = "HOTEL_ENTRANCE"
)

type Options

type Options []*Option

Options is a set of options with helper methods

func OptionAppend

func OptionAppend(opts Options, opt *Option) Options

OptionAppend appends the option to the set

func (Options) GroupBy

func (opts Options) GroupBy(og OptionGrouper) IndexedOptions

GroupBy takes 'Options' and indexes them by an 'OptionGrouper'

func (Options) SortBy

func (opts Options) SortBy(less func(i, j int) bool)

SortBy sorts the provided slice given the provided less function.

func (Options) SortByNetPrice

func (opts Options) SortByNetPrice()

SortByNetPrice will sort options from the lowest net price to the highest

type Pax

type Pax struct {
	Age int `json:"age"`
}

type PaymentCard

type PaymentCard struct {
	CardType string
	Holder   Holder
	Number   string
	CVC      string
	Expire   PaymentCardExpiration
}

type PaymentCardExpiration

type PaymentCardExpiration struct {
	Month int32
	Year  int32
}

type PaymentCardType

type PaymentCardType string

type PaymentType

type PaymentType string
const (
	PaymentTypeMerchant    PaymentType = "MERCHANT"
	PaymentTypeDirect      PaymentType = "DIRECT"
	PaymentTypeCardBooking PaymentType = "CARD_BOOKING"
	PaymentTypeCardCheckIn PaymentType = "CARD_CHECK_IN"
)

func ToPaymentType

func ToPaymentType(s string) (PaymentType, error)

func (PaymentType) Code

func (e PaymentType) Code() int

func (PaymentType) Description

func (pt PaymentType) Description() string

func (PaymentType) HotelApiDescription

func (e PaymentType) HotelApiDescription() string

func (PaymentType) IsValid

func (e PaymentType) IsValid() bool

func (PaymentType) MarshalGQL

func (e PaymentType) MarshalGQL(w io.Writer)

func (PaymentType) String

func (e PaymentType) String() string

func (*PaymentType) UnmarshalGQL

func (e *PaymentType) UnmarshalGQL(v interface{}) error

type Plugin

type Plugin struct {
	Name       string
	Type       PluginType
	Parameters *[]access.Parameter
}

type PluginFilter

type PluginFilter struct {
	Plugin *FilterPluginType
}

type PluginStep

type PluginStep struct {
	Step        PluginStepType
	PluginsType *[]Plugin
}

type PluginStepType

type PluginStepType string
const (
	PluginStepTypeRequest        PluginStepType = "REQUEST"
	PluginStepTypeRequestAccess  PluginStepType = "REQUEST_ACCESS"
	PluginStepTypeResponseOption PluginStepType = "RESPONSE_OPTION"
	PluginStepTypeResponseAccess PluginStepType = "RESPONSE_ACCESS"
	PluginStepTypeResponse       PluginStepType = "RESPONSE"
)

func (PluginStepType) IsValid

func (e PluginStepType) IsValid() bool

func (PluginStepType) MarshalGQL

func (e PluginStepType) MarshalGQL(w io.Writer)

func (PluginStepType) String

func (e PluginStepType) String() string

func (*PluginStepType) UnmarshalGQL

func (e *PluginStepType) UnmarshalGQL(v interface{}) error

type PluginType

type PluginType string
const (
	PluginTypePreStep            PluginType = "PRE_STEP"
	PluginTypeHotelMap           PluginType = "HOTEL_MAP"
	PluginTypeBoardMap           PluginType = "BOARD_MAP"
	PluginTypeRoomMap            PluginType = "ROOM_MAP"
	PluginTypeCurrencyConversion PluginType = "CURRENCY_CONVERSION"
	PluginTypeMarkup             PluginType = "MARKUP"
	PluginTypeAggregation        PluginType = "AGGREGATION"
	PluginTypePostStep           PluginType = "POST_STEP"
)

func (PluginType) IsValid

func (e PluginType) IsValid() bool

func (PluginType) MarshalGQL

func (e PluginType) MarshalGQL(w io.Writer)

func (PluginType) String

func (e PluginType) String() string

func (*PluginType) UnmarshalGQL

func (e *PluginType) UnmarshalGQL(v interface{}) error

type Plugins

type Plugins struct {
	Plugins *[]PluginStep
	Filter  *PluginFilter
}

type Price

type Price struct {
	Currency                string   `json:"currency"`
	Binding                 bool     `json:"binding"`
	Net                     float64  `json:"net"`
	Gross                   float64  `json:"gross"`
	CommissionIntegration   float64  `json:"-"`
	CommissionPluginApplied bool     `json:"-"`
	Exchange                Exchange `json:"exchange"`
	Markups                 []Markup `json:"markups"`
	CommissionNet           float64  `json:"-"`
	CommissionGross         float64  `json:"-"`
}

func (Price) ApplyCommissionBlue

func (p Price) ApplyCommissionBlue(comm float64) Price

don't use if NewPrice is not used previously

func (Price) ApplyCommissionRed

func (p Price) ApplyCommissionRed(comm float64) Price

don't use if NewPrice is not used previously

func (Price) IsPriceable

func (Price) IsPriceable()

type PriceBreakDown

type PriceBreakDown struct {
	EffectiveDate string `json:"effectiveDate"`
	ExpireDate    string `json:"expireDate"`
	Price         Price  `json:"price"`
}

type PriceType

type PriceType string
const (
	Gross  PriceType = "GROSS"
	Net    PriceType = "NET"
	Amount PriceType = "Amount"
)

type Promotion

type Promotion struct {
	Code          string
	Name          *string
	EffectiveDate *string
	ExpireDate    *string
}

type Rate

type Rate int
const (
	B2b Rate = iota
	B2c
)

type RatePlan

type RatePlan struct {
	Code          *string //Pointer because we need change value by the mapper
	OriginalCode  string
	Name          *string
	EffectiveDate *string
	ExpireDate    *string
}

type Reference

type Reference struct {
	Client   *string
	Supplier *string
}

type Resort

type Resort struct {
	Code        string
	Name        *string
	Description *string
}

type Room

type Room struct {
	OccupancyRefID int     `json:"occupancyRefId"`
	Code           *string `json:"code"` //Pointer because we need change value by the mapper
	OriginalCode   string
	Description    *string     `json:"description"`
	Refundable     *bool       `json:"refundable"`
	Units          *int        `json:"units"`
	RoomPrice      RoomPrice   `json:"roomPrice"`
	Beds           []Bed       `json:"beds"`
	RatePlans      []RatePlan  `json:"ratePlans"`
	Promotions     []Promotion `json:"promotions"`
}

type RoomPrice

type RoomPrice struct {
	Price     Price            `json:"price"`
	Breakdown []PriceBreakDown `json:"breakdowns"`
}

type Rule

type Rule struct {
	Id    string
	Name  *string
	Type  MarkupRuleType
	Value float64
}

type Settings

type Settings struct {
	SettingsBase

	Context      *string
	Client       *string
	Group        *string
	Org          string
	Suppliers    *[]Supplier
	Plugins      *[]PluginStep
	TestMode     *bool
	ClientTokens *[]string

	// deprecated
	UseContext  *bool
	ConnectUser *string

	// pinxo
	IsClientNewCommission_pinxo bool
	IsClientMap_pinxo           bool
	IsAvorisClient_pinxo        bool

	IsClientDiscardBoardMap_pinxo bool
	IsClientDiscardRoomMap_pinxo  bool
	IsClientDiscardRateMap_pinxo  bool
}

type SettingsBase

type SettingsBase struct {
	Timeout           *int
	AuditTransactions *bool
	BusinessRules     *BusinessRules
	Currency          *string
}

type StatusType

type StatusType string
const (
	StatusTypeOk StatusType = "OK"
	StatusTypeRq StatusType = "RQ"
)

func ToStatusType

func ToStatusType(s string) (StatusType, error)

func (StatusType) IsValid

func (e StatusType) IsValid() bool

func (StatusType) MarshalGQL

func (e StatusType) MarshalGQL(w io.Writer)

func (StatusType) String

func (e StatusType) String() string

func (*StatusType) UnmarshalGQL

func (e *StatusType) UnmarshalGQL(v interface{}) error

type Supplement

type Supplement struct {
	Code           *string //Pointer because we need change value by the mapper
	Name           *string
	Description    *string
	SupplementType SupplementType
	ChargeType     ChargeType
	Mandatory      bool
	DurationType   *DurationType
	Quantity       *int
	Unit           *UnitTimeType
	EffectiveDate  *string
	ExpireDate     *string
	Resort         *Resort
	Price          *Price
}

type SupplementType

type SupplementType string
const (
	SupplementTypeSkiPass   SupplementType = "SKI_PASS"
	SupplementTypeLessons   SupplementType = "LESSONS"
	SupplementTypeMeals     SupplementType = "MEALS"
	SupplementTypeEquipment SupplementType = "EQUIPMENT"
	SupplementTypeTicket    SupplementType = "TICKET"
	SupplementTypeTransfers SupplementType = "TRANSFERS"
	SupplementTypeGala      SupplementType = "GALA"
	SupplementTypeActivity  SupplementType = "ACTIVITY"
)

func ToSupplementType

func ToSupplementType(s string) (SupplementType, error)

func (SupplementType) IsValid

func (e SupplementType) IsValid() bool

func (SupplementType) MarshalGQL

func (e SupplementType) MarshalGQL(w io.Writer)

func (SupplementType) String

func (e SupplementType) String() string

func (*SupplementType) UnmarshalGQL

func (e *SupplementType) UnmarshalGQL(v interface{}) error

type Supplier

type Supplier struct {
	Settings *SettingsBase
	Code     string
	Accesses *[]Access
}

type Surcharge

type Surcharge struct {
	ChargeType  ChargeType
	Mandatory   bool
	Price       Price
	Description *string
}

type UnitTimeType

type UnitTimeType string
const (
	UnitTimeTypeDay  UnitTimeType = "DAY"
	UnitTimeTypeHour UnitTimeType = "HOUR"
)

func ToUnitType

func ToUnitType(s string) (UnitTimeType, error)

func (UnitTimeType) IsValid

func (e UnitTimeType) IsValid() bool

func (UnitTimeType) MarshalGQL

func (e UnitTimeType) MarshalGQL(w io.Writer)

func (UnitTimeType) String

func (e UnitTimeType) String() string

func (*UnitTimeType) UnmarshalGQL

func (e *UnitTimeType) UnmarshalGQL(v interface{}) error

Jump to

Keyboard shortcuts

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