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
27 changes: 27 additions & 0 deletions src/Merchant.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,18 @@ class Merchant extends Component
/** @var string used for creating the hash to check the data (in API doc see 'secret2') */
public $checkDataSecret;

/**
* Name of property to testing
* @var string
*/
public $testInitName = 'intid';

/**
* Value to define test request
* @var string
*/
public $testInitValue = 'TEST_ORDER';

/** @var Client */
protected $httpClient;

Expand Down Expand Up @@ -294,6 +306,10 @@ public function processResult($data)
throw new ForbiddenHttpException('Hash error');
}

if($this->isTestId($data)){
return true;
}

$event = new GatewayEvent(['gatewayData' => $data]);

$this->trigger(GatewayEvent::EVENT_PAYMENT_REQUEST, $event);
Expand Down Expand Up @@ -383,6 +399,17 @@ public function checkHash($data)
return false;
}

/**
* Return result of check testing property
*
* @param array $data
* @return bool
*/
public function isTestId($data)
{
return $data[$this->testInitName] === $this->testInitValue;
}

/**
* Format amount to correct format
* to prevent errors
Expand Down