{@inheritdoc}

@param Sync $request
964766
public function execute($request)
    {
        RequestNotSupportedException::assertSupports($this, $request);

        //$model = ArrayObject::ensureArrayObject($request->getModel());

        $this->gateway->execute(new PaymentResponse($request->getModel()));
    }
969963
public function attachToObject($request, $item)
    {
        if ($request->filled('widgets')) {
            $widgets = explode(',', $request->get('widgets'));
            $item->syncWidgets($this->repository->getItemsByIDs((array) $widgets));
        } else {
            $item->detachWidgets($item->widgets);
        }
    }
658358
public function delete($model, $sync = false)
    {
        if (!$model instanceof $this->class) {
            throw new \RuntimeException(sprintf('Manager "%s" is unable to delete model "%s"', get_class($this), get_class($model)));
        }

        $this->manager->remove($model);

        if ($sync) {
            $this->manager->flush();
        }
    }
862127
function fetchSync (name, request, options) {
  if (!hasStartedInit) {
    throw new Error('initialise first with fetchSync.init()')
  }

  const isRequestOptionsCall = () => arguments.length === 2 &&
    (typeof arguments[0] === 'string' || arguments[0] instanceof Request) &&
    (typeof arguments[1] === 'object' && !(arguments[1] instanceof Request))

  if (arguments.length === 1) {
    request = name
    name = null
  } else if (isRequestOptionsCall()) {
    options = request
    request = name
    name = null
  }

  if (typeof request !== 'string' && !(request instanceof Request)) {
    throw new Error('expecting request to be a string or Request')
  } else if (options && typeof options !== 'object') {
    throw new Error('expecting options to be an object')
  }

  if (!hasBackgroundSyncSupport) {
    return fetch(request, options)
  }

  let sync = syncs.find((s) => s.id === name)

  if (sync) {
    const err = new Error(`sync operation already exists with name '${name}'`)
    return Promise.reject(err)
  }

  sync = syncUtil.createFromUserOptions({ name, request, options })

  syncs.push(sync)

  ready.promise
    .then(() => serialiseRequest(new Request(request, options)))
    .then((request) => { sync.request = request })
    .then(() => channel.send('REGISTER_SYNC', sync))

  return syncUtil.makePublicApi(sync)
}
262405
public function sync($data = false)
    {
        if ($this->_exists !== null) {
            return;
        }
        $id = $this->id();
        if ($id !== null) {
            $persisted = static::load($id);
            if ($persisted && $data) {
                $this->amend($persisted->data(), ['exists' => true]);
            } else {
                $this->_exists = !!$persisted;
            }
        } else {
            $this->_exists = false;
        }
    }
715578
public function setRequest(BaseRequest $request)
    {
        foreach ($request as $prop => $value) {
            $this->$prop = $value;
        }
    }
64838
public function notifyAction(Request $request)
    {
        /** @var Event $content */
        $content = json_decode($request->getContent(), true);

        // Get the Event again from Stripe for security reasons
        $stripeWebhookEvent = $this->get('stripe_bundle.manager.stripe_api')->retrieveEvent($content['id']);

        // Now check the event doesn't already exist in the database
        $localWebhookEvent = $this->get('stripe_bundle.entity_manager')->getRepository('SHQStripeBundle:StripeLocalWebhookEvent')->findOneByStripeId($stripeWebhookEvent->id);

        if (false !== strpos($content['type'], 'deleted')) {
            $objectType = ucfirst($content['data']['object']['object']);
            if (null === $localWebhookEvent) {
                $localResource = $this->get('stripe_bundle.entity_manager')
                    ->getRepository('SHQStripeBundle:StripeLocal' . $objectType)
                    ->findOneBy(['id' => $content['data']['object']['id']]);
            }
            $syncer = $this->get('stripe_bundle.syncer.' . $objectType);
            if (method_exists($syncer, 'removeLocal')) {
                $this->get('stripe_bundle.syncer.' . $objectType)->removeLocal($localResource, $stripeWebhookEvent);
            }

            return new Response('ok', 200);
        }

        if (null === $localWebhookEvent) {
            // Create the entity object (this will be persisted)
            $localWebhookEvent = new StripeLocalWebhookEvent();

            // Now sync the entity LocalWebhookEvent with the remote Stripe\Event (persisting is automatically handled)
            $this->get('stripe_bundle.syncer.webhook_event')->syncLocalFromStripe($localWebhookEvent, $stripeWebhookEvent);
        }

        // Guess the event to dispatch to the application
        $guessedDispatchingEvent = $this->get('stripe_bundle.guesser.event_guesser')->guess($stripeWebhookEvent, $localWebhookEvent);

        $this->container->get('event_dispatcher')->dispatch($guessedDispatchingEvent['type'], $guessedDispatchingEvent['object']);

        return new Response('ok', 200);
    }
