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.
<?php namespace dtos;

use DateTime;
use Exception;
use DateInterval;
use JsonSerializable;
use ServiceStack\{IReturn,IReturnVoid,IGet,IPost,IPut,IDelete,IPatch,IMeta,IHasSessionId,IHasBearerToken,IHasVersion};
use ServiceStack\{ICrud,ICreateDb,IUpdateDb,IPatchDb,IDeleteDb,ISaveDb,AuditBase,QueryDb,QueryDb2,QueryData,QueryData2,QueryResponse};
use ServiceStack\{ResponseStatus,ResponseError,EmptyResponse,IdResponse,ArrayList,KeyValuePair2,StringResponse,StringsResponse,Tuple2,Tuple3,ByteArray};
use ServiceStack\{JsonConverters,Returns,TypeContext};


class DaysOfWeekResponse implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $Id=0,
        /** @var string */
        public string $DayOfWeek='',
        /** @var string */
        public string $DayOfWeekTranslation='',
        /** @var bool|null */
        public ?bool $DayOfWeekActive=null,
        /** @var int|null */
        public ?int $DayOfWeekSortOrder=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Id'])) $this->Id = $o['Id'];
        if (isset($o['DayOfWeek'])) $this->DayOfWeek = $o['DayOfWeek'];
        if (isset($o['DayOfWeekTranslation'])) $this->DayOfWeekTranslation = $o['DayOfWeekTranslation'];
        if (isset($o['DayOfWeekActive'])) $this->DayOfWeekActive = $o['DayOfWeekActive'];
        if (isset($o['DayOfWeekSortOrder'])) $this->DayOfWeekSortOrder = $o['DayOfWeekSortOrder'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Id)) $o['Id'] = $this->Id;
        if (isset($this->DayOfWeek)) $o['DayOfWeek'] = $this->DayOfWeek;
        if (isset($this->DayOfWeekTranslation)) $o['DayOfWeekTranslation'] = $this->DayOfWeekTranslation;
        if (isset($this->DayOfWeekActive)) $o['DayOfWeekActive'] = $this->DayOfWeekActive;
        if (isset($this->DayOfWeekSortOrder)) $o['DayOfWeekSortOrder'] = $this->DayOfWeekSortOrder;
        return empty($o) ? new class(){} : $o;
    }
}

class RebateCodeServiceResponse implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $Id=0,
        /** @var string */
        public string $Name='',
        /** @var string */
        public string $Description='',
        /** @var bool|null */
        public ?bool $Active=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Id'])) $this->Id = $o['Id'];
        if (isset($o['Name'])) $this->Name = $o['Name'];
        if (isset($o['Description'])) $this->Description = $o['Description'];
        if (isset($o['Active'])) $this->Active = $o['Active'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Id)) $o['Id'] = $this->Id;
        if (isset($this->Name)) $o['Name'] = $this->Name;
        if (isset($this->Description)) $o['Description'] = $this->Description;
        if (isset($this->Active)) $o['Active'] = $this->Active;
        return empty($o) ? new class(){} : $o;
    }
}

class BaseModel implements JsonSerializable
{
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        return empty($o) ? new class(){} : $o;
    }
}

