Trendsic Platform Service

<back to all web services

PortalInvoiceRequest

The following routes are available for this service:
GET,OPTIONS/portal/{Token}/invoice
<?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 InvoiceLineItem implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $InvoiceLineItemID=0,
        /** @var int */
        public int $InvoiceID=0,
        /** @var string|null */
        public ?string $Type=null,
        /** @var string|null */
        public ?string $Name=null,
        /** @var int|null */
        public ?int $Quantity=null,
        /** @var float|null */
        public ?float $PercentageAdjust=null,
        /** @var float|null */
        public ?float $AmountAdjust=null,
        /** @var float|null */
        public ?float $Price=null,
        /** @var string|null */
        public ?string $Description=null,
        /** @var string|null */
        public ?string $Notes=null,
        /** @var bool|null */
        public ?bool $IsTaxable=null,
        /** @var int|null */
        public ?int $DisplayOrder=null,
        /** @var bool|null */
        public ?bool $IsLocked=null,
        /** @var bool|null */
        public ?bool $IsDeleted=null,
        /** @var bool|null */
        public ?bool $IsPaid=null,
        /** @var DateTime|null */
        public ?DateTime $CreatedDate=null,
        /** @var DateTime|null */
        public ?DateTime $ModifiedDate=null,
        /** @var string|null */
        public ?string $CreatedByUID=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['InvoiceLineItemID'])) $this->InvoiceLineItemID = $o['InvoiceLineItemID'];
        if (isset($o['InvoiceID'])) $this->InvoiceID = $o['InvoiceID'];
        if (isset($o['Type'])) $this->Type = $o['Type'];
        if (isset($o['Name'])) $this->Name = $o['Name'];
        if (isset($o['Quantity'])) $this->Quantity = $o['Quantity'];
        if (isset($o['PercentageAdjust'])) $this->PercentageAdjust = $o['PercentageAdjust'];
        if (isset($o['AmountAdjust'])) $this->AmountAdjust = $o['AmountAdjust'];
        if (isset($o['Price'])) $this->Price = $o['Price'];
        if (isset($o['Description'])) $this->Description = $o['Description'];
        if (isset($o['Notes'])) $this->Notes = $o['Notes'];
        if (isset($o['IsTaxable'])) $this->IsTaxable = $o['IsTaxable'];
        if (isset($o['DisplayOrder'])) $this->DisplayOrder = $o['DisplayOrder'];
        if (isset($o['IsLocked'])) $this->IsLocked = $o['IsLocked'];
        if (isset($o['IsDeleted'])) $this->IsDeleted = $o['IsDeleted'];
        if (isset($o['IsPaid'])) $this->IsPaid = $o['IsPaid'];
        if (isset($o['CreatedDate'])) $this->CreatedDate = JsonConverters::from('DateTime', $o['CreatedDate']);
        if (isset($o['ModifiedDate'])) $this->ModifiedDate = JsonConverters::from('DateTime', $o['ModifiedDate']);
        if (isset($o['CreatedByUID'])) $this->CreatedByUID = $o['CreatedByUID'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->InvoiceLineItemID)) $o['InvoiceLineItemID'] = $this->InvoiceLineItemID;
        if (isset($this->InvoiceID)) $o['InvoiceID'] = $this->InvoiceID;
        if (isset($this->Type)) $o['Type'] = $this->Type;
        if (isset($this->Name)) $o['Name'] = $this->Name;
        if (isset($this->Quantity)) $o['Quantity'] = $this->Quantity;
        if (isset($this->PercentageAdjust)) $o['PercentageAdjust'] = $this->PercentageAdjust;
        if (isset($this->AmountAdjust)) $o['AmountAdjust'] = $this->AmountAdjust;
        if (isset($this->Price)) $o['Price'] = $this->Price;
        if (isset($this->Description)) $o['Description'] = $this->Description;
        if (isset($this->Notes)) $o['Notes'] = $this->Notes;
        if (isset($this->IsTaxable)) $o['IsTaxable'] = $this->IsTaxable;
        if (isset($this->DisplayOrder)) $o['DisplayOrder'] = $this->DisplayOrder;
        if (isset($this->IsLocked)) $o['IsLocked'] = $this->IsLocked;
        if (isset($this->IsDeleted)) $o['IsDeleted'] = $this->IsDeleted;
        if (isset($this->IsPaid)) $o['IsPaid'] = $this->IsPaid;
        if (isset($this->CreatedDate)) $o['CreatedDate'] = JsonConverters::to('DateTime', $this->CreatedDate);
        if (isset($this->ModifiedDate)) $o['ModifiedDate'] = JsonConverters::to('DateTime', $this->ModifiedDate);
        if (isset($this->CreatedByUID)) $o['CreatedByUID'] = $this->CreatedByUID;
        return empty($o) ? new class(){} : $o;
    }
}

