| PUT | /services/{Id}/calculateprice | Calculate price on service | Calculate an price on a service. |
|---|
"use strict";
export class RebateCodeTypeResponse {
/** @param {{Id?:number,Name?:string,Description?:string}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {number} */
Id;
/** @type {string} */
Name;
/** @type {string} */
Description;
}
export class AppliedRebateCodesResponse {
/** @param {{RebateCodeSign?:string,RebateCodeValue?:number,RebateCodeType?:RebateCodeTypeResponse,RebateCodeId?:number,RebateAmount?:number}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {string} */
RebateCodeSign;
/** @type {number} */
RebateCodeValue;
/** @type {RebateCodeTypeResponse} */
RebateCodeType;
/** @type {number} */
RebateCodeId;
/** @type {number} */
RebateAmount;
}
export class TotalPricePriceDetail {
/** @param {{Quantity?:number,Price?:number,VatAmount?:number,Description?:string}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {number} */
Quantity;
/** @type {number} */
Price;
/** @type {number} */
VatAmount;
/** @type {string} */
Description;
}
export class TotalPriceInformationResponse {
/** @param {{PriceSign?:string,CurrencyId?:string,TotalPrice?:number,TotalVatAmount?:number,TotalPriceBeforeRebate?:number,PriceDifference?:number,AppliedCodes?:AppliedRebateCodesResponse[],PriceDetails?:TotalPricePriceDetail[]}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {string} */
PriceSign;
/** @type {string} */
CurrencyId;
/** @type {number} */
TotalPrice;
/** @type {number} */
TotalVatAmount;
/** @type {number} */
TotalPriceBeforeRebate;
/** @type {number} */
PriceDifference;
/** @type {AppliedRebateCodesResponse[]} */
AppliedCodes = [];
/** @type {TotalPricePriceDetail[]} */
PriceDetails = [];
}
export class PriceInterval {
/** @param {{From?:string,To?:string}} [init] */
constructor(init) { Object.assign(this, init) }
/**
* @type {string}
* @description The start date and time for the price to be calculated. Normally the booking start datetime. */
From;
/**
* @type {?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. */
To;
}
export class ArticleToCreateBase {
/** @param {{ArticleId?:number,Quantity?:number}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {number} */
ArticleId;
/** @type {number} */
Quantity;
}
export class QuantityToBook {
/** @param {{PriceId?:number,Quantity?:number,OccupiesSpot?:boolean}} [init] */
constructor(init) { Object.assign(this, init) }
/**
* @type {number}
* @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) */
PriceId;
/**
* @type {number}
* @description Set the number of spots or resources you want to book on the specific price category */
Quantity;
/**
* @type {boolean}
* @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. */
OccupiesSpot;
}
export class CalculateTotalPriceOnService {
/** @param {{CompanyId?:string,Id?:number,BookingId?:number,Interval?:PriceInterval,RebateCodeIds?:number[],ArticleIds?:number[],Articles?:ArticleToCreateBase[],Quantities?:QuantityToBook[],CustomerEmail?:string}} [init] */
constructor(init) { Object.assign(this, init) }
/**
* @type {?string}
* @description The company id, if empty will use the company id for the user you are logged in with. */
CompanyId;
/**
* @type {number}
* @description Id of the service */
Id;
/**
* @type {?number}
* @description Optional booking id. If provided, the response will also contain the price difference compared to the existing booking price. */
BookingId;
/**
* @type {PriceInterval}
* @description The price interval to be used for calculations */
Interval;
/**
* @type {number[]}
* @description Rebate codes applied to booking */
RebateCodeIds = [];
/**
* @type {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. */
ArticleIds = [];
/**
* @type {ArticleToCreateBase[]}
* @description Articles (with quantity) that should be included in the price calculation. The articles must be of type ServiceAddonArticle and connected to the service. */
Articles = [];
/**
* @type {QuantityToBook[]}
* @description If you have selected to include the prices, here you can include the quantities to book to get the correct total price. */
Quantities = [];
/** @type {string} */
CustomerEmail;
}
JavaScript CalculateTotalPriceOnService DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other
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: testapi.bokamera.se
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length
{"CompanyId":"00000000-0000-0000-0000-000000000000","Id":0,"BookingId":0,"Interval":{"To":"0001-01-01T00:00:00"},"RebateCodeIds":[0],"ArticleIds":[0],"Articles":[{"ArticleId":0,"Quantity":0}],"Quantities":[{"PriceId":0,"Quantity":0,"OccupiesSpot":false}],"CustomerEmail":"String"}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length
{"PriceSign":"String","CurrencyId":"String","TotalPrice":0,"TotalVatAmount":0,"TotalPriceBeforeRebate":0,"PriceDifference":0,"AppliedCodes":[{"RebateCodeSign":"String","RebateCodeValue":0,"RebateCodeType":{"Id":0,"Name":"String","Description":"String"},"RebateCodeId":0,"RebateAmount":0}],"PriceDetails":[{"Quantity":0,"Price":0,"VatAmount":0,"Description":"String"}]}