Required permission: | CreatePayables |
POST | /Finance/Payable |
---|
<?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 FinancePayableRequest implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $cheque_id=null,
/** @var string|null */
public ?string $invoice_id=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'];
}
/** @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;
return empty($o) ? new class(){} : $o;
}
}
PHP FinancePayableRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /Finance/Payable HTTP/1.1
Host: data.regent-college.edu
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
cheque_id: String,
invoice_id: 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 } } }