Required permission: | CreatePayables |
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 .xml suffix or ?format=xml
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: application/xml
Content-Type: application/xml
Content-Length: length
<FinanceCreatePayableRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/regis.ClassLibrary.Requests">
<batch_id>String</batch_id>
<chequebook>String</chequebook>
<description>String</description>
<distributions>
<FinanceCreatePayableDistributionRequest>
<account>String</account>
<amount>0</amount>
<description>String</description>
</FinanceCreatePayableDistributionRequest>
</distributions>
<document_date>0001-01-01T00:00:00</document_date>
<invoice_id>String</invoice_id>
<is_eft>false</is_eft>
<post_date>0001-01-01T00:00:00</post_date>
<tax_account>String</tax_account>
<tax_amount>0</tax_amount>
<tax_schedule>String</tax_schedule>
<total_amount>0</total_amount>
<vendor_id>String</vendor_id>
</FinanceCreatePayableRequest>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <FinancePayableResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/regis.ClassLibrary.Responses"> <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> <batch_id>String</batch_id> <cheque_date>0001-01-01T00:00:00</cheque_date> <cheque_id>String</cheque_id> <description>String</description> <doc_date>0001-01-01T00:00:00</doc_date> <doc_type>String</doc_type> <due_date>0001-01-01T00:00:00</due_date> <invoice_id>String</invoice_id> <is_paid>false</is_paid> <is_posted>false</is_posted> <is_reimbursed>false</is_reimbursed> <is_voided>false</is_voided> <post_date>0001-01-01T00:00:00</post_date> <total_amount>0</total_amount> <transaction_batch_id>String</transaction_batch_id> <unapplied_amount>0</unapplied_amount> <vendor_id>String</vendor_id> <vendor_name>String</vendor_name> </FinancePayableResponse>