Merge branch 'release/0.0.5'

develop
X14XA\shengli 2 months ago
commit 4886051fe6
  1. 17
      src/factory/object/trade/DeviceInfo.php
  2. 13
      src/factory/object/trade/DivDetail.php
  3. 13
      src/factory/object/trade/ObjectInfo.php

@ -2,6 +2,8 @@
namespace Tansilu\HfPayLib\factory\object\trade; namespace Tansilu\HfPayLib\factory\object\trade;
use JsonSerializable;
use PHPUnit\Util\Json;
use Tansilu\HfPayLib\exception\ParamsException; use Tansilu\HfPayLib\exception\ParamsException;
/** /**
@ -31,7 +33,7 @@ use Tansilu\HfPayLib\exception\ParamsException;
* @property $serviceProviderIp 商户服务IP地址 * @property $serviceProviderIp 商户服务IP地址
* @property $merUrl 商户网址 * @property $merUrl 商户网址
*/ */
class DeviceInfo class DeviceInfo implements JsonSerializable
{ {
public static function make( public static function make(
string $devType, string $devType,
@ -62,6 +64,14 @@ class DeviceInfo
$this->data[$name] = $value; $this->data[$name] = $value;
} }
/**
* @throws ParamsException
*/
public function __toString()
{
return $this->toJson();
}
public function toJSON(): string public function toJSON(): string
{ {
@ -76,4 +86,9 @@ class DeviceInfo
} }
return json_encode($this->data, JSON_UNESCAPED_UNICODE); return json_encode($this->data, JSON_UNESCAPED_UNICODE);
} }
public function jsonSerialize(): array
{
return $this->data;
}
} }

@ -2,13 +2,15 @@
namespace Tansilu\HfPayLib\factory\object\trade; namespace Tansilu\HfPayLib\factory\object\trade;
use JsonSerializable;
/** /**
* @property $divCustId 分账客户号 * @property $divCustId 分账客户号
* @property $divAcctId 分账账户号 * @property $divAcctId 分账账户号
* @property $divAmt 分账金额 * @property $divAmt 分账金额
* @property $riskDivType 风控分账用途 * @property $riskDivType 风控分账用途
*/ */
class DivDetail class DivDetail implements JsonSerializable
{ {
public static function make(string $divCustId, string $divAcctId, string $amount, string $riskDivType): self public static function make(string $divCustId, string $divAcctId, string $amount, string $riskDivType): self
{ {
@ -35,9 +37,18 @@ class DivDetail
$this->data[$name] = $value; $this->data[$name] = $value;
} }
public function __toString()
{
return $this->toJSON();
}
public function toJSON(): string public function toJSON(): string
{ {
return json_encode($this->data, JSON_UNESCAPED_UNICODE); return json_encode($this->data, JSON_UNESCAPED_UNICODE);
} }
public function jsonSerialize(): array
{
return $this->data;
}
} }

@ -2,6 +2,8 @@
namespace Tansilu\HfPayLib\factory\object\trade; namespace Tansilu\HfPayLib\factory\object\trade;
use JsonSerializable;
/** /**
* 藏品信息 * 藏品信息
* *
@ -22,7 +24,7 @@ namespace Tansilu\HfPayLib\factory\object\trade;
* @property string $regCustId 买家注册用户ID * @property string $regCustId 买家注册用户ID
* *
*/ */
class ObjectInfo class ObjectInfo implements JsonSerializable
{ {
public static function make(int $marketType): self public static function make(int $marketType): self
{ {
@ -46,9 +48,18 @@ class ObjectInfo
$this->data[$name] = $value; $this->data[$name] = $value;
} }
public function __toString()
{
return $this->toJSON();
}
public function toJSON(): string public function toJSON(): string
{ {
return json_encode($this->data, JSON_UNESCAPED_UNICODE); return json_encode($this->data, JSON_UNESCAPED_UNICODE);
} }
public function jsonSerialize(): array
{
return $this->data;
}
} }
Loading…
Cancel
Save