Required role: | REGISUserRole |
POST | /DynamicsCRM/Donations | ||
---|---|---|---|
POST | /DynamicsCRM/Donations/{regent_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 CRMDonationResponse implements JsonSerializable
{
public function __construct(
/** @var int */
public int $regent_id=0,
/** @var string|null */
public ?string $contact_addressee=null,
/** @var string|null */
public ?string $donor_first_name=null,
/** @var string|null */
public ?string $donor_last_name=null,
/** @var string|null */
public ?string $donor_addressee=null,
/** @var string|null */
public ?string $donor_city=null,
/** @var string|null */
public ?string $donor_country=null,
/** @var string|null */
public ?string $donor_owner_full_name=null,
/** @var bool|null */
public ?bool $is_contact=null,
/** @var bool|null */
public ?bool $is_account=null,
/** @var int|null */
public ?int $soft_credit_regent_id=null,
/** @var string|null */
public ?string $soft_credit_contact_addressee=null,
/** @var string|null */
public ?string $soft_credit_contact_first_name=null,
/** @var string|null */
public ?string $soft_credit_contact_last_name=null,
/** @var bool|null */
public ?bool $soft_credit_contact_spouse_is_main_contact=null,
/** @var string|null */
public ?string $soft_credit_contact_city=null,
/** @var string|null */
public ?string $soft_credit_contact_country=null,
/** @var string|null */
public ?string $soft_credit_contact_owner_full_name=null,
/** @var string|null */
public ?string $soft_credit_second_regent_id=null,
/** @var string|null */
public ?string $soft_credit_second_contact_addressee=null,
/** @var string|null */
public ?string $soft_credit_second_contact_first_name=null,
/** @var string|null */
public ?string $soft_credit_second_contact_last_name=null,
/** @var bool|null */
public ?bool $soft_credit_second_contact_spouse_is_main_contact=null,
/** @var string|null */
public ?string $soft_credit_second_contact_city=null,
/** @var string|null */
public ?string $soft_credit_second_contact_country=null,
/** @var string|null */
public ?string $soft_credit_second_contact_owner_full_name=null,
/** @var bool|null */
public ?bool $spouse_is_main_contact=null,
/** @var int|null */
public ?int $import_id=null,
/** @var string|null */
public ?string $donation_id=null,
/** @var string|null */
public ?string $guid=null,
/** @var string|null */
public ?string $name=null,
/** @var string|null */
public ?string $description=null,
/** @var string|null */
public ?string $appeal_code=null,
/** @var string|null */
public ?string $designation=null,
/** @var string|null */
public ?string $designation_description=null,
/** @var string|null */
public ?string $general_ledger_account_number=null,
/** @var string|null */
public ?string $campaign=null,
/** @var float */
public float $total_pledge_amount=0.0,
/** @var float */
public float $total_paid_amount=0.0,
/** @var float */
public float $receipt_amount=0.0,
/** @var float|null */
public ?float $exchange_rate=null,
/** @var float|null */
public ?float $total_paid_canadian_amount=null,
/** @var bool|null */
public ?bool $is_recurring=null,
/** @var bool|null */
public ?bool $is_parent_donation=null,
/** @var string|null */
public ?string $currency=null,
/** @var string|null */
public ?string $source=null,
/** @var string|null */
public ?string $channel=null,
/** @var string|null */
public ?string $receipting_organization=null,
/** @var string|null */
public ?string $type=null,
/** @var bool|null */
public ?bool $acknowledgment_sent=null,
/** @var bool|null */
public ?bool $send_acknowledgment=null,
/** @var string|null */
public ?string $acknowledgment_template_guid=null,
/** @var string|null */
public ?string $parent_guid=null,
/** @var bool|null */
public ?bool $anonymous=null,
/** @var DateTime|null */
public ?DateTime $gift_date=null,
/** @var DateTime|null */
public ?DateTime $recurring_gift_start_date=null,
/** @var DateTime|null */
public ?DateTime $recurring_gift_end_date=null,
/** @var string|null */
public ?string $cheque_number=null,
/** @var int */
public int $version_number=0,
/** @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['contact_addressee'])) $this->contact_addressee = $o['contact_addressee'];
if (isset($o['donor_first_name'])) $this->donor_first_name = $o['donor_first_name'];
if (isset($o['donor_last_name'])) $this->donor_last_name = $o['donor_last_name'];
if (isset($o['donor_addressee'])) $this->donor_addressee = $o['donor_addressee'];
if (isset($o['donor_city'])) $this->donor_city = $o['donor_city'];
if (isset($o['donor_country'])) $this->donor_country = $o['donor_country'];
if (isset($o['donor_owner_full_name'])) $this->donor_owner_full_name = $o['donor_owner_full_name'];
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['soft_credit_regent_id'])) $this->soft_credit_regent_id = $o['soft_credit_regent_id'];
if (isset($o['soft_credit_contact_addressee'])) $this->soft_credit_contact_addressee = $o['soft_credit_contact_addressee'];
if (isset($o['soft_credit_contact_first_name'])) $this->soft_credit_contact_first_name = $o['soft_credit_contact_first_name'];
if (isset($o['soft_credit_contact_last_name'])) $this->soft_credit_contact_last_name = $o['soft_credit_contact_last_name'];
if (isset($o['soft_credit_contact_spouse_is_main_contact'])) $this->soft_credit_contact_spouse_is_main_contact = $o['soft_credit_contact_spouse_is_main_contact'];
if (isset($o['soft_credit_contact_city'])) $this->soft_credit_contact_city = $o['soft_credit_contact_city'];
if (isset($o['soft_credit_contact_country'])) $this->soft_credit_contact_country = $o['soft_credit_contact_country'];
if (isset($o['soft_credit_contact_owner_full_name'])) $this->soft_credit_contact_owner_full_name = $o['soft_credit_contact_owner_full_name'];
if (isset($o['soft_credit_second_regent_id'])) $this->soft_credit_second_regent_id = $o['soft_credit_second_regent_id'];
if (isset($o['soft_credit_second_contact_addressee'])) $this->soft_credit_second_contact_addressee = $o['soft_credit_second_contact_addressee'];
if (isset($o['soft_credit_second_contact_first_name'])) $this->soft_credit_second_contact_first_name = $o['soft_credit_second_contact_first_name'];
if (isset($o['soft_credit_second_contact_last_name'])) $this->soft_credit_second_contact_last_name = $o['soft_credit_second_contact_last_name'];
if (isset($o['soft_credit_second_contact_spouse_is_main_contact'])) $this->soft_credit_second_contact_spouse_is_main_contact = $o['soft_credit_second_contact_spouse_is_main_contact'];
if (isset($o['soft_credit_second_contact_city'])) $this->soft_credit_second_contact_city = $o['soft_credit_second_contact_city'];
if (isset($o['soft_credit_second_contact_country'])) $this->soft_credit_second_contact_country = $o['soft_credit_second_contact_country'];
if (isset($o['soft_credit_second_contact_owner_full_name'])) $this->soft_credit_second_contact_owner_full_name = $o['soft_credit_second_contact_owner_full_name'];
if (isset($o['spouse_is_main_contact'])) $this->spouse_is_main_contact = $o['spouse_is_main_contact'];
if (isset($o['import_id'])) $this->import_id = $o['import_id'];
if (isset($o['donation_id'])) $this->donation_id = $o['donation_id'];
if (isset($o['guid'])) $this->guid = $o['guid'];
if (isset($o['name'])) $this->name = $o['name'];
if (isset($o['description'])) $this->description = $o['description'];
if (isset($o['appeal_code'])) $this->appeal_code = $o['appeal_code'];
if (isset($o['designation'])) $this->designation = $o['designation'];
if (isset($o['designation_description'])) $this->designation_description = $o['designation_description'];
if (isset($o['general_ledger_account_number'])) $this->general_ledger_account_number = $o['general_ledger_account_number'];
if (isset($o['campaign'])) $this->campaign = $o['campaign'];
if (isset($o['total_pledge_amount'])) $this->total_pledge_amount = $o['total_pledge_amount'];
if (isset($o['total_paid_amount'])) $this->total_paid_amount = $o['total_paid_amount'];
if (isset($o['receipt_amount'])) $this->receipt_amount = $o['receipt_amount'];
if (isset($o['exchange_rate'])) $this->exchange_rate = $o['exchange_rate'];
if (isset($o['total_paid_canadian_amount'])) $this->total_paid_canadian_amount = $o['total_paid_canadian_amount'];
if (isset($o['is_recurring'])) $this->is_recurring = $o['is_recurring'];
if (isset($o['is_parent_donation'])) $this->is_parent_donation = $o['is_parent_donation'];
if (isset($o['currency'])) $this->currency = $o['currency'];
if (isset($o['source'])) $this->source = $o['source'];
if (isset($o['channel'])) $this->channel = $o['channel'];
if (isset($o['receipting_organization'])) $this->receipting_organization = $o['receipting_organization'];
if (isset($o['type'])) $this->type = $o['type'];
if (isset($o['acknowledgment_sent'])) $this->acknowledgment_sent = $o['acknowledgment_sent'];
if (isset($o['send_acknowledgment'])) $this->send_acknowledgment = $o['send_acknowledgment'];
if (isset($o['acknowledgment_template_guid'])) $this->acknowledgment_template_guid = $o['acknowledgment_template_guid'];
if (isset($o['parent_guid'])) $this->parent_guid = $o['parent_guid'];
if (isset($o['anonymous'])) $this->anonymous = $o['anonymous'];
if (isset($o['gift_date'])) $this->gift_date = JsonConverters::from('DateTime', $o['gift_date']);
if (isset($o['recurring_gift_start_date'])) $this->recurring_gift_start_date = JsonConverters::from('DateTime', $o['recurring_gift_start_date']);
if (isset($o['recurring_gift_end_date'])) $this->recurring_gift_end_date = JsonConverters::from('DateTime', $o['recurring_gift_end_date']);
if (isset($o['cheque_number'])) $this->cheque_number = $o['cheque_number'];
if (isset($o['version_number'])) $this->version_number = $o['version_number'];
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->contact_addressee)) $o['contact_addressee'] = $this->contact_addressee;
if (isset($this->donor_first_name)) $o['donor_first_name'] = $this->donor_first_name;
if (isset($this->donor_last_name)) $o['donor_last_name'] = $this->donor_last_name;
if (isset($this->donor_addressee)) $o['donor_addressee'] = $this->donor_addressee;
if (isset($this->donor_city)) $o['donor_city'] = $this->donor_city;
if (isset($this->donor_country)) $o['donor_country'] = $this->donor_country;
if (isset($this->donor_owner_full_name)) $o['donor_owner_full_name'] = $this->donor_owner_full_name;
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->soft_credit_regent_id)) $o['soft_credit_regent_id'] = $this->soft_credit_regent_id;
if (isset($this->soft_credit_contact_addressee)) $o['soft_credit_contact_addressee'] = $this->soft_credit_contact_addressee;
if (isset($this->soft_credit_contact_first_name)) $o['soft_credit_contact_first_name'] = $this->soft_credit_contact_first_name;
if (isset($this->soft_credit_contact_last_name)) $o['soft_credit_contact_last_name'] = $this->soft_credit_contact_last_name;
if (isset($this->soft_credit_contact_spouse_is_main_contact)) $o['soft_credit_contact_spouse_is_main_contact'] = $this->soft_credit_contact_spouse_is_main_contact;
if (isset($this->soft_credit_contact_city)) $o['soft_credit_contact_city'] = $this->soft_credit_contact_city;
if (isset($this->soft_credit_contact_country)) $o['soft_credit_contact_country'] = $this->soft_credit_contact_country;
if (isset($this->soft_credit_contact_owner_full_name)) $o['soft_credit_contact_owner_full_name'] = $this->soft_credit_contact_owner_full_name;
if (isset($this->soft_credit_second_regent_id)) $o['soft_credit_second_regent_id'] = $this->soft_credit_second_regent_id;
if (isset($this->soft_credit_second_contact_addressee)) $o['soft_credit_second_contact_addressee'] = $this->soft_credit_second_contact_addressee;
if (isset($this->soft_credit_second_contact_first_name)) $o['soft_credit_second_contact_first_name'] = $this->soft_credit_second_contact_first_name;
if (isset($this->soft_credit_second_contact_last_name)) $o['soft_credit_second_contact_last_name'] = $this->soft_credit_second_contact_last_name;
if (isset($this->soft_credit_second_contact_spouse_is_main_contact)) $o['soft_credit_second_contact_spouse_is_main_contact'] = $this->soft_credit_second_contact_spouse_is_main_contact;
if (isset($this->soft_credit_second_contact_city)) $o['soft_credit_second_contact_city'] = $this->soft_credit_second_contact_city;
if (isset($this->soft_credit_second_contact_country)) $o['soft_credit_second_contact_country'] = $this->soft_credit_second_contact_country;
if (isset($this->soft_credit_second_contact_owner_full_name)) $o['soft_credit_second_contact_owner_full_name'] = $this->soft_credit_second_contact_owner_full_name;
if (isset($this->spouse_is_main_contact)) $o['spouse_is_main_contact'] = $this->spouse_is_main_contact;
if (isset($this->import_id)) $o['import_id'] = $this->import_id;
if (isset($this->donation_id)) $o['donation_id'] = $this->donation_id;
if (isset($this->guid)) $o['guid'] = $this->guid;
if (isset($this->name)) $o['name'] = $this->name;
if (isset($this->description)) $o['description'] = $this->description;
if (isset($this->appeal_code)) $o['appeal_code'] = $this->appeal_code;
if (isset($this->designation)) $o['designation'] = $this->designation;
if (isset($this->designation_description)) $o['designation_description'] = $this->designation_description;
if (isset($this->general_ledger_account_number)) $o['general_ledger_account_number'] = $this->general_ledger_account_number;
if (isset($this->campaign)) $o['campaign'] = $this->campaign;
if (isset($this->total_pledge_amount)) $o['total_pledge_amount'] = $this->total_pledge_amount;
if (isset($this->total_paid_amount)) $o['total_paid_amount'] = $this->total_paid_amount;
if (isset($this->receipt_amount)) $o['receipt_amount'] = $this->receipt_amount;
if (isset($this->exchange_rate)) $o['exchange_rate'] = $this->exchange_rate;
if (isset($this->total_paid_canadian_amount)) $o['total_paid_canadian_amount'] = $this->total_paid_canadian_amount;
if (isset($this->is_recurring)) $o['is_recurring'] = $this->is_recurring;
if (isset($this->is_parent_donation)) $o['is_parent_donation'] = $this->is_parent_donation;
if (isset($this->currency)) $o['currency'] = $this->currency;
if (isset($this->source)) $o['source'] = $this->source;
if (isset($this->channel)) $o['channel'] = $this->channel;
if (isset($this->receipting_organization)) $o['receipting_organization'] = $this->receipting_organization;
if (isset($this->type)) $o['type'] = $this->type;
if (isset($this->acknowledgment_sent)) $o['acknowledgment_sent'] = $this->acknowledgment_sent;
if (isset($this->send_acknowledgment)) $o['send_acknowledgment'] = $this->send_acknowledgment;
if (isset($this->acknowledgment_template_guid)) $o['acknowledgment_template_guid'] = $this->acknowledgment_template_guid;
if (isset($this->parent_guid)) $o['parent_guid'] = $this->parent_guid;
if (isset($this->anonymous)) $o['anonymous'] = $this->anonymous;
if (isset($this->gift_date)) $o['gift_date'] = JsonConverters::to('DateTime', $this->gift_date);
if (isset($this->recurring_gift_start_date)) $o['recurring_gift_start_date'] = JsonConverters::to('DateTime', $this->recurring_gift_start_date);
if (isset($this->recurring_gift_end_date)) $o['recurring_gift_end_date'] = JsonConverters::to('DateTime', $this->recurring_gift_end_date);
if (isset($this->cheque_number)) $o['cheque_number'] = $this->cheque_number;
if (isset($this->version_number)) $o['version_number'] = $this->version_number;
if (isset($this->added_date)) $o['added_date'] = JsonConverters::to('DateTime', $this->added_date);
return empty($o) ? new class(){} : $o;
}
}
class CRMDonationsResponse implements JsonSerializable
{
public function __construct(
/** @var ResponseStatus|null */
public ?ResponseStatus $responseStatus=null,
/** @var array<CRMDonationResponse>|null */
public ?array $donations=null,
/** @var DateTime|null */
public ?DateTime $from_date=null,
/** @var DateTime|null */
public ?DateTime $to_date=null,
/** @var int|null */
public ?int $start_version_number=null,
/** @var int|null */
public ?int $end_version_number=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['responseStatus'])) $this->responseStatus = JsonConverters::from('ResponseStatus', $o['responseStatus']);
if (isset($o['donations'])) $this->donations = JsonConverters::fromArray('CRMDonationResponse', $o['donations']);
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']);
if (isset($o['start_version_number'])) $this->start_version_number = $o['start_version_number'];
if (isset($o['end_version_number'])) $this->end_version_number = $o['end_version_number'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->responseStatus)) $o['responseStatus'] = JsonConverters::to('ResponseStatus', $this->responseStatus);
if (isset($this->donations)) $o['donations'] = JsonConverters::toArray('CRMDonationResponse', $this->donations);
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);
if (isset($this->start_version_number)) $o['start_version_number'] = $this->start_version_number;
if (isset($this->end_version_number)) $o['end_version_number'] = $this->end_version_number;
return empty($o) ? new class(){} : $o;
}
}
class CRMDonationsRequest implements JsonSerializable
{
public function __construct(
/** @var int|null */
public ?int $regent_id=null,
/** @var DateTime|null */
public ?DateTime $from_date=null,
/** @var DateTime|null */
public ?DateTime $to_date=null,
/** @var int|null */
public ?int $start_version_number=null,
/** @var int|null */
public ?int $end_version_number=null,
/** @var bool|null */
public ?bool $is_missing_acknowledgement=null,
/** @var bool|null */
public ?bool $has_acknowledgement_letter=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['regent_id'])) $this->regent_id = $o['regent_id'];
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']);
if (isset($o['start_version_number'])) $this->start_version_number = $o['start_version_number'];
if (isset($o['end_version_number'])) $this->end_version_number = $o['end_version_number'];
if (isset($o['is_missing_acknowledgement'])) $this->is_missing_acknowledgement = $o['is_missing_acknowledgement'];
if (isset($o['has_acknowledgement_letter'])) $this->has_acknowledgement_letter = $o['has_acknowledgement_letter'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->regent_id)) $o['regent_id'] = $this->regent_id;
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);
if (isset($this->start_version_number)) $o['start_version_number'] = $this->start_version_number;
if (isset($this->end_version_number)) $o['end_version_number'] = $this->end_version_number;
if (isset($this->is_missing_acknowledgement)) $o['is_missing_acknowledgement'] = $this->is_missing_acknowledgement;
if (isset($this->has_acknowledgement_letter)) $o['has_acknowledgement_letter'] = $this->has_acknowledgement_letter;
return empty($o) ? new class(){} : $o;
}
}
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/Donations HTTP/1.1
Host: data.regent-college.edu
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length
{"regent_id":0,"from_date":"0001-01-01T00:00:00.0000000","to_date":"0001-01-01T00:00:00.0000000","start_version_number":0,"end_version_number":0,"is_missing_acknowledgement":false,"has_acknowledgement_letter":false}
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"}},"donations":[{"regent_id":0,"contact_addressee":"String","donor_first_name":"String","donor_last_name":"String","donor_addressee":"String","donor_city":"String","donor_country":"String","donor_owner_full_name":"String","is_contact":false,"is_account":false,"soft_credit_regent_id":0,"soft_credit_contact_addressee":"String","soft_credit_contact_first_name":"String","soft_credit_contact_last_name":"String","soft_credit_contact_spouse_is_main_contact":false,"soft_credit_contact_city":"String","soft_credit_contact_country":"String","soft_credit_contact_owner_full_name":"String","soft_credit_second_regent_id":"String","soft_credit_second_contact_addressee":"String","soft_credit_second_contact_first_name":"String","soft_credit_second_contact_last_name":"String","soft_credit_second_contact_spouse_is_main_contact":false,"soft_credit_second_contact_city":"String","soft_credit_second_contact_country":"String","soft_credit_second_contact_owner_full_name":"String","spouse_is_main_contact":false,"import_id":0,"donation_id":"String","guid":"String","name":"String","description":"String","appeal_code":"String","designation":"String","designation_description":"String","general_ledger_account_number":"String","campaign":"String","total_pledge_amount":0,"total_paid_amount":0,"receipt_amount":0,"exchange_rate":0,"total_paid_canadian_amount":0,"is_recurring":false,"is_parent_donation":false,"currency":"String","source":"String","channel":"String","receipting_organization":"String","type":"String","acknowledgment_sent":false,"send_acknowledgment":false,"acknowledgment_template_guid":"String","parent_guid":"String","anonymous":false,"gift_date":"0001-01-01T00:00:00.0000000","recurring_gift_start_date":"0001-01-01T00:00:00.0000000","recurring_gift_end_date":"0001-01-01T00:00:00.0000000","cheque_number":"String","version_number":0,"added_date":"0001-01-01T00:00:00.0000000"}],"from_date":"0001-01-01T00:00:00.0000000","to_date":"0001-01-01T00:00:00.0000000","start_version_number":0,"end_version_number":0}