Version Notes
Infobip StoreSMS API module
Download this release
Release Info
Developer | Snowdog |
Extension | Infobip_Storesms |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/community/Infobip/Storesms/Block/Adminhtml/Storesms.php +14 -0
- app/code/community/Infobip/Storesms/Block/Adminhtml/Storesms/Edit.php +20 -0
- app/code/community/Infobip/Storesms/Block/Adminhtml/Storesms/Edit/Form.php +19 -0
- app/code/community/Infobip/Storesms/Block/Adminhtml/Storesms/Edit/Tab/Form.php +33 -0
- app/code/community/Infobip/Storesms/Block/Adminhtml/Storesms/Edit/Tabs.php +25 -0
- app/code/community/Infobip/Storesms/Block/Adminhtml/Storesms/Grid.php +68 -0
- app/code/community/Infobip/Storesms/Block/Adminhtml/System/Config/Fieldset/Branding.php +20 -0
- app/code/community/Infobip/Storesms/Block/Buttons/Contact.php +22 -0
- app/code/community/Infobip/Storesms/Block/Buttons/NewAccount.php +19 -0
- app/code/community/Infobip/Storesms/Helper/Data.php +43 -0
- app/code/community/Infobip/Storesms/Helper/Xml.php +40 -0
- app/code/community/Infobip/Storesms/Model/ApiClient.php +159 -0
- app/code/community/Infobip/Storesms/Model/Config.php +161 -0
- app/code/community/Infobip/Storesms/Model/Cron.php +14 -0
- app/code/community/Infobip/Storesms/Model/Observer.php +148 -0
- app/code/community/Infobip/Storesms/Model/Resource/Storesms.php +13 -0
- app/code/community/Infobip/Storesms/Model/Resource/Storesms/Collection.php +12 -0
- app/code/community/Infobip/Storesms/Model/Storesms.php +122 -0
- app/code/community/Infobip/Storesms/controllers/Adminhtml/StoresmsController.php +45 -0
- app/code/community/Infobip/Storesms/etc/config.xml +225 -0
- app/code/community/Infobip/Storesms/etc/system.xml +330 -0
- app/code/community/Infobip/Storesms/sql/storesms_setup/install-1.0.0.php +32 -0
- app/design/adminhtml/base/default/layout/Infobip_Storesms.xml +20 -0
- app/design/adminhtml/base/default/template/storesms/system/config/fieldset/branding.phtml +7 -0
- app/etc/modules/Infobip_Storesms.xml +9 -0
- app/locale/pl_PL/Infobip_Storesms.csv +47 -0
- js/infobipStoresms/storesmscounter.js +81 -0
- package.xml +18 -0
- skin/adminhtml/base/default/css/storesms/skin.css +5 -0
- skin/adminhtml/base/default/images/storesms/storesms_header.png +0 -0
app/code/community/Infobip/Storesms/Block/Adminhtml/Storesms.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Infobip_Storesms_Block_Adminhtml_Storesms extends Mage_Adminhtml_Block_Widget_Grid_Container {
|
4 |
+
|
5 |
+
public function __construct() {
|
6 |
+
$this->_controller = 'adminhtml_storesms';
|
7 |
+
$this->_blockGroup = 'storesms';
|
8 |
+
$this->_headerText = Mage::helper('storesms')->__('StoreSMS');
|
9 |
+
parent::__construct();
|
10 |
+
$this->removeButton('add');
|
11 |
+
|
12 |
+
}
|
13 |
+
|
14 |
+
}
|
app/code/community/Infobip/Storesms/Block/Adminhtml/Storesms/Edit.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Infobip_Storesms_Block_Adminhtml_Storesms_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
parent::__construct();
|
8 |
+
|
9 |
+
$this->_objectId = 'id';
|
10 |
+
$this->_blockGroup = 'storesms';
|
11 |
+
$this->_controller = 'adminhtml_storesms';
|
12 |
+
|
13 |
+
$this->_updateButton('save', 'label', Mage::helper('storesms')->__('Send'));
|
14 |
+
}
|
15 |
+
|
16 |
+
public function getHeaderText()
|
17 |
+
{
|
18 |
+
return Mage::helper('storesms')->__('Send Bulk SMS');
|
19 |
+
}
|
20 |
+
}
|
app/code/community/Infobip/Storesms/Block/Adminhtml/Storesms/Edit/Form.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Infobip_Storesms_Block_Adminhtml_Storesms_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
4 |
+
{
|
5 |
+
protected function _prepareForm()
|
6 |
+
{
|
7 |
+
$form = new Varien_Data_Form(array(
|
8 |
+
'id' => 'edit_form',
|
9 |
+
'action' => $this->getUrl('*/*/save'),
|
10 |
+
'method' => 'post',
|
11 |
+
'enctype' => 'multipart/form-data'
|
12 |
+
)
|
13 |
+
);
|
14 |
+
|
15 |
+
$form->setUseContainer(true);
|
16 |
+
$this->setForm($form);
|
17 |
+
return parent::_prepareForm();
|
18 |
+
}
|
19 |
+
}
|
app/code/community/Infobip/Storesms/Block/Adminhtml/Storesms/Edit/Tab/Form.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Infobip_Storesms_Block_Adminhtml_Storesms_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
|
4 |
+
{
|
5 |
+
protected function _prepareForm() {
|
6 |
+
|
7 |
+
$form = new Varien_Data_Form();
|
8 |
+
$this->setForm($form);
|
9 |
+
|
10 |
+
$fieldset = $form->addFieldset('storesms_form', array('legend'=>Mage::helper('storesms')->__('SMS Content')));
|
11 |
+
|
12 |
+
$fieldset->addField('sms_message', 'editor', array(
|
13 |
+
'name' => 'sms_message',
|
14 |
+
'label' => Mage::helper('storesms')->__('Message'),
|
15 |
+
'title' => Mage::helper('storesms')->__('Message'),
|
16 |
+
'style' => 'width:500px; height:15em;',
|
17 |
+
'after_element_html' => Mage::helper('storesms')->__('Message (max. 160 characters).'),
|
18 |
+
'wysiwyg' => false,
|
19 |
+
'required' => true,
|
20 |
+
'class' => 'validate-length maximum-length-160'
|
21 |
+
));
|
22 |
+
|
23 |
+
$fieldset->addField('note2', 'note', array(
|
24 |
+
'text' => Mage::helper('storesms')->__('Bulk messaging is the process of sending a large number of SMS messages to various mobile number databases (mobile numbers). Bulk SMS is commonly used for alerts, reminders, marketing but also for providing information and communication between both staff and customers.')
|
25 |
+
));
|
26 |
+
|
27 |
+
$fieldset->addField('note', 'note', array(
|
28 |
+
'text' => Mage::helper('storesms')->__('<br /><p><strong>Using other Infobip services with Infobip StoreSMS</strong><br /><br /> Infobip is a global provider of mobile solutions connecting mobile network operators and enterprises through an in-house developed and operated mobile services cloud. SMS offers an ideal opportunity for business expansion because of its ubiquity, marketing effectiveness and wide reach.<br /> To find out more about SMS messaging solution visit <a href="http://www.infobip.com/" target="_blank">www.infobip.com</a><br />Magento users can go to <strong>System > Import/export > Dataflow Profiles > Export Customers > Run Profile</strong> to create a file that could later be imported to all of Infobip\'s other tools. This way, you can also use Infobip\'s Worx platform and inform your customers over SMS.</p>')
|
29 |
+
));
|
30 |
+
|
31 |
+
return parent::_prepareForm();
|
32 |
+
}
|
33 |
+
}
|
app/code/community/Infobip/Storesms/Block/Adminhtml/Storesms/Edit/Tabs.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Infobip_Storesms_Block_Adminhtml_Storesms_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
|
4 |
+
{
|
5 |
+
|
6 |
+
public function __construct()
|
7 |
+
{
|
8 |
+
parent::__construct();
|
9 |
+
$this->setId('storesms_tabs');
|
10 |
+
$this->setDestElementId('edit_form');
|
11 |
+
$this->setTitle(Mage::helper('storesms')->__('SMS Content'));
|
12 |
+
}
|
13 |
+
|
14 |
+
protected function _beforeToHtml()
|
15 |
+
{
|
16 |
+
|
17 |
+
$this->addTab('form_section', array(
|
18 |
+
'label' => Mage::helper('storesms')->__('SMS Content'),
|
19 |
+
'title' => Mage::helper('storesms')->__('SMS Content'),
|
20 |
+
'content' => $this->getLayout()->createBlock('storesms/adminhtml_storesms_edit_tab_form')->toHtml(),
|
21 |
+
));
|
22 |
+
|
23 |
+
return parent::_beforeToHtml();
|
24 |
+
}
|
25 |
+
}
|
app/code/community/Infobip/Storesms/Block/Adminhtml/Storesms/Grid.php
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Infobip_Storesms_Block_Adminhtml_Storesms_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
parent::__construct();
|
8 |
+
$this->setId('storesms_grid');
|
9 |
+
$this->setDefaultSort('id');
|
10 |
+
$this->setDefaultDir('desc');
|
11 |
+
$this->setSaveParametersInSession(true);
|
12 |
+
}
|
13 |
+
|
14 |
+
protected function _prepareCollection()
|
15 |
+
{
|
16 |
+
$collection = Mage::getModel('storesms/storesms')->getCollection();
|
17 |
+
$this->setCollection($collection);
|
18 |
+
return parent::_prepareCollection();
|
19 |
+
}
|
20 |
+
|
21 |
+
protected function _prepareColumns()
|
22 |
+
{
|
23 |
+
|
24 |
+
$this->addColumn('id', array(
|
25 |
+
'header' => Mage::helper('storesms')->__('ID'),
|
26 |
+
'align' =>'left',
|
27 |
+
'width' => '40px',
|
28 |
+
'index' => 'id',
|
29 |
+
));
|
30 |
+
$this->addColumn('created', array(
|
31 |
+
'header' => Mage::helper('storesms')->__('Created date'),
|
32 |
+
'align' =>'left',
|
33 |
+
'width' => '50px',
|
34 |
+
'index' => 'created',
|
35 |
+
'type' => 'date'
|
36 |
+
));
|
37 |
+
$this->addColumn('sender', array(
|
38 |
+
'header' => Mage::helper('storesms')->__('Sender'),
|
39 |
+
'align' =>'left',
|
40 |
+
'width' => '50px',
|
41 |
+
'index' => 'sender',
|
42 |
+
));
|
43 |
+
$this->addColumn('telephone', array(
|
44 |
+
'header' => Mage::helper('storesms')->__('Phone number'),
|
45 |
+
'align' =>'left',
|
46 |
+
'width' => '50px',
|
47 |
+
'index' => 'telephone',
|
48 |
+
));
|
49 |
+
$this->addColumn('message', array(
|
50 |
+
'header' => Mage::helper('storesms')->__('Message'),
|
51 |
+
'align' =>'left',
|
52 |
+
'width' => '250px',
|
53 |
+
'index' => 'message',
|
54 |
+
));
|
55 |
+
$this->addColumn('delivery_status', array(
|
56 |
+
'header' => Mage::helper('storesms')->__('Delivery Status'),
|
57 |
+
'align' =>'left',
|
58 |
+
'width' => '50px',
|
59 |
+
'index' => 'delivery_status',
|
60 |
+
'type' => 'options',
|
61 |
+
'options' => Mage::getModel('storesms/config')->getMessageStatuses()
|
62 |
+
));
|
63 |
+
|
64 |
+
|
65 |
+
return parent::_prepareColumns();
|
66 |
+
}
|
67 |
+
|
68 |
+
}
|
app/code/community/Infobip/Storesms/Block/Adminhtml/System/Config/Fieldset/Branding.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Infobip_Storesms_Block_Adminhtml_System_Config_Fieldset_Branding
|
4 |
+
extends Mage_Adminhtml_Block_Abstract
|
5 |
+
implements Varien_Data_Form_Element_Renderer_Interface
|
6 |
+
{
|
7 |
+
protected $_template = 'storesms/system/config/fieldset/branding.phtml';
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Render fieldset html
|
11 |
+
*
|
12 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
13 |
+
* @return string
|
14 |
+
*/
|
15 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
16 |
+
{
|
17 |
+
$elementOriginalData = $element->getOriginalData();
|
18 |
+
return $this->toHtml();
|
19 |
+
}
|
20 |
+
}
|
app/code/community/Infobip/Storesms/Block/Buttons/Contact.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Infobip_Storesms_Block_Buttons_Contact extends Mage_Adminhtml_Block_System_Config_Form_Field {
|
4 |
+
|
5 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element){
|
6 |
+
|
7 |
+
$locale = Mage::app()->getLocale()->getLocaleCode();
|
8 |
+
$contactUrl = Mage::getModel('storesms/config')->getContactUrl($locale);
|
9 |
+
|
10 |
+
$this->setElement($element);
|
11 |
+
|
12 |
+
$html = $this->getLayout()->createBlock('adminhtml/widget_button')
|
13 |
+
->setType('button')
|
14 |
+
->setClass('button')
|
15 |
+
->setLabel(Mage::helper('storesms')->__('Open contact form'))
|
16 |
+
->setOnClick("window.open('{$contactUrl}','window1','width=990, height=705, scrollbars=1, resizable=1'); return false;")
|
17 |
+
->toHtml();
|
18 |
+
|
19 |
+
return $html;
|
20 |
+
|
21 |
+
}
|
22 |
+
}
|
app/code/community/Infobip/Storesms/Block/Buttons/NewAccount.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Infobip_Storesms_Block_Buttons_NewAccount extends Mage_Adminhtml_Block_System_Config_Form_Field {
|
4 |
+
|
5 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element){
|
6 |
+
|
7 |
+
$this->setElement($element);
|
8 |
+
|
9 |
+
$html = $this->getLayout()->createBlock('adminhtml/widget_button')
|
10 |
+
->setType('button')
|
11 |
+
->setClass('button')
|
12 |
+
->setLabel(Mage::helper('storesms')->__('Open Sign Up form'))
|
13 |
+
->setOnClick("window.open('http://www.parseco.com/sign-up/','window1','width=990, height=705, scrollbars=1, resizable=1'); return false;")
|
14 |
+
->toHtml();
|
15 |
+
|
16 |
+
return $html;
|
17 |
+
|
18 |
+
}
|
19 |
+
}
|
app/code/community/Infobip/Storesms/Helper/Data.php
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Infobip_Storesms_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
|
7 |
+
|
8 |
+
public function getPhoneNumber($phoneNumber) {
|
9 |
+
|
10 |
+
$config = Mage::getModel('storesms/config');
|
11 |
+
$prefix = $config->getCountryPrefix();
|
12 |
+
|
13 |
+
if ($prefix) {
|
14 |
+
$toStrip = '+,'. $prefix .',0';
|
15 |
+
}
|
16 |
+
else {
|
17 |
+
$toStrip = '+,0';
|
18 |
+
}
|
19 |
+
|
20 |
+
|
21 |
+
return $prefix . ltrim($phoneNumber,$toStrip);
|
22 |
+
|
23 |
+
}
|
24 |
+
|
25 |
+
|
26 |
+
public function getStatusVerbally($responseErrorNumber) {
|
27 |
+
|
28 |
+
$responseErrorNumber = ($responseErrorNumber>0) ? 1:$responseErrorNumber;
|
29 |
+
|
30 |
+
$statuses = array(
|
31 |
+
'1' =>'SEND_OK',
|
32 |
+
'-1' =>'AUTH_FAILED',
|
33 |
+
'-2' =>'XML_ERROR',
|
34 |
+
'-3' =>'NOT_ENOUGH_CREDITS',
|
35 |
+
'-4' =>'NO_RECIPIENTS',
|
36 |
+
'-5' =>'GENERAL_ERROR'
|
37 |
+
);
|
38 |
+
|
39 |
+
return $statuses[$responseErrorNumber];
|
40 |
+
|
41 |
+
}
|
42 |
+
|
43 |
+
}
|
app/code/community/Infobip/Storesms/Helper/Xml.php
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
class Infobip_Storesms_Helper_Xml extends Mage_Core_Helper_Abstract
|
5 |
+
{
|
6 |
+
|
7 |
+
public function getStatusesFromXml($xml) {
|
8 |
+
|
9 |
+
$xmlResource = xml_parser_create();
|
10 |
+
xml_parse_into_struct($xmlResource, $xml, $vals, $index);
|
11 |
+
xml_parser_free($xmlResource);
|
12 |
+
|
13 |
+
$attributes = array();
|
14 |
+
|
15 |
+
foreach ($index['MESSAGE'] as $key) {
|
16 |
+
$attributes[] = $vals[$key]['attributes'];
|
17 |
+
}
|
18 |
+
|
19 |
+
return $attributes;
|
20 |
+
|
21 |
+
|
22 |
+
}
|
23 |
+
|
24 |
+
|
25 |
+
|
26 |
+
public function getStatusCode($xml) {
|
27 |
+
|
28 |
+
$vals = $index = array();
|
29 |
+
$xmlResource = xml_parser_create();
|
30 |
+
xml_parse_into_struct($xmlResource, $xml, $vals, $index);
|
31 |
+
xml_parser_free($xmlResource);
|
32 |
+
|
33 |
+
return $vals[$index['STATUS'][0]]['value']; //return value of <STATUS></STATUS> node
|
34 |
+
|
35 |
+
|
36 |
+
}
|
37 |
+
|
38 |
+
|
39 |
+
|
40 |
+
}
|
app/code/community/Infobip/Storesms/Model/ApiClient.php
ADDED
@@ -0,0 +1,159 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
//File: app/code/community/Infobip/Storesms/Model/ApiClient.php
|
4 |
+
|
5 |
+
/**
|
6 |
+
* SMS API client class
|
7 |
+
*
|
8 |
+
* @category Infobip
|
9 |
+
* @package StoresmsApi
|
10 |
+
* @copyright Copyright (c) 2012 Infobip (http://infobip.pl/)
|
11 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
12 |
+
* @author Marek Jasiukiewicz <dev@jasiukiewicz.pl>
|
13 |
+
* ...
|
14 |
+
*/
|
15 |
+
class Infobip_Storesms_Model_ApiClient {
|
16 |
+
|
17 |
+
|
18 |
+
public function sendByCurl(array $smsData) {
|
19 |
+
|
20 |
+
|
21 |
+
if (empty($smsData['recipients']))
|
22 |
+
throw new Exception(Mage::helper('storesms')->__('No recipients found'));
|
23 |
+
|
24 |
+
$config = Mage::getModel('storesms/config');
|
25 |
+
$postUrl = "http://api2.infobip.com/api/sendsms/xml";
|
26 |
+
|
27 |
+
// XML-formatted data
|
28 |
+
|
29 |
+
$xmlLongSms = ($config->isSingle()==1) ? '':'<type>longSMS</type>';
|
30 |
+
$sender = $config->getSender();
|
31 |
+
$xmlSender = ($config->isPro() && !empty($sender)) ? '<sender>'.$config->getSender().'</sender>':'';
|
32 |
+
|
33 |
+
$xmlRecipients = '<recipients>'."\r\n";
|
34 |
+
foreach ($smsData['recipients'] as $recipient) {
|
35 |
+
$messageId = ($smsData['ids'][$recipient]) ? ' messageId="'.$smsData['ids'][$recipient].'"':'';
|
36 |
+
$xmlRecipients .= '<gsm'.$messageId.'>'.$recipient.'</gsm>'."\r\n";
|
37 |
+
}
|
38 |
+
$xmlRecipients .= '</recipients>'."\r\n";
|
39 |
+
|
40 |
+
$xmlString =
|
41 |
+
'<SMS>
|
42 |
+
<authentification>
|
43 |
+
<username>'.$config->getLogin().'</username>
|
44 |
+
<password>'.$config->getPassword().'</password>
|
45 |
+
</authentification>
|
46 |
+
<message>
|
47 |
+
'.$xmlSender.'
|
48 |
+
'.$xmlLongSms.'
|
49 |
+
<text>'.$smsData['message'].'</text>
|
50 |
+
</message>
|
51 |
+
'.$xmlRecipients.'
|
52 |
+
</SMS>';
|
53 |
+
|
54 |
+
// previously formatted XML data becomes value of "XML" POST variable
|
55 |
+
$fields = "XML=" . urlencode($xmlString);
|
56 |
+
|
57 |
+
$ch = curl_init();
|
58 |
+
curl_setopt($ch, CURLOPT_URL, $postUrl);
|
59 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
60 |
+
curl_setopt($ch, CURLOPT_HEADER, FALSE);
|
61 |
+
curl_setopt($ch, CURLOPT_POST, 1);
|
62 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
|
63 |
+
|
64 |
+
// response of the POST request
|
65 |
+
$response = curl_exec($ch);
|
66 |
+
curl_close($ch);
|
67 |
+
|
68 |
+
return $response;
|
69 |
+
}
|
70 |
+
|
71 |
+
|
72 |
+
|
73 |
+
|
74 |
+
|
75 |
+
public function getCredits() {
|
76 |
+
|
77 |
+
$getUrl = 'http://api.infobip.com/api/command?username='.Mage::getModel('storesms/config')->getLogin().'&password='.Mage::getModel('storesms/config')->getPassword().'&cmd=CREDITS';
|
78 |
+
$ch = curl_init();
|
79 |
+
curl_setopt($ch, CURLOPT_URL, $getUrl);
|
80 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
81 |
+
|
82 |
+
$response = curl_exec($ch);
|
83 |
+
curl_close($ch);
|
84 |
+
return $response;
|
85 |
+
|
86 |
+
|
87 |
+
}
|
88 |
+
|
89 |
+
|
90 |
+
|
91 |
+
|
92 |
+
|
93 |
+
public function checkCreditLimit() {
|
94 |
+
|
95 |
+
$config = Mage::getModel('storesms/config');
|
96 |
+
if ($config->isApiEnabled()==0) return;
|
97 |
+
|
98 |
+
$limit = $config->creditAllertLimit();
|
99 |
+
if ($limit==0) return; //If limit allert is turned off
|
100 |
+
|
101 |
+
|
102 |
+
try {
|
103 |
+
|
104 |
+
$credits = $this->getCredits();
|
105 |
+
|
106 |
+
if ($credits=='UNKNOWN_COMMAND') {
|
107 |
+
Mage::getSingleton('core/session')->addError(Mage::helper('storesms')->__($config::WRONG_AUTH_DATA));
|
108 |
+
}
|
109 |
+
elseif($credits < $limit) {
|
110 |
+
Mage::getSingleton('core/session')->addError(Mage::helper('storesms')->__($config::LOW_CREDITS_WARNING_MESSAGE));
|
111 |
+
}
|
112 |
+
|
113 |
+
}
|
114 |
+
catch (Exception $e) {
|
115 |
+
Mage::getSingleton('core/session')->addError($e->getMessage());
|
116 |
+
}
|
117 |
+
|
118 |
+
}
|
119 |
+
|
120 |
+
|
121 |
+
|
122 |
+
public function getDelieveryReport() {
|
123 |
+
|
124 |
+
$config = Mage::getModel('storesms/config');
|
125 |
+
$getUrl = 'http://api2.infobip.com/api/dlrpull?user='.$config->getLogin().'&password='.$config->getPassword();
|
126 |
+
$curl = curl_init();
|
127 |
+
curl_setopt($curl, CURLOPT_URL, $getUrl);
|
128 |
+
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
129 |
+
$response = curl_exec($curl);
|
130 |
+
curl_close($curl);
|
131 |
+
return $response;
|
132 |
+
|
133 |
+
}
|
134 |
+
|
135 |
+
|
136 |
+
|
137 |
+
public function saveDelieveryReport($report = false) {
|
138 |
+
|
139 |
+
if ($report === false)
|
140 |
+
$report = $this->getDelieveryReport ();
|
141 |
+
|
142 |
+
if ($report == 'NO_DATA' || !$report)
|
143 |
+
return;
|
144 |
+
|
145 |
+
//if delievery report exists save it to db
|
146 |
+
$delieveryStatuses = Mage::helper('storesms/xml')->getStatusesFromXml($report);
|
147 |
+
$model = Mage::getModel('storesms/storesms');
|
148 |
+
|
149 |
+
//save delievery status for each message
|
150 |
+
foreach ($delieveryStatuses as $message) {
|
151 |
+
$model->setNewDeliveryStatus($message['ID'],$message['STATUS']);
|
152 |
+
$model->unsetData();
|
153 |
+
}
|
154 |
+
|
155 |
+
|
156 |
+
}
|
157 |
+
|
158 |
+
|
159 |
+
}
|
app/code/community/Infobip/Storesms/Model/Config.php
ADDED
@@ -0,0 +1,161 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
//File: app/code/community/Infobip/StoresmsApi/Model/Config.php
|
3 |
+
|
4 |
+
/**
|
5 |
+
* Storesms API config class
|
6 |
+
*
|
7 |
+
*
|
8 |
+
* @category Infobip
|
9 |
+
* @package Storesms API
|
10 |
+
* @copyright Copyright (c) 2012 Infobip (http://infobip.pl/)
|
11 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
12 |
+
* @author Marek Jasiukiewicz <dev@jasiukiewicz.pl>
|
13 |
+
* ...
|
14 |
+
*/
|
15 |
+
|
16 |
+
|
17 |
+
class Infobip_Storesms_Model_Config {
|
18 |
+
|
19 |
+
const LOW_CREDITS_WARNING_MESSAGE = 'Warning: Low credit level at your Storesms account. Buy credits.';
|
20 |
+
const API_HOST = 'api2.infobip.com';
|
21 |
+
const WRONG_AUTH_DATA = 'Storesms API: Wrong Password and/or Username' ;
|
22 |
+
|
23 |
+
public $contacts = array (
|
24 |
+
'en_US'=>'http://www.infobip.com/contact', //default international
|
25 |
+
'pt_BR'=>'http://br.infobip.com/contact', //brasil
|
26 |
+
'fr_FR'=>'http://www.infobip.fr/contact', //france
|
27 |
+
'ru_RU'=>'http://www.infobip.com.ru/contact', //russia
|
28 |
+
'af_ZA'=>'http://www.infobip.co.za/contact', //south africa
|
29 |
+
'pl_PL'=>'http://www.infobip.com.pl/contact', //poland
|
30 |
+
'tr_TR'=>'http://www.infobip.com.tr/contact'//Turkey
|
31 |
+
);
|
32 |
+
|
33 |
+
|
34 |
+
|
35 |
+
public function getContactUrl($localeCode) {
|
36 |
+
|
37 |
+
return (array_key_exists($localeCode, $this->contacts)) ? $this->contacts[$localeCode] : $this->contacts['en_US'];
|
38 |
+
|
39 |
+
}
|
40 |
+
|
41 |
+
|
42 |
+
|
43 |
+
/**
|
44 |
+
* getting API login from main configuration
|
45 |
+
* @return string
|
46 |
+
*/
|
47 |
+
public function getLogin() {
|
48 |
+
return Mage::getStoreConfig('storesms/main_conf/apilogin');
|
49 |
+
|
50 |
+
|
51 |
+
}
|
52 |
+
|
53 |
+
|
54 |
+
/**
|
55 |
+
* getting API password from main configuration
|
56 |
+
* @return string
|
57 |
+
*/
|
58 |
+
public function getPassword() {
|
59 |
+
$encrypted_pass = Mage::getStoreConfig('storesms/main_conf/apipassword');
|
60 |
+
return Mage::helper('core')->decrypt($encrypted_pass);
|
61 |
+
|
62 |
+
}
|
63 |
+
|
64 |
+
|
65 |
+
/**
|
66 |
+
* getting message sender from main configuration
|
67 |
+
* @return string
|
68 |
+
*/
|
69 |
+
public function getSender() {
|
70 |
+
return Mage::getStoreConfig('storesms/main_conf/sender');
|
71 |
+
|
72 |
+
}
|
73 |
+
|
74 |
+
public function isPro() {
|
75 |
+
return Mage::getStoreConfig('storesms/main_conf/sender_active');
|
76 |
+
}
|
77 |
+
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Checks if allowed only single message
|
81 |
+
* @return int
|
82 |
+
*/
|
83 |
+
public function isSingle() {
|
84 |
+
$confRule = Mage::getStoreConfig('storesms/main_conf/allow_long_sms');
|
85 |
+
|
86 |
+
return ($confRule == 1) ? 0:1;
|
87 |
+
|
88 |
+
}
|
89 |
+
|
90 |
+
|
91 |
+
public function getCountryPrefix() {
|
92 |
+
|
93 |
+
return Mage::getStoreConfig('storesms/main_conf/country_prefix');
|
94 |
+
|
95 |
+
}
|
96 |
+
|
97 |
+
public function getStoreName() {
|
98 |
+
|
99 |
+
return Mage::getStoreConfig('storesms/main_conf/storename');
|
100 |
+
|
101 |
+
}
|
102 |
+
|
103 |
+
|
104 |
+
/**
|
105 |
+
* checks if Storesms API module is enabled
|
106 |
+
* @return boolean
|
107 |
+
*/
|
108 |
+
public function isApiEnabled() {
|
109 |
+
|
110 |
+
return (Mage::getStoreConfig('storesms/main_conf/active')==0) ? 0:1;
|
111 |
+
|
112 |
+
}
|
113 |
+
|
114 |
+
|
115 |
+
|
116 |
+
public function creditAllertLimit() {
|
117 |
+
return floatval(str_replace(',','.',Mage::getStoreConfig('storesms/main_conf/credit_alert_limit')));
|
118 |
+
}
|
119 |
+
|
120 |
+
|
121 |
+
|
122 |
+
|
123 |
+
/**
|
124 |
+
* getting SMS templates from config
|
125 |
+
* @return string
|
126 |
+
*/
|
127 |
+
public function getMessageTemplate($template) {
|
128 |
+
|
129 |
+
$templateContent = Mage::getStoreConfig('storesms/templates/status_'.$template);
|
130 |
+
|
131 |
+
if (Mage::getStoreConfig('storesms/templates/status_'. $template .'_active') && !empty($templateContent))
|
132 |
+
return $templateContent;
|
133 |
+
|
134 |
+
}
|
135 |
+
|
136 |
+
|
137 |
+
|
138 |
+
public function getMessageStatuses() {
|
139 |
+
$statuses = array( 'SEND_OK' =>'SEND_OK',
|
140 |
+
'AUTH_FAILED' =>'AUTH_FAILED',
|
141 |
+
'XML_ERROR' =>'XML_ERROR',
|
142 |
+
'NOT_ENOUGH_CREDITS' =>'NOT_ENOUGH_CREDITS',
|
143 |
+
'NO_RECIPIENTS' =>'NO_RECIPIENTS',
|
144 |
+
'GENERAL_ERROR' =>'GENERAL_ERROR',
|
145 |
+
'WAITING_FOR_DR' =>'WAITING_FOR_DR',
|
146 |
+
'NOT_SENT'=>'NOT_SENT',
|
147 |
+
'SENT'=>'SENT',
|
148 |
+
'NOT_DELIVERED'=>'NOT_DELIVERED',
|
149 |
+
'DELIVERED'=>'DELIVERED',
|
150 |
+
'NOT_ALLOWED'=>'NOT_ALLOWED',
|
151 |
+
'INVALID_DESTINATION_ADDRESS'=>'INVALID_DESTINATION_ADDRESS',
|
152 |
+
'INVALID_SOURCE_ADDRESS'=>'INVALID_SOURCE_ADDRESS',
|
153 |
+
'ROUTE_NOT_AVAILABLE'=>'ROUTE_NOT_AVAILABLE',
|
154 |
+
'NOT_ENOUGH_CREDITS'=>'NOT_ENOUGH_CREDITS',
|
155 |
+
'INVALID_MESSAGE_FORMAT'=>'INVALID_MESSAGE_FORMAT');
|
156 |
+
|
157 |
+
return $statuses;
|
158 |
+
}
|
159 |
+
|
160 |
+
|
161 |
+
}
|
app/code/community/Infobip/Storesms/Model/Cron.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Infobip_Storesms_Model_Cron {
|
4 |
+
|
5 |
+
public function getDelieveryReport() {
|
6 |
+
|
7 |
+
$apiClient = Mage::getModel('storesms/apiClient');
|
8 |
+
$apiClient->saveDelieveryReport();
|
9 |
+
|
10 |
+
|
11 |
+
}
|
12 |
+
|
13 |
+
|
14 |
+
}
|
app/code/community/Infobip/Storesms/Model/Observer.php
ADDED
@@ -0,0 +1,148 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
//File: app/code/community/Infobip/Storesms/Model/Observer.php
|
3 |
+
|
4 |
+
/**
|
5 |
+
* @category Infobip
|
6 |
+
* @package Storesms API
|
7 |
+
* @copyright Copyright (c) 2012 Infobip (http://infobip.pl/)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
9 |
+
* @author Marek Jasiukiewicz <dev@jasiukiewicz.pl>
|
10 |
+
* ...
|
11 |
+
*/
|
12 |
+
class Infobip_Storesms_Model_Observer {
|
13 |
+
|
14 |
+
|
15 |
+
|
16 |
+
|
17 |
+
/**
|
18 |
+
*
|
19 |
+
* @param type $observer
|
20 |
+
* @return type
|
21 |
+
*/
|
22 |
+
|
23 |
+
public function handleStatus($observer) {
|
24 |
+
|
25 |
+
$config = Mage::getModel('storesms/config');
|
26 |
+
if ($config->isApiEnabled()==0) return; //do nothing if api is disabled
|
27 |
+
|
28 |
+
$order = $observer->getEvent()->getOrder();
|
29 |
+
$newStatus = $order->getData('status');
|
30 |
+
$origStatus = $order->getOrigData('status');
|
31 |
+
|
32 |
+
|
33 |
+
//if status has changed run action
|
34 |
+
if ($newStatus!=$origStatus) {
|
35 |
+
|
36 |
+
$message = $config->getMessageTemplate($newStatus); //get template for new status (if active and exists)
|
37 |
+
if (!$message) //return if no active message template
|
38 |
+
return;
|
39 |
+
|
40 |
+
|
41 |
+
//getting last tracking number
|
42 |
+
$trackings = Mage::getResourceModel('sales/order_shipment_track_collection')->setOrderFilter($order)->getData();
|
43 |
+
|
44 |
+
if (!empty($trackings)) {
|
45 |
+
$last = count($trackings)-1;
|
46 |
+
$last_tracking_number = $trackings[$last]['track_number'];
|
47 |
+
}
|
48 |
+
else
|
49 |
+
$last_tracking_number = 'no_tracking'; //if no tracking number set "no_tracking" message for {TRACKINGNUMBER} template
|
50 |
+
|
51 |
+
|
52 |
+
//getting order data to generate message template
|
53 |
+
$messageOrderData['{NAME}'] = $order->getShippingAddress()->getData('firstname');
|
54 |
+
$messageOrderData['{ORDERNUMBER}'] = $order->getIncrement_id();
|
55 |
+
$messageOrderData['{ORDERSTATUS}'] = $newStatus;
|
56 |
+
$messageOrderData['{TRACKINGNUMBER}'] = $last_tracking_number;
|
57 |
+
$messageOrderData['{STORENAME}'] = $config->getStoreName();
|
58 |
+
|
59 |
+
$message = strtr($message,$messageOrderData);
|
60 |
+
|
61 |
+
|
62 |
+
|
63 |
+
|
64 |
+
$api = Mage::getModel('storesms/apiClient');
|
65 |
+
|
66 |
+
//prepare sms content
|
67 |
+
$msg['recipients'][] = $order->getShippingAddress()->getData('telephone'); //or getBillingAddress
|
68 |
+
$msg['message'] = $message;
|
69 |
+
$msg['single_message'] = $config->isSingle(); //allow_long_sms
|
70 |
+
$msg['sender'] = $config->getSender();//sender
|
71 |
+
|
72 |
+
|
73 |
+
//sending sms and getting API response
|
74 |
+
|
75 |
+
try {
|
76 |
+
|
77 |
+
$apiClient = Mage::getModel('storesms/apiClient');
|
78 |
+
$savedIds = Mage::getModel('storesms/storesms')->saveMessages($msg);
|
79 |
+
$msg['ids'] = $savedIds;
|
80 |
+
|
81 |
+
$response = $apiClient->sendByCurl($msg);
|
82 |
+
$responseVerbally = Mage::helper('storesms')->getStatusVerbally(Mage::helper('storesms/xml')->getStatusCode($response));
|
83 |
+
|
84 |
+
if ($responseVerbally!='SEND_OK')
|
85 |
+
throw new Exception (Mage::helper('storesms')->__('Error sending Message:').' '.$responseVerbally);
|
86 |
+
|
87 |
+
//@successs add comment to order
|
88 |
+
$newComment = Mage::helper('storesms')->__('SMS notification sent (SMS id:').$msg['ids'][$msg['recipients'][0]].') ' ;
|
89 |
+
$order->addStatusToHistory($order->getStatus(),$newComment,true);
|
90 |
+
$this->checkCreditLimit();
|
91 |
+
|
92 |
+
} catch (Exception $e) {
|
93 |
+
$newComment = Mage::helper('storesms')->__('SMS notification sending error:').' "'.$e->getMessage().'"';
|
94 |
+
$order->addStatusToHistory($order->getStatus(),$newComment,false);
|
95 |
+
}
|
96 |
+
|
97 |
+
|
98 |
+
|
99 |
+
|
100 |
+
|
101 |
+
}
|
102 |
+
|
103 |
+
}
|
104 |
+
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Generating alert notification if storesmsAPI account balance is low
|
108 |
+
*
|
109 |
+
* @return none
|
110 |
+
*/
|
111 |
+
|
112 |
+
public function checkCreditLimit() {
|
113 |
+
|
114 |
+
Mage::getModel('storesms/apiClient')->checkCreditLimit();
|
115 |
+
|
116 |
+
}
|
117 |
+
|
118 |
+
|
119 |
+
|
120 |
+
/**
|
121 |
+
* Check if authorization data is ok
|
122 |
+
*
|
123 |
+
* @return none
|
124 |
+
*/
|
125 |
+
public function checkAuthorizationData() {
|
126 |
+
|
127 |
+
$config = Mage::getModel('storesms/config');
|
128 |
+
|
129 |
+
if ($config->isApiEnabled()==0) return;
|
130 |
+
|
131 |
+
try {
|
132 |
+
$credits = Mage::getModel('storesms/apiClient')->getCredits();
|
133 |
+
|
134 |
+
if ($credits=='UNKNOWN_COMMAND') {
|
135 |
+
throw new Exception(Mage::helper('storesms')->__($config::WRONG_AUTH_DATA));
|
136 |
+
}
|
137 |
+
else {
|
138 |
+
Mage::getSingleton('core/session')->addSuccess(Mage::helper('storesms')->__('Success. Logged into Storesms API.'));
|
139 |
+
}
|
140 |
+
|
141 |
+
}
|
142 |
+
catch (Exception $e) {
|
143 |
+
Mage::getSingleton('core/session')->addError($e->getMessage());
|
144 |
+
}
|
145 |
+
|
146 |
+
}
|
147 |
+
|
148 |
+
}
|
app/code/community/Infobip/Storesms/Model/Resource/Storesms.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Infobip_Storesms_Model_Resource_Storesms extends Mage_Core_Model_Resource_Db_Abstract {
|
4 |
+
|
5 |
+
|
6 |
+
public function _construct() {
|
7 |
+
$this->_init("storesms/infobip_storesms","id");
|
8 |
+
|
9 |
+
}
|
10 |
+
|
11 |
+
|
12 |
+
}
|
13 |
+
|
app/code/community/Infobip/Storesms/Model/Resource/Storesms/Collection.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Infobip_Storesms_Model_Resource_Storesms_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract {
|
4 |
+
|
5 |
+
|
6 |
+
public function _construct() {
|
7 |
+
$this->_init("storesms/storesms");
|
8 |
+
|
9 |
+
}
|
10 |
+
|
11 |
+
|
12 |
+
}
|
app/code/community/Infobip/Storesms/Model/Storesms.php
ADDED
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Infobip_Storesms_Model_Storesms extends Mage_Core_Model_Abstract {
|
4 |
+
|
5 |
+
|
6 |
+
public function _construct() {
|
7 |
+
|
8 |
+
$this->_init("storesms/storesms");
|
9 |
+
}
|
10 |
+
|
11 |
+
/** Gets list of Partners or Distributors
|
12 |
+
*
|
13 |
+
* @param type $ofWhat
|
14 |
+
* @return type
|
15 |
+
*/
|
16 |
+
public function getFailedSmses() {
|
17 |
+
|
18 |
+
$collection = $this->getCollection();
|
19 |
+
$collection->addFieldToFilter("group_id" ,array("eq"=>$ofWhat));
|
20 |
+
$items = $collection->getItems();
|
21 |
+
|
22 |
+
foreach ($items as $item) {
|
23 |
+
$listToReturn[] = $item->getData();
|
24 |
+
}
|
25 |
+
|
26 |
+
return $listToReturn;
|
27 |
+
|
28 |
+
}
|
29 |
+
|
30 |
+
|
31 |
+
public function saveMessages(array $smsData) {
|
32 |
+
|
33 |
+
foreach ($smsData['recipients'] as $gsmNumber) { //save sms to database and retrieve message id's
|
34 |
+
|
35 |
+
$this->newSms($gsmNumber,$smsData['message'],'WAITING_FOR_DR',Mage::getModel('storesms/config')->getSender());
|
36 |
+
$smsId = $this->getData('id');
|
37 |
+
$smsIds[$gsmNumber] = $smsId;
|
38 |
+
$this->unsetData();
|
39 |
+
|
40 |
+
}
|
41 |
+
|
42 |
+
return $smsIds;
|
43 |
+
}
|
44 |
+
|
45 |
+
|
46 |
+
public function newSms($telephone,$message,$deliveryStatus,$sender = false) {
|
47 |
+
|
48 |
+
$this -> setSender($sender);
|
49 |
+
$this -> setTelephone($telephone);
|
50 |
+
$this -> setDeliveryStatus($deliveryStatus);
|
51 |
+
$this -> setMessage($message);
|
52 |
+
$this -> setAttemptsNumber(1);
|
53 |
+
$this -> setCreated(new Zend_Db_Expr('CURDATE()'));
|
54 |
+
$this -> save();
|
55 |
+
|
56 |
+
}
|
57 |
+
|
58 |
+
public function setNewDeliveryStatus($smsId,$deliveryStatus) {
|
59 |
+
|
60 |
+
$this -> load($smsId);
|
61 |
+
$this -> setDeliveryStatus($deliveryStatus)->save();
|
62 |
+
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Get all phone numbers from customer address collection
|
67 |
+
*
|
68 |
+
*
|
69 |
+
* @return type
|
70 |
+
*/
|
71 |
+
|
72 |
+
public function getPhoneNumbers() {
|
73 |
+
|
74 |
+
$col = Mage::getModel('customer/address')->getCollection()->addAttributeToSelect('telephone')->getItems();
|
75 |
+
foreach ($col as $address) {
|
76 |
+
$phones[] = Mage::helper('storesms')->getPhoneNumber($address->getTelephone());
|
77 |
+
}
|
78 |
+
$phones = array_unique($phones);
|
79 |
+
|
80 |
+
return $phones;
|
81 |
+
|
82 |
+
}
|
83 |
+
|
84 |
+
|
85 |
+
public function sendBulkSMS($messageContent) {
|
86 |
+
|
87 |
+
$numbers = $this->getPhoneNumbers();
|
88 |
+
|
89 |
+
$message = array(
|
90 |
+
'recipients' => $numbers,
|
91 |
+
'message' => $messageContent
|
92 |
+
);
|
93 |
+
|
94 |
+
|
95 |
+
try {
|
96 |
+
$apiClient = Mage::getModel('storesms/apiClient');
|
97 |
+
$savedIds = Mage::getModel('storesms/storesms')->saveMessages($message);
|
98 |
+
$message['ids'] = $savedIds;
|
99 |
+
|
100 |
+
$response = $apiClient->sendByCurl($message);
|
101 |
+
$responseVerbally = Mage::helper('storesms')->getStatusVerbally(Mage::helper('storesms/xml')->getStatusCode($response));
|
102 |
+
$errSendMessage = Mage::helper('storesms')->__('Error sending Message:');
|
103 |
+
if ($responseVerbally!='SEND_OK')
|
104 |
+
throw new Exception ($errSendMessage.' '.$responseVerbally);
|
105 |
+
|
106 |
+
//if all is ok get delievery report from api
|
107 |
+
$apiClient->saveDelieveryReport();
|
108 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('storesms')->__('Message sent successfully'));
|
109 |
+
|
110 |
+
}
|
111 |
+
catch (Exception $e) {
|
112 |
+
|
113 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
114 |
+
|
115 |
+
}
|
116 |
+
|
117 |
+
|
118 |
+
}
|
119 |
+
|
120 |
+
|
121 |
+
|
122 |
+
}
|
app/code/community/Infobip/Storesms/controllers/Adminhtml/StoresmsController.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Infobip_Storesms_Adminhtml_StoresmsController extends Mage_Adminhtml_Controller_Action
|
4 |
+
{
|
5 |
+
|
6 |
+
public function indexAction() {
|
7 |
+
$this->loadLayout()
|
8 |
+
->_setActiveMenu('storesms/items');
|
9 |
+
$this->renderLayout();
|
10 |
+
|
11 |
+
}
|
12 |
+
|
13 |
+
|
14 |
+
|
15 |
+
public function editAction() {
|
16 |
+
|
17 |
+
$this->loadLayout()
|
18 |
+
->_setActiveMenu('storesms/items');
|
19 |
+
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
|
20 |
+
$this->_addContent($this->getLayout()->createBlock('storesms/adminhtml_storesms_edit'))
|
21 |
+
->_addLeft($this->getLayout()->createBlock('storesms/adminhtml_storesms_edit_tabs'));
|
22 |
+
|
23 |
+
$this->renderLayout();
|
24 |
+
|
25 |
+
}
|
26 |
+
|
27 |
+
|
28 |
+
|
29 |
+
public function newAction() {
|
30 |
+
|
31 |
+
$this->_forward('edit');
|
32 |
+
|
33 |
+
}
|
34 |
+
|
35 |
+
|
36 |
+
|
37 |
+
public function saveAction() {
|
38 |
+
|
39 |
+
Mage::getModel('storesms/storesms')->sendBulkSMS($this->getRequest()->getParam('sms_message'));
|
40 |
+
$this->_redirect('*/*/new');
|
41 |
+
|
42 |
+
}
|
43 |
+
|
44 |
+
|
45 |
+
}
|
app/code/community/Infobip/Storesms/etc/config.xml
ADDED
@@ -0,0 +1,225 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<!--
|
3 |
+
File: app/code/community/Infobip/Storesms/etc/config.xml
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Infobip Storesms API Module
|
7 |
+
*
|
8 |
+
* NOTICE OF LICENSE
|
9 |
+
*
|
10 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
11 |
+
* that is bundled with this package in the file LICENSE.txt.
|
12 |
+
* It is also available through the world-wide-web at this URL:
|
13 |
+
* http://opensource.org/licenses/osl-3.0.php
|
14 |
+
* If you did not receive a copy of the license and are unable to
|
15 |
+
* obtain it through the world-wide-web, please send an email
|
16 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
17 |
+
*
|
18 |
+
* DISCLAIMER
|
19 |
+
*
|
20 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
21 |
+
* versions in the future. If you wish to customize Magento for your
|
22 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
23 |
+
*
|
24 |
+
* Short Message Service (SMS) API
|
25 |
+
*
|
26 |
+
* @category Infobip
|
27 |
+
* @package StoreSMS
|
28 |
+
* @copyright Copyright (c) 2012 Infobip (http://infobip.com/)
|
29 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
30 |
+
* @author Marek Jasiukiewicz <dev@jasiukiewicz.pl>
|
31 |
+
*/
|
32 |
+
|
33 |
+
-->
|
34 |
+
<config>
|
35 |
+
|
36 |
+
<modules>
|
37 |
+
<Infobip_Storesms>
|
38 |
+
<version>1.0.0</version>
|
39 |
+
</Infobip_Storesms>
|
40 |
+
</modules>
|
41 |
+
|
42 |
+
<admin>
|
43 |
+
<routers>
|
44 |
+
<adminhtml>
|
45 |
+
<args>
|
46 |
+
<modules>
|
47 |
+
<storesms before="Mage_Adminhtml">Infobip_Storesms_Adminhtml</storesms>
|
48 |
+
</modules>
|
49 |
+
</args>
|
50 |
+
</adminhtml>
|
51 |
+
<storesms>
|
52 |
+
<use>admin</use>
|
53 |
+
<args>
|
54 |
+
<module>Infobip_Storesms</module>
|
55 |
+
<frontName>storesms</frontName>
|
56 |
+
</args>
|
57 |
+
</storesms>
|
58 |
+
</routers>
|
59 |
+
</admin>
|
60 |
+
|
61 |
+
|
62 |
+
<adminhtml>
|
63 |
+
<acl>
|
64 |
+
<resources>
|
65 |
+
<admin>
|
66 |
+
<children>
|
67 |
+
<system>
|
68 |
+
<children>
|
69 |
+
<config>
|
70 |
+
<children>
|
71 |
+
<storesms>
|
72 |
+
<title>Infobip StoreSMS</title>
|
73 |
+
<sort_order>101</sort_order>
|
74 |
+
</storesms>
|
75 |
+
</children>
|
76 |
+
</config>
|
77 |
+
</children>
|
78 |
+
</system>
|
79 |
+
<storesms>
|
80 |
+
<title>Infobip StoreSMS</title>
|
81 |
+
<children>
|
82 |
+
<storesms translate="title" module="storesms">
|
83 |
+
<title>StoreSMS - SMS summary</title>
|
84 |
+
</storesms>
|
85 |
+
<manual translate="title" module="storesms">
|
86 |
+
<title>StoreSMS - Send Bulk SMS</title>
|
87 |
+
<sort_order>10</sort_order>
|
88 |
+
</manual>
|
89 |
+
</children>
|
90 |
+
</storesms>
|
91 |
+
</children>
|
92 |
+
</admin>
|
93 |
+
</resources>
|
94 |
+
</acl>
|
95 |
+
|
96 |
+
<menu>
|
97 |
+
<storesms translate="title" module="storesms">
|
98 |
+
<title>Infobip StoreSMS</title>
|
99 |
+
<sort_order>500</sort_order>
|
100 |
+
<children>
|
101 |
+
<smssummary translate="title" module="storesms">
|
102 |
+
<title>StoreSMS - Summary</title>
|
103 |
+
<sort_order>5</sort_order>
|
104 |
+
<action>adminhtml/storesms/index</action>
|
105 |
+
</smssummary>
|
106 |
+
<manual translate="title" module="storesms">
|
107 |
+
<title>StoreSMS - Send Bulk SMS</title>
|
108 |
+
<sort_order>10</sort_order>
|
109 |
+
<action>storesms/adminhtml_storesms/new</action>
|
110 |
+
</manual>
|
111 |
+
<settings translate="title" module="storesms">
|
112 |
+
<title>StoreSMS - Settings</title>
|
113 |
+
<sort_order>15</sort_order>
|
114 |
+
<action>adminhtml/system_config/edit/section/storesms</action>
|
115 |
+
</settings>
|
116 |
+
</children>
|
117 |
+
</storesms>
|
118 |
+
</menu>
|
119 |
+
|
120 |
+
<layout>
|
121 |
+
<updates>
|
122 |
+
<storesms>
|
123 |
+
<file>Infobip_Storesms.xml</file>
|
124 |
+
</storesms>
|
125 |
+
</updates>
|
126 |
+
</layout>
|
127 |
+
|
128 |
+
<translate>
|
129 |
+
<modules>
|
130 |
+
<Infobip_Storesms>
|
131 |
+
<files>
|
132 |
+
<default>Infobip_Storesms.csv</default>
|
133 |
+
</files>
|
134 |
+
</Infobip_Storesms>
|
135 |
+
</modules>
|
136 |
+
</translate>
|
137 |
+
|
138 |
+
<events>
|
139 |
+
<admin_system_config_changed_section_storesms>
|
140 |
+
<observers>
|
141 |
+
<storesms_check_authorization_data>
|
142 |
+
<class>Infobip_Storesms_Model_Observer</class>
|
143 |
+
<method>checkAuthorizationData</method>
|
144 |
+
</storesms_check_authorization_data>
|
145 |
+
</observers>
|
146 |
+
</admin_system_config_changed_section_storesms>
|
147 |
+
<admin_session_user_login_success>
|
148 |
+
<observers>
|
149 |
+
<storesms_check_limits>
|
150 |
+
<class>Infobip_Storesms_Model_Observer</class>
|
151 |
+
<method>checkCreditLimit</method>
|
152 |
+
</storesms_check_limits>
|
153 |
+
</observers>
|
154 |
+
</admin_session_user_login_success>
|
155 |
+
</events>
|
156 |
+
|
157 |
+
|
158 |
+
</adminhtml>
|
159 |
+
|
160 |
+
|
161 |
+
<global>
|
162 |
+
<models>
|
163 |
+
<storesms>
|
164 |
+
<class>Infobip_Storesms_Model</class>
|
165 |
+
<resourceModel>storesms_resource</resourceModel>
|
166 |
+
</storesms>
|
167 |
+
<storesms_resource>
|
168 |
+
<class>Infobip_Storesms_Model_Resource</class>
|
169 |
+
<entities>
|
170 |
+
<infobip_storesms>
|
171 |
+
<table>infobip_storesms</table>
|
172 |
+
</infobip_storesms>
|
173 |
+
</entities>
|
174 |
+
</storesms_resource>
|
175 |
+
</models>
|
176 |
+
<helpers>
|
177 |
+
<storesms>
|
178 |
+
<class>Infobip_Storesms_Helper</class>
|
179 |
+
</storesms>
|
180 |
+
</helpers>
|
181 |
+
<blocks>
|
182 |
+
<storesms>
|
183 |
+
<class>Infobip_Storesms_Block</class>
|
184 |
+
</storesms>
|
185 |
+
</blocks>
|
186 |
+
<resources>
|
187 |
+
<storesms_setup>
|
188 |
+
<setup>
|
189 |
+
<module>Infobip_Storesms</module>
|
190 |
+
</setup>
|
191 |
+
</storesms_setup>
|
192 |
+
</resources>
|
193 |
+
<events>
|
194 |
+
<sales_order_save_before>
|
195 |
+
<observers>
|
196 |
+
<order_new_status>
|
197 |
+
<class>Infobip_Storesms_Model_Observer</class>
|
198 |
+
<method>handleStatus</method>
|
199 |
+
</order_new_status>
|
200 |
+
</observers>
|
201 |
+
</sales_order_save_before>
|
202 |
+
</events>
|
203 |
+
</global>
|
204 |
+
|
205 |
+
<default>
|
206 |
+
<storesms>
|
207 |
+
<main_conf>
|
208 |
+
<credit_alert_limit>0</credit_alert_limit>
|
209 |
+
</main_conf>
|
210 |
+
</storesms>
|
211 |
+
</default>
|
212 |
+
|
213 |
+
<crontab>
|
214 |
+
<jobs>
|
215 |
+
<storesms_getreports>
|
216 |
+
<schedule>
|
217 |
+
<cron_expr>0,30 * * * *</cron_expr>
|
218 |
+
</schedule>
|
219 |
+
<run><model>storesms/cron::getDelieveryReport</model></run>
|
220 |
+
</storesms_getreports>
|
221 |
+
</jobs>
|
222 |
+
</crontab>
|
223 |
+
|
224 |
+
|
225 |
+
</config>
|
app/code/community/Infobip/Storesms/etc/system.xml
ADDED
@@ -0,0 +1,330 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Infobip Storesms API
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* Short Message Service (SMS) API
|
23 |
+
*
|
24 |
+
* @category Infobip
|
25 |
+
* @package storesms API
|
26 |
+
* @copyright Copyright (c) 2012 Infobip (http://infobip.pl/)
|
27 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
28 |
+
* @author Marek Jasiukiewicz <dev@jasiukiewicz.pl>
|
29 |
+
*/
|
30 |
+
|
31 |
+
-->
|
32 |
+
|
33 |
+
<config>
|
34 |
+
<tabs>
|
35 |
+
<infobip translate="label">
|
36 |
+
<label>INFOBIP</label>
|
37 |
+
<sort_order>1</sort_order>
|
38 |
+
</infobip>
|
39 |
+
</tabs>
|
40 |
+
<sections>
|
41 |
+
<storesms translate="label" module="storesms">
|
42 |
+
<label><![CDATA[<span class="infobipadmin-menu">Infobip StoreSMS</span>]]></label>
|
43 |
+
<tab>infobip</tab>
|
44 |
+
<frontend_type>text</frontend_type>
|
45 |
+
<sort_order>0</sort_order>
|
46 |
+
<show_in_default>1</show_in_default>
|
47 |
+
<show_in_website>1</show_in_website>
|
48 |
+
<show_in_store>1</show_in_store>
|
49 |
+
<groups>
|
50 |
+
<branding_header translate="label" module="storesms">
|
51 |
+
<frontend_model>storesms/adminhtml_system_config_fieldset_branding</frontend_model>
|
52 |
+
<sort_order>0</sort_order>
|
53 |
+
<show_in_default>1</show_in_default>
|
54 |
+
<show_in_website>1</show_in_website>
|
55 |
+
<show_in_store>1</show_in_store>
|
56 |
+
</branding_header>
|
57 |
+
<main_conf translate="label">
|
58 |
+
<label>Storesms - Main Configuration</label>
|
59 |
+
<frontend_type>text</frontend_type>
|
60 |
+
<sort_order>1</sort_order>
|
61 |
+
<show_in_default>1</show_in_default>
|
62 |
+
<show_in_website>1</show_in_website>
|
63 |
+
<show_in_store>1</show_in_store>
|
64 |
+
<expanded>1</expanded>
|
65 |
+
<fields>
|
66 |
+
<active translate="label">
|
67 |
+
<label>Enabled</label>
|
68 |
+
<frontend_type>select</frontend_type>
|
69 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
70 |
+
<sort_order>1</sort_order>
|
71 |
+
<show_in_default>1</show_in_default>
|
72 |
+
<show_in_website>1</show_in_website>
|
73 |
+
<show_in_store>1</show_in_store>
|
74 |
+
</active>
|
75 |
+
|
76 |
+
<apilogin translate="label">
|
77 |
+
<label>API Login</label>
|
78 |
+
<frontend_type>text</frontend_type>
|
79 |
+
<sort_order>2</sort_order>
|
80 |
+
<show_in_default>1</show_in_default>
|
81 |
+
<show_in_website>1</show_in_website>
|
82 |
+
<show_in_store>1</show_in_store>
|
83 |
+
</apilogin>
|
84 |
+
|
85 |
+
<apipassword translate="label">
|
86 |
+
<label>API Password</label>
|
87 |
+
<frontend_type>obscure</frontend_type>
|
88 |
+
<backend_model>adminhtml/system_config_backend_encrypted</backend_model>
|
89 |
+
<sort_order>3</sort_order>
|
90 |
+
<show_in_default>1</show_in_default>
|
91 |
+
<show_in_website>1</show_in_website>
|
92 |
+
<show_in_store>1</show_in_store>
|
93 |
+
</apipassword>
|
94 |
+
|
95 |
+
<storename translate="label">
|
96 |
+
<label>Store name</label>
|
97 |
+
<frontend_type>text</frontend_type>
|
98 |
+
<sort_order>4</sort_order>
|
99 |
+
<show_in_default>1</show_in_default>
|
100 |
+
<show_in_website>1</show_in_website>
|
101 |
+
<show_in_store>1</show_in_store>
|
102 |
+
</storename>
|
103 |
+
|
104 |
+
|
105 |
+
<sender_active translate="label">
|
106 |
+
<label>Send as Pro Message (with sender)</label>
|
107 |
+
<frontend_type>select</frontend_type>
|
108 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
109 |
+
<sort_order>5</sort_order>
|
110 |
+
<show_in_default>1</show_in_default>
|
111 |
+
<show_in_website>1</show_in_website>
|
112 |
+
<show_in_store>1</show_in_store>
|
113 |
+
</sender_active>
|
114 |
+
<sender translate="label">
|
115 |
+
<label>Sender (max. 11 chars)</label>
|
116 |
+
<frontend_type>text</frontend_type>
|
117 |
+
<sort_order>6</sort_order>
|
118 |
+
<show_in_default>1</show_in_default>
|
119 |
+
<show_in_website>1</show_in_website>
|
120 |
+
<show_in_store>1</show_in_store>
|
121 |
+
<validate>validate-length maximum-length-11</validate>
|
122 |
+
<depends><sender_active>1</sender_active></depends>
|
123 |
+
</sender>
|
124 |
+
|
125 |
+
<country_prefix translate="label">
|
126 |
+
<label>Country prefix</label>
|
127 |
+
<frontend_type>text</frontend_type>
|
128 |
+
<sort_order>20</sort_order>
|
129 |
+
<show_in_default>1</show_in_default>
|
130 |
+
<show_in_website>1</show_in_website>
|
131 |
+
<show_in_store>1</show_in_store>
|
132 |
+
<validate>validate-length maximum-length-5</validate>
|
133 |
+
</country_prefix>
|
134 |
+
|
135 |
+
<allow_long_sms translate="label">
|
136 |
+
<label>Allow long messages (more than 160 chars)</label>
|
137 |
+
<frontend_type>select</frontend_type>
|
138 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
139 |
+
<sort_order>25</sort_order>
|
140 |
+
<show_in_default>1</show_in_default>
|
141 |
+
<show_in_website>1</show_in_website>
|
142 |
+
<show_in_store>1</show_in_store>
|
143 |
+
</allow_long_sms>
|
144 |
+
|
145 |
+
<credit_alert_limit translate="label comment">
|
146 |
+
<label>Notify if my Storesms account credits is below:</label>
|
147 |
+
<comment>0 - turn off/no alert</comment>
|
148 |
+
<frontend_type>text</frontend_type>
|
149 |
+
<sort_order>30</sort_order>
|
150 |
+
<show_in_default>1</show_in_default>
|
151 |
+
<show_in_website>1</show_in_website>
|
152 |
+
<show_in_store>1</show_in_store>
|
153 |
+
<validate>validate-zero-or-greater</validate>
|
154 |
+
</credit_alert_limit>
|
155 |
+
|
156 |
+
</fields>
|
157 |
+
|
158 |
+
</main_conf>
|
159 |
+
|
160 |
+
|
161 |
+
|
162 |
+
<templates translate="label comment" module="storesms">
|
163 |
+
<label>Message templates</label>
|
164 |
+
<frontend_type>text</frontend_type>
|
165 |
+
<comment><![CDATA[<div style="padding:10px;background-color:#fff;border:1px solid #CCC;margin-bottom:7px;">In each template you can use dynamic data. You can add <br />- {NAME} - customer name <br />- {ORDERSTATUS} - status of an order <br />- {ORDERNUMBER} - order number<br />- {TRACKINGNUMBER} - tracking number (if exists)<br />- {STORENAME} - the name of the store<br />Example: Your order #{ORDERNUMBER} waits for a fee. Regards {STORENAME}<br />SMS Content: Your order #100000012 waits for a fee. Regards infobip.com</div><div id="storesmsCounterContainer">Message length: <span id="storesmsCounter">0</span> chars.<br /> <span id="storesmsTooLongAlert"> Warning: The template can be to long for 1 SMS. Please shorten the message or allow to send long messages in Main Configuration.</span></div><br />]]></comment>
|
166 |
+
<sort_order>100</sort_order>
|
167 |
+
<show_in_default>1</show_in_default>
|
168 |
+
<show_in_website>1</show_in_website>
|
169 |
+
<show_in_store>1</show_in_store>
|
170 |
+
<expanded>1</expanded>
|
171 |
+
<fields>
|
172 |
+
|
173 |
+
<status_pending_payment_active translate="label">
|
174 |
+
<label>Send SMS after status changed to "Pending Payment"</label>
|
175 |
+
<frontend_type>select</frontend_type>
|
176 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
177 |
+
<sort_order>3</sort_order>
|
178 |
+
<show_in_default>1</show_in_default>
|
179 |
+
<show_in_website>1</show_in_website>
|
180 |
+
<show_in_store>1</show_in_store>
|
181 |
+
</status_pending_payment_active>
|
182 |
+
<status_pending_payment translate="label">
|
183 |
+
<label>Template</label>
|
184 |
+
<frontend_type>textarea</frontend_type>
|
185 |
+
<sort_order>4</sort_order>
|
186 |
+
<show_in_default>1</show_in_default>
|
187 |
+
<show_in_website>1</show_in_website>
|
188 |
+
<show_in_store>1</show_in_store>
|
189 |
+
<depends><status_pending_payment_active>1</status_pending_payment_active></depends>
|
190 |
+
</status_pending_payment>
|
191 |
+
|
192 |
+
<status_holded_active translate="label">
|
193 |
+
<label>Send SMS after status changed to "On Hold"</label>
|
194 |
+
<frontend_type>select</frontend_type>
|
195 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
196 |
+
<sort_order>5</sort_order>
|
197 |
+
<show_in_default>1</show_in_default>
|
198 |
+
<show_in_website>1</show_in_website>
|
199 |
+
<show_in_store>1</show_in_store>
|
200 |
+
</status_holded_active>
|
201 |
+
<status_holded translate="label">
|
202 |
+
<label>Template</label>
|
203 |
+
<frontend_type>textarea</frontend_type>
|
204 |
+
<sort_order>6</sort_order>
|
205 |
+
<show_in_default>1</show_in_default>
|
206 |
+
<show_in_website>1</show_in_website>
|
207 |
+
<show_in_store>1</show_in_store>
|
208 |
+
<depends><status_holded_active>1</status_holded_active></depends>
|
209 |
+
</status_holded>
|
210 |
+
|
211 |
+
<status_processing_active translate="label">
|
212 |
+
<label>Send SMS after status changed to "Processing"</label>
|
213 |
+
<frontend_type>select</frontend_type>
|
214 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
215 |
+
<sort_order>7</sort_order>
|
216 |
+
<show_in_default>1</show_in_default>
|
217 |
+
<show_in_website>1</show_in_website>
|
218 |
+
<show_in_store>1</show_in_store>
|
219 |
+
</status_processing_active>
|
220 |
+
<status_processing translate="label">
|
221 |
+
<label>Template</label>
|
222 |
+
<frontend_type>textarea</frontend_type>
|
223 |
+
<sort_order>8</sort_order>
|
224 |
+
<show_in_default>1</show_in_default>
|
225 |
+
<show_in_website>1</show_in_website>
|
226 |
+
<show_in_store>1</show_in_store>
|
227 |
+
<depends><status_processing_active>1</status_processing_active></depends>
|
228 |
+
</status_processing>
|
229 |
+
|
230 |
+
<status_canceled_active translate="label">
|
231 |
+
<label>Send SMS after status changed to "Canceled"</label>
|
232 |
+
<frontend_type>select</frontend_type>
|
233 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
234 |
+
<sort_order>9</sort_order>
|
235 |
+
<show_in_default>1</show_in_default>
|
236 |
+
<show_in_website>1</show_in_website>
|
237 |
+
<show_in_store>1</show_in_store>
|
238 |
+
</status_canceled_active>
|
239 |
+
<status_canceled translate="label">
|
240 |
+
<label>Template</label>
|
241 |
+
<frontend_type>textarea</frontend_type>
|
242 |
+
<sort_order>10</sort_order>
|
243 |
+
<show_in_default>1</show_in_default>
|
244 |
+
<show_in_website>1</show_in_website>
|
245 |
+
<show_in_store>1</show_in_store>
|
246 |
+
<depends><status_canceled_active>1</status_canceled_active></depends>
|
247 |
+
</status_canceled>
|
248 |
+
|
249 |
+
<status_complete_active translate="label">
|
250 |
+
<label>Send SMS after status changed to "Complete"</label>
|
251 |
+
<frontend_type>select</frontend_type>
|
252 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
253 |
+
<sort_order>11</sort_order>
|
254 |
+
<show_in_default>1</show_in_default>
|
255 |
+
<show_in_website>1</show_in_website>
|
256 |
+
<show_in_store>1</show_in_store>
|
257 |
+
</status_complete_active>
|
258 |
+
<status_complete translate="label">
|
259 |
+
<label>Template</label>
|
260 |
+
<frontend_type>textarea</frontend_type>
|
261 |
+
<sort_order>12</sort_order>
|
262 |
+
<show_in_default>1</show_in_default>
|
263 |
+
<show_in_website>1</show_in_website>
|
264 |
+
<show_in_store>1</show_in_store>
|
265 |
+
<depends><status_complete_active>1</status_complete_active></depends>
|
266 |
+
</status_complete>
|
267 |
+
|
268 |
+
<status_closed_active translate="label">
|
269 |
+
<label>Send SMS after status changed to "Closed"</label>
|
270 |
+
<frontend_type>select</frontend_type>
|
271 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
272 |
+
<sort_order>13</sort_order>
|
273 |
+
<show_in_default>1</show_in_default>
|
274 |
+
<show_in_website>1</show_in_website>
|
275 |
+
<show_in_store>1</show_in_store>
|
276 |
+
</status_closed_active>
|
277 |
+
<status_closed translate="label">
|
278 |
+
<label>Template</label>
|
279 |
+
<frontend_type>textarea</frontend_type>
|
280 |
+
<sort_order>14</sort_order>
|
281 |
+
<show_in_default>1</show_in_default>
|
282 |
+
<show_in_website>1</show_in_website>
|
283 |
+
<show_in_store>1</show_in_store>
|
284 |
+
<depends><status_closed_active>1</status_closed_active></depends>
|
285 |
+
</status_closed>
|
286 |
+
</fields>
|
287 |
+
</templates>
|
288 |
+
|
289 |
+
<contact translate="label" module="storesms">
|
290 |
+
<label>Contact Us</label>
|
291 |
+
<frontend_type>text</frontend_type>
|
292 |
+
<sort_order>200</sort_order>
|
293 |
+
<show_in_default>1</show_in_default>
|
294 |
+
<show_in_website>1</show_in_website>
|
295 |
+
<show_in_store>1</show_in_store>
|
296 |
+
<fields>
|
297 |
+
<contactbutton translate="label">
|
298 |
+
<label>Contact Us</label>
|
299 |
+
<frontend_model>storesms/buttons_contact</frontend_model>
|
300 |
+
<sort_order>101</sort_order>
|
301 |
+
<show_in_default>1</show_in_default>
|
302 |
+
<show_in_website>1</show_in_website>
|
303 |
+
<show_in_store>1</show_in_store>
|
304 |
+
</contactbutton>
|
305 |
+
</fields>
|
306 |
+
</contact>
|
307 |
+
|
308 |
+
<newaccount translate="label comment" module="storesms">
|
309 |
+
<label>Sign up</label>
|
310 |
+
<comment><![CDATA[<p><strong>How to register and start using the Plugin?</strong><br /><br />Because Parseco provides Infobip's API integration, in order to use Infobip StoreSMS it is necessary to register over the Parseco platform (<a href="http://www.parseco.com/" target="_blank">www.parseco.com</a>). This allows you to get your login credentials and password for the plugin.</p>]]></comment>
|
311 |
+
<frontend_type>text</frontend_type>
|
312 |
+
<sort_order>210</sort_order>
|
313 |
+
<show_in_default>1</show_in_default>
|
314 |
+
<show_in_website>1</show_in_website>
|
315 |
+
<show_in_store>1</show_in_store>
|
316 |
+
<fields>
|
317 |
+
<newaccountbutton translate="label">
|
318 |
+
<label>Sign up</label>
|
319 |
+
<frontend_model>storesms/buttons_newAccount</frontend_model>
|
320 |
+
<sort_order>101</sort_order>
|
321 |
+
<show_in_default>1</show_in_default>
|
322 |
+
<show_in_website>1</show_in_website>
|
323 |
+
<show_in_store>1</show_in_store>
|
324 |
+
</newaccountbutton>
|
325 |
+
</fields>
|
326 |
+
</newaccount>
|
327 |
+
</groups>
|
328 |
+
</storesms>
|
329 |
+
</sections>
|
330 |
+
</config>
|
app/code/community/Infobip/Storesms/sql/storesms_setup/install-1.0.0.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
$installer->startSetup();
|
5 |
+
$table = $installer->getConnection()->newTable($installer->getTable('infobip_storesms'))
|
6 |
+
->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
7 |
+
'identity' => true,
|
8 |
+
'unsigned' => true,
|
9 |
+
'nullable' => false,
|
10 |
+
'primary' => true
|
11 |
+
), 'SMS ID')
|
12 |
+
->addColumn('sender', Varien_Db_Ddl_Table::TYPE_TEXT, 100, array(
|
13 |
+
'nullable' => false,
|
14 |
+
), 'Sender')
|
15 |
+
->addColumn('telephone', Varien_Db_Ddl_Table::TYPE_TEXT, 50, array(
|
16 |
+
'nullable' => false,
|
17 |
+
), 'Telephone')
|
18 |
+
->addColumn('message', Varien_Db_Ddl_Table::TYPE_TEXT, 1000, array(
|
19 |
+
'nullable' => false,
|
20 |
+
), 'Message')
|
21 |
+
->addColumn('attempts_number', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
22 |
+
'nullable' => false,
|
23 |
+
), 'Send Attempts')
|
24 |
+
->addColumn('delivery_status', Varien_Db_Ddl_Table::TYPE_TEXT, 100, array(
|
25 |
+
'nullable' => false,
|
26 |
+
), 'Delivery Status')
|
27 |
+
->addColumn('created', Varien_Db_Ddl_Table::TYPE_DATE , null, array(
|
28 |
+
'nullable' => false,
|
29 |
+
), 'First send date')
|
30 |
+
->setComment('Storesms API SMSes');
|
31 |
+
$installer->getConnection()->createTable($table);
|
32 |
+
$installer->endSetup();
|
app/design/adminhtml/base/default/layout/Infobip_Storesms.xml
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<default>
|
4 |
+
<reference name="head">
|
5 |
+
<action method="addJs"><script>infobipStoresms/storesmscounter.js</script></action>
|
6 |
+
<action method="addCss"><name>css/storesms/skin.css</name></action>
|
7 |
+
</reference>
|
8 |
+
</default>
|
9 |
+
<adminhtml_storesms_index>
|
10 |
+
<reference name="content">
|
11 |
+
<block type="storesms/adminhtml_storesms" name="storesms" />
|
12 |
+
</reference>
|
13 |
+
</adminhtml_storesms_index>
|
14 |
+
|
15 |
+
<storesms_adminhtml_storesms_index>
|
16 |
+
<reference name="content">
|
17 |
+
<block type="storesms/adminhtml_storesms" name="storesms" />
|
18 |
+
</reference>
|
19 |
+
</storesms_adminhtml_storesms_index>
|
20 |
+
</layout>
|
app/design/adminhtml/base/default/template/storesms/system/config/fieldset/branding.phtml
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<style type="text/css">
|
2 |
+
|
3 |
+
.entry-edit .entry-edit-head { background:#ff6900 !important; }
|
4 |
+
.content-header { margin-bottom: 0px !important; }
|
5 |
+
|
6 |
+
</style>
|
7 |
+
<div style="overflow: hidden;"><img src="<?php echo $this->getSkinUrl('images/storesms/storesms_header.png'); ?>"></div>
|
app/etc/modules/Infobip_Storesms.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Infobip_Storesms>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</Infobip_Storesms>
|
8 |
+
</modules>
|
9 |
+
</config>
|
app/locale/pl_PL/Infobip_Storesms.csv
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"StoreSMS - Summary","StoreSMS - Podsumowanie"
|
2 |
+
"StoreSMS - Send Bulk SMS","StoreSMS: Hurtowa wysyłka wiadomości"
|
3 |
+
"Send Bulk SMS","Wyślij wiadomość hurtową"
|
4 |
+
"Send","Wyślij"
|
5 |
+
"StoreSMS - Settings","StoreSMS - Ustawienia"
|
6 |
+
"Storesms - Main Configuration","Storesms - konfiguracja podstawowa"
|
7 |
+
"Enabled","Włączony"
|
8 |
+
"API Login","API Login"
|
9 |
+
"API Password","API Hasło"
|
10 |
+
"Store name","Nazwa sklepu"
|
11 |
+
"Send as Pro Message (with sender)","Wyślij jako wiadomość Pro (z nadawcą)"
|
12 |
+
"Sender (max. 11 chars)","Nadawca (max. 11 znaków)"
|
13 |
+
"Country prefix","Prefix kraju"
|
14 |
+
"Allow long messages (more than 160 chars)","Zezwól na długie wiadomości (dłuższe niż 160 znaków)"
|
15 |
+
"Notify if my Storesms account credits is below:","Poinformuj mnie jeśli na moim koncie Storesms pozostało środków mniej niż:"
|
16 |
+
"<div style=""padding:10px;background-color:#fff;border:1px solid #CCC;margin-bottom:7px;"">In each template you can use dynamic data. You can add <br />- {NAME} - customer name <br />- {ORDERSTATUS} - status of an order <br />- {ORDERNUMBER} - order number<br />- {TRACKINGNUMBER} - tracking number (if exists)<br />- {STORENAME} - the name of the store<br />Example: Your order #{ORDERNUMBER} waits for a fee. Regards {STORENAME}<br />SMS Content: Your order #100000012 waits for a fee. Regards infobip.com</div><div id=""storesmsCounterContainer"">Message length: <span id=""storesmsCounter"">0</span> chars.<br /> <span id=""storesmsTooLongAlert""> Warning: The template can be to long for 1 SMS. Please shorten the message or allow to send long messages in Main Configuration.</span></div><br />","<div style=""padding:10px;background-color:#fff;border:1px solid #CCC;margin-bottom:7px;""><p>W każdym szablonie możesz używać danych dynamicznych. Możesz dodać:<br /> - {NAME} - imię klienta <br /> - {ORDERSTATUS} - status przesyłki <br /> - {ORDERNUMBER} - nr zamówienia<br /> - {TRACKINGNUMBER} - nr pozwalający na śledzenie przesyłki (jeśli istnieje)<br /> - {STORENAME} - nazwa sklepu<br /> Przykład: Twoje zamówienie nr {ORDERNUMBER} czeka na wpłatę. Pozdrawiamy {STORENAME}.<br /> Treść wysłanego SMSa: Twoje zamówienie nr 100000012 czeka na wpłatę. Pozdrawiamy infobip.com.pl.</p></div><div id=""storesmsCounterContainer"">Długość wiadomości: <span id=""storesmsCounter"">0</span> znaków.<br /> <span id=""storesmsTooLongAlert""> Uwaga: Szablon może być zbyt długi na 1 SMSa. Proszę skrócić wiadomość lub zezwolić na wysyłkę długich wiadomości w konfiguracji podstawowej.</span></div><br />"
|
17 |
+
"Send SMS after status changed to ""Pending Payment""","Wyślij SMS po zmianie statusu zamówienia na ""Oczekuje na wpłatę"""
|
18 |
+
"Message templates","Szablony wiadomości"
|
19 |
+
"Template","Szablon"
|
20 |
+
"Send SMS after status changed to ""On Hold""","Wyślij SMS po zmianie statusu zamówienia na ""Wstrzymano"""
|
21 |
+
"Send SMS after status changed to ""Processing""","Wyślij SMS po zmianie statusu zamówienia na ""Przetwarzam"""
|
22 |
+
"Send SMS after status changed to ""Canceled""","Wyślij SMS po zmianie statusu zamówienia na ""Anulowano"""
|
23 |
+
"end SMS after status changed to ""Complete""","Wyślij SMS po zmianie statusu zamówienia na ""Zakończone"""
|
24 |
+
"Send SMS after status changed to ""Closed""","Wyślij SMS po zmianie statusu zamówienia na ""Zamknięte"""
|
25 |
+
"Contact Us","Skontaktuj się z nami"
|
26 |
+
"Sign up","Zarejestruj się"
|
27 |
+
"Error sending Message:","Błąd podczas wysyłania wiadomości"
|
28 |
+
"Message sent successfully","Wiadomość wysłana"
|
29 |
+
"SMS notification sent (SMS id:","Powiadomienie SMS wysłane (id SMSa:"
|
30 |
+
"SMS notification sending error:","Błąd podczas wysyłania powiadomienia SMS:"
|
31 |
+
"Warning: Low credit level at your Storesms account. Buy credits.","Ostrzeżenie: Niski stan środków na koncie StoreSMS"
|
32 |
+
"Storesms API: Wrong Password and/or Username","StoreSMS API: Nieprawidłowa nazwa użytkownika lub hasło"
|
33 |
+
"No recipients found","Brak odbiorcy/ów"
|
34 |
+
"Open Sign Up form","Otwórz formularz rejestracyjny"
|
35 |
+
"Open contact form","Otwórz formularz kontaktowy"
|
36 |
+
"Storesms API: Messages summary","Storesms API: Podsumowanie wiadomości"
|
37 |
+
"ID","id"
|
38 |
+
"Created date","Data wysłania"
|
39 |
+
"Sender","Nadawca"
|
40 |
+
"Phone number","Odbiorca (nr tel.)"
|
41 |
+
"Message","Treść wiadomości"
|
42 |
+
"Delivery Status","Status doręczenia"
|
43 |
+
"SMS Content","Treść wiadomości"
|
44 |
+
"<p><strong>How to register and start using the Plugin?</strong><br /><br />Because Parseco provides Infobip's API integration, in order to use Infobip StoreSMS it is necessary to register over the Parseco platform (<a href=""http://www.parseco.com/"" target=""_blank"">www.parseco.com</a>). This allows you to get your login credentials and password for the plugin.</p>","<p><strong>Rejestracja i rozpoczęcie korzystania z Pluginu</strong><br /><br />Parseco jest marką Infobip pozwalającą na szybką integrację. Aby korzystać z Infobip Store SMS, niezbędna jest rejestracja na platformie Parseco (<a href=""http://www.parseco.com/"" target=""_blank"">www.parseco.com</a>). W ten sposób uzyskasz login i hasło wymagane przez Infobip Store SMS.</p>"
|
45 |
+
"<br /><p><strong>Using other Infobip services with Infobip StoreSMS</strong><br /><br /> Infobip is a global provider of mobile solutions connecting mobile network operators and enterprises through an in-house developed and operated mobile services cloud. SMS offers an ideal opportunity for business expansion because of its ubiquity, marketing effectiveness and wide reach.<br /> To find out more about SMS messaging solution visit <a href=""http://www.infobip.com/"" target=""_blank"">www.infobip.com</a><br />Magento users can go to <strong>System > Import/export > Dataflow Profiles > Export Customers > Run Profile</strong> to create a file that could later be imported to all of Infobip's other tools. This way, you can also use Infobip's Worx platform and inform your customers over SMS.</p>","<br /><p><strong>Korzystanie z pozostałych rozwiązań Infobip dla Infobip StoreSMS</strong><br /><br />Infobip jest globalnym dostawcą usług mobilnych, łączacym przedsiębiorców z operatorami telefonii komórkowej poprzez wewnętrznie tworzone, działające w chmurze aplikacje. Dzięki swojej uniwersalności I efektywności, SMS stanowi doskonały sposób na rozwój biznesu.<br />Aby dowiedzieć się więcej wejdź na <a href=""http://www.infobip.com.pl/"" target=""_blank"">www.infobip.com.pl</a><br /> Użytkownicy Magento mogą przejść do zakładki <strong>System > Import/export > Dataflow Profiles > Export Customers > Uruchom Profil</strong> aby utworzyć plik, który może później być użyty z narzędziami Infobip. W ten sposób, możesz wykorzystać pakiet Infobip Worx, do lepszej komunikacji z klientem.</p>"
|
46 |
+
"Message (max. 160 characters).","Treść (max. 160 znaków)."
|
47 |
+
"Bulk messaging is the process of sending a large number of SMS messages to various mobile number databases (mobile numbers). Bulk SMS is commonly used for alerts, reminders, marketing but also for providing information and communication between both staff and customers.","Hurtowa komunikacja to proces wysyłki dużej ilości wiadomości SMS do odpowiednio dużej bazy numerów komórkowych. Komunikacja hurtowa jest zazwyczaj używana do przypomnień, przekazywania informacji marketingowej lub komunikacji z klientami."
|
js/infobipStoresms/storesmscounter.js
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Create the class
|
2 |
+
|
3 |
+
var myStoresmsCounter = Class.create({
|
4 |
+
initialize: function(eventToObserve) // Is called when the page has finished loading by the Event.observe code below
|
5 |
+
{
|
6 |
+
|
7 |
+
var storesmsCounter = document.getElementById('storesmsCounter');
|
8 |
+
var storesmsCounterContainer = document.getElementById('storesmsCounterContainer');
|
9 |
+
var maxchars = 160;
|
10 |
+
var childAdded = false;
|
11 |
+
var activeTextArea = false;
|
12 |
+
var textAreaId = false;
|
13 |
+
// var storeNameLenght = document.getElementById('storesms_main_conf_storename').value.length;
|
14 |
+
|
15 |
+
$('storesms_templates').observe(eventToObserve, function(event) {
|
16 |
+
var textlength = 0;
|
17 |
+
activeTextArea = event.findElement('textarea');
|
18 |
+
|
19 |
+
if (activeTextArea) {
|
20 |
+
|
21 |
+
|
22 |
+
if (textAreaId !== activeTextArea.id) {
|
23 |
+
storesmsCounterContainer.remove(); //remove old storesmsCounterContainer
|
24 |
+
activeTextArea.insert({//reinitialize conterContainer in new position
|
25 |
+
after: storesmsCounterContainer
|
26 |
+
});
|
27 |
+
storesmsCounterContainer.show(); //snow storesmsCounter div at starts
|
28 |
+
}
|
29 |
+
|
30 |
+
textlength = activeTextArea.value.length;
|
31 |
+
|
32 |
+
|
33 |
+
|
34 |
+
storesmsCounter.update(textlength);
|
35 |
+
|
36 |
+
if (textlength <= (maxchars - 50)) {
|
37 |
+
|
38 |
+
$('storesmsCounter').setStyle({
|
39 |
+
fontSize: '150%',
|
40 |
+
fontWeight: 'normal',
|
41 |
+
color: '#0F910F'
|
42 |
+
});
|
43 |
+
$('storesmsTooLongAlert').hide();
|
44 |
+
|
45 |
+
}
|
46 |
+
else if (textlength <= (maxchars - 20)) {
|
47 |
+
|
48 |
+
$('storesmsCounter').setStyle({
|
49 |
+
fontWeight: 'bold',
|
50 |
+
color: '#FF8400'
|
51 |
+
});
|
52 |
+
$('storesmsTooLongAlert').hide();
|
53 |
+
|
54 |
+
} else {
|
55 |
+
|
56 |
+
$('storesmsCounter').setStyle({
|
57 |
+
fontWeight: ' bold',
|
58 |
+
color: '#B80000'
|
59 |
+
});
|
60 |
+
$('storesmsTooLongAlert').show();
|
61 |
+
|
62 |
+
}
|
63 |
+
|
64 |
+
|
65 |
+
}
|
66 |
+
|
67 |
+
|
68 |
+
|
69 |
+
|
70 |
+
});
|
71 |
+
|
72 |
+
}
|
73 |
+
|
74 |
+
});
|
75 |
+
// Global variable for the instance of the class
|
76 |
+
// Creating an instance of the class if the page has finished loading
|
77 |
+
Event.observe(window, 'load', function() {
|
78 |
+
document.getElementById('storesmsCounterContainer').hide(); //hide storesmsCounter div at start
|
79 |
+
new myStoresmsCounter('click');
|
80 |
+
new myStoresmsCounter('keyup');
|
81 |
+
});
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Infobip_Storesms</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>Infobip StoreSMS licence</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Infobip StoreSMS API module</summary>
|
10 |
+
<description>Infobip StoreSMS API module</description>
|
11 |
+
<notes>Infobip StoreSMS API module</notes>
|
12 |
+
<authors><author><name>Snowdog</name><user>snowdog</user><email>support@snowdog.pl</email></author><author><name>Marek Jasiukiewicz</name><user>jasiukiewicz_m</user><email>dev@jasiukiewicz.pl</email></author><author><name>Infobip</name><user>Infobip</user><email>magento@infobip.com</email></author></authors>
|
13 |
+
<date>2013-03-11</date>
|
14 |
+
<time>12:42:41</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Infobip"><dir name="Storesms"><dir name="Block"><dir name="Adminhtml"><dir name="Storesms"><dir name="Edit"><file name="Form.php" hash="1b369dae5e437d2dcf17b30275fcd489"/><dir name="Tab"><file name="Form.php" hash="96d0f24063b0a7af61d55a728e13ad0e"/></dir><file name="Tabs.php" hash="188c99c05a103090fb0d3c65a30529a5"/></dir><file name="Edit.php" hash="d2095dd15d30a7ee0bb50f12c9d91c8d"/><file name="Grid.php" hash="b411c3db6224c7774811fa5bed9dbe70"/></dir><file name="Storesms.php" hash="7bb4da25d3b5bc3e7363cf8b9a86bfd2"/><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Branding.php" hash="eebc4a367ad619b8fe105dfd2fe42394"/></dir></dir></dir></dir><dir name="Buttons"><file name="Contact.php" hash="a9ea799fe52cac5ce9eced905173a69d"/><file name="NewAccount.php" hash="69047d85be7fe818d76e2c09c8f80805"/></dir></dir><dir name="Helper"><file name="Data.php" hash="2b7999c16e3f2e9400a31f87e0fa2fbc"/><file name="Xml.php" hash="a858c494660f260fae1d26c4baf98258"/></dir><dir name="Model"><file name="ApiClient.php" hash="c76b7abe20f80bf636c7c8db1f3266ff"/><file name="Config.php" hash="77679160df8b273550f2be7144c65723"/><file name="Cron.php" hash="7eabce279410694dd39ff7ba47b891ae"/><file name="Observer.php" hash="23dabc6ef2ee78ad24827f9d0ad2dc0d"/><dir name="Resource"><dir name="Storesms"><file name="Collection.php" hash="9ddcb7f555bce6a7d61b94a1b8411365"/></dir><file name="Storesms.php" hash="4c8de8d71e2b5f7240eced9ff892823f"/></dir><file name="Storesms.php" hash="13af9b62b847f156767250bb07079aba"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="StoresmsController.php" hash="f1ecf02504ed1ce8f1364f75df4827cf"/></dir></dir><dir name="etc"><file name="config.xml" hash="6b9a72ca2310e7319079c7132a2029e5"/><file name="system.xml" hash="89b70927b7cb0dc6c0b4cf81a119e335"/></dir><dir name="sql"><dir name="storesms_setup"><file name="install-1.0.0.php" hash="05abcca86b256b1fe6ecc75dca077042"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="layout"><file name="Infobip_Storesms.xml" hash="f24aee754602413e872941f4b7768e67"/></dir><dir name="template"><dir name="storesms"><dir name="system"><dir name="config"><dir name="fieldset"><file name="branding.phtml" hash="97fd7bad4030f34f3869363786cc46c8"/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="images"><dir name="storesms"><file name="storesms_header.png" hash="ca8dce29b3bbe56ae222587b103f27ac"/></dir></dir><dir name="css"><dir name="storesms"><file name="skin.css" hash="2f6c219956ed5ac0bd28256279cdc0cf"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Infobip_Storesms.xml" hash="ea5ef63fd7a211500bdaefaf6e56809e"/></dir></target><target name="mage"><dir name="js"><dir name="infobipStoresms"><file name="storesmscounter.js" hash="172592c438b41b35d5b3bec9ad8afc0d"/></dir></dir></target><target name="magelocale"><dir name="pl_PL"><file name="Infobip_Storesms.csv" hash="00700b577d39d3c4f9e0553301cdead7"/></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
+
</package>
|
skin/adminhtml/base/default/css/storesms/skin.css
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.infobipadmin-menu {
|
2 |
+
color:#ff6900;
|
3 |
+
padding-left:0px !important;
|
4 |
+
padding-right:20px;
|
5 |
+
}
|
skin/adminhtml/base/default/images/storesms/storesms_header.png
ADDED
Binary file
|