支付bug

This commit is contained in:
wangjinlei
2025-11-26 17:39:35 +08:00
parent f7641d4654
commit b8dc9ded3a
3 changed files with 94 additions and 66 deletions

View File

@@ -998,27 +998,54 @@ function aliemail($email,$title,$content,$has_hb=1){
return $res;
}
function paystationLookup($transactionId){
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.paystation.co.nz/v1/transactions/'.$transactionId,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Authorization: Bearer '.createPayStationToken()
)
));
$response = curl_exec($curl);
curl_close($curl);
//function paystationLookup($transactionId){
// $curl = curl_init();
// curl_setopt_array($curl, array(
// CURLOPT_URL => 'https://api.paystation.co.nz/v1/transactions/'.$transactionId,
// CURLOPT_RETURNTRANSFER => true,
// CURLOPT_ENCODING => '',
// CURLOPT_MAXREDIRS => 10,
// CURLOPT_TIMEOUT => 0,
// CURLOPT_FOLLOWLOCATION => true,
// CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
// CURLOPT_CUSTOMREQUEST => 'GET',
// CURLOPT_HTTPHEADER => array(
// 'Content-Type: application/json',
// 'Authorization: Bearer '.createPayStationToken()
// )
// ));
// $response = curl_exec($curl);
// curl_close($curl);
// return $response;
//}
function paystationLookup($ms){
$url = "https://payments.paystation.co.nz/lookup/";
$time = time();
$params = [
"pi" => "616562",
"ms" => $ms,
"pstn_HMACTimestamp" => $time
];
$secret_key = Env::get("paystation.hmac");// 使用提供的HMAC认证密钥
$query_string = http_build_query($params);
$hmac_signature = hash_hmac('sha256', $time."paystation".$query_string,$secret_key);
$params["pstn_HMAC"] = $hmac_signature;
$url_with_params = $url . '?' . http_build_query($params);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url_with_params);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
if(curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
curl_close($ch);
return $response;
}
function createPayStationToken(){
$bodyParams = [
'client_id' => Env::get("paystation.client_id"),