Cancel all

With best effort, cancel all open orders. The response is a list of ids of the canceled orders.

@param RequestOrder|null $order

@return ResponseTypeInterface
433390
public function cancelOrders(RequestOrder $order = null) {
        return $this->delete(['orders'], RawData::class, ($order !== null) ? $order->toArray() : []);
    }
1042846
public function orderBy($order = null) {
		if (is_null($order)) //remove option
			return $this->discard('query.orderBy');
			
		return $this->merge(['query.orderBy' => func_get_args()]);
	}
98584
public function send(OrderInterface $order, $customerId = null)
    {
        $request = new ApiRequest();
        if (!empty($customerId)) {
            $request->setPath(ApiRequest::PATH_ORDER_TAGGING);
            $replaceParams = array('{m}' => $this->account->getName(), '{cid}' => $customerId);
        } else {
            $request->setPath(ApiRequest::PATH_UNMATCHED_ORDER_TAGGING);
            $replaceParams = array('{m}' => $this->account->getName());
        }
        if (is_string($this->activeDomain)) {
            $request->setActiveDomainHeader($this->activeDomain);
        }
        if (is_string($this->account->getName())) {
            $request->setNostoAccountHeader($this->account->getName());
        }
        $request->setReplaceParams($replaceParams);
        $response = $request->post($order);
        return self::checkResponse($request, $response);
    }
1294056
@Override
  public boolean cancelOrder(String orderId) throws IOException {
    CurrencyPair cp =
        (CurrencyPair)
            exchange
                .getExchangeSpecification()
                .getExchangeSpecificParameters()
                .get(TheRockExchange.CURRENCY_PAIR);
    if (cp == null) {
      throw new ExchangeException("Provide TheRockCancelOrderParams with orderId and currencyPair");
    }

    return cancelOrder(cp, orderId);
  }
201826
public function orderBy($sort, $order = null)
    {
        return $this->add('orderBy', $sort . ' ' . (! $order ? 'ASC' : $order), false);
    }
249699
protected function createItemBagForOrder(Order $order)
    {
        if (!$this->sendCartInfo) {
            return null;
        }

        $items = $this->getItemListForOrder($order);
        $itemBagClassName = $this->getItemBagClassName();

        return new $itemBagClassName($items);
    }
1121725
def orderExecuted(self, orderId):
        '''  '''
        if orderId == self.__stopOrderId:
            LOG.debug("smaStrategy stop order canceled %s" % orderId)
            # stop order executed
            self.__clearStopOrder()
1250855
public function order($order)
    {
        $order = $this->prepareNames(func_get_args(),false);
        $this->order = $order;
        return $this;
    }
926436
protected function normalizeOrder($order)
    {
        switch (strtolower($order)) {
            case 'asc':
                return 'asc';
            case 'desc':
                return 'desc';
            default:
                throw new QueryException(sprintf('Unsupported sorting method "%s" in query "%s"', $this->getType($order), $this->model->entity()));

        }
    }
67510
public function cancelOrder()
    {
        $order = oxNew(\OxidEsales\Eshop\Application\Model\Order::class);
        if ($order->load($this->getEditObjectId())) {
            $order->cancelOrder();
        }

        $this->resetContentCache();

        $this->init();
    }
457548
public function resetAction(Request $request)
    {
        $cart = $this->getCart();
        $event = new OrderEvent($cart);
        $this->get('ekyna_order.order.operator')->delete($event, true);
        if (!$event->hasErrors()) {
            $this->addFlash('ekyna_cart.message.reset');
        } else {
            $event->toFlashes($this->getFlashBag());
        }

        return $this->redirectAfterContentChange($request);
    }
1366691
def delete_order(self, order_id):
        """"""
        request = self._delete("transactions/orders/" + str(order_id))
        return self.responder(request)
483583
public function cancel($purchaseOrderId, $order)
    {
        if(!is_numeric($purchaseOrderId)){
            throw new \Exception("purchaseOrderId must be numeric",1448480746);
        }

        $schema = [
            '/orderCancellation' => [
                'namespace' => 'ns3',
                'childNamespace' => 'ns3',
            ],
            '/orderCancellation/orderLines' => [
                'sendItemsAs' => 'orderLine',
            ],
            '/orderCancellation/orderLines/orderLine/orderLineStatuses' => [
                'sendItemsAs' => 'orderLineStatus',
            ],
            '@namespaces' => [
                'ns3' => 'http://walmart.com/mp/v3/orders'
            ],
        ];

        $a2x = new A2X($order, $schema);
        $xml = $a2x->asXml();
        
        return $this->cancelOrder([
            'purchaseOrderId' => $purchaseOrderId,
            'order' => $xml,
        ]);
    }
1355013
public function cancelRedirectAction(Request $request)
    {
        $orderReference = $request->query->get('orderReference');
        $urlHmac = $request->query->get('sig');

        if ($orderReference) {
            $cancelRedirectTransfer = new PayoneCancelRedirectTransfer();
            $cancelRedirectTransfer->setOrderReference($orderReference);
            $cancelRedirectTransfer->setUrlHmac($urlHmac);

            $response = $this->getClient()->cancelRedirect($cancelRedirectTransfer);
        }

        return $this->redirectResponseInternal(PayoneControllerProvider::CHECKOUT_PAYMENT);
    }
275071
public function truncateOrderCoupons(OrderInterface $order)
    {
        $orderCoupons = $this
            ->orderCouponRepository
            ->findOrderCouponsByOrder($order);

        if ($orderCoupons instanceof Collection) {
            foreach ($orderCoupons as $orderCoupon) {
                $this
                    ->orderCouponObjectManager
                    ->remove($orderCoupon);
            }

            $this
                ->orderCouponObjectManager
                ->flush($orderCoupons->toArray());
        }

        return $this;
    }
1148044
public final function setOrderData(Order $order)
    {
        if (get_called_class() != self::class) {
            throw new \InvalidArgumentException("Method can be call only by OrderFinalized entity");
        }
        $this->id = $order->id;
        $this->setProperties($order);
    }
1057032
def cancel_orders(self, order_ids: List[str]) -> List[str]:
        """"""
        orders_to_cancel = order_ids
        self.log.debug(f'Canceling orders on {self.name}: ids={orders_to_cancel}')
        cancelled_orders = []

        if self.dry_run:  # Don't cancel if dry run
            self.log.warning(f'DRY RUN: Orders cancelled on {self.name}: {orders_to_cancel}')
            return orders_to_cancel

        try:  # Iterate and cancel orders
            if self.has_batch_cancel:
                self._cancel_orders(orders_to_cancel)
                cancelled_orders.append(orders_to_cancel)
                orders_to_cancel.clear()
            else:
                for i, order_id in enumerate(orders_to_cancel):
                    self._cancel_order(order_id)
                    cancelled_orders.append(order_id)
                    orders_to_cancel.pop(i)
        except Exception as e:
            msg = f'Failed to cancel {len(orders_to_cancel)} orders on {self.name}: ids={orders_to_cancel}'
            raise self.exception(OrderNotFound, msg, e) from e

        self.log.info(f'Orders cancelled on {self.name}: ids={cancelled_orders}')
        return cancelled_orders