Trendsic Platform Service

<back to all web services

PayRuleSaveRequest

Requires Authentication
The following routes are available for this service:
POST/v1/workforce/payrules/{PayRulePolicyId}
<?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 PayRulePolicy implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $PayRulePolicyId=0,
        /** @var string */
        public string $PayRulePolicyUID='',
        /** @var string|null */
        public ?string $Name=null,
        /** @var string|null */
        public ?string $ScopeLevel=null,
        /** @var string|null */
        public ?string $BranchId=null,
        /** @var string|null */
        public ?string $JurisdictionKey=null,
        /** @var string|null */
        public ?string $CbaKey=null,
        /** @var string|null */
        public ?string $WorkTypeKey=null,
        /** @var int */
        public int $CurrentVersion=0,
        /** @var bool|null */
        public ?bool $IsActive=null,
        /** @var string|null */
        public ?string $BranchName=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['PayRulePolicyId'])) $this->PayRulePolicyId = $o['PayRulePolicyId'];
        if (isset($o['PayRulePolicyUID'])) $this->PayRulePolicyUID = $o['PayRulePolicyUID'];
        if (isset($o['Name'])) $this->Name = $o['Name'];
        if (isset($o['ScopeLevel'])) $this->ScopeLevel = $o['ScopeLevel'];
        if (isset($o['BranchId'])) $this->BranchId = $o['BranchId'];
        if (isset($o['JurisdictionKey'])) $this->JurisdictionKey = $o['JurisdictionKey'];
        if (isset($o['CbaKey'])) $this->CbaKey = $o['CbaKey'];
        if (isset($o['WorkTypeKey'])) $this->WorkTypeKey = $o['WorkTypeKey'];
        if (isset($o['CurrentVersion'])) $this->CurrentVersion = $o['CurrentVersion'];
        if (isset($o['IsActive'])) $this->IsActive = $o['IsActive'];
        if (isset($o['BranchName'])) $this->BranchName = $o['BranchName'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->PayRulePolicyId)) $o['PayRulePolicyId'] = $this->PayRulePolicyId;
        if (isset($this->PayRulePolicyUID)) $o['PayRulePolicyUID'] = $this->PayRulePolicyUID;
        if (isset($this->Name)) $o['Name'] = $this->Name;
        if (isset($this->ScopeLevel)) $o['ScopeLevel'] = $this->ScopeLevel;
        if (isset($this->BranchId)) $o['BranchId'] = $this->BranchId;
        if (isset($this->JurisdictionKey)) $o['JurisdictionKey'] = $this->JurisdictionKey;
        if (isset($this->CbaKey)) $o['CbaKey'] = $this->CbaKey;
        if (isset($this->WorkTypeKey)) $o['WorkTypeKey'] = $this->WorkTypeKey;
        if (isset($this->CurrentVersion)) $o['CurrentVersion'] = $this->CurrentVersion;
        if (isset($this->IsActive)) $o['IsActive'] = $this->IsActive;
        if (isset($this->BranchName)) $o['BranchName'] = $this->BranchName;
        return empty($o) ? new class(){} : $o;
    }
}

class PayRuleDocSection implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $H=null,
        /** @var string|null */
        public ?string $T=null
    ) {
    }

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

class PayRuleTuneOption implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Label=null,
        /** @var string|null */
        public ?string $Sub=null
    ) {
    }

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

class PayRuleTune implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Intro=null,
        /** @var array<PayRuleTuneOption>|null */
        public ?array $Options=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Intro'])) $this->Intro = $o['Intro'];
        if (isset($o['Options'])) $this->Options = JsonConverters::fromArray('PayRuleTuneOption', $o['Options']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Intro)) $o['Intro'] = $this->Intro;
        if (isset($this->Options)) $o['Options'] = JsonConverters::toArray('PayRuleTuneOption', $this->Options);
        return empty($o) ? new class(){} : $o;
    }
}

