BokaMera.API.Host

<back to all web services

CreateServicePrice

Requires Authentication
Requires any of the roles:bookingsupplier-administrator-write, superadmin
The following routes are available for this service:
POST/services/prices/Create a priceCreate a new price on the service

export class DayOfWeekDto
{
    public DayOfWeekId: number;
    public DotNetDayOfWeekId: number;
    public DayOfWeek: string;

    public constructor(init?: Partial<DayOfWeekDto>) { (Object as any).assign(this, init); }
}

export class GroupBookingSettings
{
    public Active: boolean;
    public Min: number;
    public Max: number;

    public constructor(init?: Partial<GroupBookingSettings>) { (Object as any).assign(this, init); }
}

export class MultipleResourceSettings
{
    public Active: boolean;
    public Min: number;
    public Max: number;

    public constructor(init?: Partial<MultipleResourceSettings>) { (Object as any).assign(this, init); }
}

export class ServiceInfoResponse
{
    public Id: number;
    public Name: string;
    public Description: string;
    public ImageUrl: string;
    public LengthInMinutes?: number;
    public MaxNumberOfSpotsPerBooking: number;
    public MinNumberOfSpotsPerBooking: number;
    public GroupBooking: GroupBookingSettings;
    public MultipleResource: MultipleResourceSettings;
    public IsGroupBooking: boolean;
    public IsPaymentEnabled: boolean;

    public constructor(init?: Partial<ServiceInfoResponse>) { (Object as any).assign(this, init); }
}

export class ServicePriceResponse
{
    /** @description The company id */
    // @ApiMember(Description="The company id")
    public CompanyId: string;

    /** @description The price id */
    // @ApiMember(Description="The price id")
    public Id: number;

    /** @description The service id */
    // @ApiMember(Description="The service id")
    public ServiceId: number;

    /** @description The price */
    // @ApiMember(Description="The price")
    public Price: number;

    /** @description The price calculation type id, 1 = Normal, price is for the service total duration, 2 = Price is per minute, 3 = Price is per hour, 4= Price is per day */
    // @ApiMember(Description="The price calculation type id, 1 = Normal, price is for the service total duration, 2 = Price is per minute, 3 = Price is per hour, 4= Price is per day")
    public CalculationTypeId: number;

    /** @description The price currency */
    // @ApiMember(Description="The price currency")
    public CurrencyId: string;

    /** @description The price sign */
    // @ApiMember(Description="The price sign")
    public PriceSign: string;

    /** @description The price VAT in percent */
    // @ApiMember(Description="The price VAT in percent")
    public VAT: number;

    /** @description The price category if price has a category */
    // @ApiMember(Description="The price category if price has a category")
    public Category: string;

    /** @description The price text to display */
    // @ApiMember(Description="The price text to display")
    public PriceText: string;

    /** @description The valid from date for the price. */
    // @ApiMember(Description="The valid from date for the price.")
    public From: string;

    /** @description The valid to date for the price. */
    // @ApiMember(Description="The valid to date for the price.")
    public To: string;

    /** @description If the price is only valid for specific days in week add a comma separated list of which days this day price belongs to, 1 = Monday .. 7 = Sunday. All old days connected will be removed on update. */
    // @ApiMember(Description="If the price is only valid for specific days in week add a comma separated list of which days this day price belongs to, 1 = Monday .. 7 = Sunday. All old days connected will be removed on update.")
    public DaysOfWeek: DayOfWeekDto[];

    /** @description If the price is only valid for specific days in week add a comma separated list of which days this day price belongs to, 1 = Monday .. 7 = Sunday. All old days connected will be removed on update. */
    // @ApiMember(Description="If the price is only valid for specific days in week add a comma separated list of which days this day price belongs to, 1 = Monday .. 7 = Sunday. All old days connected will be removed on update.")
    public FromTime?: string;

    /** @description If the price is only valid for a specific time span during a time of day enter the FromTime and ToTime parameters. */
    // @ApiMember(Description="If the price is only valid for a specific time span during a time of day enter the FromTime and ToTime parameters.")
    public ToTime?: string;

    public Service: ServiceInfoResponse;
    /** @description If the price is only valid for a specific time span */
    // @ApiMember(Description="If the price is only valid for a specific time span")
    public IsTimeSpecific: boolean;

