@Route("/sales-channel-api/v{version}/context", name="sales-channel-api.context.update", methods={"PATCH"})

@throws AddressNotFoundException
@throws CustomerNotLoggedInException
343553
public function update(RequestDataBag $data, SalesChannelContext $context): JsonResponse
    {
        $this->contextSwitcher->update($data, $context);

        return new JsonResponse([
            PlatformRequest::HEADER_CONTEXT_TOKEN => $context->getToken(),
        ]);
    }
1206299
def update_alias(self, addressid, data):
        """"""
        return self.api_call(
            ENDPOINTS['aliases']['update'],
            dict(addressid=addressid),
            body=data)
1190447
public function ChangeSelectedAddress()
    {
        $this->SetPreventProcessStepMethodFromExecuting(true);
        // the method only works if the user is logged in
        $oUser = self::getExtranetUserProvider()->getActiveUser();
        if ($oUser->IsLoggedIn()) {
            $sNewShippingAddressId = $this->GetShippingAddressData('selectedAddressId');
            $sNewBillingAddressId = $this->GetBillingAddressData('selectedAddressId');

            if ('1' == $this->GetShipToBillingAddress()) {
                if (0 != strcmp($sNewBillingAddressId, $sNewShippingAddressId)) {
                    if (TdbDataExtranetUserAddress::FORM_DATA_NAME_BILLING == $this->AddressUsedAsPrimaryAddress()) {
                        $sNewShippingAddressId = $sNewBillingAddressId;
                    } else {
                        $sNewBillingAddressId = $sNewShippingAddressId;
                    }
                }
            } else {
                // they were different.. if they are now the same, we should set the new state
                if (0 == strcmp($sNewBillingAddressId, $sNewShippingAddressId)) {
                    $this->SetShipToBillingAddress('1');
                }
            }

            if (!empty($sNewBillingAddressId)) {
                if ('new' != $sNewBillingAddressId) {
                    $oNewBillingAdr = $oUser->SetAddressAsBillingAddress($sNewBillingAddressId);
                    if ($oNewBillingAdr) {
                        $this->SetBillingAddressData($oNewBillingAdr->sqlData);
                    } else {
                        // invalid request...
                        if (false == $this->GetBillingAddressData('selectedAddressId')) {
                            // there was nothing selected... so we get an an alternative
                            $sNewBillingAddressId = $this->GetAnotherAddressFromUser($sNewBillingAddressId, TdbDataExtranetUserAddress::FORM_DATA_NAME_BILLING);
                            $oNewBillingAdr = $oUser->SetAddressAsBillingAddress($sNewBillingAddressId);
                            if ($oNewBillingAdr) {
                                $this->SetBillingAddressData($oNewBillingAdr->sqlData);
                            } else {
                                $this->SetBillingAddressData(array('selectedAddressId' => 'new'));
                            }
                        }
                    }
                } else {
                    $this->SetBillingAddressData(array('selectedAddressId' => 'new'));
                }
            }

            if (!empty($sNewShippingAddressId)) {
                if ('new' != $sNewShippingAddressId) {
                    $oNewShippingAdr = $oUser->SetAddressAsShippingAddress($sNewShippingAddressId);
                    if ($oNewShippingAdr) {
                        $this->SetShippingAddressData($oNewShippingAdr->sqlData);
                    } else {
                        // invalid request...
                        if (false == $this->GetShippingAddressData('selectedAddressId')) {
                            // there was nothing selected... so we get an an alternative
                            $sNewShippingAddressId = $this->GetAnotherAddressFromUser($sNewBillingAddressId, TdbDataExtranetUserAddress::FORM_DATA_NAME_SHIPPING);
                            $oNewShippingAdr = $oUser->SetAddressAsShippingAddress($sNewShippingAddressId);
                            if ($oNewShippingAdr) {
                                $this->SetShippingAddressData($oNewShippingAdr->sqlData);
                            } else {
                                $this->SetShippingAddressData(array('selectedAddressId' => 'new'));
                            }
                        }
                    }
                } else {
                    $this->SetShippingAddressData(array('selectedAddressId' => 'new'));
                }
            }

            // check if shipping != billing AND ShipToBillingAddress() == '1' or the other way around. if that is the case,
            // then we need to adjust ShipToBillingAddress to match the new setting
            if (1 == $this->GetShipToBillingAddress() && $this->GetShippingAddressData('selectedAddressId') != $this->GetBillingAddressData('selectedAddressId')) {
                $this->SetShipToBillingAddress(0);
            } elseif (0 == $this->GetShipToBillingAddress() && $this->GetShippingAddressData('selectedAddressId') == $this->GetBillingAddressData('selectedAddressId')) {
                $this->SetShipToBillingAddress(1);
            }
            TShopBasket::GetInstance()->RecalculateBasket();
        }
    }