class PayRuleDef implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $RuleId=null,
        /** @var string|null */
        public ?string $Name=null,
        /** @var string|null */
        public ?string $Kind=null,
        /** @var string|null */
        public ?string $Demand=null,
        /** @var string|null */
        public ?string $SourcePolicyName=null,
        /** @var string|null */
        public ?string $CascadeLevel=null,
        /** @var string|null */
        public ?string $Why=null,
        /** @var string|null */
        public ?string $Change=null,
        /** @var string|null */
        public ?string $OverrideWho=null,
        /** @var string|null */
        public ?string $OverrideConsequence=null,
        /** @var string|null */
        public ?string $NoNote=null,
        /** @var string|null */
        public ?string $LegalVerify=null,
        /** @var array<string,string>|null */
        public ?array $Params=null,
        /** @var array<PayRuleDocSection>|null */
        public ?array $Doc=null,
        /** @var PayRuleTune|null */
        public ?PayRuleTune $Tune=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['RuleId'])) $this->RuleId = $o['RuleId'];
        if (isset($o['Name'])) $this->Name = $o['Name'];
        if (isset($o['Kind'])) $this->Kind = $o['Kind'];
        if (isset($o['Demand'])) $this->Demand = $o['Demand'];
        if (isset($o['SourcePolicyName'])) $this->SourcePolicyName = $o['SourcePolicyName'];
        if (isset($o['CascadeLevel'])) $this->CascadeLevel = $o['CascadeLevel'];
        if (isset($o['Why'])) $this->Why = $o['Why'];
        if (isset($o['Change'])) $this->Change = $o['Change'];
        if (isset($o['OverrideWho'])) $this->OverrideWho = $o['OverrideWho'];
        if (isset($o['OverrideConsequence'])) $this->OverrideConsequence = $o['OverrideConsequence'];
        if (isset($o['NoNote'])) $this->NoNote = $o['NoNote'];
        if (isset($o['LegalVerify'])) $this->LegalVerify = $o['LegalVerify'];
        if (isset($o['Params'])) $this->Params = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','string']), $o['Params']);
        if (isset($o['Doc'])) $this->Doc = JsonConverters::fromArray('PayRuleDocSection', $o['Doc']);
        if (isset($o['Tune'])) $this->Tune = JsonConverters::from('PayRuleTune', $o['Tune']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->RuleId)) $o['RuleId'] = $this->RuleId;
        if (isset($this->Name)) $o['Name'] = $this->Name;
        if (isset($this->Kind)) $o['Kind'] = $this->Kind;
        if (isset($this->Demand)) $o['Demand'] = $this->Demand;
        if (isset($this->SourcePolicyName)) $o['SourcePolicyName'] = $this->SourcePolicyName;
        if (isset($this->CascadeLevel)) $o['CascadeLevel'] = $this->CascadeLevel;
        if (isset($this->Why)) $o['Why'] = $this->Why;
        if (isset($this->Change)) $o['Change'] = $this->Change;
        if (isset($this->OverrideWho)) $o['OverrideWho'] = $this->OverrideWho;
        if (isset($this->OverrideConsequence)) $o['OverrideConsequence'] = $this->OverrideConsequence;
        if (isset($this->NoNote)) $o['NoNote'] = $this->NoNote;
        if (isset($this->LegalVerify)) $o['LegalVerify'] = $this->LegalVerify;
        if (isset($this->Params)) $o['Params'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','string']), $this->Params);
        if (isset($this->Doc)) $o['Doc'] = JsonConverters::toArray('PayRuleDocSection', $this->Doc);
        if (isset($this->Tune)) $o['Tune'] = JsonConverters::to('PayRuleTune', $this->Tune);
        return empty($o) ? new class(){} : $o;
    }
}

class PayRulePolicyDoc implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Intro=null,
        /** @var string|null */
        public ?string $LockLine=null,
        /** @var string|null */
        public ?string $TemplateName=null,
        /** @var array<PayRuleDef>|null */
        public ?array $Rules=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Intro'])) $this->Intro = $o['Intro'];
        if (isset($o['LockLine'])) $this->LockLine = $o['LockLine'];
        if (isset($o['TemplateName'])) $this->TemplateName = $o['TemplateName'];
        if (isset($o['Rules'])) $this->Rules = JsonConverters::fromArray('PayRuleDef', $o['Rules']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Intro)) $o['Intro'] = $this->Intro;
        if (isset($this->LockLine)) $o['LockLine'] = $this->LockLine;
        if (isset($this->TemplateName)) $o['TemplateName'] = $this->TemplateName;
        if (isset($this->Rules)) $o['Rules'] = JsonConverters::toArray('PayRuleDef', $this->Rules);
        return empty($o) ? new class(){} : $o;
    }
}

