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 java.math.*;
import java.util.*;
import net.servicestack.client.*;

public class dtos
{

    public static class CalculateTotalPriceOnService implements 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.")
        public UUID CompanyId = null;

        /**
        * Id of the service
        */
        @ApiMember(Description="Id of the service", IsRequired=true, ParameterType="path")
        public Integer Id = null;

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

        /**
        * If you have selected to include the prices, here you can include the rebate codes
        */
        @ApiMember(Description="If you have selected to include the prices, here you can include the rebate codes")
        public ArrayList<Integer> RebateCodeIds = null;

        /**
        * 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 ArrayList<QuantityToBook> Quantities = null;
        
        public UUID getCompanyId() { return CompanyId; }
        public CalculateTotalPriceOnService setCompanyId(UUID value) { this.CompanyId = value; return this; }
        public Integer getId() { return Id; }
        public CalculateTotalPriceOnService setId(Integer value) { this.Id = value; return this; }
        public PriceInterval getInterval() { return Interval; }
        public CalculateTotalPriceOnService setInterval(PriceInterval value) { this.Interval = value; return this; }
        public ArrayList<Integer> getRebateCodeIds() { return RebateCodeIds; }
        public CalculateTotalPriceOnService setRebateCodeIds(ArrayList<Integer> value) { this.RebateCodeIds = value; return this; }
        public ArrayList<QuantityToBook> getQuantities() { return Quantities; }
        public CalculateTotalPriceOnService setQuantities(ArrayList<QuantityToBook> value) { this.Quantities = value; return this; }
    }

    public static 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)
        public Date From = 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.")
        public Date To = null;
        
        public Date getFrom() { return From; }
        public PriceInterval setFrom(Date value) { this.From = value; return this; }
        public Date getTo() { return To; }
        public PriceInterval setTo(Date value) { this.To = value; return this; }
    }

    public static 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)
        public Integer PriceId = 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)
        public Integer Quantity = 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.")
        public Boolean OccupiesSpot = null;
        
        public Integer getPriceId() { return PriceId; }
        public QuantityToBook setPriceId(Integer value) { this.PriceId = value; return this; }
        public Integer getQuantity() { return Quantity; }
        public QuantityToBook setQuantity(Integer value) { this.Quantity = value; return this; }
        public Boolean isOccupiesSpot() { return OccupiesSpot; }
        public QuantityToBook setOccupiesSpot(Boolean value) { this.OccupiesSpot = value; return this; }
    }

    public static class TotalPriceInformationResponse
    {
        public String PriceSign = null;
        public String CurrencyId = null;
        public Double TotalPrice = null;
        public Double TotalVatAmount = null;
        public Double TotalPriceBeforeRebate = null;
        public ArrayList<AppliedRebateCodesResponse> AppliedCodes = null;
        public ArrayList<TotalPricePriceDetail> PriceDetails = null;
        
        public String getPriceSign() { return PriceSign; }
        public TotalPriceInformationResponse setPriceSign(String value) { this.PriceSign = value; return this; }
        public String getCurrencyId() { return CurrencyId; }
        public TotalPriceInformationResponse setCurrencyId(String value) { this.CurrencyId = value; return this; }
        public Double getTotalPrice() { return TotalPrice; }
        public TotalPriceInformationResponse setTotalPrice(Double value) { this.TotalPrice = value; return this; }
        public Double getTotalVatAmount() { return TotalVatAmount; }
        public TotalPriceInformationResponse setTotalVatAmount(Double value) { this.TotalVatAmount = value; return this; }
        public Double getTotalPriceBeforeRebate() { return TotalPriceBeforeRebate; }
        public TotalPriceInformationResponse setTotalPriceBeforeRebate(Double value) { this.TotalPriceBeforeRebate = value; return this; }
        public ArrayList<AppliedRebateCodesResponse> getAppliedCodes() { return AppliedCodes; }
        public TotalPriceInformationResponse setAppliedCodes(ArrayList<AppliedRebateCodesResponse> value) { this.AppliedCodes = value; return this; }
        public ArrayList<TotalPricePriceDetail> getPriceDetails() { return PriceDetails; }
        public TotalPriceInformationResponse setPriceDetails(ArrayList<TotalPricePriceDetail> value) { this.PriceDetails = value; return this; }
    }

    public static class AppliedRebateCodesResponse
    {
        public String RebateCodeSign = null;
        public Integer RebateCodeValue = null;
        public RebateCodeTypeItem RebateCodeType = null;
        public Integer RebateCodeId = null;
        public Double RebateAmount = null;
        
        public String getRebateCodeSign() { return RebateCodeSign; }
        public AppliedRebateCodesResponse setRebateCodeSign(String value) { this.RebateCodeSign = value; return this; }
        public Integer getRebateCodeValue() { return RebateCodeValue; }
        public AppliedRebateCodesResponse setRebateCodeValue(Integer value) { this.RebateCodeValue = value; return this; }
        public RebateCodeTypeItem getRebateCodeType() { return RebateCodeType; }
        public AppliedRebateCodesResponse setRebateCodeType(RebateCodeTypeItem value) { this.RebateCodeType = value; return this; }
        public Integer getRebateCodeId() { return RebateCodeId; }
        public AppliedRebateCodesResponse setRebateCodeId(Integer value) { this.RebateCodeId = value; return this; }
        public Double getRebateAmount() { return RebateAmount; }
        public AppliedRebateCodesResponse setRebateAmount(Double value) { this.RebateAmount = value; return this; }
    }

    public static class RebateCodeTypeItem
    {
        public Integer Id = null;
        public String Name = null;
        public String Description = null;
        
        public Integer getId() { return Id; }
        public RebateCodeTypeItem setId(Integer value) { this.Id = value; return this; }
        public String getName() { return Name; }
        public RebateCodeTypeItem setName(String value) { this.Name = value; return this; }
        public String getDescription() { return Description; }
        public RebateCodeTypeItem setDescription(String value) { this.Description = value; return this; }
    }

    public static class TotalPricePriceDetail
    {
        public Integer Quantity = null;
        public Double Price = null;
        public Double VatAmount = null;
        public String Description = null;
        
        public Integer getQuantity() { return Quantity; }
        public TotalPricePriceDetail setQuantity(Integer value) { this.Quantity = value; return this; }
        public Double getPrice() { return Price; }
        public TotalPricePriceDetail setPrice(Double value) { this.Price = value; return this; }
        public Double getVatAmount() { return VatAmount; }
        public TotalPricePriceDetail setVatAmount(Double value) { this.VatAmount = value; return this; }
        public String getDescription() { return Description; }
        public TotalPricePriceDetail setDescription(String value) { this.Description = value; return this; }
    }

}

Java CalculateTotalPriceOnService DTOs

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

HTTP + JSV

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/jsv
Content-Type: text/jsv
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
		}
	]
}
HTTP/1.1 200 OK
Content-Type: text/jsv
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
		}
	]
}