public function postProcess() { $res = \CashWay\API::receiveNotification(Tools::file_get_contents('php://input'), getallheaders(), Configuration::get('CASHWAY_SHARED_SECRET')); if ($res[0] === false) { $this->terminateReply($res[2], $res[1]); } $event = $res[1]; $this->data = $res[2]; $handler = $this->snakeToCamel('on_' . $event); method_exists($this, $handler) ? $this->{$handler}() : $this->terminateReply(400, 'Do not know how to handle this event.'); }
/** * @dataProvider notificationsProvider */ public function testReceiveNotification($body, $headers, $secret, $expected) { $this->assertEquals($expected, \CashWay\API::receiveNotification($body, $headers, $secret)); }