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 .other suffix or ?format=other

HTTP + OTHER

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: text/jsonl
Content-Type: text/jsonl
Content-Length: length

{"Customer":{"ID":0,"CustomerCode":"String","BusinessName":"String","FirstName":"String","LastName":"String","Email":"String","UID":"00000000000000000000000000000000","AgentId":0},"Address":{"ID":0,"AddressTypeID":0,"AddressContact":"String","AttentionTo":"String","AddressLine1":"String","AddressLine2":"String","AddressLine3":"String","AddressCity":"String","AddressState":"String","AddressZip":"String","AddressCountry":"String","PhoneNumber":"String","FaxNumber":"String","UID":"00000000000000000000000000000000","Name":"String"}}
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"}},"StripeCustomer":{"StripeCustomerId":0,"StripeMerchantId":0,"CustomerId":0,"StripeId":"String","AgentId":0,"StripeCustomerSessionClientSecret":"String"},"Success":false,"Message":"String"}