云账户自动提现封装(支付宝加银行卡)

目录

1、支付宝自动提现代码

2、银行卡自动提现代码


 

1、支付宝自动提现代码

des3key = $des3key;$this->iv = $iv;}/*** 加密* @param  $value* @return */public function encrypt($value){$td = mcrypt_module_open(MCRYPT_3DES, '', $this->mode, '');$iv = substr($this->des3key, 0, 8);$value = $this->PaddingPKCS7($value);@mcrypt_generic_init($td, $this->des3key, $iv);$dec = mcrypt_generic($td, $value);$ret = base64_encode($dec);mcrypt_generic_deinit($td);mcrypt_module_close($td);return $ret;}/*** 解密* @param  $value* @return */public function decrypt($value){$td = mcrypt_module_open(MCRYPT_3DES, '', $this->mode, '');$iv = substr($this->des3key, 0, 8);@mcrypt_generic_init($td, $this->des3key, $iv);$ret = trim(mdecrypt_generic($td, base64_decode($value)));$ret = $this->UnPaddingPKCS7($ret);mcrypt_generic_deinit($td);mcrypt_module_close($td);return $ret;}private function PaddingPKCS7($data){$block_size = mcrypt_get_block_size('tripledes', $this->mode);$padding_char = $block_size - (strlen($data) % $block_size);$data .= str_repeat(chr($padding_char), $padding_char);return $data;}private function UnPaddingPKCS7($text){$pad = ord($text{strlen($text) - 1});if ($pad > strlen($text)) {return false;}if (strspn($text, chr($pad), strlen($text) - $pad) != $pad) {return false;}return substr($text, 0, -1 * $pad);}
}$info = ["order_id"   => "201910141637".time(),"dealer_id"  => "285114213","broker_id"  => "27532144","real_name"  => "张三","id_card"    => "342522188005052140","card_no"    => "13000000000","pay"        => "1.00","pay_remark" => "","check_name" => "NoCheck","notify_url" => "",
];$des3key         = 'hx4b3sdn32z22T3Q5n862v21';
$appkey          = "HFrn2i2W3Eo56m2Fh3I7XX34JAEKvwNk";
$json_data       = json_encode($info);$DesUtilsObj     = new DesUtils($des3key);
$data    = $DesUtilsObj->encrypt($json_data);$mess            = time();
$timestamp       = time();$key_sign       = "data=".$data."&mess=".$mess."×tamp=".$timestamp."&key=".$appkey;
$key_sign1       = "data=".$data."&mess=".$mess."&timestamp=".$timestamp."&key=".$appkey;$sign            = hash_hmac('sha256', $key_sign, $appkey);
$sign_type       = "sha256";$postUrl = 'https://api-jiesuan.yunzhanghu.com/api/payment/v1/order-alipay';
$postData = array('dealer-id'  => '28511713','request-id' => "20191015".time().time(),'data'       => $data,'mess'       => $mess,'timestamp'  => $timestamp,'sign'       => $sign,'sign_type'  => $sign_type,
);$header = ['Content-Type:application/x-www-form-urlencoded','dealer-id:28511713',
];
$postData = http_build_query($postData);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $postUrl);
curl_setopt($curl, CURLOPT_USERAGENT,'Opera/9.80 (Windows NT 6.2; Win64; x64) Presto/2.12.388 Version/12.15');
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); // stop verifying certificate
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
$r = curl_exec($curl);
curl_close($curl);
print_r($r);

2、银行卡自动提现代码

des3key = $des3key;$this->iv = $iv;}/*** 加密* @param  $value* @return */public function encrypt($value){$td = mcrypt_module_open(MCRYPT_3DES, '', $this->mode, '');$iv = substr($this->des3key, 0, 8);$value = $this->PaddingPKCS7($value);@mcrypt_generic_init($td, $this->des3key, $iv);$dec = mcrypt_generic($td, $value);$ret = base64_encode($dec);mcrypt_generic_deinit($td);mcrypt_module_close($td);return $ret;}/*** 解密* @param  $value* @return */public function decrypt($value){$td = mcrypt_module_open(MCRYPT_3DES, '', $this->mode, '');$iv = substr($this->des3key, 0, 8);@mcrypt_generic_init($td, $this->des3key, $iv);$ret = trim(mdecrypt_generic($td, base64_decode($value)));$ret = $this->UnPaddingPKCS7($ret);mcrypt_generic_deinit($td);mcrypt_module_close($td);return $ret;}private function PaddingPKCS7($data){$block_size = mcrypt_get_block_size('tripledes', $this->mode);$padding_char = $block_size - (strlen($data) % $block_size);$data .= str_repeat(chr($padding_char), $padding_char);return $data;}private function UnPaddingPKCS7($text){$pad = ord($text{strlen($text) - 1});if ($pad > strlen($text)) {return false;}if (strspn($text, chr($pad), strlen($text) - $pad) != $pad) {return false;}return substr($text, 0, -1 * $pad);}
}$info = ["order_id"   => "201910141637".time(),"dealer_id"  => "28511713","broker_id"  => "27532644","real_name"  => "张三","card_no"    => "6228880199872220","phone_no"   => "13488795491","id_card"    => "5326123123123211","pay"        => "1.00","pay_remark" => "","notify_url" => "",
];$des3key         = 'hx4b3sdn62z22TBQ5n862v21';
$appkey          = "HFrn2iqW3Eo56m2FhrI7XX34JAEKvwNk";
$json_data       = json_encode($info);$DesUtilsObj     = new DesUtils($des3key);
$data    = $DesUtilsObj->encrypt($json_data);$mess            = time();
$timestamp       = time();$key_sign       = "data=".$data."&mess=".$mess."×tamp=".$timestamp."&key=".$appkey;
$key_sign1       = "data=".$data."&mess=".$mess."&timestamp=".$timestamp."&key=".$appkey;$sign            = hash_hmac('sha256', $key_sign, $appkey);
$sign_type       = "sha256";$postUrl = 'https://api-jiesuan.yunzhanghu.com/api/payment/v1/order-realtime';
$postData = array('dealer-id'  => '28511313','request-id' => "20191015".time().time(),'data'       => $data,'mess'       => $mess,'timestamp'  => $timestamp,'sign'       => $sign,'sign_type'  => $sign_type,
);$header = ['Content-Type:application/x-www-form-urlencoded','dealer-id:28511713',
];
$postData = http_build_query($postData);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $postUrl);
curl_setopt($curl, CURLOPT_USERAGENT,'Opera/9.80 (Windows NT 6.2; Win64; x64) Presto/2.12.388 Version/12.15');
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); // stop verifying certificate
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
$r = curl_exec($curl);
curl_close($curl);
print_r($r);

 


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部