更新
This commit is contained in:
@@ -20,7 +20,7 @@ class YunPay
|
||||
public $id_card;
|
||||
public $card_no;
|
||||
public $order_amount;
|
||||
public $notify_url = 'http://chat.qxmier.com/api/Payment/yun_callback';
|
||||
public $notify_url = 'https://md.xscmmidi.site/api/Payment/yun_callback';
|
||||
|
||||
public $phone = '';
|
||||
public $config;
|
||||
@@ -36,6 +36,7 @@ class YunPay
|
||||
$this->card_no = $card_no;
|
||||
$this->order_amount = $order_amount;
|
||||
$this->phone = $phone;
|
||||
$this->dealer_platform_name = "秘地";
|
||||
//读取配置
|
||||
$this->config = Config::newFromArray(array(
|
||||
'app_dealer_id' => $this->sys_config->dealer_id,
|
||||
@@ -47,7 +48,7 @@ class YunPay
|
||||
'sign_type' => $this->sys_config->sign_type
|
||||
));
|
||||
}
|
||||
public function alipay(){
|
||||
public function alipay($data=[]){
|
||||
try {
|
||||
$this->paymentClient = new PaymentClient($this->config);
|
||||
$this->paymentClient->setEnv(PaymentClient::ENV_PROD);
|
||||
@@ -66,7 +67,11 @@ class YunPay
|
||||
'pay_remark' => $this->remark, // 订单备注(选填,至多支持 40 个字符且不支持特殊字符,⼀个汉字占 2 个字符,不支持的特殊字符为 ' " & | @% ( ) - : # + / < > ¥ \ ,)
|
||||
'check_name' => 'Check', // 校验⽀付宝账户姓名(固定值 Check)
|
||||
'notify_url' => $this->notify_url, // 回调地址(选填,长度不超过 200 个字符)
|
||||
'project_id' => '' // 项目ID,该字段由云账户分配,当接口指定项目时,会将订单关联指定项目
|
||||
'project_id' => '', // 项目ID,该字段由云账户分配,当接口指定项目时,会将订单关联指定项目
|
||||
//9月新加
|
||||
'dealer_platform_name' => $this->dealer_platform_name, //互联网平台名称
|
||||
'dealer_user_nickname' => $data['nickname'] ?? "", //用户名称/昵称
|
||||
'dealer_user_id' => strval($data['user_id']) ?? "", //用户ID 用户唯一标识码
|
||||
));
|
||||
/*
|
||||
* request-id:请求 ID,请求的唯一标识
|
||||
@@ -200,18 +205,27 @@ class YunPay
|
||||
$request->setRequestID($request_id);
|
||||
$response = $this->paymentClient->getOrder($request);
|
||||
if ($response->isSuccess()) {
|
||||
// if(!empty($response->getData()->getTaxDetail())){
|
||||
// $personal_tax_rate = $response->getData()->getTaxDetail()->getPersonalTaxRate();
|
||||
// }else{
|
||||
// $personal_tax_rate = 0;
|
||||
// }
|
||||
// TODO 订单查询操作成功,根据订单状态 status 判断订单状态,做业务订单的处理
|
||||
if($response->getData()->getStatusDetail() == 0){
|
||||
return ['code' => 1, 'msg' => "订单状态:" . $response->getData()->getStatusMessage(), 'data' => [
|
||||
'code' => $response->getData()->getStatusDetail(),
|
||||
'msg' => $response->getData()->getStatusMessage(),
|
||||
// 'personal_tax_rate' => $personal_tax_rate,
|
||||
'received_tax_amount' => $response->getData()->getReceivedTaxAmount()
|
||||
|
||||
]];
|
||||
}else{
|
||||
return ['code' => 1, 'msg' => "订单状态:" . $response->getData()->getStatusDetailMessage(), 'data' => [
|
||||
'code' => $response->getData()->getStatusDetail(),
|
||||
'msg' => $response->getData()->getStatusDetailMessage(),
|
||||
]];
|
||||
// 'personal_tax_rate' => $personal_tax_rate,
|
||||
'received_tax_amount' => $response->getData()->getReceivedTaxAmount()
|
||||
]];
|
||||
}
|
||||
|
||||
} else if ($response->getCode() == '2018') {
|
||||
@@ -231,7 +245,7 @@ class YunPay
|
||||
$notifyReq = new NotifyRequest ($data, $mess, $timestamp, $sign) ;// 发起验签解密
|
||||
try {
|
||||
$result = $notifyClient->verifyAndDecrypt($notifyReq) ;
|
||||
Log::record("云账户回调信息-返回:".json_encode($result),"info");
|
||||
write_log_redis("云账户回调信息_解密返回",$result);
|
||||
$result = json_decode($result,true);
|
||||
if ($result['signRes']) {
|
||||
// 验签通过、解密成功
|
||||
|
||||
Reference in New Issue
Block a user