Файл: billing/_rootinc/easypay.inc.php
Строк: 58
<?
class EASYPAY
{
public $controller = true;
public $user = null;
public $password = null;
public $error = null;
public $wsdl = null;
public function startup(&$controller)
{
$this->controller =& $controller;
}
public function init($user,$password)
{
$this->user=$user;
$this->password=$password;
$this->wsdl = "https://ssl.easypay.by/xml/easypay.wsdl";
}
public function createBill($order, $sum, $exp, $card, $comment, $info, $xml)
{
$comment=iconv("utf-8", "windows-1251", $comment);
$info=iconv("utf-8", "windows-1251", $info);
$params = array(
'mer_no' => $this->user,
'pass' => $this->password,
'order' => $order,
'sum' => $sum,
'exp' => $exp,
'card' => $card,
'comment' => $comment,
'info' => $info,
'xml' => $xml
);
$client = new SoapClient($this->wsdl, array('trace' => 1, 'encoding'=>'windows-1251'));
$result = $client->EP_CreateInvoice($params);
if ($result->status->code == "200") {
return true;
} else {
$result->status->message=iconv("windows-1251", "utf-8", $result->status->message);
$this->error = "createBill: ".$result->status->code." ".$result->status->message;
return false;
}
}
public function checkBill($order)
{
$params = array(
'mer_no' => $this->user,
'pass' => $this->password,
'order' => $order
);
$client = new SoapClient($this->wsdl, array('trace' => 1, 'encoding'=>'windows-1251'));
$result = $client->EP_IsInvoicePaid($params);
$code = intval($result->status->code);
if ($code == 200) {
return 1;
} else if ($code == 503) {
return -1;
} else {
return false;
}
}
}
?>