| Requires any of the roles: | Agent, Administrator, Agent, Administrator, Agent, Administrator |
| 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 .jsv suffix or ?format=jsv
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: text/jsv
Content-Type: text/jsv
Content-Length: length
{
Customer:
{
ID: 0,
CustomerCode: String,
BusinessName: String,
FirstName: String,
LastName: String,
Email: String,
UID: 00000000000000000000000000000000,
AgentId: 0
},
OrderID: 00000000000000000000000000000000,
PaymentInfo:
{
PaymentType: String,
CardNumber: String,
ExpDate: String,
CCV: String,
StripeToken: String,
AgentId: 0
}
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
ResponseStatus:
{
ErrorCode: String,
Message: String,
StackTrace: String,
Errors:
[
{
ErrorCode: String,
FieldName: String,
Message: String,
Meta:
{
String: String
}
}
],
Meta:
{
String: String
}
},
PaymentIntentSuccess: False,
PaymentSuccess: False,
SubscriptionSuccess: False,
Message: String,
ReceiptUrl: String,
AgentNumber: String,
ClientSecret: String,
CustomerPayment:
{
ID: 0,
CustomerID: 0,
OrderHeaderID: 0,
Amount: String,
Approved: False,
AuthCode: String,
CardNumber: String,
Message: String,
ResponseCode: 0,
TransactionId: String,
TransactionDate: 0001-01-01,
FullResponse: String,
PaymentStatus: 0,
PaymentType: 0
},
PublicOrderID: String
}