class PortalInvoiceResponse implements JsonSerializable
{
    public function __construct(
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null,
        /** @var string|null */
        public ?string $InvoiceNumber=null,
        /** @var DateTime|null */
        public ?DateTime $InvoiceDate=null,
        /** @var DateTime|null */
        public ?DateTime $DueDate=null,
        /** @var string|null */
        public ?string $FromName=null,
        /** @var string|null */
        public ?string $FromAddress=null,
        /** @var string|null */
        public ?string $ToName=null,
        /** @var string|null */
        public ?string $ToAddress=null,
        /** @var string|null */
        public ?string $Currency=null,
        /** @var float */
        public float $Total=0.0,
        /** @var float */
        public float $AmountPaid=0.0,
        /** @var float */
        public float $Balance=0.0,
        /** @var bool|null */
        public ?bool $IsPaid=null,
        /** @var array<InvoiceLineItem>|null */
        public ?array $LineItems=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
        if (isset($o['InvoiceNumber'])) $this->InvoiceNumber = $o['InvoiceNumber'];
        if (isset($o['InvoiceDate'])) $this->InvoiceDate = JsonConverters::from('DateTime', $o['InvoiceDate']);
        if (isset($o['DueDate'])) $this->DueDate = JsonConverters::from('DateTime', $o['DueDate']);
        if (isset($o['FromName'])) $this->FromName = $o['FromName'];
        if (isset($o['FromAddress'])) $this->FromAddress = $o['FromAddress'];
        if (isset($o['ToName'])) $this->ToName = $o['ToName'];
        if (isset($o['ToAddress'])) $this->ToAddress = $o['ToAddress'];
        if (isset($o['Currency'])) $this->Currency = $o['Currency'];
        if (isset($o['Total'])) $this->Total = $o['Total'];
        if (isset($o['AmountPaid'])) $this->AmountPaid = $o['AmountPaid'];
        if (isset($o['Balance'])) $this->Balance = $o['Balance'];
        if (isset($o['IsPaid'])) $this->IsPaid = $o['IsPaid'];
        if (isset($o['LineItems'])) $this->LineItems = JsonConverters::fromArray('InvoiceLineItem', $o['LineItems']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
        if (isset($this->InvoiceNumber)) $o['InvoiceNumber'] = $this->InvoiceNumber;
        if (isset($this->InvoiceDate)) $o['InvoiceDate'] = JsonConverters::to('DateTime', $this->InvoiceDate);
        if (isset($this->DueDate)) $o['DueDate'] = JsonConverters::to('DateTime', $this->DueDate);
        if (isset($this->FromName)) $o['FromName'] = $this->FromName;
        if (isset($this->FromAddress)) $o['FromAddress'] = $this->FromAddress;
        if (isset($this->ToName)) $o['ToName'] = $this->ToName;
        if (isset($this->ToAddress)) $o['ToAddress'] = $this->ToAddress;
        if (isset($this->Currency)) $o['Currency'] = $this->Currency;
        if (isset($this->Total)) $o['Total'] = $this->Total;
        if (isset($this->AmountPaid)) $o['AmountPaid'] = $this->AmountPaid;
        if (isset($this->Balance)) $o['Balance'] = $this->Balance;
        if (isset($this->IsPaid)) $o['IsPaid'] = $this->IsPaid;
        if (isset($this->LineItems)) $o['LineItems'] = JsonConverters::toArray('InvoiceLineItem', $this->LineItems);
        return empty($o) ? new class(){} : $o;
    }
}

class PortalInvoiceRequest implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Token=null
    ) {
    }

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

PHP PortalInvoiceRequest 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.

GET /portal/{Token}/invoice HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}},"InvoiceNumber":"String","InvoiceDate":"0001-01-01T00:00:00.0000000","DueDate":"0001-01-01T00:00:00.0000000","FromName":"String","FromAddress":"String","ToName":"String","ToAddress":"String","Currency":"String","Total":0,"AmountPaid":0,"Balance":0,"IsPaid":false,"LineItems":[{"InvoiceLineItemID":0,"InvoiceID":0,"Type":"String","Name":"String","Quantity":0,"PercentageAdjust":0,"AmountAdjust":0,"Price":0,"Description":"String","Notes":"String","IsTaxable":false,"DisplayOrder":0,"IsLocked":false,"IsDeleted":false,"IsPaid":false,"CreatedDate":"0001-01-01T00:00:00.0000000","ModifiedDate":"0001-01-01T00:00:00.0000000","CreatedByUID":"00000000000000000000000000000000"}]}