37 lines
663 B
PHP
37 lines
663 B
PHP
|
<?php
|
||
|
|
||
|
require_once ('vn/tpv/tpv.php');
|
||
|
|
||
|
use Vn\Rest;
|
||
|
use Vn\Tpv;
|
||
|
|
||
|
class RestMod extends Rest\Module
|
||
|
{
|
||
|
function run ()
|
||
|
{
|
||
|
if (empty ($_REQUEST['amount']))
|
||
|
throw new Rest\Exception ('Tpv', 'badRequest', s('Bad request'));
|
||
|
|
||
|
|
||
|
$params = Tpv::transactionStart (
|
||
|
$this->conn
|
||
|
,(int) $_REQUEST['amount']
|
||
|
,empty ($_REQUEST['urlOk']) ? NULL : $_REQUEST['urlOk']
|
||
|
,empty ($_REQUEST['urlKo']) ? NULL : $_REQUEST['urlKo']
|
||
|
,empty ($_REQUEST['company']) ? NULL : $_REQUEST['company']
|
||
|
,$url
|
||
|
,$signature
|
||
|
);
|
||
|
|
||
|
$result = [
|
||
|
'url' => $url
|
||
|
,'params' => $params
|
||
|
,'signature' => $signature
|
||
|
];
|
||
|
|
||
|
return $result;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
?>
|