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 .other suffix or ?format=other
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: text/jsonl
Content-Type: text/jsonl
Content-Length: length
{"from_date":"0001-01-01T00:00:00.0000000","to_date":"0001-01-01T00:00:00.0000000"}
HTTP/1.1 200 OK Content-Type: text/jsonl Content-Length: length {"responseStatus":{"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}},"payments":[{"paymentUUID":"String","order_id":"String","external_payment_id":0,"added_date":"0001-01-01T00:00:00.0000000","regent_id":0,"uuid":"String","amount":0,"payment_type":"String","is_pushed_to_gl":false,"current_status":"String","current_status_date":"0001-01-01T00:00:00.0000000"}],"from_date":"0001-01-01T00:00:00.0000000","to_date":"0001-01-01T00:00:00.0000000"}