$payment = array(
'amount' => array(
'value' => $order["total"],
'currency' => $order["currency"],
),
'payment_method_data' => array(
'type' => 'bank_card',
),
'confirmation' => array(
'type' => 'redirect',
'return_url' => $returl,
),
"receipt" => array(
"customer" => array(
"full_name" => $customer["fullname"],
"phone" => preg_replace("/[^0-9]/", "",$customer["phone"]),
"email" => $customer["email"]
),
"email" => $customer["email"],
"items" => $items
),
'capture' => true,
'description' => $order["reason"],
);
$param = $pq->find("param");
$meta = $pq->find("meta[property^=some]");
$embed = $pq->find("embed[src]");
function wbAuthPostContents($url, $post=null, $username=null,$password=null) {
if (func_num_args()==3) {
$password=$username;
$username=$get;
$post=array();
}
if (!is_array($post)) $post=(array)$post;
$cred = sprintf('Authorization: Basic %s', base64_encode("$username:$password") );
$post=http_build_query($post);
$opts = array(
'http'=>array(
'method'=>'POST',
'header'=>$cred,
'content'=>$post
)
);
$context = stream_context_create($opts);
$result = file_get_contents($url, false, $context);
return $result;
}
function autoinc_id($dataset="common",$min=0) {
$file = __DIR__ . "/autoinc.json";
$fp = fopen($file, 'c+');
flock($fp, LOCK_SH);
$json = json_decode(file_get_contents($file),true);
if (!isset($json[$dataset])) {
$json[$dataset]=$min;
} else {
if ($json[$dataset]<$min) {$json[$dataset]=$min;} else {$json[$dataset]++;}
}
file_put_contents($file,json_encode($json));
flock($fp, LOCK_UN);
fclose($fp);
return $json[$dataset];
}