BokaMera.API.Host

<back to all web services

CreateVossDiscountAgreement

Requires Authentication
Requires any of the roles:bookingsupplier-administrator-write, superadmin
The following routes are available for this service:
POST/voss/discountAgreementsCreate discount agreementCreate discount agreement in VOSS System.
import java.math.*
import java.util.*
import java.io.InputStream
import net.servicestack.client.*
import com.google.gson.annotations.*
import com.google.gson.reflect.*


@ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
@ValidateRequest(Validator="IsAuthenticated")
open class CreateVossDiscountAgreement
{
    /**
    * Discount agreement name
    */
    @ApiMember(Description="Discount agreement name", IsRequired=true)
    open var Name:String? = null

    /**
    * Discount agreement name
    */
    @ApiMember(Description="Discount agreement name", IsRequired=true)
    open var ChargePlanDiscounts:ArrayList<CreateChargePlanDiscountRequestDto> = ArrayList<CreateChargePlanDiscountRequestDto>()

    open var Description:String? = null
    /**
    * Discount agreement name
    */
    @ApiMember(Description="Discount agreement name", IsRequired=true)
    open var ValidFrom:Date? = null

    /**
    * Discount agreement name
    */
    @ApiMember(Description="Discount agreement name")
    open var ValidTo:Date? = null

    /**
    * Discount agreement name
    */
    @ApiMember(Description="Discount agreement name")
    open var DiscountPeriod:CreateDiscountPeriodRequestDto? = null
}

@DataContract(Name="CreateChargePlanDiscountRequestDto")
open class CreateChargePlanDiscountRequestDto
{
    @DataMember(Name="chargePlanId", IsRequired=true)
    @SerializedName("chargePlanId")
    open var ChargePlanId:UUID? = null

    @DataMember(Name="productGroupDiscounts", EmitDefaultValue=false)
    @SerializedName("productGroupDiscounts")
    open var ProductGroupDiscounts:ArrayList<CreateProductGroupDiscountRequestDto> = ArrayList<CreateProductGroupDiscountRequestDto>()
}

@DataContract(Name="CreateProductGroupDiscountRequestDto")
open class CreateProductGroupDiscountRequestDto
{
    @DataMember(Name="productGroupId", IsRequired=true)
    @SerializedName("productGroupId")
    open var ProductGroupId:UUID? = null

    @DataMember(Name="productPricingDiscounts", EmitDefaultValue=false)
    @SerializedName("productPricingDiscounts")
    open var ProductPricingDiscounts:ArrayList<ProductPricingDiscountRequestDto> = ArrayList<ProductPricingDiscountRequestDto>()
}

@DataContract(Name="ProductPricingDiscountRequestDto")
open class ProductPricingDiscountRequestDto
{
    @DataMember(Name="discountType", IsRequired=true)
    @SerializedName("discountType")
    open var DiscountType:DiscountTypeEnum? = null

    @DataMember(Name="productId", IsRequired=true)
    @SerializedName("productId")
    open var ProductId:UUID? = null

    @DataMember(Name="unitPriceDiscount", EmitDefaultValue=false)
    @SerializedName("unitPriceDiscount")
    open var UnitPriceDiscount:Double? = null

    @DataMember(Name="tierPricingDiscounts", EmitDefaultValue=false)
    @SerializedName("tierPricingDiscounts")
    open var TierPricingDiscounts:ArrayList<CreatePricingTierDiscountRequestDto> = ArrayList<CreatePricingTierDiscountRequestDto>()
}

enum class DiscountTypeEnum
{
    FlatPrice,
    Percentage,
}

@DataContract(Name="CreatePricingTierDiscountRequestDto")
open class CreatePricingTierDiscountRequestDto
{
    @DataMember(Name="discountType", IsRequired=true)
    @SerializedName("discountType")
    open var DiscountType:DiscountTypeEnum? = null

    @DataMember(Name="index", IsRequired=true)
    @SerializedName("index")
    open var Index:Int? = null

    @DataMember(Name="unitPriceDiscount", EmitDefaultValue=false)
    @SerializedName("unitPriceDiscount")
    open var UnitPriceDiscount:Double? = null

    @DataMember(Name="flatPriceDiscount", EmitDefaultValue=false)
    @SerializedName("flatPriceDiscount")
    open var FlatPriceDiscount:Double? = null
}

@DataContract(Name="CreateDiscountPeriodRequestDto")
open class CreateDiscountPeriodRequestDto
{
    @DataMember(Name="periodKind", IsRequired=true)
    @SerializedName("periodKind")
    open var PeriodKind:PeriodKindEnum? = null

