Trendsic Platform Service

<back to all web services

StripeCustomerRequest

Requires Authentication
Requires any of the roles:Agent, Administrator, Agent, Administrator, Agent, Administrator
The following routes are available for this service:
GET,OPTIONS/v1/StripeCustomer
PUT,OPTIONS/v1/StripeCustomer
POST,OPTIONS/v1/StripeCustomer
<?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 StripeCustomer implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $StripeCustomerId=0,
        /** @var int */
        public int $StripeMerchantId=0,
        /** @var int */
        public int $CustomerId=0,
        /** @var string|null */
        public ?string $StripeId=null,
        /** @var int */
        public int $AgentId=0,
        /** @var string|null */
        public ?string $StripeCustomerSessionClientSecret=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['StripeCustomerId'])) $this->StripeCustomerId = $o['StripeCustomerId'];
        if (isset($o['StripeMerchantId'])) $this->StripeMerchantId = $o['StripeMerchantId'];
        if (isset($o['CustomerId'])) $this->CustomerId = $o['CustomerId'];
        if (isset($o['StripeId'])) $this->StripeId = $o['StripeId'];
        if (isset($o['AgentId'])) $this->AgentId = $o['AgentId'];
        if (isset($o['StripeCustomerSessionClientSecret'])) $this->StripeCustomerSessionClientSecret = $o['StripeCustomerSessionClientSecret'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->StripeCustomerId)) $o['StripeCustomerId'] = $this->StripeCustomerId;
        if (isset($this->StripeMerchantId)) $o['StripeMerchantId'] = $this->StripeMerchantId;
        if (isset($this->CustomerId)) $o['CustomerId'] = $this->CustomerId;
        if (isset($this->StripeId)) $o['StripeId'] = $this->StripeId;
        if (isset($this->AgentId)) $o['AgentId'] = $this->AgentId;
        if (isset($this->StripeCustomerSessionClientSecret)) $o['StripeCustomerSessionClientSecret'] = $this->StripeCustomerSessionClientSecret;
        return empty($o) ? new class(){} : $o;
    }
}

