/** * Updates a gateway. * * @param int $seller_id Seller ID. * @param int $id Gateway ID. * * @return void */ public function put_index($seller_id = null, $id = null) { $gateway = $this->get_gateway($id); $validator = \Validation_Gateway::update(); if (!$validator->run(\Input::put())) { throw new HttpBadRequestException($validator->errors()); } $data = $validator->validated(); $gateway = \Service_Gateway::update($gateway, $data); if (!$gateway) { throw new HttpServerErrorException(); } $this->response($gateway); }
/** * POST Edit action. * * @param int $id Gateway ID. * * @return void */ public function post_edit($id = null) { $this->get_edit($id); $validator = Validation_Gateway::update(); if (!$validator->run()) { Session::set_alert('error', __('form.error')); $this->view->errors = $validator->error(); return; } $data = $validator->validated(); if (!Service_Gateway::update($this->get_gateway($id), $data)) { Session::set_alert('error', 'There was an error updating the gateway.'); } else { Session::set_alert('success', 'The gateway has been updated.'); } Response::redirect('settings/gateways'); }