1270063
public function syncRefresh() {
    // Disable alias since we are targeting specific uri.
    $this->config->set('drush.alias', '');

    // Sync files.
    $this->config->set('sync.files', TRUE);

    foreach ($this->getConfigValue('multisites') as $multisite) {
      $this->say("Syncing $multisite...");
      if (!$this->config->get('drush.uri')) {
        $this->config->set('drush.uri', $multisite);
      }

      $this->invokeCommand('drupal:sync:db');
      $this->invokeCommand('drupal:sync:files');
      $this->invokeCommand('drupal:update');

      $this->say("Finished syncing $multisite.");
    }
  }
1081395
public function setRequest(Request $request)
    {
        $this->request = $request;

        $this->cachedRoot = null;
        $this->cachedScheme = null;
        $this->routeGenerator = null;
    }
365544
public function execute($request): void
    {
        /** @var PaymentInterface $payment */
        $payment = $request->getFirstModel();

        if (
            $payment->getState() === PaymentInterface::STATE_COMPLETED ||
            $payment->getState() === PaymentInterface::STATE_AUTHORIZED
        ) {
            $request->setRouteName(
                'sylius_shop_order_thank_you'
            );

            return;
        }

        $request->setRouteName('sylius_shop_order_show');
        $request->setRouteParameters(['tokenValue' => $payment->getOrder()->getTokenValue()]);
    }
291100
public function disconnect($sync = false)
    {
        try {
            if ($this->connection && $this->connection->isConnected()) {
                if ($this->protocol) {
                    $this->sendFrame($this->protocol->getDisconnectFrame(), $sync);
                }
            }
        } catch (StompException $ex) {
            // nothing!
        }
        if ($this->connection) {
            $this->connection->disconnect();
        }

        $this->sessionId = null;
        $this->unprocessedFrames = [];
        $this->protocol = null;
        $this->isConnecting = false;
    }
392862
private void addPostParams(final Request request) {
        if (friendlyName != null) {
            request.addPostParam("FriendlyName", friendlyName);
        }

        if (syncServiceSid != null) {
            request.addPostParam("SyncServiceSid", syncServiceSid);
        }
    }
1308837
public function execute($request)
    {
        RequestNotSupportedException::assertSupports($this, $request);

        $model = ArrayObject::ensureArrayObject($request->getModel());

        // invalidate:
        // - we process only replied and notified payments
        if (!isset($model['state']) ||
            !in_array(
                $model['state'],
                array(
                    StateInterface::STATE_REPLIED,
                    StateInterface::STATE_NOTIFIED,
                    StateInterface::STATE_CONFIRMED,
                )
            )
        ) {
            // return;
        }

        $httpRequest = new GetHttpRequest;
        $this->gateway->execute($httpRequest);

        if ($httpRequest->method != 'POST') {
            return;
        }

        $status = Api::STATUS_OK;
        $model['state'] = StateInterface::STATE_NOTIFIED;
        $notification = $httpRequest->request;
        $redirectUrl = $model['afterUrl'];
        // check signature hash
        
        if ($this->api->tamperingDetected((array) $notification, (array) $model->toUnsafeArray())) {
            $status = Api::STATUS_INVALID;
            $statusDetails = "Tampering detected. Wrong hash.";
        } else {
            if ($notification['Status'] == Api::STATUS_OK) {
                $model['state'] = StateInterface::STATE_CONFIRMED;
            } elseif ($notification['Status'] == Api::STATUS_PENDING) {
                $model['state'] = StateInterface::STATE_REPLIED;
            } else {
                $model['state'] = StateInterface::STATE_ERROR;
            }

            $statusDetails = 'Transaction processed';

            if ($notification['Status'] == Api::STATUS_ERROR
                && isset($notification['Vendor'])
                && isset($notification['VendorTxCode'])
                && isset($notification['StatusDetail'])
            ) {
                $status = Api::STATUS_ERROR;
                $statusDetails = 'Status of ERROR is seen, together with your Vendor, VendorTxCode and the StatusDetail.';
            }

        }

        $model['notification'] = (array) $notification;
        $model->replace(
            $model->toUnsafeArray()
        );

        $params = array(
            'Status' => $status,
            'StatusDetails' => $statusDetails,
            'RedirectURL' => $redirectUrl,
            );

        throw new NotifyResponse($params);
    }
