Exemplo n.º 1
0
 public function postProcess(Axis_Sales_Model_Order_Row $order)
 {
     $number = $this->getCreditCard()->getCcNumber();
     switch (Axis::config("payment/{$order->payment_method_code}/saveCCAction")) {
         case 'last_four':
             $number = str_repeat('X', strlen($number) - 4) . substr($number, -4);
             break;
         case 'first_last_four':
             $number = substr($number, 0, 4) . str_repeat('X', strlen($number) - 8) . substr($number, -4);
             break;
         case 'partial_email':
             $number = substr($number, 0, 4) . str_repeat('X', strlen($number) - 8) . substr($number, -4);
             try {
                 $mail = new Axis_Mail();
                 $mail->setLocale(Axis::config('locale/main/language_admin'));
                 $mail->setConfig(array('subject' => Axis::translate('sales')->__('Order #%s. Credit card number'), 'data' => array('text' => Axis::translate('sales')->__('Order #%s, Credit card middle digits: %s', $order->number, substr($number, 4, strlen($number) - 8))), 'to' => Axis_Collect_MailBoxes::getName(Axis::config('sales/order/email'))));
                 $mail->send();
             } catch (Zend_Mail_Transport_Exception $e) {
             }
             break;
         case 'complete':
             $number = $number;
             break;
         default:
             return true;
     }
     $crypt = Axis_Crypt::factory();
     $data = array('order_id' => $order->id, 'cc_type' => $crypt->encrypt($card->getCcType()), 'cc_owner' => $crypt->encrypt($card->getCcOwner()), 'cc_number' => $crypt->encrypt($number), 'cc_expires_year' => $crypt->encrypt($card->getCcExpiresYear()), 'cc_expires_month' => $crypt->encrypt($card->getCcExpiresMonth()), 'cc_cvv' => Axis::config()->payment->{$order->payment_method_code}->saveCvv ? $crypt->encrypt($card->getCcCvv()) : '', 'cc_issue_year' => $crypt->encrypt($card->getCcIssueYear()), 'cc_issue_month' => $crypt->encrypt($card->getCcIssueMonth()));
     Axis::single('sales/order_creditcard')->save($data);
 }
Exemplo n.º 2
0
 /**
  *
  * @param Axis_Sales_Model_Order_Row $order
  * @return bool
  */
 public function notifyAdminNewOrder(Axis_Sales_Model_Order_Row $order)
 {
     try {
         $mail = new Axis_Mail();
         $mail->setLocale(Axis::config('locale/main/language_admin'));
         $mail->setConfig(array('event' => 'order_new-owner', 'subject' => Axis::translate('sales')->__('Order created'), 'data' => array('order' => $order), 'to' => Axis_Collect_MailBoxes::getName(Axis::config('sales/order/email'))));
         $mail->send();
         return true;
     } catch (Zend_Mail_Exception $e) {
         return false;
     }
 }
Exemplo n.º 3
0
 public function indexAction()
 {
     $this->setTitle(Axis::translate('contacts')->__('Contact Us'));
     $form = Axis::model('contacts/form_message');
     if ($this->_request->isPost()) {
         $data = $this->_request->getPost();
         if ($form->isValid($data)) {
             $custom = array();
             foreach ($form->getElements() as $element) {
                 $elementsToSkip = array('email', 'subject', 'department_id', 'message', 'submit');
                 if (in_array($element->getName(), $elementsToSkip)) {
                     continue;
                 }
                 $custom[$element->getLabel()] = $element->getValue();
             }
             $data['custom_info'] = Zend_Json::encode($custom);
             $data['site_id'] = Axis::getSiteId();
             Axis::model('contacts/message')->save($data);
             $department = Axis::single('contacts/department')->find($data['department_id'])->current();
             if ($department) {
                 try {
                     $mail = new Axis_Mail();
                     $mail->setLocale(Axis::config('locale/main/language_admin'));
                     $mail->setConfig(array('event' => 'contact_us', 'subject' => $data['subject'], 'data' => $data, 'to' => $department->email, 'from' => array('name' => $data['name'], 'email' => $data['email'])));
                     $mail->send();
                 } catch (Zend_Mail_Exception $e) {
                 }
             }
             Axis::message()->addSuccess(Axis::translate('contacts')->__('Your message was successfully added'));
             $this->_redirect($this->_getBackUrl());
         } else {
             $form->populate($data);
         }
     } elseif ($customer = Axis::getCustomer()) {
         $form->getElement('email')->setValue($customer->email);
         $form->getElement('name')->setValue($customer->firstname . ' ' . $customer->lastname);
     }
     $this->view->form = $form;
     $this->render();
 }
