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