Trendsic Platform Service

<back to all web services

CommissionReportRequest

Requires Authentication
Requires any of the roles:Agent, Administrator
The following routes are available for this service:
GET,OPTIONS/v1/CommissionReport/{StartDate}/{EndDate}
<?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 CommissionRecord implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $Id=0,
        /** @var DateTime */
        public DateTime $DateCreated=new DateTime(),
        /** @var string|null */
        public ?string $AgentNumber=null,
        /** @var string|null */
        public ?string $AgentName=null,
        /** @var string|null */
        public ?string $PolicyNumber=null,
        /** @var string|null */
        public ?string $InsuredAnnuitant=null,
        /** @var DateTime */
        public DateTime $ProcessDate=new DateTime(),
        /** @var float */
        public float $Premium=0.0,
        /** @var float */
        public float $GrossCommission=0.0,
        /** @var float */
        public float $CommRate=0.0,
        /** @var float */
        public float $Part=0.0,
        /** @var DateTime */
        public DateTime $PaymentDate=new DateTime(),
        /** @var string|null */
        public ?string $PolicyType=null,
        /** @var string|null */
        public ?string $Company=null,
        /** @var int */
        public int $AgentId=0,
        /** @var DateTime */
        public DateTime $DateProcessed=new DateTime(),
        /** @var int */
        public int $CommissionBatchId=0
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Id'])) $this->Id = $o['Id'];
        if (isset($o['DateCreated'])) $this->DateCreated = JsonConverters::from('DateTime', $o['DateCreated']);
        if (isset($o['AgentNumber'])) $this->AgentNumber = $o['AgentNumber'];
        if (isset($o['AgentName'])) $this->AgentName = $o['AgentName'];
        if (isset($o['PolicyNumber'])) $this->PolicyNumber = $o['PolicyNumber'];
        if (isset($o['InsuredAnnuitant'])) $this->InsuredAnnuitant = $o['InsuredAnnuitant'];
        if (isset($o['ProcessDate'])) $this->ProcessDate = JsonConverters::from('DateTime', $o['ProcessDate']);
        if (isset($o['Premium'])) $this->Premium = $o['Premium'];
        if (isset($o['GrossCommission'])) $this->GrossCommission = $o['GrossCommission'];
        if (isset($o['CommRate'])) $this->CommRate = $o['CommRate'];
        if (isset($o['Part'])) $this->Part = $o['Part'];
        if (isset($o['PaymentDate'])) $this->PaymentDate = JsonConverters::from('DateTime', $o['PaymentDate']);
        if (isset($o['PolicyType'])) $this->PolicyType = $o['PolicyType'];
        if (isset($o['Company'])) $this->Company = $o['Company'];
        if (isset($o['AgentId'])) $this->AgentId = $o['AgentId'];
        if (isset($o['DateProcessed'])) $this->DateProcessed = JsonConverters::from('DateTime', $o['DateProcessed']);
        if (isset($o['CommissionBatchId'])) $this->CommissionBatchId = $o['CommissionBatchId'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Id)) $o['Id'] = $this->Id;
        if (isset($this->DateCreated)) $o['DateCreated'] = JsonConverters::to('DateTime', $this->DateCreated);
        if (isset($this->AgentNumber)) $o['AgentNumber'] = $this->AgentNumber;
        if (isset($this->AgentName)) $o['AgentName'] = $this->AgentName;
        if (isset($this->PolicyNumber)) $o['PolicyNumber'] = $this->PolicyNumber;
        if (isset($this->InsuredAnnuitant)) $o['InsuredAnnuitant'] = $this->InsuredAnnuitant;
        if (isset($this->ProcessDate)) $o['ProcessDate'] = JsonConverters::to('DateTime', $this->ProcessDate);
        if (isset($this->Premium)) $o['Premium'] = $this->Premium;
        if (isset($this->GrossCommission)) $o['GrossCommission'] = $this->GrossCommission;
        if (isset($this->CommRate)) $o['CommRate'] = $this->CommRate;
        if (isset($this->Part)) $o['Part'] = $this->Part;
        if (isset($this->PaymentDate)) $o['PaymentDate'] = JsonConverters::to('DateTime', $this->PaymentDate);
        if (isset($this->PolicyType)) $o['PolicyType'] = $this->PolicyType;
        if (isset($this->Company)) $o['Company'] = $this->Company;
        if (isset($this->AgentId)) $o['AgentId'] = $this->AgentId;
        if (isset($this->DateProcessed)) $o['DateProcessed'] = JsonConverters::to('DateTime', $this->DateProcessed);
        if (isset($this->CommissionBatchId)) $o['CommissionBatchId'] = $this->CommissionBatchId;
        return empty($o) ? new class(){} : $o;
    }
}

class CommissionReportResponse implements JsonSerializable
{
    public function __construct(
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null,
        /** @var array<CommissionRecord>|null */
        public ?array $ReportData=null
    ) {
    }

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

class CommissionReportRequest implements JsonSerializable
{
    public function __construct(
        /** @var DateTime */
        public DateTime $StartDate=new DateTime(),
        /** @var DateTime */
        public DateTime $EndDate=new DateTime(),
        /** @var bool|null */
        public ?bool $ShowProcessed=null
    ) {
    }

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

PHP CommissionReportRequest DTOs

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

HTTP + JSV

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

GET /v1/CommissionReport/{StartDate}/{EndDate} HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	ResponseStatus: 
	{
		ErrorCode: String,
		Message: String,
		StackTrace: String,
		Errors: 
		[
			{
				ErrorCode: String,
				FieldName: String,
				Message: String,
				Meta: 
				{
					String: String
				}
			}
		],
		Meta: 
		{
			String: String
		}
	},
	ReportData: 
	[
		{
			Id: 0,
			DateCreated: 0001-01-01,
			AgentNumber: String,
			AgentName: String,
			PolicyNumber: String,
			InsuredAnnuitant: String,
			ProcessDate: 0001-01-01,
			Premium: 0,
			GrossCommission: 0,
			CommRate: 0,
			Part: 0,
			PaymentDate: 0001-01-01,
			PolicyType: String,
			Company: String,
			AgentId: 0,
			DateProcessed: 0001-01-01,
			CommissionBatchId: 0
		}
	]
}