    @DataMember(Name="length", EmitDefaultValue=false)
    @SerializedName("length")
    open var Length:DiscountAgreementTimeLengthRequestDto? = null

    @DataMember(Name="periodIterationCount")
    @SerializedName("periodIterationCount")
    open var PeriodIterationCount:Int? = null
}

enum class PeriodKindEnum
{
    FixedTime,
    AlignedToBindingPeriod,
    AlignedToSubscriptionBillingPeriod,
}

@DataContract(Name="DiscountAgreementTimeLengthRequestDto")
open class DiscountAgreementTimeLengthRequestDto
{
    @DataMember(Name="unit", IsRequired=true)
    @SerializedName("unit")
    open var Unit:UnitEnum? = null

    @DataMember(Name="value", IsRequired=true)
    @SerializedName("value")
    open var Value:Int? = null
}

enum class UnitEnum
{
    Day,
    Month,
    Year,
}

@DataContract(Name="DiscountAgreementResult")
open class DiscountAgreementResult
{
    @DataMember(Name="status", IsRequired=true)
    @SerializedName("status")
    open var DiscountAgreementStatus:DiscountAgreementStatusEnum? = null

    @DataMember(Name="applicationScope", IsRequired=true)
    @SerializedName("applicationScope")
    open var ApplicationScope:ApplicationScopeEnum? = null

    @DataMember(Name="id", IsRequired=true)
    @SerializedName("id")
    open var Id:UUID? = null

    @DataMember(Name="versionId", IsRequired=true)
    @SerializedName("versionId")
    open var VersionId:UUID? = null

    @DataMember(Name="sourceVersionId")
    @SerializedName("sourceVersionId")
    open var SourceVersionId:UUID? = null

    @DataMember(Name="externalId")
    @SerializedName("externalId")
    open var ExternalId:String? = null

    @DataMember(Name="name", IsRequired=true)
    @SerializedName("name")
    open var Name:String? = null

    @DataMember(Name="description")
    @SerializedName("description")
    open var Description:String? = null

    @DataMember(Name="validFrom", IsRequired=true)
    @SerializedName("validFrom")
    open var ValidFrom:Date? = null

    @DataMember(Name="validTo")
    @SerializedName("validTo")
    open var ValidTo:Date? = null

    @DataMember(Name="discountPeriod", EmitDefaultValue=false)
    @SerializedName("discountPeriod")
    open var DiscountPeriod:DiscountPeriodDto? = null

    @DataMember(Name="package", IsRequired=true)
    @SerializedName("package")
    open var Package:DiscountPackageDto? = null

    @DataMember(Name="customers", EmitDefaultValue=false)
    @SerializedName("customers")
    open var Customers:ArrayList<DiscountAgreementCustomerResultDto> = ArrayList<DiscountAgreementCustomerResultDto>()

    @DataMember(Name="customerGroups", EmitDefaultValue=false)
    @SerializedName("customerGroups")
    open var CustomerGroups:ArrayList<DiscountAgreementCustomerGroupResultDto> = ArrayList<DiscountAgreementCustomerGroupResultDto>()

    @DataMember(Name="chargePlanDiscounts", EmitDefaultValue=false)
    @SerializedName("chargePlanDiscounts")
    open var ChargePlanDiscounts:ArrayList<ChargePlanDiscountResultDto> = ArrayList<ChargePlanDiscountResultDto>()
}

enum class DiscountAgreementStatusEnum
{
    Draft,
    Staged,
    Published,
    Archived,
    Discarded,
}

enum class ApplicationScopeEnum
{
    Any,
    SubscriptionCustomer,
    NonSubscriptionCustomerInvoiceRecipient,
}

@DataContract(Name="DiscountPeriodDto")
open class DiscountPeriodDto
{
    @DataMember(Name="periodKind", IsRequired=true)
    @SerializedName("periodKind")
    open var PeriodKind:PeriodKindEnum? = null

    @DataMember(Name="length")
    @SerializedName("length")
    open var Length:TimeLengthDto? = null

    @DataMember(Name="periodIterationCount")
    @SerializedName("periodIterationCount")
    open var PeriodIterationCount:Int? = null
}

@DataContract(Name="TimeLengthDto")
open class TimeLengthDto
{
    @DataMember(Name="unit", IsRequired=true)
    @SerializedName("unit")
    open var Unit:UnitEnum? = null

    @DataMember(Name="value", EmitDefaultValue=false)
    @SerializedName("value")
    open var Value:Int? = null
}

@DataContract(Name="DiscountPackageDto")
open class DiscountPackageDto
{
    @DataMember(Name="id", IsRequired=true)
    @SerializedName("id")
    open var Id:UUID? = null

