Skip to content

Commit

Permalink
修复支付宝支付,extend_params 处理错误的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Yurunsoft committed Jun 24, 2020
1 parent f4ea1fa commit d287d6f
Show file tree
Hide file tree
Showing 12 changed files with 20 additions and 56 deletions.
4 changes: 2 additions & 2 deletions src/AlipayApp/App/Params/Pay/BusinessParams.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class BusinessParams

/**
* 外部指定买家
* @var [type]
* @var array
*/
public $ext_user_info;

Expand All @@ -108,7 +108,7 @@ public function __construct()
public function toString()
{
$obj = (array)$this;
$result = $obj['extend_params']->toString();
$result = $obj['extend_params']->toArray();
if(null === $result)
{
unset($obj['extend_params']);
Expand Down
10 changes: 2 additions & 8 deletions src/AlipayApp/App/Params/Pay/ExtendParams.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
<?php
namespace Yurun\PaySDK\AlipayApp\App\Params\Pay;

use \Yurun\PaySDK\Traits\JSONParams;

/**
* 支付宝手机支付下单扩展参数类
*/
class ExtendParams
{
use JSONParams{
toString as private traitToString;
}

/**
* 系统商编号,该参数作为系统商返佣数据提取的依据,请填写系统商签约协议的PID
* @var string
Expand Down Expand Up @@ -45,12 +39,12 @@ class ExtendParams
*/
public $hb_fq_seller_percent;

public function toString()
public function toArray()
{
if(null === $this->sys_service_provider_id && null === $this->hb_fq_num && null === $this->hb_fq_seller_percent && null === $this->needBuyerRealnamed && null === $this->TRANS_MEMO)
{
return null;
}
return $this->traitToString();
return (array)$this;
}
}
10 changes: 2 additions & 8 deletions src/AlipayApp/FTF/Params/ExtendParams.php
Original file line number Diff line number Diff line change
@@ -1,29 +1,23 @@
<?php
namespace Yurun\PaySDK\AlipayApp\FTF\Params;

use \Yurun\PaySDK\Traits\JSONParams;

/**
* 支付宝当面付扩展参数
*/
class ExtendParams
{
use JSONParams{
toString as private traitToString;
}

/**
* 系统商编号,该参数作为系统商返佣数据提取的依据,请填写系统商签约协议的PID
* @var string
*/
public $sys_service_provider_id;

public function toString()
public function toArray()
{
if(null === $this->sys_service_provider_id)
{
return null;
}
return $this->traitToString();
return (array)$this;
}
}
2 changes: 1 addition & 1 deletion src/AlipayApp/FTF/Params/Pay/BusinessParams.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public function toString()
{
$obj['goods_detail'] = json_encode($obj['goods_detail']);
}
$result = $obj['extend_params']->toString();
$result = $obj['extend_params']->toArray();
if(null === $result)
{
unset($obj['extend_params']);
Expand Down
2 changes: 1 addition & 1 deletion src/AlipayApp/FTF/Params/QR/BusinessParams.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function toString()
{
$obj['goods_detail'] = json_encode($obj['goods_detail']);
}
$result = $obj['extend_params']->toString();
$result = $obj['extend_params']->toArray();
if(null === $result)
{
unset($obj['extend_params']);
Expand Down
2 changes: 1 addition & 1 deletion src/AlipayApp/MiniApp/Params/Pay/BusinessParams.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public function __construct()
public function toString()
{
$obj = (array)$this;
$result = $obj['extend_params']->toString();
$result = $obj['extend_params']->toArray();
if(null === $result)
{
unset($obj['extend_params']);
Expand Down
10 changes: 2 additions & 8 deletions src/AlipayApp/MiniApp/Params/Pay/ExtendParams.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
<?php
namespace Yurun\PaySDK\AlipayApp\MiniApp\Params\Pay;

use \Yurun\PaySDK\Traits\JSONParams;

/**
* 业务扩展参数
*/
class ExtendParams
{
use JSONParams{
toString as private traitToString;
}

/**
* 系统商编号,该参数作为系统商返佣数据提取的依据,请填写系统商签约协议的PID
* @var string
Expand All @@ -25,12 +19,12 @@ class ExtendParams
*/
public $card_type;

public function toString()
public function toArray()
{
if(null === $this->sys_service_provider_id && null === $this->card_type)
{
return null;
}
return $this->traitToString();
return (array)$this;
}
}
10 changes: 2 additions & 8 deletions src/AlipayApp/Page/Params/GoodsDetail.php
Original file line number Diff line number Diff line change
@@ -1,29 +1,23 @@
<?php
namespace Yurun\PaySDK\AlipayApp\Page\Params;

use \Yurun\PaySDK\Traits\JSONParams;

/**
* 支付宝PC场景下单并支付商品详情类
*/
class GoodsDetail
{
use JSONParams{
toString as private traitToString;
}

/**
* 在支付时,可点击商品名称跳转到该地址
* @var string
*/
public $show_url;

public function toString()
public function toArray()
{
if(null === $this->show_url)
{
return null;
}
return $this->traitToString();
return (array)$this;
}
}
4 changes: 2 additions & 2 deletions src/AlipayApp/Page/Params/Pay/BusinessParams.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public function __construct()
public function toString()
{
$obj = (array)$this;
$result = $obj['goods_detail']->toString();
$result = $obj['goods_detail']->toArray();
if(null === $result)
{
unset($obj['goods_detail']);
Expand All @@ -132,7 +132,7 @@ public function toString()
{
$obj['goods_detail'] = $result;
}
$result = $obj['extend_params']->toString();
$result = $obj['extend_params']->toArray();
if(null === $result)
{
unset($obj['extend_params']);
Expand Down
10 changes: 2 additions & 8 deletions src/AlipayApp/Page/Params/Pay/ExtendParams.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
<?php
namespace Yurun\PaySDK\AlipayApp\Page\Params\Pay;

use \Yurun\PaySDK\Traits\JSONParams;

/**
* 支付宝PC场景下单并支付扩展参数类
*/
class ExtendParams
{
use JSONParams{
toString as private traitToString;
}

/**
* 系统商编号,该参数作为系统商返佣数据提取的依据,请填写系统商签约协议的PID
* @var string
Expand All @@ -30,12 +24,12 @@ class ExtendParams
*/
public $hb_fq_seller_percent;

public function toString()
public function toArray()
{
if(null === $this->sys_service_provider_id && null === $this->hb_fq_num && null === $this->hb_fq_seller_percent)
{
return null;
}
return $this->traitToString();
return (array)$this;
}
}
2 changes: 1 addition & 1 deletion src/AlipayApp/Wap/Params/Pay/BusinessParams.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public function __construct()
public function toString()
{
$obj = (array)$this;
$result = $obj['extend_params']->toString();
$result = $obj['extend_params']->toArray();
if(null === $result)
{
unset($obj['extend_params']);
Expand Down
10 changes: 2 additions & 8 deletions src/AlipayApp/Wap/Params/Pay/ExtendParams.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
<?php
namespace Yurun\PaySDK\AlipayApp\Wap\Params\Pay;

use \Yurun\PaySDK\Traits\JSONParams;

/**
* 支付宝手机支付下单扩展参数类
*/
class ExtendParams
{
use JSONParams{
toString as private traitToString;
}

/**
* 系统商编号,该参数作为系统商返佣数据提取的依据,请填写系统商签约协议的PID
* @var string
Expand Down Expand Up @@ -45,12 +39,12 @@ class ExtendParams
*/
public $hb_fq_seller_percent;

public function toString()
public function toArray()
{
if(null === $this->sys_service_provider_id && null === $this->hb_fq_num && null === $this->hb_fq_seller_percent && null === $this->needBuyerRealnamed && null === $this->TRANS_MEMO)
{
return null;
}
return $this->traitToString();
return (array)$this;
}
}

0 comments on commit d287d6f

Please sign in to comment.