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.
import Foundation
import ServiceStack

public class CalculateTotalPriceOnService : ICompany, Codable
{
    /**
    * 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 var companyId:String?

    /**
    * Id of the service
    */
    // @ApiMember(Description="Id of the service", IsRequired=true, ParameterType="path")
    public var id:Int

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

    /**
    * Rebate codes applied to booking
    */
    // @ApiMember(Description="Rebate codes applied to booking")
    public var rebateCodeIds:[Int] = []

    /**
    * 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 var quantities:[QuantityToBook] = []

    /**
    * 
    */
    // @ApiMember(Description="")
    public var customerEmail:String

    required public init(){}
}

public class PriceInterval : Codable
{
    /**
    * 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 var from:Date

    /**
    * 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 var to:Date?

    required public init(){}
}

public class QuantityToBook : Codable
{
    /**
    * 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 var priceId:Int

    /**
    * 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 var quantity:Int

    /**
    * 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 var occupiesSpot:Bool

    required public init(){}
}

public class TotalPriceInformationResponse : Codable
{
    public var priceSign:String
    public var currencyId:String
    public var totalPrice:Double
    public var totalVatAmount:Double
    public var totalPriceBeforeRebate:Double
    public var appliedCodes:[AppliedRebateCodesResponse] = []
    public var priceDetails:[TotalPricePriceDetail] = []

    required public init(){}
}

public class AppliedRebateCodesResponse : Codable
{
    public var rebateCodeSign:String
    public var rebateCodeValue:Int
    public var rebateCodeType:RebateCodeTypeResponse
    public var rebateCodeId:Int
    public var rebateAmount:Double

    required public init(){}
}

public class RebateCodeTypeResponse : Codable
{
    public var id:Int
    public var name:String
    public var Description:String

    required public init(){}
}

public class TotalPricePriceDetail : Codable
{
    public var quantity:Int
    public var price:Double
    public var vatAmount:Double
    public var Description:String

    required public init(){}
}


Swift CalculateTotalPriceOnService DTOs

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

HTTP + CSV

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: text/csv
Content-Type: text/csv
Content-Length: length

{"CompanyId":"00000000-0000-0000-0000-000000000000","Id":0,"Interval":{"To":"0001-01-01T00:00:00"},"RebateCodeIds":[0],"Quantities":[{"PriceId":0,"Quantity":0,"OccupiesSpot":false}],"CustomerEmail":"String"}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{"PriceSign":"String","CurrencyId":"String","TotalPrice":0,"TotalVatAmount":0,"TotalPriceBeforeRebate":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"}]}