diff --git a/src/Merchant.php b/src/Merchant.php old mode 100644 new mode 100755 index b138c8e..bbb4c51 --- a/src/Merchant.php +++ b/src/Merchant.php @@ -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; @@ -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); @@ -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