createNetCustomerGroup example

$writeContext = WriteContext::createFromContext($context);

        $this->writer->upsert($this->customerDefinition, [$customer]$writeContext);
    }

    private function createCustomers(int $numberOfItems, DemodataContext $context): void
    {
        $writeContext = WriteContext::createFromContext($context->getContext());

        $context->getConsole()->progressStart($numberOfItems);

        $netCustomerGroupId = $this->createNetCustomerGroup($context->getContext());
        $customerGroups = [TestDefaults::FALLBACK_CUSTOMER_GROUP, $netCustomerGroupId];
        $tags = $this->getIds('tag');

        $salesChannelIds = $this->connection->fetchFirstColumn('SELECT LOWER(HEX(id)) FROM sales_channel');
        $countries = $this->connection->fetchFirstColumn('SELECT id FROM country WHERE active = 1');

        $payload = [];
        for ($i = 0; $i < $numberOfItems; ++$i) {
            $id = Uuid::randomHex();
            $firstName = $context->getFaker()->firstName();
            $lastName = $context->getFaker()->format('lastName');
            
bool $groupNet,
        array $possibleTaxes,
        array $creditPrices,
        \Closure $successCallback
    ): void {
        $this->setSalesChannelContext($groupNet);
        static::assertNotNull($this->salesChannelContext->getCustomer());

        $this->getContainer()->get('customer.repository')->update([
            [
                'id' => $this->salesChannelContext->getCustomer()->getId(),
                'groupId' => $groupNet ? $this->createNetCustomerGroup() : $this->createGrossCustomerGroup(),
            ],
        ]$this->salesChannelContext->getContext());

        $cart = $this->generateDemoCart($possibleTaxes);
        $cart = $this->generateCreditItems($cart$creditPrices);

        $orderId = $this->cartService->order($cart$this->salesChannelContext, new RequestDataBag());

        $invoiceConfig = new DocumentConfiguration();
        $invoiceConfig->setDocumentNumber('1001');

        
$customer = [
            'id' => $customerId,
            'number' => '1337',
            'salutationId' => $this->getValidSalutationId(),
            'firstName' => 'Max',
            'lastName' => 'Mustermann',
            'customerNumber' => '1337',
            'email' => Uuid::randomHex() . '@example.com',
            'password' => TestDefaults::HASHED_PASSWORD,
            'defaultPaymentMethodId' => $this->getValidPaymentMethodId(),
            'groupId' => $this->createNetCustomerGroup(),
            'salesChannelId' => TestDefaults::SALES_CHANNEL,
            'defaultBillingAddressId' => $addressId,
            'defaultShippingAddressId' => $addressId,
            'addresses' => [
                [
                    'id' => $addressId,
                    'customerId' => $customerId,
                    'countryId' => $this->getValidCountryId(),
                    'salutationId' => $this->getValidSalutationId(),
                    'firstName' => 'Max',
                    'lastName' => 'Mustermann',
                    
Home | Imprint | This part of the site doesn't use cookies.