Conditions | 3 |
Paths | 3 |
Total Lines | 14 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
18 | 4 | public function process(ItemHolderInterface $itemHolder, PurchaseContext $context) |
|
19 | { |
||
20 | 4 | $Order = $itemHolder; |
|
21 | 4 | $Customer = $context->getUser(); |
|
22 | 4 | if (!$Customer) { |
|
23 | 1 | return ProcessResult::success(); |
|
24 | } |
||
25 | 3 | if ($Customer->getPoint() < $Order->getUsePoint()) { |
|
26 | 1 | return ProcessResult::error('利用ポイントが所有ポイントを上回っています.'); |
|
27 | } |
||
28 | 2 | $Customer->setPoint($Customer->getPoint() + $Order->getUsePoint() * -1); |
|
29 | |||
30 | 2 | return ProcessResult::success(); |
|
31 | } |
||
32 | } |
||
33 |