class ArticleServiceRelation extends BaseModel implements JsonSerializable
{
    public function __construct(
        // @Required()
        /** @var string */
        public string $CompanyId='',

        /** @var int */
        public int $Id=0,
        // @Required()
        /** @var int */
        public int $ServiceId=0,

        // @Required()
        /** @var int */
        public int $ArticleId=0
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
        if (isset($o['CompanyId'])) $this->CompanyId = $o['CompanyId'];
        if (isset($o['Id'])) $this->Id = $o['Id'];
        if (isset($o['ServiceId'])) $this->ServiceId = $o['ServiceId'];
        if (isset($o['ArticleId'])) $this->ArticleId = $o['ArticleId'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        if (isset($this->CompanyId)) $o['CompanyId'] = $this->CompanyId;
        if (isset($this->Id)) $o['Id'] = $this->Id;
        if (isset($this->ServiceId)) $o['ServiceId'] = $this->ServiceId;
        if (isset($this->ArticleId)) $o['ArticleId'] = $this->ArticleId;
        return empty($o) ? new class(){} : $o;
    }
}

class ArticleResponse implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $CompanyId='',
        /** @var int */
        public int $Id=0,
        /** @var string */
        public string $Name='',
        /** @var int */
        public int $ArticleTypeId=0,
        /** @var string */
        public string $Description='',
        /** @var string */
        public string $ImageUrl='',
        /** @var bool|null */
        public ?bool $Active=null,
        /** @var int */
        public int $Amount=0,
        /** @var float */
        public float $Price=0.0,
        /** @var string */
        public string $CurrencyId='',
        /** @var int */
        public int $SortOrder=0,
        /** @var DateTime */
        public DateTime $UpdatedDate=new DateTime(),
        /** @var DateTime */
        public DateTime $CreatedDate=new DateTime(),
        /** @var int */
        public int $Duration=0,
        /** @var array<ArticleServiceRelation>|null */
        public ?array $Services=null,
        /** @var array<int>|null */
        public ?array $ServiceIds=null,
        /** @var string */
        public string $PriceSign='',
        /** @var float|null */
        public ?float $VAT=null,
        /** @var int */
        public int $ValidDays=0,
        /** @var bool|null */
        public ?bool $SendNotification=null,
        /** @var string */
        public string $NotificationEmail=''
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['CompanyId'])) $this->CompanyId = $o['CompanyId'];
        if (isset($o['Id'])) $this->Id = $o['Id'];
        if (isset($o['Name'])) $this->Name = $o['Name'];
        if (isset($o['ArticleTypeId'])) $this->ArticleTypeId = $o['ArticleTypeId'];
        if (isset($o['Description'])) $this->Description = $o['Description'];
        if (isset($o['ImageUrl'])) $this->ImageUrl = $o['ImageUrl'];
        if (isset($o['Active'])) $this->Active = $o['Active'];
        if (isset($o['Amount'])) $this->Amount = $o['Amount'];
        if (isset($o['Price'])) $this->Price = $o['Price'];
        if (isset($o['CurrencyId'])) $this->CurrencyId = $o['CurrencyId'];
        if (isset($o['SortOrder'])) $this->SortOrder = $o['SortOrder'];
        if (isset($o['UpdatedDate'])) $this->UpdatedDate = JsonConverters::from('DateTime', $o['UpdatedDate']);
        if (isset($o['CreatedDate'])) $this->CreatedDate = JsonConverters::from('DateTime', $o['CreatedDate']);
        if (isset($o['Duration'])) $this->Duration = $o['Duration'];
        if (isset($o['Services'])) $this->Services = JsonConverters::fromArray('ArticleServiceRelation', $o['Services']);
        if (isset($o['ServiceIds'])) $this->ServiceIds = JsonConverters::fromArray('int', $o['ServiceIds']);
        if (isset($o['PriceSign'])) $this->PriceSign = $o['PriceSign'];
        if (isset($o['VAT'])) $this->VAT = $o['VAT'];
        if (isset($o['ValidDays'])) $this->ValidDays = $o['ValidDays'];
        if (isset($o['SendNotification'])) $this->SendNotification = $o['SendNotification'];
        if (isset($o['NotificationEmail'])) $this->NotificationEmail = $o['NotificationEmail'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->CompanyId)) $o['CompanyId'] = $this->CompanyId;
        if (isset($this->Id)) $o['Id'] = $this->Id;
        if (isset($this->Name)) $o['Name'] = $this->Name;
        if (isset($this->ArticleTypeId)) $o['ArticleTypeId'] = $this->ArticleTypeId;
        if (isset($this->Description)) $o['Description'] = $this->Description;
        if (isset($this->ImageUrl)) $o['ImageUrl'] = $this->ImageUrl;
        if (isset($this->Active)) $o['Active'] = $this->Active;
        if (isset($this->Amount)) $o['Amount'] = $this->Amount;
        if (isset($this->Price)) $o['Price'] = $this->Price;
        if (isset($this->CurrencyId)) $o['CurrencyId'] = $this->CurrencyId;
        if (isset($this->SortOrder)) $o['SortOrder'] = $this->SortOrder;
        if (isset($this->UpdatedDate)) $o['UpdatedDate'] = JsonConverters::to('DateTime', $this->UpdatedDate);
        if (isset($this->CreatedDate)) $o['CreatedDate'] = JsonConverters::to('DateTime', $this->CreatedDate);
        if (isset($this->Duration)) $o['Duration'] = $this->Duration;
        if (isset($this->Services)) $o['Services'] = JsonConverters::toArray('ArticleServiceRelation', $this->Services);
        if (isset($this->ServiceIds)) $o['ServiceIds'] = JsonConverters::toArray('int', $this->ServiceIds);
        if (isset($this->PriceSign)) $o['PriceSign'] = $this->PriceSign;
        if (isset($this->VAT)) $o['VAT'] = $this->VAT;
        if (isset($this->ValidDays)) $o['ValidDays'] = $this->ValidDays;
        if (isset($this->SendNotification)) $o['SendNotification'] = $this->SendNotification;
        if (isset($this->NotificationEmail)) $o['NotificationEmail'] = $this->NotificationEmail;
        return empty($o) ? new class(){} : $o;
    }
}

class RebateCodeCustomerResponse implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $Id='',
        /** @var string */
        public string $Firstname='',
        /** @var string */
        public string $Lastname='',
        /** @var string */
        public string $Email='',
        /** @var string */
        public string $Phone='',
        /** @var string */
        public string $ImageUrl=''
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Id'])) $this->Id = $o['Id'];
        if (isset($o['Firstname'])) $this->Firstname = $o['Firstname'];
        if (isset($o['Lastname'])) $this->Lastname = $o['Lastname'];
        if (isset($o['Email'])) $this->Email = $o['Email'];
        if (isset($o['Phone'])) $this->Phone = $o['Phone'];
        if (isset($o['ImageUrl'])) $this->ImageUrl = $o['ImageUrl'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Id)) $o['Id'] = $this->Id;
        if (isset($this->Firstname)) $o['Firstname'] = $this->Firstname;
        if (isset($this->Lastname)) $o['Lastname'] = $this->Lastname;
        if (isset($this->Email)) $o['Email'] = $this->Email;
        if (isset($this->Phone)) $o['Phone'] = $this->Phone;
        if (isset($this->ImageUrl)) $o['ImageUrl'] = $this->ImageUrl;
        return empty($o) ? new class(){} : $o;
    }
}

