Required permission: | ReadAccountReport |
POST | /Finance/Payments |
---|
<?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 FinancePaymentResponse implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $paymentUUID=null,
/** @var string|null */
public ?string $order_id=null,
/** @var int */
public int $external_payment_id=0,
/** @var DateTime */
public DateTime $added_date=new DateTime(),
/** @var int */
public int $regent_id=0,
/** @var string|null */
public ?string $uuid=null,
/** @var float */
public float $amount=0.0,
/** @var string|null */
public ?string $payment_type=null,
/** @var bool|null */
public ?bool $is_pushed_to_gl=null,
/** @var string|null */
public ?string $current_status=null,
/** @var DateTime|null */
public ?DateTime $current_status_date=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['paymentUUID'])) $this->paymentUUID = $o['paymentUUID'];
if (isset($o['order_id'])) $this->order_id = $o['order_id'];
if (isset($o['external_payment_id'])) $this->external_payment_id = $o['external_payment_id'];
if (isset($o['added_date'])) $this->added_date = JsonConverters::from('DateTime', $o['added_date']);
if (isset($o['regent_id'])) $this->regent_id = $o['regent_id'];
if (isset($o['uuid'])) $this->uuid = $o['uuid'];
if (isset($o['amount'])) $this->amount = $o['amount'];
if (isset($o['payment_type'])) $this->payment_type = $o['payment_type'];
if (isset($o['is_pushed_to_gl'])) $this->is_pushed_to_gl = $o['is_pushed_to_gl'];
if (isset($o['current_status'])) $this->current_status = $o['current_status'];
if (isset($o['current_status_date'])) $this->current_status_date = JsonConverters::from('DateTime', $o['current_status_date']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->paymentUUID)) $o['paymentUUID'] = $this->paymentUUID;
if (isset($this->order_id)) $o['order_id'] = $this->order_id;
if (isset($this->external_payment_id)) $o['external_payment_id'] = $this->external_payment_id;
if (isset($this->added_date)) $o['added_date'] = JsonConverters::to('DateTime', $this->added_date);
if (isset($this->regent_id)) $o['regent_id'] = $this->regent_id;
if (isset($this->uuid)) $o['uuid'] = $this->uuid;
if (isset($this->amount)) $o['amount'] = $this->amount;
if (isset($this->payment_type)) $o['payment_type'] = $this->payment_type;
if (isset($this->is_pushed_to_gl)) $o['is_pushed_to_gl'] = $this->is_pushed_to_gl;
if (isset($this->current_status)) $o['current_status'] = $this->current_status;
if (isset($this->current_status_date)) $o['current_status_date'] = JsonConverters::to('DateTime', $this->current_status_date);
return empty($o) ? new class(){} : $o;
}
}
class FinancePaymentsResponse implements JsonSerializable
{
public function __construct(
/** @var ResponseStatus|null */
public ?ResponseStatus $responseStatus=null,
/** @var array<FinancePaymentResponse>|null */
public ?array $payments=null,
/** @var DateTime */
public DateTime $from_date=new DateTime(),
/** @var DateTime */
public DateTime $to_date=new DateTime()
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['responseStatus'])) $this->responseStatus = JsonConverters::from('ResponseStatus', $o['responseStatus']);
if (isset($o['payments'])) $this->payments = JsonConverters::fromArray('FinancePaymentResponse', $o['payments']);
if (isset($o['from_date'])) $this->from_date = JsonConverters::from('DateTime', $o['from_date']);
if (isset($o['to_date'])) $this->to_date = JsonConverters::from('DateTime', $o['to_date']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->responseStatus)) $o['responseStatus'] = JsonConverters::to('ResponseStatus', $this->responseStatus);
if (isset($this->payments)) $o['payments'] = JsonConverters::toArray('FinancePaymentResponse', $this->payments);
if (isset($this->from_date)) $o['from_date'] = JsonConverters::to('DateTime', $this->from_date);
if (isset($this->to_date)) $o['to_date'] = JsonConverters::to('DateTime', $this->to_date);
return empty($o) ? new class(){} : $o;
}
}
class FinancePaymentsRequest implements JsonSerializable
{
public function __construct(
/** @var DateTime|null */
public ?DateTime $from_date=null,
/** @var DateTime|null */
public ?DateTime $to_date=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['from_date'])) $this->from_date = JsonConverters::from('DateTime', $o['from_date']);
if (isset($o['to_date'])) $this->to_date = JsonConverters::from('DateTime', $o['to_date']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->from_date)) $o['from_date'] = JsonConverters::to('DateTime', $this->from_date);
if (isset($this->to_date)) $o['to_date'] = JsonConverters::to('DateTime', $this->to_date);
return empty($o) ? new class(){} : $o;
}
}
PHP FinancePaymentsRequest 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/Payments HTTP/1.1
Host: data.regent-college.edu
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<FinancePaymentsRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/regis.ClassLibrary.Requests">
<from_date>0001-01-01T00:00:00</from_date>
<to_date>0001-01-01T00:00:00</to_date>
</FinancePaymentsRequest>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <FinancePaymentsResponse 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> <from_date>0001-01-01T00:00:00</from_date> <payments> <FinancePaymentResponse> <added_date>0001-01-01T00:00:00</added_date> <amount>0</amount> <current_status>String</current_status> <current_status_date>0001-01-01T00:00:00</current_status_date> <external_payment_id>0</external_payment_id> <is_pushed_to_gl>false</is_pushed_to_gl> <order_id>String</order_id> <paymentUUID>String</paymentUUID> <payment_type>String</payment_type> <regent_id>0</regent_id> <uuid>String</uuid> </FinancePaymentResponse> </payments> <to_date>0001-01-01T00:00:00</to_date> </FinancePaymentsResponse>