BokaMera.API.Host

<back to all web services

CreateRebateCode

Requires Authentication
Requires any of the roles:bookingsupplier-administrator-write, superadmin
The following routes are available for this service:
POST/rebatecodesCreate RebateCode.Create RebateCode.
using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using ServiceStack;
using ServiceStack.DataAnnotations;
using BokaMera.API.ServiceModel.Dtos;
using BokaMera.API.ServiceModel.Db;

namespace BokaMera.API.ServiceModel.Db
{
    public partial class ArticleServiceRelation
        : BaseModel
    {
        [Required]
        public virtual Guid CompanyId { get; set; }

        public virtual int Id { get; set; }
        [Required]
        public virtual int ServiceId { get; set; }

        [Required]
        public virtual int ArticleId { get; set; }
    }

    public partial class BaseModel
    {
    }

}

namespace BokaMera.API.ServiceModel.Dtos
{
    public partial class ArticleResponse
    {
        public virtual Guid CompanyId { get; set; }
        public virtual int Id { get; set; }
        public virtual string Name { get; set; }
        public virtual int ArticleTypeId { get; set; }
        public virtual string Description { get; set; }
        public virtual string ImageUrl { get; set; }
        public virtual bool Active { get; set; }
        public virtual int Amount { get; set; }
        public virtual double Price { get; set; }
        public virtual string CurrencyId { get; set; }
        public virtual int SortOrder { get; set; }
        public virtual DateTime UpdatedDate { get; set; }
        public virtual DateTime CreatedDate { get; set; }
        public virtual int Duration { get; set; }
        public virtual List<ArticleServiceRelation> Services { get; set; } = [];
        public virtual List<int> ServiceIds { get; set; } = [];
        public virtual string PriceSign { get; set; }
        public virtual decimal? VAT { get; set; }
        public virtual int ValidDays { get; set; }
        public virtual bool SendNotification { get; set; }
        public virtual string NotificationEmail { get; set; }
    }