class RebateCodeTransactionQueryResponse implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $Id=0,
        /** @var string */
        public string $CompanyId='',
        /** @var string */
        public string $Note='',
        /** @var int */
        public int $RebateCodeId=0,
        /** @var string */
        public string $RebateCodeSign='',
        /** @var int|null */
        public ?int $RebateCodeTypeId=null,
        /** @var string */
        public string $RebateCodeTypeName='',
        /** @var float */
        public float $Amount=0.0,
        /** @var string */
        public string $Usage='',
        /** @var int|null */
        public ?int $BookingId=null,
        /** @var DateTime */
        public DateTime $UpdatedDate=new DateTime(),
        /** @var DateTime */
        public DateTime $CreatedDate=new DateTime(),
        /** @var RebateCodeServiceResponse|null */
        public ?RebateCodeServiceResponse $Service=null,
        /** @var RebateCodeCustomerResponse|null */
        public ?RebateCodeCustomerResponse $Customer=null,
        /** @var string */
        public string $PriceSign=''
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Id'])) $this->Id = $o['Id'];
        if (isset($o['CompanyId'])) $this->CompanyId = $o['CompanyId'];
        if (isset($o['Note'])) $this->Note = $o['Note'];
        if (isset($o['RebateCodeId'])) $this->RebateCodeId = $o['RebateCodeId'];
        if (isset($o['RebateCodeSign'])) $this->RebateCodeSign = $o['RebateCodeSign'];
        if (isset($o['RebateCodeTypeId'])) $this->RebateCodeTypeId = $o['RebateCodeTypeId'];
        if (isset($o['RebateCodeTypeName'])) $this->RebateCodeTypeName = $o['RebateCodeTypeName'];
        if (isset($o['Amount'])) $this->Amount = $o['Amount'];
        if (isset($o['Usage'])) $this->Usage = $o['Usage'];
        if (isset($o['BookingId'])) $this->BookingId = $o['BookingId'];
        if (isset($o['UpdatedDate'])) $this->UpdatedDate = JsonConverters::from('DateTime', $o['UpdatedDate']);
        if (isset($o['CreatedDate'])) $this->CreatedDate = JsonConverters::from('DateTime', $o['CreatedDate']);
        if (isset($o['Service'])) $this->Service = JsonConverters::from('RebateCodeServiceResponse', $o['Service']);
        if (isset($o['Customer'])) $this->Customer = JsonConverters::from('RebateCodeCustomerResponse', $o['Customer']);
        if (isset($o['PriceSign'])) $this->PriceSign = $o['PriceSign'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Id)) $o['Id'] = $this->Id;
        if (isset($this->CompanyId)) $o['CompanyId'] = $this->CompanyId;
        if (isset($this->Note)) $o['Note'] = $this->Note;
        if (isset($this->RebateCodeId)) $o['RebateCodeId'] = $this->RebateCodeId;
        if (isset($this->RebateCodeSign)) $o['RebateCodeSign'] = $this->RebateCodeSign;
        if (isset($this->RebateCodeTypeId)) $o['RebateCodeTypeId'] = $this->RebateCodeTypeId;
        if (isset($this->RebateCodeTypeName)) $o['RebateCodeTypeName'] = $this->RebateCodeTypeName;
        if (isset($this->Amount)) $o['Amount'] = $this->Amount;
        if (isset($this->Usage)) $o['Usage'] = $this->Usage;
        if (isset($this->BookingId)) $o['BookingId'] = $this->BookingId;
        if (isset($this->UpdatedDate)) $o['UpdatedDate'] = JsonConverters::to('DateTime', $this->UpdatedDate);
        if (isset($this->CreatedDate)) $o['CreatedDate'] = JsonConverters::to('DateTime', $this->CreatedDate);
        if (isset($this->Service)) $o['Service'] = JsonConverters::to('RebateCodeServiceResponse', $this->Service);
        if (isset($this->Customer)) $o['Customer'] = JsonConverters::to('RebateCodeCustomerResponse', $this->Customer);
        if (isset($this->PriceSign)) $o['PriceSign'] = $this->PriceSign;
        return empty($o) ? new class(){} : $o;
    }
}

class RebateCodeCompanyResponse implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $SitePath='',
        /** @var int|null */
        public ?int $PaymentProviderId=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['SitePath'])) $this->SitePath = $o['SitePath'];
        if (isset($o['PaymentProviderId'])) $this->PaymentProviderId = $o['PaymentProviderId'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->SitePath)) $o['SitePath'] = $this->SitePath;
        if (isset($this->PaymentProviderId)) $o['PaymentProviderId'] = $this->PaymentProviderId;
        return empty($o) ? new class(){} : $o;
    }
}