Exemplo n.º 4
0
 /**
  * Send notification emails to registered cutomer, store owner
  *
  * @param array $data
  * Array(
  *  'customer' => Axis_Account_Model_Customer_Row
  *  'password' => string
  * )
  * @return void
  */
 public function notifyCustomerRegistration($data)
 {
     try {
         $mail = new Axis_Mail();
         $mail->setLocale($data['customer']->locale);
         $configResult = $mail->setConfig(array('event' => 'account_new-customer', 'subject' => Axis::translate('account')->__("Welcome, %s %s", $data['customer']->firstname, $data['customer']->lastname), 'data' => array('customer' => $data['customer'], 'password' => $data['password']), 'to' => $data['customer']->email));
         $mail->send();
         //            if ($configResult) {
         //                Axis::message()->addSuccess(
         //                    Axis::translate('core')->__('Mail was sended successfully')
         //                );
         //            }
     } catch (Zend_Mail_Transport_Exception $e) {
         Axis::message()->addError(Axis::translate('core')->__('Mail sending was failed.'));
     }
     try {
         $mailNotice = new Axis_Mail();
         $mailNotice->setLocale(Axis::config('locale/main/language_admin'));
         $mailNotice->setConfig(array('event' => 'account_new-owner', 'subject' => Axis::translate('account')->__('New Account Created'), 'data' => array('customer' => $data['customer']), 'to' => Axis_Collect_MailBoxes::getName(Axis::config('core/company/administratorEmail'))));
         $mailNotice->send();
     } catch (Zend_Mail_Transport_Exception $e) {
     }
 }
Exemplo n.º 5
0
 public function sendAction()
 {
     $data = $this->_getAllParams();
     $row = Axis::model('account/customer')->select()->where('email = ?', $data['email'])->fetchRow();
     $department = Axis::model('contacts/department')->select('*')->where('id = ?', $data['department_id'])->join('contacts_department_name', 'cd.id = cdn.department_id  AND cdn.language_id = :languageId', 'name')->bind(array('languageId' => Axis::model('locale/language')->getIdByLocale($row->locale)))->fetchRow();
     //@todo if null need firstname = full name from custom_info fields
     $firstname = $row ? $row->firstname : null;
     $lastname = $row ? $row->lastname : null;
     try {
         $mail = new Axis_Mail();
         if ($row) {
             $mail->setLocale($row->locale);
         }
         $configResult = $mail->setConfig(array('event' => 'default', 'subject' => $data['subject'], 'data' => array('text' => $data['message'], 'firstname' => $firstname, 'lastname' => $lastname, 'customer' => $row), 'to' => $data['email'], 'from' => array('email' => $department->email, 'name' => $department->name)));
         $mail->send();
         if ($configResult) {
             Axis::message()->addSuccess(Axis::translate('core')->__('Mail was sended successfully'));
         }
         $this->_helper->json->sendSuccess();
     } catch (Zend_Mail_Exception $e) {
         Axis::message()->addError(Axis::translate('core')->__('Mail sending was failed.') . ' ' . $e->getMessage());
         return $this->_helper->json->sendFailure();
     }
 }
Exemplo n.º 6
0
 /**
  * Notify customer about order status changes or comments
  *
  * @return bool
  */
 protected function _notify($comments)
 {
     $languageId = Axis::model('locale/language')->getIdByLocale($this->locale);
     if (!$languageId) {
         $languageId = Axis_Locale::getLanguageId();
     }
     $status = Axis::single('sales/order_status_text')->find($this->order_status_id, $languageId)->current()->toArray();
     try {
         $mail = new Axis_Mail();
         $mail->setLocale($this->locale);
         $configResult = $mail->setConfig(array('event' => 'change_order_status-customer', 'subject' => Axis::translate('sales')->__('Status of your order has been changed'), 'data' => array('order' => $this, 'comment' => $comments, 'status' => $status['status_name']), 'to' => $this->customer_email));
         $mail->send();
         if ($configResult) {
             Axis::message()->addSuccess(Axis::translate('core')->__('Mail was sended successfully'));
         }
         return true;
     } catch (Zend_Mail_Exception $e) {
         Axis::message()->addError(Axis::translate('core')->__('Mail sending was failed.') . ' ' . $e->getMessage());
         return false;
     }
 }