Trendsic Platform Service

<back to all web services

CustomerPaymentsRequest

Requires Authentication
Requires any of the roles:Agent, Administrator, Agent, Administrator, Agent, Administrator
The following routes are available for this service:
GET/v1/CustomerPayments/{OrderID}
POST,PUT,OPTIONS/v1/CustomerPayments
<?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 CustomerPayment implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $ID=0,
        /** @var int */
        public int $CustomerID=0,
        /** @var int */
        public int $OrderHeaderID=0,
        /** @var string|null */
        public ?string $Amount=null,
        /** @var bool|null */
        public ?bool $Approved=null,
        /** @var string|null */
        public ?string $AuthCode=null,
        /** @var string|null */
        public ?string $CardNumber=null,
        /** @var string|null */
        public ?string $Message=null,
        /** @var int */
        public int $ResponseCode=0,
        /** @var string|null */
        public ?string $TransactionId=null,
        /** @var DateTime */
        public DateTime $TransactionDate=new DateTime(),
        /** @var string|null */
        public ?string $FullResponse=null,
        /** @var int */
        public int $PaymentStatus=0,
        /** @var int */
        public int $PaymentType=0
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ID'])) $this->ID = $o['ID'];
        if (isset($o['CustomerID'])) $this->CustomerID = $o['CustomerID'];
        if (isset($o['OrderHeaderID'])) $this->OrderHeaderID = $o['OrderHeaderID'];
        if (isset($o['Amount'])) $this->Amount = $o['Amount'];
        if (isset($o['Approved'])) $this->Approved = $o['Approved'];
        if (isset($o['AuthCode'])) $this->AuthCode = $o['AuthCode'];
        if (isset($o['CardNumber'])) $this->CardNumber = $o['CardNumber'];
        if (isset($o['Message'])) $this->Message = $o['Message'];
        if (isset($o['ResponseCode'])) $this->ResponseCode = $o['ResponseCode'];
        if (isset($o['TransactionId'])) $this->TransactionId = $o['TransactionId'];
        if (isset($o['TransactionDate'])) $this->TransactionDate = JsonConverters::from('DateTime', $o['TransactionDate']);
        if (isset($o['FullResponse'])) $this->FullResponse = $o['FullResponse'];
        if (isset($o['PaymentStatus'])) $this->PaymentStatus = $o['PaymentStatus'];
        if (isset($o['PaymentType'])) $this->PaymentType = $o['PaymentType'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ID)) $o['ID'] = $this->ID;
        if (isset($this->CustomerID)) $o['CustomerID'] = $this->CustomerID;
        if (isset($this->OrderHeaderID)) $o['OrderHeaderID'] = $this->OrderHeaderID;
        if (isset($this->Amount)) $o['Amount'] = $this->Amount;
        if (isset($this->Approved)) $o['Approved'] = $this->Approved;
        if (isset($this->AuthCode)) $o['AuthCode'] = $this->AuthCode;
        if (isset($this->CardNumber)) $o['CardNumber'] = $this->CardNumber;
        if (isset($this->Message)) $o['Message'] = $this->Message;
        if (isset($this->ResponseCode)) $o['ResponseCode'] = $this->ResponseCode;
        if (isset($this->TransactionId)) $o['TransactionId'] = $this->TransactionId;
        if (isset($this->TransactionDate)) $o['TransactionDate'] = JsonConverters::to('DateTime', $this->TransactionDate);
        if (isset($this->FullResponse)) $o['FullResponse'] = $this->FullResponse;
        if (isset($this->PaymentStatus)) $o['PaymentStatus'] = $this->PaymentStatus;
        if (isset($this->PaymentType)) $o['PaymentType'] = $this->PaymentType;
        return empty($o) ? new class(){} : $o;
    }
}

