UserMerchantSolver.php 629B

1234567891011121314151617181920212223242526
  1. <?php
  2. namespace Lc\CaracoleBundle\Solver\User;
  3. use Lc\CaracoleBundle\Model\User\UserMerchantInterface;
  4. class UserMerchantSolver
  5. {
  6. public function isCreditActive(UserMerchantInterface $userMerchant = null)
  7. {
  8. if (!$userMerchant || ($userMerchant && !$userMerchant->isCreditActive())) {
  9. return false;
  10. }
  11. return true;
  12. }
  13. public function isCreditSufficientToPay(UserMerchantInterface $userMerchant, float $amount)
  14. {
  15. if ($this->isCreditActive($userMerchant) && $userMerchant->getCredit() >= $amount) {
  16. return true;
  17. }
  18. return false;
  19. }
  20. }