Esempio n. 1
0
 public function revert(PromotionSubjectInterface $subject, array $configuration, PromotionInterface $promotion)
 {
     if (!$subject instanceof OrderInterface) {
         return;
     }
     if (!$promotion instanceof OriginAwareInterface) {
         return;
     }
     /** @var AdjustmentInterface $adjustment */
     foreach ($subject->getAdjustments() as $adjustment) {
         if ($adjustment->getOriginId() === $promotion->getOriginId() && $adjustment->getOriginType() === $promotion->getOriginType() && $adjustment->getType() === $this->getAdjustmentType()) {
             $subject->removeAdjustment($adjustment);
             break;
         }
     }
 }