class PayRulePolicyVersionInfo implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $PayRulePolicyVersionId=0,
        /** @var int */
        public int $VersionNumber=0,
        /** @var string|null */
        public ?string $ChangeNote=null,
        /** @var string|null */
        public ?string $ChangedByName=null,
        /** @var DateTime */
        public DateTime $CreatedAtUtc=new DateTime()
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['PayRulePolicyVersionId'])) $this->PayRulePolicyVersionId = $o['PayRulePolicyVersionId'];
        if (isset($o['VersionNumber'])) $this->VersionNumber = $o['VersionNumber'];
        if (isset($o['ChangeNote'])) $this->ChangeNote = $o['ChangeNote'];
        if (isset($o['ChangedByName'])) $this->ChangedByName = $o['ChangedByName'];
        if (isset($o['CreatedAtUtc'])) $this->CreatedAtUtc = JsonConverters::from('DateTime', $o['CreatedAtUtc']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->PayRulePolicyVersionId)) $o['PayRulePolicyVersionId'] = $this->PayRulePolicyVersionId;
        if (isset($this->VersionNumber)) $o['VersionNumber'] = $this->VersionNumber;
        if (isset($this->ChangeNote)) $o['ChangeNote'] = $this->ChangeNote;
        if (isset($this->ChangedByName)) $o['ChangedByName'] = $this->ChangedByName;
        if (isset($this->CreatedAtUtc)) $o['CreatedAtUtc'] = JsonConverters::to('DateTime', $this->CreatedAtUtc);
        return empty($o) ? new class(){} : $o;
    }
}

class PayRulesCascadeResponse implements JsonSerializable
{
    public function __construct(
        /** @var PayRulePolicy|null */
        public ?PayRulePolicy $Policy=null,
        /** @var PayRulePolicyDoc|null */
        public ?PayRulePolicyDoc $Doc=null,
        /** @var int */
        public int $VersionNumber=0,
        /** @var array<PayRulePolicyVersionInfo>|null */
        public ?array $Versions=null,
        /** @var bool|null */
        public ?bool $CanEditRules=null,
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Policy'])) $this->Policy = JsonConverters::from('PayRulePolicy', $o['Policy']);
        if (isset($o['Doc'])) $this->Doc = JsonConverters::from('PayRulePolicyDoc', $o['Doc']);
        if (isset($o['VersionNumber'])) $this->VersionNumber = $o['VersionNumber'];
        if (isset($o['Versions'])) $this->Versions = JsonConverters::fromArray('PayRulePolicyVersionInfo', $o['Versions']);
        if (isset($o['CanEditRules'])) $this->CanEditRules = $o['CanEditRules'];
        if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Policy)) $o['Policy'] = JsonConverters::to('PayRulePolicy', $this->Policy);
        if (isset($this->Doc)) $o['Doc'] = JsonConverters::to('PayRulePolicyDoc', $this->Doc);
        if (isset($this->VersionNumber)) $o['VersionNumber'] = $this->VersionNumber;
        if (isset($this->Versions)) $o['Versions'] = JsonConverters::toArray('PayRulePolicyVersionInfo', $this->Versions);
        if (isset($this->CanEditRules)) $o['CanEditRules'] = $this->CanEditRules;
        if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
        return empty($o) ? new class(){} : $o;
    }
}

class PayRuleSaveRequest implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $PayRulePolicyId=0,
        /** @var PayRulePolicyDoc|null */
        public ?PayRulePolicyDoc $Doc=null,
        /** @var string|null */
        public ?string $ChangeNote=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['PayRulePolicyId'])) $this->PayRulePolicyId = $o['PayRulePolicyId'];
        if (isset($o['Doc'])) $this->Doc = JsonConverters::from('PayRulePolicyDoc', $o['Doc']);
        if (isset($o['ChangeNote'])) $this->ChangeNote = $o['ChangeNote'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->PayRulePolicyId)) $o['PayRulePolicyId'] = $this->PayRulePolicyId;
        if (isset($this->Doc)) $o['Doc'] = JsonConverters::to('PayRulePolicyDoc', $this->Doc);
        if (isset($this->ChangeNote)) $o['ChangeNote'] = $this->ChangeNote;
        return empty($o) ? new class(){} : $o;
    }
}

PHP PayRuleSaveRequest DTOs

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

HTTP + XML

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

