Conditions | 3 |
Paths | 3 |
Total Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
27 | public function init() |
||
28 | { |
||
29 | parent::init(); |
||
30 | $reservation = $this->getReservation(); |
||
31 | |||
32 | // If we get to the success controller form any state except PENDING or PAID |
||
33 | // This would mean someone would be clever and change the url from summary to success bypassing the payment |
||
34 | // End the session, thus removing the reservation, and redirect back |
||
35 | if (!in_array($reservation->Status, array('PENDING', 'PAID'))) { |
||
36 | ReservationSession::end(); |
||
37 | $this->redirect($this->Link('/')); |
||
38 | } elseif ($reservation->Status !== 'PAID') { |
||
39 | // todo move to TicketPayment::onCaptured() |
||
40 | $this->extend('afterPaymentComplete', $reservation); |
||
41 | } |
||
42 | } |
||
43 | } |
||
44 |