    /** @description If the price is only valid for specific days of week */
    // @ApiMember(Description="If the price is only valid for specific days of week")
    public IsDaysOfWeekSpecific: boolean;

    public constructor(init?: Partial<ServicePriceResponse>) { (Object as any).assign(this, init); }
}

// @ValidateRequest(Validator="IsAuthenticated")
export class CreateServicePrice implements ICompany
{
    /** @description The company id, if empty will use the company id for the user you are logged in with. */
    // @ApiMember(Description="The company id, if empty will use the company id for the user you are logged in with.")
    public CompanyId?: string;

    /** @description The service id */
    // @ApiMember(Description="The service id", IsRequired=true)
    public ServiceId: number;

    /** @description The price */
    // @ApiMember(Description="The price", IsRequired=true)
    public Price: number;

    /** @description The price currency */
    // @ApiMember(Description="The price currency", IsRequired=true)
    public CurrencyId: string;

    /** @description The price calculation type id, 1 = Normal, price is for the service total duration, 2 = Price is per minute, 3 = Price is per hour, 4= Price is per day */
    // @ApiMember(Description="The price calculation type id, 1 = Normal, price is for the service total duration, 2 = Price is per minute, 3 = Price is per hour, 4= Price is per day", IsRequired=true)
    public CalculationTypeId: number;

    /** @description The price VAT in percent */
    // @ApiMember(Description="The price VAT in percent", IsRequired=true)
    public VAT: number;

    /** @description The price category if price has a category */
    // @ApiMember(Description="The price category if price has a category")
    public Category: string;

    /** @description The valid from date for the price. */
    // @ApiMember(Description="The valid from date for the price.")
    public From: string;

    /** @description The valid to date for the price. */
    // @ApiMember(Description="The valid to date for the price.")
    public To: string;

    /** @description If the price is only valid for specific days in week add a comma separated list of which days this day price belongs to, 1 = Monday .. 7 = Sunday. All old days connected will be removed on update. */
    // @ApiMember(Description="If the price is only valid for specific days in week add a comma separated list of which days this day price belongs to, 1 = Monday .. 7 = Sunday. All old days connected will be removed on update.")
    public DaysOfWeek: number[];

    /** @description If the price is only valid for specific days in week add a comma separated list of which days this day price belongs to, 1 = Monday .. 7 = Sunday. All old days connected will be removed on update. */
    // @ApiMember(Description="If the price is only valid for specific days in week add a comma separated list of which days this day price belongs to, 1 = Monday .. 7 = Sunday. All old days connected will be removed on update.")
    public FromTime?: string;

    /** @description If the price is only valid for a specific time span during a time of day enter the FromTime and ToTime parameters. */
    // @ApiMember(Description="If the price is only valid for a specific time span during a time of day enter the FromTime and ToTime parameters.")
    public ToTime?: string;

    public constructor(init?: Partial<CreateServicePrice>) { (Object as any).assign(this, init); }
}

TypeScript CreateServicePrice DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv

HTTP + JSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /services/prices/ HTTP/1.1 
Host: api.bokamera.se 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	CompanyId: 00000000-0000-0000-0000-000000000000,
	ServiceId: 0,
	Price: 0,
	CurrencyId: String,
	CalculationTypeId: 0,
	VAT: 0,
	Category: String,
	DaysOfWeek: 
	[
		0
	],
	FromTime: PT0S,
	ToTime: PT0S
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	Id: 0,
	ServiceId: 0,
	Price: 0,
	CalculationTypeId: 0,
	CurrencyId: String,
	PriceSign: String,
	VAT: 0,
	Category: String,
	PriceText: String,
	DaysOfWeek: 
	[
		{
			DayOfWeekId: 0,
			DotNetDayOfWeekId: 0,
			DayOfWeek: String
		}
	],
	FromTime: PT0S,
	ToTime: PT0S,
	Service: 
	{
		Id: 0,
		Name: String,
		Description: String,
		LengthInMinutes: 0,
		MaxNumberOfSpotsPerBooking: 0,
		MinNumberOfSpotsPerBooking: 0,
		GroupBooking: 
		{
			Active: False,
			Min: 0,
			Max: 0
		},
		MultipleResource: 
		{
			Active: False,
			Min: 0,
			Max: 0
		},
		IsGroupBooking: False,
		IsPaymentEnabled: False
	},
	IsTimeSpecific: False,
	IsDaysOfWeekSpecific: False
}