| Requires any of the roles: | bookingsupplier-administrator-write, superadmin |
| POST | /voss/discountAgreements | Create discount agreement | Create 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.*;
public class dtos
{
@ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
@ValidateRequest(Validator="IsAuthenticated")
public static class CreateVossDiscountAgreement
{
/**
* Discount agreement name
*/
@ApiMember(Description="Discount agreement name", IsRequired=true)
public String Name = null;
/**
* Discount agreement name
*/
@ApiMember(Description="Discount agreement name", IsRequired=true)
public ArrayList<CreateChargePlanDiscountRequestDto> ChargePlanDiscounts = new ArrayList<CreateChargePlanDiscountRequestDto>();
public String Description = null;
/**
* Discount agreement name
*/
@ApiMember(Description="Discount agreement name", IsRequired=true)
public Date ValidFrom = null;
/**
* Discount agreement name
*/
@ApiMember(Description="Discount agreement name")
public Date ValidTo = null;
/**
* Discount agreement name
*/
@ApiMember(Description="Discount agreement name")
public CreateDiscountPeriodRequestDto DiscountPeriod = null;
public String getName() { return Name; }
public CreateVossDiscountAgreement setName(String value) { this.Name = value; return this; }
public ArrayList<CreateChargePlanDiscountRequestDto> getChargePlanDiscounts() { return ChargePlanDiscounts; }
public CreateVossDiscountAgreement setChargePlanDiscounts(ArrayList<CreateChargePlanDiscountRequestDto> value) { this.ChargePlanDiscounts = value; return this; }
public String getDescription() { return Description; }
public CreateVossDiscountAgreement setDescription(String value) { this.Description = value; return this; }
public Date getValidFrom() { return ValidFrom; }
public CreateVossDiscountAgreement setValidFrom(Date value) { this.ValidFrom = value; return this; }
public Date getValidTo() { return ValidTo; }
public CreateVossDiscountAgreement setValidTo(Date value) { this.ValidTo = value; return this; }
public CreateDiscountPeriodRequestDto getDiscountPeriod() { return DiscountPeriod; }
public CreateVossDiscountAgreement setDiscountPeriod(CreateDiscountPeriodRequestDto value) { this.DiscountPeriod = value; return this; }
}
@DataContract(Name="CreateChargePlanDiscountRequestDto")
public static class CreateChargePlanDiscountRequestDto
{
@DataMember(Name="chargePlanId", IsRequired=true)
@SerializedName("chargePlanId")
public UUID ChargePlanId = null;
@DataMember(Name="productGroupDiscounts", EmitDefaultValue=false)
@SerializedName("productGroupDiscounts")
public ArrayList<CreateProductGroupDiscountRequestDto> ProductGroupDiscounts = new ArrayList<CreateProductGroupDiscountRequestDto>();
public UUID getChargePlanId() { return ChargePlanId; }
public CreateChargePlanDiscountRequestDto setChargePlanId(UUID value) { this.ChargePlanId = value; return this; }
public ArrayList<CreateProductGroupDiscountRequestDto> getProductGroupDiscounts() { return ProductGroupDiscounts; }
public CreateChargePlanDiscountRequestDto setProductGroupDiscounts(ArrayList<CreateProductGroupDiscountRequestDto> value) { this.ProductGroupDiscounts = value; return this; }
}
@DataContract(Name="CreateProductGroupDiscountRequestDto")
public static class CreateProductGroupDiscountRequestDto
{
@DataMember(Name="productGroupId", IsRequired=true)
@SerializedName("productGroupId")
public UUID ProductGroupId = null;
@DataMember(Name="productPricingDiscounts", EmitDefaultValue=false)
@SerializedName("productPricingDiscounts")
public ArrayList<ProductPricingDiscountRequestDto> ProductPricingDiscounts = new ArrayList<ProductPricingDiscountRequestDto>();
public UUID getProductGroupId() { return ProductGroupId; }
public CreateProductGroupDiscountRequestDto setProductGroupId(UUID value) { this.ProductGroupId = value; return this; }
public ArrayList<ProductPricingDiscountRequestDto> getProductPricingDiscounts() { return ProductPricingDiscounts; }
public CreateProductGroupDiscountRequestDto setProductPricingDiscounts(ArrayList<ProductPricingDiscountRequestDto> value) { this.ProductPricingDiscounts = value; return this; }
}
@DataContract(Name="ProductPricingDiscountRequestDto")
public static class ProductPricingDiscountRequestDto
{
@DataMember(Name="discountType", IsRequired=true)
@SerializedName("discountType")
public DiscountTypeEnum DiscountType = null;
@DataMember(Name="productId", IsRequired=true)
@SerializedName("productId")
public UUID ProductId = null;
@DataMember(Name="unitPriceDiscount", EmitDefaultValue=false)
@SerializedName("unitPriceDiscount")
public Double UnitPriceDiscount = null;
@DataMember(Name="tierPricingDiscounts", EmitDefaultValue=false)
@SerializedName("tierPricingDiscounts")
public ArrayList<CreatePricingTierDiscountRequestDto> TierPricingDiscounts = new ArrayList<CreatePricingTierDiscountRequestDto>();
public DiscountTypeEnum getDiscountType() { return DiscountType; }
public ProductPricingDiscountRequestDto setDiscountType(DiscountTypeEnum value) { this.DiscountType = value; return this; }
public UUID getProductId() { return ProductId; }
public ProductPricingDiscountRequestDto setProductId(UUID value) { this.ProductId = value; return this; }
public Double getUnitPriceDiscount() { return UnitPriceDiscount; }
public ProductPricingDiscountRequestDto setUnitPriceDiscount(Double value) { this.UnitPriceDiscount = value; return this; }
public ArrayList<CreatePricingTierDiscountRequestDto> getTierPricingDiscounts() { return TierPricingDiscounts; }
public ProductPricingDiscountRequestDto setTierPricingDiscounts(ArrayList<CreatePricingTierDiscountRequestDto> value) { this.TierPricingDiscounts = value; return this; }
}
public static enum DiscountTypeEnum
{
FlatPrice,
Percentage;
}
@DataContract(Name="CreatePricingTierDiscountRequestDto")
public static class CreatePricingTierDiscountRequestDto
{
@DataMember(Name="discountType", IsRequired=true)
@SerializedName("discountType")
public DiscountTypeEnum DiscountType = null;
@DataMember(Name="index", IsRequired=true)
@SerializedName("index")
public Integer Index = null;
@DataMember(Name="unitPriceDiscount", EmitDefaultValue=false)
@SerializedName("unitPriceDiscount")
public Double UnitPriceDiscount = null;
@DataMember(Name="flatPriceDiscount", EmitDefaultValue=false)
@SerializedName("flatPriceDiscount")
public Double FlatPriceDiscount = null;
public DiscountTypeEnum getDiscountType() { return DiscountType; }
public CreatePricingTierDiscountRequestDto setDiscountType(DiscountTypeEnum value) { this.DiscountType = value; return this; }
public Integer getIndex() { return Index; }
public CreatePricingTierDiscountRequestDto setIndex(Integer value) { this.Index = value; return this; }
public Double getUnitPriceDiscount() { return UnitPriceDiscount; }
public CreatePricingTierDiscountRequestDto setUnitPriceDiscount(Double value) { this.UnitPriceDiscount = value; return this; }
public Double getFlatPriceDiscount() { return FlatPriceDiscount; }
public CreatePricingTierDiscountRequestDto setFlatPriceDiscount(Double value) { this.FlatPriceDiscount = value; return this; }
}
@DataContract(Name="CreateDiscountPeriodRequestDto")
public static class CreateDiscountPeriodRequestDto
{
@DataMember(Name="periodKind", IsRequired=true)
@SerializedName("periodKind")
public PeriodKindEnum PeriodKind = null;
@DataMember(Name="length", EmitDefaultValue=false)
@SerializedName("length")
public DiscountAgreementTimeLengthRequestDto Length = null;
@DataMember(Name="periodIterationCount")
@SerializedName("periodIterationCount")
public Integer PeriodIterationCount = null;
public PeriodKindEnum getPeriodKind() { return PeriodKind; }
public CreateDiscountPeriodRequestDto setPeriodKind(PeriodKindEnum value) { this.PeriodKind = value; return this; }
public DiscountAgreementTimeLengthRequestDto getLength() { return Length; }
public CreateDiscountPeriodRequestDto setLength(DiscountAgreementTimeLengthRequestDto value) { this.Length = value; return this; }
public Integer getPeriodIterationCount() { return PeriodIterationCount; }
public CreateDiscountPeriodRequestDto setPeriodIterationCount(Integer value) { this.PeriodIterationCount = value; return this; }
}
public static enum PeriodKindEnum
{
FixedTime,
AlignedToBindingPeriod,
AlignedToSubscriptionBillingPeriod;
}
@DataContract(Name="DiscountAgreementTimeLengthRequestDto")
public static class DiscountAgreementTimeLengthRequestDto
{
@DataMember(Name="unit", IsRequired=true)
@SerializedName("unit")
public UnitEnum Unit = null;
@DataMember(Name="value", IsRequired=true)
@SerializedName("value")
public Integer Value = null;
public UnitEnum getUnit() { return Unit; }
public DiscountAgreementTimeLengthRequestDto setUnit(UnitEnum value) { this.Unit = value; return this; }
public Integer getValue() { return Value; }
public DiscountAgreementTimeLengthRequestDto setValue(Integer value) { this.Value = value; return this; }
}
public static enum UnitEnum
{
Day,
Month,
Year;
}
@DataContract(Name="DiscountAgreementResult")
public static class DiscountAgreementResult
{
@DataMember(Name="status", IsRequired=true)
@SerializedName("status")
public DiscountAgreementStatusEnum DiscountAgreementStatus = null;
@DataMember(Name="applicationScope", IsRequired=true)
@SerializedName("applicationScope")
public ApplicationScopeEnum ApplicationScope = null;
@DataMember(Name="id", IsRequired=true)
@SerializedName("id")
public UUID Id = null;
@DataMember(Name="versionId", IsRequired=true)
@SerializedName("versionId")
public UUID VersionId = null;
@DataMember(Name="sourceVersionId")
@SerializedName("sourceVersionId")
public UUID SourceVersionId = null;
@DataMember(Name="externalId")
@SerializedName("externalId")
public String ExternalId = null;
@DataMember(Name="name", IsRequired=true)
@SerializedName("name")
public String Name = null;
@DataMember(Name="description")
@SerializedName("description")
public String Description = null;
@DataMember(Name="validFrom", IsRequired=true)
@SerializedName("validFrom")
public Date ValidFrom = null;
@DataMember(Name="validTo")
@SerializedName("validTo")
public Date ValidTo = null;
@DataMember(Name="discountPeriod", EmitDefaultValue=false)
@SerializedName("discountPeriod")
public DiscountPeriodDto DiscountPeriod = null;
@DataMember(Name="package", IsRequired=true)
@SerializedName("package")
public DiscountPackageDto Package = null;
@DataMember(Name="customers", EmitDefaultValue=false)
@SerializedName("customers")
public ArrayList<DiscountAgreementCustomerResultDto> Customers = new ArrayList<DiscountAgreementCustomerResultDto>();
@DataMember(Name="customerGroups", EmitDefaultValue=false)
@SerializedName("customerGroups")
public ArrayList<DiscountAgreementCustomerGroupResultDto> CustomerGroups = new ArrayList<DiscountAgreementCustomerGroupResultDto>();
@DataMember(Name="chargePlanDiscounts", EmitDefaultValue=false)
@SerializedName("chargePlanDiscounts")
public ArrayList<ChargePlanDiscountResultDto> ChargePlanDiscounts = new ArrayList<ChargePlanDiscountResultDto>();
public DiscountAgreementStatusEnum getDiscountAgreementStatus() { return DiscountAgreementStatus; }
public DiscountAgreementResult setDiscountAgreementStatus(DiscountAgreementStatusEnum value) { this.DiscountAgreementStatus = value; return this; }
public ApplicationScopeEnum getApplicationScope() { return ApplicationScope; }
public DiscountAgreementResult setApplicationScope(ApplicationScopeEnum value) { this.ApplicationScope = value; return this; }
public UUID getId() { return Id; }
public DiscountAgreementResult setId(UUID value) { this.Id = value; return this; }
public UUID getVersionId() { return VersionId; }
public DiscountAgreementResult setVersionId(UUID value) { this.VersionId = value; return this; }
public UUID getSourceVersionId() { return SourceVersionId; }
public DiscountAgreementResult setSourceVersionId(UUID value) { this.SourceVersionId = value; return this; }
public String getExternalId() { return ExternalId; }
public DiscountAgreementResult setExternalId(String value) { this.ExternalId = value; return this; }
public String getName() { return Name; }
public DiscountAgreementResult setName(String value) { this.Name = value; return this; }
public String getDescription() { return Description; }
public DiscountAgreementResult setDescription(String value) { this.Description = value; return this; }
public Date getValidFrom() { return ValidFrom; }
public DiscountAgreementResult setValidFrom(Date value) { this.ValidFrom = value; return this; }
public Date getValidTo() { return ValidTo; }
public DiscountAgreementResult setValidTo(Date value) { this.ValidTo = value; return this; }
public DiscountPeriodDto getDiscountPeriod() { return DiscountPeriod; }
public DiscountAgreementResult setDiscountPeriod(DiscountPeriodDto value) { this.DiscountPeriod = value; return this; }
public DiscountPackageDto getPackage() { return Package; }
public DiscountAgreementResult setPackage(DiscountPackageDto value) { this.Package = value; return this; }
public ArrayList<DiscountAgreementCustomerResultDto> getCustomers() { return Customers; }
public DiscountAgreementResult setCustomers(ArrayList<DiscountAgreementCustomerResultDto> value) { this.Customers = value; return this; }
public ArrayList<DiscountAgreementCustomerGroupResultDto> getCustomerGroups() { return CustomerGroups; }
public DiscountAgreementResult setCustomerGroups(ArrayList<DiscountAgreementCustomerGroupResultDto> value) { this.CustomerGroups = value; return this; }
public ArrayList<ChargePlanDiscountResultDto> getChargePlanDiscounts() { return ChargePlanDiscounts; }
public DiscountAgreementResult setChargePlanDiscounts(ArrayList<ChargePlanDiscountResultDto> value) { this.ChargePlanDiscounts = value; return this; }
}
public static enum DiscountAgreementStatusEnum
{
Draft,
Staged,
Published,
Archived,
Discarded;
}
public static enum ApplicationScopeEnum
{
Any,
SubscriptionCustomer,
NonSubscriptionCustomerInvoiceRecipient;
}
@DataContract(Name="DiscountPeriodDto")
public static class DiscountPeriodDto
{
@DataMember(Name="periodKind", IsRequired=true)
@SerializedName("periodKind")
public PeriodKindEnum PeriodKind = null;
@DataMember(Name="length")
@SerializedName("length")
public TimeLengthDto Length = null;
@DataMember(Name="periodIterationCount")
@SerializedName("periodIterationCount")
public Integer PeriodIterationCount = null;
public PeriodKindEnum getPeriodKind() { return PeriodKind; }
public DiscountPeriodDto setPeriodKind(PeriodKindEnum value) { this.PeriodKind = value; return this; }
public TimeLengthDto getLength() { return Length; }
public DiscountPeriodDto setLength(TimeLengthDto value) { this.Length = value; return this; }
public Integer getPeriodIterationCount() { return PeriodIterationCount; }
public DiscountPeriodDto setPeriodIterationCount(Integer value) { this.PeriodIterationCount = value; return this; }
}
@DataContract(Name="TimeLengthDto")
public static class TimeLengthDto
{
@DataMember(Name="unit", IsRequired=true)
@SerializedName("unit")
public UnitEnum Unit = null;
@DataMember(Name="value", EmitDefaultValue=false)
@SerializedName("value")
public Integer Value = null;
public UnitEnum getUnit() { return Unit; }
public TimeLengthDto setUnit(UnitEnum value) { this.Unit = value; return this; }
public Integer getValue() { return Value; }
public TimeLengthDto setValue(Integer value) { this.Value = value; return this; }
}
@DataContract(Name="DiscountPackageDto")
public static class DiscountPackageDto
{
@DataMember(Name="id", IsRequired=true)
@SerializedName("id")
public UUID Id = null;
@DataMember(Name="name", IsRequired=true)
@SerializedName("name")
public String Name = null;
public UUID getId() { return Id; }
public DiscountPackageDto setId(UUID value) { this.Id = value; return this; }
public String getName() { return Name; }
public DiscountPackageDto setName(String value) { this.Name = value; return this; }
}
@DataContract(Name="DiscountAgreementCustomerResultDto")
public static class DiscountAgreementCustomerResultDto
{
@DataMember(Name="customerId", IsRequired=true)
@SerializedName("customerId")
public UUID CustomerId = null;
public UUID getCustomerId() { return CustomerId; }
public DiscountAgreementCustomerResultDto setCustomerId(UUID value) { this.CustomerId = value; return this; }
}
@DataContract(Name="DiscountAgreementCustomerGroupResultDto")
public static class DiscountAgreementCustomerGroupResultDto
{
@DataMember(Name="intervalStart", EmitDefaultValue=false)
@SerializedName("intervalStart")
public Integer IntervalStart = null;
@DataMember(Name="intervalEnd", EmitDefaultValue=false)
@SerializedName("intervalEnd")
public Integer IntervalEnd = null;
public Integer getIntervalStart() { return IntervalStart; }
public DiscountAgreementCustomerGroupResultDto setIntervalStart(Integer value) { this.IntervalStart = value; return this; }
public Integer getIntervalEnd() { return IntervalEnd; }
public DiscountAgreementCustomerGroupResultDto setIntervalEnd(Integer value) { this.IntervalEnd = value; return this; }
}
@DataContract(Name="ChargePlanDiscountResultDto")
public static class ChargePlanDiscountResultDto
{
@DataMember(Name="id", IsRequired=true)
@SerializedName("id")
public UUID Id = null;
@DataMember(Name="chargePlanId", IsRequired=true)
@SerializedName("chargePlanId")
public UUID ChargePlanId = null;
@DataMember(Name="productGroupDiscounts", EmitDefaultValue=false)
@SerializedName("productGroupDiscounts")
public ArrayList<ProductGroupDiscountResultDto> ProductGroupDiscounts = new ArrayList<ProductGroupDiscountResultDto>();
public UUID getId() { return Id; }
public ChargePlanDiscountResultDto setId(UUID value) { this.Id = value; return this; }
public UUID getChargePlanId() { return ChargePlanId; }
public ChargePlanDiscountResultDto setChargePlanId(UUID value) { this.ChargePlanId = value; return this; }
public ArrayList<ProductGroupDiscountResultDto> getProductGroupDiscounts() { return ProductGroupDiscounts; }
public ChargePlanDiscountResultDto setProductGroupDiscounts(ArrayList<ProductGroupDiscountResultDto> value) { this.ProductGroupDiscounts = value; return this; }
}
@DataContract(Name="ProductGroupDiscountResultDto")
public static class ProductGroupDiscountResultDto
{
@DataMember(Name="id", IsRequired=true)
@SerializedName("id")
public UUID Id = null;
@DataMember(Name="productGroupId", IsRequired=true)
@SerializedName("productGroupId")
public UUID ProductGroupId = null;
@DataMember(Name="productPricingDiscounts", EmitDefaultValue=false)
@SerializedName("productPricingDiscounts")
public ArrayList<ProductPricingDiscountResultDto> ProductPricingDiscounts = new ArrayList<ProductPricingDiscountResultDto>();
public UUID getId() { return Id; }
public ProductGroupDiscountResultDto setId(UUID value) { this.Id = value; return this; }
public UUID getProductGroupId() { return ProductGroupId; }
public ProductGroupDiscountResultDto setProductGroupId(UUID value) { this.ProductGroupId = value; return this; }
public ArrayList<ProductPricingDiscountResultDto> getProductPricingDiscounts() { return ProductPricingDiscounts; }
public ProductGroupDiscountResultDto setProductPricingDiscounts(ArrayList<ProductPricingDiscountResultDto> value) { this.ProductPricingDiscounts = value; return this; }
}
@DataContract(Name="ProductPricingDiscountResultDto")
public static class ProductPricingDiscountResultDto
{
@DataMember(Name="discountType", IsRequired=true)
@SerializedName("discountType")
public DiscountTypeEnum DiscountType = null;
@DataMember(Name="id", IsRequired=true)
@SerializedName("id")
public UUID Id = null;
@DataMember(Name="productId", IsRequired=true)
@SerializedName("productId")
public UUID ProductId = null;
@DataMember(Name="unitPriceDiscount", EmitDefaultValue=false)
@SerializedName("unitPriceDiscount")
public Double UnitPriceDiscount = null;
@DataMember(Name="tierPricingDiscounts", EmitDefaultValue=false)
@SerializedName("tierPricingDiscounts")
public ArrayList<PricingTierDiscountResultDto> TierPricingDiscounts = new ArrayList<PricingTierDiscountResultDto>();
public DiscountTypeEnum getDiscountType() { return DiscountType; }
public ProductPricingDiscountResultDto setDiscountType(DiscountTypeEnum value) { this.DiscountType = value; return this; }
public UUID getId() { return Id; }
public ProductPricingDiscountResultDto setId(UUID value) { this.Id = value; return this; }
public UUID getProductId() { return ProductId; }
public ProductPricingDiscountResultDto setProductId(UUID value) { this.ProductId = value; return this; }
public Double getUnitPriceDiscount() { return UnitPriceDiscount; }
public ProductPricingDiscountResultDto setUnitPriceDiscount(Double value) { this.UnitPriceDiscount = value; return this; }
public ArrayList<PricingTierDiscountResultDto> getTierPricingDiscounts() { return TierPricingDiscounts; }
public ProductPricingDiscountResultDto setTierPricingDiscounts(ArrayList<PricingTierDiscountResultDto> value) { this.TierPricingDiscounts = value; return this; }
}
@DataContract(Name="PricingTierDiscountResultDto")
public static class PricingTierDiscountResultDto
{
@DataMember(Name="discountType", IsRequired=true)
@SerializedName("discountType")
public DiscountTypeEnum DiscountType = null;
@DataMember(Name="id", IsRequired=true)
@SerializedName("id")
public UUID Id = null;
@DataMember(Name="index", EmitDefaultValue=false)
@SerializedName("index")
public Integer Index = null;
@DataMember(Name="unitPriceDiscount", EmitDefaultValue=false)
@SerializedName("unitPriceDiscount")
public Double UnitPriceDiscount = null;
@DataMember(Name="flatPriceDiscount", EmitDefaultValue=false)
@SerializedName("flatPriceDiscount")
public Double FlatPriceDiscount = null;
public DiscountTypeEnum getDiscountType() { return DiscountType; }
public PricingTierDiscountResultDto setDiscountType(DiscountTypeEnum value) { this.DiscountType = value; return this; }
public UUID getId() { return Id; }
public PricingTierDiscountResultDto setId(UUID value) { this.Id = value; return this; }
public Integer getIndex() { return Index; }
public PricingTierDiscountResultDto setIndex(Integer value) { this.Index = value; return this; }
public Double getUnitPriceDiscount() { return UnitPriceDiscount; }
public PricingTierDiscountResultDto setUnitPriceDiscount(Double value) { this.UnitPriceDiscount = value; return this; }
public Double getFlatPriceDiscount() { return FlatPriceDiscount; }
public PricingTierDiscountResultDto setFlatPriceDiscount(Double value) { this.FlatPriceDiscount = value; return this; }
}
}
Java CreateVossDiscountAgreement DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
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: text/jsv
Content-Type: text/jsv
Content-Length: length
{
Name: String,
ChargePlanDiscounts:
[
{
}
],
Description: String,
ValidTo: "0001-01-01T00:00:00"
}
HTTP/1.1 200 OK
Content-Type: text/jsv
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:
[
{
}
]
}