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

namespace BokaMera.API.ServiceModel.Dtos
{
    public partial class AppliedRebateCodesResponse
    {
        public virtual string RebateCodeSign { get; set; }
        public virtual int RebateCodeValue { get; set; }
        public virtual RebateCodeTypeResponse RebateCodeType { get; set; }
        public virtual int RebateCodeId { get; set; }
        public virtual double RebateAmount { get; set; }
    }

    public partial class CalculateTotalPriceOnService
        : ICompany
    {
        public CalculateTotalPriceOnService()
        {
            RebateCodeIds = new List<int>{};
            Quantities = new QuantityToBook[]{};
        }

        ///<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 virtual Guid? CompanyId { get; set; }

        ///<summary>
        ///Id of the service
        ///</summary>
        [ApiMember(Description="Id of the service", IsRequired=true, ParameterType="path")]
        public virtual int Id { get; set; }

        ///<summary>
        ///The price interval to be used for calculations
        ///</summary>
        [ApiMember(Description="The price interval to be used for calculations", IsRequired=true)]
        public virtual PriceInterval Interval { get; set; }

        ///<summary>
        ///Rebate codes applied to booking
        ///</summary>
        [ApiMember(Description="Rebate codes applied to booking")]
        public virtual List<int> RebateCodeIds { get; set; }

        ///<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 virtual QuantityToBook[] Quantities { get; set; }

        ///<summary>
        ///
        ///</summary>
        [ApiMember(Description="")]
        public virtual string CustomerEmail { get; set; }
    }

    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 virtual DateTime From { get; set; }

        ///<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 virtual DateTime? To { get; set; }
    }

    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 virtual int PriceId { get; set; }

        ///<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 virtual int Quantity { get; set; }

        ///<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 virtual bool OccupiesSpot { get; set; }
    }

    public partial class RebateCodeTypeResponse
    {
        public virtual int Id { get; set; }
        public virtual string Name { get; set; }
        public virtual string Description { get; set; }
    }

    public partial class TotalPriceInformationResponse
    {
        public TotalPriceInformationResponse()
        {
            AppliedCodes = new List<AppliedRebateCodesResponse>{};
            PriceDetails = new List<TotalPricePriceDetail>{};
        }

        public virtual string PriceSign { get; set; }
        public virtual string CurrencyId { get; set; }
        public virtual double TotalPrice { get; set; }
        public virtual double TotalVatAmount { get; set; }
        public virtual double TotalPriceBeforeRebate { get; set; }
        public virtual List<AppliedRebateCodesResponse> AppliedCodes { get; set; }
        public virtual List<TotalPricePriceDetail> PriceDetails { get; set; }
    }

    public partial class TotalPricePriceDetail
    {
        public virtual int Quantity { get; set; }
        public virtual double Price { get; set; }
        public virtual double VatAmount { get; set; }
        public virtual string Description { get; set; }
    }

}

C# 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: api.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"},"RebateCodeIds":[0],"Quantities":[{"PriceId":0,"Quantity":0,"OccupiesSpot":false}],"CustomerEmail":"String"}
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"}]}