orderShopStore = $orderShopStore; $this->reductionCreditStore = $reductionCreditStore; } public function getReductionCreditsAvailableByUser(UserInterface $user) { $reductionCredits = $this->reductionCreditStore->getByTypeAndUser(ReductionCreditModel::TYPE_CREDIT, $user); $reductionCreditsArray = []; foreach ($reductionCredits as $reductionCredit) { if (!$this->orderShopStore->countValidOrderWithReductionCredit($reductionCredit, $user)) { $reductionCreditsArray[] = $reductionCredit; } } return $reductionCreditsArray; } public function getReductionGiftsAvailableByUser($user) { $reductionGifts = $this->reductionCreditStore->getByTypeAndUser(ReductionCreditModel::TYPE_GIFT, $user); $reductionGiftsArray = []; foreach ($reductionGifts as $reductionGift) { if (!$this->orderShopStore->countValidOrderWithReductionCredit($reductionGift)) { $reductionGiftsArray[] = $reductionGift; } } return $reductionGiftsArray; } }