src/Pakettikauppa/Shipment/AdditionalService.php
public function isValid()
    {
        // alternative pickup point
        if($this->service_code == 2106) {
            if($this->getSpecifier('pickup_point_id') === null)
                return false;
        }

        // cash on delivery (Postiennakko/Bussiennakko)
        if($this->service_code == 3101) {
            $expected_params = array('amount', 'account', 'reference', 'codbic');

            foreach($expected_params as $param)
            {
                if($this->getSpecifier($param) === null)
                    return false;
            }
        }

        // multipacket shipment requires package count
        if($this->service_code == 3102) {
            if($this->getSpecifier('count') === null)
                return false;

            if(!is_numeric($this->getSpecifier('count')))
                return false;
        }

        if($this->service_code == 3111) {
            if($this->getSpecifier('insurancevalue') === null)
                return false;
        }

        if($this->service_code == 3120) {
            if($this->getSpecifier('deliverytime'))
                return false;
        }

        if($this->service_code == 3143) {
            if($this->getSpecifier('lqweight') === null or $this->getSpecifier('lqcount') === null)
                return false;
        }

        if(!is_numeric($this->service_code)) {
            return false;
        }

        return true;
    }
public function isValid()
    {
        // alternative pickup point
        if($this->service_code == 2106) {
            if($this->getSpecifier('pickup_point_id') === null)
                return false;
        }

        // cash on delivery (Postiennakko/Bussiennakko)
        if($this->service_code == 3101) {
            $expected_params = array('amount', 'account', 'reference', 'codbic');

            foreach($expected_params as $param)
            {
                if($this->getSpecifier($param) === null)
                    return false;
            }
        }

        // multipacket shipment requires package count
        if($this->service_code == 3102) {
            if($this->getSpecifier('count') === null)
                return false;

            if(!is_numeric($this->getSpecifier('count')))
                return false;
        }

        if($this->service_code == 3111) {
            if($this->getSpecifier('insurancevalue') === null)
                return false;
        }

        if($this->service_code == 3120) {
            if($this->getSpecifier('deliverytime'))
                return false;
        }

        if($this->service_code == 3143) {
            if($this->getSpecifier('lqweight') === null or $this->getSpecifier('lqcount') === null)
                return false;
        }

        if(!is_numeric($this->service_code)) {
            return false;
        }

        return true;
    }
Checks that service_code is numeric and that expected specifiers exist with certain service_code values.

@return bool