@@ -9,18 +9,38 @@ class CheckoutConfirmPage
99{
1010 public function execute (): void
1111 {
12- if (isset ($ _SESSION ['Zahlungsart ' ]) && $ _SESSION ['Zahlungsart ' ]->cAnbieter == 'Mondu ' ) {
13- if (isset ($ GLOBALS ['step ' ]) && $ GLOBALS ['step ' ] == 'Bestaetigung ' ) {
14- if (!isset ($ _SESSION ['monduOrderUuid ' ]) || empty ($ _SESSION ['monduOrderUuid ' ]) || $ _GET ['payment ' ] != 'accepted ' ) {
15- $ orderService = new OrderService ();
16- $ orderData = $ orderService ->token ($ _SESSION ['Zahlungsart ' ]->cModulId );
17-
18- header ('Location: ' . $ orderData ['hosted_checkout_url ' ], true , 303 );
19- exit ;
20- }
21- }
12+ if (!$ this ->isMonduPayment () || !$ this ->isConfirmStep ()) return ;
13+
14+ if ($ _GET ['payment ' ] !== 'accepted ' && $ _SERVER ['REQUEST_METHOD ' ] === 'GET ' ) {
15+ header ('Location: ' . Shop::Container ()->getLinkService ()->getStaticRoute ('bestellvorgang.php ' ) . '?editZahlungsart=1 ' );
16+ }
17+
18+ if ($ _GET ['payment ' ] == 'accepted ' || !$ this ->isMonduOrderSessionMissing ()) return ;
19+
20+ if ($ _GET ['monduCreateOrder ' ] !== 'true ' ) {
21+ header ('Location: ' . Shop::Container ()->getLinkService ()->getStaticRoute ('bestellvorgang.php ' ) . '?monduCreateOrder=true ' );
22+ exit ;
23+ }
24+
25+ if ($ _GET ['monduCreateOrder ' ] === 'true ' ) {
26+ $ orderService = new OrderService ();
27+ $ orderData = $ orderService ->token ($ _SESSION ['Zahlungsart ' ]->cModulId );
28+ header ('Location: ' . $ orderData ['hosted_checkout_url ' ], true , 303 );
29+ exit ;
2230 }
2331 }
32+
33+ protected function isMonduPayment () {
34+ return isset ($ _SESSION ['Zahlungsart ' ]) && $ _SESSION ['Zahlungsart ' ]->cAnbieter == 'Mondu ' ;
35+ }
36+
37+ protected function isConfirmStep () {
38+ return isset ($ GLOBALS ['step ' ]) && $ GLOBALS ['step ' ] == 'Bestaetigung ' ;
39+ }
40+
41+ protected function isMonduOrderSessionMissing () {
42+ return !isset ($ _SESSION ['monduOrderUuid ' ]) || empty ($ _SESSION ['monduOrderUuid ' ]);
43+ }
2444}
2545
2646$ hook = new CheckoutConfirmPage ();
0 commit comments