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