Ejemplo n.º 1
0
    private function process(Pap_Contexts_Action $context) {
        $currencyCode = $context->getCurrencyFromRequest();
        if ($currencyCode == '') {
            throw new Gpf_Exception('Currency code is not defined');
        }

        if ($currencyCode == $context->getDefaultCurrencyObject()->getName()) {
            throw new Gpf_Exception('Currency is the same as default currency');
        }

        $currency = new Gpf_Db_Currency();
        try {
            $currency = $currency->findCurrencyByCode($currencyCode);
        } catch (Gpf_DbEngine_NoRowException $e) {
            throw new Gpf_Exception('Currency does not exist');
        }
        return $currency;
    }