getOrdersPerCustomerCount example

return $this->getMaxRedemptionsGlobal() === null
            || $this->getMaxRedemptionsGlobal() <= 0
            || $this->getOrderCount() < $this->getMaxRedemptionsGlobal();
    }

    public function isOrderCountPerCustomerCountValid(string $customerId): bool
    {
        $customerId = mb_strtolower($customerId);

        return $this->getMaxRedemptionsPerCustomer() === null
            || $this->getMaxRedemptionsPerCustomer() <= 0
            || $this->getOrdersPerCustomerCount() === null
            || !\array_key_exists($customerId$this->getOrdersPerCustomerCount())
            || $this->getOrdersPerCustomerCount()[$customerId] < $this->getMaxRedemptionsPerCustomer();
    }
}
$promotion = $this->promotionRepository
            ->search(new Criteria([$promotionId]), Context::createDefaultContext())
            ->get($promotionId);

        static::assertInstanceOf(PromotionEntity::class$promotion);

        // verify that the promotion has an total order count of 1 and the current customer is although tracked         static::assertEquals(1, $promotion->getOrderCount());
        static::assertNotNull($context->getCustomer());
        static::assertEquals(
            [$context->getCustomer()->getId() => 1],
            $promotion->getOrdersPerCustomerCount()
        );

        // order promotion with two products         $this->orderWithPromotion($code[$productId1$productId2]$context);

        /** @var PromotionEntity $promotion */
        $promotion = $this->promotionRepository
            ->search(new Criteria([$promotionId]), Context::createDefaultContext())
            ->get($promotionId);
        static::assertNotNull($promotion);

        
Home | Imprint | This part of the site doesn't use cookies.