|
@@ -35,19 +35,10 @@ class OriginBank
|
|
|
'JSAPI'=>1
|
|
|
];
|
|
|
|
|
|
- dump($data);
|
|
|
$base_data['data'] = $this->encrypt(json_encode($data),$this->open_key);
|
|
|
- dump($data);
|
|
|
-
|
|
|
- dump($this->decrypt($base_data['data'],$this->open_key));
|
|
|
$base_data['sign'] = $this->signs($base_data);
|
|
|
|
|
|
- dump('base_data');dump($base_data);
|
|
|
-
|
|
|
$response = $this->PayClient->request('POST','/mct1/payorder',['form_params'=>$base_data])->getBody()->getContents();
|
|
|
- dump($this->decrypt(json_decode($response,1)['data'],$this->open_key));
|
|
|
-
|
|
|
- dd($this->getPayInfo($response));
|
|
|
return $this->getPayInfo($response);
|
|
|
}
|
|
|
|
|
@@ -55,14 +46,11 @@ class OriginBank
|
|
|
{
|
|
|
try{
|
|
|
$return_info = json_decode($response,1);
|
|
|
- dump($return_info);
|
|
|
if($return_info['errcode'] == 0)
|
|
|
{
|
|
|
$data = json_decode($this->decrypt($return_info['data'],$this->open_key,true),true);
|
|
|
- dump($data);
|
|
|
$trade_result = json_decode($data['trade_result'],true);
|
|
|
$wc_pay_data = json_decode($trade_result['wc_pay_data'],true);
|
|
|
- dump($trade_result);
|
|
|
$pay_info = [
|
|
|
'appId'=>$wc_pay_data['appId'],
|
|
|
'timeStamp'=>$wc_pay_data['timeStamp'],
|
|
@@ -76,6 +64,7 @@ class OriginBank
|
|
|
}catch (\Exception $e)
|
|
|
{
|
|
|
echo $e->getMessage();
|
|
|
+ Log::error($response);
|
|
|
return null;
|
|
|
}
|
|
|
|
|
@@ -110,44 +99,6 @@ class OriginBank
|
|
|
return $data;
|
|
|
}
|
|
|
|
|
|
- public function encrypt3($key, $iv, $data)
|
|
|
- {
|
|
|
- /**
|
|
|
- * 打开加密
|
|
|
- */
|
|
|
- $td = @mcrypt_module_open(MCRYPT_RIJNDAEL_128, "", MCRYPT_MODE_CBC, "");
|
|
|
- /**
|
|
|
- * 初始化加密
|
|
|
- */
|
|
|
- @mcrypt_generic_init($td, $key, $iv);
|
|
|
- /**
|
|
|
- * 加密
|
|
|
- */
|
|
|
- $encrypted = @mcrypt_generic($td, $data);
|
|
|
- /**
|
|
|
- * 清理加密
|
|
|
- */
|
|
|
- @mcrypt_generic_deinit($td);
|
|
|
- /**
|
|
|
- * 关闭
|
|
|
- */
|
|
|
- @mcrypt_module_close($td);
|
|
|
- return base64_encode($encrypted);
|
|
|
- }
|
|
|
-
|
|
|
- public function encrypt2($input, $key)
|
|
|
- {
|
|
|
- $data = openssl_encrypt($input, 'AES-128-ECB', $key, OPENSSL_RAW_DATA);
|
|
|
- $data = base64_encode($data);
|
|
|
- return $data;
|
|
|
- }
|
|
|
-
|
|
|
- public function decrypt2($sStr, $sKey)
|
|
|
- {
|
|
|
- $decrypted = openssl_decrypt(base64_decode($sStr), 'AES-128-ECB', $sKey, OPENSSL_RAW_DATA);
|
|
|
- return $decrypted;
|
|
|
- }
|
|
|
-
|
|
|
private function pkcs5_pad ($text, $blocksize) {
|
|
|
$pad = $blocksize - (strlen($text) % $blocksize);
|
|
|
return $text . str_repeat(chr($pad), $pad);
|