class StripeCustomerResponse implements JsonSerializable
{
    public function __construct(
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null,
        /** @var StripeCustomer|null */
        public ?StripeCustomer $StripeCustomer=null,
        /** @var bool|null */
        public ?bool $Success=null,
        /** @var string|null */
        public ?string $Message=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
        if (isset($o['StripeCustomer'])) $this->StripeCustomer = JsonConverters::from('StripeCustomer', $o['StripeCustomer']);
        if (isset($o['Success'])) $this->Success = $o['Success'];
        if (isset($o['Message'])) $this->Message = $o['Message'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
        if (isset($this->StripeCustomer)) $o['StripeCustomer'] = JsonConverters::to('StripeCustomer', $this->StripeCustomer);
        if (isset($this->Success)) $o['Success'] = $this->Success;
        if (isset($this->Message)) $o['Message'] = $this->Message;
        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 Address implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $ID=0,
        /** @var int */
        public int $AddressTypeID=0,
        /** @var string|null */
        public ?string $AddressContact=null,
        /** @var string|null */
        public ?string $AttentionTo=null,
        /** @var string|null */
        public ?string $AddressLine1=null,
        /** @var string|null */
        public ?string $AddressLine2=null,
        /** @var string|null */
        public ?string $AddressLine3=null,
        /** @var string|null */
        public ?string $AddressCity=null,
        /** @var string|null */
        public ?string $AddressState=null,
        /** @var string|null */
        public ?string $AddressZip=null,
        /** @var string|null */
        public ?string $AddressCountry=null,
        /** @var string|null */
        public ?string $PhoneNumber=null,
        /** @var string|null */
        public ?string $FaxNumber=null,
        /** @var string */
        public string $UID='',
        /** @var string|null */
        public ?string $Name=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ID'])) $this->ID = $o['ID'];
        if (isset($o['AddressTypeID'])) $this->AddressTypeID = $o['AddressTypeID'];
        if (isset($o['AddressContact'])) $this->AddressContact = $o['AddressContact'];
        if (isset($o['AttentionTo'])) $this->AttentionTo = $o['AttentionTo'];
        if (isset($o['AddressLine1'])) $this->AddressLine1 = $o['AddressLine1'];
        if (isset($o['AddressLine2'])) $this->AddressLine2 = $o['AddressLine2'];
        if (isset($o['AddressLine3'])) $this->AddressLine3 = $o['AddressLine3'];
        if (isset($o['AddressCity'])) $this->AddressCity = $o['AddressCity'];
        if (isset($o['AddressState'])) $this->AddressState = $o['AddressState'];
        if (isset($o['AddressZip'])) $this->AddressZip = $o['AddressZip'];
        if (isset($o['AddressCountry'])) $this->AddressCountry = $o['AddressCountry'];
        if (isset($o['PhoneNumber'])) $this->PhoneNumber = $o['PhoneNumber'];
        if (isset($o['FaxNumber'])) $this->FaxNumber = $o['FaxNumber'];
        if (isset($o['UID'])) $this->UID = $o['UID'];
        if (isset($o['Name'])) $this->Name = $o['Name'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ID)) $o['ID'] = $this->ID;
        if (isset($this->AddressTypeID)) $o['AddressTypeID'] = $this->AddressTypeID;
        if (isset($this->AddressContact)) $o['AddressContact'] = $this->AddressContact;
        if (isset($this->AttentionTo)) $o['AttentionTo'] = $this->AttentionTo;
        if (isset($this->AddressLine1)) $o['AddressLine1'] = $this->AddressLine1;
        if (isset($this->AddressLine2)) $o['AddressLine2'] = $this->AddressLine2;
        if (isset($this->AddressLine3)) $o['AddressLine3'] = $this->AddressLine3;
        if (isset($this->AddressCity)) $o['AddressCity'] = $this->AddressCity;
        if (isset($this->AddressState)) $o['AddressState'] = $this->AddressState;
        if (isset($this->AddressZip)) $o['AddressZip'] = $this->AddressZip;
        if (isset($this->AddressCountry)) $o['AddressCountry'] = $this->AddressCountry;
        if (isset($this->PhoneNumber)) $o['PhoneNumber'] = $this->PhoneNumber;
        if (isset($this->FaxNumber)) $o['FaxNumber'] = $this->FaxNumber;
        if (isset($this->UID)) $o['UID'] = $this->UID;
        if (isset($this->Name)) $o['Name'] = $this->Name;
        return empty($o) ? new class(){} : $o;
    }
}

class StripeCustomerRequest implements JsonSerializable
{
    public function __construct(
        /** @var Customer|null */
        public ?Customer $Customer=null,
        /** @var Address|null */
        public ?Address $Address=null
    ) {
    }

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

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

<StripeCustomerRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
  <Address>
    <AddressCity>String</AddressCity>
    <AddressContact>String</AddressContact>
    <AddressCountry>String</AddressCountry>
    <AddressLine1>String</AddressLine1>
    <AddressLine2>String</AddressLine2>
    <AddressLine3>String</AddressLine3>
    <AddressState>String</AddressState>
    <AddressTypeID>0</AddressTypeID>
    <AddressZip>String</AddressZip>
    <AttentionTo>String</AttentionTo>
    <FaxNumber>String</FaxNumber>
    <ID>0</ID>
    <Name>String</Name>
    <PhoneNumber>String</PhoneNumber>
    <UID>00000000-0000-0000-0000-000000000000</UID>
  </Address>
  <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>
</StripeCustomerRequest>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<StripeCustomerResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
  <Message>String</Message>
  <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>
  <StripeCustomer>
    <AgentId>0</AgentId>
    <CustomerId>0</CustomerId>
    <StripeCustomerId>0</StripeCustomerId>
    <StripeCustomerSessionClientSecret>String</StripeCustomerSessionClientSecret>
    <StripeId>String</StripeId>
    <StripeMerchantId>0</StripeMerchantId>
  </StripeCustomer>
  <Success>false</Success>
</StripeCustomerResponse>