public function execute(Request $request, Response $response)
 {
     $this->config = Configuration::getDefaultConfig();
     $requestValues = $request->getValues();
     // Don't store blank messages.
     if (empty($requestValues)) {
         return;
     }
     // Don't store invalid messages.
     $valid = $this->config->object('api')->validate($requestValues);
     if (!$valid) {
         // This will tell them to resend later.
         $response->setStatusCode(403, 'Failed verification');
         return false;
     }
     // Dump the request right into the queue with no validation.
     $job = new Job();
     $job->payload = $requestValues;
     $this->config->object('data-store/jobs-paypal')->push($job);
     Logger::info('Pushed new message to jobs-paypal: ' . print_r($requestValues, true));
 }
 /**
  * Hook from set_exception_handler(). Will clear output data, set the HTTP status to 500: Internal Error
  * and then die.
  *
  * @param \Exception $ex The uncaught exception
  */
 public static function lastChanceExceptionHandler($ex)
 {
     Logger::alert("Last chance exception handler fired.", null, $ex);
     $response = new Response();
     $response->setPrivate();
     $response->setStatusCode(500, "Unhandled internal server exception.");
     $response->send();
 }