Required role: | REGISUserRole |
POST | /DynamicsCRM/Donation/Upsert |
---|
<?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 CRMDonationUpsertRequest implements JsonSerializable
{
public function __construct(
/** @var int */
public int $regent_id=0,
/** @var int|null */
public ?int $soft_credit_regent_id=null,
/** @var int|null */
public ?int $soft_credit_second_regent_id=null,
/** @var int|null */
public ?int $import_id=null,
/** @var bool|null */
public ?bool $is_contact=null,
/** @var bool|null */
public ?bool $is_account=null,
/** @var string|null */
public ?string $name=null,
/** @var string|null */
public ?string $description=null,
/** @var float */
public float $total_pledge_amount=0.0,
/** @var float */
public float $receipt_amount=0.0,
/** @var string|null */
public ?string $currency=null,
/** @var string|null */
public ?string $receipting_organization=null,
/** @var string|null */
public ?string $type=null,
/** @var DateTime|null */
public ?DateTime $gift_date=null,
/** @var string|null */
public ?string $cheque_number=null,
/** @var bool|null */
public ?bool $do_not_receipt=null,
/** @var bool|null */
public ?bool $is_complete=null,
/** @var bool|null */
public ?bool $anonymous=null,
/** @var string|null */
public ?string $gift_batch=null,
/** @var string|null */
public ?string $source=null,
/** @var string|null */
public ?string $channel=null,
/** @var string|null */
public ?string $designation=null,
/** @var string|null */
public ?string $designation_description=null,
/** @var string|null */
public ?string $campaign=null,
/** @var string|null */
public ?string $campaign_code=null,
/** @var string|null */
public ?string $campaign_description=null,
/** @var DateTime|null */
public ?DateTime $campaign_start_date=null,
/** @var DateTime|null */
public ?DateTime $campaign_end_date=null,
/** @var float|null */
public ?float $campaign_goal=null,
/** @var string|null */
public ?string $appeal=null,
/** @var string|null */
public ?string $appeal_code=null,
/** @var string|null */
public ?string $appeal_description=null,
/** @var DateTime|null */
public ?DateTime $appeal_start_date=null,
/** @var DateTime|null */
public ?DateTime $appeal_end_date=null,
/** @var float|null */
public ?float $appeal_goal=null,
/** @var DateTime|null */
public ?DateTime $added_date=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['regent_id'])) $this->regent_id = $o['regent_id'];
if (isset($o['soft_credit_regent_id'])) $this->soft_credit_regent_id = $o['soft_credit_regent_id'];
if (isset($o['soft_credit_second_regent_id'])) $this->soft_credit_second_regent_id = $o['soft_credit_second_regent_id'];
if (isset($o['import_id'])) $this->import_id = $o['import_id'];
if (isset($o['is_contact'])) $this->is_contact = $o['is_contact'];
if (isset($o['is_account'])) $this->is_account = $o['is_account'];
if (isset($o['name'])) $this->name = $o['name'];
if (isset($o['description'])) $this->description = $o['description'];
if (isset($o['total_pledge_amount'])) $this->total_pledge_amount = $o['total_pledge_amount'];
if (isset($o['receipt_amount'])) $this->receipt_amount = $o['receipt_amount'];
if (isset($o['currency'])) $this->currency = $o['currency'];
if (isset($o['receipting_organization'])) $this->receipting_organization = $o['receipting_organization'];
if (isset($o['type'])) $this->type = $o['type'];
if (isset($o['gift_date'])) $this->gift_date = JsonConverters::from('DateTime', $o['gift_date']);
if (isset($o['cheque_number'])) $this->cheque_number = $o['cheque_number'];
if (isset($o['do_not_receipt'])) $this->do_not_receipt = $o['do_not_receipt'];
if (isset($o['is_complete'])) $this->is_complete = $o['is_complete'];
if (isset($o['anonymous'])) $this->anonymous = $o['anonymous'];
if (isset($o['gift_batch'])) $this->gift_batch = $o['gift_batch'];
if (isset($o['source'])) $this->source = $o['source'];
if (isset($o['channel'])) $this->channel = $o['channel'];
if (isset($o['designation'])) $this->designation = $o['designation'];
if (isset($o['designation_description'])) $this->designation_description = $o['designation_description'];
if (isset($o['campaign'])) $this->campaign = $o['campaign'];
if (isset($o['campaign_code'])) $this->campaign_code = $o['campaign_code'];
if (isset($o['campaign_description'])) $this->campaign_description = $o['campaign_description'];
if (isset($o['campaign_start_date'])) $this->campaign_start_date = JsonConverters::from('DateTime', $o['campaign_start_date']);
if (isset($o['campaign_end_date'])) $this->campaign_end_date = JsonConverters::from('DateTime', $o['campaign_end_date']);
if (isset($o['campaign_goal'])) $this->campaign_goal = $o['campaign_goal'];
if (isset($o['appeal'])) $this->appeal = $o['appeal'];
if (isset($o['appeal_code'])) $this->appeal_code = $o['appeal_code'];
if (isset($o['appeal_description'])) $this->appeal_description = $o['appeal_description'];
if (isset($o['appeal_start_date'])) $this->appeal_start_date = JsonConverters::from('DateTime', $o['appeal_start_date']);
if (isset($o['appeal_end_date'])) $this->appeal_end_date = JsonConverters::from('DateTime', $o['appeal_end_date']);
if (isset($o['appeal_goal'])) $this->appeal_goal = $o['appeal_goal'];
if (isset($o['added_date'])) $this->added_date = JsonConverters::from('DateTime', $o['added_date']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->regent_id)) $o['regent_id'] = $this->regent_id;
if (isset($this->soft_credit_regent_id)) $o['soft_credit_regent_id'] = $this->soft_credit_regent_id;
if (isset($this->soft_credit_second_regent_id)) $o['soft_credit_second_regent_id'] = $this->soft_credit_second_regent_id;
if (isset($this->import_id)) $o['import_id'] = $this->import_id;
if (isset($this->is_contact)) $o['is_contact'] = $this->is_contact;
if (isset($this->is_account)) $o['is_account'] = $this->is_account;
if (isset($this->name)) $o['name'] = $this->name;
if (isset($this->description)) $o['description'] = $this->description;
if (isset($this->total_pledge_amount)) $o['total_pledge_amount'] = $this->total_pledge_amount;
if (isset($this->receipt_amount)) $o['receipt_amount'] = $this->receipt_amount;
if (isset($this->currency)) $o['currency'] = $this->currency;
if (isset($this->receipting_organization)) $o['receipting_organization'] = $this->receipting_organization;
if (isset($this->type)) $o['type'] = $this->type;
if (isset($this->gift_date)) $o['gift_date'] = JsonConverters::to('DateTime', $this->gift_date);
if (isset($this->cheque_number)) $o['cheque_number'] = $this->cheque_number;
if (isset($this->do_not_receipt)) $o['do_not_receipt'] = $this->do_not_receipt;
if (isset($this->is_complete)) $o['is_complete'] = $this->is_complete;
if (isset($this->anonymous)) $o['anonymous'] = $this->anonymous;
if (isset($this->gift_batch)) $o['gift_batch'] = $this->gift_batch;
if (isset($this->source)) $o['source'] = $this->source;
if (isset($this->channel)) $o['channel'] = $this->channel;
if (isset($this->designation)) $o['designation'] = $this->designation;
if (isset($this->designation_description)) $o['designation_description'] = $this->designation_description;
if (isset($this->campaign)) $o['campaign'] = $this->campaign;
if (isset($this->campaign_code)) $o['campaign_code'] = $this->campaign_code;
if (isset($this->campaign_description)) $o['campaign_description'] = $this->campaign_description;
if (isset($this->campaign_start_date)) $o['campaign_start_date'] = JsonConverters::to('DateTime', $this->campaign_start_date);
if (isset($this->campaign_end_date)) $o['campaign_end_date'] = JsonConverters::to('DateTime', $this->campaign_end_date);
if (isset($this->campaign_goal)) $o['campaign_goal'] = $this->campaign_goal;
if (isset($this->appeal)) $o['appeal'] = $this->appeal;
if (isset($this->appeal_code)) $o['appeal_code'] = $this->appeal_code;
if (isset($this->appeal_description)) $o['appeal_description'] = $this->appeal_description;
if (isset($this->appeal_start_date)) $o['appeal_start_date'] = JsonConverters::to('DateTime', $this->appeal_start_date);
if (isset($this->appeal_end_date)) $o['appeal_end_date'] = JsonConverters::to('DateTime', $this->appeal_end_date);
if (isset($this->appeal_goal)) $o['appeal_goal'] = $this->appeal_goal;
if (isset($this->added_date)) $o['added_date'] = JsonConverters::to('DateTime', $this->added_date);
return empty($o) ? new class(){} : $o;
}
}
PHP CRMDonationUpsertRequest 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 /DynamicsCRM/Donation/Upsert HTTP/1.1
Host: data.regent-college.edu
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length
{"regent_id":0,"soft_credit_regent_id":0,"soft_credit_second_regent_id":0,"import_id":0,"is_contact":false,"is_account":false,"name":"String","description":"String","total_pledge_amount":0,"receipt_amount":0,"currency":"String","receipting_organization":"String","type":"String","gift_date":"0001-01-01T00:00:00.0000000","cheque_number":"String","do_not_receipt":false,"is_complete":false,"anonymous":false,"gift_batch":"String","source":"String","channel":"String","designation":"String","designation_description":"String","campaign":"String","campaign_code":"String","campaign_description":"String","campaign_start_date":"0001-01-01T00:00:00.0000000","campaign_end_date":"0001-01-01T00:00:00.0000000","campaign_goal":0,"appeal":"String","appeal_code":"String","appeal_description":"String","appeal_start_date":"0001-01-01T00:00:00.0000000","appeal_end_date":"0001-01-01T00:00:00.0000000","appeal_goal":0,"added_date":"0001-01-01T00:00:00.0000000"}
HTTP/1.1 200 OK Content-Type: text/jsonl Content-Length: length {"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}}