/**
  * @author SL
  *
  * @param Request $request
  * @param $installation
  * @param $id
  *
  * @return \Illuminate\Http\RedirectResponse
  * @throws RedirectException
  */
 public function processAddMerchantPayment(Request $request, $installation, $id)
 {
     try {
         if (!$request->has(['effective_date', 'amount']) || !is_numeric($request->get('amount'))) {
             throw new Exception('Please ensure all required fields have been completed correctly!');
         }
         $amountPence = $request->get('amount') * 100;
         $response = $this->applicationSynchronisationService->addRemoteMerchantPayment(Application::find($id), Carbon::parse($request->get('effective_date')), $amountPence);
         if ($response) {
             return $this->redirectWithSuccessMessage('installations/' . $installation . '/applications/' . $id . '/', 'Successfully added merchant payment to application.');
         }
         throw new Exception('An unknown error was encountered while trying to add the merchant payment.');
     } catch (\Exception $e) {
         throw $this->redirectWithException('installations/' . $installation . '/applications/' . $id . '/add-merchant-payment', 'Unable to add merchant payment: ' . $e->getMessage(), $e);
     }
 }
 /**
  * @author EB
  * @param Request $request
  * @param Location $location
  * @param Application $application
  * @return Application
  * @throws \Exception
  */
 private function createProfilePersonal(Request $request, Location $location, Application $application)
 {
     $this->profileGateway->createPersonal($application->ext_id, ['first_name' => (string) $request->get('first_name'), 'last_name' => (string) $request->get('last_name'), 'phone_mobile' => (string) $request->get('phone_mobile'), 'phone_home' => (string) $request->get('phone_home')], $location->installation->merchant->token);
     return $this->applicationSynchronisationService->synchroniseApplication($application->id);
 }