    @DataMember(Name="name", IsRequired=true)
    @SerializedName("name")
    open var Name:String? = null
}

@DataContract(Name="DiscountAgreementCustomerResultDto")
open class DiscountAgreementCustomerResultDto
{
    @DataMember(Name="customerId", IsRequired=true)
    @SerializedName("customerId")
    open var CustomerId:UUID? = null
}

@DataContract(Name="DiscountAgreementCustomerGroupResultDto")
open class DiscountAgreementCustomerGroupResultDto
{
    @DataMember(Name="intervalStart", EmitDefaultValue=false)
    @SerializedName("intervalStart")
    open var IntervalStart:Int? = null

    @DataMember(Name="intervalEnd", EmitDefaultValue=false)
    @SerializedName("intervalEnd")
    open var IntervalEnd:Int? = null
}

@DataContract(Name="ChargePlanDiscountResultDto")
open class ChargePlanDiscountResultDto
{
    @DataMember(Name="id", IsRequired=true)
    @SerializedName("id")
    open var Id:UUID? = null

    @DataMember(Name="chargePlanId", IsRequired=true)
    @SerializedName("chargePlanId")
    open var ChargePlanId:UUID? = null

    @DataMember(Name="productGroupDiscounts", EmitDefaultValue=false)
    @SerializedName("productGroupDiscounts")
    open var ProductGroupDiscounts:ArrayList<ProductGroupDiscountResultDto> = ArrayList<ProductGroupDiscountResultDto>()
}

@DataContract(Name="ProductGroupDiscountResultDto")
open class ProductGroupDiscountResultDto
{
    @DataMember(Name="id", IsRequired=true)
    @SerializedName("id")
    open var Id:UUID? = null

    @DataMember(Name="productGroupId", IsRequired=true)
    @SerializedName("productGroupId")
    open var ProductGroupId:UUID? = null

    @DataMember(Name="productPricingDiscounts", EmitDefaultValue=false)
    @SerializedName("productPricingDiscounts")
    open var ProductPricingDiscounts:ArrayList<ProductPricingDiscountResultDto> = ArrayList<ProductPricingDiscountResultDto>()
}

@DataContract(Name="ProductPricingDiscountResultDto")
open class ProductPricingDiscountResultDto
{
    @DataMember(Name="discountType", IsRequired=true)
    @SerializedName("discountType")
    open var DiscountType:DiscountTypeEnum? = null

    @DataMember(Name="id", IsRequired=true)
    @SerializedName("id")
    open var Id:UUID? = null

    @DataMember(Name="productId", IsRequired=true)
    @SerializedName("productId")
    open var ProductId:UUID? = null

    @DataMember(Name="unitPriceDiscount", EmitDefaultValue=false)
    @SerializedName("unitPriceDiscount")
    open var UnitPriceDiscount:Double? = null

    @DataMember(Name="tierPricingDiscounts", EmitDefaultValue=false)
    @SerializedName("tierPricingDiscounts")
    open var TierPricingDiscounts:ArrayList<PricingTierDiscountResultDto> = ArrayList<PricingTierDiscountResultDto>()
}

@DataContract(Name="PricingTierDiscountResultDto")
open class PricingTierDiscountResultDto
{
    @DataMember(Name="discountType", IsRequired=true)
    @SerializedName("discountType")
    open var DiscountType:DiscountTypeEnum? = null

    @DataMember(Name="id", IsRequired=true)
    @SerializedName("id")
    open var Id:UUID? = null

    @DataMember(Name="index", EmitDefaultValue=false)
    @SerializedName("index")
    open var Index:Int? = null

    @DataMember(Name="unitPriceDiscount", EmitDefaultValue=false)
    @SerializedName("unitPriceDiscount")
    open var UnitPriceDiscount:Double? = null

    @DataMember(Name="flatPriceDiscount", EmitDefaultValue=false)
    @SerializedName("flatPriceDiscount")
    open var FlatPriceDiscount:Double? = null
}

Kotlin CreateVossDiscountAgreement 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.

POST /voss/discountAgreements HTTP/1.1 
Host: api.bokamera.se 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"Name":"String","ChargePlanDiscounts":[{}],"Description":"String","ValidTo":"0001-01-01T00:00:00"}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"status":"Draft","applicationScope":"Any","sourceVersionId":"00000000-0000-0000-0000-000000000000","externalId":"String","name":"String","description":"String","validTo":"0001-01-01T00:00:00","customers":[{}],"customerGroups":[{}],"chargePlanDiscounts":[{}]}