'3.0', 'acqSpId' => self::getConfig('customerCode'), 'merId' => $merId, 'backUrl' => $backUrl, 'certificateName' => $certificateName, 'lawyerCertType' => $lawyerCertType, 'lawyerCertNo' => $lawyerCertNo, 'lawyerCertPhotoFront' => $lawyerCertPhotoFront, 'lawyerCertPhotoBack' => $lawyerCertPhotoBack, 'certificateTo' => $certificateTo, 'contactPhone' => $contactPhone, 'accountType' => $accountType, 'canDownType' => $canDownType, ]; $sign = Signer::sign(json_encode($params)); return self::request($uri, $params, $sign); } public static function bindCard($params) { $memberId = $params['memberId'] ?? ''; $mchtOrderNo = $params['mchtOrderNo'] ?? StringHelper::generateOrderNo(); $userName = $params['userName'] ?? ''; $phoneNum = $params['phoneNum'] ?? ''; $bankCardNo = $params['bankCardNo'] ?? ''; $bankCardType = $params['bankCardType'] ?? ''; $certificatesNo = $params['certificatesNo'] ?? ''; $expired = $params['expired'] ?? ''; $cvn = $params['cvn'] ?? ''; $uri = '/api/txs/protocol/bindCard'; $params = [ 'version' => '2.0', 'customerCode' => self::getConfig('customerCode'), 'mchtOrderNo' => $mchtOrderNo, 'memberId' => $memberId, 'isSendIssuer' => true, 'userName' => Signer::publicEncrypt($userName), 'phoneNum' => Signer::publicEncrypt($phoneNum), 'bankCardNo' => Signer::publicEncrypt($bankCardNo), 'bankCardType' => $bankCardType, 'certificatesType' => '01', 'certificatesNo' => Signer::publicEncrypt($certificatesNo), 'nonceStr' => StringHelper::getRandomString(32), ]; if ($bankCardType == 'credit') { $params['expired'] = Signer::publicEncrypt($expired); $params['cvn'] = Signer::publicEncrypt($cvn); } $sign = Signer::sign(json_encode($params)); return self::request($uri, $params, $sign); } public static function bindCardConfirm($params) { $smsNo = $params['smsNo'] ?? ''; $smsCode = $params['smsCode'] ?? ''; $memberId = $params['memberId'] ?? ''; $uri = '/api/txs/protocol/bindCardConfirm'; $params = [ 'version' => '2.0', 'customerCode' => self::getConfig('customerCode'), 'smsNo' => $smsNo, 'memberId' => $memberId, 'smsCode' => $smsCode, 'nonceStr' => StringHelper::getRandomString(32), ]; $sign = Signer::sign(json_encode($params)); return self::request($uri, $params, $sign); } public static function unBindCard($params) { $protocol = $params['protocol'] ?? ''; $memberId = $params['memberId'] ?? ''; $uri = '/api/txs/protocol/unBindCard'; $params = [ 'version' => '2.0', 'customerCode' => self::getConfig('customerCode'), 'protocol' => $protocol, 'memberId' => $memberId, 'nonceStr' => StringHelper::getRandomString(32), ]; $sign = Signer::sign(json_encode($params)); return self::request($uri, $params, $sign); } public static function protocolPayPre($params) { $outTradeNo = $params['outTradeNo'] ?? StringHelper::generateOrderNo(); $protocol = $params['protocol'] ?? ''; $smsNo = $params['smsNo'] ?? ''; $smsCode = $params['smsCode'] ?? ''; $payAmount = $params['payAmount'] ?? 0; $orderInfo = []; $orderInfo['Id'] = $outTradeNo; $orderInfo['businessType'] = '130001'; $orderInfo['goodsList'] = [['name' => 'pay', 'number' => '1', 'amount' => $payAmount]]; $uri = '/api/txs/protocol/protocolPayPre'; $params = [ 'version' => '3.0', 'customerCode' => self::getConfig('customerCode'), 'outTradeNo' => $outTradeNo, 'orderInfo' => $orderInfo, 'payAmount' => $payAmount, 'payCurrency' => 'CNY', 'isInstalments' => 0, 'isSendSmsCode' => 2, 'notifyUrl' => env('WEB_HOST') . '/notify/payment', 'transactionStartTime' => date('YmdHis'), 'nonceStr' => StringHelper::getRandomString(32), ]; if ($protocol) { $params['protocol'] = $protocol; } else { $params['smsCode'] = $smsCode; $params['smsNo'] = $smsNo; } $sign = Signer::sign(json_encode($params)); return self::request($uri, $params, $sign); } public static function protocolPayConfirm($params) { $smsCode = $params['smsCode'] ?? ''; $protocol = $params['protocol'] ?? ''; $token = $params['token'] ?? ''; $uri = '/api/txs/protocol/protocolPayConfirm'; $params = [ 'version' => '3.0', 'customerCode' => self::getConfig('customerCode'), 'token' => $token, 'protocol' => $protocol, 'smsCode' => $smsCode, 'nonceStr' => StringHelper::getRandomString(32), ]; $sign = Signer::sign(json_encode($params)); return self::request($uri, $params, $sign); } public static function refund($params) { $uri = '/api/txs/pay/Refund/V2'; $outRefundNo = $params['outRefundNo'] ?? ''; $outTradeNo = $params['outTradeNo'] ?? ''; $refundAmount = $params['refundAmount'] ?? 0; $amount = $params['amount'] ?? 0; $remark = $params['remark'] ?? ''; $params = [ 'customerCode' => self::getConfig('customerCode'), 'outRefundNo' => $outRefundNo, 'outTradeNo' => $outTradeNo, 'refundAmount' => $refundAmount, 'amount' => $amount, 'remark' => $remark, 'notifyUrl' => env('WEB_HOST') . '/notify/refund', 'nonceStr' => StringHelper::getRandomString(32), ]; $sign = Signer::sign(json_encode($params)); return self::request($uri, $params, $sign); } public static function refundQuery($params) { $uri = '/api/txs/custPay/refundQuery'; $outRefundNo = $params['outRefundNo'] ?? ''; $params = [ 'customerCode' => self::getConfig('customerCode'), 'outRefundNo' => $outRefundNo, 'nonceStr' => StringHelper::getRandomString(32), ]; $sign = Signer::sign(json_encode($params)); return self::request($uri, $params, $sign); } public static function paymentQuery($params) { $uri = '/api/txs/pay/PaymentQuery'; $outTradeNo = $params['outTradeNo'] ?? ''; $params = [ 'customerCode' => self::getConfig('customerCode'), 'outTradeNo' => $outTradeNo, 'nonceStr' => StringHelper::getRandomString(32), ]; $sign = Signer::sign(json_encode($params)); return self::request($uri, $params, $sign); } public static function withdrawalToCard($params) { $bankUserName = $params['bankUserName'] ?? ''; $bankUserCert = $params['bankUserCert'] ?? ''; $bankCardNo = $params['bankCardNo'] ?? ''; $uri = '/api/txs/pay/withdrawalToCard'; $params = [ 'version' => '3.0', 'customerCode' => self::getConfig('customerCode'), 'outTradeNo' => time() . rand(1000, 9999), 'bankName' => '工商银行', 'amount' => 1, 'bankUserName' => Signer::publicEncrypt('饶丽秀'), 'bankUserCert' => Signer::publicEncrypt('350824199001045864'), 'bankCardNo' => Signer::publicEncrypt('6212261402022689613'), 'bankAccountType' => 2, 'payCurrency' => 'CNY', 'nonceStr' => StringHelper::getRandomString(32), ]; $sign = Signer::sign(json_encode($params)); return self::request($uri, $params, $sign); } }