regis

<back to all web services

FinanceCreatePayableRequest

Requires Authentication
Required permission:CreatePayables
The following routes are available for this service:
POST/Finance/CreatePayable/{vendor_id}
<?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 FinancePayableResponse implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $cheque_id=null,
        /** @var string|null */
        public ?string $invoice_id=null,
        /** @var string|null */
        public ?string $batch_id=null,
        /** @var string|null */
        public ?string $transaction_batch_id=null,
        /** @var float */
        public float $total_amount=0.0,
        /** @var float */
        public float $unapplied_amount=0.0,
        /** @var string|null */
        public ?string $description=null,
        /** @var string|null */
        public ?string $vendor_id=null,
        /** @var string|null */
        public ?string $vendor_name=null,
        /** @var string|null */
        public ?string $doc_type=null,
        /** @var bool|null */
        public ?bool $is_posted=null,
        /** @var bool|null */
        public ?bool $is_paid=null,
        /** @var bool|null */
        public ?bool $is_voided=null,
        /** @var bool|null */
        public ?bool $is_reimbursed=null,
        /** @var DateTime|null */
        public ?DateTime $doc_date=null,
        /** @var DateTime|null */
        public ?DateTime $post_date=null,
        /** @var DateTime|null */
        public ?DateTime $cheque_date=null,
        /** @var DateTime|null */
        public ?DateTime $due_date=null,
        /** @var ResponseStatus|null */
        public ?ResponseStatus $responseStatus=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['cheque_id'])) $this->cheque_id = $o['cheque_id'];
        if (isset($o['invoice_id'])) $this->invoice_id = $o['invoice_id'];
        if (isset($o['batch_id'])) $this->batch_id = $o['batch_id'];
        if (isset($o['transaction_batch_id'])) $this->transaction_batch_id = $o['transaction_batch_id'];
        if (isset($o['total_amount'])) $this->total_amount = $o['total_amount'];
        if (isset($o['unapplied_amount'])) $this->unapplied_amount = $o['unapplied_amount'];
        if (isset($o['description'])) $this->description = $o['description'];
        if (isset($o['vendor_id'])) $this->vendor_id = $o['vendor_id'];
        if (isset($o['vendor_name'])) $this->vendor_name = $o['vendor_name'];
        if (isset($o['doc_type'])) $this->doc_type = $o['doc_type'];
        if (isset($o['is_posted'])) $this->is_posted = $o['is_posted'];
        if (isset($o['is_paid'])) $this->is_paid = $o['is_paid'];
        if (isset($o['is_voided'])) $this->is_voided = $o['is_voided'];
        if (isset($o['is_reimbursed'])) $this->is_reimbursed = $o['is_reimbursed'];
        if (isset($o['doc_date'])) $this->doc_date = JsonConverters::from('DateTime', $o['doc_date']);
        if (isset($o['post_date'])) $this->post_date = JsonConverters::from('DateTime', $o['post_date']);
        if (isset($o['cheque_date'])) $this->cheque_date = JsonConverters::from('DateTime', $o['cheque_date']);
        if (isset($o['due_date'])) $this->due_date = JsonConverters::from('DateTime', $o['due_date']);
        if (isset($o['responseStatus'])) $this->responseStatus = JsonConverters::from('ResponseStatus', $o['responseStatus']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->cheque_id)) $o['cheque_id'] = $this->cheque_id;
        if (isset($this->invoice_id)) $o['invoice_id'] = $this->invoice_id;
        if (isset($this->batch_id)) $o['batch_id'] = $this->batch_id;
        if (isset($this->transaction_batch_id)) $o['transaction_batch_id'] = $this->transaction_batch_id;
        if (isset($this->total_amount)) $o['total_amount'] = $this->total_amount;
        if (isset($this->unapplied_amount)) $o['unapplied_amount'] = $this->unapplied_amount;
        if (isset($this->description)) $o['description'] = $this->description;
        if (isset($this->vendor_id)) $o['vendor_id'] = $this->vendor_id;
        if (isset($this->vendor_name)) $o['vendor_name'] = $this->vendor_name;
        if (isset($this->doc_type)) $o['doc_type'] = $this->doc_type;
        if (isset($this->is_posted)) $o['is_posted'] = $this->is_posted;
        if (isset($this->is_paid)) $o['is_paid'] = $this->is_paid;
        if (isset($this->is_voided)) $o['is_voided'] = $this->is_voided;
        if (isset($this->is_reimbursed)) $o['is_reimbursed'] = $this->is_reimbursed;
        if (isset($this->doc_date)) $o['doc_date'] = JsonConverters::to('DateTime', $this->doc_date);
        if (isset($this->post_date)) $o['post_date'] = JsonConverters::to('DateTime', $this->post_date);
        if (isset($this->cheque_date)) $o['cheque_date'] = JsonConverters::to('DateTime', $this->cheque_date);
        if (isset($this->due_date)) $o['due_date'] = JsonConverters::to('DateTime', $this->due_date);
        if (isset($this->responseStatus)) $o['responseStatus'] = JsonConverters::to('ResponseStatus', $this->responseStatus);
        return empty($o) ? new class(){} : $o;
    }
}

