Commit 4cfa092e authored by Yan Loetzer's avatar Yan Loetzer Committed by Paul Smith
Browse files

By yanniboi: Fixed order placed post transitions missed if paying order in full.

parent a32a9022
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -65,9 +65,20 @@ class OrderHooks {
      if ($is_positive) {
        $this->applyTransitionIfAllowed($order->getState(), 'payment_undone');
      }
      // Otherwise, use the paid_in_full transition.
      // Otherwise, transition to the paid_in_full state.
      else {
        $this->applyTransitionIfAllowed($order->getState(), 'paid_in_full');
        // If we are confirming the booking and paying in full in the same
        // transition we need to reset the order state back to the original
        // state (likely 'draft') before applying the transition.
        $order->set('state', $original->getState()->getId());

        $state_item = $order->getState();

        // Transition might be paid_in_full or confirmed_paid_in_full.
        $transition = $state_item->getWorkflow()->findTransition($state_item->getId(), 'paid_in_full');
        if ($transition) {
          $state_item->applyTransition($transition);
        }
      }
    }
  }