383466
public function replaceOrderAddressWithCustomerAddress(string $orderAddressId, string $customerAddressId, Context $context): JsonResponse
    {
        $this->recalculationService->replaceOrderAddressWithCustomerAddress($orderAddressId, $customerAddressId, $context);

        return new JsonResponse(null, Response::HTTP_NO_CONTENT);
    }
543324
private void sendNotModified(ChannelHandlerContext ctx) {
        FullHttpResponse response = new DefaultFullHttpResponse(HTTP_1_1, NOT_MODIFIED);
        setDateHeader(response);

        this.sendAndCleanupConnection(ctx, response);
    }
747410
void portForward(final Patch patch, IdentityPatchContext context) throws PatchingException, IOException, XMLStreamException {
        assert patch.getIdentity().getPatchType() == Patch.PatchType.CUMULATIVE;

        final PatchingHistory history = context.getHistory();
        for (final PatchElement element : patch.getElements()) {

            final PatchElementProvider provider = element.getProvider();
            final String name = provider.getName();
            final boolean addOn = provider.isAddOn();

            final IdentityPatchContext.PatchEntry target = context.resolveForElement(element);
            final String cumulativePatchID = target.getCumulativePatchID();
            if (Constants.BASE.equals(cumulativePatchID)) {
                reenableRolledBackInBase(target);
                continue;
            }

            boolean found = false;
            final PatchingHistory.Iterator iterator = history.iterator();
            while (iterator.hasNextCP()) {
                final PatchingHistory.Entry entry = iterator.nextCP();
                final String patchId = addOn ? entry.getAddOnPatches().get(name) : entry.getLayerPatches().get(name);

                if (patchId != null && patchId.equals(cumulativePatchID)) {
                    final Patch original = loadPatchInformation(entry.getPatchId(), installedImage);
                    for (final PatchElement originalElement : original.getElements()) {
                        if (name.equals(originalElement.getProvider().getName())
                                && addOn == originalElement.getProvider().isAddOn()) {
                            PatchingTasks.addMissingModifications(target, originalElement.getModifications(), ContentItemFilter.ALL_BUT_MISC);
                        }
                    }
                    // Record a loader to have access to the current modules
                    final DirectoryStructure structure = target.getDirectoryStructure();
                    final File modulesRoot = structure.getModulePatchDirectory(patchId);
                    final File bundlesRoot = structure.getBundlesPatchDirectory(patchId);
                    final PatchContentLoader loader = PatchContentLoader.create(null, bundlesRoot, modulesRoot);
                    context.recordContentLoader(patchId, loader);
                    found = true;
                    break;
                }
            }
            if (!found) {
                throw PatchLogger.ROOT_LOGGER.patchNotFoundInHistory(cumulativePatchID);
            }

            reenableRolledBackInBase(target);
        }
    }
67615
public void setWebAppDispatcherContext(IWebAppDispatcherContext ctx) {
        // 321485
        if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)){  //306998.15
            logger.logp(Level.FINE, CLASS_NAME,"setWebAppDispatcherContext", " old context [" + this.getDispatchContext() + "] new context [" + ctx +"]");
        }
        if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
            checkRequestObjectInUse();
        }
        SRTServletRequestThreadData.getInstance().setDispatchContext(ctx);
        this._dispatchContext = (WebAppDispatcherContext) ctx;
        resetPathElements();
    }
893842
@Process(actionType = ModifyDefaults.class)
    public void modifyDefaults(final ModifyDefaults action, final Channel channel) {
        operationDelegate.onSaveResource(ROOT_ADDRESS, null, action.getChangedValues(),
                new ChannelCallback(statementContext, channel));
    }
1045410
private void sendNotModified(ChannelHandlerContext ctx) {
    HttpResponse response = new DefaultHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.NOT_MODIFIED);
    setDateHeader(response);

    // Close the connection as soon as the error message is sent.
    ctx.writeAndFlush(response).addListener(ChannelFutureListener.CLOSE);
  }
1083464
@SuppressWarnings("unchecked")
    public <T extends IEntity> T donotUpdateAccountOnTxns(T entity) throws FMSException {

        IntuitMessage intuitMessage = preparedonotUpdateAccountOnTxns(entity);

        //execute interceptors
        executeInterceptors(intuitMessage);

        return (T) retrieveEntity(intuitMessage);
    }