class PaymentLogResponse implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $Id=0,
        /** @var float|null */
        public ?float $Amount=null,
        /** @var float|null */
        public ?float $AmountCredited=null,
        /** @var string */
        public string $CurrencyId='',
        /** @var string */
        public string $Comments='',
        /** @var DateTime */
        public DateTime $Created=new DateTime(),
        /** @var DateTime */
        public DateTime $Updated=new DateTime()
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Id'])) $this->Id = $o['Id'];
        if (isset($o['Amount'])) $this->Amount = $o['Amount'];
        if (isset($o['AmountCredited'])) $this->AmountCredited = $o['AmountCredited'];
        if (isset($o['CurrencyId'])) $this->CurrencyId = $o['CurrencyId'];
        if (isset($o['Comments'])) $this->Comments = $o['Comments'];
        if (isset($o['Created'])) $this->Created = JsonConverters::from('DateTime', $o['Created']);
        if (isset($o['Updated'])) $this->Updated = JsonConverters::from('DateTime', $o['Updated']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Id)) $o['Id'] = $this->Id;
        if (isset($this->Amount)) $o['Amount'] = $this->Amount;
        if (isset($this->AmountCredited)) $o['AmountCredited'] = $this->AmountCredited;
        if (isset($this->CurrencyId)) $o['CurrencyId'] = $this->CurrencyId;
        if (isset($this->Comments)) $o['Comments'] = $this->Comments;
        if (isset($this->Created)) $o['Created'] = JsonConverters::to('DateTime', $this->Created);
        if (isset($this->Updated)) $o['Updated'] = JsonConverters::to('DateTime', $this->Updated);
        return empty($o) ? new class(){} : $o;
    }
}

