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.
"use strict";
/** @typedef {'Draft'|'Staged'|'Published'|'Archived'|'Discarded'} */
export var DiscountAgreementStatusEnum;
(function (DiscountAgreementStatusEnum) {
    DiscountAgreementStatusEnum["Draft"] = "Draft"
    DiscountAgreementStatusEnum["Staged"] = "Staged"
    DiscountAgreementStatusEnum["Published"] = "Published"
    DiscountAgreementStatusEnum["Archived"] = "Archived"
    DiscountAgreementStatusEnum["Discarded"] = "Discarded"
})(DiscountAgreementStatusEnum || (DiscountAgreementStatusEnum = {}));
/** @typedef {'Any'|'SubscriptionCustomer'|'NonSubscriptionCustomerInvoiceRecipient'} */
export var ApplicationScopeEnum;
(function (ApplicationScopeEnum) {
    ApplicationScopeEnum["Any"] = "Any"
    ApplicationScopeEnum["SubscriptionCustomer"] = "SubscriptionCustomer"
    ApplicationScopeEnum["NonSubscriptionCustomerInvoiceRecipient"] = "NonSubscriptionCustomerInvoiceRecipient"
})(ApplicationScopeEnum || (ApplicationScopeEnum = {}));
/** @typedef {'FixedTime'|'AlignedToBindingPeriod'|'AlignedToSubscriptionBillingPeriod'} */
export var PeriodKindEnum;
(function (PeriodKindEnum) {
    PeriodKindEnum["FixedTime"] = "FixedTime"
    PeriodKindEnum["AlignedToBindingPeriod"] = "AlignedToBindingPeriod"
    PeriodKindEnum["AlignedToSubscriptionBillingPeriod"] = "AlignedToSubscriptionBillingPeriod"
})(PeriodKindEnum || (PeriodKindEnum = {}));
/** @typedef {'Day'|'Month'|'Year'} */
export var UnitEnum;
(function (UnitEnum) {
    UnitEnum["Day"] = "Day"
    UnitEnum["Month"] = "Month"
    UnitEnum["Year"] = "Year"
})(UnitEnum || (UnitEnum = {}));
export class TimeLengthDto {
    /** @param {{unit?:UnitEnum,value?:number}} [init] */
    constructor(init) { Object.assign(this, init) }
    /** @type {UnitEnum} */
    unit;
    /** @type {number} */
    value;
}
export class DiscountPeriodDto {
    /** @param {{periodKind?:PeriodKindEnum,length?:TimeLengthDto,periodIterationCount?:number}} [init] */
    constructor(init) { Object.assign(this, init) }
    /** @type {PeriodKindEnum} */
    periodKind;
    /** @type {TimeLengthDto} */
    length;
    /** @type {?number} */
    periodIterationCount;
}
export class DiscountPackageDto {
    /** @param {{id?:string,name?:string}} [init] */
    constructor(init) { Object.assign(this, init) }
    /** @type {string} */
    id;
    /** @type {string} */
    name;
}
export class DiscountAgreementCustomerResultDto {
    /** @param {{customerId?:string}} [init] */
    constructor(init) { Object.assign(this, init) }
    /** @type {string} */
    customerId;
}
export class DiscountAgreementCustomerGroupResultDto {
    /** @param {{intervalStart?:number,intervalEnd?:number}} [init] */
    constructor(init) { Object.assign(this, init) }
    /** @type {number} */
    intervalStart;
    /** @type {number} */
    intervalEnd;
}
/** @typedef {'FlatPrice'|'Percentage'} */
export var DiscountTypeEnum;
(function (DiscountTypeEnum) {
    DiscountTypeEnum["FlatPrice"] = "FlatPrice"
    DiscountTypeEnum["Percentage"] = "Percentage"
})(DiscountTypeEnum || (DiscountTypeEnum = {}));
export class PricingTierDiscountResultDto {
    /** @param {{discountType?:DiscountTypeEnum,id?:string,index?:number,unitPriceDiscount?:number,flatPriceDiscount?:number}} [init] */
    constructor(init) { Object.assign(this, init) }
    /** @type {DiscountTypeEnum} */
    discountType;
    /** @type {string} */
    id;
    /** @type {number} */
    index;
    /** @type {number} */
    unitPriceDiscount;
    /** @type {number} */
    flatPriceDiscount;
}
export class ProductPricingDiscountResultDto {
    /** @param {{discountType?:DiscountTypeEnum,id?:string,productId?:string,unitPriceDiscount?:number,tierPricingDiscounts?:PricingTierDiscountResultDto[]}} [init] */
    constructor(init) { Object.assign(this, init) }
    /** @type {DiscountTypeEnum} */
    discountType;
    /** @type {string} */
    id;
    /** @type {string} */
    productId;
    /** @type {number} */
    unitPriceDiscount;
    /** @type {PricingTierDiscountResultDto[]} */
    tierPricingDiscounts = [];
}
export class ProductGroupDiscountResultDto {
    /** @param {{id?:string,productGroupId?:string,productPricingDiscounts?:ProductPricingDiscountResultDto[]}} [init] */
    constructor(init) { Object.assign(this, init) }
    /** @type {string} */
    id;
    /** @type {string} */
    productGroupId;
    /** @type {ProductPricingDiscountResultDto[]} */
    productPricingDiscounts = [];
}
export class ChargePlanDiscountResultDto {
    /** @param {{id?:string,chargePlanId?:string,productGroupDiscounts?:ProductGroupDiscountResultDto[]}} [init] */
    constructor(init) { Object.assign(this, init) }
    /** @type {string} */
    id;
    /** @type {string} */
    chargePlanId;
    /** @type {ProductGroupDiscountResultDto[]} */
    productGroupDiscounts = [];
}
export class DiscountAgreementResult {
    /** @param {{status?:DiscountAgreementStatusEnum,applicationScope?:ApplicationScopeEnum,id?:string,versionId?:string,sourceVersionId?:string,externalId?:string,name?:string,description?:string,validFrom?:string,validTo?:string,discountPeriod?:DiscountPeriodDto,package?:DiscountPackageDto,customers?:DiscountAgreementCustomerResultDto[],customerGroups?:DiscountAgreementCustomerGroupResultDto[],chargePlanDiscounts?:ChargePlanDiscountResultDto[]}} [init] */
    constructor(init) { Object.assign(this, init) }
    /** @type {DiscountAgreementStatusEnum} */
    status;
    /** @type {ApplicationScopeEnum} */
    applicationScope;
    /** @type {string} */
    id;
    /** @type {string} */
    versionId;
    /** @type {?string} */
    sourceVersionId;
    /** @type {string} */
    externalId;
    /** @type {string} */
    name;
    /** @type {string} */
    description;
    /** @type {string} */
    validFrom;
    /** @type {?string} */
    validTo;
    /** @type {DiscountPeriodDto} */
    discountPeriod;
    /** @type {DiscountPackageDto} */
    package;
    /** @type {DiscountAgreementCustomerResultDto[]} */
    customers = [];
    /** @type {DiscountAgreementCustomerGroupResultDto[]} */
    customerGroups = [];
    /** @type {ChargePlanDiscountResultDto[]} */
    chargePlanDiscounts = [];
}
export class CreatePricingTierDiscountRequestDto {
    /** @param {{discountType?:DiscountTypeEnum,index?:number,unitPriceDiscount?:number,flatPriceDiscount?:number}} [init] */
    constructor(init) { Object.assign(this, init) }
    /** @type {DiscountTypeEnum} */
    discountType;
    /** @type {number} */
    index;
    /** @type {number} */
    unitPriceDiscount;
    /** @type {number} */
    flatPriceDiscount;
}
export class ProductPricingDiscountRequestDto {
    /** @param {{discountType?:DiscountTypeEnum,productId?:string,unitPriceDiscount?:number,tierPricingDiscounts?:CreatePricingTierDiscountRequestDto[]}} [init] */
    constructor(init) { Object.assign(this, init) }
    /** @type {DiscountTypeEnum} */
    discountType;
    /** @type {string} */
    productId;
    /** @type {number} */
    unitPriceDiscount;
    /** @type {CreatePricingTierDiscountRequestDto[]} */
    tierPricingDiscounts = [];
}
export class CreateProductGroupDiscountRequestDto {
    /** @param {{productGroupId?:string,productPricingDiscounts?:ProductPricingDiscountRequestDto[]}} [init] */
    constructor(init) { Object.assign(this, init) }
    /** @type {string} */
    productGroupId;
    /** @type {ProductPricingDiscountRequestDto[]} */
    productPricingDiscounts = [];
}
export class CreateChargePlanDiscountRequestDto {
    /** @param {{chargePlanId?:string,productGroupDiscounts?:CreateProductGroupDiscountRequestDto[]}} [init] */
    constructor(init) { Object.assign(this, init) }
    /** @type {string} */
    chargePlanId;
    /** @type {CreateProductGroupDiscountRequestDto[]} */
    productGroupDiscounts = [];
}
export class DiscountAgreementTimeLengthRequestDto {
    /** @param {{unit?:UnitEnum,value?:number}} [init] */
    constructor(init) { Object.assign(this, init) }
    /** @type {UnitEnum} */
    unit;
    /** @type {number} */
    value;
}
export class CreateDiscountPeriodRequestDto {
    /** @param {{periodKind?:PeriodKindEnum,length?:DiscountAgreementTimeLengthRequestDto,periodIterationCount?:number}} [init] */
    constructor(init) { Object.assign(this, init) }
    /** @type {PeriodKindEnum} */
    periodKind;
    /** @type {DiscountAgreementTimeLengthRequestDto} */
    length;
    /** @type {?number} */
    periodIterationCount;
}
export class CreateVossDiscountAgreement {
    /** @param {{Name?:string,ChargePlanDiscounts?:CreateChargePlanDiscountRequestDto[],Description?:string,ValidFrom?:string,ValidTo?:string,DiscountPeriod?:CreateDiscountPeriodRequestDto}} [init] */
    constructor(init) { Object.assign(this, init) }
    /**
     * @type {string}
     * @description Discount agreement name */
    Name;
    /**
     * @type {CreateChargePlanDiscountRequestDto[]}
     * @description Discount agreement name */
    ChargePlanDiscounts = [];
    /** @type {string} */
    Description;
    /**
     * @type {string}
     * @description Discount agreement name */
    ValidFrom;
    /**
     * @type {?string}
     * @description Discount agreement name */
    ValidTo;
    /**
     * @type {CreateDiscountPeriodRequestDto}
     * @description Discount agreement name */
    DiscountPeriod;
}

JavaScript CreateVossDiscountAgreement DTOs

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

HTTP + CSV

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/csv
Content-Type: text/csv
Content-Length: length

{"Name":"String","ChargePlanDiscounts":[{}],"Description":"String","ValidTo":"0001-01-01T00:00:00"}
HTTP/1.1 200 OK
Content-Type: text/csv
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":[{}]}