Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions UnitPay.php
Original file line number Diff line number Diff line change
Expand Up @@ -370,25 +370,25 @@ public function api($method, $params = array())
}

/**
* Check request on handler from UnitPay
* Checks request on handler from Unitpay
*
* @return bool
*
* @throws InvalidArgumentException
* @throws UnexpectedValueException
* @param array $data Request data
* @return boolean Always `true`
* @throws InvalidArgumentException If some request parameter missing or missmatch
* @throws UnexpectedValueException If some request parameter has invalid value
*/
public function checkHandlerRequest()
public function checkHandlerRequest(array $data)
{
$ip = $this->getIp();
if (!isset($_GET['method'])) {

if (!isset($data['method'])) {
throw new InvalidArgumentException('Method is null');
}

if (!isset($_GET['params'])) {
if (!isset($data['params'])) {
throw new InvalidArgumentException('Params is null');
}

list($method, $params) = array($_GET['method'], $_GET['params']);
list($method, $params) = array($data['method'], $data['params']);

if (!in_array($method, $this->supportedPartnerMethods)) {
throw new UnexpectedValueException('Method is not supported');
Expand Down