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.
Imports System
Imports System.Collections
Imports System.Collections.Generic
Imports System.Runtime.Serialization
Imports ServiceStack
Imports ServiceStack.DataAnnotations
Imports BokaMera.API.ServiceModel.Dtos

Namespace Global

    Namespace BokaMera.API.ServiceModel.Dtos

        Public Partial Class AppliedRebateCodesResponse
            Public Overridable Property RebateCodeSign As String
            Public Overridable Property RebateCodeValue As Integer
            Public Overridable Property RebateCodeType As RebateCodeTypeItem
            Public Overridable Property RebateCodeId As Integer
            Public Overridable Property RebateAmount As Double
        End Class

        Public Partial Class CalculateTotalPriceOnService
            Implements ICompany
            Public Sub New()
                RebateCodeIdsWithAmount = New List(Of RebateCodeAppliedWithAmount)
                Quantities = New QuantityToBook(){}
            End Sub

            '''<Summary>
            '''The company id, if empty will use the company id for the user you are logged in with.
            '''</Summary>
            <ApiMember(Description:="The company id, if empty will use the company id for the user you are logged in with.")>
            Public Overridable Property CompanyId As Nullable(Of Guid)

            '''<Summary>
            '''Id of the service
            '''</Summary>
            <ApiMember(Description:="Id of the service", IsRequired:=true, ParameterType:="path")>
            Public Overridable Property Id As Integer

            '''<Summary>
            '''The price interval to be used for calculations
            '''</Summary>
            <ApiMember(Description:="The price interval to be used for calculations", IsRequired:=true)>
            Public Overridable Property Interval As PriceInterval

            '''<Summary>
            '''Rebate codes applied to booking
            '''</Summary>
            <ApiMember(Description:="Rebate codes applied to booking")>
            Public Overridable Property RebateCodeIdsWithAmount As List(Of RebateCodeAppliedWithAmount)

            '''<Summary>
            '''If you have selected to include the prices, here you can include the quantities to book to get the correct total price.
            '''</Summary>
            <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 Overridable Property Quantities As QuantityToBook()
        End Class

        Public Partial Class PriceInterval
            '''<Summary>
            '''The start date and time for the price to be calculated. Normally the booking start datetime.
            '''</Summary>
            <ApiMember(Description:="The start date and time for the price to be calculated. Normally the booking start datetime.", IsRequired:=true)>
            Public Overridable Property From As Date

            '''<Summary>
            '''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.
            '''</Summary>
            <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 Overridable Property To As Nullable(Of Date)
        End Class

        Public Partial Class QuantityToBook
            '''<Summary>
            '''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)
            '''</Summary>
            <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 Overridable Property PriceId As Integer

            '''<Summary>
            '''Set the number of spots or resources you want to book on the specific price category
            '''</Summary>
            <ApiMember(Description:="Set the number of spots or resources you want to book on the specific price category", IsRequired:=true)>
            Public Overridable Property Quantity As Integer

            '''<Summary>
            '''If the quantity you add should occupy a spot. Default is true. If no it will only be a row that includes price information.
            '''</Summary>
            <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 Overridable Property OccupiesSpot As Boolean
        End Class

        Public Partial Class RebateCodeAppliedWithAmount
            Public Overridable Property Id As Integer
        End Class

        Public Partial Class RebateCodeTypeItem
            Public Overridable Property Id As Integer
            Public Overridable Property Name As String
            Public Overridable Property Description As String
        End Class

        Public Partial Class TotalPriceInformationResponse
            Public Sub New()
                AppliedCodes = New List(Of AppliedRebateCodesResponse)
                PriceDetails = New List(Of TotalPricePriceDetail)
            End Sub

            Public Overridable Property PriceSign As String
            Public Overridable Property CurrencyId As String
            Public Overridable Property TotalPrice As Double
            Public Overridable Property TotalVatAmount As Double
            Public Overridable Property TotalPriceBeforeRebate As Double
            Public Overridable Property AppliedCodes As List(Of AppliedRebateCodesResponse)
            Public Overridable Property PriceDetails As List(Of TotalPricePriceDetail)
        End Class

        Public Partial Class TotalPricePriceDetail
            Public Overridable Property Quantity As Integer
            Public Overridable Property Price As Double
            Public Overridable Property VatAmount As Double
            Public Overridable Property Description As String
        End Class
    End Namespace
End Namespace

VB.NET CalculateTotalPriceOnService DTOs

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

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

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: application/json
Content-Type: application/json
Content-Length: length

{"CompanyId":"00000000-0000-0000-0000-000000000000","Id":0,"Interval":{"To":"0001-01-01T00:00:00"},"RebateCodeIdsWithAmount":[{"Id":0}],"Quantities":[{"PriceId":0,"Quantity":0,"OccupiesSpot":false}]}
HTTP/1.1 200 OK
Content-Type: application/json
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"}]}