class CustomerPaymentsResponse implements JsonSerializable
{
    public function __construct(
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null,
        /** @var bool|null */
        public ?bool $PaymentIntentSuccess=null,
        /** @var bool|null */
        public ?bool $PaymentSuccess=null,
        /** @var bool|null */
        public ?bool $SubscriptionSuccess=null,
        /** @var string|null */
        public ?string $Message=null,
        /** @var string|null */
        public ?string $ReceiptUrl=null,
        /** @var string|null */
        public ?string $AgentNumber=null,
        /** @var string|null */
        public ?string $ClientSecret=null,
        /** @var CustomerPayment|null */
        public ?CustomerPayment $CustomerPayment=null,
        /** @var string|null */
        public ?string $PublicOrderID=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
        if (isset($o['PaymentIntentSuccess'])) $this->PaymentIntentSuccess = $o['PaymentIntentSuccess'];
        if (isset($o['PaymentSuccess'])) $this->PaymentSuccess = $o['PaymentSuccess'];
        if (isset($o['SubscriptionSuccess'])) $this->SubscriptionSuccess = $o['SubscriptionSuccess'];
        if (isset($o['Message'])) $this->Message = $o['Message'];
        if (isset($o['ReceiptUrl'])) $this->ReceiptUrl = $o['ReceiptUrl'];
        if (isset($o['AgentNumber'])) $this->AgentNumber = $o['AgentNumber'];
        if (isset($o['ClientSecret'])) $this->ClientSecret = $o['ClientSecret'];
        if (isset($o['CustomerPayment'])) $this->CustomerPayment = JsonConverters::from('CustomerPayment', $o['CustomerPayment']);
        if (isset($o['PublicOrderID'])) $this->PublicOrderID = $o['PublicOrderID'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
        if (isset($this->PaymentIntentSuccess)) $o['PaymentIntentSuccess'] = $this->PaymentIntentSuccess;
        if (isset($this->PaymentSuccess)) $o['PaymentSuccess'] = $this->PaymentSuccess;
        if (isset($this->SubscriptionSuccess)) $o['SubscriptionSuccess'] = $this->SubscriptionSuccess;
        if (isset($this->Message)) $o['Message'] = $this->Message;
        if (isset($this->ReceiptUrl)) $o['ReceiptUrl'] = $this->ReceiptUrl;
        if (isset($this->AgentNumber)) $o['AgentNumber'] = $this->AgentNumber;
        if (isset($this->ClientSecret)) $o['ClientSecret'] = $this->ClientSecret;
        if (isset($this->CustomerPayment)) $o['CustomerPayment'] = JsonConverters::to('CustomerPayment', $this->CustomerPayment);
        if (isset($this->PublicOrderID)) $o['PublicOrderID'] = $this->PublicOrderID;
        return empty($o) ? new class(){} : $o;
    }
}

class Customer implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $ID=0,
        /** @var string|null */
        public ?string $CustomerCode=null,
        /** @var string|null */
        public ?string $BusinessName=null,
        /** @var string|null */
        public ?string $FirstName=null,
        /** @var string|null */
        public ?string $LastName=null,
        /** @var string|null */
        public ?string $Email=null,
        /** @var string */
        public string $UID='',
        /** @var int */
        public int $AgentId=0
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ID'])) $this->ID = $o['ID'];
        if (isset($o['CustomerCode'])) $this->CustomerCode = $o['CustomerCode'];
        if (isset($o['BusinessName'])) $this->BusinessName = $o['BusinessName'];
        if (isset($o['FirstName'])) $this->FirstName = $o['FirstName'];
        if (isset($o['LastName'])) $this->LastName = $o['LastName'];
        if (isset($o['Email'])) $this->Email = $o['Email'];
        if (isset($o['UID'])) $this->UID = $o['UID'];
        if (isset($o['AgentId'])) $this->AgentId = $o['AgentId'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ID)) $o['ID'] = $this->ID;
        if (isset($this->CustomerCode)) $o['CustomerCode'] = $this->CustomerCode;
        if (isset($this->BusinessName)) $o['BusinessName'] = $this->BusinessName;
        if (isset($this->FirstName)) $o['FirstName'] = $this->FirstName;
        if (isset($this->LastName)) $o['LastName'] = $this->LastName;
        if (isset($this->Email)) $o['Email'] = $this->Email;
        if (isset($this->UID)) $o['UID'] = $this->UID;
        if (isset($this->AgentId)) $o['AgentId'] = $this->AgentId;
        return empty($o) ? new class(){} : $o;
    }
}

