Has this order been paid for? We determine this
by checking one of the pre-defined "paid_statuses"
in the config variable:

# Order.paid_statuses

@return boolean
500244
public function isPaid()
    {
        $statuses = $this->config()->get("paid_statuses");

        if (!is_array($statuses)) {
            return $this->Status == $statuses;
        } else {
            return in_array($this->Status, $statuses);
        }
    }
686372
private function compareStatus($order, $payment)
    {
        if (! (in_array($order->getStatus(), [
                $this->getStatusFromPaymentKey(1),
                $this->getStatusFromPaymentKey(2)
            ]) || in_array($payment->getStatus(), [1, 2]))) {
            return false;
        }
        return true;
    }
524970
function in_special_checkout() {
    if ((defined('MODULE_PAYMENT_PAYPALWPP_STATUS') && MODULE_PAYMENT_PAYPALWPP_STATUS == 'True') &&
             !empty($_SESSION['paypal_ec_token']) &&
             !empty($_SESSION['paypal_ec_payer_id']) &&
             !empty($_SESSION['paypal_ec_payer_info'])) {
      $this->flagDisablePaymentAddressChange = true;
      return true;
    }
  }
423089
public function isVoided()
    {
        if ($this->parent) {
            return $this->parent->isVoided();
        }

        return $this->children->exists(function($key, Transaction $child) {
            return $child->getType() == Transaction\TransactionType::VOID && $child->getStatus() == Result\ResultStatus::APPROVED;
        });
    }
527688
protected function hasPaymentWithStatus($status)
    {
        $hasStatus = false;
        $payments = $this->getArray();

        foreach ($payments as $payment) {
            if ($status == $payment->getStatus()) {
                $hasStatus = true;
                break;
            }
        }

        return $hasStatus;
    }
382018
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();
        }
    }
797174
public function isPayPalOrder()
    {
        $active = false;

        $order = $this->getEditObject();
        if ($order && $order->getFieldData('oxpaymenttype') == 'oxidpaypal') {
            $active = true;
        }

        return $active;
    }
518051
public function isSuccessful()
    {
        $isHttpSuccess = parent::isSuccessful();
        $isPurchaseSuccess = false;

        if (isset($this->data['paymentStatus']) && $this->data['paymentStatus'] == $this->successfulPaymentStatus) {
            $isPurchaseSuccess = true;
        }

        return ($isHttpSuccess && $isPurchaseSuccess);
    }
204151
protected function getOrderPaymentStatusFinal()
    {
        $status = null;
        if ($this->isOrderPaymentStatusFinal()) {
            $status = $this->getOrder()->getPaymentStatus();
        }

        return $status;
    }
762208
public function isVatIncluded()
    {
        if ($this->_blIsVatIncluded !== null) {
            return $this->_blIsVatIncluded;
        }

        $config = \OxidEsales\Eshop\Core\Registry::getConfig();
        /*
         * Do not show "inclusive VAT" when:
         *
         *   B2B mode is activated
         * OR
         *   the VAT will only be calculated in the basket
         * OR
         *   the country does not bill VAT
         *
         * oxcountry__oxvatstatus: Vat status: 0 - Do not bill VAT, 1 - Do not bill VAT only if provided valid VAT ID
         * if country is not available (no session) oxvatstatus->value will return null
         */
        if ($config->getConfigParam('blShowNetPrice') || $config->getConfigParam('bl_perfCalcVatOnlyForBasketOrder')) {
            return $this->_blIsVatIncluded = false;
        }

        $user = $this->getUser();
        if ($user !== false) {
            if ($user->getFieldData('oxustid') && $user->getFieldData('oxustidstatus') == 1) {
                return $this->_blIsVatIncluded = false;
            }
        } else {
            $user = oxNew(\OxidEsales\Eshop\Application\Model\User::class);
        }

        $activeCountry = $user->getActiveCountry();
        if ($activeCountry !== '') {
            $country = oxNew(\OxidEsales\Eshop\Application\Model\Country::class);
            if ($country->load($activeCountry) &&
                $country->oxcountry__oxvatstatus->value !== null &&
                $country->oxcountry__oxvatstatus->value == 0
            ) {
                return $this->_blIsVatIncluded = false;
            }
        }

        return $this->_blIsVatIncluded = true;
    }
436676
protected function getPaymentStatusOrder()
    {
        return Number::isZero($this->source->getBaseTotalDue())
            ? Api::PaymentStatus_Paid
            : Api::PaymentStatus_Due;
    }
291332
public function getPaymentStatus()
    {
        if ($this->Status) {
            return _t('SilverStripe\Omnipay\Model\Payment.STATUS_' . strtoupper($this->Status), $this->Status);
        }
        return null;
    }
851502
protected function getPaymentMethodsCheckout()
    {
        $list = $this->payment->getList(array('status' => true));
        $this->prepareMethodsCheckout($list);
        return $list;
    }
961064
public function approve()
	{

		$id = Input::get('id');
		$terminal = Terminal::whereUserId($this->userId())->first();
		$payment = Payment::find($id);
		if ($payment->term == $terminal->id) {

			$status = $payment->getPossibleStatus();

			if ($status) {
				$payment->status = $status;
				$payment->save();

				if ($payment->getPossibleStatus()) {
					return array(
						'next'  => true,
						'value' => 'Move to [' . $payment->getPossibleStatus() . ']',
						'status' => $payment->status,
					);
				}

			}

		}

		return array(
			'next' => false,
			'status' => $payment? $payment->status: null,
		);

	}
312271
public function isSuccessful()
    {
        $status = new Constants\Transaction\States(
            isset($this->responseObj->status) ? $this->responseObj->status : ''
        );

        if ($status->isValid()) {
            return !$status->isError();
        }

        return null;
    }
280485
public function TotalPaid()
    {
        $paid = 0;

        if ($payments = $this->owner->Payments()) {
            foreach ($payments as $payment) {
                if ($payment->Status == 'Captured') {
                    $paid += $payment->Amount;
                }
            }
        }

        return $paid;
    }
454017
public function isActive() {
        if (!$this->getValue(
                self::KEY_ACTIVE,
                $this->storeManager->getStore()
            )) {
            return false;
        }

        $quote = $this->checkoutSession->getQuote();

        return (bool) in_array($quote->getQuoteCurrencyCode(), $this->getAcceptedCurrencies());
    }