| PUT | /services/{Id}/calculateprice | Calculate price on service | Calculate an price on a service. |
|---|
import java.math.*
import java.util.*
import java.io.InputStream
import net.servicestack.client.*
open class CalculateTotalPriceOnService : ICompany
{
/**
* 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.")
override var CompanyId:UUID? = null
/**
* Id of the service
*/
@ApiMember(Description="Id of the service", IsRequired=true, ParameterType="path")
open var Id:Int? = null
/**
* 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.")
open var BookingId:Int? = null
/**
* The price interval to be used for calculations
*/
@ApiMember(Description="The price interval to be used for calculations", IsRequired=true)
open var Interval:PriceInterval? = null
/**
* Rebate codes applied to booking
*/
@ApiMember(Description="Rebate codes applied to booking")
open var RebateCodeIds:ArrayList<Int> = ArrayList<Int>()
/**
* 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.")
open var ArticleIds:ArrayList<Int> = ArrayList<Int>()
/**
* 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.")
open var Articles:ArrayList<ArticleToCreateBase> = ArrayList<ArticleToCreateBase>()
/**
* 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.")
open var Quantities:ArrayList<QuantityToBook> = ArrayList<QuantityToBook>()
/**
*
*/
@ApiMember(Description="")
open var CustomerEmail:String? = null
}
open class PriceInterval
{
/**
* 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)
open var From:Date? = null
/**
* 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.")
open var To:Date? = null
}
open class ArticleToCreateBase
{
open var ArticleId:Int? = null
open var Quantity:Int? = null
}
open class QuantityToBook
{
/**
* 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)
open var PriceId:Int? = null
/**
* 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)
open var Quantity:Int? = null
/**
* 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.")
open var OccupiesSpot:Boolean? = null
}
open class TotalPriceInformationResponse
{
open var PriceSign:String? = null
open var CurrencyId:String? = null
open var TotalPrice:Double? = null
open var TotalVatAmount:Double? = null
open var TotalPriceBeforeRebate:Double? = null
open var PriceDifference:Double? = null
open var AppliedCodes:ArrayList<AppliedRebateCodesResponse> = ArrayList<AppliedRebateCodesResponse>()
open var PriceDetails:ArrayList<TotalPricePriceDetail> = ArrayList<TotalPricePriceDetail>()
}
open class AppliedRebateCodesResponse
{
open var RebateCodeSign:String? = null
open var RebateCodeValue:Int? = null
open var RebateCodeType:RebateCodeTypeResponse? = null
open var RebateCodeId:Int? = null
open var RebateAmount:Double? = null
}
open class RebateCodeTypeResponse
{
open var Id:Int? = null
open var Name:String? = null
open var Description:String? = null
}
open class TotalPricePriceDetail
{
open var Quantity:Int? = null
open var Price:Double? = null
open var VatAmount:Double? = null
open var Description:String? = null
}
Kotlin 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"}]}