    [ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)]
    [ValidateRequest("IsAuthenticated")]
    public partial class CreateRebateCode
    {
        ///<summary>
        ///
        ///</summary>
        [ApiMember(Description="")]
        public virtual Guid? CompanyId { get; set; }

        ///<summary>
        ///The default value is 9999
        ///</summary>
        [ApiMember(Description="The default value is 9999")]
        public virtual int? MaxNumberOfUses { get; set; }

        ///<summary>
        ///The default value is 1
        ///</summary>
        [ApiMember(Description="The default value is 1")]
        public virtual int? MaxNumberOfUsesPerCustomer { get; set; }

        ///<summary>
        ///
        ///</summary>
        [ApiMember(Description="", IsRequired=true)]
        public virtual DateTime ValidFrom { get; set; }

        ///<summary>
        ///
        ///</summary>
        [ApiMember(Description="", IsRequired=true)]
        public virtual DateTime ValidTo { get; set; }

        ///<summary>
        ///If the price is only valid for specific days in week add a comma separated list of which days this day price belongs to, 1 = Monday .. 7 = Sunday. All old days connected will be removed on update.
        ///</summary>
        [ApiMember(Description="If the price is only valid for specific days in week add a comma separated list of which days this day price belongs to, 1 = Monday .. 7 = Sunday. All old days connected will be removed on update.")]
        public virtual TimeSpan? FromTime { get; set; }

        ///<summary>
        ///If the price is only valid for a specific time span during a time of day enter the FromTime and ToTime parameters.
        ///</summary>
        [ApiMember(Description="If the price is only valid for a specific time span during a time of day enter the FromTime and ToTime parameters.")]
        public virtual TimeSpan? ToTime { get; set; }

        ///<summary>
        ///1 - Percent, 2 - Сurrency, 3 - PunchTicket, 4 - ValueCard, 5 - GiftCard
        ///</summary>
        [ApiMember(Description="1 - Percent, 2 - Сurrency, 3 - PunchTicket, 4 - ValueCard, 5 - GiftCard", IsRequired=true)]
        public virtual int RebateCodeTypeId { get; set; }

        ///<summary>
        ///If it's connected to an Article, add the Article Id here.
        ///</summary>
        [ApiMember(Description="If it's connected to an Article, add the Article Id here.")]
        public virtual int? ArticleId { get; set; }

        ///<summary>
        ///
        ///</summary>
        [ApiMember(Description="", IsRequired=true)]
        public virtual int RebateCodeValue { get; set; }

        ///<summary>
        ///If AutoGenerateRebateCodeSign=false - more than four letters, unique among active codes
        ///</summary>
        [ApiMember(Description="If AutoGenerateRebateCodeSign=false - more than four letters, unique among active codes")]
        public virtual string RebateCodeSign { get; set; }

        ///<summary>
        ///AutoGenerateRebateCodeSign=true - random generate code
        ///</summary>
        [ApiMember(Description="AutoGenerateRebateCodeSign=true - random generate code")]
        public virtual bool AutoGenerateRebateCodeSign { get; set; }

        ///<summary>
        ///
        ///</summary>
        [ApiMember(Description="")]
        public virtual string PersonalNote { get; set; }

        ///<summary>
        ///
        ///</summary>
        [ApiMember(Description="")]
        public virtual List<int> DaysOfWeek { get; set; } = [];

        ///<summary>
        ///
        ///</summary>
        [ApiMember(Description="")]
        public virtual List<int> Services { get; set; } = [];

        ///<summary>
        ///
        ///</summary>
        [ApiMember(Description="")]
        public virtual List<Guid> Customers { get; set; } = [];

        ///<summary>
        ///The price
        ///</summary>
        [ApiMember(Description="The price")]
        public virtual decimal? PriceVat { get; set; }

        ///<summary>
        ///The price VAT in percent
        ///</summary>
        [ApiMember(Description="The price VAT in percent")]
        public virtual decimal? VAT { get; set; }

        ///<summary>
        ///The price currency
        ///</summary>
        [ApiMember(Description="The price currency")]
        public virtual string CurrencyId { get; set; }

        ///<summary>
        ///Promo code receiver information
        ///</summary>
        [ApiMember(Description="Promo code receiver information")]
        public virtual PromoCodeReceiver PromoCodeReceiver { get; set; }

        ///<summary>
        ///If you wish to save some invoice address information for the rebate code, you can do so here. This is optional.
        ///</summary>
        [ApiMember(Description="If you wish to save some invoice address information for the rebate code, you can do so here. This is optional.")]
        public virtual InvoiceAddressToHandle? InvoiceAddress { get; set; }

        ///<summary>
        ///Determines if the rebate code is active on creation or if it should await payment. If you set this to true, make sure to mark the code as payed when you receive the payment, by using the MarkRebateCodeAsPayed endpoint. The default value is false.
        ///</summary>
        [ApiMember(Description="Determines if the rebate code is active on creation or if it should await payment. If you set this to true, make sure to mark the code as payed when you receive the payment, by using the MarkRebateCodeAsPayed endpoint. The default value is false.")]
        public virtual bool? Paid { get; set; }
    }

    public partial class DaysOfWeekResponse
    {
        public virtual int Id { get; set; }
        public virtual string DayOfWeek { get; set; }
        public virtual string DayOfWeekTranslation { get; set; }
        public virtual bool? DayOfWeekActive { get; set; }
        public virtual short? DayOfWeekSortOrder { get; set; }
    }

    public partial class InvoiceAddressToHandle
        : IInvoiceAddress
    {
        public virtual string CorporateIdentityNumber { get; set; }
        public virtual string InvoiceAddress1 { get; set; }
        public virtual string InvoiceAddress2 { get; set; }
        public virtual string InvoiceCity { get; set; }
        public virtual string InvoicePostalCode { get; set; }
        public virtual string InvoiceCountryCode { get; set; }
    }

    public partial class PaymentLogResponse
    {
        public virtual int Id { get; set; }
        public virtual double? Amount { get; set; }
        public virtual double? AmountCredited { get; set; }
        public virtual string CurrencyId { get; set; }
        public virtual string Comments { get; set; }
        public virtual DateTime Created { get; set; }
        public virtual DateTime Updated { get; set; }
    }

    public partial class PromoCodeReceiver
    {
        public virtual Guid? CustomerId { get; set; }
        public virtual string Firstname { get; set; }
        public virtual string Lastname { get; set; }
        public virtual string Email { get; set; }
        public virtual string ReceiverMessage { get; set; }
    }

    public partial class RebateCodeCompanyResponse
    {
        public virtual string SitePath { get; set; }
        public virtual int? PaymentProviderId { get; set; }
    }

    public partial class RebateCodeCustomerResponse
    {
        public virtual Guid Id { get; set; }
        public virtual string Firstname { get; set; }
        public virtual string Lastname { get; set; }
        public virtual string Email { get; set; }
        public virtual string Phone { get; set; }
        public virtual string ImageUrl { get; set; }
    }

    public partial class RebateCodeResponse
    {
        public virtual int Id { get; set; }
        public virtual Guid? CompanyId { get; set; }
        public virtual DateTime ValidFrom { get; set; }
        public virtual DateTime ValidTo { get; set; }
        ///<summary>
        ///If the price is only valid for specific days in week add a comma separated list of which days this day price belongs to, 1 = Monday .. 7 = Sunday. All old days connected will be removed on update.
        ///</summary>
        [ApiMember(Description="If the price is only valid for specific days in week add a comma separated list of which days this day price belongs to, 1 = Monday .. 7 = Sunday. All old days connected will be removed on update.")]
        public virtual TimeSpan FromTime { get; set; }

        ///<summary>
        ///If the price is only valid for a specific time span during a time of day enter the FromTime and ToTime parameters.
        ///</summary>
        [ApiMember(Description="If the price is only valid for a specific time span during a time of day enter the FromTime and ToTime parameters.")]
        public virtual TimeSpan ToTime { get; set; }

        public virtual string CreatedBy { get; set; }
        public virtual DateTime Created { get; set; }
        public virtual string UpdatedBy { get; set; }
        public virtual DateTime Updated { get; set; }
        public virtual string PersonalNote { get; set; }
        public virtual string RebateCodeSign { get; set; }
        public virtual int RebateCodeValue { get; set; }
        public virtual int RebateCodeTypeId { get; set; }
        public virtual string Name { get; set; }
        public virtual int RebateCodeStatusId { get; set; }
        public virtual string StatusName { get; set; }
        public virtual int MaxNumberOfUses { get; set; }
        public virtual int MaxNumberOfUsesPerCustomer { get; set; }
        public virtual int NumberOfUsesUsed { get; set; }
        public virtual List<DaysOfWeekResponse> DaysOfWeek { get; set; } = [];
        public virtual List<RebateCodeServiceResponse> Services { get; set; } = [];
        public virtual ArticleResponse Article { get; set; }
        public virtual List<RebateCodeTransactionQueryResponse> Transactions { get; set; } = [];
        public virtual double? RemainingAmount { get; set; }
        public virtual int? RemainingUsage { get; set; }
        public virtual List<RebateCodeCustomerResponse> Customers { get; set; } = [];
        public virtual ResponseStatus ResponseStatus { get; set; }
        public virtual bool PaymentReceived { get; set; }
        public virtual string RebateCodeCurrencySign { get; set; }
        public virtual bool ActiveByStatus { get; set; }
        public virtual string PriceSign { get; set; }
        public virtual string RebateCodeTypeName { get; set; }
        public virtual RebateCodeCompanyResponse Company { get; set; }
        public virtual List<PaymentLogResponse> PaymentLog { get; set; } = [];
    }

    public partial class RebateCodeServiceResponse
    {
        public virtual int Id { get; set; }
        public virtual string Name { get; set; }
        public virtual string Description { get; set; }
        public virtual bool Active { get; set; }
    }

    public partial class RebateCodeTransactionQueryResponse
    {
        public virtual int Id { get; set; }
        public virtual Guid CompanyId { get; set; }
        public virtual string Note { get; set; }
        public virtual int RebateCodeId { get; set; }
        public virtual string RebateCodeSign { get; set; }
        public virtual int? RebateCodeTypeId { get; set; }
        public virtual string RebateCodeTypeName { get; set; }
        public virtual double Amount { get; set; }
        public virtual string Usage { get; set; }
        public virtual int? BookingId { get; set; }
        public virtual DateTime UpdatedDate { get; set; }
        public virtual DateTime CreatedDate { get; set; }
        public virtual RebateCodeServiceResponse Service { get; set; }
        public virtual RebateCodeCustomerResponse Customer { get; set; }
        public virtual string PriceSign { get; set; }
    }

}

