HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/ZelfVerkopen/zelfverkopen.nl/app/KommaApp/Icepay/Api/PaymentStatus.php
<?php


namespace App\KommaApp\Icepay\Paybymail;

/**
 * Class PaymentStatus
 *
 * Represents user paymentStatuses.
 * Will be replaced by the PaymentStatus model since this is a interim solution
 */
abstract class PaymentStatuses
{
    const OK = "OK"; //Payment has been completed successfully.
    const OPEN = "OPEN"; //Payment has not yet been completed. You will receive another postback in the near future, which will tell you if the payment has been completed or expired.
    const ERROR = "ERR"; //Payment failed, expired or manually cancelled by the end-user.
    const REFUNDED = "REFUND"; //The request refund of the payment has been processed successfully.
    const CHARGED_BACK = "CBACK"; //A charge back for the payment has been requested by the enduser.

    /**
     * @return int[] All paymentStatuses as an array of integers
     */
    static function getAsArray() {
        return self::getAllPaymentStatuses();
    }

    /**
     * Check if the passed paymentStatus is really a paymentStatus that is defined as a constant in this class.
     *
     * @param int $paymentStatus
     * @param bool $strict If true it will only consider a paymentStatus as valid if it is an int. If it for example is a numeric string it won't consider it valid
     * @return bool Returns true if the paymentStatus is a valid one, false otherwise
     */
    static function isValidPaymentStatus(int $paymentStatus, $strict = false) {
        return in_array($paymentStatus, self::getAllPaymentStatuses(), $strict);
    }

    /**
     * Returns an array containing integers representing the defined paymentStatuses.
     *
     * @return int[]
     */
    private static function getAllPaymentStatuses()
    {
        $thisClassAsReflectionClass = new \ReflectionClass(__CLASS__);
        return $thisClassAsReflectionClass->getConstants();
    }
}