433538
public static function updateData(Registry $syncdata)
	{
		//find out if the syncid already exists
		$db = Factory::getDBO();

		$query = $db->getQuery(true)
			->update('#__jfusion_sync')
			->set('syncdata = ' . $db->quote($syncdata->toString()))
			->where('syncid = ' . $db->quote($syncdata->get('syncid')));

		$db->setQuery($query);
		$db->execute();
	}
909108
public function execute($request)
    {
        RequestNotSupportedException::assertSupports($this, $request);

        $model = ArrayObject::ensureArrayObject($request->getModel());

        if (false == $code = $model['code-retour']) {
            $request->markNew();

            return;
        }

        switch ($code) {
            case "payetest" : // paiement accepté (en TEST uniquement)
            case "paiement" : // paiement accepté (en Production uniquement)
                $request->markCaptured();
                break;
            case "Annulation" : // contacter l’émetteur de carte
                $request->markFailed();
                break;
            default :
                $request->markUnknown();
        }

        if ($request->isCaptured() && false != $code = $model['state_override']) {
            if ($code == 'refunded') {
                $request->markRefunded();
            }
        }
    }
898114
public function execute($request)
    {
        RequestNotSupportedException::assertSupports($this, $request);

        /** @var PaymentInterface $payment */
        $payment = $request->getModel();

        if (in_array($payment->getState(), array(PaymentInterface::STATE_APPROVED, PaymentInterface::STATE_DEPOSITED))) {
            $request->markCaptured();

            return;
        }

        if (in_array($payment->getState(), array(PaymentInterface::STATE_DEPOSITING))) {
            $request->markPending();

            return;
        }

        if (in_array($payment->getState(), array(PaymentInterface::STATE_CANCELED))) {
            $request->markCanceled();

            return;
        }

        if (in_array($payment->getState(), array(PaymentInterface::STATE_EXPIRED))) {
            $request->markExpired();

            return;
        }

        if (in_array($payment->getState(), array(PaymentInterface::STATE_FAILED))) {
            $request->markFailed();

            return;
        }

        if (in_array($payment->getState(), array(PaymentInterface::STATE_NEW, PaymentInterface::STATE_APPROVING))) {
            $request->markNew();

            return;
        }

        $request->markUnknown();
    }
85814
public function updateCrud(UpdateRequest $request = null)
	{
		// if edit_permission is false, abort
		if (isset($this->crud['edit_permission']) && !$this->crud['edit_permission']) {
			abort(403, 'Not allowed.');
		}

		$model = $this->crud['model'];
		$this->prepareFields($model::find(\Request::input('id')));

		$item = $model::find(\Request::input('id'))
						->update($this->compactFakeFields(\Request::all()));

		// if it's a relationship with a pivot table, also sync that
		foreach ($this->crud['fields'] as $k => $field) {
			if (isset($field['pivot']) && $field['pivot']==true && \Request::has($field['name']))
			{
				$model::find(\Request::input('id'))->$field['name']()->sync(\Request::input($field['name']));
			}
		}

		// show a success message
		\Alert::success(trans('crud.update_success'))->flash();

		return \Redirect::to($this->crud['route']);
	}