C# CreateRebateCode DTOs

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

HTTP + OTHER

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /rebatecodes HTTP/1.1 
Host: testapi.bokamera.se 
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length

{"CompanyId":"00000000-0000-0000-0000-000000000000","MaxNumberOfUses":0,"MaxNumberOfUsesPerCustomer":0,"FromTime":"00:00:00","ToTime":"00:00:00","RebateCodeTypeId":0,"ArticleId":0,"RebateCodeValue":0,"RebateCodeSign":"String","AutoGenerateRebateCodeSign":false,"PersonalNote":"String","DaysOfWeek":[0],"Services":[0],"Customers":["00000000-0000-0000-0000-000000000000"],"PriceVat":0,"VAT":0,"CurrencyId":"String","PromoCodeReceiver":{"CustomerId":"00000000-0000-0000-0000-000000000000","Firstname":"String","Lastname":"String","Email":"String","ReceiverMessage":"String"},"InvoiceAddress":{"CorporateIdentityNumber":"String","InvoiceAddress1":"String","InvoiceAddress2":"String","InvoiceCity":"String","InvoicePostalCode":"String","InvoiceCountryCode":"String"},"Paid":false}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

{"Id":0,"CompanyId":"00000000-0000-0000-0000-000000000000","FromTime":"00:00:00","ToTime":"00:00:00","CreatedBy":"String","UpdatedBy":"String","PersonalNote":"String","RebateCodeSign":"String","RebateCodeValue":0,"RebateCodeTypeId":0,"Name":"String","RebateCodeStatusId":0,"StatusName":"String","MaxNumberOfUses":0,"MaxNumberOfUsesPerCustomer":0,"NumberOfUsesUsed":0,"DaysOfWeek":[{"Id":0,"DayOfWeek":"String","DayOfWeekTranslation":"String","DayOfWeekActive":false,"DayOfWeekSortOrder":0}],"Services":[{"Id":0,"Name":"String","Description":"String","Active":false}],"Article":{"Id":0,"Name":"String","ArticleTypeId":0,"Description":"String","ImageUrl":"String","Active":false,"Amount":0,"Price":0,"CurrencyId":"String","SortOrder":0,"Duration":0,"Services":[{"Id":0,"ServiceId":0,"ArticleId":0}],"ServiceIds":[0],"PriceSign":"String","VAT":0,"ValidDays":0,"SendNotification":false,"NotificationEmail":"String"},"Transactions":[{"Id":0,"Note":"String","RebateCodeId":0,"RebateCodeSign":"String","RebateCodeTypeId":0,"RebateCodeTypeName":"String","Amount":0,"Usage":"String","BookingId":0,"Service":{"Id":0,"Name":"String","Description":"String","Active":false},"Customer":{"Firstname":"String","Lastname":"String","Email":"String","Phone":"String","ImageUrl":"String"},"PriceSign":"String"}],"RemainingAmount":0,"RemainingUsage":0,"Customers":[{"Firstname":"String","Lastname":"String","Email":"String","Phone":"String","ImageUrl":"String"}],"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}},"PaymentReceived":false,"RebateCodeCurrencySign":"String","ActiveByStatus":false,"PriceSign":"String","RebateCodeTypeName":"String","Company":{"SitePath":"String","PaymentProviderId":0},"PaymentLog":[{"Id":0,"Amount":0,"AmountCredited":0,"CurrencyId":"String","Comments":"String"}]}