POST /v1/workforce/payrules/{PayRulePolicyId} HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<PayRuleSaveRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
  <ChangeNote>String</ChangeNote>
  <Doc>
    <Intro>String</Intro>
    <LockLine>String</LockLine>
    <Rules>
      <PayRuleDef>
        <CascadeLevel>String</CascadeLevel>
        <Change>String</Change>
        <Demand>String</Demand>
        <Doc>
          <PayRuleDocSection>
            <H>String</H>
            <T>String</T>
          </PayRuleDocSection>
        </Doc>
        <Kind>String</Kind>
        <LegalVerify>String</LegalVerify>
        <Name>String</Name>
        <NoNote>String</NoNote>
        <OverrideConsequence>String</OverrideConsequence>
        <OverrideWho>String</OverrideWho>
        <Params xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
          <d5p1:KeyValueOfstringstring>
            <d5p1:Key>String</d5p1:Key>
            <d5p1:Value>String</d5p1:Value>
          </d5p1:KeyValueOfstringstring>
        </Params>
        <RuleId>String</RuleId>
        <SourcePolicyName>String</SourcePolicyName>
        <Tune>
          <Intro>String</Intro>
          <Options>
            <PayRuleTuneOption>
              <Label>String</Label>
              <Sub>String</Sub>
            </PayRuleTuneOption>
          </Options>
        </Tune>
        <Why>String</Why>
      </PayRuleDef>
    </Rules>
    <TemplateName>String</TemplateName>
  </Doc>
  <PayRulePolicyId>0</PayRulePolicyId>
</PayRuleSaveRequest>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<PayRulesCascadeResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
  <CanEditRules>false</CanEditRules>
  <Doc>
    <Intro>String</Intro>
    <LockLine>String</LockLine>
    <Rules>
      <PayRuleDef>
        <CascadeLevel>String</CascadeLevel>
        <Change>String</Change>
        <Demand>String</Demand>
        <Doc>
          <PayRuleDocSection>
            <H>String</H>
            <T>String</T>
          </PayRuleDocSection>
        </Doc>
        <Kind>String</Kind>
        <LegalVerify>String</LegalVerify>
        <Name>String</Name>
        <NoNote>String</NoNote>
        <OverrideConsequence>String</OverrideConsequence>
        <OverrideWho>String</OverrideWho>
        <Params xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
          <d5p1:KeyValueOfstringstring>
            <d5p1:Key>String</d5p1:Key>
            <d5p1:Value>String</d5p1:Value>
          </d5p1:KeyValueOfstringstring>
        </Params>
        <RuleId>String</RuleId>
        <SourcePolicyName>String</SourcePolicyName>
        <Tune>
          <Intro>String</Intro>
          <Options>
            <PayRuleTuneOption>
              <Label>String</Label>
              <Sub>String</Sub>
            </PayRuleTuneOption>
          </Options>
        </Tune>
        <Why>String</Why>
      </PayRuleDef>
    </Rules>
    <TemplateName>String</TemplateName>
  </Doc>
  <Policy>
    <BranchId>00000000-0000-0000-0000-000000000000</BranchId>
    <BranchName>String</BranchName>
    <CbaKey>String</CbaKey>
    <CurrentVersion>0</CurrentVersion>
    <IsActive>false</IsActive>
    <JurisdictionKey>String</JurisdictionKey>
    <Name>String</Name>
    <PayRulePolicyId>0</PayRulePolicyId>
    <PayRulePolicyUID>00000000-0000-0000-0000-000000000000</PayRulePolicyUID>
    <ScopeLevel>String</ScopeLevel>
    <WorkTypeKey>String</WorkTypeKey>
  </Policy>
  <ResponseStatus xmlns:d2p1="http://schemas.servicestack.net/types">
    <d2p1:ErrorCode>String</d2p1:ErrorCode>
    <d2p1:Message>String</d2p1:Message>
    <d2p1:StackTrace>String</d2p1:StackTrace>
    <d2p1:Errors>
      <d2p1:ResponseError>
        <d2p1:ErrorCode>String</d2p1:ErrorCode>
        <d2p1:FieldName>String</d2p1:FieldName>
        <d2p1:Message>String</d2p1:Message>
        <d2p1:Meta xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
          <d5p1:KeyValueOfstringstring>
            <d5p1:Key>String</d5p1:Key>
            <d5p1:Value>String</d5p1:Value>
          </d5p1:KeyValueOfstringstring>
        </d2p1:Meta>
      </d2p1:ResponseError>
    </d2p1:Errors>
    <d2p1:Meta xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:KeyValueOfstringstring>
        <d3p1:Key>String</d3p1:Key>
        <d3p1:Value>String</d3p1:Value>
      </d3p1:KeyValueOfstringstring>
    </d2p1:Meta>
  </ResponseStatus>
  <VersionNumber>0</VersionNumber>
  <Versions>
    <PayRulePolicyVersionInfo>
      <ChangeNote>String</ChangeNote>
      <ChangedByName>String</ChangedByName>
      <CreatedAtUtc>0001-01-01T00:00:00</CreatedAtUtc>
      <PayRulePolicyVersionId>0</PayRulePolicyVersionId>
      <VersionNumber>0</VersionNumber>
    </PayRulePolicyVersionInfo>
  </Versions>
</PayRulesCascadeResponse>