hob

package
v0.0.0-...-cbea63e Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2021 License: Apache-2.0, MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HobStatusBeta     = HobStatus("BETA")
	HobStatusEnabled  = HobStatus("ENABLED")
	HobStatusDisabled = HobStatus("DISABLED")
	HobStatusHidden   = HobStatus("HIDDEN")
)
View Source
const (
	ServiceTypeStatusEnabled  = ServiceTypeStatus("ENABLED")
	ServiceTypeStatusDisabled = ServiceTypeStatus("DISABLED")
	ServiceTypeStatusBeta     = ServiceTypeStatus("BETA")
)
View Source
const (
	GoingHomeDisabled = GoingHome("DISABLED")
	GoingHomeAlways   = GoingHome("ALWAYS")
	GoingHomePriority = GoingHome("PRIORITY")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AssumableServiceType

type AssumableServiceType struct {
	Id                  string `json:"id"`                  // service type
	AlwaysAssume        bool   `json:"alwaysAssume"`        // Always assume this service type
	AssumeForNewDrivers bool   `json:"assumeForNewDrivers"` // Assume for new drivers
}

func ProtoToAssumableServiceTypes

func ProtoToAssumableServiceTypes(types []*hobpb.AssumableServiceType) []*AssumableServiceType

type Centroid

type Centroid struct {
	Lat float64 `json:"lat"`
	Lng float64 `json:"lng"`
}

type Country

type Country struct {
	Cctld      string `json:"cctld"`
	ISO_3166_1 string `json:"iso_3166_1"`
}

type Fastpay

type Fastpay struct {
	Enabled   bool                        `json:"enabled"`
	Countries map[string][]FastpayCountry `json:"countries"`
}

type FastpayCountry

type FastpayCountry struct {
	Name string `json:"name"`
	Code string `json:"code"`
}

type GeoInfo

type GeoInfo struct {
	Centroid Centroid `json:"centroid"`
	Minimum  Location `json:"minimum"`
	Maximum  Location `json:"maximum"`
}

type GoingHome

type GoingHome string

type H2HobService

type H2HobService struct{}

func (*H2HobService) Multiconfig

func (c *H2HobService) Multiconfig(hobs, hobHashes, serviceTypesHashes []string) (newHobs, newHobsConfigs, newHobsHashes, newServiceTypesConfigs, newServiceTypesHashes []string, err error)

func (*H2HobService) ReadHob

func (c *H2HobService) ReadHob(hob string) (*Hob, error)

func (*H2HobService) ReadServiceTypes

func (c *H2HobService) ReadServiceTypes(hob string) (ServiceTypes, error)

type H4B

type H4B struct {
	RestrictDrivers bool `json:"restrictDrivers"`
}

type Hob

type Hob struct {
	Code                   string         `json:"code" readOnly:"true"`
	Name                   string         `json:"name"`
	Status                 HobStatus      `json:"status" enum:"BETA,ENABLED,DISABLED,HIDDEN"`
	Country                Country        `json:"country"`
	Currency               string         `json:"currency"`
	Language               string         `json:"language"`
	GeoInfo                GeoInfo        `json:"geoInfo"`
	Phone                  Phone          `json:"phone"`
	Timezone               string         `json:"timezone"`
	DefaultLocale          string         `json:"defaultLocale"`
	Locale                 string         `json:"locale"`
	Misc                   Misc           `json:"misc"`
	FastestFirst           bool           `json:"fastestFirst"` // Specified whether the "fastest first" feature in the passenger app is enabled
	H4B                    H4B            `json:"h4b"`
	Prebook                Prebook        `json:"prebook"`
	VehicleOptions         VehicleOptions `json:"vehicleOptions"`
	JobOfferVolumeOverride bool           `json:"jobOfferVolumeOverride" description:"Allow user to override job offer volume"`
	CustomJobRingtone      bool           `json:"customJobRingtone"`
	Fastpay                Fastpay        `json:"fastpay"`
}

Hob represents one of our regulatory areas

func GetHob

func GetHob(hob string) (*Hob, error)

Hob return the Hob object

func ProtoToHob

func ProtoToHob(s *hobpb.Hob) *Hob

func ReadHob

func ReadHob(scope *server.Request, hob string) (*Hob, error)

Deprecated, use GetHob(hob) instead.

func (*Hob) LocalTime

func (h *Hob) LocalTime(t time.Time) (time.Time, error)

LocalTime turns a UTC time.Time into a localised time for this HOB, based on the timezone If the HOB does not have a valid timezone defined, we will return the SAME time, and an error

func (*Hob) Location

func (h *Hob) Location() (*time.Location, error)

Location yields a time.Location appropriate for this HOB, or an error if failed to load

type HobData

type HobData struct {
	Hob              *Hob         `json:"hob"`
	HobHash          string       `json:"hobHash"`
	ServiceTypes     ServiceTypes `json:"serviceTypes"`
	ServiceTypesHash string       `json:"serviceTypesHash"`
}

type HobService

type HobService interface {
	ReadHob(hob string) (*Hob, error)
	ReadServiceTypes(hob string) (ServiceTypes, error)
	Multiconfig(hobs, hobHashes, serviceTypesHashes []string) (newHobs, newHobsConfigs, newHobsHashes, newServiceTypesConfigs, newServiceTypesHashes []string, err error)
}

type HobStatus

type HobStatus string

type HobsCache

type HobsCache interface {
	ReadHob(hob string) *Hob
	ReadServiceTypes(hob string) ServiceTypes
}
var (
	Cache HobsCache = MemoryHobsCache()
)

func MemoryHobsCache

func MemoryHobsCache() HobsCache

type I18nText

type I18nText struct {
	Id            string `json:"id"`
	Language      string `json:"language"`
	Text          string `json:"text"`
	IsDefaultLang bool   `json:"isDefaultLang"`
}

type Icons

type Icons struct {
	SelectorActive   string `json:"selectorActive"`
	SelectorInactive string `json:"selectorInactive"`
	PrebookList      string `json:"prebookList"`
}

func ProtoToIcons

func ProtoToIcons(icons *hobpb.Icons) Icons

type JobSettings

type JobSettings struct {
	Enabled                    bool      `json:"enabled"`
	CashJobs                   bool      `json:"cashJobs"`
	CardPayment                bool      `json:"cardPayment"`
	CardToCashSwitch           bool      `json:"cardToCashSwitch"`
	FareScreenType             uint32    `json:"fareScreenType"` // fareTypeMeterTip=0, fareTypeMeterTipTollsNoTipOnTolls=1, fareTypeFixedPriceTipTollsNoTipOnTolls=2
	FixedToVirtualMeterEnabled bool      `json:"fixedToVirtualEnabled"`
	ShowDriverAllocatedAlert   bool      `json:"showDriverAllocatedAlert"`
	SoonToClear                bool      `json:"soonToClear"`
	PriorityEnabled            bool      `json:"priorityEnabled"` // @DEPRECATED remove in favour of struct
	Priority                   Priority  `json:"priority"`
	GoingHome                  GoingHome `json:"goingHome" enum:"DISABLED,ALWAYS,PRIORITY" description:"How do we determine if going home is available"`
}

func ProtoToJobSettings

func ProtoToJobSettings(j *hobpb.JobSettings) JobSettings

type JsonDuration

type JsonDuration string

func (JsonDuration) Duration

func (jsonDuration JsonDuration) Duration() time.Duration

type Location

type Location struct {
	Lat float64 `json:"lat"`
	Lng float64 `json:"lng"`
}

type Misc

type Misc struct {
	DriverTermsUrl      string `json:"driverTerms"`   // The URL used in the driver app to point to Hailos' Terms&Conditions
	FallbackOnOsm       bool   `json:"fallbackOnOsm"` // The flag used in the driver app to indicate whether to use a fallback to Open Street Maps
	EnableProdDebugMenu bool   `json:"enableProdDebugMenu"`
	DistanceDisplayUnit int32  `json:"distanceDisplayUnit"` // Indicates whether the city uses miles or km in the driver app (MILES_UNIT = 0, KM_UNIT = 1)
	PayWithHailo        bool   `json:"payWithHailo"`
	ShowRouteToPickup   bool   `json:"showRouteToPickup"`
	CancellationPolicy  string `json:"cancellationPolicy"` // The URL to the Hob cancellation policy
	ShowStats           bool   `json:"showStats"`
	ShowAcceptRate      bool   `json:"showAcceptRate"`
	HelpCentreUrl       string `json:"helpCentre"` // The URL used in the driver app to point to Hailo Help pages
}

miscellaneous fields used by https://github.com/hailo-platform/H2O/go-api-lib/blob/master/driverconfig/driverconfig.go#L49 as this is a library not really sure what service to put them, so will stick them here for now.

type MockHobsCache

type MockHobsCache struct {
	mock.Mock
}

func (*MockHobsCache) ReadHob

func (c *MockHobsCache) ReadHob(hob string) *Hob

func (*MockHobsCache) ReadServiceTypes

func (c *MockHobsCache) ReadServiceTypes(hob string) ServiceTypes

type Phone

type Phone struct {
	CallingCode string `json:"callingCode"`
	TrunkPrefix string `json:"trunkPrefix"`
}

type Prebook

type Prebook struct {
	Enabled             bool  `json:"enabled"`
	ShowDestination     bool  `json:"showDestination"`
	ShowPrice           bool  `json:"showPrice"`
	PollInterval        int32 `json:"pollInterval"`
	StartupPollInterval int32 `json:"startupPollInterval"`
	ShowFilters         bool  `json:"showFilters"`
}

type Priority

type Priority struct {
	Enabled          bool   `json:"enabled"`
	MorningPeakText  string `json:"morningPeakText"`
	EveningPeakText  string `json:"eveningPeakText"`
	PeakTimeReminder bool   `json:"peak_time_reminder"`
}

func ProtoToPriority

func ProtoToPriority(p *hobpb.Priority) Priority

type ServiceType

type ServiceType struct {
	Id                           string                  `json:"id" readOnly:"true"`
	Name                         string                  `json:"name"`
	Status                       ServiceTypeStatus       `json:"status" enum:"BETA,ENABLED,DISABLED"`
	Tier                         uint32                  `json:"tier" description:"Preference order on PMUH screen"`
	FreeWaitingTime              JsonDuration            `json:"freeWaitingTime"`
	MaxUnverifiedFare            float64                 `json:"maxUnverifiedFare"` // i.e. 50.00
	MinAcceptableFare            float64                 `json:"minAcceptableFare"` // i.e. 2.20
	MinUnverifiedFare            float64                 `json:"minUnverifiedFare"` //i.e. 2.50
	MaxFare                      float64                 `json:"maxFare"`           // i.e. 999.00
	MinFare                      float64                 `json:"minFare"`           // i.e. 2.50
	FastPayFeePercentage         uint32                  `json:"fastpayFeePercentage"`
	FastPayMode                  uint32                  `json:"fastpayMode" enum:"0,1,2" description:"FAST_PAY_DISABLED = 0, FAST_PAY_DRIVER_PAYS = 1, FAST_PAY_CUSTOMER_PAYS = 2" ` // FAST_PAY_DISABLED = 0, FAST_PAY_DRIVER_PAYS = 1, FAST_PAY_CUSTOMER_PAYS = 2
	HailoJobSettings             JobSettings             `json:"hailoJobSettings"`
	TollsAndExtras               bool                    `json:"tollsAndExtras"`
	AutoOffShift                 JsonDuration            `json:"autoOffShift"`
	VirtualMeter                 bool                    `json:"virtualMeter" description:"whether the service type uses a virtual meter"`
	FixedVirtual                 bool                    `json:"fixedVirtual" description:"Use fixed fare pricing to calculate virtual meter rate from POB to job end"`
	PercentOverTaxiRate          int32                   `json:"percentOverTaxiRate"`
	MinEta                       int32                   `json:"minEta"`
	MaxEta                       int32                   `json:"maxEta"`
	JobHistoryEnabled            bool                    `json:"jobHistoryEnabled"`
	JobHistoryDeleteEnabled      bool                    `json:"jobHistoryDeleteEnabled"`
	AlwaysShowDestinationOnOffer bool                    `json:"alwaysShowDestinationOnOffer"`
	AssumableServiceTypes        []*AssumableServiceType `json:"assumableServiceTypes"`
	GoingHomeEnabled             bool                    `json:"goingHomeEnabled"`
	Icons                        Icons                   `json:"icons"`
	VehicleOptions               VehicleOptions          `json:"vehicleOptions"`
}

func GetServiceType

func GetServiceType(hob string, serviceType string) (*ServiceType, error)

ServiceType returns the service type for the given parameters

func GetTieredServiceTypeList

func GetTieredServiceTypeList(hob string) ([]*ServiceType, error)

func ProtoToServiceType

func ProtoToServiceType(s *hobpb.ServiceType) *ServiceType

func ReadServiceType

func ReadServiceType(scope *server.Request, hob string, serviceType string) (*ServiceType, error)

Deprecated, use GetServiceType(hob, serviceType) instead

func ReadTieredServiceTypeList

func ReadTieredServiceTypeList(scope *server.Request, hob string) ([]*ServiceType, error)

Depricated, use GetTieredServiceTypeList instead

type ServiceTypeStatus

type ServiceTypeStatus string

type ServiceTypes

type ServiceTypes map[string]*ServiceType

func GetServiceTypes

func GetServiceTypes(hob string) (ServiceTypes, error)

ServiceTypes returns all the service types for the given hob

func ReadServiceTypes

func ReadServiceTypes(scope *server.Request, hob string) (ServiceTypes, error)

Deprecated, use ServiceTypes instead

func (ServiceTypes) Ids

func (serviceTypes ServiceTypes) Ids() []string

type TieredServiceTypes

type TieredServiceTypes []*ServiceType

func (TieredServiceTypes) Len

func (t TieredServiceTypes) Len() int

func (TieredServiceTypes) Less

func (t TieredServiceTypes) Less(i, j int) bool

func (TieredServiceTypes) Swap

func (t TieredServiceTypes) Swap(i, j int)

type VehicleOptions

type VehicleOptions struct {
	Accessible bool    `json:"accessible"` // Show accessible on/off switch
	Passengers []int32 `json:"passengers"` // Number of seats available in vehicles. Ex: 5, 6
}

Options to display to the user when booking for this hob

func ProtoToVehicleOptions

func ProtoToVehicleOptions(vehicleOptions *hobpb.OverrideVehicleOptions) VehicleOptions

Jump to

Keyboard shortcuts

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