protected function initContexts()
    {
        if (empty($this->contexts)) {
            throw new CException('PaymentManager.contexts cannot be empty.');
        }
        foreach ($this->contexts as $name => $config) {
            if (!isset($config['class'])) {
                $config['class'] = 'PaymentContext';
            }
            if (!isset($config['name'])) {
                $config['name'] = $name;
            }
            $context = Yii::createComponent($config);
            if (!($context instanceof PaymentContext)) {
                throw new CException('Payment context must be an instance of PaymentContext.');
            }
            $this->_contexts[$name] = $context;
        }
    }