regis

<back to all web services

CRMDonationUpsertRequest

Requires Authentication
Required role:REGISUserRole
The following routes are available for this service:
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 .xml suffix or ?format=xml

HTTP + XML

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: application/xml
Content-Type: application/xml
Content-Length: length

<CRMDonationUpsertRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/regis.DynamicsCRM.Requests">
  <added_date>0001-01-01T00:00:00</added_date>
  <anonymous>false</anonymous>
  <appeal>String</appeal>
  <appeal_code>String</appeal_code>
  <appeal_description>String</appeal_description>
  <appeal_end_date>0001-01-01T00:00:00</appeal_end_date>
  <appeal_goal>0</appeal_goal>
  <appeal_start_date>0001-01-01T00:00:00</appeal_start_date>
  <campaign>String</campaign>
  <campaign_code>String</campaign_code>
  <campaign_description>String</campaign_description>
  <campaign_end_date>0001-01-01T00:00:00</campaign_end_date>
  <campaign_goal>0</campaign_goal>
  <campaign_start_date>0001-01-01T00:00:00</campaign_start_date>
  <channel>String</channel>
  <cheque_number>String</cheque_number>
  <currency>String</currency>
  <description>String</description>
  <designation>String</designation>
  <designation_description>String</designation_description>
  <do_not_receipt>false</do_not_receipt>
  <gift_batch>String</gift_batch>
  <gift_date>0001-01-01T00:00:00</gift_date>
  <import_id>0</import_id>
  <is_account>false</is_account>
  <is_complete>false</is_complete>
  <is_contact>false</is_contact>
  <name>String</name>
  <receipt_amount>0</receipt_amount>
  <receipting_organization>String</receipting_organization>
  <regent_id>0</regent_id>
  <soft_credit_regent_id>0</soft_credit_regent_id>
  <soft_credit_second_regent_id>0</soft_credit_second_regent_id>
  <source>String</source>
  <total_pledge_amount>0</total_pledge_amount>
  <type>String</type>
</CRMDonationUpsertRequest>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<ResponseStatus xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.servicestack.net/types">
  <ErrorCode>String</ErrorCode>
  <Message>String</Message>
  <StackTrace>String</StackTrace>
  <Errors>
    <ResponseError>
      <ErrorCode>String</ErrorCode>
      <FieldName>String</FieldName>
      <Message>String</Message>
      <Meta xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
        <d4p1:KeyValueOfstringstring>
          <d4p1:Key>String</d4p1:Key>
          <d4p1:Value>String</d4p1:Value>
        </d4p1:KeyValueOfstringstring>
      </Meta>
    </ResponseError>
  </Errors>
  <Meta xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <d2p1:KeyValueOfstringstring>
      <d2p1:Key>String</d2p1:Key>
      <d2p1:Value>String</d2p1:Value>
    </d2p1:KeyValueOfstringstring>
  </Meta>
</ResponseStatus>