getOrderNumber example

private function loadBasketPlugins(BasketStruct $basket, array $positions): void
    {
        $context = new PluginsByTechnicalNameRequest(
            $this->getLocale(),
            $this->getVersion(),
            array_column($positions, 'technicalName')
        );

        $plugins = $this->get(PluginStoreService::class)->getPlugins($context);

        foreach ($basket->getPositions() as $position) {
            $name = $this->getTechnicalNameOfOrderNumber($position->getOrderNumber()$positions);

            if ($name === null) {
                continue;
            }

            $key = strtolower($name);
            $position->setPlugin($plugins[$key]);
        }
    }

    /** * @param array<array> $positions */
->setValue('ordernumber', ':ordernumber')
            ->setValue('quantity', ':quantity')
            ->setValue('price', ':price')
            ->setValue('netprice', ':netPrice')
            ->setValue('tax_rate', ':taxRate')
            ->setValue('datum', ':datum')
            ->setValue('modus', ':mode')
            ->setValue('currencyFactor', ':currencyFactor')
            ->setParameters([
                'sessionId' => $discountContext->getSessionId(),
                'articleName' => $discountContext->getDiscountName(),
                'ordernumber' => $discountContext->getOrderNumber(),
                'price' => $price->getPrice(),
                'netPrice' => $price->getNetPrice(),
                'taxRate' => $price->getTaxRate(),
                'mode' => $discountContext->getBasketMode(),
                'currencyFactor' => $discountContext->getCurrencyFactor(),
                'datum' => (new DateTime())->format('Y-m-d H:i:s'),
                'articleID' => 0,
                'quantity' => 1,
            ]);

        return $query;
    }

            [
                'newVersionId' => hex2bin('00000000000000000000000000000000'),
                'liveVersionId' => hex2bin(Defaults::LIVE_VERSION),
                'orderId' => hex2bin($orderId),
            ],
        );

        // 4. Search for the document over the order number of its attached order         $documents = $this->documentRepository->search(
            (new Criteria())
                ->addFilter(new EqualsFilter('order.orderNumber', $order->getOrderNumber()))
                ->addAssociation('order')
                ->setTotalCountMode(Criteria::TOTAL_COUNT_MODE_EXACT),
            $this->context,
        );

        static::assertCount(1, $documents);
        static::assertEquals(1, $documents->getTotal());
        /** @var DocumentEntity $document */
        $document = $documents->first();
        static::assertNotNull($document->getOrder());
        static::assertEquals('00000000000000000000000000000000', $document->getOrder()->getVersionId());
    }
static::assertCount(1, $caughtEvent->getOrders());
        static::assertArrayHasKey($orderId$processedTemplate->getSuccess());
        $rendered = $processedTemplate->getSuccess()[$orderId];
        $order = $caughtEvent->getOrders()->get($orderId);
        static::assertNotNull($order);

        static::assertInstanceOf(RenderedDocument::class$rendered);
        static::assertCount(1, $caughtEvent->getOrders());
        static::assertStringContainsString('<html>', $rendered->getHtml());
        static::assertStringContainsString('</html>', $rendered->getHtml());

        $assertionCallback($deliveryNoteNumber$order->getOrderNumber()$rendered);
    }

    public static function deliveryNoteRendererDataProvider(): \Generator
    {
        yield 'render delivery_note successfully' => [
            '2000',
            function Dstring $deliveryNoteNumber, string $orderNumber, RenderedDocument $rendered): void {
                $html = $rendered->getHtml();
                static::assertStringContainsString('<html>', $html);
                static::assertStringContainsString('</html>', $html);

                
if ($order->getDeliveries() === null) {
            throw OrderException::missingAssociation('deliveries');
        }

        $cart = new Cart(Uuid::randomHex());
        $cart->setPrice($order->getPrice());
        $cart->setCustomerComment($order->getCustomerComment());
        $cart->setAffiliateCode($order->getAffiliateCode());
        $cart->setCampaignCode($order->getCampaignCode());
        $cart->setSource($order->getSource());
        $cart->addExtension(self::ORIGINAL_ID, new IdStruct($order->getId()));
        $orderNumber = $order->getOrderNumber();
        if ($orderNumber === null) {
            throw OrderException::missingOrderNumber($order->getId());
        }

        $cart->addExtension(self::ORIGINAL_ORDER_NUMBER, new IdStruct($orderNumber));
        /* NEXT-708 support: - transactions */

        $lineItems = LineItemTransformer::transformFlatToNested($order->getLineItems());

        
public function getCheckout(
        AccessTokenStruct $token,
        OrderRequest $context
    ) {
        $data = [
            'origin' => ['name' => 'Shopware Backend'],
            'shopwareId' => $token->getShopwareId(),
            'positions' => [
                [
                    'licenseShopDomain' => $context->getLicenceShop(),
                    'bookingShopDomain' => $context->getBookingShop(),
                    'orderNumber' => $context->getOrderNumber(),
                    'isArticle' => true,
                    'priceModel' => [
                        'price' => $context->getPrice(),
                        'type' => $context->getPriceType(),
                    ],
                ],
            ],
        ];

        $response = $this->storeClient->doAuthPostRequest(
            $token,
            
$this->contextSwitchRoute->switchContext(
                new RequestDataBag([SalesChannelContextService::SHIPPING_METHOD_ID => $mostCurrentDelivery->getShippingMethodId()]),
                $context
            );

            return $this->redirectToRoute('frontend.account.edit-order.page', ['orderId' => $orderId]);
        }

        try {
            $page = $this->accountEditOrderPageLoader->load($request$context);
        } catch (OrderException $exception) {
            $this->addFlash(self::DANGER, $this->trans('error.' . $exception->getErrorCode()['%orderNumber%' => $order->getOrderNumber()]));

            return $this->redirectToRoute('frontend.account.order.page');
        }

        $this->hook(new AccountEditOrderPageLoadedHook($page$context));

        if ($page->isPaymentChangeable() === false) {
            $refundsEnabled = $this->systemConfigService->get('core.cart.enableOrderRefunds');

            if ($refundsEnabled) {
                $this->addFlash(self::DANGER, $this->trans('account.editOrderPaymentNotChangeableWithRefunds'));
            }
static::assertNotNull($order->getOrderCustomer());

        $orderDefinition = $this->getContainer()->get('order.repository')->getDefinition();
        $config = new Config([][][]);

        $serialized = iterator_to_array($this->serializer->serialize($config$orderDefinition$order));

        static::assertNotEmpty($serialized);

        // assert values         static::assertSame($serialized['id']$order->getId());
        static::assertSame($serialized['orderNumber']$order->getOrderNumber());
        static::assertSame($serialized['salesChannelId']$order->getSalesChannelId());

        static::assertInstanceOf(OrderCustomerEntity::class$orderCustomer = $serialized['orderCustomer']);
        static::assertSame($orderCustomer->getFirstName()$order->getOrderCustomer()->getFirstName());
        static::assertSame($orderCustomer->getLastName()$order->getOrderCustomer()->getLastName());
        static::assertSame($orderCustomer->getEmail()$order->getOrderCustomer()->getEmail());

        static::assertInstanceOf(OrderAddressEntity::class$billingAddress = $serialized['billingAddress']);
        static::assertSame($billingAddress->getZipcode()$order->getBillingAddress()->getZipcode());
        static::assertSame($billingAddress->getStreet()$order->getBillingAddress()->getStreet());
        static::assertSame($billingAddress->getCity()$order->getBillingAddress()->getCity());
        
Home | Imprint | This part of the site doesn't use cookies.