public function setPaymentStatus($status, \OxidEsales\Eshop\Application\Model\Order $order = null)
    {
        $this->setValue('oepaypal_paymentstatus', $status);

        // if payment completed, set order paid
        if ($status == \OxidEsales\PayPalModule\Model\PayPalOrder::PAYPAL_ORDER_STATE_COMPLETED) {
            if (is_null($order)) {
                $order = oxNew(\OxidEsales\Eshop\Application\Model\Order::class);
                $order->load($this->getOrderId());
            }
            $order->markOrderPaid();
        }
    }