BokaMera.API.Host

<back to all web services

CalculateTotalPriceOnService

The following routes are available for this service:
PUT/services/{Id}/calculatepriceCalculate price on serviceCalculate an price on a service.
// @ts-nocheck

export class RebateCodeTypeResponse
{
    public Id: number;
    public Name: string;
    public Description: string;

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

export class AppliedRebateCodesResponse
{
    public RebateCodeSign: string;
    public RebateCodeValue: number;
    public RebateCodeType: RebateCodeTypeResponse;
    public RebateCodeId: number;
    public RebateAmount: number;

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

export class TotalPricePriceDetail
{
    public Quantity: number;
    public Price: number;
    public VatAmount: number;
    public Description: string;
    public ArticleId: number;
    public MaxQuantity: number;

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

export class TotalPriceInformationResponse
{
    public PriceSign: string;
    public CurrencyId: string;
    public TotalPrice: number;
    public TotalVatAmount: number;
    public TotalPriceBeforeRebate: number;
    public PriceDifference: number;
    public AppliedCodes: AppliedRebateCodesResponse[] = [];
    public PriceDetails: TotalPricePriceDetail[] = [];

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

export class PriceInterval
{
    /** @description The start date and time for the price to be calculated. Normally the booking start datetime. */
    // @ApiMember(Description="The start date and time for the price to be calculated. Normally the booking start datetime.", IsRequired=true)
    public From: string;

    /** @description The end date and time for the price to be calculated.Normally the booking end datetime. If nothing entered it will use the service length. */
    // @ApiMember(Description="The end date and time for the price to be calculated.Normally the booking end datetime. If nothing entered it will use the service length.")
    public To?: string;

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

export class ArticleToCreateBase
{
    public ArticleId: number;
    public Quantity: number;

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

export class QuantityToBook
{
    /** @description If service has a price, enter the price id for that price. If no price exists for the service set 0 as PriceId. If you put 0 and a price exists, it will use that price (only works if just one price exists for the current selected date to book) */
    // @ApiMember(Description="If service has a price, enter the price id for that price. If no price exists for the service set 0 as PriceId. If you put 0 and a price exists, it will use that price (only works if just one price exists for the current selected date to book)", IsRequired=true)
    public PriceId: number;

    /** @description Set the number of spots or resources you want to book on the specific price category */
    // @ApiMember(Description="Set the number of spots or resources you want to book on the specific price category", IsRequired=true)
    public Quantity: number;

    /** @description If the quantity you add should occupy a spot. Default is true. If no it will only be a row that includes price information. */
    // @ApiMember(Description="If the quantity you add should occupy a spot. Default is true. If no it will only be a row that includes price information.")
    public OccupiesSpot: boolean;

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

export class CalculateTotalPriceOnService 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 Id of the service */
    // @ApiMember(Description="Id of the service", IsRequired=true, ParameterType="path")
    public Id: number;

    /** @description Optional booking id. If provided, the response will also contain the price difference compared to the existing booking price. */
    // @ApiMember(Description="Optional booking id. If provided, the response will also contain the price difference compared to the existing booking price.")
    public BookingId?: number;

    /** @description The price interval to be used for calculations */
    // @ApiMember(Description="The price interval to be used for calculations", IsRequired=true)
    public Interval: PriceInterval;

    /** @description Rebate codes applied to booking */
    // @ApiMember(Description="Rebate codes applied to booking")
    public RebateCodeIds: number[] = [];

    /** @description DEPRECATED — use Articles instead. Article ids that should be included in the price calculation. The articles must be of type ServiceAddonArticle and connected to the service. Duplicate ids are counted as quantity. */
    // @ApiMember(Description="DEPRECATED — use Articles instead. Article ids that should be included in the price calculation. The articles must be of type ServiceAddonArticle and connected to the service. Duplicate ids are counted as quantity.")
    public ArticleIds: number[] = [];

    /** @description Articles (with quantity) that should be included in the price calculation. The articles must be of type ServiceAddonArticle and connected to the service. */
    // @ApiMember(Description="Articles (with quantity) that should be included in the price calculation. The articles must be of type ServiceAddonArticle and connected to the service.")
    public Articles: ArticleToCreateBase[] = [];

    /** @description If you have selected to include the prices, here you can include the quantities to book to get the correct total price. */
    // @ApiMember(Description="If you have selected to include the prices, here you can include the quantities to book to get the correct total price.")
    public Quantities: QuantityToBook[] = [];

    /** @description  */
    // @ApiMember(Description="")
    public CustomerEmail: string;

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

TypeScript CalculateTotalPriceOnService DTOs

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

HTTP + XML

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

PUT /services/{Id}/calculateprice HTTP/1.1 
Host: api.bokamera.se 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<CalculateTotalPriceOnService xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos">
  <ArticleIds xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <d2p1:int>0</d2p1:int>
  </ArticleIds>
  <Articles>
    <ArticleToCreateBase>
      <ArticleId>0</ArticleId>
      <Quantity>0</Quantity>
    </ArticleToCreateBase>
  </Articles>
  <BookingId>0</BookingId>
  <CompanyId>00000000-0000-0000-0000-000000000000</CompanyId>
  <CustomerEmail>String</CustomerEmail>
  <Id>0</Id>
  <Interval>
    <From>0001-01-01T00:00:00</From>
    <To>0001-01-01T00:00:00</To>
  </Interval>
  <Quantities>
    <QuantityToBook>
      <OccupiesSpot>false</OccupiesSpot>
      <PriceId>0</PriceId>
      <Quantity>0</Quantity>
    </QuantityToBook>
  </Quantities>
  <RebateCodeIds xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <d2p1:int>0</d2p1:int>
  </RebateCodeIds>
</CalculateTotalPriceOnService>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<TotalPriceInformationResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos">
  <AppliedCodes>
    <AppliedRebateCodesResponse>
      <RebateAmount>0</RebateAmount>
      <RebateCodeId>0</RebateCodeId>
      <RebateCodeSign>String</RebateCodeSign>
      <RebateCodeType>
        <Description>String</Description>
        <Id>0</Id>
        <Name>String</Name>
      </RebateCodeType>
      <RebateCodeValue>0</RebateCodeValue>
    </AppliedRebateCodesResponse>
  </AppliedCodes>
  <CurrencyId>String</CurrencyId>
  <PriceDetails>
    <TotalPricePriceDetail>
      <ArticleId>0</ArticleId>
      <Description>String</Description>
      <MaxQuantity>0</MaxQuantity>
      <Price>0</Price>
      <Quantity>0</Quantity>
      <VatAmount>0</VatAmount>
    </TotalPricePriceDetail>
  </PriceDetails>
  <PriceDifference>0</PriceDifference>
  <PriceSign>String</PriceSign>
  <TotalPrice>0</TotalPrice>
  <TotalPriceBeforeRebate>0</TotalPriceBeforeRebate>
  <TotalVatAmount>0</TotalVatAmount>
</TotalPriceInformationResponse>