class FinanceCreatePayableDistributionRequest implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $account=null,
        /** @var float */
        public float $amount=0.0,
        /** @var string|null */
        public ?string $description=null
    ) {
    }

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

class FinanceCreatePayableRequest implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $vendor_id=null,
        /** @var float */
        public float $total_amount=0.0,
        /** @var float|null */
        public ?float $tax_amount=null,
        /** @var string|null */
        public ?string $tax_schedule=null,
        /** @var string|null */
        public ?string $tax_account=null,
        /** @var string|null */
        public ?string $description=null,
        /** @var string|null */
        public ?string $batch_id=null,
        /** @var bool|null */
        public ?bool $is_eft=null,
        /** @var string|null */
        public ?string $invoice_id=null,
        /** @var string|null */
        public ?string $chequebook=null,
        /** @var DateTime */
        public DateTime $document_date=new DateTime(),
        /** @var DateTime */
        public DateTime $post_date=new DateTime(),
        /** @var array<FinanceCreatePayableDistributionRequest>|null */
        public ?array $distributions=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['vendor_id'])) $this->vendor_id = $o['vendor_id'];
        if (isset($o['total_amount'])) $this->total_amount = $o['total_amount'];
        if (isset($o['tax_amount'])) $this->tax_amount = $o['tax_amount'];
        if (isset($o['tax_schedule'])) $this->tax_schedule = $o['tax_schedule'];
        if (isset($o['tax_account'])) $this->tax_account = $o['tax_account'];
        if (isset($o['description'])) $this->description = $o['description'];
        if (isset($o['batch_id'])) $this->batch_id = $o['batch_id'];
        if (isset($o['is_eft'])) $this->is_eft = $o['is_eft'];
        if (isset($o['invoice_id'])) $this->invoice_id = $o['invoice_id'];
        if (isset($o['chequebook'])) $this->chequebook = $o['chequebook'];
        if (isset($o['document_date'])) $this->document_date = JsonConverters::from('DateTime', $o['document_date']);
        if (isset($o['post_date'])) $this->post_date = JsonConverters::from('DateTime', $o['post_date']);
        if (isset($o['distributions'])) $this->distributions = JsonConverters::fromArray('FinanceCreatePayableDistributionRequest', $o['distributions']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->vendor_id)) $o['vendor_id'] = $this->vendor_id;
        if (isset($this->total_amount)) $o['total_amount'] = $this->total_amount;
        if (isset($this->tax_amount)) $o['tax_amount'] = $this->tax_amount;
        if (isset($this->tax_schedule)) $o['tax_schedule'] = $this->tax_schedule;
        if (isset($this->tax_account)) $o['tax_account'] = $this->tax_account;
        if (isset($this->description)) $o['description'] = $this->description;
        if (isset($this->batch_id)) $o['batch_id'] = $this->batch_id;
        if (isset($this->is_eft)) $o['is_eft'] = $this->is_eft;
        if (isset($this->invoice_id)) $o['invoice_id'] = $this->invoice_id;
        if (isset($this->chequebook)) $o['chequebook'] = $this->chequebook;
        if (isset($this->document_date)) $o['document_date'] = JsonConverters::to('DateTime', $this->document_date);
        if (isset($this->post_date)) $o['post_date'] = JsonConverters::to('DateTime', $this->post_date);
        if (isset($this->distributions)) $o['distributions'] = JsonConverters::toArray('FinanceCreatePayableDistributionRequest', $this->distributions);
        return empty($o) ? new class(){} : $o;
    }
}

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

POST /Finance/CreatePayable/{vendor_id} HTTP/1.1 
Host: data.regent-college.edu 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	vendor_id: String,
	total_amount: 0,
	tax_amount: 0,
	tax_schedule: String,
	tax_account: String,
	description: String,
	batch_id: String,
	is_eft: False,
	invoice_id: String,
	chequebook: String,
	document_date: 0001-01-01,
	post_date: 0001-01-01,
	distributions: 
	[
		{
			account: String,
			amount: 0,
			description: String
		}
	]
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	cheque_id: String,
	invoice_id: String,
	batch_id: String,
	transaction_batch_id: String,
	total_amount: 0,
	unapplied_amount: 0,
	description: String,
	vendor_id: String,
	vendor_name: String,
	doc_type: String,
	is_posted: False,
	is_paid: False,
	is_voided: False,
	is_reimbursed: False,
	doc_date: 0001-01-01,
	post_date: 0001-01-01,
	cheque_date: 0001-01-01,
	due_date: 0001-01-01,
	responseStatus: 
	{
		errorCode: String,
		message: String,
		stackTrace: String,
		errors: 
		[
			{
				errorCode: String,
				fieldName: String,
				message: String,
				meta: 
				{
					String: String
				}
			}
		],
		meta: 
		{
			String: String
		}
	}
}