This commit is contained in:
Your Name
2026-03-01 14:17:59 +08:00
parent 65aa12f146
commit a07e844c47
6071 changed files with 777651 additions and 0 deletions
@@ -0,0 +1,129 @@
<?php
// This file is auto-generated, don't edit it. Thanks.
namespace Alipay\EasySDK\Payment\App;
use Alipay\EasySDK\Kernel\EasySDKKernel;
use Alipay\EasySDK\Payment\App\Models\AlipayTradeAppPayResponse;
class Client {
protected $_kernel;
public function __construct($kernel){
$this->_kernel = $kernel;
}
/**
* @param string $subject
* @param string $outTradeNo
* @param string $totalAmount
* @return AlipayTradeAppPayResponse
*/
public function pay($subject, $outTradeNo, $totalAmount){
$systemParams = [
"method" => "alipay.trade.app.pay",
"app_id" => $this->_kernel->getConfig("appId"),
"timestamp" => $this->_kernel->getTimestamp(),
"format" => "json",
"version" => "1.0",
"alipay_sdk" => $this->_kernel->getSdkVersion(),
"charset" => "UTF-8",
"sign_type" => $this->_kernel->getConfig("signType"),
"app_cert_sn" => $this->_kernel->getMerchantCertSN(),
"alipay_root_cert_sn" => $this->_kernel->getAlipayRootCertSN()
];
$bizParams = [
"subject" => $subject,
"out_trade_no" => $outTradeNo,
"total_amount" => $totalAmount
];
$textParams = [];
$sign = $this->_kernel->sign($systemParams, $bizParams, $textParams, $this->_kernel->getConfig("merchantPrivateKey"));
$response = [
"body" => $this->_kernel->generateOrderString($systemParams, $bizParams, $textParams, $sign)
];
return AlipayTradeAppPayResponse::fromMap($response);
}
/**
* ISV代商户代用,指定appAuthToken
*
* @param $appAuthToken String 代调用token
* @return $this 本客户端,便于链式调用
*/
public function agent($appAuthToken)
{
$this->_kernel->injectTextParam("app_auth_token", $appAuthToken);
return $this;
}
/**
* 用户授权调用,指定authToken
*
* @param $authToken String 用户授权token
* @return $this
*/
public function auth($authToken)
{
$this->_kernel->injectTextParam("auth_token", $authToken);
return $this;
}
/**
* 设置异步通知回调地址,此处设置将在本调用中覆盖Config中的全局配置
*
* @param $url String 异步通知回调地址,例如:https://www.test.com/callback
* @return $this
*/
public function asyncNotify($url)
{
$this->_kernel->injectTextParam("notify_url", $url);
return $this;
}
/**
* 将本次调用强制路由到后端系统的测试地址上,常用于线下环境内外联调,沙箱与线上环境设置无效
*
* @param $testUrl String 后端系统测试地址
* @return $this
*/
public function route($testUrl)
{
$this->_kernel->injectTextParam("ws_service_url", $testUrl);
return $this;
}
/**
* 设置API入参中没有的其他可选业务请求参数(biz_content下的字段)
*
* @param $key String 业务请求参数名称(biz_content下的字段名,比如timeout_express)
* @param $value object 业务请求参数的值,一个可以序列化成JSON的对象
* 如果该字段是一个字符串类型(String、Price、Date在SDK中都是字符串),请使用String储存
* 如果该字段是一个数值型类型(比如:Number),请使用Long储存
* 如果该字段是一个复杂类型,请使用嵌套的array指定各下级字段的值
* 如果该字段是一个数组,请使用array储存各个值
* @return $this
*/
public function optional($key, $value)
{
$this->_kernel->injectBizParam($key, $value);
return $this;
}
/**
* 批量设置API入参中没有的其他可选业务请求参数(biz_content下的字段)
* optional方法的批量版本
*
* @param $optionalArgs array 可选参数集合,每个参数由key和value组成,key和value的格式请参见optional方法的注释
* @return $this
*/
public function batchOptional($optionalArgs)
{
foreach ($optionalArgs as $key => $value) {
$this->_kernel->injectBizParam($key, $value);
}
return $this;
}
}
@@ -0,0 +1,39 @@
<?php
// This file is auto-generated, don't edit it. Thanks.
namespace Alipay\EasySDK\Payment\App\Models;
use AlibabaCloud\Tea\Model;
class AlipayTradeAppPayResponse extends Model {
protected $_name = [
'body' => 'body',
];
public function validate() {
Model::validateRequired('body', $this->body, true);
}
public function toMap() {
$res = [];
if (null !== $this->body) {
$res['body'] = $this->body;
}
return $res;
}
/**
* @param array $map
* @return AlipayTradeAppPayResponse
*/
public static function fromMap($map = []) {
$model = new self();
if(isset($map['body'])){
$model->body = $map['body'];
}
return $model;
}
/**
* @description 订单信息,字符串形式
* @var string
*/
public $body;
}
@@ -0,0 +1,757 @@
<?php
// This file is auto-generated, don't edit it. Thanks.
namespace Alipay\EasySDK\Payment\Common;
use Alipay\EasySDK\Kernel\EasySDKKernel;
use AlibabaCloud\Tea\Tea;
use AlibabaCloud\Tea\Request;
use AlibabaCloud\Tea\Exception\TeaError;
use \Exception;
use AlibabaCloud\Tea\Exception\TeaUnableRetryError;
use Alipay\EasySDK\Payment\Common\Models\AlipayTradeCreateResponse;
use AlibabaCloud\Tea\Response;
use Alipay\EasySDK\Payment\Common\Models\AlipayTradeQueryResponse;
use Alipay\EasySDK\Payment\Common\Models\AlipayTradeRefundResponse;
use Alipay\EasySDK\Payment\Common\Models\AlipayTradeCloseResponse;
use Alipay\EasySDK\Payment\Common\Models\AlipayTradeCancelResponse;
use Alipay\EasySDK\Payment\Common\Models\AlipayTradeFastpayRefundQueryResponse;
use Alipay\EasySDK\Payment\Common\Models\AlipayDataDataserviceBillDownloadurlQueryResponse;
class Client {
protected $_kernel;
public function __construct($kernel){
$this->_kernel = $kernel;
}
/**
* @param string $subject
* @param string $outTradeNo
* @param string $totalAmount
* @param string $buyerId
* @return AlipayTradeCreateResponse
* @throws TeaError
* @throws Exception
* @throws TeaUnableRetryError
*/
public function create($subject, $outTradeNo, $totalAmount, $buyerId){
$_runtime = [
"ignoreSSL" => $this->_kernel->getConfig("ignoreSSL"),
"httpProxy" => $this->_kernel->getConfig("httpProxy"),
"connectTimeout" => 15000,
"readTimeout" => 15000,
"retry" => [
"maxAttempts" => 0
]
];
$_lastRequest = null;
$_lastException = null;
$_now = time();
$_retryTimes = 0;
while (Tea::allowRetry(@$_runtime["retry"], $_retryTimes, $_now)) {
if ($_retryTimes > 0) {
$_backoffTime = Tea::getBackoffTime(@$_runtime["backoff"], $_retryTimes);
if ($_backoffTime > 0) {
Tea::sleep($_backoffTime);
}
}
$_retryTimes = $_retryTimes + 1;
try {
$_request = new Request();
$systemParams = [
"method" => "alipay.trade.create",
"app_id" => $this->_kernel->getConfig("appId"),
"timestamp" => $this->_kernel->getTimestamp(),
"format" => "json",
"version" => "1.0",
"alipay_sdk" => $this->_kernel->getSdkVersion(),
"charset" => "UTF-8",
"sign_type" => $this->_kernel->getConfig("signType"),
"app_cert_sn" => $this->_kernel->getMerchantCertSN(),
"alipay_root_cert_sn" => $this->_kernel->getAlipayRootCertSN()
];
$bizParams = [
"subject" => $subject,
"out_trade_no" => $outTradeNo,
"total_amount" => $totalAmount,
"buyer_id" => $buyerId
];
$textParams = [];
$_request->protocol = $this->_kernel->getConfig("protocol");
$_request->method = "POST";
$_request->pathname = "/gateway.do";
$_request->headers = [
"host" => $this->_kernel->getConfig("gatewayHost"),
"content-type" => "application/x-www-form-urlencoded;charset=utf-8"
];
$_request->query = $this->_kernel->sortMap(Tea::merge([
"sign" => $this->_kernel->sign($systemParams, $bizParams, $textParams, $this->_kernel->getConfig("merchantPrivateKey"))
], $systemParams, $textParams));
$_request->body = $this->_kernel->toUrlEncodedRequestBody($bizParams);
$_lastRequest = $_request;
$_response= Tea::send($_request, $_runtime);
$respMap = $this->_kernel->readAsJson($_response, "alipay.trade.create");
if ($this->_kernel->isCertMode()) {
if ($this->_kernel->verify($respMap, $this->_kernel->extractAlipayPublicKey($this->_kernel->getAlipayCertSN($respMap)))) {
return AlipayTradeCreateResponse::fromMap($this->_kernel->toRespModel($respMap));
}
}
else {
if ($this->_kernel->verify($respMap, $this->_kernel->getConfig("alipayPublicKey"))) {
return AlipayTradeCreateResponse::fromMap($this->_kernel->toRespModel($respMap));
}
}
throw new TeaError([
"message" => "验签失败,请检查支付宝公钥设置是否正确。"
]);
}
catch (Exception $e) {
if (!($e instanceof TeaError)) {
$e = new TeaError([], $e->getMessage(), $e->getCode(), $e);
}
if (Tea::isRetryable($e)) {
$_lastException = $e;
continue;
}
throw $e;
}
}
throw new TeaUnableRetryError($_lastRequest, $_lastException);
}
/**
* @param string $outTradeNo
* @return AlipayTradeQueryResponse
* @throws TeaError
* @throws Exception
* @throws TeaUnableRetryError
*/
public function query($outTradeNo){
$_runtime = [
"ignoreSSL" => $this->_kernel->getConfig("ignoreSSL"),
"httpProxy" => $this->_kernel->getConfig("httpProxy"),
"connectTimeout" => 15000,
"readTimeout" => 15000,
"retry" => [
"maxAttempts" => 0
]
];
$_lastRequest = null;
$_lastException = null;
$_now = time();
$_retryTimes = 0;
while (Tea::allowRetry(@$_runtime["retry"], $_retryTimes, $_now)) {
if ($_retryTimes > 0) {
$_backoffTime = Tea::getBackoffTime(@$_runtime["backoff"], $_retryTimes);
if ($_backoffTime > 0) {
Tea::sleep($_backoffTime);
}
}
$_retryTimes = $_retryTimes + 1;
try {
$_request = new Request();
$systemParams = [
"method" => "alipay.trade.query",
"app_id" => $this->_kernel->getConfig("appId"),
"timestamp" => $this->_kernel->getTimestamp(),
"format" => "json",
"version" => "1.0",
"alipay_sdk" => $this->_kernel->getSdkVersion(),
"charset" => "UTF-8",
"sign_type" => $this->_kernel->getConfig("signType"),
"app_cert_sn" => $this->_kernel->getMerchantCertSN(),
"alipay_root_cert_sn" => $this->_kernel->getAlipayRootCertSN()
];
$bizParams = [
"out_trade_no" => $outTradeNo
];
$textParams = [];
$_request->protocol = $this->_kernel->getConfig("protocol");
$_request->method = "POST";
$_request->pathname = "/gateway.do";
$_request->headers = [
"host" => $this->_kernel->getConfig("gatewayHost"),
"content-type" => "application/x-www-form-urlencoded;charset=utf-8"
];
$_request->query = $this->_kernel->sortMap(Tea::merge([
"sign" => $this->_kernel->sign($systemParams, $bizParams, $textParams, $this->_kernel->getConfig("merchantPrivateKey"))
], $systemParams, $textParams));
$_request->body = $this->_kernel->toUrlEncodedRequestBody($bizParams);
$_lastRequest = $_request;
$_response= Tea::send($_request, $_runtime);
$respMap = $this->_kernel->readAsJson($_response, "alipay.trade.query");
if ($this->_kernel->isCertMode()) {
if ($this->_kernel->verify($respMap, $this->_kernel->extractAlipayPublicKey($this->_kernel->getAlipayCertSN($respMap)))) {
return AlipayTradeQueryResponse::fromMap($this->_kernel->toRespModel($respMap));
}
}
else {
if ($this->_kernel->verify($respMap, $this->_kernel->getConfig("alipayPublicKey"))) {
return AlipayTradeQueryResponse::fromMap($this->_kernel->toRespModel($respMap));
}
}
throw new TeaError([
"message" => "验签失败,请检查支付宝公钥设置是否正确。"
]);
}
catch (Exception $e) {
if (!($e instanceof TeaError)) {
$e = new TeaError([], $e->getMessage(), $e->getCode(), $e);
}
if (Tea::isRetryable($e)) {
$_lastException = $e;
continue;
}
throw $e;
}
}
throw new TeaUnableRetryError($_lastRequest, $_lastException);
}
/**
* @param string $outTradeNo
* @param string $refundAmount
* @return AlipayTradeRefundResponse
* @throws TeaError
* @throws Exception
* @throws TeaUnableRetryError
*/
public function refund($outTradeNo, $refundAmount){
$_runtime = [
"ignoreSSL" => $this->_kernel->getConfig("ignoreSSL"),
"httpProxy" => $this->_kernel->getConfig("httpProxy"),
"connectTimeout" => 15000,
"readTimeout" => 15000,
"retry" => [
"maxAttempts" => 0
]
];
$_lastRequest = null;
$_lastException = null;
$_now = time();
$_retryTimes = 0;
while (Tea::allowRetry(@$_runtime["retry"], $_retryTimes, $_now)) {
if ($_retryTimes > 0) {
$_backoffTime = Tea::getBackoffTime(@$_runtime["backoff"], $_retryTimes);
if ($_backoffTime > 0) {
Tea::sleep($_backoffTime);
}
}
$_retryTimes = $_retryTimes + 1;
try {
$_request = new Request();
$systemParams = [
"method" => "alipay.trade.refund",
"app_id" => $this->_kernel->getConfig("appId"),
"timestamp" => $this->_kernel->getTimestamp(),
"format" => "json",
"version" => "1.0",
"alipay_sdk" => $this->_kernel->getSdkVersion(),
"charset" => "UTF-8",
"sign_type" => $this->_kernel->getConfig("signType"),
"app_cert_sn" => $this->_kernel->getMerchantCertSN(),
"alipay_root_cert_sn" => $this->_kernel->getAlipayRootCertSN()
];
$bizParams = [
"out_trade_no" => $outTradeNo,
"refund_amount" => $refundAmount
];
$textParams = [];
$_request->protocol = $this->_kernel->getConfig("protocol");
$_request->method = "POST";
$_request->pathname = "/gateway.do";
$_request->headers = [
"host" => $this->_kernel->getConfig("gatewayHost"),
"content-type" => "application/x-www-form-urlencoded;charset=utf-8"
];
$_request->query = $this->_kernel->sortMap(Tea::merge([
"sign" => $this->_kernel->sign($systemParams, $bizParams, $textParams, $this->_kernel->getConfig("merchantPrivateKey"))
], $systemParams, $textParams));
$_request->body = $this->_kernel->toUrlEncodedRequestBody($bizParams);
$_lastRequest = $_request;
$_response= Tea::send($_request, $_runtime);
$respMap = $this->_kernel->readAsJson($_response, "alipay.trade.refund");
if ($this->_kernel->isCertMode()) {
if ($this->_kernel->verify($respMap, $this->_kernel->extractAlipayPublicKey($this->_kernel->getAlipayCertSN($respMap)))) {
return AlipayTradeRefundResponse::fromMap($this->_kernel->toRespModel($respMap));
}
}
else {
if ($this->_kernel->verify($respMap, $this->_kernel->getConfig("alipayPublicKey"))) {
return AlipayTradeRefundResponse::fromMap($this->_kernel->toRespModel($respMap));
}
}
throw new TeaError([
"message" => "验签失败,请检查支付宝公钥设置是否正确。"
]);
}
catch (Exception $e) {
if (!($e instanceof TeaError)) {
$e = new TeaError([], $e->getMessage(), $e->getCode(), $e);
}
if (Tea::isRetryable($e)) {
$_lastException = $e;
continue;
}
throw $e;
}
}
throw new TeaUnableRetryError($_lastRequest, $_lastException);
}
/**
* @param string $outTradeNo
* @return AlipayTradeCloseResponse
* @throws TeaError
* @throws Exception
* @throws TeaUnableRetryError
*/
public function close($outTradeNo){
$_runtime = [
"ignoreSSL" => $this->_kernel->getConfig("ignoreSSL"),
"httpProxy" => $this->_kernel->getConfig("httpProxy"),
"connectTimeout" => 15000,
"readTimeout" => 15000,
"retry" => [
"maxAttempts" => 0
]
];
$_lastRequest = null;
$_lastException = null;
$_now = time();
$_retryTimes = 0;
while (Tea::allowRetry(@$_runtime["retry"], $_retryTimes, $_now)) {
if ($_retryTimes > 0) {
$_backoffTime = Tea::getBackoffTime(@$_runtime["backoff"], $_retryTimes);
if ($_backoffTime > 0) {
Tea::sleep($_backoffTime);
}
}
$_retryTimes = $_retryTimes + 1;
try {
$_request = new Request();
$systemParams = [
"method" => "alipay.trade.close",
"app_id" => $this->_kernel->getConfig("appId"),
"timestamp" => $this->_kernel->getTimestamp(),
"format" => "json",
"version" => "1.0",
"alipay_sdk" => $this->_kernel->getSdkVersion(),
"charset" => "UTF-8",
"sign_type" => $this->_kernel->getConfig("signType"),
"app_cert_sn" => $this->_kernel->getMerchantCertSN(),
"alipay_root_cert_sn" => $this->_kernel->getAlipayRootCertSN()
];
$bizParams = [
"out_trade_no" => $outTradeNo
];
$textParams = [];
$_request->protocol = $this->_kernel->getConfig("protocol");
$_request->method = "POST";
$_request->pathname = "/gateway.do";
$_request->headers = [
"host" => $this->_kernel->getConfig("gatewayHost"),
"content-type" => "application/x-www-form-urlencoded;charset=utf-8"
];
$_request->query = $this->_kernel->sortMap(Tea::merge([
"sign" => $this->_kernel->sign($systemParams, $bizParams, $textParams, $this->_kernel->getConfig("merchantPrivateKey"))
], $systemParams, $textParams));
$_request->body = $this->_kernel->toUrlEncodedRequestBody($bizParams);
$_lastRequest = $_request;
$_response= Tea::send($_request, $_runtime);
$respMap = $this->_kernel->readAsJson($_response, "alipay.trade.close");
if ($this->_kernel->isCertMode()) {
if ($this->_kernel->verify($respMap, $this->_kernel->extractAlipayPublicKey($this->_kernel->getAlipayCertSN($respMap)))) {
return AlipayTradeCloseResponse::fromMap($this->_kernel->toRespModel($respMap));
}
}
else {
if ($this->_kernel->verify($respMap, $this->_kernel->getConfig("alipayPublicKey"))) {
return AlipayTradeCloseResponse::fromMap($this->_kernel->toRespModel($respMap));
}
}
throw new TeaError([
"message" => "验签失败,请检查支付宝公钥设置是否正确。"
]);
}
catch (Exception $e) {
if (!($e instanceof TeaError)) {
$e = new TeaError([], $e->getMessage(), $e->getCode(), $e);
}
if (Tea::isRetryable($e)) {
$_lastException = $e;
continue;
}
throw $e;
}
}
throw new TeaUnableRetryError($_lastRequest, $_lastException);
}
/**
* @param string $outTradeNo
* @return AlipayTradeCancelResponse
* @throws TeaError
* @throws Exception
* @throws TeaUnableRetryError
*/
public function cancel($outTradeNo){
$_runtime = [
"ignoreSSL" => $this->_kernel->getConfig("ignoreSSL"),
"httpProxy" => $this->_kernel->getConfig("httpProxy"),
"connectTimeout" => 15000,
"readTimeout" => 15000,
"retry" => [
"maxAttempts" => 0
]
];
$_lastRequest = null;
$_lastException = null;
$_now = time();
$_retryTimes = 0;
while (Tea::allowRetry(@$_runtime["retry"], $_retryTimes, $_now)) {
if ($_retryTimes > 0) {
$_backoffTime = Tea::getBackoffTime(@$_runtime["backoff"], $_retryTimes);
if ($_backoffTime > 0) {
Tea::sleep($_backoffTime);
}
}
$_retryTimes = $_retryTimes + 1;
try {
$_request = new Request();
$systemParams = [
"method" => "alipay.trade.cancel",
"app_id" => $this->_kernel->getConfig("appId"),
"timestamp" => $this->_kernel->getTimestamp(),
"format" => "json",
"version" => "1.0",
"alipay_sdk" => $this->_kernel->getSdkVersion(),
"charset" => "UTF-8",
"sign_type" => $this->_kernel->getConfig("signType"),
"app_cert_sn" => $this->_kernel->getMerchantCertSN(),
"alipay_root_cert_sn" => $this->_kernel->getAlipayRootCertSN()
];
$bizParams = [
"out_trade_no" => $outTradeNo
];
$textParams = [];
$_request->protocol = $this->_kernel->getConfig("protocol");
$_request->method = "POST";
$_request->pathname = "/gateway.do";
$_request->headers = [
"host" => $this->_kernel->getConfig("gatewayHost"),
"content-type" => "application/x-www-form-urlencoded;charset=utf-8"
];
$_request->query = $this->_kernel->sortMap(Tea::merge([
"sign" => $this->_kernel->sign($systemParams, $bizParams, $textParams, $this->_kernel->getConfig("merchantPrivateKey"))
], $systemParams, $textParams));
$_request->body = $this->_kernel->toUrlEncodedRequestBody($bizParams);
$_lastRequest = $_request;
$_response= Tea::send($_request, $_runtime);
$respMap = $this->_kernel->readAsJson($_response, "alipay.trade.cancel");
if ($this->_kernel->isCertMode()) {
if ($this->_kernel->verify($respMap, $this->_kernel->extractAlipayPublicKey($this->_kernel->getAlipayCertSN($respMap)))) {
return AlipayTradeCancelResponse::fromMap($this->_kernel->toRespModel($respMap));
}
}
else {
if ($this->_kernel->verify($respMap, $this->_kernel->getConfig("alipayPublicKey"))) {
return AlipayTradeCancelResponse::fromMap($this->_kernel->toRespModel($respMap));
}
}
throw new TeaError([
"message" => "验签失败,请检查支付宝公钥设置是否正确。"
]);
}
catch (Exception $e) {
if (!($e instanceof TeaError)) {
$e = new TeaError([], $e->getMessage(), $e->getCode(), $e);
}
if (Tea::isRetryable($e)) {
$_lastException = $e;
continue;
}
throw $e;
}
}
throw new TeaUnableRetryError($_lastRequest, $_lastException);
}
/**
* @param string $outTradeNo
* @param string $outRequestNo
* @return AlipayTradeFastpayRefundQueryResponse
* @throws TeaError
* @throws Exception
* @throws TeaUnableRetryError
*/
public function queryRefund($outTradeNo, $outRequestNo){
$_runtime = [
"ignoreSSL" => $this->_kernel->getConfig("ignoreSSL"),
"httpProxy" => $this->_kernel->getConfig("httpProxy"),
"connectTimeout" => 15000,
"readTimeout" => 15000,
"retry" => [
"maxAttempts" => 0
]
];
$_lastRequest = null;
$_lastException = null;
$_now = time();
$_retryTimes = 0;
while (Tea::allowRetry(@$_runtime["retry"], $_retryTimes, $_now)) {
if ($_retryTimes > 0) {
$_backoffTime = Tea::getBackoffTime(@$_runtime["backoff"], $_retryTimes);
if ($_backoffTime > 0) {
Tea::sleep($_backoffTime);
}
}
$_retryTimes = $_retryTimes + 1;
try {
$_request = new Request();
$systemParams = [
"method" => "alipay.trade.fastpay.refund.query",
"app_id" => $this->_kernel->getConfig("appId"),
"timestamp" => $this->_kernel->getTimestamp(),
"format" => "json",
"version" => "1.0",
"alipay_sdk" => $this->_kernel->getSdkVersion(),
"charset" => "UTF-8",
"sign_type" => $this->_kernel->getConfig("signType"),
"app_cert_sn" => $this->_kernel->getMerchantCertSN(),
"alipay_root_cert_sn" => $this->_kernel->getAlipayRootCertSN()
];
$bizParams = [
"out_trade_no" => $outTradeNo,
"out_request_no" => $outRequestNo
];
$textParams = [];
$_request->protocol = $this->_kernel->getConfig("protocol");
$_request->method = "POST";
$_request->pathname = "/gateway.do";
$_request->headers = [
"host" => $this->_kernel->getConfig("gatewayHost"),
"content-type" => "application/x-www-form-urlencoded;charset=utf-8"
];
$_request->query = $this->_kernel->sortMap(Tea::merge([
"sign" => $this->_kernel->sign($systemParams, $bizParams, $textParams, $this->_kernel->getConfig("merchantPrivateKey"))
], $systemParams, $textParams));
$_request->body = $this->_kernel->toUrlEncodedRequestBody($bizParams);
$_lastRequest = $_request;
$_response= Tea::send($_request, $_runtime);
$respMap = $this->_kernel->readAsJson($_response, "alipay.trade.fastpay.refund.query");
if ($this->_kernel->isCertMode()) {
if ($this->_kernel->verify($respMap, $this->_kernel->extractAlipayPublicKey($this->_kernel->getAlipayCertSN($respMap)))) {
return AlipayTradeFastpayRefundQueryResponse::fromMap($this->_kernel->toRespModel($respMap));
}
}
else {
if ($this->_kernel->verify($respMap, $this->_kernel->getConfig("alipayPublicKey"))) {
return AlipayTradeFastpayRefundQueryResponse::fromMap($this->_kernel->toRespModel($respMap));
}
}
throw new TeaError([
"message" => "验签失败,请检查支付宝公钥设置是否正确。"
]);
}
catch (Exception $e) {
if (!($e instanceof TeaError)) {
$e = new TeaError([], $e->getMessage(), $e->getCode(), $e);
}
if (Tea::isRetryable($e)) {
$_lastException = $e;
continue;
}
throw $e;
}
}
throw new TeaUnableRetryError($_lastRequest, $_lastException);
}
/**
* @param string $billType
* @param string $billDate
* @return AlipayDataDataserviceBillDownloadurlQueryResponse
* @throws TeaError
* @throws Exception
* @throws TeaUnableRetryError
*/
public function downloadBill($billType, $billDate){
$_runtime = [
"ignoreSSL" => $this->_kernel->getConfig("ignoreSSL"),
"httpProxy" => $this->_kernel->getConfig("httpProxy"),
"connectTimeout" => 15000,
"readTimeout" => 15000,
"retry" => [
"maxAttempts" => 0
]
];
$_lastRequest = null;
$_lastException = null;
$_now = time();
$_retryTimes = 0;
while (Tea::allowRetry(@$_runtime["retry"], $_retryTimes, $_now)) {
if ($_retryTimes > 0) {
$_backoffTime = Tea::getBackoffTime(@$_runtime["backoff"], $_retryTimes);
if ($_backoffTime > 0) {
Tea::sleep($_backoffTime);
}
}
$_retryTimes = $_retryTimes + 1;
try {
$_request = new Request();
$systemParams = [
"method" => "alipay.data.dataservice.bill.downloadurl.query",
"app_id" => $this->_kernel->getConfig("appId"),
"timestamp" => $this->_kernel->getTimestamp(),
"format" => "json",
"version" => "1.0",
"alipay_sdk" => $this->_kernel->getSdkVersion(),
"charset" => "UTF-8",
"sign_type" => $this->_kernel->getConfig("signType"),
"app_cert_sn" => $this->_kernel->getMerchantCertSN(),
"alipay_root_cert_sn" => $this->_kernel->getAlipayRootCertSN()
];
$bizParams = [
"bill_type" => $billType,
"bill_date" => $billDate
];
$textParams = [];
$_request->protocol = $this->_kernel->getConfig("protocol");
$_request->method = "POST";
$_request->pathname = "/gateway.do";
$_request->headers = [
"host" => $this->_kernel->getConfig("gatewayHost"),
"content-type" => "application/x-www-form-urlencoded;charset=utf-8"
];
$_request->query = $this->_kernel->sortMap(Tea::merge([
"sign" => $this->_kernel->sign($systemParams, $bizParams, $textParams, $this->_kernel->getConfig("merchantPrivateKey"))
], $systemParams, $textParams));
$_request->body = $this->_kernel->toUrlEncodedRequestBody($bizParams);
$_lastRequest = $_request;
$_response= Tea::send($_request, $_runtime);
$respMap = $this->_kernel->readAsJson($_response, "alipay.data.dataservice.bill.downloadurl.query");
if ($this->_kernel->isCertMode()) {
if ($this->_kernel->verify($respMap, $this->_kernel->extractAlipayPublicKey($this->_kernel->getAlipayCertSN($respMap)))) {
return AlipayDataDataserviceBillDownloadurlQueryResponse::fromMap($this->_kernel->toRespModel($respMap));
}
}
else {
if ($this->_kernel->verify($respMap, $this->_kernel->getConfig("alipayPublicKey"))) {
return AlipayDataDataserviceBillDownloadurlQueryResponse::fromMap($this->_kernel->toRespModel($respMap));
}
}
throw new TeaError([
"message" => "验签失败,请检查支付宝公钥设置是否正确。"
]);
}
catch (Exception $e) {
if (!($e instanceof TeaError)) {
$e = new TeaError([], $e->getMessage(), $e->getCode(), $e);
}
if (Tea::isRetryable($e)) {
$_lastException = $e;
continue;
}
throw $e;
}
}
throw new TeaUnableRetryError($_lastRequest, $_lastException);
}
/**
* @param string[] $parameters
* @return bool
*/
public function verifyNotify($parameters){
if ($this->_kernel->isCertMode()) {
return $this->_kernel->verifyParams($parameters, $this->_kernel->extractAlipayPublicKey(""));
}
else {
return $this->_kernel->verifyParams($parameters, $this->_kernel->getConfig("alipayPublicKey"));
}
}
/**
* ISV代商户代用,指定appAuthToken
*
* @param $appAuthToken String 代调用token
* @return $this 本客户端,便于链式调用
*/
public function agent($appAuthToken)
{
$this->_kernel->injectTextParam("app_auth_token", $appAuthToken);
return $this;
}
/**
* 用户授权调用,指定authToken
*
* @param $authToken String 用户授权token
* @return $this
*/
public function auth($authToken)
{
$this->_kernel->injectTextParam("auth_token", $authToken);
return $this;
}
/**
* 设置异步通知回调地址,此处设置将在本调用中覆盖Config中的全局配置
*
* @param $url String 异步通知回调地址,例如:https://www.test.com/callback
* @return $this
*/
public function asyncNotify($url)
{
$this->_kernel->injectTextParam("notify_url", $url);
return $this;
}
/**
* 将本次调用强制路由到后端系统的测试地址上,常用于线下环境内外联调,沙箱与线上环境设置无效
*
* @param $testUrl String 后端系统测试地址
* @return $this
*/
public function route($testUrl)
{
$this->_kernel->injectTextParam("ws_service_url", $testUrl);
return $this;
}
/**
* 设置API入参中没有的其他可选业务请求参数(biz_content下的字段)
*
* @param $key String 业务请求参数名称(biz_content下的字段名,比如timeout_express)
* @param $value object 业务请求参数的值,一个可以序列化成JSON的对象
* 如果该字段是一个字符串类型(String、Price、Date在SDK中都是字符串),请使用String储存
* 如果该字段是一个数值型类型(比如:Number),请使用Long储存
* 如果该字段是一个复杂类型,请使用嵌套的array指定各下级字段的值
* 如果该字段是一个数组,请使用array储存各个值
* @return $this
*/
public function optional($key, $value)
{
$this->_kernel->injectBizParam($key, $value);
return $this;
}
/**
* 批量设置API入参中没有的其他可选业务请求参数(biz_content下的字段)
* optional方法的批量版本
*
* @param $optionalArgs array 可选参数集合,每个参数由key和value组成,key和value的格式请参见optional方法的注释
* @return $this
*/
public function batchOptional($optionalArgs)
{
foreach ($optionalArgs as $key => $value) {
$this->_kernel->injectBizParam($key, $value);
}
return $this;
}
}
@@ -0,0 +1,104 @@
<?php
// This file is auto-generated, don't edit it. Thanks.
namespace Alipay\EasySDK\Payment\Common\Models;
use AlibabaCloud\Tea\Model;
class AlipayDataDataserviceBillDownloadurlQueryResponse extends Model {
protected $_name = [
'httpBody' => 'http_body',
'code' => 'code',
'msg' => 'msg',
'subCode' => 'sub_code',
'subMsg' => 'sub_msg',
'billDownloadUrl' => 'bill_download_url',
];
public function validate() {
Model::validateRequired('httpBody', $this->httpBody, true);
Model::validateRequired('code', $this->code, true);
Model::validateRequired('msg', $this->msg, true);
Model::validateRequired('subCode', $this->subCode, true);
Model::validateRequired('subMsg', $this->subMsg, true);
Model::validateRequired('billDownloadUrl', $this->billDownloadUrl, true);
}
public function toMap() {
$res = [];
if (null !== $this->httpBody) {
$res['http_body'] = $this->httpBody;
}
if (null !== $this->code) {
$res['code'] = $this->code;
}
if (null !== $this->msg) {
$res['msg'] = $this->msg;
}
if (null !== $this->subCode) {
$res['sub_code'] = $this->subCode;
}
if (null !== $this->subMsg) {
$res['sub_msg'] = $this->subMsg;
}
if (null !== $this->billDownloadUrl) {
$res['bill_download_url'] = $this->billDownloadUrl;
}
return $res;
}
/**
* @param array $map
* @return AlipayDataDataserviceBillDownloadurlQueryResponse
*/
public static function fromMap($map = []) {
$model = new self();
if(isset($map['http_body'])){
$model->httpBody = $map['http_body'];
}
if(isset($map['code'])){
$model->code = $map['code'];
}
if(isset($map['msg'])){
$model->msg = $map['msg'];
}
if(isset($map['sub_code'])){
$model->subCode = $map['sub_code'];
}
if(isset($map['sub_msg'])){
$model->subMsg = $map['sub_msg'];
}
if(isset($map['bill_download_url'])){
$model->billDownloadUrl = $map['bill_download_url'];
}
return $model;
}
/**
* @description 响应原始字符串
* @var string
*/
public $httpBody;
/**
* @var string
*/
public $code;
/**
* @var string
*/
public $msg;
/**
* @var string
*/
public $subCode;
/**
* @var string
*/
public $subMsg;
/**
* @var string
*/
public $billDownloadUrl;
}
@@ -0,0 +1,169 @@
<?php
// This file is auto-generated, don't edit it. Thanks.
namespace Alipay\EasySDK\Payment\Common\Models;
use AlibabaCloud\Tea\Model;
class AlipayTradeCancelResponse extends Model {
protected $_name = [
'httpBody' => 'http_body',
'code' => 'code',
'msg' => 'msg',
'subCode' => 'sub_code',
'subMsg' => 'sub_msg',
'tradeNo' => 'trade_no',
'outTradeNo' => 'out_trade_no',
'retryFlag' => 'retry_flag',
'action' => 'action',
'gmtRefundPay' => 'gmt_refund_pay',
'refundSettlementId' => 'refund_settlement_id',
];
public function validate() {
Model::validateRequired('httpBody', $this->httpBody, true);
Model::validateRequired('code', $this->code, true);
Model::validateRequired('msg', $this->msg, true);
Model::validateRequired('subCode', $this->subCode, true);
Model::validateRequired('subMsg', $this->subMsg, true);
Model::validateRequired('tradeNo', $this->tradeNo, true);
Model::validateRequired('outTradeNo', $this->outTradeNo, true);
Model::validateRequired('retryFlag', $this->retryFlag, true);
Model::validateRequired('action', $this->action, true);
Model::validateRequired('gmtRefundPay', $this->gmtRefundPay, true);
Model::validateRequired('refundSettlementId', $this->refundSettlementId, true);
}
public function toMap() {
$res = [];
if (null !== $this->httpBody) {
$res['http_body'] = $this->httpBody;
}
if (null !== $this->code) {
$res['code'] = $this->code;
}
if (null !== $this->msg) {
$res['msg'] = $this->msg;
}
if (null !== $this->subCode) {
$res['sub_code'] = $this->subCode;
}
if (null !== $this->subMsg) {
$res['sub_msg'] = $this->subMsg;
}
if (null !== $this->tradeNo) {
$res['trade_no'] = $this->tradeNo;
}
if (null !== $this->outTradeNo) {
$res['out_trade_no'] = $this->outTradeNo;
}
if (null !== $this->retryFlag) {
$res['retry_flag'] = $this->retryFlag;
}
if (null !== $this->action) {
$res['action'] = $this->action;
}
if (null !== $this->gmtRefundPay) {
$res['gmt_refund_pay'] = $this->gmtRefundPay;
}
if (null !== $this->refundSettlementId) {
$res['refund_settlement_id'] = $this->refundSettlementId;
}
return $res;
}
/**
* @param array $map
* @return AlipayTradeCancelResponse
*/
public static function fromMap($map = []) {
$model = new self();
if(isset($map['http_body'])){
$model->httpBody = $map['http_body'];
}
if(isset($map['code'])){
$model->code = $map['code'];
}
if(isset($map['msg'])){
$model->msg = $map['msg'];
}
if(isset($map['sub_code'])){
$model->subCode = $map['sub_code'];
}
if(isset($map['sub_msg'])){
$model->subMsg = $map['sub_msg'];
}
if(isset($map['trade_no'])){
$model->tradeNo = $map['trade_no'];
}
if(isset($map['out_trade_no'])){
$model->outTradeNo = $map['out_trade_no'];
}
if(isset($map['retry_flag'])){
$model->retryFlag = $map['retry_flag'];
}
if(isset($map['action'])){
$model->action = $map['action'];
}
if(isset($map['gmt_refund_pay'])){
$model->gmtRefundPay = $map['gmt_refund_pay'];
}
if(isset($map['refund_settlement_id'])){
$model->refundSettlementId = $map['refund_settlement_id'];
}
return $model;
}
/**
* @description 响应原始字符串
* @var string
*/
public $httpBody;
/**
* @var string
*/
public $code;
/**
* @var string
*/
public $msg;
/**
* @var string
*/
public $subCode;
/**
* @var string
*/
public $subMsg;
/**
* @var string
*/
public $tradeNo;
/**
* @var string
*/
public $outTradeNo;
/**
* @var string
*/
public $retryFlag;
/**
* @var string
*/
public $action;
/**
* @var string
*/
public $gmtRefundPay;
/**
* @var string
*/
public $refundSettlementId;
}
@@ -0,0 +1,117 @@
<?php
// This file is auto-generated, don't edit it. Thanks.
namespace Alipay\EasySDK\Payment\Common\Models;
use AlibabaCloud\Tea\Model;
class AlipayTradeCloseResponse extends Model {
protected $_name = [
'httpBody' => 'http_body',
'code' => 'code',
'msg' => 'msg',
'subCode' => 'sub_code',
'subMsg' => 'sub_msg',
'tradeNo' => 'trade_no',
'outTradeNo' => 'out_trade_no',
];
public function validate() {
Model::validateRequired('httpBody', $this->httpBody, true);
Model::validateRequired('code', $this->code, true);
Model::validateRequired('msg', $this->msg, true);
Model::validateRequired('subCode', $this->subCode, true);
Model::validateRequired('subMsg', $this->subMsg, true);
Model::validateRequired('tradeNo', $this->tradeNo, true);
Model::validateRequired('outTradeNo', $this->outTradeNo, true);
}
public function toMap() {
$res = [];
if (null !== $this->httpBody) {
$res['http_body'] = $this->httpBody;
}
if (null !== $this->code) {
$res['code'] = $this->code;
}
if (null !== $this->msg) {
$res['msg'] = $this->msg;
}
if (null !== $this->subCode) {
$res['sub_code'] = $this->subCode;
}
if (null !== $this->subMsg) {
$res['sub_msg'] = $this->subMsg;
}
if (null !== $this->tradeNo) {
$res['trade_no'] = $this->tradeNo;
}
if (null !== $this->outTradeNo) {
$res['out_trade_no'] = $this->outTradeNo;
}
return $res;
}
/**
* @param array $map
* @return AlipayTradeCloseResponse
*/
public static function fromMap($map = []) {
$model = new self();
if(isset($map['http_body'])){
$model->httpBody = $map['http_body'];
}
if(isset($map['code'])){
$model->code = $map['code'];
}
if(isset($map['msg'])){
$model->msg = $map['msg'];
}
if(isset($map['sub_code'])){
$model->subCode = $map['sub_code'];
}
if(isset($map['sub_msg'])){
$model->subMsg = $map['sub_msg'];
}
if(isset($map['trade_no'])){
$model->tradeNo = $map['trade_no'];
}
if(isset($map['out_trade_no'])){
$model->outTradeNo = $map['out_trade_no'];
}
return $model;
}
/**
* @description 响应原始字符串
* @var string
*/
public $httpBody;
/**
* @var string
*/
public $code;
/**
* @var string
*/
public $msg;
/**
* @var string
*/
public $subCode;
/**
* @var string
*/
public $subMsg;
/**
* @var string
*/
public $tradeNo;
/**
* @var string
*/
public $outTradeNo;
}
@@ -0,0 +1,117 @@
<?php
// This file is auto-generated, don't edit it. Thanks.
namespace Alipay\EasySDK\Payment\Common\Models;
use AlibabaCloud\Tea\Model;
class AlipayTradeCreateResponse extends Model {
protected $_name = [
'httpBody' => 'http_body',
'code' => 'code',
'msg' => 'msg',
'subCode' => 'sub_code',
'subMsg' => 'sub_msg',
'outTradeNo' => 'out_trade_no',
'tradeNo' => 'trade_no',
];
public function validate() {
Model::validateRequired('httpBody', $this->httpBody, true);
Model::validateRequired('code', $this->code, true);
Model::validateRequired('msg', $this->msg, true);
Model::validateRequired('subCode', $this->subCode, true);
Model::validateRequired('subMsg', $this->subMsg, true);
Model::validateRequired('outTradeNo', $this->outTradeNo, true);
Model::validateRequired('tradeNo', $this->tradeNo, true);
}
public function toMap() {
$res = [];
if (null !== $this->httpBody) {
$res['http_body'] = $this->httpBody;
}
if (null !== $this->code) {
$res['code'] = $this->code;
}
if (null !== $this->msg) {
$res['msg'] = $this->msg;
}
if (null !== $this->subCode) {
$res['sub_code'] = $this->subCode;
}
if (null !== $this->subMsg) {
$res['sub_msg'] = $this->subMsg;
}
if (null !== $this->outTradeNo) {
$res['out_trade_no'] = $this->outTradeNo;
}
if (null !== $this->tradeNo) {
$res['trade_no'] = $this->tradeNo;
}
return $res;
}
/**
* @param array $map
* @return AlipayTradeCreateResponse
*/
public static function fromMap($map = []) {
$model = new self();
if(isset($map['http_body'])){
$model->httpBody = $map['http_body'];
}
if(isset($map['code'])){
$model->code = $map['code'];
}
if(isset($map['msg'])){
$model->msg = $map['msg'];
}
if(isset($map['sub_code'])){
$model->subCode = $map['sub_code'];
}
if(isset($map['sub_msg'])){
$model->subMsg = $map['sub_msg'];
}
if(isset($map['out_trade_no'])){
$model->outTradeNo = $map['out_trade_no'];
}
if(isset($map['trade_no'])){
$model->tradeNo = $map['trade_no'];
}
return $model;
}
/**
* @description 响应原始字符串
* @var string
*/
public $httpBody;
/**
* @var string
*/
public $code;
/**
* @var string
*/
public $msg;
/**
* @var string
*/
public $subCode;
/**
* @var string
*/
public $subMsg;
/**
* @var string
*/
public $outTradeNo;
/**
* @var string
*/
public $tradeNo;
}
@@ -0,0 +1,352 @@
<?php
// This file is auto-generated, don't edit it. Thanks.
namespace Alipay\EasySDK\Payment\Common\Models;
use AlibabaCloud\Tea\Model;
use Alipay\EasySDK\Payment\Common\Models\TradeFundBill;
use Alipay\EasySDK\Payment\Common\Models\RefundRoyaltyResult;
class AlipayTradeFastpayRefundQueryResponse extends Model {
protected $_name = [
'httpBody' => 'http_body',
'code' => 'code',
'msg' => 'msg',
'subCode' => 'sub_code',
'subMsg' => 'sub_msg',
'errorCode' => 'error_code',
'gmtRefundPay' => 'gmt_refund_pay',
'industrySepcDetail' => 'industry_sepc_detail',
'outRequestNo' => 'out_request_no',
'outTradeNo' => 'out_trade_no',
'presentRefundBuyerAmount' => 'present_refund_buyer_amount',
'presentRefundDiscountAmount' => 'present_refund_discount_amount',
'presentRefundMdiscountAmount' => 'present_refund_mdiscount_amount',
'refundAmount' => 'refund_amount',
'refundChargeAmount' => 'refund_charge_amount',
'refundDetailItemList' => 'refund_detail_item_list',
'refundReason' => 'refund_reason',
'refundRoyaltys' => 'refund_royaltys',
'refundSettlementId' => 'refund_settlement_id',
'refundStatus' => 'refund_status',
'sendBackFee' => 'send_back_fee',
'totalAmount' => 'total_amount',
'tradeNo' => 'trade_no',
];
public function validate() {
Model::validateRequired('httpBody', $this->httpBody, true);
Model::validateRequired('code', $this->code, true);
Model::validateRequired('msg', $this->msg, true);
Model::validateRequired('subCode', $this->subCode, true);
Model::validateRequired('subMsg', $this->subMsg, true);
Model::validateRequired('errorCode', $this->errorCode, true);
Model::validateRequired('gmtRefundPay', $this->gmtRefundPay, true);
Model::validateRequired('industrySepcDetail', $this->industrySepcDetail, true);
Model::validateRequired('outRequestNo', $this->outRequestNo, true);
Model::validateRequired('outTradeNo', $this->outTradeNo, true);
Model::validateRequired('presentRefundBuyerAmount', $this->presentRefundBuyerAmount, true);
Model::validateRequired('presentRefundDiscountAmount', $this->presentRefundDiscountAmount, true);
Model::validateRequired('presentRefundMdiscountAmount', $this->presentRefundMdiscountAmount, true);
Model::validateRequired('refundAmount', $this->refundAmount, true);
Model::validateRequired('refundChargeAmount', $this->refundChargeAmount, true);
Model::validateRequired('refundDetailItemList', $this->refundDetailItemList, true);
Model::validateRequired('refundReason', $this->refundReason, true);
Model::validateRequired('refundRoyaltys', $this->refundRoyaltys, true);
Model::validateRequired('refundSettlementId', $this->refundSettlementId, true);
Model::validateRequired('refundStatus', $this->refundStatus, true);
Model::validateRequired('sendBackFee', $this->sendBackFee, true);
Model::validateRequired('totalAmount', $this->totalAmount, true);
Model::validateRequired('tradeNo', $this->tradeNo, true);
}
public function toMap() {
$res = [];
if (null !== $this->httpBody) {
$res['http_body'] = $this->httpBody;
}
if (null !== $this->code) {
$res['code'] = $this->code;
}
if (null !== $this->msg) {
$res['msg'] = $this->msg;
}
if (null !== $this->subCode) {
$res['sub_code'] = $this->subCode;
}
if (null !== $this->subMsg) {
$res['sub_msg'] = $this->subMsg;
}
if (null !== $this->errorCode) {
$res['error_code'] = $this->errorCode;
}
if (null !== $this->gmtRefundPay) {
$res['gmt_refund_pay'] = $this->gmtRefundPay;
}
if (null !== $this->industrySepcDetail) {
$res['industry_sepc_detail'] = $this->industrySepcDetail;
}
if (null !== $this->outRequestNo) {
$res['out_request_no'] = $this->outRequestNo;
}
if (null !== $this->outTradeNo) {
$res['out_trade_no'] = $this->outTradeNo;
}
if (null !== $this->presentRefundBuyerAmount) {
$res['present_refund_buyer_amount'] = $this->presentRefundBuyerAmount;
}
if (null !== $this->presentRefundDiscountAmount) {
$res['present_refund_discount_amount'] = $this->presentRefundDiscountAmount;
}
if (null !== $this->presentRefundMdiscountAmount) {
$res['present_refund_mdiscount_amount'] = $this->presentRefundMdiscountAmount;
}
if (null !== $this->refundAmount) {
$res['refund_amount'] = $this->refundAmount;
}
if (null !== $this->refundChargeAmount) {
$res['refund_charge_amount'] = $this->refundChargeAmount;
}
if (null !== $this->refundDetailItemList) {
$res['refund_detail_item_list'] = [];
if(null !== $this->refundDetailItemList && is_array($this->refundDetailItemList)){
$n = 0;
foreach($this->refundDetailItemList as $item){
$res['refund_detail_item_list'][$n++] = null !== $item ? $item->toMap() : $item;
}
}
}
if (null !== $this->refundReason) {
$res['refund_reason'] = $this->refundReason;
}
if (null !== $this->refundRoyaltys) {
$res['refund_royaltys'] = [];
if(null !== $this->refundRoyaltys && is_array($this->refundRoyaltys)){
$n = 0;
foreach($this->refundRoyaltys as $item){
$res['refund_royaltys'][$n++] = null !== $item ? $item->toMap() : $item;
}
}
}
if (null !== $this->refundSettlementId) {
$res['refund_settlement_id'] = $this->refundSettlementId;
}
if (null !== $this->refundStatus) {
$res['refund_status'] = $this->refundStatus;
}
if (null !== $this->sendBackFee) {
$res['send_back_fee'] = $this->sendBackFee;
}
if (null !== $this->totalAmount) {
$res['total_amount'] = $this->totalAmount;
}
if (null !== $this->tradeNo) {
$res['trade_no'] = $this->tradeNo;
}
return $res;
}
/**
* @param array $map
* @return AlipayTradeFastpayRefundQueryResponse
*/
public static function fromMap($map = []) {
$model = new self();
if(isset($map['http_body'])){
$model->httpBody = $map['http_body'];
}
if(isset($map['code'])){
$model->code = $map['code'];
}
if(isset($map['msg'])){
$model->msg = $map['msg'];
}
if(isset($map['sub_code'])){
$model->subCode = $map['sub_code'];
}
if(isset($map['sub_msg'])){
$model->subMsg = $map['sub_msg'];
}
if(isset($map['error_code'])){
$model->errorCode = $map['error_code'];
}
if(isset($map['gmt_refund_pay'])){
$model->gmtRefundPay = $map['gmt_refund_pay'];
}
if(isset($map['industry_sepc_detail'])){
$model->industrySepcDetail = $map['industry_sepc_detail'];
}
if(isset($map['out_request_no'])){
$model->outRequestNo = $map['out_request_no'];
}
if(isset($map['out_trade_no'])){
$model->outTradeNo = $map['out_trade_no'];
}
if(isset($map['present_refund_buyer_amount'])){
$model->presentRefundBuyerAmount = $map['present_refund_buyer_amount'];
}
if(isset($map['present_refund_discount_amount'])){
$model->presentRefundDiscountAmount = $map['present_refund_discount_amount'];
}
if(isset($map['present_refund_mdiscount_amount'])){
$model->presentRefundMdiscountAmount = $map['present_refund_mdiscount_amount'];
}
if(isset($map['refund_amount'])){
$model->refundAmount = $map['refund_amount'];
}
if(isset($map['refund_charge_amount'])){
$model->refundChargeAmount = $map['refund_charge_amount'];
}
if(isset($map['refund_detail_item_list'])){
if(!empty($map['refund_detail_item_list'])){
$model->refundDetailItemList = [];
$n = 0;
foreach($map['refund_detail_item_list'] as $item) {
$model->refundDetailItemList[$n++] = null !== $item ? TradeFundBill::fromMap($item) : $item;
}
}
}
if(isset($map['refund_reason'])){
$model->refundReason = $map['refund_reason'];
}
if(isset($map['refund_royaltys'])){
if(!empty($map['refund_royaltys'])){
$model->refundRoyaltys = [];
$n = 0;
foreach($map['refund_royaltys'] as $item) {
$model->refundRoyaltys[$n++] = null !== $item ? RefundRoyaltyResult::fromMap($item) : $item;
}
}
}
if(isset($map['refund_settlement_id'])){
$model->refundSettlementId = $map['refund_settlement_id'];
}
if(isset($map['refund_status'])){
$model->refundStatus = $map['refund_status'];
}
if(isset($map['send_back_fee'])){
$model->sendBackFee = $map['send_back_fee'];
}
if(isset($map['total_amount'])){
$model->totalAmount = $map['total_amount'];
}
if(isset($map['trade_no'])){
$model->tradeNo = $map['trade_no'];
}
return $model;
}
/**
* @description 响应原始字符串
* @var string
*/
public $httpBody;
/**
* @var string
*/
public $code;
/**
* @var string
*/
public $msg;
/**
* @var string
*/
public $subCode;
/**
* @var string
*/
public $subMsg;
/**
* @var string
*/
public $errorCode;
/**
* @var string
*/
public $gmtRefundPay;
/**
* @var string
*/
public $industrySepcDetail;
/**
* @var string
*/
public $outRequestNo;
/**
* @var string
*/
public $outTradeNo;
/**
* @var string
*/
public $presentRefundBuyerAmount;
/**
* @var string
*/
public $presentRefundDiscountAmount;
/**
* @var string
*/
public $presentRefundMdiscountAmount;
/**
* @var string
*/
public $refundAmount;
/**
* @var string
*/
public $refundChargeAmount;
/**
* @var TradeFundBill[]
*/
public $refundDetailItemList;
/**
* @var string
*/
public $refundReason;
/**
* @var RefundRoyaltyResult[]
*/
public $refundRoyaltys;
/**
* @var string
*/
public $refundSettlementId;
/**
* @var string
*/
public $refundStatus;
/**
* @var string
*/
public $sendBackFee;
/**
* @var string
*/
public $totalAmount;
/**
* @var string
*/
public $tradeNo;
}
@@ -0,0 +1,573 @@
<?php
// This file is auto-generated, don't edit it. Thanks.
namespace Alipay\EasySDK\Payment\Common\Models;
use AlibabaCloud\Tea\Model;
use Alipay\EasySDK\Payment\Common\Models\TradeFundBill;
use Alipay\EasySDK\Payment\Common\Models\TradeSettleInfo;
class AlipayTradeQueryResponse extends Model {
protected $_name = [
'httpBody' => 'http_body',
'code' => 'code',
'msg' => 'msg',
'subCode' => 'sub_code',
'subMsg' => 'sub_msg',
'tradeNo' => 'trade_no',
'outTradeNo' => 'out_trade_no',
'buyerLogonId' => 'buyer_logon_id',
'tradeStatus' => 'trade_status',
'totalAmount' => 'total_amount',
'transCurrency' => 'trans_currency',
'settleCurrency' => 'settle_currency',
'settleAmount' => 'settle_amount',
'payCurrency' => 'pay_currency',
'payAmount' => 'pay_amount',
'settleTransRate' => 'settle_trans_rate',
'transPayRate' => 'trans_pay_rate',
'buyerPayAmount' => 'buyer_pay_amount',
'pointAmount' => 'point_amount',
'invoiceAmount' => 'invoice_amount',
'sendPayDate' => 'send_pay_date',
'receiptAmount' => 'receipt_amount',
'storeId' => 'store_id',
'terminalId' => 'terminal_id',
'fundBillList' => 'fund_bill_list',
'storeName' => 'store_name',
'buyerUserId' => 'buyer_user_id',
'chargeAmount' => 'charge_amount',
'chargeFlags' => 'charge_flags',
'settlementId' => 'settlement_id',
'tradeSettleInfo' => 'trade_settle_info',
'authTradePayMode' => 'auth_trade_pay_mode',
'buyerUserType' => 'buyer_user_type',
'mdiscountAmount' => 'mdiscount_amount',
'discountAmount' => 'discount_amount',
'buyerUserName' => 'buyer_user_name',
'subject' => 'subject',
'body' => 'body',
'alipaySubMerchantId' => 'alipay_sub_merchant_id',
'extInfos' => 'ext_infos',
];
public function validate() {
Model::validateRequired('httpBody', $this->httpBody, true);
Model::validateRequired('code', $this->code, true);
Model::validateRequired('msg', $this->msg, true);
Model::validateRequired('subCode', $this->subCode, true);
Model::validateRequired('subMsg', $this->subMsg, true);
Model::validateRequired('tradeNo', $this->tradeNo, true);
Model::validateRequired('outTradeNo', $this->outTradeNo, true);
Model::validateRequired('buyerLogonId', $this->buyerLogonId, true);
Model::validateRequired('tradeStatus', $this->tradeStatus, true);
Model::validateRequired('totalAmount', $this->totalAmount, true);
Model::validateRequired('transCurrency', $this->transCurrency, true);
Model::validateRequired('settleCurrency', $this->settleCurrency, true);
Model::validateRequired('settleAmount', $this->settleAmount, true);
Model::validateRequired('payCurrency', $this->payCurrency, true);
Model::validateRequired('payAmount', $this->payAmount, true);
Model::validateRequired('settleTransRate', $this->settleTransRate, true);
Model::validateRequired('transPayRate', $this->transPayRate, true);
Model::validateRequired('buyerPayAmount', $this->buyerPayAmount, true);
Model::validateRequired('pointAmount', $this->pointAmount, true);
Model::validateRequired('invoiceAmount', $this->invoiceAmount, true);
Model::validateRequired('sendPayDate', $this->sendPayDate, true);
Model::validateRequired('receiptAmount', $this->receiptAmount, true);
Model::validateRequired('storeId', $this->storeId, true);
Model::validateRequired('terminalId', $this->terminalId, true);
Model::validateRequired('fundBillList', $this->fundBillList, true);
Model::validateRequired('storeName', $this->storeName, true);
Model::validateRequired('buyerUserId', $this->buyerUserId, true);
Model::validateRequired('chargeAmount', $this->chargeAmount, true);
Model::validateRequired('chargeFlags', $this->chargeFlags, true);
Model::validateRequired('settlementId', $this->settlementId, true);
Model::validateRequired('tradeSettleInfo', $this->tradeSettleInfo, true);
Model::validateRequired('authTradePayMode', $this->authTradePayMode, true);
Model::validateRequired('buyerUserType', $this->buyerUserType, true);
Model::validateRequired('mdiscountAmount', $this->mdiscountAmount, true);
Model::validateRequired('discountAmount', $this->discountAmount, true);
Model::validateRequired('buyerUserName', $this->buyerUserName, true);
Model::validateRequired('subject', $this->subject, true);
Model::validateRequired('body', $this->body, true);
Model::validateRequired('alipaySubMerchantId', $this->alipaySubMerchantId, true);
Model::validateRequired('extInfos', $this->extInfos, true);
}
public function toMap() {
$res = [];
if (null !== $this->httpBody) {
$res['http_body'] = $this->httpBody;
}
if (null !== $this->code) {
$res['code'] = $this->code;
}
if (null !== $this->msg) {
$res['msg'] = $this->msg;
}
if (null !== $this->subCode) {
$res['sub_code'] = $this->subCode;
}
if (null !== $this->subMsg) {
$res['sub_msg'] = $this->subMsg;
}
if (null !== $this->tradeNo) {
$res['trade_no'] = $this->tradeNo;
}
if (null !== $this->outTradeNo) {
$res['out_trade_no'] = $this->outTradeNo;
}
if (null !== $this->buyerLogonId) {
$res['buyer_logon_id'] = $this->buyerLogonId;
}
if (null !== $this->tradeStatus) {
$res['trade_status'] = $this->tradeStatus;
}
if (null !== $this->totalAmount) {
$res['total_amount'] = $this->totalAmount;
}
if (null !== $this->transCurrency) {
$res['trans_currency'] = $this->transCurrency;
}
if (null !== $this->settleCurrency) {
$res['settle_currency'] = $this->settleCurrency;
}
if (null !== $this->settleAmount) {
$res['settle_amount'] = $this->settleAmount;
}
if (null !== $this->payCurrency) {
$res['pay_currency'] = $this->payCurrency;
}
if (null !== $this->payAmount) {
$res['pay_amount'] = $this->payAmount;
}
if (null !== $this->settleTransRate) {
$res['settle_trans_rate'] = $this->settleTransRate;
}
if (null !== $this->transPayRate) {
$res['trans_pay_rate'] = $this->transPayRate;
}
if (null !== $this->buyerPayAmount) {
$res['buyer_pay_amount'] = $this->buyerPayAmount;
}
if (null !== $this->pointAmount) {
$res['point_amount'] = $this->pointAmount;
}
if (null !== $this->invoiceAmount) {
$res['invoice_amount'] = $this->invoiceAmount;
}
if (null !== $this->sendPayDate) {
$res['send_pay_date'] = $this->sendPayDate;
}
if (null !== $this->receiptAmount) {
$res['receipt_amount'] = $this->receiptAmount;
}
if (null !== $this->storeId) {
$res['store_id'] = $this->storeId;
}
if (null !== $this->terminalId) {
$res['terminal_id'] = $this->terminalId;
}
if (null !== $this->fundBillList) {
$res['fund_bill_list'] = [];
if(null !== $this->fundBillList && is_array($this->fundBillList)){
$n = 0;
foreach($this->fundBillList as $item){
$res['fund_bill_list'][$n++] = null !== $item ? $item->toMap() : $item;
}
}
}
if (null !== $this->storeName) {
$res['store_name'] = $this->storeName;
}
if (null !== $this->buyerUserId) {
$res['buyer_user_id'] = $this->buyerUserId;
}
if (null !== $this->chargeAmount) {
$res['charge_amount'] = $this->chargeAmount;
}
if (null !== $this->chargeFlags) {
$res['charge_flags'] = $this->chargeFlags;
}
if (null !== $this->settlementId) {
$res['settlement_id'] = $this->settlementId;
}
if (null !== $this->tradeSettleInfo) {
$res['trade_settle_info'] = [];
if(null !== $this->tradeSettleInfo && is_array($this->tradeSettleInfo)){
$n = 0;
foreach($this->tradeSettleInfo as $item){
$res['trade_settle_info'][$n++] = null !== $item ? $item->toMap() : $item;
}
}
}
if (null !== $this->authTradePayMode) {
$res['auth_trade_pay_mode'] = $this->authTradePayMode;
}
if (null !== $this->buyerUserType) {
$res['buyer_user_type'] = $this->buyerUserType;
}
if (null !== $this->mdiscountAmount) {
$res['mdiscount_amount'] = $this->mdiscountAmount;
}
if (null !== $this->discountAmount) {
$res['discount_amount'] = $this->discountAmount;
}
if (null !== $this->buyerUserName) {
$res['buyer_user_name'] = $this->buyerUserName;
}
if (null !== $this->subject) {
$res['subject'] = $this->subject;
}
if (null !== $this->body) {
$res['body'] = $this->body;
}
if (null !== $this->alipaySubMerchantId) {
$res['alipay_sub_merchant_id'] = $this->alipaySubMerchantId;
}
if (null !== $this->extInfos) {
$res['ext_infos'] = $this->extInfos;
}
return $res;
}
/**
* @param array $map
* @return AlipayTradeQueryResponse
*/
public static function fromMap($map = []) {
$model = new self();
if(isset($map['http_body'])){
$model->httpBody = $map['http_body'];
}
if(isset($map['code'])){
$model->code = $map['code'];
}
if(isset($map['msg'])){
$model->msg = $map['msg'];
}
if(isset($map['sub_code'])){
$model->subCode = $map['sub_code'];
}
if(isset($map['sub_msg'])){
$model->subMsg = $map['sub_msg'];
}
if(isset($map['trade_no'])){
$model->tradeNo = $map['trade_no'];
}
if(isset($map['out_trade_no'])){
$model->outTradeNo = $map['out_trade_no'];
}
if(isset($map['buyer_logon_id'])){
$model->buyerLogonId = $map['buyer_logon_id'];
}
if(isset($map['trade_status'])){
$model->tradeStatus = $map['trade_status'];
}
if(isset($map['total_amount'])){
$model->totalAmount = $map['total_amount'];
}
if(isset($map['trans_currency'])){
$model->transCurrency = $map['trans_currency'];
}
if(isset($map['settle_currency'])){
$model->settleCurrency = $map['settle_currency'];
}
if(isset($map['settle_amount'])){
$model->settleAmount = $map['settle_amount'];
}
if(isset($map['pay_currency'])){
$model->payCurrency = $map['pay_currency'];
}
if(isset($map['pay_amount'])){
$model->payAmount = $map['pay_amount'];
}
if(isset($map['settle_trans_rate'])){
$model->settleTransRate = $map['settle_trans_rate'];
}
if(isset($map['trans_pay_rate'])){
$model->transPayRate = $map['trans_pay_rate'];
}
if(isset($map['buyer_pay_amount'])){
$model->buyerPayAmount = $map['buyer_pay_amount'];
}
if(isset($map['point_amount'])){
$model->pointAmount = $map['point_amount'];
}
if(isset($map['invoice_amount'])){
$model->invoiceAmount = $map['invoice_amount'];
}
if(isset($map['send_pay_date'])){
$model->sendPayDate = $map['send_pay_date'];
}
if(isset($map['receipt_amount'])){
$model->receiptAmount = $map['receipt_amount'];
}
if(isset($map['store_id'])){
$model->storeId = $map['store_id'];
}
if(isset($map['terminal_id'])){
$model->terminalId = $map['terminal_id'];
}
if(isset($map['fund_bill_list'])){
if(!empty($map['fund_bill_list'])){
$model->fundBillList = [];
$n = 0;
foreach($map['fund_bill_list'] as $item) {
$model->fundBillList[$n++] = null !== $item ? TradeFundBill::fromMap($item) : $item;
}
}
}
if(isset($map['store_name'])){
$model->storeName = $map['store_name'];
}
if(isset($map['buyer_user_id'])){
$model->buyerUserId = $map['buyer_user_id'];
}
if(isset($map['charge_amount'])){
$model->chargeAmount = $map['charge_amount'];
}
if(isset($map['charge_flags'])){
$model->chargeFlags = $map['charge_flags'];
}
if(isset($map['settlement_id'])){
$model->settlementId = $map['settlement_id'];
}
if(isset($map['trade_settle_info'])){
if(!empty($map['trade_settle_info'])){
$model->tradeSettleInfo = [];
$n = 0;
foreach($map['trade_settle_info'] as $item) {
$model->tradeSettleInfo[$n++] = null !== $item ? TradeSettleInfo::fromMap($item) : $item;
}
}
}
if(isset($map['auth_trade_pay_mode'])){
$model->authTradePayMode = $map['auth_trade_pay_mode'];
}
if(isset($map['buyer_user_type'])){
$model->buyerUserType = $map['buyer_user_type'];
}
if(isset($map['mdiscount_amount'])){
$model->mdiscountAmount = $map['mdiscount_amount'];
}
if(isset($map['discount_amount'])){
$model->discountAmount = $map['discount_amount'];
}
if(isset($map['buyer_user_name'])){
$model->buyerUserName = $map['buyer_user_name'];
}
if(isset($map['subject'])){
$model->subject = $map['subject'];
}
if(isset($map['body'])){
$model->body = $map['body'];
}
if(isset($map['alipay_sub_merchant_id'])){
$model->alipaySubMerchantId = $map['alipay_sub_merchant_id'];
}
if(isset($map['ext_infos'])){
$model->extInfos = $map['ext_infos'];
}
return $model;
}
/**
* @description 响应原始字符串
* @var string
*/
public $httpBody;
/**
* @var string
*/
public $code;
/**
* @var string
*/
public $msg;
/**
* @var string
*/
public $subCode;
/**
* @var string
*/
public $subMsg;
/**
* @var string
*/
public $tradeNo;
/**
* @var string
*/
public $outTradeNo;
/**
* @var string
*/
public $buyerLogonId;
/**
* @var string
*/
public $tradeStatus;
/**
* @var string
*/
public $totalAmount;
/**
* @var string
*/
public $transCurrency;
/**
* @var string
*/
public $settleCurrency;
/**
* @var string
*/
public $settleAmount;
/**
* @var string
*/
public $payCurrency;
/**
* @var string
*/
public $payAmount;
/**
* @var string
*/
public $settleTransRate;
/**
* @var string
*/
public $transPayRate;
/**
* @var string
*/
public $buyerPayAmount;
/**
* @var string
*/
public $pointAmount;
/**
* @var string
*/
public $invoiceAmount;
/**
* @var string
*/
public $sendPayDate;
/**
* @var string
*/
public $receiptAmount;
/**
* @var string
*/
public $storeId;
/**
* @var string
*/
public $terminalId;
/**
* @var TradeFundBill[]
*/
public $fundBillList;
/**
* @var string
*/
public $storeName;
/**
* @var string
*/
public $buyerUserId;
/**
* @var string
*/
public $chargeAmount;
/**
* @var string
*/
public $chargeFlags;
/**
* @var string
*/
public $settlementId;
/**
* @var TradeSettleInfo[]
*/
public $tradeSettleInfo;
/**
* @var string
*/
public $authTradePayMode;
/**
* @var string
*/
public $buyerUserType;
/**
* @var string
*/
public $mdiscountAmount;
/**
* @var string
*/
public $discountAmount;
/**
* @var string
*/
public $buyerUserName;
/**
* @var string
*/
public $subject;
/**
* @var string
*/
public $body;
/**
* @var string
*/
public $alipaySubMerchantId;
/**
* @var string
*/
public $extInfos;
}
@@ -0,0 +1,313 @@
<?php
// This file is auto-generated, don't edit it. Thanks.
namespace Alipay\EasySDK\Payment\Common\Models;
use AlibabaCloud\Tea\Model;
use Alipay\EasySDK\Payment\Common\Models\TradeFundBill;
use Alipay\EasySDK\Payment\Common\Models\PresetPayToolInfo;
class AlipayTradeRefundResponse extends Model {
protected $_name = [
'httpBody' => 'http_body',
'code' => 'code',
'msg' => 'msg',
'subCode' => 'sub_code',
'subMsg' => 'sub_msg',
'tradeNo' => 'trade_no',
'outTradeNo' => 'out_trade_no',
'buyerLogonId' => 'buyer_logon_id',
'fundChange' => 'fund_change',
'refundFee' => 'refund_fee',
'refundCurrency' => 'refund_currency',
'gmtRefundPay' => 'gmt_refund_pay',
'refundDetailItemList' => 'refund_detail_item_list',
'storeName' => 'store_name',
'buyerUserId' => 'buyer_user_id',
'refundPresetPaytoolList' => 'refund_preset_paytool_list',
'refundSettlementId' => 'refund_settlement_id',
'presentRefundBuyerAmount' => 'present_refund_buyer_amount',
'presentRefundDiscountAmount' => 'present_refund_discount_amount',
'presentRefundMdiscountAmount' => 'present_refund_mdiscount_amount',
];
public function validate() {
Model::validateRequired('httpBody', $this->httpBody, true);
Model::validateRequired('code', $this->code, true);
Model::validateRequired('msg', $this->msg, true);
Model::validateRequired('subCode', $this->subCode, true);
Model::validateRequired('subMsg', $this->subMsg, true);
Model::validateRequired('tradeNo', $this->tradeNo, true);
Model::validateRequired('outTradeNo', $this->outTradeNo, true);
Model::validateRequired('buyerLogonId', $this->buyerLogonId, true);
Model::validateRequired('fundChange', $this->fundChange, true);
Model::validateRequired('refundFee', $this->refundFee, true);
Model::validateRequired('refundCurrency', $this->refundCurrency, true);
Model::validateRequired('gmtRefundPay', $this->gmtRefundPay, true);
Model::validateRequired('refundDetailItemList', $this->refundDetailItemList, true);
Model::validateRequired('storeName', $this->storeName, true);
Model::validateRequired('buyerUserId', $this->buyerUserId, true);
Model::validateRequired('refundPresetPaytoolList', $this->refundPresetPaytoolList, true);
Model::validateRequired('refundSettlementId', $this->refundSettlementId, true);
Model::validateRequired('presentRefundBuyerAmount', $this->presentRefundBuyerAmount, true);
Model::validateRequired('presentRefundDiscountAmount', $this->presentRefundDiscountAmount, true);
Model::validateRequired('presentRefundMdiscountAmount', $this->presentRefundMdiscountAmount, true);
}
public function toMap() {
$res = [];
if (null !== $this->httpBody) {
$res['http_body'] = $this->httpBody;
}
if (null !== $this->code) {
$res['code'] = $this->code;
}
if (null !== $this->msg) {
$res['msg'] = $this->msg;
}
if (null !== $this->subCode) {
$res['sub_code'] = $this->subCode;
}
if (null !== $this->subMsg) {
$res['sub_msg'] = $this->subMsg;
}
if (null !== $this->tradeNo) {
$res['trade_no'] = $this->tradeNo;
}
if (null !== $this->outTradeNo) {
$res['out_trade_no'] = $this->outTradeNo;
}
if (null !== $this->buyerLogonId) {
$res['buyer_logon_id'] = $this->buyerLogonId;
}
if (null !== $this->fundChange) {
$res['fund_change'] = $this->fundChange;
}
if (null !== $this->refundFee) {
$res['refund_fee'] = $this->refundFee;
}
if (null !== $this->refundCurrency) {
$res['refund_currency'] = $this->refundCurrency;
}
if (null !== $this->gmtRefundPay) {
$res['gmt_refund_pay'] = $this->gmtRefundPay;
}
if (null !== $this->refundDetailItemList) {
$res['refund_detail_item_list'] = [];
if(null !== $this->refundDetailItemList && is_array($this->refundDetailItemList)){
$n = 0;
foreach($this->refundDetailItemList as $item){
$res['refund_detail_item_list'][$n++] = null !== $item ? $item->toMap() : $item;
}
}
}
if (null !== $this->storeName) {
$res['store_name'] = $this->storeName;
}
if (null !== $this->buyerUserId) {
$res['buyer_user_id'] = $this->buyerUserId;
}
if (null !== $this->refundPresetPaytoolList) {
$res['refund_preset_paytool_list'] = [];
if(null !== $this->refundPresetPaytoolList && is_array($this->refundPresetPaytoolList)){
$n = 0;
foreach($this->refundPresetPaytoolList as $item){
$res['refund_preset_paytool_list'][$n++] = null !== $item ? $item->toMap() : $item;
}
}
}
if (null !== $this->refundSettlementId) {
$res['refund_settlement_id'] = $this->refundSettlementId;
}
if (null !== $this->presentRefundBuyerAmount) {
$res['present_refund_buyer_amount'] = $this->presentRefundBuyerAmount;
}
if (null !== $this->presentRefundDiscountAmount) {
$res['present_refund_discount_amount'] = $this->presentRefundDiscountAmount;
}
if (null !== $this->presentRefundMdiscountAmount) {
$res['present_refund_mdiscount_amount'] = $this->presentRefundMdiscountAmount;
}
return $res;
}
/**
* @param array $map
* @return AlipayTradeRefundResponse
*/
public static function fromMap($map = []) {
$model = new self();
if(isset($map['http_body'])){
$model->httpBody = $map['http_body'];
}
if(isset($map['code'])){
$model->code = $map['code'];
}
if(isset($map['msg'])){
$model->msg = $map['msg'];
}
if(isset($map['sub_code'])){
$model->subCode = $map['sub_code'];
}
if(isset($map['sub_msg'])){
$model->subMsg = $map['sub_msg'];
}
if(isset($map['trade_no'])){
$model->tradeNo = $map['trade_no'];
}
if(isset($map['out_trade_no'])){
$model->outTradeNo = $map['out_trade_no'];
}
if(isset($map['buyer_logon_id'])){
$model->buyerLogonId = $map['buyer_logon_id'];
}
if(isset($map['fund_change'])){
$model->fundChange = $map['fund_change'];
}
if(isset($map['refund_fee'])){
$model->refundFee = $map['refund_fee'];
}
if(isset($map['refund_currency'])){
$model->refundCurrency = $map['refund_currency'];
}
if(isset($map['gmt_refund_pay'])){
$model->gmtRefundPay = $map['gmt_refund_pay'];
}
if(isset($map['refund_detail_item_list'])){
if(!empty($map['refund_detail_item_list'])){
$model->refundDetailItemList = [];
$n = 0;
foreach($map['refund_detail_item_list'] as $item) {
$model->refundDetailItemList[$n++] = null !== $item ? TradeFundBill::fromMap($item) : $item;
}
}
}
if(isset($map['store_name'])){
$model->storeName = $map['store_name'];
}
if(isset($map['buyer_user_id'])){
$model->buyerUserId = $map['buyer_user_id'];
}
if(isset($map['refund_preset_paytool_list'])){
if(!empty($map['refund_preset_paytool_list'])){
$model->refundPresetPaytoolList = [];
$n = 0;
foreach($map['refund_preset_paytool_list'] as $item) {
$model->refundPresetPaytoolList[$n++] = null !== $item ? PresetPayToolInfo::fromMap($item) : $item;
}
}
}
if(isset($map['refund_settlement_id'])){
$model->refundSettlementId = $map['refund_settlement_id'];
}
if(isset($map['present_refund_buyer_amount'])){
$model->presentRefundBuyerAmount = $map['present_refund_buyer_amount'];
}
if(isset($map['present_refund_discount_amount'])){
$model->presentRefundDiscountAmount = $map['present_refund_discount_amount'];
}
if(isset($map['present_refund_mdiscount_amount'])){
$model->presentRefundMdiscountAmount = $map['present_refund_mdiscount_amount'];
}
return $model;
}
/**
* @description 响应原始字符串
* @var string
*/
public $httpBody;
/**
* @var string
*/
public $code;
/**
* @var string
*/
public $msg;
/**
* @var string
*/
public $subCode;
/**
* @var string
*/
public $subMsg;
/**
* @var string
*/
public $tradeNo;
/**
* @var string
*/
public $outTradeNo;
/**
* @var string
*/
public $buyerLogonId;
/**
* @var string
*/
public $fundChange;
/**
* @var string
*/
public $refundFee;
/**
* @var string
*/
public $refundCurrency;
/**
* @var string
*/
public $gmtRefundPay;
/**
* @var TradeFundBill[]
*/
public $refundDetailItemList;
/**
* @var string
*/
public $storeName;
/**
* @var string
*/
public $buyerUserId;
/**
* @var PresetPayToolInfo[]
*/
public $refundPresetPaytoolList;
/**
* @var string
*/
public $refundSettlementId;
/**
* @var string
*/
public $presentRefundBuyerAmount;
/**
* @var string
*/
public $presentRefundDiscountAmount;
/**
* @var string
*/
public $presentRefundMdiscountAmount;
}
@@ -0,0 +1,53 @@
<?php
// This file is auto-generated, don't edit it. Thanks.
namespace Alipay\EasySDK\Payment\Common\Models;
use AlibabaCloud\Tea\Model;
class PresetPayToolInfo extends Model {
protected $_name = [
'amount' => 'amount',
'assertTypeCode' => 'assert_type_code',
];
public function validate() {
Model::validateRequired('amount', $this->amount, true);
Model::validateRequired('assertTypeCode', $this->assertTypeCode, true);
}
public function toMap() {
$res = [];
if (null !== $this->amount) {
$res['amount'] = $this->amount;
}
if (null !== $this->assertTypeCode) {
$res['assert_type_code'] = $this->assertTypeCode;
}
return $res;
}
/**
* @param array $map
* @return PresetPayToolInfo
*/
public static function fromMap($map = []) {
$model = new self();
if(isset($map['amount'])){
if(!empty($map['amount'])){
$model->amount = $map['amount'];
}
}
if(isset($map['assert_type_code'])){
$model->assertTypeCode = $map['assert_type_code'];
}
return $model;
}
/**
* @var string[]
*/
public $amount;
/**
* @var string
*/
public $assertTypeCode;
}
@@ -0,0 +1,116 @@
<?php
// This file is auto-generated, don't edit it. Thanks.
namespace Alipay\EasySDK\Payment\Common\Models;
use AlibabaCloud\Tea\Model;
class RefundRoyaltyResult extends Model {
protected $_name = [
'refundAmount' => 'refund_amount',
'royaltyType' => 'royalty_type',
'resultCode' => 'result_code',
'transOut' => 'trans_out',
'transOutEmail' => 'trans_out_email',
'transIn' => 'trans_in',
'transInEmail' => 'trans_in_email',
];
public function validate() {
Model::validateRequired('refundAmount', $this->refundAmount, true);
Model::validateRequired('royaltyType', $this->royaltyType, true);
Model::validateRequired('resultCode', $this->resultCode, true);
Model::validateRequired('transOut', $this->transOut, true);
Model::validateRequired('transOutEmail', $this->transOutEmail, true);
Model::validateRequired('transIn', $this->transIn, true);
Model::validateRequired('transInEmail', $this->transInEmail, true);
}
public function toMap() {
$res = [];
if (null !== $this->refundAmount) {
$res['refund_amount'] = $this->refundAmount;
}
if (null !== $this->royaltyType) {
$res['royalty_type'] = $this->royaltyType;
}
if (null !== $this->resultCode) {
$res['result_code'] = $this->resultCode;
}
if (null !== $this->transOut) {
$res['trans_out'] = $this->transOut;
}
if (null !== $this->transOutEmail) {
$res['trans_out_email'] = $this->transOutEmail;
}
if (null !== $this->transIn) {
$res['trans_in'] = $this->transIn;
}
if (null !== $this->transInEmail) {
$res['trans_in_email'] = $this->transInEmail;
}
return $res;
}
/**
* @param array $map
* @return RefundRoyaltyResult
*/
public static function fromMap($map = []) {
$model = new self();
if(isset($map['refund_amount'])){
$model->refundAmount = $map['refund_amount'];
}
if(isset($map['royalty_type'])){
$model->royaltyType = $map['royalty_type'];
}
if(isset($map['result_code'])){
$model->resultCode = $map['result_code'];
}
if(isset($map['trans_out'])){
$model->transOut = $map['trans_out'];
}
if(isset($map['trans_out_email'])){
$model->transOutEmail = $map['trans_out_email'];
}
if(isset($map['trans_in'])){
$model->transIn = $map['trans_in'];
}
if(isset($map['trans_in_email'])){
$model->transInEmail = $map['trans_in_email'];
}
return $model;
}
/**
* @var string
*/
public $refundAmount;
/**
* @var string
*/
public $royaltyType;
/**
* @var string
*/
public $resultCode;
/**
* @var string
*/
public $transOut;
/**
* @var string
*/
public $transOutEmail;
/**
* @var string
*/
public $transIn;
/**
* @var string
*/
public $transInEmail;
}
@@ -0,0 +1,90 @@
<?php
// This file is auto-generated, don't edit it. Thanks.
namespace Alipay\EasySDK\Payment\Common\Models;
use AlibabaCloud\Tea\Model;
class TradeFundBill extends Model {
protected $_name = [
'fundChannel' => 'fund_channel',
'bankCode' => 'bank_code',
'amount' => 'amount',
'realAmount' => 'real_amount',
'fundType' => 'fund_type',
];
public function validate() {
Model::validateRequired('fundChannel', $this->fundChannel, true);
Model::validateRequired('bankCode', $this->bankCode, true);
Model::validateRequired('amount', $this->amount, true);
Model::validateRequired('realAmount', $this->realAmount, true);
Model::validateRequired('fundType', $this->fundType, true);
}
public function toMap() {
$res = [];
if (null !== $this->fundChannel) {
$res['fund_channel'] = $this->fundChannel;
}
if (null !== $this->bankCode) {
$res['bank_code'] = $this->bankCode;
}
if (null !== $this->amount) {
$res['amount'] = $this->amount;
}
if (null !== $this->realAmount) {
$res['real_amount'] = $this->realAmount;
}
if (null !== $this->fundType) {
$res['fund_type'] = $this->fundType;
}
return $res;
}
/**
* @param array $map
* @return TradeFundBill
*/
public static function fromMap($map = []) {
$model = new self();
if(isset($map['fund_channel'])){
$model->fundChannel = $map['fund_channel'];
}
if(isset($map['bank_code'])){
$model->bankCode = $map['bank_code'];
}
if(isset($map['amount'])){
$model->amount = $map['amount'];
}
if(isset($map['real_amount'])){
$model->realAmount = $map['real_amount'];
}
if(isset($map['fund_type'])){
$model->fundType = $map['fund_type'];
}
return $model;
}
/**
* @var string
*/
public $fundChannel;
/**
* @var string
*/
public $bankCode;
/**
* @var string
*/
public $amount;
/**
* @var string
*/
public $realAmount;
/**
* @var string
*/
public $fundType;
}
@@ -0,0 +1,103 @@
<?php
// This file is auto-generated, don't edit it. Thanks.
namespace Alipay\EasySDK\Payment\Common\Models;
use AlibabaCloud\Tea\Model;
class TradeSettleDetail extends Model {
protected $_name = [
'operationType' => 'operation_type',
'operationSerial_no' => 'operation_serial_no',
'operationDt' => 'operation_dt',
'transOut' => 'trans_out',
'transIn' => 'trans_in',
'amount' => 'amount',
];
public function validate() {
Model::validateRequired('operationType', $this->operationType, true);
Model::validateRequired('operationSerial_no', $this->operationSerial_no, true);
Model::validateRequired('operationDt', $this->operationDt, true);
Model::validateRequired('transOut', $this->transOut, true);
Model::validateRequired('transIn', $this->transIn, true);
Model::validateRequired('amount', $this->amount, true);
}
public function toMap() {
$res = [];
if (null !== $this->operationType) {
$res['operation_type'] = $this->operationType;
}
if (null !== $this->operationSerial_no) {
$res['operation_serial_no'] = $this->operationSerial_no;
}
if (null !== $this->operationDt) {
$res['operation_dt'] = $this->operationDt;
}
if (null !== $this->transOut) {
$res['trans_out'] = $this->transOut;
}
if (null !== $this->transIn) {
$res['trans_in'] = $this->transIn;
}
if (null !== $this->amount) {
$res['amount'] = $this->amount;
}
return $res;
}
/**
* @param array $map
* @return TradeSettleDetail
*/
public static function fromMap($map = []) {
$model = new self();
if(isset($map['operation_type'])){
$model->operationType = $map['operation_type'];
}
if(isset($map['operation_serial_no'])){
$model->operationSerial_no = $map['operation_serial_no'];
}
if(isset($map['operation_dt'])){
$model->operationDt = $map['operation_dt'];
}
if(isset($map['trans_out'])){
$model->transOut = $map['trans_out'];
}
if(isset($map['trans_in'])){
$model->transIn = $map['trans_in'];
}
if(isset($map['amount'])){
$model->amount = $map['amount'];
}
return $model;
}
/**
* @var string
*/
public $operationType;
/**
* @var string
*/
public $operationSerial_no;
/**
* @var string
*/
public $operationDt;
/**
* @var string
*/
public $transOut;
/**
* @var string
*/
public $transIn;
/**
* @var string
*/
public $amount;
}
@@ -0,0 +1,52 @@
<?php
// This file is auto-generated, don't edit it. Thanks.
namespace Alipay\EasySDK\Payment\Common\Models;
use AlibabaCloud\Tea\Model;
use Alipay\EasySDK\Payment\Common\Models\TradeSettleDetail;
class TradeSettleInfo extends Model {
protected $_name = [
'tradeSettleDetailList' => 'trade_settle_detail_list',
];
public function validate() {
Model::validateRequired('tradeSettleDetailList', $this->tradeSettleDetailList, true);
}
public function toMap() {
$res = [];
if (null !== $this->tradeSettleDetailList) {
$res['trade_settle_detail_list'] = [];
if(null !== $this->tradeSettleDetailList && is_array($this->tradeSettleDetailList)){
$n = 0;
foreach($this->tradeSettleDetailList as $item){
$res['trade_settle_detail_list'][$n++] = null !== $item ? $item->toMap() : $item;
}
}
}
return $res;
}
/**
* @param array $map
* @return TradeSettleInfo
*/
public static function fromMap($map = []) {
$model = new self();
if(isset($map['trade_settle_detail_list'])){
if(!empty($map['trade_settle_detail_list'])){
$model->tradeSettleDetailList = [];
$n = 0;
foreach($map['trade_settle_detail_list'] as $item) {
$model->tradeSettleDetailList[$n++] = null !== $item ? TradeSettleDetail::fromMap($item) : $item;
}
}
}
return $model;
}
/**
* @var TradeSettleDetail[]
*/
public $tradeSettleDetailList;
}
@@ -0,0 +1,293 @@
<?php
// This file is auto-generated, don't edit it. Thanks.
namespace Alipay\EasySDK\Payment\FaceToFace;
use Alipay\EasySDK\Kernel\EasySDKKernel;
use AlibabaCloud\Tea\Tea;
use AlibabaCloud\Tea\Request;
use AlibabaCloud\Tea\Exception\TeaError;
use \Exception;
use AlibabaCloud\Tea\Exception\TeaUnableRetryError;
use Alipay\EasySDK\Payment\FaceToFace\Models\AlipayTradePayResponse;
use AlibabaCloud\Tea\Response;
use Alipay\EasySDK\Payment\FaceToFace\Models\AlipayTradePrecreateResponse;
class Client {
protected $_kernel;
public function __construct($kernel){
$this->_kernel = $kernel;
}
/**
* @param string $subject
* @param string $outTradeNo
* @param string $totalAmount
* @param string $authCode
* @return AlipayTradePayResponse
* @throws TeaError
* @throws Exception
* @throws TeaUnableRetryError
*/
public function pay($subject, $outTradeNo, $totalAmount, $authCode){
$_runtime = [
"ignoreSSL" => $this->_kernel->getConfig("ignoreSSL"),
"httpProxy" => $this->_kernel->getConfig("httpProxy"),
"connectTimeout" => 15000,
"readTimeout" => 15000,
"retry" => [
"maxAttempts" => 0
]
];
$_lastRequest = null;
$_lastException = null;
$_now = time();
$_retryTimes = 0;
while (Tea::allowRetry(@$_runtime["retry"], $_retryTimes, $_now)) {
if ($_retryTimes > 0) {
$_backoffTime = Tea::getBackoffTime(@$_runtime["backoff"], $_retryTimes);
if ($_backoffTime > 0) {
Tea::sleep($_backoffTime);
}
}
$_retryTimes = $_retryTimes + 1;
try {
$_request = new Request();
$systemParams = [
"method" => "alipay.trade.pay",
"app_id" => $this->_kernel->getConfig("appId"),
"timestamp" => $this->_kernel->getTimestamp(),
"format" => "json",
"version" => "1.0",
"alipay_sdk" => $this->_kernel->getSdkVersion(),
"charset" => "UTF-8",
"sign_type" => $this->_kernel->getConfig("signType"),
"app_cert_sn" => $this->_kernel->getMerchantCertSN(),
"alipay_root_cert_sn" => $this->_kernel->getAlipayRootCertSN()
];
$bizParams = [
"subject" => $subject,
"out_trade_no" => $outTradeNo,
"total_amount" => $totalAmount,
"auth_code" => $authCode,
"scene" => "bar_code"
];
$textParams = [];
$_request->protocol = $this->_kernel->getConfig("protocol");
$_request->method = "POST";
$_request->pathname = "/gateway.do";
$_request->headers = [
"host" => $this->_kernel->getConfig("gatewayHost"),
"content-type" => "application/x-www-form-urlencoded;charset=utf-8"
];
$_request->query = $this->_kernel->sortMap(Tea::merge([
"sign" => $this->_kernel->sign($systemParams, $bizParams, $textParams, $this->_kernel->getConfig("merchantPrivateKey"))
], $systemParams, $textParams));
$_request->body = $this->_kernel->toUrlEncodedRequestBody($bizParams);
$_lastRequest = $_request;
$_response= Tea::send($_request, $_runtime);
$respMap = $this->_kernel->readAsJson($_response, "alipay.trade.pay");
if ($this->_kernel->isCertMode()) {
if ($this->_kernel->verify($respMap, $this->_kernel->extractAlipayPublicKey($this->_kernel->getAlipayCertSN($respMap)))) {
return AlipayTradePayResponse::fromMap($this->_kernel->toRespModel($respMap));
}
}
else {
if ($this->_kernel->verify($respMap, $this->_kernel->getConfig("alipayPublicKey"))) {
return AlipayTradePayResponse::fromMap($this->_kernel->toRespModel($respMap));
}
}
throw new TeaError([
"message" => "验签失败,请检查支付宝公钥设置是否正确。"
]);
}
catch (Exception $e) {
if (!($e instanceof TeaError)) {
$e = new TeaError([], $e->getMessage(), $e->getCode(), $e);
}
if (Tea::isRetryable($e)) {
$_lastException = $e;
continue;
}
throw $e;
}
}
throw new TeaUnableRetryError($_lastRequest, $_lastException);
}
/**
* @param string $subject
* @param string $outTradeNo
* @param string $totalAmount
* @return AlipayTradePrecreateResponse
* @throws TeaError
* @throws Exception
* @throws TeaUnableRetryError
*/
public function preCreate($subject, $outTradeNo, $totalAmount){
$_runtime = [
"ignoreSSL" => $this->_kernel->getConfig("ignoreSSL"),
"httpProxy" => $this->_kernel->getConfig("httpProxy"),
"connectTimeout" => 15000,
"readTimeout" => 15000,
"retry" => [
"maxAttempts" => 0
]
];
$_lastRequest = null;
$_lastException = null;
$_now = time();
$_retryTimes = 0;
while (Tea::allowRetry(@$_runtime["retry"], $_retryTimes, $_now)) {
if ($_retryTimes > 0) {
$_backoffTime = Tea::getBackoffTime(@$_runtime["backoff"], $_retryTimes);
if ($_backoffTime > 0) {
Tea::sleep($_backoffTime);
}
}
$_retryTimes = $_retryTimes + 1;
try {
$_request = new Request();
$systemParams = [
"method" => "alipay.trade.precreate",
"app_id" => $this->_kernel->getConfig("appId"),
"timestamp" => $this->_kernel->getTimestamp(),
"format" => "json",
"version" => "1.0",
"alipay_sdk" => $this->_kernel->getSdkVersion(),
"charset" => "UTF-8",
"sign_type" => $this->_kernel->getConfig("signType"),
"app_cert_sn" => $this->_kernel->getMerchantCertSN(),
"alipay_root_cert_sn" => $this->_kernel->getAlipayRootCertSN()
];
$bizParams = [
"subject" => $subject,
"out_trade_no" => $outTradeNo,
"total_amount" => $totalAmount
];
$textParams = [];
$_request->protocol = $this->_kernel->getConfig("protocol");
$_request->method = "POST";
$_request->pathname = "/gateway.do";
$_request->headers = [
"host" => $this->_kernel->getConfig("gatewayHost"),
"content-type" => "application/x-www-form-urlencoded;charset=utf-8"
];
$_request->query = $this->_kernel->sortMap(Tea::merge([
"sign" => $this->_kernel->sign($systemParams, $bizParams, $textParams, $this->_kernel->getConfig("merchantPrivateKey"))
], $systemParams, $textParams));
$_request->body = $this->_kernel->toUrlEncodedRequestBody($bizParams);
$_lastRequest = $_request;
$_response= Tea::send($_request, $_runtime);
$respMap = $this->_kernel->readAsJson($_response, "alipay.trade.precreate");
if ($this->_kernel->isCertMode()) {
if ($this->_kernel->verify($respMap, $this->_kernel->extractAlipayPublicKey($this->_kernel->getAlipayCertSN($respMap)))) {
return AlipayTradePrecreateResponse::fromMap($this->_kernel->toRespModel($respMap));
}
}
else {
if ($this->_kernel->verify($respMap, $this->_kernel->getConfig("alipayPublicKey"))) {
return AlipayTradePrecreateResponse::fromMap($this->_kernel->toRespModel($respMap));
}
}
throw new TeaError([
"message" => "验签失败,请检查支付宝公钥设置是否正确。"
]);
}
catch (Exception $e) {
if (!($e instanceof TeaError)) {
$e = new TeaError([], $e->getMessage(), $e->getCode(), $e);
}
if (Tea::isRetryable($e)) {
$_lastException = $e;
continue;
}
throw $e;
}
}
throw new TeaUnableRetryError($_lastRequest, $_lastException);
}
/**
* ISV代商户代用,指定appAuthToken
*
* @param $appAuthToken String 代调用token
* @return $this 本客户端,便于链式调用
*/
public function agent($appAuthToken)
{
$this->_kernel->injectTextParam("app_auth_token", $appAuthToken);
return $this;
}
/**
* 用户授权调用,指定authToken
*
* @param $authToken String 用户授权token
* @return $this
*/
public function auth($authToken)
{
$this->_kernel->injectTextParam("auth_token", $authToken);
return $this;
}
/**
* 设置异步通知回调地址,此处设置将在本调用中覆盖Config中的全局配置
*
* @param $url String 异步通知回调地址,例如:https://www.test.com/callback
* @return $this
*/
public function asyncNotify($url)
{
$this->_kernel->injectTextParam("notify_url", $url);
return $this;
}
/**
* 将本次调用强制路由到后端系统的测试地址上,常用于线下环境内外联调,沙箱与线上环境设置无效
*
* @param $testUrl String 后端系统测试地址
* @return $this
*/
public function route($testUrl)
{
$this->_kernel->injectTextParam("ws_service_url", $testUrl);
return $this;
}
/**
* 设置API入参中没有的其他可选业务请求参数(biz_content下的字段)
*
* @param $key String 业务请求参数名称(biz_content下的字段名,比如timeout_express)
* @param $value object 业务请求参数的值,一个可以序列化成JSON的对象
* 如果该字段是一个字符串类型(String、Price、Date在SDK中都是字符串),请使用String储存
* 如果该字段是一个数值型类型(比如:Number),请使用Long储存
* 如果该字段是一个复杂类型,请使用嵌套的array指定各下级字段的值
* 如果该字段是一个数组,请使用array储存各个值
* @return $this
*/
public function optional($key, $value)
{
$this->_kernel->injectBizParam($key, $value);
return $this;
}
/**
* 批量设置API入参中没有的其他可选业务请求参数(biz_content下的字段)
* optional方法的批量版本
*
* @param $optionalArgs array 可选参数集合,每个参数由key和value组成,key和value的格式请参见optional方法的注释
* @return $this
*/
public function batchOptional($optionalArgs)
{
foreach ($optionalArgs as $key => $value) {
$this->_kernel->injectBizParam($key, $value);
}
return $this;
}
}
@@ -0,0 +1,534 @@
<?php
// This file is auto-generated, don't edit it. Thanks.
namespace Alipay\EasySDK\Payment\FaceToFace\Models;
use AlibabaCloud\Tea\Model;
use Alipay\EasySDK\Payment\FaceToFace\Models\TradeFundBill;
use Alipay\EasySDK\Payment\FaceToFace\Models\VoucherDetail;
class AlipayTradePayResponse extends Model {
protected $_name = [
'httpBody' => 'http_body',
'code' => 'code',
'msg' => 'msg',
'subCode' => 'sub_code',
'subMsg' => 'sub_msg',
'tradeNo' => 'trade_no',
'outTradeNo' => 'out_trade_no',
'buyerLogonId' => 'buyer_logon_id',
'settleAmount' => 'settle_amount',
'payCurrency' => 'pay_currency',
'payAmount' => 'pay_amount',
'settleTransRate' => 'settle_trans_rate',
'transPayRate' => 'trans_pay_rate',
'totalAmount' => 'total_amount',
'transCurrency' => 'trans_currency',
'settleCurrency' => 'settle_currency',
'receiptAmount' => 'receipt_amount',
'buyerPayAmount' => 'buyer_pay_amount',
'pointAmount' => 'point_amount',
'invoiceAmount' => 'invoice_amount',
'gmtPayment' => 'gmt_payment',
'fundBillList' => 'fund_bill_list',
'cardBalance' => 'card_balance',
'storeName' => 'store_name',
'buyerUserId' => 'buyer_user_id',
'discountGoodsDetail' => 'discount_goods_detail',
'voucherDetailList' => 'voucher_detail_list',
'advanceAmount' => 'advance_amount',
'authTradePayMode' => 'auth_trade_pay_mode',
'chargeAmount' => 'charge_amount',
'chargeFlags' => 'charge_flags',
'settlementId' => 'settlement_id',
'businessParams' => 'business_params',
'buyerUserType' => 'buyer_user_type',
'mdiscountAmount' => 'mdiscount_amount',
'discountAmount' => 'discount_amount',
'buyerUserName' => 'buyer_user_name',
];
public function validate() {
Model::validateRequired('httpBody', $this->httpBody, true);
Model::validateRequired('code', $this->code, true);
Model::validateRequired('msg', $this->msg, true);
Model::validateRequired('subCode', $this->subCode, true);
Model::validateRequired('subMsg', $this->subMsg, true);
Model::validateRequired('tradeNo', $this->tradeNo, true);
Model::validateRequired('outTradeNo', $this->outTradeNo, true);
Model::validateRequired('buyerLogonId', $this->buyerLogonId, true);
Model::validateRequired('settleAmount', $this->settleAmount, true);
Model::validateRequired('payCurrency', $this->payCurrency, true);
Model::validateRequired('payAmount', $this->payAmount, true);
Model::validateRequired('settleTransRate', $this->settleTransRate, true);
Model::validateRequired('transPayRate', $this->transPayRate, true);
Model::validateRequired('totalAmount', $this->totalAmount, true);
Model::validateRequired('transCurrency', $this->transCurrency, true);
Model::validateRequired('settleCurrency', $this->settleCurrency, true);
Model::validateRequired('receiptAmount', $this->receiptAmount, true);
Model::validateRequired('buyerPayAmount', $this->buyerPayAmount, true);
Model::validateRequired('pointAmount', $this->pointAmount, true);
Model::validateRequired('invoiceAmount', $this->invoiceAmount, true);
Model::validateRequired('gmtPayment', $this->gmtPayment, true);
Model::validateRequired('fundBillList', $this->fundBillList, true);
Model::validateRequired('cardBalance', $this->cardBalance, true);
Model::validateRequired('storeName', $this->storeName, true);
Model::validateRequired('buyerUserId', $this->buyerUserId, true);
Model::validateRequired('discountGoodsDetail', $this->discountGoodsDetail, true);
Model::validateRequired('voucherDetailList', $this->voucherDetailList, true);
Model::validateRequired('advanceAmount', $this->advanceAmount, true);
Model::validateRequired('authTradePayMode', $this->authTradePayMode, true);
Model::validateRequired('chargeAmount', $this->chargeAmount, true);
Model::validateRequired('chargeFlags', $this->chargeFlags, true);
Model::validateRequired('settlementId', $this->settlementId, true);
Model::validateRequired('businessParams', $this->businessParams, true);
Model::validateRequired('buyerUserType', $this->buyerUserType, true);
Model::validateRequired('mdiscountAmount', $this->mdiscountAmount, true);
Model::validateRequired('discountAmount', $this->discountAmount, true);
Model::validateRequired('buyerUserName', $this->buyerUserName, true);
}
public function toMap() {
$res = [];
if (null !== $this->httpBody) {
$res['http_body'] = $this->httpBody;
}
if (null !== $this->code) {
$res['code'] = $this->code;
}
if (null !== $this->msg) {
$res['msg'] = $this->msg;
}
if (null !== $this->subCode) {
$res['sub_code'] = $this->subCode;
}
if (null !== $this->subMsg) {
$res['sub_msg'] = $this->subMsg;
}
if (null !== $this->tradeNo) {
$res['trade_no'] = $this->tradeNo;
}
if (null !== $this->outTradeNo) {
$res['out_trade_no'] = $this->outTradeNo;
}
if (null !== $this->buyerLogonId) {
$res['buyer_logon_id'] = $this->buyerLogonId;
}
if (null !== $this->settleAmount) {
$res['settle_amount'] = $this->settleAmount;
}
if (null !== $this->payCurrency) {
$res['pay_currency'] = $this->payCurrency;
}
if (null !== $this->payAmount) {
$res['pay_amount'] = $this->payAmount;
}
if (null !== $this->settleTransRate) {
$res['settle_trans_rate'] = $this->settleTransRate;
}
if (null !== $this->transPayRate) {
$res['trans_pay_rate'] = $this->transPayRate;
}
if (null !== $this->totalAmount) {
$res['total_amount'] = $this->totalAmount;
}
if (null !== $this->transCurrency) {
$res['trans_currency'] = $this->transCurrency;
}
if (null !== $this->settleCurrency) {
$res['settle_currency'] = $this->settleCurrency;
}
if (null !== $this->receiptAmount) {
$res['receipt_amount'] = $this->receiptAmount;
}
if (null !== $this->buyerPayAmount) {
$res['buyer_pay_amount'] = $this->buyerPayAmount;
}
if (null !== $this->pointAmount) {
$res['point_amount'] = $this->pointAmount;
}
if (null !== $this->invoiceAmount) {
$res['invoice_amount'] = $this->invoiceAmount;
}
if (null !== $this->gmtPayment) {
$res['gmt_payment'] = $this->gmtPayment;
}
if (null !== $this->fundBillList) {
$res['fund_bill_list'] = [];
if(null !== $this->fundBillList && is_array($this->fundBillList)){
$n = 0;
foreach($this->fundBillList as $item){
$res['fund_bill_list'][$n++] = null !== $item ? $item->toMap() : $item;
}
}
}
if (null !== $this->cardBalance) {
$res['card_balance'] = $this->cardBalance;
}
if (null !== $this->storeName) {
$res['store_name'] = $this->storeName;
}
if (null !== $this->buyerUserId) {
$res['buyer_user_id'] = $this->buyerUserId;
}
if (null !== $this->discountGoodsDetail) {
$res['discount_goods_detail'] = $this->discountGoodsDetail;
}
if (null !== $this->voucherDetailList) {
$res['voucher_detail_list'] = [];
if(null !== $this->voucherDetailList && is_array($this->voucherDetailList)){
$n = 0;
foreach($this->voucherDetailList as $item){
$res['voucher_detail_list'][$n++] = null !== $item ? $item->toMap() : $item;
}
}
}
if (null !== $this->advanceAmount) {
$res['advance_amount'] = $this->advanceAmount;
}
if (null !== $this->authTradePayMode) {
$res['auth_trade_pay_mode'] = $this->authTradePayMode;
}
if (null !== $this->chargeAmount) {
$res['charge_amount'] = $this->chargeAmount;
}
if (null !== $this->chargeFlags) {
$res['charge_flags'] = $this->chargeFlags;
}
if (null !== $this->settlementId) {
$res['settlement_id'] = $this->settlementId;
}
if (null !== $this->businessParams) {
$res['business_params'] = $this->businessParams;
}
if (null !== $this->buyerUserType) {
$res['buyer_user_type'] = $this->buyerUserType;
}
if (null !== $this->mdiscountAmount) {
$res['mdiscount_amount'] = $this->mdiscountAmount;
}
if (null !== $this->discountAmount) {
$res['discount_amount'] = $this->discountAmount;
}
if (null !== $this->buyerUserName) {
$res['buyer_user_name'] = $this->buyerUserName;
}
return $res;
}
/**
* @param array $map
* @return AlipayTradePayResponse
*/
public static function fromMap($map = []) {
$model = new self();
if(isset($map['http_body'])){
$model->httpBody = $map['http_body'];
}
if(isset($map['code'])){
$model->code = $map['code'];
}
if(isset($map['msg'])){
$model->msg = $map['msg'];
}
if(isset($map['sub_code'])){
$model->subCode = $map['sub_code'];
}
if(isset($map['sub_msg'])){
$model->subMsg = $map['sub_msg'];
}
if(isset($map['trade_no'])){
$model->tradeNo = $map['trade_no'];
}
if(isset($map['out_trade_no'])){
$model->outTradeNo = $map['out_trade_no'];
}
if(isset($map['buyer_logon_id'])){
$model->buyerLogonId = $map['buyer_logon_id'];
}
if(isset($map['settle_amount'])){
$model->settleAmount = $map['settle_amount'];
}
if(isset($map['pay_currency'])){
$model->payCurrency = $map['pay_currency'];
}
if(isset($map['pay_amount'])){
$model->payAmount = $map['pay_amount'];
}
if(isset($map['settle_trans_rate'])){
$model->settleTransRate = $map['settle_trans_rate'];
}
if(isset($map['trans_pay_rate'])){
$model->transPayRate = $map['trans_pay_rate'];
}
if(isset($map['total_amount'])){
$model->totalAmount = $map['total_amount'];
}
if(isset($map['trans_currency'])){
$model->transCurrency = $map['trans_currency'];
}
if(isset($map['settle_currency'])){
$model->settleCurrency = $map['settle_currency'];
}
if(isset($map['receipt_amount'])){
$model->receiptAmount = $map['receipt_amount'];
}
if(isset($map['buyer_pay_amount'])){
$model->buyerPayAmount = $map['buyer_pay_amount'];
}
if(isset($map['point_amount'])){
$model->pointAmount = $map['point_amount'];
}
if(isset($map['invoice_amount'])){
$model->invoiceAmount = $map['invoice_amount'];
}
if(isset($map['gmt_payment'])){
$model->gmtPayment = $map['gmt_payment'];
}
if(isset($map['fund_bill_list'])){
if(!empty($map['fund_bill_list'])){
$model->fundBillList = [];
$n = 0;
foreach($map['fund_bill_list'] as $item) {
$model->fundBillList[$n++] = null !== $item ? TradeFundBill::fromMap($item) : $item;
}
}
}
if(isset($map['card_balance'])){
$model->cardBalance = $map['card_balance'];
}
if(isset($map['store_name'])){
$model->storeName = $map['store_name'];
}
if(isset($map['buyer_user_id'])){
$model->buyerUserId = $map['buyer_user_id'];
}
if(isset($map['discount_goods_detail'])){
$model->discountGoodsDetail = $map['discount_goods_detail'];
}
if(isset($map['voucher_detail_list'])){
if(!empty($map['voucher_detail_list'])){
$model->voucherDetailList = [];
$n = 0;
foreach($map['voucher_detail_list'] as $item) {
$model->voucherDetailList[$n++] = null !== $item ? VoucherDetail::fromMap($item) : $item;
}
}
}
if(isset($map['advance_amount'])){
$model->advanceAmount = $map['advance_amount'];
}
if(isset($map['auth_trade_pay_mode'])){
$model->authTradePayMode = $map['auth_trade_pay_mode'];
}
if(isset($map['charge_amount'])){
$model->chargeAmount = $map['charge_amount'];
}
if(isset($map['charge_flags'])){
$model->chargeFlags = $map['charge_flags'];
}
if(isset($map['settlement_id'])){
$model->settlementId = $map['settlement_id'];
}
if(isset($map['business_params'])){
$model->businessParams = $map['business_params'];
}
if(isset($map['buyer_user_type'])){
$model->buyerUserType = $map['buyer_user_type'];
}
if(isset($map['mdiscount_amount'])){
$model->mdiscountAmount = $map['mdiscount_amount'];
}
if(isset($map['discount_amount'])){
$model->discountAmount = $map['discount_amount'];
}
if(isset($map['buyer_user_name'])){
$model->buyerUserName = $map['buyer_user_name'];
}
return $model;
}
/**
* @description 响应原始字符串
* @var string
*/
public $httpBody;
/**
* @var string
*/
public $code;
/**
* @var string
*/
public $msg;
/**
* @var string
*/
public $subCode;
/**
* @var string
*/
public $subMsg;
/**
* @var string
*/
public $tradeNo;
/**
* @var string
*/
public $outTradeNo;
/**
* @var string
*/
public $buyerLogonId;
/**
* @var string
*/
public $settleAmount;
/**
* @var string
*/
public $payCurrency;
/**
* @var string
*/
public $payAmount;
/**
* @var string
*/
public $settleTransRate;
/**
* @var string
*/
public $transPayRate;
/**
* @var string
*/
public $totalAmount;
/**
* @var string
*/
public $transCurrency;
/**
* @var string
*/
public $settleCurrency;
/**
* @var string
*/
public $receiptAmount;
/**
* @var string
*/
public $buyerPayAmount;
/**
* @var string
*/
public $pointAmount;
/**
* @var string
*/
public $invoiceAmount;
/**
* @var string
*/
public $gmtPayment;
/**
* @var TradeFundBill[]
*/
public $fundBillList;
/**
* @var string
*/
public $cardBalance;
/**
* @var string
*/
public $storeName;
/**
* @var string
*/
public $buyerUserId;
/**
* @var string
*/
public $discountGoodsDetail;
/**
* @var VoucherDetail[]
*/
public $voucherDetailList;
/**
* @var string
*/
public $advanceAmount;
/**
* @var string
*/
public $authTradePayMode;
/**
* @var string
*/
public $chargeAmount;
/**
* @var string
*/
public $chargeFlags;
/**
* @var string
*/
public $settlementId;
/**
* @var string
*/
public $businessParams;
/**
* @var string
*/
public $buyerUserType;
/**
* @var string
*/
public $mdiscountAmount;
/**
* @var string
*/
public $discountAmount;
/**
* @var string
*/
public $buyerUserName;
}
@@ -0,0 +1,117 @@
<?php
// This file is auto-generated, don't edit it. Thanks.
namespace Alipay\EasySDK\Payment\FaceToFace\Models;
use AlibabaCloud\Tea\Model;
class AlipayTradePrecreateResponse extends Model {
protected $_name = [
'httpBody' => 'http_body',
'code' => 'code',
'msg' => 'msg',
'subCode' => 'sub_code',
'subMsg' => 'sub_msg',
'outTradeNo' => 'out_trade_no',
'qrCode' => 'qr_code',
];
public function validate() {
Model::validateRequired('httpBody', $this->httpBody, true);
Model::validateRequired('code', $this->code, true);
Model::validateRequired('msg', $this->msg, true);
Model::validateRequired('subCode', $this->subCode, true);
Model::validateRequired('subMsg', $this->subMsg, true);
Model::validateRequired('outTradeNo', $this->outTradeNo, true);
Model::validateRequired('qrCode', $this->qrCode, true);
}
public function toMap() {
$res = [];
if (null !== $this->httpBody) {
$res['http_body'] = $this->httpBody;
}
if (null !== $this->code) {
$res['code'] = $this->code;
}
if (null !== $this->msg) {
$res['msg'] = $this->msg;
}
if (null !== $this->subCode) {
$res['sub_code'] = $this->subCode;
}
if (null !== $this->subMsg) {
$res['sub_msg'] = $this->subMsg;
}
if (null !== $this->outTradeNo) {
$res['out_trade_no'] = $this->outTradeNo;
}
if (null !== $this->qrCode) {
$res['qr_code'] = $this->qrCode;
}
return $res;
}
/**
* @param array $map
* @return AlipayTradePrecreateResponse
*/
public static function fromMap($map = []) {
$model = new self();
if(isset($map['http_body'])){
$model->httpBody = $map['http_body'];
}
if(isset($map['code'])){
$model->code = $map['code'];
}
if(isset($map['msg'])){
$model->msg = $map['msg'];
}
if(isset($map['sub_code'])){
$model->subCode = $map['sub_code'];
}
if(isset($map['sub_msg'])){
$model->subMsg = $map['sub_msg'];
}
if(isset($map['out_trade_no'])){
$model->outTradeNo = $map['out_trade_no'];
}
if(isset($map['qr_code'])){
$model->qrCode = $map['qr_code'];
}
return $model;
}
/**
* @description 响应原始字符串
* @var string
*/
public $httpBody;
/**
* @var string
*/
public $code;
/**
* @var string
*/
public $msg;
/**
* @var string
*/
public $subCode;
/**
* @var string
*/
public $subMsg;
/**
* @var string
*/
public $outTradeNo;
/**
* @var string
*/
public $qrCode;
}
@@ -0,0 +1,77 @@
<?php
// This file is auto-generated, don't edit it. Thanks.
namespace Alipay\EasySDK\Payment\FaceToFace\Models;
use AlibabaCloud\Tea\Model;
class TradeFundBill extends Model {
protected $_name = [
'fundChannel' => 'fund_channel',
'bankCode' => 'bank_code',
'amount' => 'amount',
'realAmount' => 'real_amount',
];
public function validate() {
Model::validateRequired('fundChannel', $this->fundChannel, true);
Model::validateRequired('bankCode', $this->bankCode, true);
Model::validateRequired('amount', $this->amount, true);
Model::validateRequired('realAmount', $this->realAmount, true);
}
public function toMap() {
$res = [];
if (null !== $this->fundChannel) {
$res['fund_channel'] = $this->fundChannel;
}
if (null !== $this->bankCode) {
$res['bank_code'] = $this->bankCode;
}
if (null !== $this->amount) {
$res['amount'] = $this->amount;
}
if (null !== $this->realAmount) {
$res['real_amount'] = $this->realAmount;
}
return $res;
}
/**
* @param array $map
* @return TradeFundBill
*/
public static function fromMap($map = []) {
$model = new self();
if(isset($map['fund_channel'])){
$model->fundChannel = $map['fund_channel'];
}
if(isset($map['bank_code'])){
$model->bankCode = $map['bank_code'];
}
if(isset($map['amount'])){
$model->amount = $map['amount'];
}
if(isset($map['real_amount'])){
$model->realAmount = $map['real_amount'];
}
return $model;
}
/**
* @var string
*/
public $fundChannel;
/**
* @var string
*/
public $bankCode;
/**
* @var string
*/
public $amount;
/**
* @var string
*/
public $realAmount;
}
@@ -0,0 +1,168 @@
<?php
// This file is auto-generated, don't edit it. Thanks.
namespace Alipay\EasySDK\Payment\FaceToFace\Models;
use AlibabaCloud\Tea\Model;
class VoucherDetail extends Model {
protected $_name = [
'id' => 'id',
'name' => 'name',
'type' => 'type',
'amount' => 'amount',
'merchantContribute' => 'merchant_contribute',
'otherContribute' => 'other_contribute',
'memo' => 'memo',
'templateId' => 'template_id',
'purchaseBuyerContribute' => 'purchase_buyer_contribute',
'purchaseMerchantContribute' => 'purchase_merchant_contribute',
'purchaseAntContribute' => 'purchase_ant_contribute',
];
public function validate() {
Model::validateRequired('id', $this->id, true);
Model::validateRequired('name', $this->name, true);
Model::validateRequired('type', $this->type, true);
Model::validateRequired('amount', $this->amount, true);
Model::validateRequired('merchantContribute', $this->merchantContribute, true);
Model::validateRequired('otherContribute', $this->otherContribute, true);
Model::validateRequired('memo', $this->memo, true);
Model::validateRequired('templateId', $this->templateId, true);
Model::validateRequired('purchaseBuyerContribute', $this->purchaseBuyerContribute, true);
Model::validateRequired('purchaseMerchantContribute', $this->purchaseMerchantContribute, true);
Model::validateRequired('purchaseAntContribute', $this->purchaseAntContribute, true);
}
public function toMap() {
$res = [];
if (null !== $this->id) {
$res['id'] = $this->id;
}
if (null !== $this->name) {
$res['name'] = $this->name;
}
if (null !== $this->type) {
$res['type'] = $this->type;
}
if (null !== $this->amount) {
$res['amount'] = $this->amount;
}
if (null !== $this->merchantContribute) {
$res['merchant_contribute'] = $this->merchantContribute;
}
if (null !== $this->otherContribute) {
$res['other_contribute'] = $this->otherContribute;
}
if (null !== $this->memo) {
$res['memo'] = $this->memo;
}
if (null !== $this->templateId) {
$res['template_id'] = $this->templateId;
}
if (null !== $this->purchaseBuyerContribute) {
$res['purchase_buyer_contribute'] = $this->purchaseBuyerContribute;
}
if (null !== $this->purchaseMerchantContribute) {
$res['purchase_merchant_contribute'] = $this->purchaseMerchantContribute;
}
if (null !== $this->purchaseAntContribute) {
$res['purchase_ant_contribute'] = $this->purchaseAntContribute;
}
return $res;
}
/**
* @param array $map
* @return VoucherDetail
*/
public static function fromMap($map = []) {
$model = new self();
if(isset($map['id'])){
$model->id = $map['id'];
}
if(isset($map['name'])){
$model->name = $map['name'];
}
if(isset($map['type'])){
$model->type = $map['type'];
}
if(isset($map['amount'])){
$model->amount = $map['amount'];
}
if(isset($map['merchant_contribute'])){
$model->merchantContribute = $map['merchant_contribute'];
}
if(isset($map['other_contribute'])){
$model->otherContribute = $map['other_contribute'];
}
if(isset($map['memo'])){
$model->memo = $map['memo'];
}
if(isset($map['template_id'])){
$model->templateId = $map['template_id'];
}
if(isset($map['purchase_buyer_contribute'])){
$model->purchaseBuyerContribute = $map['purchase_buyer_contribute'];
}
if(isset($map['purchase_merchant_contribute'])){
$model->purchaseMerchantContribute = $map['purchase_merchant_contribute'];
}
if(isset($map['purchase_ant_contribute'])){
$model->purchaseAntContribute = $map['purchase_ant_contribute'];
}
return $model;
}
/**
* @var string
*/
public $id;
/**
* @var string
*/
public $name;
/**
* @var string
*/
public $type;
/**
* @var string
*/
public $amount;
/**
* @var string
*/
public $merchantContribute;
/**
* @var string
*/
public $otherContribute;
/**
* @var string
*/
public $memo;
/**
* @var string
*/
public $templateId;
/**
* @var string
*/
public $purchaseBuyerContribute;
/**
* @var string
*/
public $purchaseMerchantContribute;
/**
* @var string
*/
public $purchaseAntContribute;
}
@@ -0,0 +1,202 @@
<?php
// This file is auto-generated, don't edit it. Thanks.
namespace Alipay\EasySDK\Payment\Huabei;
use Alipay\EasySDK\Kernel\EasySDKKernel;
use AlibabaCloud\Tea\Tea;
use AlibabaCloud\Tea\Request;
use AlibabaCloud\Tea\Exception\TeaError;
use \Exception;
use AlibabaCloud\Tea\Exception\TeaUnableRetryError;
use Alipay\EasySDK\Payment\Huabei\Models\HuabeiConfig;
use Alipay\EasySDK\Payment\Huabei\Models\AlipayTradeCreateResponse;
use AlibabaCloud\Tea\Response;
class Client {
protected $_kernel;
public function __construct($kernel){
$this->_kernel = $kernel;
}
/**
* @param string $subject
* @param string $outTradeNo
* @param string $totalAmount
* @param string $buyerId
* @param HuabeiConfig $extendParams
* @return AlipayTradeCreateResponse
* @throws TeaError
* @throws Exception
* @throws TeaUnableRetryError
*/
public function create($subject, $outTradeNo, $totalAmount, $buyerId, $extendParams){
$extendParams->validate();
$_runtime = [
"ignoreSSL" => $this->_kernel->getConfig("ignoreSSL"),
"httpProxy" => $this->_kernel->getConfig("httpProxy"),
"connectTimeout" => 15000,
"readTimeout" => 15000,
"retry" => [
"maxAttempts" => 0
]
];
$_lastRequest = null;
$_lastException = null;
$_now = time();
$_retryTimes = 0;
while (Tea::allowRetry(@$_runtime["retry"], $_retryTimes, $_now)) {
if ($_retryTimes > 0) {
$_backoffTime = Tea::getBackoffTime(@$_runtime["backoff"], $_retryTimes);
if ($_backoffTime > 0) {
Tea::sleep($_backoffTime);
}
}
$_retryTimes = $_retryTimes + 1;
try {
$_request = new Request();
$systemParams = [
"method" => "alipay.trade.create",
"app_id" => $this->_kernel->getConfig("appId"),
"timestamp" => $this->_kernel->getTimestamp(),
"format" => "json",
"version" => "1.0",
"alipay_sdk" => $this->_kernel->getSdkVersion(),
"charset" => "UTF-8",
"sign_type" => $this->_kernel->getConfig("signType"),
"app_cert_sn" => $this->_kernel->getMerchantCertSN(),
"alipay_root_cert_sn" => $this->_kernel->getAlipayRootCertSN()
];
$bizParams = [
"subject" => $subject,
"out_trade_no" => $outTradeNo,
"total_amount" => $totalAmount,
"buyer_id" => $buyerId,
"extend_params" => $extendParams
];
$textParams = [];
$_request->protocol = $this->_kernel->getConfig("protocol");
$_request->method = "POST";
$_request->pathname = "/gateway.do";
$_request->headers = [
"host" => $this->_kernel->getConfig("gatewayHost"),
"content-type" => "application/x-www-form-urlencoded;charset=utf-8"
];
$_request->query = $this->_kernel->sortMap(Tea::merge([
"sign" => $this->_kernel->sign($systemParams, $bizParams, $textParams, $this->_kernel->getConfig("merchantPrivateKey"))
], $systemParams, $textParams));
$_request->body = $this->_kernel->toUrlEncodedRequestBody($bizParams);
$_lastRequest = $_request;
$_response= Tea::send($_request, $_runtime);
$respMap = $this->_kernel->readAsJson($_response, "alipay.trade.create");
if ($this->_kernel->isCertMode()) {
if ($this->_kernel->verify($respMap, $this->_kernel->extractAlipayPublicKey($this->_kernel->getAlipayCertSN($respMap)))) {
return AlipayTradeCreateResponse::fromMap($this->_kernel->toRespModel($respMap));
}
}
else {
if ($this->_kernel->verify($respMap, $this->_kernel->getConfig("alipayPublicKey"))) {
return AlipayTradeCreateResponse::fromMap($this->_kernel->toRespModel($respMap));
}
}
throw new TeaError([
"message" => "验签失败,请检查支付宝公钥设置是否正确。"
]);
}
catch (Exception $e) {
if (!($e instanceof TeaError)) {
$e = new TeaError([], $e->getMessage(), $e->getCode(), $e);
}
if (Tea::isRetryable($e)) {
$_lastException = $e;
continue;
}
throw $e;
}
}
throw new TeaUnableRetryError($_lastRequest, $_lastException);
}
/**
* ISV代商户代用,指定appAuthToken
*
* @param $appAuthToken String 代调用token
* @return $this 本客户端,便于链式调用
*/
public function agent($appAuthToken)
{
$this->_kernel->injectTextParam("app_auth_token", $appAuthToken);
return $this;
}
/**
* 用户授权调用,指定authToken
*
* @param $authToken String 用户授权token
* @return $this
*/
public function auth($authToken)
{
$this->_kernel->injectTextParam("auth_token", $authToken);
return $this;
}
/**
* 设置异步通知回调地址,此处设置将在本调用中覆盖Config中的全局配置
*
* @param $url String 异步通知回调地址,例如:https://www.test.com/callback
* @return $this
*/
public function asyncNotify($url)
{
$this->_kernel->injectTextParam("notify_url", $url);
return $this;
}
/**
* 将本次调用强制路由到后端系统的测试地址上,常用于线下环境内外联调,沙箱与线上环境设置无效
*
* @param $testUrl String 后端系统测试地址
* @return $this
*/
public function route($testUrl)
{
$this->_kernel->injectTextParam("ws_service_url", $testUrl);
return $this;
}
/**
* 设置API入参中没有的其他可选业务请求参数(biz_content下的字段)
*
* @param $key String 业务请求参数名称(biz_content下的字段名,比如timeout_express)
* @param $value object 业务请求参数的值,一个可以序列化成JSON的对象
* 如果该字段是一个字符串类型(String、Price、Date在SDK中都是字符串),请使用String储存
* 如果该字段是一个数值型类型(比如:Number),请使用Long储存
* 如果该字段是一个复杂类型,请使用嵌套的array指定各下级字段的值
* 如果该字段是一个数组,请使用array储存各个值
* @return $this
*/
public function optional($key, $value)
{
$this->_kernel->injectBizParam($key, $value);
return $this;
}
/**
* 批量设置API入参中没有的其他可选业务请求参数(biz_content下的字段)
* optional方法的批量版本
*
* @param $optionalArgs array 可选参数集合,每个参数由key和value组成,key和value的格式请参见optional方法的注释
* @return $this
*/
public function batchOptional($optionalArgs)
{
foreach ($optionalArgs as $key => $value) {
$this->_kernel->injectBizParam($key, $value);
}
return $this;
}
}
@@ -0,0 +1,117 @@
<?php
// This file is auto-generated, don't edit it. Thanks.
namespace Alipay\EasySDK\Payment\Huabei\Models;
use AlibabaCloud\Tea\Model;
class AlipayTradeCreateResponse extends Model {
protected $_name = [
'httpBody' => 'http_body',
'code' => 'code',
'msg' => 'msg',
'subCode' => 'sub_code',
'subMsg' => 'sub_msg',
'outTradeNo' => 'out_trade_no',
'tradeNo' => 'trade_no',
];
public function validate() {
Model::validateRequired('httpBody', $this->httpBody, true);
Model::validateRequired('code', $this->code, true);
Model::validateRequired('msg', $this->msg, true);
Model::validateRequired('subCode', $this->subCode, true);
Model::validateRequired('subMsg', $this->subMsg, true);
Model::validateRequired('outTradeNo', $this->outTradeNo, true);
Model::validateRequired('tradeNo', $this->tradeNo, true);
}
public function toMap() {
$res = [];
if (null !== $this->httpBody) {
$res['http_body'] = $this->httpBody;
}
if (null !== $this->code) {
$res['code'] = $this->code;
}
if (null !== $this->msg) {
$res['msg'] = $this->msg;
}
if (null !== $this->subCode) {
$res['sub_code'] = $this->subCode;
}
if (null !== $this->subMsg) {
$res['sub_msg'] = $this->subMsg;
}
if (null !== $this->outTradeNo) {
$res['out_trade_no'] = $this->outTradeNo;
}
if (null !== $this->tradeNo) {
$res['trade_no'] = $this->tradeNo;
}
return $res;
}
/**
* @param array $map
* @return AlipayTradeCreateResponse
*/
public static function fromMap($map = []) {
$model = new self();
if(isset($map['http_body'])){
$model->httpBody = $map['http_body'];
}
if(isset($map['code'])){
$model->code = $map['code'];
}
if(isset($map['msg'])){
$model->msg = $map['msg'];
}
if(isset($map['sub_code'])){
$model->subCode = $map['sub_code'];
}
if(isset($map['sub_msg'])){
$model->subMsg = $map['sub_msg'];
}
if(isset($map['out_trade_no'])){
$model->outTradeNo = $map['out_trade_no'];
}
if(isset($map['trade_no'])){
$model->tradeNo = $map['trade_no'];
}
return $model;
}
/**
* @description 响应原始字符串
* @var string
*/
public $httpBody;
/**
* @var string
*/
public $code;
/**
* @var string
*/
public $msg;
/**
* @var string
*/
public $subCode;
/**
* @var string
*/
public $subMsg;
/**
* @var string
*/
public $outTradeNo;
/**
* @var string
*/
public $tradeNo;
}
@@ -0,0 +1,51 @@
<?php
// This file is auto-generated, don't edit it. Thanks.
namespace Alipay\EasySDK\Payment\Huabei\Models;
use AlibabaCloud\Tea\Model;
class HuabeiConfig extends Model {
protected $_name = [
'hbFqNum' => 'hb_fq_num',
'hbFqSellerPercent' => 'hb_fq_seller_percent',
];
public function validate() {
Model::validateRequired('hbFqNum', $this->hbFqNum, true);
Model::validateRequired('hbFqSellerPercent', $this->hbFqSellerPercent, true);
}
public function toMap() {
$res = [];
if (null !== $this->hbFqNum) {
$res['hb_fq_num'] = $this->hbFqNum;
}
if (null !== $this->hbFqSellerPercent) {
$res['hb_fq_seller_percent'] = $this->hbFqSellerPercent;
}
return $res;
}
/**
* @param array $map
* @return HuabeiConfig
*/
public static function fromMap($map = []) {
$model = new self();
if(isset($map['hb_fq_num'])){
$model->hbFqNum = $map['hb_fq_num'];
}
if(isset($map['hb_fq_seller_percent'])){
$model->hbFqSellerPercent = $map['hb_fq_seller_percent'];
}
return $model;
}
/**
* @var string
*/
public $hbFqNum;
/**
* @var string
*/
public $hbFqSellerPercent;
}
@@ -0,0 +1,133 @@
<?php
// This file is auto-generated, don't edit it. Thanks.
namespace Alipay\EasySDK\Payment\Page;
use Alipay\EasySDK\Kernel\EasySDKKernel;
use Alipay\EasySDK\Payment\Page\Models\AlipayTradePagePayResponse;
class Client {
protected $_kernel;
public function __construct($kernel){
$this->_kernel = $kernel;
}
/**
* @param string $subject
* @param string $outTradeNo
* @param string $totalAmount
* @param string $returnUrl
* @return AlipayTradePagePayResponse
*/
public function pay($subject, $outTradeNo, $totalAmount, $returnUrl){
$systemParams = [
"method" => "alipay.trade.page.pay",
"app_id" => $this->_kernel->getConfig("appId"),
"timestamp" => $this->_kernel->getTimestamp(),
"format" => "json",
"version" => "1.0",
"alipay_sdk" => $this->_kernel->getSdkVersion(),
"charset" => "UTF-8",
"sign_type" => $this->_kernel->getConfig("signType"),
"app_cert_sn" => $this->_kernel->getMerchantCertSN(),
"alipay_root_cert_sn" => $this->_kernel->getAlipayRootCertSN()
];
$bizParams = [
"subject" => $subject,
"out_trade_no" => $outTradeNo,
"total_amount" => $totalAmount,
"product_code" => "FAST_INSTANT_TRADE_PAY"
];
$textParams = [
"return_url" => $returnUrl
];
$sign = $this->_kernel->sign($systemParams, $bizParams, $textParams, $this->_kernel->getConfig("merchantPrivateKey"));
$response = [
"body" => $this->_kernel->generatePage("POST", $systemParams, $bizParams, $textParams, $sign)
];
return AlipayTradePagePayResponse::fromMap($response);
}
/**
* ISV代商户代用,指定appAuthToken
*
* @param $appAuthToken String 代调用token
* @return $this 本客户端,便于链式调用
*/
public function agent($appAuthToken)
{
$this->_kernel->injectTextParam("app_auth_token", $appAuthToken);
return $this;
}
/**
* 用户授权调用,指定authToken
*
* @param $authToken String 用户授权token
* @return $this
*/
public function auth($authToken)
{
$this->_kernel->injectTextParam("auth_token", $authToken);
return $this;
}
/**
* 设置异步通知回调地址,此处设置将在本调用中覆盖Config中的全局配置
*
* @param $url String 异步通知回调地址,例如:https://www.test.com/callback
* @return $this
*/
public function asyncNotify($url)
{
$this->_kernel->injectTextParam("notify_url", $url);
return $this;
}
/**
* 将本次调用强制路由到后端系统的测试地址上,常用于线下环境内外联调,沙箱与线上环境设置无效
*
* @param $testUrl String 后端系统测试地址
* @return $this
*/
public function route($testUrl)
{
$this->_kernel->injectTextParam("ws_service_url", $testUrl);
return $this;
}
/**
* 设置API入参中没有的其他可选业务请求参数(biz_content下的字段)
*
* @param $key String 业务请求参数名称(biz_content下的字段名,比如timeout_express)
* @param $value object 业务请求参数的值,一个可以序列化成JSON的对象
* 如果该字段是一个字符串类型(String、Price、Date在SDK中都是字符串),请使用String储存
* 如果该字段是一个数值型类型(比如:Number),请使用Long储存
* 如果该字段是一个复杂类型,请使用嵌套的array指定各下级字段的值
* 如果该字段是一个数组,请使用array储存各个值
* @return $this
*/
public function optional($key, $value)
{
$this->_kernel->injectBizParam($key, $value);
return $this;
}
/**
* 批量设置API入参中没有的其他可选业务请求参数(biz_content下的字段)
* optional方法的批量版本
*
* @param $optionalArgs array 可选参数集合,每个参数由key和value组成,key和value的格式请参见optional方法的注释
* @return $this
*/
public function batchOptional($optionalArgs)
{
foreach ($optionalArgs as $key => $value) {
$this->_kernel->injectBizParam($key, $value);
}
return $this;
}
}
@@ -0,0 +1,39 @@
<?php
// This file is auto-generated, don't edit it. Thanks.
namespace Alipay\EasySDK\Payment\Page\Models;
use AlibabaCloud\Tea\Model;
class AlipayTradePagePayResponse extends Model {
protected $_name = [
'body' => 'body',
];
public function validate() {
Model::validateRequired('body', $this->body, true);
}
public function toMap() {
$res = [];
if (null !== $this->body) {
$res['body'] = $this->body;
}
return $res;
}
/**
* @param array $map
* @return AlipayTradePagePayResponse
*/
public static function fromMap($map = []) {
$model = new self();
if(isset($map['body'])){
$model->body = $map['body'];
}
return $model;
}
/**
* @description 订单信息,Form表单形式
* @var string
*/
public $body;
}
@@ -0,0 +1,135 @@
<?php
// This file is auto-generated, don't edit it. Thanks.
namespace Alipay\EasySDK\Payment\Wap;
use Alipay\EasySDK\Kernel\EasySDKKernel;
use Alipay\EasySDK\Payment\Wap\Models\AlipayTradeWapPayResponse;
class Client {
protected $_kernel;
public function __construct($kernel){
$this->_kernel = $kernel;
}
/**
* @param string $subject
* @param string $outTradeNo
* @param string $totalAmount
* @param string $quitUrl
* @param string $returnUrl
* @return AlipayTradeWapPayResponse
*/
public function pay($subject, $outTradeNo, $totalAmount, $quitUrl, $returnUrl){
$systemParams = [
"method" => "alipay.trade.wap.pay",
"app_id" => $this->_kernel->getConfig("appId"),
"timestamp" => $this->_kernel->getTimestamp(),
"format" => "json",
"version" => "1.0",
"alipay_sdk" => $this->_kernel->getSdkVersion(),
"charset" => "UTF-8",
"sign_type" => $this->_kernel->getConfig("signType"),
"app_cert_sn" => $this->_kernel->getMerchantCertSN(),
"alipay_root_cert_sn" => $this->_kernel->getAlipayRootCertSN()
];
$bizParams = [
"subject" => $subject,
"out_trade_no" => $outTradeNo,
"total_amount" => $totalAmount,
"quit_url" => $quitUrl,
"product_code" => "QUICK_WAP_WAY"
];
$textParams = [
"return_url" => $returnUrl
];
$sign = $this->_kernel->sign($systemParams, $bizParams, $textParams, $this->_kernel->getConfig("merchantPrivateKey"));
$response = [
"body" => $this->_kernel->generatePage("POST", $systemParams, $bizParams, $textParams, $sign)
];
return AlipayTradeWapPayResponse::fromMap($response);
}
/**
* ISV代商户代用,指定appAuthToken
*
* @param $appAuthToken String 代调用token
* @return $this 本客户端,便于链式调用
*/
public function agent($appAuthToken)
{
$this->_kernel->injectTextParam("app_auth_token", $appAuthToken);
return $this;
}
/**
* 用户授权调用,指定authToken
*
* @param $authToken String 用户授权token
* @return $this
*/
public function auth($authToken)
{
$this->_kernel->injectTextParam("auth_token", $authToken);
return $this;
}
/**
* 设置异步通知回调地址,此处设置将在本调用中覆盖Config中的全局配置
*
* @param $url String 异步通知回调地址,例如:https://www.test.com/callback
* @return $this
*/
public function asyncNotify($url)
{
$this->_kernel->injectTextParam("notify_url", $url);
return $this;
}
/**
* 将本次调用强制路由到后端系统的测试地址上,常用于线下环境内外联调,沙箱与线上环境设置无效
*
* @param $testUrl String 后端系统测试地址
* @return $this
*/
public function route($testUrl)
{
$this->_kernel->injectTextParam("ws_service_url", $testUrl);
return $this;
}
/**
* 设置API入参中没有的其他可选业务请求参数(biz_content下的字段)
*
* @param $key String 业务请求参数名称(biz_content下的字段名,比如timeout_express)
* @param $value object 业务请求参数的值,一个可以序列化成JSON的对象
* 如果该字段是一个字符串类型(String、Price、Date在SDK中都是字符串),请使用String储存
* 如果该字段是一个数值型类型(比如:Number),请使用Long储存
* 如果该字段是一个复杂类型,请使用嵌套的array指定各下级字段的值
* 如果该字段是一个数组,请使用array储存各个值
* @return $this
*/
public function optional($key, $value)
{
$this->_kernel->injectBizParam($key, $value);
return $this;
}
/**
* 批量设置API入参中没有的其他可选业务请求参数(biz_content下的字段)
* optional方法的批量版本
*
* @param $optionalArgs array 可选参数集合,每个参数由key和value组成,key和value的格式请参见optional方法的注释
* @return $this
*/
public function batchOptional($optionalArgs)
{
foreach ($optionalArgs as $key => $value) {
$this->_kernel->injectBizParam($key, $value);
}
return $this;
}
}
@@ -0,0 +1,39 @@
<?php
// This file is auto-generated, don't edit it. Thanks.
namespace Alipay\EasySDK\Payment\Wap\Models;
use AlibabaCloud\Tea\Model;
class AlipayTradeWapPayResponse extends Model {
protected $_name = [
'body' => 'body',
];
public function validate() {
Model::validateRequired('body', $this->body, true);
}
public function toMap() {
$res = [];
if (null !== $this->body) {
$res['body'] = $this->body;
}
return $res;
}
/**
* @param array $map
* @return AlipayTradeWapPayResponse
*/
public static function fromMap($map = []) {
$model = new self();
if(isset($map['body'])){
$model->body = $map['body'];
}
return $model;
}
/**
* @description 订单信息,Form表单形式
* @var string
*/
public $body;
}