/**
  * send a mail
  * 
  * @param string $subject
  * @param string $templateId
  * @param mixed  $vars
  * 
  * @return void
  */
 public function sendMail($subject, $templateId = null, $vars = null)
 {
     $sender = array('email' => $this->config->get('scoring/mail/sender_mail_address'), 'name' => $this->config->get('scoring/mail/sender_name'));
     $email = $this->config->get('scoring/mail/receiver_mail_address');
     $name = $this->config->get('scoring/mail/receiver_name');
     $translate = Mage::getSingleton('core/translate');
     $mail = Mage::getModel('core/email_template')->setTemplateSubject($subject)->sendTransactional($templateId, $sender, $email, $name, $vars);
     $translate->setTranslateInline(true);
 }
 /**
  * handle errors resulting in wrong interface usage
  *
  * @param string    $method
  * @param mixed     $return_code
  * @param Exception $exception
  * @param string    $message
  *
  * @return void
  */
 protected function handleInterfaceError($method, $return_code = null, $exception = null, $message = null)
 {
     $message = $method . ' failed: ' . $message;
     $message .= is_null($return_code) ? 'Got no return code' : sprintf('Got return code %s.', $return_code);
     if (false == is_null($exception)) {
         $message .= "\n" . $exception->getMessage();
     }
     if ($this->config->get('scoring/mail/mail_active')) {
         $mailTemplateId = $this->config->get('scoring/mail/mail_template');
         $mailer = Mage::getModel('scoring/mailer')->sendMail('scoring interface error occured', $mailTemplateId, array('message' => $message, 'logging_key' => $this->getLoggingKey()));
     }
     $message .= ' ' . $this->getLoggingKey();
 }
 public function handleFail($event)
 {
     Mage::getModel('scoring/session')->setAddressValidationResultArray(array('error_messages' => $this->config->get('scoring/errormessages/address')));
 }