Für die aktive und passive Zahlartensteuerung können in der metadata.php die folgenden Hooks registriert werden:
'extend' => array( 'payment' => 'cb/crifbuergelcredit/controllers/crifbuergelcheckpayment', 'order' => 'cb/crifbuergelcredit/controllers/crifbuergelcheckpayment' ),
Für die aktive Prüfung hooken Sie sich an die validatePayment Funktion des Payment-Controllers:
public function validatePayment(){ // load Database and change Database Mode $oDB = oxDb::getDb(); $oDB->setFetchMode(\OxidEsales\EshopCommunity\Core\Database\Adapter\DatabaseInterface::FETCH_MODE_ASSOC); // Standard payment validation $originCheck = parent::validatePayment(); // load necessary data $oSession = $this->getSession(); $oBasket = $oSession->getBasket(); $oPayment = oxNew( "oxpayment" ); $oPayment->load($oBasket->getPaymentId()); //execute Riskcheck $risk = $this->checkifRisk($oBasket->getPaymentId(), true); if($risk) { $this->addTplParam('iPayError', '-3'); $oSession->setVariable( 'payerror', '-3' ); return false; } else { return $originCheck; } }
Für die Passive Prüfung können Sie sich an die execute Funktion des order-Controllers hooken:
public function execute(){ // load Database and change Database Mode $oDB = oxDb::getDb(); $oDB->setFetchMode(\OxidEsales\EshopCommunity\Core\Database\Adapter\DatabaseInterface::FETCH_MODE_ASSOC); // Standard order validation $originCheck = parent::execute(); // load necessary data $oSession = $this->getSession(); $oBasket = $oSession->getBasket(); $oPayment = oxNew( "oxpayment" ); $oPayment->load($oBasket->getPaymentId()); //execute Riskcheck $risk = $this->checkifRisk($oBasket->getPaymentId(), true); if($risk) { $this->addTplParam('iPayError', '-3'); $oSession->setVariable( 'payerror', '-3' ); oxRegistry::getUtils()->redirect($this->getConfig()->getShopSecureHomeUrl().'cl=payment'); return false; } else { return $originCheck; } }