Файл: core/ya.class.php
Строк: 85
<?php
const YandexToken = '4100110520828124.B7A6DB67600F0E11329B14299BC3966E3886ED11EAB2F974BBFECC48571A0BDC7D06CC9A7856EE83B007E885C9E2E177009A29A2A040218A1203D422174296EFACA0B7950B3F65178C9D194212ED98BCC87F02E18F8E4171BCE9510A6473F06274E47F4B83F7ABE8B6F37B01D37438E20047416D99DE2C86057DBB9146C2C122';
class Ya {
function send($to,$money,$comment){
if(empty($comment)) $comment = 'Автоматический вывод средств с WordPay';
$money = number_format($money, 2, '.', '');
$token = YandexToken;
$uri = 'https://money.yandex.ru/api/request-payment';
$curl = curl_init();
$params = 'pattern_id=p2p&to='.$to.'&amount='.$money.'&message='.$comment.'&comment='.$comment;
$headers[] = 'Authorization: Bearer ' . $token;
curl_setopt($curl, CURLOPT_URL, $uri);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt ($curl, CURLOPT_SSLVERSION, 6);
curl_setopt($curl, CURLOPT_USERAGENT, 'ANDROID');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
// curl_setopt($curl, CURLOPT_FORBID_REUSE, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $params);
// curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, true);
//curl_setopt($curl, CURLOPT_CAINFO, dirname(__FILE__) . '/../data/ca-certificate.crt');
$rbody = curl_exec($curl);
curl_close($curl);
$json = json_decode($rbody);
print_r($json);
$uri2 = 'https://money.yandex.ru/api/process-payment';
$curl2 = curl_init();
$params2 = 'request_id='.$json->request_id;
$headers2[] = 'Authorization: Bearer ' . $token;
curl_setopt($curl2, CURLOPT_URL, $uri2);
curl_setopt($curl2, CURLOPT_HTTPHEADER, $headers2);
curl_setopt ($curl2, CURLOPT_SSLVERSION, 6);
curl_setopt($curl2, CURLOPT_USERAGENT, 'ANDROID');
curl_setopt($curl2, CURLOPT_RETURNTRANSFER, true);
// curl_setopt($curl, CURLOPT_FORBID_REUSE, true);
curl_setopt($curl2, CURLOPT_POST, true);
curl_setopt($curl2, CURLOPT_POSTFIELDS, $params2);
// curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, true);
//curl_setopt($curl, CURLOPT_CAINFO, dirname(__FILE__) . '/../data/ca-certificate.crt');
$rbody2 = curl_exec($curl2);
curl_close($curl2);
$json2 = json_decode($rbody2);
if($json2->status == 'success'){
return 1;
}
else
{
return print_r($json2);
#return 0;
}
}
function mobile($to,$money){
$token = YandexToken;
$uri = 'https://money.yandex.ru/api/request-payment';
$curl = curl_init();
$params = 'pattern_id=phone-topup&phone-number='.$to.'&amount='.$money;
$headers[] = 'Authorization: Bearer ' . $token;
curl_setopt($curl, CURLOPT_URL, $uri);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_USERAGENT, 'ANDROID');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
// curl_setopt($curl, CURLOPT_FORBID_REUSE, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $params);
// curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, true);
//curl_setopt($curl, CURLOPT_CAINFO, dirname(__FILE__) . '/../data/ca-certificate.crt');
$rbody = curl_exec($curl);
curl_close($curl);
$json = json_decode($rbody);
$uri2 = 'https://money.yandex.ru/api/process-payment';
$curl2 = curl_init();
$params2 = 'request_id='.$json->request_id;
$headers2[] = 'Authorization: Bearer ' . $token;
curl_setopt($curl2, CURLOPT_URL, $uri2);
curl_setopt($curl2, CURLOPT_HTTPHEADER, $headers2);
curl_setopt($curl2, CURLOPT_USERAGENT, 'ANDROID');
curl_setopt($curl2, CURLOPT_RETURNTRANSFER, true);
// curl_setopt($curl, CURLOPT_FORBID_REUSE, true);
curl_setopt($curl2, CURLOPT_POST, true);
curl_setopt($curl2, CURLOPT_POSTFIELDS, $params2);
// curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, true);
//curl_setopt($curl, CURLOPT_CAINFO, dirname(__FILE__) . '/../data/ca-certificate.crt');
$rbody2 = curl_exec($curl2);
curl_close($curl2);
$json2 = json_decode($rbody2);
if($json2->status == 'success'){
return 1;
}
else
{
return 0;
}
}
}
$ya = new Ya();