| POST | /api/v1/pay/submit |
|---|
<?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 PaySubmitRequest implements JsonSerializable
{
public function __construct(
/** @var string */
public string $captcha='',
/** @var int */
public int $gameId=0,
/** @var int */
public int $serverId=0,
/** @var int */
public int $packageId=0,
/** @var string */
public string $characterId='',
/** @var string */
public string $characterName=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['captcha'])) $this->captcha = $o['captcha'];
if (isset($o['gameId'])) $this->gameId = $o['gameId'];
if (isset($o['serverId'])) $this->serverId = $o['serverId'];
if (isset($o['packageId'])) $this->packageId = $o['packageId'];
if (isset($o['characterId'])) $this->characterId = $o['characterId'];
if (isset($o['characterName'])) $this->characterName = $o['characterName'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->captcha)) $o['captcha'] = $this->captcha;
if (isset($this->gameId)) $o['gameId'] = $this->gameId;
if (isset($this->serverId)) $o['serverId'] = $this->serverId;
if (isset($this->packageId)) $o['packageId'] = $this->packageId;
if (isset($this->characterId)) $o['characterId'] = $this->characterId;
if (isset($this->characterName)) $o['characterName'] = $this->characterName;
return empty($o) ? new class(){} : $o;
}
}
class BannerListResponse implements JsonSerializable
{
public function __construct(
/** @var int */
public int $id=0,
/** @var string */
public string $title='',
/** @var string */
public string $image='',
/** @var string */
public string $url='',
/** @var bool|null */
public ?bool $publish=null,
/** @var DateTime */
public DateTime $publishDate=new DateTime(),
/** @var int */
public int $orderIndex=0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['id'])) $this->id = $o['id'];
if (isset($o['title'])) $this->title = $o['title'];
if (isset($o['image'])) $this->image = $o['image'];
if (isset($o['url'])) $this->url = $o['url'];
if (isset($o['publish'])) $this->publish = $o['publish'];
if (isset($o['publishDate'])) $this->publishDate = JsonConverters::from('DateTime', $o['publishDate']);
if (isset($o['orderIndex'])) $this->orderIndex = $o['orderIndex'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->id)) $o['id'] = $this->id;
if (isset($this->title)) $o['title'] = $this->title;
if (isset($this->image)) $o['image'] = $this->image;
if (isset($this->url)) $o['url'] = $this->url;
if (isset($this->publish)) $o['publish'] = $this->publish;
if (isset($this->publishDate)) $o['publishDate'] = JsonConverters::to('DateTime', $this->publishDate);
if (isset($this->orderIndex)) $o['orderIndex'] = $this->orderIndex;
return empty($o) ? new class(){} : $o;
}
}
/**
* @template T
*/
class BaseResponse implements IResponseRequest, JsonSerializable
{
public array $genericArgs = [];
public static function create(array $genericArgs=[]): BaseResponse {
$to = new BaseResponse();
$to->genericArgs = $genericArgs;
return $to;
}
public function __construct(
/** @var int */
public mixed $code=0,
/** @var string|null */
public mixed $message=null,
/** @var array<BannerListResponse>|null */
public mixed $data=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['code'])) $this->code = $o['code'];
if (isset($o['message'])) $this->message = $o['message'];
if (isset($o['data'])) $this->data = JsonConverters::fromArray('BannerListResponse', $o['data']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->code)) $o['code'] = $this->code;
if (isset($this->message)) $o['message'] = $this->message;
if (isset($this->data)) $o['data'] = JsonConverters::toArray('BannerListResponse', $this->data);
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /api/v1/pay/submit HTTP/1.1
Host: efun-id-api-sandbox.efun.vn
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<PaySubmitRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/efun.id.api.ServiceModel">
<Captcha>String</Captcha>
<CharacterId>String</CharacterId>
<CharacterName>String</CharacterName>
<GameId>0</GameId>
<PackageId>0</PackageId>
<ServerId>0</ServerId>
</PaySubmitRequest>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length
<BaseResponseOfCdoRechargeResponse53LsApX4 xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/efun.id.api.ServiceModel">
<Code>0</Code>
<Data xmlns:d2p1="http://schemas.datacontract.org/2004/07/efun.id.data.Models">
<d2p1:code>0</d2p1:code>
<d2p1:data>
<d2p1:Money>0</d2p1:Money>
<d2p1:OrderId>String</d2p1:OrderId>
<d2p1:PayId>0</d2p1:PayId>
<d2p1:PlayerId>0</d2p1:PlayerId>
<d2p1:ServerId>0</d2p1:ServerId>
<d2p1:Time>0</d2p1:Time>
</d2p1:data>
<d2p1:message>String</d2p1:message>
</Data>
<Message>String</Message>
</BaseResponseOfCdoRechargeResponse53LsApX4>