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

Namespace Global

    Namespace BokaMera.API.ServiceModel.Dtos

        <ApiResponse(Description:="You were unauthorized to call this service", StatusCode:=401)>
        <ValidateRequest(Validator:="IsAuthenticated")>
        Public Partial Class CreateVossDiscountAgreement
            '''<Summary>
            '''Discount agreement name
            '''</Summary>
            <ApiMember(Description:="Discount agreement name", IsRequired:=true)>
            Public Overridable Property Name As String

            '''<Summary>
            '''Discount agreement name
            '''</Summary>
            <ApiMember(Description:="Discount agreement name", IsRequired:=true)>
            Public Overridable Property ChargePlanDiscounts As List(Of CreateChargePlanDiscountRequestDto) = New List(Of CreateChargePlanDiscountRequestDto)

            Public Overridable Property Description As String
            '''<Summary>
            '''Discount agreement name
            '''</Summary>
            <ApiMember(Description:="Discount agreement name", IsRequired:=true)>
            Public Overridable Property ValidFrom As Date

            '''<Summary>
            '''Discount agreement name
            '''</Summary>
            <ApiMember(Description:="Discount agreement name")>
            Public Overridable Property ValidTo As Date?

            '''<Summary>
            '''Discount agreement name
            '''</Summary>
            <ApiMember(Description:="Discount agreement name")>
            Public Overridable Property DiscountPeriod As CreateDiscountPeriodRequestDto
        End Class
    End Namespace

    Namespace BokaMera.VossIntegration.ApiTools.Enums

        Public Enum DiscountAgreementStatusEnum
            Draft
            Staged
            Published
            Archived
            Discarded
        End Enum

        Public Enum DiscountTypeEnum
            FlatPrice
            Percentage
        End Enum

        Public Enum PeriodKindEnum
            FixedTime
            AlignedToBindingPeriod
            AlignedToSubscriptionBillingPeriod
        End Enum
    End Namespace

    Namespace BokaMera.VossIntegration.ApiTools.Model

        <DataContract(Name:="ChargePlanDiscountResultDto")>
        Public Partial Class ChargePlanDiscountResultDto
            <DataMember(Name:="id", IsRequired:=true)>
            Public Overridable Property Id As Guid

            <DataMember(Name:="chargePlanId", IsRequired:=true)>
            Public Overridable Property ChargePlanId As Guid

            <DataMember(Name:="productGroupDiscounts", EmitDefaultValue:=false)>
            Public Overridable Property ProductGroupDiscounts As List(Of ProductGroupDiscountResultDto) = New List(Of ProductGroupDiscountResultDto)
        End Class

        <DataContract(Name:="CreateChargePlanDiscountRequestDto")>
        Public Partial Class CreateChargePlanDiscountRequestDto
            <DataMember(Name:="chargePlanId", IsRequired:=true)>
            Public Overridable Property ChargePlanId As Guid

            <DataMember(Name:="productGroupDiscounts", EmitDefaultValue:=false)>
            Public Overridable Property ProductGroupDiscounts As List(Of CreateProductGroupDiscountRequestDto) = New List(Of CreateProductGroupDiscountRequestDto)
        End Class

        <DataContract(Name:="CreateDiscountPeriodRequestDto")>
        Public Partial Class CreateDiscountPeriodRequestDto
            <DataMember(Name:="periodKind", IsRequired:=true)>
            Public Overridable Property PeriodKind As PeriodKindEnum

            <DataMember(Name:="length", EmitDefaultValue:=false)>
            Public Overridable Property Length As DiscountAgreementTimeLengthRequestDto

            <DataMember(Name:="periodIterationCount")>
            Public Overridable Property PeriodIterationCount As Integer?
        End Class

        <DataContract(Name:="CreatePricingTierDiscountRequestDto")>
        Public Partial Class CreatePricingTierDiscountRequestDto
            <DataMember(Name:="discountType", IsRequired:=true)>
            Public Overridable Property DiscountType As DiscountTypeEnum

            <DataMember(Name:="index", IsRequired:=true)>
            Public Overridable Property Index As Integer

            <DataMember(Name:="unitPriceDiscount", EmitDefaultValue:=false)>
            Public Overridable Property UnitPriceDiscount As Double

            <DataMember(Name:="flatPriceDiscount", EmitDefaultValue:=false)>
            Public Overridable Property FlatPriceDiscount As Double
        End Class

        <DataContract(Name:="CreateProductGroupDiscountRequestDto")>
        Public Partial Class CreateProductGroupDiscountRequestDto
            <DataMember(Name:="productGroupId", IsRequired:=true)>
            Public Overridable Property ProductGroupId As Guid

            <DataMember(Name:="productPricingDiscounts", EmitDefaultValue:=false)>
            Public Overridable Property ProductPricingDiscounts As List(Of ProductPricingDiscountRequestDto) = New List(Of ProductPricingDiscountRequestDto)
        End Class

        <DataContract(Name:="DiscountAgreementCustomerGroupResultDto")>
        Public Partial Class DiscountAgreementCustomerGroupResultDto
            <DataMember(Name:="intervalStart", EmitDefaultValue:=false)>
            Public Overridable Property IntervalStart As Integer

            <DataMember(Name:="intervalEnd", EmitDefaultValue:=false)>
            Public Overridable Property IntervalEnd As Integer
        End Class

        <DataContract(Name:="DiscountAgreementCustomerResultDto")>
        Public Partial Class DiscountAgreementCustomerResultDto
            <DataMember(Name:="customerId", IsRequired:=true)>
            Public Overridable Property CustomerId As Guid
        End Class

        <DataContract(Name:="DiscountAgreementResult")>
        Public Partial Class DiscountAgreementResult
            <DataMember(Name:="status", IsRequired:=true)>
            Public Overridable Property DiscountAgreementStatus As DiscountAgreementStatusEnum

            <DataMember(Name:="applicationScope", IsRequired:=true)>
            Public Overridable Property ApplicationScope As ApplicationScopeEnum

            <DataMember(Name:="id", IsRequired:=true)>
            Public Overridable Property Id As Guid

            <DataMember(Name:="versionId", IsRequired:=true)>
            Public Overridable Property VersionId As Guid

            <DataMember(Name:="sourceVersionId")>
            Public Overridable Property SourceVersionId As Guid?

            <DataMember(Name:="externalId")>
            Public Overridable Property ExternalId As String

            <DataMember(Name:="name", IsRequired:=true)>
            Public Overridable Property Name As String

            <DataMember(Name:="description")>
            Public Overridable Property Description As String

            <DataMember(Name:="validFrom", IsRequired:=true)>
            Public Overridable Property ValidFrom As Date

            <DataMember(Name:="validTo")>
            Public Overridable Property ValidTo As Date?

            <DataMember(Name:="discountPeriod", EmitDefaultValue:=false)>
            Public Overridable Property DiscountPeriod As DiscountPeriodDto

            <DataMember(Name:="package", IsRequired:=true)>
            Public Overridable Property Package As DiscountPackageDto

            <DataMember(Name:="customers", EmitDefaultValue:=false)>
            Public Overridable Property Customers As List(Of DiscountAgreementCustomerResultDto) = New List(Of DiscountAgreementCustomerResultDto)

            <DataMember(Name:="customerGroups", EmitDefaultValue:=false)>
            Public Overridable Property CustomerGroups As List(Of DiscountAgreementCustomerGroupResultDto) = New List(Of DiscountAgreementCustomerGroupResultDto)

            <DataMember(Name:="chargePlanDiscounts", EmitDefaultValue:=false)>
            Public Overridable Property ChargePlanDiscounts As List(Of ChargePlanDiscountResultDto) = New List(Of ChargePlanDiscountResultDto)

            Public Enum ApplicationScopeEnum
                Any
                SubscriptionCustomer
                NonSubscriptionCustomerInvoiceRecipient
            End Enum
        End Class

        <DataContract(Name:="DiscountAgreementTimeLengthRequestDto")>
        Public Partial Class DiscountAgreementTimeLengthRequestDto
            <DataMember(Name:="unit", IsRequired:=true)>
            Public Overridable Property Unit As UnitEnum

            <DataMember(Name:="value", IsRequired:=true)>
            Public Overridable Property Value As Integer

            Public Enum UnitEnum
                Day
                Month
                Year
            End Enum
        End Class

        <DataContract(Name:="DiscountPackageDto")>
        Public Partial Class DiscountPackageDto
            <DataMember(Name:="id", IsRequired:=true)>
            Public Overridable Property Id As Guid

            <DataMember(Name:="name", IsRequired:=true)>
            Public Overridable Property Name As String
        End Class

        <DataContract(Name:="DiscountPeriodDto")>
        Public Partial Class DiscountPeriodDto
            <DataMember(Name:="periodKind", IsRequired:=true)>
            Public Overridable Property PeriodKind As PeriodKindEnum

            <DataMember(Name:="length")>
            Public Overridable Property Length As TimeLengthDto

            <DataMember(Name:="periodIterationCount")>
            Public Overridable Property PeriodIterationCount As Integer?
        End Class

        <DataContract(Name:="PricingTierDiscountResultDto")>
        Public Partial Class PricingTierDiscountResultDto
            <DataMember(Name:="discountType", IsRequired:=true)>
            Public Overridable Property DiscountType As DiscountTypeEnum

            <DataMember(Name:="id", IsRequired:=true)>
            Public Overridable Property Id As Guid

            <DataMember(Name:="index", EmitDefaultValue:=false)>
            Public Overridable Property Index As Integer

            <DataMember(Name:="unitPriceDiscount", EmitDefaultValue:=false)>
            Public Overridable Property UnitPriceDiscount As Double

            <DataMember(Name:="flatPriceDiscount", EmitDefaultValue:=false)>
            Public Overridable Property FlatPriceDiscount As Double
        End Class

        <DataContract(Name:="ProductGroupDiscountResultDto")>
        Public Partial Class ProductGroupDiscountResultDto
            <DataMember(Name:="id", IsRequired:=true)>
            Public Overridable Property Id As Guid

            <DataMember(Name:="productGroupId", IsRequired:=true)>
            Public Overridable Property ProductGroupId As Guid

            <DataMember(Name:="productPricingDiscounts", EmitDefaultValue:=false)>
            Public Overridable Property ProductPricingDiscounts As List(Of ProductPricingDiscountResultDto) = New List(Of ProductPricingDiscountResultDto)
        End Class

        <DataContract(Name:="ProductPricingDiscountRequestDto")>
        Public Partial Class ProductPricingDiscountRequestDto
            <DataMember(Name:="discountType", IsRequired:=true)>
            Public Overridable Property DiscountType As DiscountTypeEnum

            <DataMember(Name:="productId", IsRequired:=true)>
            Public Overridable Property ProductId As Guid

            <DataMember(Name:="unitPriceDiscount", EmitDefaultValue:=false)>
            Public Overridable Property UnitPriceDiscount As Double

            <DataMember(Name:="tierPricingDiscounts", EmitDefaultValue:=false)>
            Public Overridable Property TierPricingDiscounts As List(Of CreatePricingTierDiscountRequestDto) = New List(Of CreatePricingTierDiscountRequestDto)
        End Class

        <DataContract(Name:="ProductPricingDiscountResultDto")>
        Public Partial Class ProductPricingDiscountResultDto
            <DataMember(Name:="discountType", IsRequired:=true)>
            Public Overridable Property DiscountType As DiscountTypeEnum

            <DataMember(Name:="id", IsRequired:=true)>
            Public Overridable Property Id As Guid

            <DataMember(Name:="productId", IsRequired:=true)>
            Public Overridable Property ProductId As Guid

            <DataMember(Name:="unitPriceDiscount", EmitDefaultValue:=false)>
            Public Overridable Property UnitPriceDiscount As Double

            <DataMember(Name:="tierPricingDiscounts", EmitDefaultValue:=false)>
            Public Overridable Property TierPricingDiscounts As List(Of PricingTierDiscountResultDto) = New List(Of PricingTierDiscountResultDto)
        End Class

        <DataContract(Name:="TimeLengthDto")>
        Public Partial Class TimeLengthDto
            <DataMember(Name:="unit", IsRequired:=true)>
            Public Overridable Property Unit As UnitEnum

            <DataMember(Name:="value", EmitDefaultValue:=false)>
            Public Overridable Property Value As Integer

            Public Enum UnitEnum
                Day
                Month
                Year
            End Enum
        End Class
    End Namespace
End Namespace

VB.NET CreateVossDiscountAgreement 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.

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: 
	[
		{
			
		}
	]
}