class RebateCodeResponse implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $Id=0,
        /** @var string|null */
        public ?string $CompanyId=null,
        /** @var DateTime */
        public DateTime $ValidFrom=new DateTime(),
        /** @var DateTime */
        public DateTime $ValidTo=new DateTime(),
        /** @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. */
        // @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.")
        /** @var DateInterval|null */
        public ?DateInterval $FromTime=null,

        /** @description If the price is only valid for a specific time span during a time of day enter the FromTime and ToTime parameters. */
        // @ApiMember(Description="If the price is only valid for a specific time span during a time of day enter the FromTime and ToTime parameters.")
        /** @var DateInterval|null */
        public ?DateInterval $ToTime=null,

        /** @var string */
        public string $CreatedBy='',
        /** @var DateTime */
        public DateTime $Created=new DateTime(),
        /** @var string */
        public string $UpdatedBy='',
        /** @var DateTime */
        public DateTime $Updated=new DateTime(),
        /** @var string */
        public string $PersonalNote='',
        /** @var string */
        public string $RebateCodeSign='',
        /** @var int */
        public int $RebateCodeValue=0,
        /** @var int */
        public int $RebateCodeTypeId=0,
        /** @var string */
        public string $Name='',
        /** @var int */
        public int $RebateCodeStatusId=0,
        /** @var string */
        public string $StatusName='',
        /** @var int */
        public int $MaxNumberOfUses=0,
        /** @var int */
        public int $MaxNumberOfUsesPerCustomer=0,
        /** @var int */
        public int $NumberOfUsesUsed=0,
        /** @var array<DaysOfWeekResponse>|null */
        public ?array $DaysOfWeek=null,
        /** @var array<RebateCodeServiceResponse>|null */
        public ?array $Services=null,
        /** @var ArticleResponse|null */
        public ?ArticleResponse $Article=null,
        /** @var array<RebateCodeTransactionQueryResponse>|null */
        public ?array $Transactions=null,
        /** @var float|null */
        public ?float $RemainingAmount=null,
        /** @var int|null */
        public ?int $RemainingUsage=null,
        /** @var array<RebateCodeCustomerResponse>|null */
        public ?array $Customers=null,
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null,
        /** @var bool|null */
        public ?bool $PaymentReceived=null,
        /** @var string */
        public string $RebateCodeCurrencySign='',
        /** @var bool|null */
        public ?bool $ActiveByStatus=null,
        /** @var string */
        public string $PriceSign='',
        /** @var string */
        public string $RebateCodeTypeName='',
        /** @var RebateCodeCompanyResponse|null */
        public ?RebateCodeCompanyResponse $Company=null,
        /** @var array<PaymentLogResponse>|null */
        public ?array $PaymentLog=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Id'])) $this->Id = $o['Id'];
        if (isset($o['CompanyId'])) $this->CompanyId = $o['CompanyId'];
        if (isset($o['ValidFrom'])) $this->ValidFrom = JsonConverters::from('DateTime', $o['ValidFrom']);
        if (isset($o['ValidTo'])) $this->ValidTo = JsonConverters::from('DateTime', $o['ValidTo']);
        if (isset($o['FromTime'])) $this->FromTime = JsonConverters::from('DateInterval', $o['FromTime']);
        if (isset($o['ToTime'])) $this->ToTime = JsonConverters::from('DateInterval', $o['ToTime']);
        if (isset($o['CreatedBy'])) $this->CreatedBy = $o['CreatedBy'];
        if (isset($o['Created'])) $this->Created = JsonConverters::from('DateTime', $o['Created']);
        if (isset($o['UpdatedBy'])) $this->UpdatedBy = $o['UpdatedBy'];
        if (isset($o['Updated'])) $this->Updated = JsonConverters::from('DateTime', $o['Updated']);
        if (isset($o['PersonalNote'])) $this->PersonalNote = $o['PersonalNote'];
        if (isset($o['RebateCodeSign'])) $this->RebateCodeSign = $o['RebateCodeSign'];
        if (isset($o['RebateCodeValue'])) $this->RebateCodeValue = $o['RebateCodeValue'];
        if (isset($o['RebateCodeTypeId'])) $this->RebateCodeTypeId = $o['RebateCodeTypeId'];
        if (isset($o['Name'])) $this->Name = $o['Name'];
        if (isset($o['RebateCodeStatusId'])) $this->RebateCodeStatusId = $o['RebateCodeStatusId'];
        if (isset($o['StatusName'])) $this->StatusName = $o['StatusName'];
        if (isset($o['MaxNumberOfUses'])) $this->MaxNumberOfUses = $o['MaxNumberOfUses'];
        if (isset($o['MaxNumberOfUsesPerCustomer'])) $this->MaxNumberOfUsesPerCustomer = $o['MaxNumberOfUsesPerCustomer'];
        if (isset($o['NumberOfUsesUsed'])) $this->NumberOfUsesUsed = $o['NumberOfUsesUsed'];
        if (isset($o['DaysOfWeek'])) $this->DaysOfWeek = JsonConverters::fromArray('DaysOfWeekResponse', $o['DaysOfWeek']);
        if (isset($o['Services'])) $this->Services = JsonConverters::fromArray('RebateCodeServiceResponse', $o['Services']);
        if (isset($o['Article'])) $this->Article = JsonConverters::from('ArticleResponse', $o['Article']);
        if (isset($o['Transactions'])) $this->Transactions = JsonConverters::fromArray('RebateCodeTransactionQueryResponse', $o['Transactions']);
        if (isset($o['RemainingAmount'])) $this->RemainingAmount = $o['RemainingAmount'];
        if (isset($o['RemainingUsage'])) $this->RemainingUsage = $o['RemainingUsage'];
        if (isset($o['Customers'])) $this->Customers = JsonConverters::fromArray('RebateCodeCustomerResponse', $o['Customers']);
        if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
        if (isset($o['PaymentReceived'])) $this->PaymentReceived = $o['PaymentReceived'];
        if (isset($o['RebateCodeCurrencySign'])) $this->RebateCodeCurrencySign = $o['RebateCodeCurrencySign'];
        if (isset($o['ActiveByStatus'])) $this->ActiveByStatus = $o['ActiveByStatus'];
        if (isset($o['PriceSign'])) $this->PriceSign = $o['PriceSign'];
        if (isset($o['RebateCodeTypeName'])) $this->RebateCodeTypeName = $o['RebateCodeTypeName'];
        if (isset($o['Company'])) $this->Company = JsonConverters::from('RebateCodeCompanyResponse', $o['Company']);
        if (isset($o['PaymentLog'])) $this->PaymentLog = JsonConverters::fromArray('PaymentLogResponse', $o['PaymentLog']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Id)) $o['Id'] = $this->Id;
        if (isset($this->CompanyId)) $o['CompanyId'] = $this->CompanyId;
        if (isset($this->ValidFrom)) $o['ValidFrom'] = JsonConverters::to('DateTime', $this->ValidFrom);
        if (isset($this->ValidTo)) $o['ValidTo'] = JsonConverters::to('DateTime', $this->ValidTo);
        if (isset($this->FromTime)) $o['FromTime'] = JsonConverters::to('DateInterval', $this->FromTime);
        if (isset($this->ToTime)) $o['ToTime'] = JsonConverters::to('DateInterval', $this->ToTime);
        if (isset($this->CreatedBy)) $o['CreatedBy'] = $this->CreatedBy;
        if (isset($this->Created)) $o['Created'] = JsonConverters::to('DateTime', $this->Created);
        if (isset($this->UpdatedBy)) $o['UpdatedBy'] = $this->UpdatedBy;
        if (isset($this->Updated)) $o['Updated'] = JsonConverters::to('DateTime', $this->Updated);
        if (isset($this->PersonalNote)) $o['PersonalNote'] = $this->PersonalNote;
        if (isset($this->RebateCodeSign)) $o['RebateCodeSign'] = $this->RebateCodeSign;
        if (isset($this->RebateCodeValue)) $o['RebateCodeValue'] = $this->RebateCodeValue;
        if (isset($this->RebateCodeTypeId)) $o['RebateCodeTypeId'] = $this->RebateCodeTypeId;
        if (isset($this->Name)) $o['Name'] = $this->Name;
        if (isset($this->RebateCodeStatusId)) $o['RebateCodeStatusId'] = $this->RebateCodeStatusId;
        if (isset($this->StatusName)) $o['StatusName'] = $this->StatusName;
        if (isset($this->MaxNumberOfUses)) $o['MaxNumberOfUses'] = $this->MaxNumberOfUses;
        if (isset($this->MaxNumberOfUsesPerCustomer)) $o['MaxNumberOfUsesPerCustomer'] = $this->MaxNumberOfUsesPerCustomer;
        if (isset($this->NumberOfUsesUsed)) $o['NumberOfUsesUsed'] = $this->NumberOfUsesUsed;
        if (isset($this->DaysOfWeek)) $o['DaysOfWeek'] = JsonConverters::toArray('DaysOfWeekResponse', $this->DaysOfWeek);
        if (isset($this->Services)) $o['Services'] = JsonConverters::toArray('RebateCodeServiceResponse', $this->Services);
        if (isset($this->Article)) $o['Article'] = JsonConverters::to('ArticleResponse', $this->Article);
        if (isset($this->Transactions)) $o['Transactions'] = JsonConverters::toArray('RebateCodeTransactionQueryResponse', $this->Transactions);
        if (isset($this->RemainingAmount)) $o['RemainingAmount'] = $this->RemainingAmount;
        if (isset($this->RemainingUsage)) $o['RemainingUsage'] = $this->RemainingUsage;
        if (isset($this->Customers)) $o['Customers'] = JsonConverters::toArray('RebateCodeCustomerResponse', $this->Customers);
        if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
        if (isset($this->PaymentReceived)) $o['PaymentReceived'] = $this->PaymentReceived;
        if (isset($this->RebateCodeCurrencySign)) $o['RebateCodeCurrencySign'] = $this->RebateCodeCurrencySign;
        if (isset($this->ActiveByStatus)) $o['ActiveByStatus'] = $this->ActiveByStatus;
        if (isset($this->PriceSign)) $o['PriceSign'] = $this->PriceSign;
        if (isset($this->RebateCodeTypeName)) $o['RebateCodeTypeName'] = $this->RebateCodeTypeName;
        if (isset($this->Company)) $o['Company'] = JsonConverters::to('RebateCodeCompanyResponse', $this->Company);
        if (isset($this->PaymentLog)) $o['PaymentLog'] = JsonConverters::toArray('PaymentLogResponse', $this->PaymentLog);
        return empty($o) ? new class(){} : $o;
    }
}

