| @@ 86-97 (lines=12) @@ | ||
| 83 | /** |
|
| 84 | * {@inheritdoc} |
|
| 85 | */ |
|
| 86 | public function prepare(ItemHolderInterface $itemHolder, PurchaseContext $context) |
|
| 87 | { |
|
| 88 | if (!$this->supports($itemHolder, $context)) { |
|
| 89 | return; |
|
| 90 | } |
|
| 91 | ||
| 92 | $diffUsePoint = $this->getDiffOfUsePoint($itemHolder, $context); |
|
| 93 | ||
| 94 | // ユーザの保有ポイントを減算 |
|
| 95 | $Customer = $itemHolder->getCustomer(); |
|
| 96 | $Customer->setPoint($Customer->getPoint() - $diffUsePoint); |
|
| 97 | } |
|
| 98 | ||
| 99 | /** |
|
| 100 | * {@inheritdoc |
|
| @@ 110-120 (lines=11) @@ | ||
| 107 | /** |
|
| 108 | * {@inheritdoc |
|
| 109 | */ |
|
| 110 | public function rollback(ItemHolderInterface $itemHolder, PurchaseContext $context) |
|
| 111 | { |
|
| 112 | if (!$this->supports($itemHolder, $context)) { |
|
| 113 | return; |
|
| 114 | } |
|
| 115 | ||
| 116 | $diffUsePoint = $this->getDiffOfUsePoint($itemHolder, $context); |
|
| 117 | ||
| 118 | $Customer = $itemHolder->getCustomer(); |
|
| 119 | $Customer->setPoint($Customer->getPoint() + $diffUsePoint); |
|
| 120 | } |
|
| 121 | ||
| 122 | /* |
|
| 123 | * Helper methods |
|