/**
  * {@inheritDoc}
  *
  * @param Notify $request
  */
 public function execute($request)
 {
     RequestNotSupportedException::assertSupports($this, $request);
     $model = ArrayObject::ensureArrayObject($request->getModel());
     $this->gateway->execute($httpRequest = new GetHttpRequest());
     if (false == $this->api->verifyRequest($httpRequest->request)) {
         throw new HttpResponse('The notification is invalid. [2]', 400, array('x-reason-code' => 2));
     }
     if ($model['amount'] != $httpRequest->request['withdraw_amount'] && $model['amount'] != $httpRequest->request['amount']) {
         throw new HttpResponse('The notification is invalid. [3]', 400, array('x-reason-code' => 3));
     }
     if ('true' === $httpRequest->request['unaccepted']) {
         throw new HttpResponse('The notification is invalid. [4]', 400, array('x-reason-code' => 4));
     }
     $model->replace(array(Api::FIELD_STATUS => Api::STATUS_CAPTURED));
     $this->tokenStorage->delete($request->getToken());
     throw new HttpResponse('', 200, array('x-reason-code' => 0));
 }
 /**
  * {@inheritDoc}
  */
 public function invalidate(TokenInterface $token)
 {
     $this->tokenStorage->delete($token);
 }
 /**
  * @param string $name
  *
  * @return Response
  */
 public function deleteAction($name)
 {
     $gatewayConfig = $this->findGatewayConfigByName($name);
     $this->gatewayConfigStorage->delete($gatewayConfig);
     return new Response('', 204);
 }