From 534307a08d87c338604f2542a0546f49ca594080 Mon Sep 17 00:00:00 2001
From: Henning Leutz <leutz@pcsg.de>
Date: Wed, 23 Jun 2021 12:38:50 +0200
Subject: [PATCH] fix: quiqqer/order#140

---
 events.xml                     | 3 +++
 src/QUI/ERP/Coupons/Events.php | 8 ++++++++
 2 files changed, 11 insertions(+)

diff --git a/events.xml b/events.xml
index 40d75ed..4ce5084 100644
--- a/events.xml
+++ b/events.xml
@@ -24,4 +24,7 @@
            fire="\QUI\ERP\Coupons\Events::onQuiqqerOrderBasketRemovePos"
     />
 
+    <event on="onQuiqqerOrderSuccessful" fire="\QUI\ERP\Coupons\Events::removeCouponsFromSession"/>
+    <event on="onQuiqqer::order::orderProcessFinish" fire="\QUI\ERP\Coupons\Events::removeCouponsFromSession"/>
+
 </events>
diff --git a/src/QUI/ERP/Coupons/Events.php b/src/QUI/ERP/Coupons/Events.php
index 12c599c..102ae37 100644
--- a/src/QUI/ERP/Coupons/Events.php
+++ b/src/QUI/ERP/Coupons/Events.php
@@ -393,4 +393,12 @@ protected static function addCouponToOrder($Order, $coupon)
         } catch (\Exception $Exception) {
         }
     }
+
+    /**
+     *
+     */
+    public static function removeCouponsFromSession()
+    {
+        QUI::getSession()->remove('quiqqer-coupons');
+    }
 }
-- 
GitLab