/** * @author EB * @param int $location * @param int $application * @return \Illuminate\Http\RedirectResponse * @throws RedirectException */ public function finishApplication($location, $application) { try { /** @var Location $location */ $location = Location::findOrFail($location); $application = $this->fetchApplicationById($application, $location->installation->id); ApplicationEvent\ApplicationEventHelper::addEvent($application, ApplicationEvent::TYPE_RESUME_LINK); } catch (\Exception $e) { throw $this->redirectWithException('installations/' . $location->installation->id . '/applications', 'Unable to complete the application: ' . $e->getMessage(), $e); } return $this->redirectWithSuccessMessage('installations/' . $location->installation->id . '/applications/' . $application->id, 'Successfully created an application'); }
/** * @author EB * @param Request $request * @param $location * @return array|\Illuminate\Http\Response */ public function setProfileFinancial(Request $request, $location) { /** @var Location $location */ $location = Location::findOrFail($location)->first(); try { return $this->profileGateway->setFinancial($request->get('user'), ['monthly_income' => (int) $request->get('monthly_income'), 'monthly_outgoings' => (int) $request->get('monthly_outgoings'), 'bank_sort_code' => (string) $request->get('bank_sort_code'), 'bank_account' => (string) $request->get('bank_account')], $location->installation->merchant->token); } catch (\Exception $e) { $this->logError('Set Profile Financial failed: ' . $e->getMessage(), $request->all()); return $this->apiResponseFromException($e, 422); } }