<?php


class GatewayResponse implements \JsonSerializable{
    private $id;
    private $amount;
	private $orderId;
    private $totalAmount;
    private $currency;
    private $lang;
    private $customerId;
    private $verificationLevel;
    private $transactionId;
    private $transactionType;
    private $description;
    private $status;
    private $processor;

	/*use SetterTrait;
	use GetterTrait;
    use JsonSerializeTrait;*/
    
    public function __construct($data = null){
		if($data !== null){
			foreach($data as $key => $value){
				$this->$key = $value;
			}
		}
	}

    public function __set($name, $value)
    {
        $setter = 'set'.$name;
        if (method_exists($this, $setter)) {
            $this->$setter($value);
        } else {
            $this->$name = $value;
        }
    }

    public function __get($name){
        return $this->$name;
    }

    public function jsonSerialize()
    {
        $vars = array_filter(get_object_vars($this), function($val){ return $val !== null; });
        return $vars;
    }
}
