//返回的全部参数
Array
(
[unitPrice] => 1
[orderId] => 81245245184095
[payTime] => 1569117532
[dealId] => 3574001498
[tpOrderId] => 201909220958408776
[count] => 1
[totalMoney] => 1
[hbBalanceMoney] => 0
[userId] => 1443238249
[promoMoney] => 0
[promoDetail] =>
[hbMoney] => 0
[giftCardMoney] => 0
[payMoney] => 1
[payType] => 1087
[returnData] => {"bizKey1":"0.01","bizKey2":"201909220958408776"}
[partnerId] => 0
[rsaSign] => Xjk8o3s5Jkib5aAmenu2zo/pqedTSbrN1I0iCcvbUrsRhzcjzDaoG5ddGe2Kkj1xlOuePG6LRc/Rp4rqgFz0ytenacOCkDHi2SXhELPgQDhhDtXCD/PgPXFBfaNIA70ASRSpPnXvRwpjUbWIiDjDigmV37icTP1qnwtRUpmfTX8=
[status] => 2
)
//去除rsaSign后的参数
Array
(
[unitPrice] => 1
[orderId] => 81245245184095
[payTime] => 1569117532
[dealId] => 3574001498
[tpOrderId] => 201909220958408776
[count] => 1
[totalMoney] => 1
[hbBalanceMoney] => 0
[userId] => 1443238249
[promoMoney] => 0
[promoDetail] =>
[hbMoney] => 0
[giftCardMoney] => 0
[payMoney] => 1
[payType] => 1087
[returnData] => {"bizKey1":"0.01","bizKey2":"201909220958408776"}
[partnerId] => 0
[status] => 2
)
//重新签名
dfMOLPin4+5L/DzPnkwhqDzxAdeELa3eRlH1dn0SUPUyUPY5Ui7tdAwSsXxnUn435c+WAdBq7miL1LmZjD/t6ZgivFxXSLEvSc/kp0eUgZ07lA7+gJLoQj/l17/U76sB4Q1AOb3YFZOf0OH2EJGRGx+k2Oy8G1VnR8RpNzI8qZE=
代码也是用的官方提供的sdk,发起支付这些步骤都正常:
$temp = json_decode($post,true);
print_r($temp);
$returnData = json_decode($temp["returnData"],true);
foreach ($returnData as $key => &$value) {
$value = urlencode($value);
}
$temp["returnData"] = json_encode($returnData);
// echo(mb_detect_encoding($temp["returnData"],['UTF-8']));
// unset($temp["returnData"]);
$rsaSign = $temp["rsaSign"];
unset($temp["rsaSign"]);
echo "\n";
print_r($temp);
// 第一步:获取签名和支付参数
import('nomi.Autoloader', EXTEND_PATH);
$rsaPrivateKeyFilePath = 'rsa/rsa_private_key.pem';
$rsaPublicKeyFilePath = 'rsa/rsa_public_key.pem';
if( !file_exists($rsaPrivateKeyFilePath) || !is_readable($rsaPrivateKeyFilePath) ||
!file_exists($rsaPublicKeyFilePath) || !is_readable($rsaPublicKeyFilePath) ){
return false;
}
$rsaPrivateKeyStr = file_get_contents($rsaPrivateKeyFilePath);
$rsaPublicKeyStr = file_get_contents($rsaPublicKeyFilePath);
$requestParamsArr = $temp;
$requestParamsArr['sign'] = $rsaSign;
$checkSignRes = \NuomiRsaSign::checkSignWithRsa($requestParamsArr, $rsaPublicKeyStr);
var_dump($checkSignRes);
$rsaSign = \NuomiRsaSign::genSignWithRsa($requestParamsArr, $rsaPrivateKeyStr);
echo $rsaSign;
echo "\n";
$requestParamsArr['sign'] = $rsaSign;
$checkSignRes = \NuomiRsaSign::checkSignWithRsa($requestParamsArr, $rsaPublicKeyStr);
var_dump($checkSignRes);