class PromoCodeReceiver implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $CustomerId=null,
        /** @var string */
        public string $Firstname='',
        /** @var string */
        public string $Lastname='',
        /** @var string */
        public string $Email='',
        /** @var string */
        public string $ReceiverMessage=''
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['CustomerId'])) $this->CustomerId = $o['CustomerId'];
        if (isset($o['Firstname'])) $this->Firstname = $o['Firstname'];
        if (isset($o['Lastname'])) $this->Lastname = $o['Lastname'];
        if (isset($o['Email'])) $this->Email = $o['Email'];
        if (isset($o['ReceiverMessage'])) $this->ReceiverMessage = $o['ReceiverMessage'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->CustomerId)) $o['CustomerId'] = $this->CustomerId;
        if (isset($this->Firstname)) $o['Firstname'] = $this->Firstname;
        if (isset($this->Lastname)) $o['Lastname'] = $this->Lastname;
        if (isset($this->Email)) $o['Email'] = $this->Email;
        if (isset($this->ReceiverMessage)) $o['ReceiverMessage'] = $this->ReceiverMessage;
        return empty($o) ? new class(){} : $o;
    }
}

class InvoiceAddressToHandle implements IInvoiceAddress, JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $CorporateIdentityNumber='',
        /** @var string */
        public string $InvoiceAddress1='',
        /** @var string */
        public string $InvoiceAddress2='',
        /** @var string */
        public string $InvoiceCity='',
        /** @var string */
        public string $InvoicePostalCode='',
        /** @var string */
        public string $InvoiceCountryCode=''
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['CorporateIdentityNumber'])) $this->CorporateIdentityNumber = $o['CorporateIdentityNumber'];
        if (isset($o['InvoiceAddress1'])) $this->InvoiceAddress1 = $o['InvoiceAddress1'];
        if (isset($o['InvoiceAddress2'])) $this->InvoiceAddress2 = $o['InvoiceAddress2'];
        if (isset($o['InvoiceCity'])) $this->InvoiceCity = $o['InvoiceCity'];
        if (isset($o['InvoicePostalCode'])) $this->InvoicePostalCode = $o['InvoicePostalCode'];
        if (isset($o['InvoiceCountryCode'])) $this->InvoiceCountryCode = $o['InvoiceCountryCode'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->CorporateIdentityNumber)) $o['CorporateIdentityNumber'] = $this->CorporateIdentityNumber;
        if (isset($this->InvoiceAddress1)) $o['InvoiceAddress1'] = $this->InvoiceAddress1;
        if (isset($this->InvoiceAddress2)) $o['InvoiceAddress2'] = $this->InvoiceAddress2;
        if (isset($this->InvoiceCity)) $o['InvoiceCity'] = $this->InvoiceCity;
        if (isset($this->InvoicePostalCode)) $o['InvoicePostalCode'] = $this->InvoicePostalCode;
        if (isset($this->InvoiceCountryCode)) $o['InvoiceCountryCode'] = $this->InvoiceCountryCode;
        return empty($o) ? new class(){} : $o;
    }
}

