/** * Handle Creditrating by Payone API response: * * @param Payone_Api_Response_Interface $response * @return string|bool will return true if all methods are available * @throws Exception|Mage_Payment_Exception */ public function handle(Payone_Api_Response_Interface $response) { $address = $this->getAddress(); $creditRatingScore = array(); if ($response instanceof Payone_Api_Response_Consumerscore_Valid) { /** @var $response Payone_Api_Response_Consumerscore_Valid */ $creditRatingScore = $response->getScore(); $address->setPayoneProtectScore($creditRatingScore); $address->setPayoneProtectDate(now()); $address->setPayoneProtectHash($this->helper()->createAddressHash($address)); $this->saveCustomerAddress($address); } elseif ($response instanceof Payone_Api_Response_Consumerscore_Invalid) { /** @var $response Payone_Api_Response_Consumerscore_Invalid*/ $creditRatingScore = Payone_Api_Enum_ConsumerscoreScore::RED; $address->setPayoneProtectScore($creditRatingScore); $address->setPayoneProtectDate(now()); $address->setPayoneProtectHash($this->helper()->createAddressHash($address)); $this->saveCustomerAddress($address); } elseif ($response instanceof Payone_Api_Response_Error) { /** @var $response Payone_Api_Response_Error */ $creditRatingScore = $this->handleError(null, $response); } //address shoult be saved to prevent to much creditratings $address->save(); return $creditRatingScore; }