531181
public function updateAddress( CustomerVault\Address $address )
    {
        $address->setRequiredFields(array(
            'profileID',
            'id'
        ));
        $address->checkRequiredFields();
        $address->setRequiredFields(array('country'));
        $address->setOptionalFields(array(
            'nickName',
            'street',
            'street2',
            'city',
            'state',
            'zip',
            'recipientName',
            'phone',
            'defaultShippingAddressIndicator',
        ));

        $request = new Request(array(
            'method' => Request::PUT,
            'uri' => $this->prepareURI("/profiles/" . $address->profileID . "/addresses/" . $address->id),
            'body' => $address
        ));
        $response = $this->client->processRequest($request);
        $response['profileID'] = $address->profileID;

        return new CustomerVault\Address($response);
    }
15091
public function update()
    {
        if (!$this->request->is('post')) {
            if ($this->request->is('ajax')) {
                throw new MethodNotAllowedException();
            } else {
                $this->Flash->error($this->invalidRequestMessage);
                $this->redirect(['action' => 'index']);
                return;
            }
        }

        if (empty($this->request->data) && !$this->request->is('ajax')) {
            $this->Flash->warning(__d('wasabi_core', 'There are no permissions to update yet.'));
            $this->redirect(['action' => 'index']);
            return;
        }

        // save the new language positions
        $permissions = $this->GroupPermissions->patchEntities(
            $this->GroupPermissions->find('all'),
            $this->request->data
        );

        /** @var Connection $connection */
        $connection = $this->GroupPermissions->connection();
        $connection->begin();
        foreach ($permissions as $permission) {
            if (!$this->GroupPermissions->save($permission)) {
                $connection->rollback();
                break;
            }
        }

        if ($connection->inTransaction()) {
            $connection->commit();
            Cache::clear(false, 'wasabi/core/group_permissions');
            if ($this->request->is('ajax')) {
                $status = 'success';
                $this->set(compact('status'));
                $this->set('_serialize', ['status']);
            } else {
                $this->Flash->success(__d('wasabi_core', 'All permissions have been saved.'));
                $this->redirect(['action' => 'index']);
                return;
            }
        } else {
            $this->Flash->error($this->dbErrorMessage);
        }
    }
627232
public function deleteAddress(string $id, SalesChannelContext $context): JsonResponse
    {
        $this->addressService->delete($id, $context);

        return new JsonResponse($this->serialize($id));
    }
759764
public function createAddress(RequestDataBag $requestData, SalesChannelContext $context): JsonResponse
    {
        $addressId = $this->addressService->create($requestData, $context);

        $this->salesChannelContextService->refresh(
            $context->getSalesChannel()->getId(),
            $context->getToken(),
            $context->getContext()->getLanguageId()
        );

        return new JsonResponse($this->serialize($addressId));
    }
908845
@Modified
    protected void modified(ComponentContext context,
                            Map<String, Object> properties) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            SibTr.entry(tc, CLASS_NAME + "modified", new Object[] { context,
                                                                   properties });
        }

        try {

            // If ME is stopped we start it again.This happens when ME might have
            // not started during activate() and user changes the server.xml, we
            // attempt to start it again(thinking user have reactified any
            // server.xml issue if any )
            if (service.getMeState().equals(ME_STATE.STOPPED.toString())) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                    SibTr.debug(tc, "Starting ME", service.getMeState());
                SibTr.info(tc, "RESTART_ME_SIAS0106");
                service.activate(context, properties, configAdminRef.getService());
            } else {
                if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                    SibTr.debug(tc, "Modifying the configuration", service
                                    .getMeState());
                service.modified(context, properties, configAdminRef.getService());
            }

        } catch (Exception e) {
            SibTr.exception(tc, e);
            FFDCFilter.processException(e, this.getClass().getName(), "187", this);
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            SibTr.exit(tc, CLASS_NAME + "modified");
        }

    }
1037244
protected function setNotFoundDecoratorMiddleware() : void
    {
        $middleware = $this->getStrategy()->getNotFoundDecorator(new NotFoundException);
        $this->prependMiddleware($middleware);
    }
676135
public function update(AddressBookRequest $request, int $id)
    {
        try {
            $address = Auth::user()->findAddress($id);
        } catch(\Illuminate\Database\Eloquent\ModelNotFoundException $e) {
            return $this->respondsWithError(trans('address.errors.model_not_found'));
        }

        $address->update($request->all());

        return $this->respondsWithSuccess(trans('address.success_update'), route('addressBook.index'));
    }