class PaymentInfo implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $PaymentType=null,
        /** @var string|null */
        public ?string $CardNumber=null,
        /** @var string|null */
        public ?string $ExpDate=null,
        /** @var string|null */
        public ?string $CCV=null,
        /** @var string|null */
        public ?string $StripeToken=null,
        /** @var int */
        public int $AgentId=0
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['PaymentType'])) $this->PaymentType = $o['PaymentType'];
        if (isset($o['CardNumber'])) $this->CardNumber = $o['CardNumber'];
        if (isset($o['ExpDate'])) $this->ExpDate = $o['ExpDate'];
        if (isset($o['CCV'])) $this->CCV = $o['CCV'];
        if (isset($o['StripeToken'])) $this->StripeToken = $o['StripeToken'];
        if (isset($o['AgentId'])) $this->AgentId = $o['AgentId'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->PaymentType)) $o['PaymentType'] = $this->PaymentType;
        if (isset($this->CardNumber)) $o['CardNumber'] = $this->CardNumber;
        if (isset($this->ExpDate)) $o['ExpDate'] = $this->ExpDate;
        if (isset($this->CCV)) $o['CCV'] = $this->CCV;
        if (isset($this->StripeToken)) $o['StripeToken'] = $this->StripeToken;
        if (isset($this->AgentId)) $o['AgentId'] = $this->AgentId;
        return empty($o) ? new class(){} : $o;
    }
}

class CustomerPaymentsRequest implements JsonSerializable
{
    public function __construct(
        /** @var Customer|null */
        public ?Customer $Customer=null,
        /** @var string */
        public string $OrderID='',
        /** @var PaymentInfo|null */
        public ?PaymentInfo $PaymentInfo=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Customer'])) $this->Customer = JsonConverters::from('Customer', $o['Customer']);
        if (isset($o['OrderID'])) $this->OrderID = $o['OrderID'];
        if (isset($o['PaymentInfo'])) $this->PaymentInfo = JsonConverters::from('PaymentInfo', $o['PaymentInfo']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Customer)) $o['Customer'] = JsonConverters::to('Customer', $this->Customer);
        if (isset($this->OrderID)) $o['OrderID'] = $this->OrderID;
        if (isset($this->PaymentInfo)) $o['PaymentInfo'] = JsonConverters::to('PaymentInfo', $this->PaymentInfo);
        return empty($o) ? new class(){} : $o;
    }
}

PHP CustomerPaymentsRequest 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 /v1/CustomerPayments HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<CustomerPaymentsRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
  <Customer>
    <AgentId>0</AgentId>
    <BusinessName>String</BusinessName>
    <CustomerCode>String</CustomerCode>
    <Email>String</Email>
    <FirstName>String</FirstName>
    <ID>0</ID>
    <LastName>String</LastName>
    <UID>00000000-0000-0000-0000-000000000000</UID>
  </Customer>
  <OrderID>00000000-0000-0000-0000-000000000000</OrderID>
  <PaymentInfo>
    <AgentId>0</AgentId>
    <CCV>String</CCV>
    <CardNumber>String</CardNumber>
    <ExpDate>String</ExpDate>
    <PaymentType>String</PaymentType>
    <StripeToken>String</StripeToken>
  </PaymentInfo>
</CustomerPaymentsRequest>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<CustomerPaymentsResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
  <AgentNumber>String</AgentNumber>
  <ClientSecret>String</ClientSecret>
  <CustomerPayment>
    <Amount>String</Amount>
    <Approved>false</Approved>
    <AuthCode>String</AuthCode>
    <CardNumber>String</CardNumber>
    <CustomerID>0</CustomerID>
    <FullResponse>String</FullResponse>
    <ID>0</ID>
    <Message>String</Message>
    <OrderHeaderID>0</OrderHeaderID>
    <PaymentStatus>0</PaymentStatus>
    <PaymentType>0</PaymentType>
    <ResponseCode>0</ResponseCode>
    <TransactionDate>0001-01-01T00:00:00</TransactionDate>
    <TransactionId>String</TransactionId>
  </CustomerPayment>
  <Message>String</Message>
  <PaymentIntentSuccess>false</PaymentIntentSuccess>
  <PaymentSuccess>false</PaymentSuccess>
  <PublicOrderID>String</PublicOrderID>
  <ReceiptUrl>String</ReceiptUrl>
  <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>
  <SubscriptionSuccess>false</SubscriptionSuccess>
</CustomerPaymentsResponse>