function checkAndPrepare(Config $config) {
		$this->merchantId = $config->merchantId;

		$this->dttm = date(Client::DATE_FORMAT);

		if (!$this->payOperation) {
			$this->payOperation = self::OPERATION_PAYMENT;
		}

		if (!$this->payMethod) {
			$this->payMethod = "card";
		}

		if (!$this->currency) {
			$this->currency = "CZK";
		}

		if (!$this->language) {
			$this->language = "CZ";
		}
		
		if (!$this->ttlSec or !is_numeric($this->ttlSec)) {
			$this->ttlSec = 1800;
		}

		if ($this->closePayment === null) {
			$this->closePayment = $config->closePayment ? true : false;
		}

		if (!$this->returnUrl) {
			$this->returnUrl = $config->returnUrl;
		}
		if (!$this->returnUrl) {
			throw new Exception("A ReturnUrl must be set - either by setting \$returnUrl property, or by specifying it in Config.");
		}

		if (!$this->returnMethod) {
			$this->returnMethod = $config->returnMethod;
		}

		if (!$this->description) {
			$this->description = $config->shopName.", ".$this->orderNo;
		}
		$this->description = Strings::shorten($this->description, 240, "...");

		$this->customerId = Strings::shorten($this->customerId, 50, "", true, true);

		if (!$this->cart) {
			throw new Exception("Cart is empty. Please add one or two items into cart using addCartItem() method.");
		}

		if (!$this->orderNo or !preg_match('~^[0-9]{1,10}$~', $this->orderNo)) {
			throw new Exception("Invalid orderNo - it must be a non-empty numeric value, 10 characters max.");
		}

		$sumOfItems = array_sum(Arrays::transform($this->cart, true, "amount"));
		$this->totalAmount = $sumOfItems;

		return $this;
	}
function checkAndPrepare(Config $config) {
		$this->merchantId = $config->merchantId;

		$this->dttm = date(Client::DATE_FORMAT);

		if (!$this->payOperation) {
			$this->payOperation = self::OPERATION_PAYMENT;
		}

		if (!$this->payMethod) {
			$this->payMethod = "card";
		}

		if (!$this->currency) {
			$this->currency = "CZK";
		}

		if (!$this->language) {
			$this->language = "CZ";
		}
		
		if (!$this->ttlSec or !is_numeric($this->ttlSec)) {
			$this->ttlSec = 1800;
		}

		if ($this->closePayment === null) {
			$this->closePayment = $config->closePayment ? true : false;
		}

		if (!$this->returnUrl) {
			$this->returnUrl = $config->returnUrl;
		}
		if (!$this->returnUrl) {
			throw new Exception("A ReturnUrl must be set - either by setting \$returnUrl property, or by specifying it in Config.");
		}

		if (!$this->returnMethod) {
			$this->returnMethod = $config->returnMethod;
		}

		if (!$this->description) {
			$this->description = $config->shopName.", ".$this->orderNo;
		}
		$this->description = Strings::shorten($this->description, 240, "...");

		$this->customerId = Strings::shorten($this->customerId, 50, "", true, true);

		if (!$this->cart) {
			throw new Exception("Cart is empty. Please add one or two items into cart using addCartItem() method.");
		}

		if (!$this->orderNo or !preg_match('~^[0-9]{1,10}$~', $this->orderNo)) {
			throw new Exception("Invalid orderNo - it must be a non-empty numeric value, 10 characters max.");
		}

		$sumOfItems = array_sum(Arrays::transform($this->cart, true, "amount"));
		$this->totalAmount = $sumOfItems;

		return $this;
	}
function checkAndPrepare ( Config $ config ) { $ this -> merchantId = $ config -> merchantId ; $ this -> dttm = date ( Client :: DATE_FORMAT ) ; if ( ! $ this -> payOperation ) { $ this -> payOperation = self :: OPERATION_PAYMENT ; } if ( ! $ this -> payMethod ) { $ this -> payMethod = "card" ; } if ( ! $ this -> currency ) { $ this -> currency = "CZK" ; } if ( ! $ this -> language ) { $ this -> language = "CZ" ; } if ( ! $ this -> ttlSec or ! is_numeric ( $ this -> ttlSec ) ) { $ this -> ttlSec = 1800 ; } if ( $ this -> closePayment === null ) { $ this -> closePayment = $ config -> closePayment ? true : false ; } if ( ! $ this -> returnUrl ) { $ this -> returnUrl = $ config -> returnUrl ; } if ( ! $ this -> returnUrl ) { throw new Exception ( "A ReturnUrl must be set - either by setting \$returnUrl property, or by specifying it in Config." ) ; } if ( ! $ this -> returnMethod ) { $ this -> returnMethod = $ config -> returnMethod ; } if ( ! $ this -> description ) { $ this -> description = $ config -> shopName . ", " . $ this -> orderNo ; } $ this -> description = Strings :: shorten ( $ this -> description , 240 , "..." ) ; $ this -> customerId = Strings :: shorten ( $ this -> customerId , 50 , "" , true , true ) ; if ( ! $ this -> cart ) { throw new Exception ( "Cart is empty. Please add one or two items into cart using addCartItem() method." ) ; } if ( ! $ this -> orderNo or ! preg_match ( '~^[0-9]{1,10}$~' , $ this -> orderNo ) ) { throw new Exception ( "Invalid orderNo - it must be a non-empty numeric value, 10 characters max." ) ; } $ sumOfItems = array_sum ( Arrays :: transform ( $ this -> cart , true , "amount" ) ) ; $ this -> totalAmount = $ sumOfItems ; return $ this ; }
Validate and initialise properties. This method is called
automatically in proper time, you never have to call it on your own.

@param Config $config
@throws Exception
@return Payment Fluent interface

@ignore
Validate and initialise properties . This method is called automatically in proper time you never have to call it on your own .