<?php

/**
 * 
 * @author Anton (2021)
 *
 */
class TransactionTokenUtil extends System {
    public function __construct(){
        parent::__construct();
    }
    
    /**
     * 
     * @param string $token
     * @param int $owner
     */
    public function storeToken($token, $owner){
        $this -> accessModify("INSERT_TRANSACTION_TOKEN", ["('){$token}(')", 1, $owner], false);
    }
    
    /**
     * 
     * @param string $token
     * @return StdClass|boolean
     */
    public function getTokenObject($token){
        $result = $this -> accessSelect("SELECT_TRANSACTION_TOKEN", ["('){$token}(')"]);
                
        if(count($result) != 0){
            $obj = (object) $this -> getRowData($result, NO_COUNT);
            return $obj;
        }
        
        return false;
    }
}