// @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
// @ValidateRequest(Validator="IsAuthenticated")
class CreateRebateCode implements JsonSerializable
{
    public function __construct(
        /** @description  */
        // @ApiMember(Description="")
        /** @var string|null */
        public ?string $CompanyId=null,

        /** @description The default value is 9999 */
        // @ApiMember(Description="The default value is 9999")
        /** @var int|null */
        public ?int $MaxNumberOfUses=null,

        /** @description The default value is 1 */
        // @ApiMember(Description="The default value is 1")
        /** @var int|null */
        public ?int $MaxNumberOfUsesPerCustomer=null,

        /** @description  */
        // @ApiMember(Description="", IsRequired=true)
        /** @var DateTime */
        public DateTime $ValidFrom=new DateTime(),

        /** @description  */
        // @ApiMember(Description="", IsRequired=true)
        /** @var DateTime */
        public DateTime $ValidTo=new DateTime(),

        /** @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. */
        // @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.")
        /** @var DateInterval|null */
        public ?DateInterval $FromTime=null,

        /** @description If the price is only valid for a specific time span during a time of day enter the FromTime and ToTime parameters. */
        // @ApiMember(Description="If the price is only valid for a specific time span during a time of day enter the FromTime and ToTime parameters.")
        /** @var DateInterval|null */
        public ?DateInterval $ToTime=null,

        /** @description 1 - Percent, 2 - Сurrency, 3 - PunchTicket, 4 - ValueCard, 5 - GiftCard */
        // @ApiMember(Description="1 - Percent, 2 - Сurrency, 3 - PunchTicket, 4 - ValueCard, 5 - GiftCard", IsRequired=true)
        /** @var int */
        public int $RebateCodeTypeId=0,

        /** @description If it's connected to an Article, add the Article Id here. */
        // @ApiMember(Description="If it's connected to an Article, add the Article Id here.")
        /** @var int|null */
        public ?int $ArticleId=null,

        /** @description  */
        // @ApiMember(Description="", IsRequired=true)
        /** @var int */
        public int $RebateCodeValue=0,

        /** @description If AutoGenerateRebateCodeSign=false - more than four letters, unique among active codes */
        // @ApiMember(Description="If AutoGenerateRebateCodeSign=false - more than four letters, unique among active codes")
        /** @var string */
        public string $RebateCodeSign='',

        /** @description AutoGenerateRebateCodeSign=true - random generate code */
        // @ApiMember(Description="AutoGenerateRebateCodeSign=true - random generate code")
        /** @var bool|null */
        public ?bool $AutoGenerateRebateCodeSign=null,

        /** @description  */
        // @ApiMember(Description="")
        /** @var string */
        public string $PersonalNote='',

        /** @description  */
        // @ApiMember(Description="")
        /** @var array<int>|null */
        public ?array $DaysOfWeek=null,

        /** @description  */
        // @ApiMember(Description="")
        /** @var array<int>|null */
        public ?array $Services=null,

        /** @description  */
        // @ApiMember(Description="")
        /** @var array<string>|null */
        public ?array $Customers=null,

        /** @description The price */
        // @ApiMember(Description="The price")
        /** @var float|null */
        public ?float $PriceVat=null,

        /** @description The price VAT in percent */
        // @ApiMember(Description="The price VAT in percent")
        /** @var float|null */
        public ?float $VAT=null,

        /** @description The price currency */
        // @ApiMember(Description="The price currency")
        /** @var string */
        public string $CurrencyId='',

        /** @description Promo code receiver information */
        // @ApiMember(Description="Promo code receiver information")
        /** @var PromoCodeReceiver|null */
        public ?PromoCodeReceiver $PromoCodeReceiver=null,

        /** @description If you wish to save some invoice address information for the rebate code, you can do so here. This is optional. */
        // @ApiMember(Description="If you wish to save some invoice address information for the rebate code, you can do so here. This is optional.")
        /** @var InvoiceAddressToHandle|null */
        public ?InvoiceAddressToHandle $InvoiceAddress=null,

        /** @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. */
        // @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.")
        /** @var bool|null */
        public ?bool $Paid=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['CompanyId'])) $this->CompanyId = $o['CompanyId'];
        if (isset($o['MaxNumberOfUses'])) $this->MaxNumberOfUses = $o['MaxNumberOfUses'];
        if (isset($o['MaxNumberOfUsesPerCustomer'])) $this->MaxNumberOfUsesPerCustomer = $o['MaxNumberOfUsesPerCustomer'];
        if (isset($o['ValidFrom'])) $this->ValidFrom = JsonConverters::from('DateTime', $o['ValidFrom']);
        if (isset($o['ValidTo'])) $this->ValidTo = JsonConverters::from('DateTime', $o['ValidTo']);
        if (isset($o['FromTime'])) $this->FromTime = JsonConverters::from('TimeSpan', $o['FromTime']);
        if (isset($o['ToTime'])) $this->ToTime = JsonConverters::from('TimeSpan', $o['ToTime']);
        if (isset($o['RebateCodeTypeId'])) $this->RebateCodeTypeId = $o['RebateCodeTypeId'];
        if (isset($o['ArticleId'])) $this->ArticleId = $o['ArticleId'];
        if (isset($o['RebateCodeValue'])) $this->RebateCodeValue = $o['RebateCodeValue'];
        if (isset($o['RebateCodeSign'])) $this->RebateCodeSign = $o['RebateCodeSign'];
        if (isset($o['AutoGenerateRebateCodeSign'])) $this->AutoGenerateRebateCodeSign = $o['AutoGenerateRebateCodeSign'];
        if (isset($o['PersonalNote'])) $this->PersonalNote = $o['PersonalNote'];
        if (isset($o['DaysOfWeek'])) $this->DaysOfWeek = JsonConverters::fromArray('int', $o['DaysOfWeek']);
        if (isset($o['Services'])) $this->Services = JsonConverters::fromArray('int', $o['Services']);
        if (isset($o['Customers'])) $this->Customers = JsonConverters::fromArray('Guid', $o['Customers']);
        if (isset($o['PriceVat'])) $this->PriceVat = $o['PriceVat'];
        if (isset($o['VAT'])) $this->VAT = $o['VAT'];
        if (isset($o['CurrencyId'])) $this->CurrencyId = $o['CurrencyId'];
        if (isset($o['PromoCodeReceiver'])) $this->PromoCodeReceiver = JsonConverters::from('PromoCodeReceiver', $o['PromoCodeReceiver']);
        if (isset($o['InvoiceAddress'])) $this->InvoiceAddress = JsonConverters::from('InvoiceAddressToHandle', $o['InvoiceAddress']);
        if (isset($o['Paid'])) $this->Paid = $o['Paid'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->CompanyId)) $o['CompanyId'] = $this->CompanyId;
        if (isset($this->MaxNumberOfUses)) $o['MaxNumberOfUses'] = $this->MaxNumberOfUses;
        if (isset($this->MaxNumberOfUsesPerCustomer)) $o['MaxNumberOfUsesPerCustomer'] = $this->MaxNumberOfUsesPerCustomer;
        if (isset($this->ValidFrom)) $o['ValidFrom'] = JsonConverters::to('DateTime', $this->ValidFrom);
        if (isset($this->ValidTo)) $o['ValidTo'] = JsonConverters::to('DateTime', $this->ValidTo);
        if (isset($this->FromTime)) $o['FromTime'] = JsonConverters::to('TimeSpan', $this->FromTime);
        if (isset($this->ToTime)) $o['ToTime'] = JsonConverters::to('TimeSpan', $this->ToTime);
        if (isset($this->RebateCodeTypeId)) $o['RebateCodeTypeId'] = $this->RebateCodeTypeId;
        if (isset($this->ArticleId)) $o['ArticleId'] = $this->ArticleId;
        if (isset($this->RebateCodeValue)) $o['RebateCodeValue'] = $this->RebateCodeValue;
        if (isset($this->RebateCodeSign)) $o['RebateCodeSign'] = $this->RebateCodeSign;
        if (isset($this->AutoGenerateRebateCodeSign)) $o['AutoGenerateRebateCodeSign'] = $this->AutoGenerateRebateCodeSign;
        if (isset($this->PersonalNote)) $o['PersonalNote'] = $this->PersonalNote;
        if (isset($this->DaysOfWeek)) $o['DaysOfWeek'] = JsonConverters::toArray('int', $this->DaysOfWeek);
        if (isset($this->Services)) $o['Services'] = JsonConverters::toArray('int', $this->Services);
        if (isset($this->Customers)) $o['Customers'] = JsonConverters::toArray('Guid', $this->Customers);
        if (isset($this->PriceVat)) $o['PriceVat'] = $this->PriceVat;
        if (isset($this->VAT)) $o['VAT'] = $this->VAT;
        if (isset($this->CurrencyId)) $o['CurrencyId'] = $this->CurrencyId;
        if (isset($this->PromoCodeReceiver)) $o['PromoCodeReceiver'] = JsonConverters::to('PromoCodeReceiver', $this->PromoCodeReceiver);
        if (isset($this->InvoiceAddress)) $o['InvoiceAddress'] = JsonConverters::to('InvoiceAddressToHandle', $this->InvoiceAddress);
        if (isset($this->Paid)) $o['Paid'] = $this->Paid;
        return empty($o) ? new class(){} : $o;
    }
}

PHP CreateRebateCode 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 /rebatecodes HTTP/1.1 
Host: testapi.bokamera.se 
Accept: application/json
Content-Type: application/json
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: application/json
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"}]}