| POST | /api/v1/onepay/payment-callback-url |
|---|
<?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 OnePayLogResponse implements JsonSerializable
{
public function __construct(
/** @var string */
public string $userName='',
/** @var string */
public string $orderId='',
/** @var int */
public int $price=0,
/** @var string */
public string $payCode='',
/** @var string */
public string $payMsg='',
/** @var string */
public string $payChannel='',
/** @var DateTime */
public DateTime $payDate=new DateTime()
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['userName'])) $this->userName = $o['userName'];
if (isset($o['orderId'])) $this->orderId = $o['orderId'];
if (isset($o['price'])) $this->price = $o['price'];
if (isset($o['payCode'])) $this->payCode = $o['payCode'];
if (isset($o['payMsg'])) $this->payMsg = $o['payMsg'];
if (isset($o['payChannel'])) $this->payChannel = $o['payChannel'];
if (isset($o['payDate'])) $this->payDate = JsonConverters::from('DateTime', $o['payDate']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->userName)) $o['userName'] = $this->userName;
if (isset($this->orderId)) $o['orderId'] = $this->orderId;
if (isset($this->price)) $o['price'] = $this->price;
if (isset($this->payCode)) $o['payCode'] = $this->payCode;
if (isset($this->payMsg)) $o['payMsg'] = $this->payMsg;
if (isset($this->payChannel)) $o['payChannel'] = $this->payChannel;
if (isset($this->payDate)) $o['payDate'] = JsonConverters::to('DateTime', $this->payDate);
return empty($o) ? new class(){} : $o;
}
}
class OnePayPaymentCallbackUrlRequest implements JsonSerializable
{
public function __construct(
/** @var string */
public string $vpc_MerchTxnRef='',
/** @var string */
public string $vpc_OrderInfo='',
/** @var string|null */
public ?string $vpc_CardNum=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['vpc_MerchTxnRef'])) $this->vpc_MerchTxnRef = $o['vpc_MerchTxnRef'];
if (isset($o['vpc_OrderInfo'])) $this->vpc_OrderInfo = $o['vpc_OrderInfo'];
if (isset($o['vpc_CardNum'])) $this->vpc_CardNum = $o['vpc_CardNum'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->vpc_MerchTxnRef)) $o['vpc_MerchTxnRef'] = $this->vpc_MerchTxnRef;
if (isset($this->vpc_OrderInfo)) $o['vpc_OrderInfo'] = $this->vpc_OrderInfo;
if (isset($this->vpc_CardNum)) $o['vpc_CardNum'] = $this->vpc_CardNum;
return empty($o) ? new class(){} : $o;
}
}
PHP OnePayPaymentCallbackUrlRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json
To embed the response in a jsonp callback, append ?callback=myCallback
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /api/v1/onepay/payment-callback-url HTTP/1.1
Host: efun-id-api-sandbox.efun.vn
Accept: application/json
Content-Type: application/json
Content-Length: length
{"vpc_MerchTxnRef":"String","vpc_OrderInfo":"String","vpc_CardNum":"String"}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length
{"userName":"String","orderId":"String","price":0,"payCode":"String","payMsg":"String","payChannel":"String","payDate":"0001-01-01T00:00:00.0000000+07:06"}