Slide 26
Slide 26 text
[core] AddPointUseCase
public function run(int $customerId, int $addPoint): int
{
if ($addPoint <= 0) {
throw new DomainRuleException(
'add_point should be equals or greater than 1');
}
if (!$this->customer->existsId($customerId)) {
$message = sprintf(
'customer_id:%d does not exists', $customerId);
throw new DomainRuleException($message);
}
$this->customerPoint->addPoint($customerId, $addPoint);
return $this->customerPoint->findPoint($customerId);
}