protected function checkHash($hashed, array $params = array()) { //echo $this->salt."8uiuu"; if (Shahash::check($params["pin"], $hashed, $options = array("number" => $params["number"], "pin" => $params["pin"], "key_salt" => $this->salt))) { return true; } else { return false; } }
*/ $app->post("/merchants/create/", function ($request, $response, $args) { try { $json = $request->getBody(); $data = json_decode($json, true); $merchant = new \models\Merchant(); //$ticketing = json_decode($args['ticketing']); if (!empty($data)) { foreach ($data as $key => $val) { $merchant->{$key} = $val; } } $merchant->created_at = date("Y-m-d H:i:s"); $input['number'] = $data['phone']; $input['key_salt'] = ""; $merchant->password = \system\library\Hashing\Shahash::make($data['password'], $input); $v = new system\library\Validator\Validator(array(new system\library\Validator\Validate\Unique("email", "is already existing", "merchants"), new system\library\Validator\Validate\Required('email', " is required"), new system\library\Validator\Validate\Unique("phone", "is already existing", "merchants"), new system\library\Validator\Validate\Unique("app_id", "is already existing", "merchants"), new system\library\Validator\Validate\Required('phone', " is required")), $data); if ($v->execute() == true) { if ($merchant->create()) { if (isset($input['phone'])) { $merchant->pinAction($merchant->id, $data); } // $result = array(); $result['success'] = true; $result['msg'] = "Record Created"; $result['data'] = $merchant->id; $result['code'] = "200"; } else { //$result = array(); $result['success'] = false; $result['msg'] = "Merchant could not be created";