public function completePayment()
    {
        if (!$this->order->IsPaid()) {
            // recalculate order to be sure we have the correct total
            $this->order->calculate();

            $this->order->extend('onPayment'); //a payment has been made
            //place the order, if not already placed
            if ($this->canPlace($this->order)) {
                $this->placeOrder();
            } else {
                if ($this->order->Locale) {
                    ShopTools::install_locale($this->order->Locale);
                }
            }

            if (($this->order->GrandTotal() > 0 && $this->order->TotalOutstanding(false) <= 0)
                // Zero-dollar order (e.g. paid with loyalty points)
                || ($this->order->GrandTotal() == 0 && Order::config()->allow_zero_order_total)
            ) {
                //set order as paid
                $this->order->Status = 'Paid';
                $this->order->write();
            }
        }
    }