Easyweb_Smsnotify - Version 1.0.3

Version Notes

Balance info
Fix issues with eSputnik provider

Download this release

Release Info

Developer Artem Kruzhalin
Extension Easyweb_Smsnotify
Version 1.0.3
Comparing to
See all releases


Code changes from version 1.0.1 to 1.0.3

app/code/local/Easyweb/Smsnotify/Block/Adminhtml/System/Config/Balance.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * EasyWeb SmsNotify
4
+ *
5
+ *
6
+ * @category Easyweb
7
+ * @package Easyweb_Smsnotify
8
+ * @copyright Copyright (c) 2014 EasyWeb. (http://easyweb.org.ua)
9
+ */
10
+
11
+ class Easyweb_Smsnotify_Block_Adminhtml_System_Config_Balance extends Mage_Adminhtml_Block_System_Config_Form_Field
12
+ {
13
+ /**
14
+ * Set template to itself
15
+ *
16
+ * @return Mage_Adminhtml_Block_Customer_System_Config_Validatevat
17
+ */
18
+ protected function _prepareLayout()
19
+ {
20
+ parent::_prepareLayout();
21
+ if (!$this->getTemplate()) {
22
+ $this->setTemplate('smsnotify/system/config/balance.phtml');
23
+ }
24
+ return $this;
25
+ }
26
+
27
+ /**
28
+ * Get the button and scripts contents
29
+ *
30
+ * @param Varien_Data_Form_Element_Abstract $element
31
+ * @return string
32
+ */
33
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
34
+ {
35
+ $originalData = $element->getOriginalData();
36
+ $this->addData(array(
37
+ 'button_label' => Mage::helper('easyweb_smsnotify')->__($originalData['button_label']),
38
+ 'html_id' => $element->getHtmlId(),
39
+ 'ajax_url' => Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/config_balance/check')
40
+ ));
41
+
42
+ return $this->_toHtml();
43
+ }
44
+ }
app/code/local/Easyweb/Smsnotify/Helper/Data.php CHANGED
@@ -1,66 +1,83 @@
1
- <?php
2
- /**
3
- * EasyWeb SmsNotify
4
- *
5
- *
6
- * @category Easyweb
7
- * @package Easyweb_Smsnotify
8
- * @copyright Copyright (c) 2014 EasyWeb. (http://easyweb.org.ua)
9
- */
10
-
11
- class Easyweb_Smsnotify_Helper_Data extends Mage_Core_Helper_Abstract
12
- {
13
- protected $_provider = null;
14
-
15
- protected $_text = null;
16
-
17
- protected $_phone = null;
18
- /**
19
- * Check if sms notify is enabled
20
- *
21
- * @return boolean
22
- */
23
- public function isSmsEnabled()
24
- {
25
- return Mage::getStoreConfig('easywebsmsnotify/general/enabled');
26
- }
27
-
28
- /**
29
- * Get current sms provider
30
- *
31
- * @return string
32
- */
33
- public function getProvider()
34
- {
35
- if(is_null($this->_provider)){
36
- $this->_provider = Mage::getStoreConfig('easywebsmsnotify/general/provider');
37
- }
38
- return $this->_provider;
39
- }
40
-
41
- /**
42
- * Get text for sms
43
- *
44
- * @return string
45
- */
46
- public function getTextMessage()
47
- {
48
- if(is_null($this->_text)){
49
- $this->_text = Mage::getStoreConfig('easywebsmsnotify/general/text');
50
- }
51
- return $this->_text;
52
- }
53
-
54
- /**
55
- * Get text for sms
56
- *
57
- * @return string
58
- */
59
- public function getStorePhone()
60
- {
61
- if(is_null($this->_phone)){
62
- $this->_phone = Mage::getStoreConfig('easywebsmsnotify/general/store_phone');
63
- }
64
- return $this->_phone;
65
- }
66
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * EasyWeb SmsNotify
5
+ *
6
+ *
7
+ * @category Easyweb
8
+ * @package Easyweb_Smsnotify
9
+ * @copyright Copyright (c) 2014 EasyWeb. (http://easyweb.org.ua)
10
+ */
11
+ class Easyweb_Smsnotify_Helper_Data extends Mage_Core_Helper_Abstract
12
+ {
13
+ protected $_provider = null;
14
+
15
+ protected $_text = null;
16
+
17
+ protected $_phone = null;
18
+
19
+ /**
20
+ * Check if sms notify is enabled
21
+ *
22
+ * @return boolean
23
+ */
24
+ public function isSmsEnabled()
25
+ {
26
+ return Mage::getStoreConfig('easywebsmsnotify/general/enabled');
27
+ }
28
+
29
+ /**
30
+ * Get current sms provider
31
+ *
32
+ * @return string
33
+ */
34
+ public function getProvider()
35
+ {
36
+ if (is_null($this->_provider)) {
37
+ $this->_provider = Mage::getStoreConfig('easywebsmsnotify/general/provider');
38
+ }
39
+ return $this->_provider;
40
+ }
41
+
42
+
43
+ /**
44
+ * @return bool|Mage_Core_Model_Abstract
45
+ */
46
+ public function getProviderModel()
47
+ {
48
+ if (!$this->isSmsEnabled()) {
49
+ return false;
50
+ }
51
+ $provider = $this->getProvider();
52
+ if ($provider) {
53
+ return Mage::getModel('easyweb_smsnotify/provider_' . $provider);
54
+ }
55
+ return false;
56
+ }
57
+
58
+ /**
59
+ * Get text for sms
60
+ *
61
+ * @return string
62
+ */
63
+ public function getTextMessage()
64
+ {
65
+ if (is_null($this->_text)) {
66
+ $this->_text = Mage::getStoreConfig('easywebsmsnotify/general/text');
67
+ }
68
+ return $this->_text;
69
+ }
70
+
71
+ /**
72
+ * Get text for sms
73
+ *
74
+ * @return string
75
+ */
76
+ public function getStorePhone()
77
+ {
78
+ if (is_null($this->_phone)) {
79
+ $this->_phone = Mage::getStoreConfig('easywebsmsnotify/general/store_phone');
80
+ }
81
+ return $this->_phone;
82
+ }
83
+ }
app/code/local/Easyweb/Smsnotify/Model/Observer.php CHANGED
@@ -1,41 +1,34 @@
1
- <?php
2
- /**
3
- * EasyWeb SmsNotify
4
- *
5
- *
6
- * @category Easyweb
7
- * @package Easyweb_Smsnotify
8
- * @copyright Copyright (c) 2014 EasyWeb. (http://easyweb.org.ua)
9
- */
10
-
11
- class Easyweb_Smsnotify_Model_Observer
12
- {
13
- /**
14
- * Handler for sales_order_place_after
15
- *
16
- * @param Varien_Event_Observer $observer
17
- * @return boolean
18
- */
19
- public function sendNotifyToAdminAfterPlaceOrder($observer)
20
- {
21
-
22
- $helper = Mage::helper('easyweb_smsnotify');
23
-
24
- if (!$helper->isSmsEnabled()) {
25
- return $this;
26
- }
27
-
28
- $order = $observer->getOrder();
29
-
30
- $orderId = $order->getIncrementId();
31
- $amount = $order->getGrandTotal();
32
-
33
- $provider = $helper->getProvider();
34
- $providerModel = Mage::getModel('easyweb_smsnotify/provider_' . $provider);
35
- if ($providerModel) {
36
- $providerModel->sendOrderSms($orderId, $amount);
37
- }
38
-
39
- return $this;
40
- }
41
- }
1
+ <?php
2
+
3
+ /**
4
+ * EasyWeb SmsNotify
5
+ *
6
+ *
7
+ * @category Easyweb
8
+ * @package Easyweb_Smsnotify
9
+ * @copyright Copyright (c) 2014 EasyWeb. (http://easyweb.org.ua)
10
+ */
11
+ class Easyweb_Smsnotify_Model_Observer
12
+ {
13
+ /**
14
+ * Handler for sales_order_place_after
15
+ *
16
+ * @param Varien_Event_Observer $observer
17
+ * @return boolean
18
+ */
19
+ public function sendNotifyToAdminAfterPlaceOrder($observer)
20
+ {
21
+ $helper = Mage::helper('easyweb_smsnotify');
22
+ $order = $observer->getOrder();
23
+
24
+ $orderId = $order->getIncrementId();
25
+ $amount = $order->getGrandTotal();
26
+
27
+ $providerModel = $helper->getProviderModel();
28
+ if ($providerModel) {
29
+ $providerModel->sendOrderSms($orderId, $amount);
30
+ }
31
+
32
+ return $this;
33
+ }
34
+ }
 
 
 
 
 
 
 
app/code/local/Easyweb/Smsnotify/Model/Provider/Abstract.php CHANGED
@@ -1,112 +1,114 @@
1
- <?php
2
- /**
3
- * EasyWeb SmsNotify
4
- *
5
- *
6
- * @category Easyweb
7
- * @package Easyweb_Smsnotify
8
- * @copyright Copyright (c) 2014 EasyWeb. (http://easyweb.org.ua)
9
- */
10
-
11
- abstract class Easyweb_Smsnotify_Model_Provider_Abstract extends Mage_Core_Model_Abstract
12
- {
13
- /**
14
- * Prefix of provider
15
- * @var string
16
- */
17
- protected $_prefix;
18
-
19
- /**
20
- * Login for webservice
21
- * @var string
22
- */
23
- protected $_login;
24
-
25
- /**
26
- * Password for webservice
27
- * @var string
28
- */
29
- protected $_password;
30
-
31
- /**
32
- * @var SoapClient
33
- */
34
- protected $_client = null;
35
-
36
- protected $_messages = array('Easyweb SMS Notify');
37
-
38
- abstract public function sendOrderSms($orderId, $amount);
39
-
40
- /**
41
- * Get field with provider prefix
42
- *
43
- * @param string $field
44
- * @return string|null
45
- */
46
- public function getConfigField($field)
47
- {
48
- $value = Mage::getStoreConfig('easywebsmsnotify/general/' . $this->_prefix . '_' . $field);
49
- return $value ? $value : null;
50
- }
51
-
52
- /**
53
- * Get text for sms
54
- *
55
- * @param string $orderId
56
- * @param float $amount
57
- * @return string
58
- */
59
- public function getTextMessage($orderId, $amount)
60
- {
61
- $text = Mage::helper('easyweb_smsnotify')->getTextMessage();
62
- $text = iconv('windows-1251', 'utf-8', $text);
63
- return str_replace(
64
- array('%ORDER_ID%', '%AMOUNT%'),
65
- array($orderId, $amount),
66
- $text
67
- );
68
- }
69
-
70
- /**
71
- * Get destination number for sms
72
- *
73
- * @return string
74
- */
75
- public function getStorePhone()
76
- {
77
- return Mage::helper('easyweb_smsnotify')->getStorePhone();
78
- }
79
-
80
- /**
81
- * Log error messages
82
- *
83
- * @return $this
84
- */
85
- protected function _logMessages()
86
- {
87
- Mage::log(implode("\n", $this->_messages));
88
- return $this;
89
- }
90
-
91
- /**
92
- * Add error message
93
- *
94
- * @param $message
95
- * @return $this
96
- */
97
- protected function _addErrorMessage($message)
98
- {
99
- $this->_messages[] = $message;
100
- return $this;
101
- }
102
-
103
- /**
104
- * Get sender
105
- *
106
- * @return null|string
107
- */
108
- public function getSender()
109
- {
110
- return $this->getConfigField('sender');
111
- }
112
- }
 
 
1
+ <?php
2
+ /**
3
+ * EasyWeb SmsNotify
4
+ *
5
+ *
6
+ * @category Easyweb
7
+ * @package Easyweb_Smsnotify
8
+ * @copyright Copyright (c) 2014 EasyWeb. (http://easyweb.org.ua)
9
+ */
10
+
11
+ abstract class Easyweb_Smsnotify_Model_Provider_Abstract extends Mage_Core_Model_Abstract
12
+ {
13
+ /**
14
+ * Prefix of provider
15
+ * @var string
16
+ */
17
+ protected $_prefix;
18
+
19
+ /**
20
+ * Login for webservice
21
+ * @var string
22
+ */
23
+ protected $_login;
24
+
25
+ /**
26
+ * Password for webservice
27
+ * @var string
28
+ */
29
+ protected $_password;
30
+
31
+ /**
32
+ * @var SoapClient
33
+ */
34
+ protected $_client = null;
35
+
36
+ protected $_messages = array('Easyweb SMS Notify');
37
+
38
+ abstract public function sendOrderSms($orderId, $amount);
39
+
40
+ abstract public function checkBalance();
41
+
42
+ /**
43
+ * Get field with provider prefix
44
+ *
45
+ * @param string $field
46
+ * @return string|null
47
+ */
48
+ public function getConfigField($field)
49
+ {
50
+ $value = Mage::getStoreConfig('easywebsmsnotify/general/' . $this->_prefix . '_' . $field);
51
+ return $value ? $value : null;
52
+ }
53
+
54
+ /**
55
+ * Get text for sms
56
+ *
57
+ * @param string $orderId
58
+ * @param float $amount
59
+ * @return string
60
+ */
61
+ public function getTextMessage($orderId, $amount)
62
+ {
63
+ $text = Mage::helper('easyweb_smsnotify')->getTextMessage();
64
+ $text = iconv('windows-1251', 'utf-8', $text);
65
+ return str_replace(
66
+ array('%ORDER_ID%', '%AMOUNT%'),
67
+ array($orderId, $amount),
68
+ $text
69
+ );
70
+ }
71
+
72
+ /**
73
+ * Get destination number for sms
74
+ *
75
+ * @return string
76
+ */
77
+ public function getStorePhone()
78
+ {
79
+ return Mage::helper('easyweb_smsnotify')->getStorePhone();
80
+ }
81
+
82
+ /**
83
+ * Log error messages
84
+ *
85
+ * @return $this
86
+ */
87
+ protected function _logMessages()
88
+ {
89
+ Mage::log(implode("\n", $this->_messages),null,'sms.log');
90
+ return $this;
91
+ }
92
+
93
+ /**
94
+ * Add error message
95
+ *
96
+ * @param $message
97
+ * @return $this
98
+ */
99
+ protected function _addErrorMessage($message)
100
+ {
101
+ $this->_messages[] = $message;
102
+ return $this;
103
+ }
104
+
105
+ /**
106
+ * Get sender
107
+ *
108
+ * @return null|string
109
+ */
110
+ public function getSender()
111
+ {
112
+ return $this->getConfigField('sender');
113
+ }
114
+ }
app/code/local/Easyweb/Smsnotify/Model/Provider/Esputnik.php CHANGED
@@ -1,61 +1,101 @@
1
- <?php
2
- /**
3
- * EasyWeb SmsNotify
4
- *
5
- *
6
- * @category Easyweb
7
- * @package Easyweb_Smsnotify
8
- * @copyright Copyright (c) 2014 EasyWeb. (http://easyweb.org.ua)
9
- */
10
-
11
- class Easyweb_Smsnotify_Model_Provider_Esputnik extends Easyweb_Smsnotify_Model_Provider_Abstract
12
- {
13
- /**
14
- * Prefix of provider
15
- * @var string
16
- */
17
- protected $_prefix = 'esputnik';
18
-
19
- /**
20
- * Api url
21
- * @var string
22
- */
23
- protected $_url = 'https://esputnik.com.ua/api/v1/message/sms';
24
-
25
-
26
- /**
27
- * Send sms when order is placed
28
- *
29
- * @param string $orderId
30
- * @param float $amount
31
- * @return array
32
- */
33
- public function sendOrderSms($orderId, $amount)
34
- {
35
- $login = $this->getConfigField('login');
36
- $password = $this->getConfigField('password');
37
-
38
- $json_value = new stdClass();
39
- $json_value->text = $this->getTextMessage($orderId, $amount);
40
- $json_value->from = $this->getSender();
41
- $json_value->phoneNumbers = array($this->getStorePhone());
42
-
43
- $ch = curl_init();
44
- curl_setopt($ch, CURLOPT_POST, 1);
45
- curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($json_value));
46
- curl_setopt($ch, CURLOPT_HEADER, 1);
47
- curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json', 'Content-Type: application/json;charset=utf-8'));
48
- curl_setopt($ch, CURLOPT_URL, $this->_url);
49
- curl_setopt($ch, CURLOPT_USERPWD, $login . ':' . $password);
50
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
51
-
52
- $output = curl_exec($ch);
53
- curl_close($ch);
54
-
55
- if ($output === FALSE) {
56
- $this->_addErrorMessage($ch);
57
- }
58
-
59
- return;
60
- }
61
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * EasyWeb SmsNotify
5
+ *
6
+ *
7
+ * @category Easyweb
8
+ * @package Easyweb_Smsnotify
9
+ * @copyright Copyright (c) 2014 EasyWeb. (http://easyweb.org.ua)
10
+ */
11
+ class Easyweb_Smsnotify_Model_Provider_Esputnik extends Easyweb_Smsnotify_Model_Provider_Abstract
12
+ {
13
+ /**
14
+ * Prefix of provider
15
+ * @var string
16
+ */
17
+ protected $_prefix = 'esputnik';
18
+
19
+ /**
20
+ * Api url
21
+ * @var string
22
+ */
23
+ protected $_urlSendSms = 'http://esputnik.com.ua/api/v1/message/sms';
24
+ protected $_urlBalance = 'http://esputnik.com.ua/api/v1/balance';
25
+
26
+ /**
27
+ * @return resource
28
+ */
29
+ protected function _getAuthCurlObject()
30
+ {
31
+ $login = $this->getConfigField('login');
32
+ $password = $this->getConfigField('password');
33
+
34
+ $ch = curl_init();
35
+ curl_setopt($ch, CURLOPT_HEADER, 0);
36
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json', 'Content-Type: application/json'));
37
+ curl_setopt($ch, CURLOPT_USERPWD, $login . ':' . $password);
38
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
39
+
40
+ return $ch;
41
+ }
42
+
43
+ /**
44
+ * @param $ch
45
+ * @return mixed
46
+ */
47
+ protected function _getResponse($ch)
48
+ {
49
+ $output = curl_exec($ch);
50
+ if ($output === FALSE) {
51
+ $this->_addErrorMessage($ch);
52
+ } else {
53
+ return $output;
54
+ }
55
+ curl_close($ch);
56
+
57
+ return false;
58
+ }
59
+
60
+ /**
61
+ * Send sms when order is placed
62
+ *
63
+ * @param string $orderId
64
+ * @param float $amount
65
+ * @return array
66
+ */
67
+ public function sendOrderSms($orderId, $amount)
68
+ {
69
+ $json_value = new stdClass();
70
+ $json_value->text = $this->getTextMessage($orderId, $amount);
71
+ $json_value->from = $this->getSender();
72
+ $json_value->phoneNumbers = array($this->getStorePhone());
73
+
74
+ $ch = $this->_getAuthCurlObject();
75
+ curl_setopt($ch, CURLOPT_POST, 1);
76
+ curl_setopt($ch, CURLOPT_HEADER, 1);
77
+ curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($json_value));
78
+ curl_setopt($ch, CURLOPT_URL, $this->_urlSendSms);
79
+ return $this->_getResponse($ch);
80
+ }
81
+
82
+ /**
83
+ * @return mixed
84
+ */
85
+ public function checkBalance()
86
+ {
87
+ $ch = $this->_getAuthCurlObject();
88
+ curl_setopt($ch, CURLOPT_URL, $this->_urlBalance);
89
+ $response = $this->_getResponse($ch);
90
+
91
+ $response = json_decode($response);
92
+
93
+ $output = $response->currentBalance . ' ' . $response->currency;
94
+ if ($response->bonusSmses) {
95
+ $output .= '<br />(Bonus SMS: ' . $response->bonusSmses . ')';
96
+ }
97
+
98
+
99
+ return $output;
100
+ }
101
+ }
app/code/local/Easyweb/Smsnotify/Model/Provider/Turbosms.php CHANGED
@@ -1,80 +1,86 @@
1
- <?php
2
- /**
3
- * EasyWeb SmsNotify
4
- *
5
- *
6
- * @category Easyweb
7
- * @package Easyweb_Smsnotify
8
- * @copyright Copyright (c) 2014 EasyWeb. (http://easyweb.org.ua)
9
- */
10
-
11
- class Easyweb_Smsnotify_Model_Provider_Turbosms extends Easyweb_Smsnotify_Model_Provider_Abstract
12
- {
13
- /**
14
- * Prefix of provider
15
- * @var string
16
- */
17
- protected $_prefix = 'turbosms';
18
-
19
- /**
20
- * Api url
21
- * @var string
22
- */
23
- protected $_url = 'http://turbosms.in.ua/api/wsdl.html';
24
-
25
- /**
26
- * Create client
27
- *
28
- * @return SoapClient
29
- */
30
- protected function _getClient()
31
- {
32
- if (is_null($this->_client)) {
33
- $this->_client = new SoapClient ($this->_url);
34
- }
35
- return $this->_client;
36
- }
37
-
38
- /**
39
- * Auth client on provider side
40
- *
41
- * @return SoapClient
42
- */
43
- protected function _getAuthClient()
44
- {
45
- $login = $this->getConfigField('login');
46
- $password = $this->getConfigField('password');
47
-
48
- $auth = array(
49
- 'login' => $login,
50
- 'password' => $password
51
- );
52
-
53
- $auth = $this->_getClient()->Auth($auth);
54
- $this->_addErrorMessage($auth->AuthResult);
55
-
56
- return $this->_getClient();
57
- }
58
-
59
- /**
60
- * Send sms when order is placed
61
- *
62
- * @param string $orderId
63
- * @param float $amount
64
- * @return array
65
- */
66
- public function sendOrderSms($orderId, $amount)
67
- {
68
- $sms = array(
69
- 'sender' => $this->getSender(),
70
- 'destination' => $this->getStorePhone(),
71
- 'text' => $this->getTextMessage($orderId, $amount),
72
- );
73
- $result = $this->_getAuthClient()->sendSMS($sms);
74
- if (!is_array($result->SendSMSResult->ResultArray)) {
75
- $message = $result->SendSMSResult->ResultArray;
76
- $this->_addErrorMessage($message)->_logMessages();
77
- }
78
- return;
79
- }
80
- }
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * EasyWeb SmsNotify
4
+ *
5
+ *
6
+ * @category Easyweb
7
+ * @package Easyweb_Smsnotify
8
+ * @copyright Copyright (c) 2014 EasyWeb. (http://easyweb.org.ua)
9
+ */
10
+
11
+ class Easyweb_Smsnotify_Model_Provider_Turbosms extends Easyweb_Smsnotify_Model_Provider_Abstract
12
+ {
13
+ /**
14
+ * Prefix of provider
15
+ * @var string
16
+ */
17
+ protected $_prefix = 'turbosms';
18
+
19
+ /**
20
+ * Api url
21
+ * @var string
22
+ */
23
+ protected $_url = 'http://turbosms.in.ua/api/wsdl.html';
24
+
25
+ /**
26
+ * Create client
27
+ *
28
+ * @return SoapClient
29
+ */
30
+ protected function _getClient()
31
+ {
32
+ if (is_null($this->_client)) {
33
+ $this->_client = new SoapClient ($this->_url);
34
+ }
35
+ return $this->_client;
36
+ }
37
+
38
+ /**
39
+ * Auth client on provider side
40
+ *
41
+ * @return SoapClient
42
+ */
43
+ protected function _getAuthClient()
44
+ {
45
+ $login = $this->getConfigField('login');
46
+ $password = $this->getConfigField('password');
47
+
48
+ $auth = array(
49
+ 'login' => $login,
50
+ 'password' => $password
51
+ );
52
+
53
+ $auth = $this->_getClient()->Auth($auth);
54
+ $this->_addErrorMessage($auth->AuthResult);
55
+
56
+ return $this->_getClient();
57
+ }
58
+
59
+ /**
60
+ * Send sms when order is placed
61
+ *
62
+ * @param string $orderId
63
+ * @param float $amount
64
+ * @return array
65
+ */
66
+ public function sendOrderSms($orderId, $amount)
67
+ {
68
+ $sms = array(
69
+ 'sender' => $this->getSender(),
70
+ 'destination' => $this->getStorePhone(),
71
+ 'text' => $this->getTextMessage($orderId, $amount),
72
+ );
73
+ $result = $this->_getAuthClient()->sendSMS($sms);
74
+ if (!is_array($result->SendSMSResult->ResultArray)) {
75
+ $message = $result->SendSMSResult->ResultArray;
76
+ $this->_addErrorMessage($message)->_logMessages();
77
+ }
78
+ return;
79
+ }
80
+
81
+ public function checkBalance()
82
+ {
83
+ $result = $this->_getAuthClient()->GetCreditBalance();
84
+ return $result->GetCreditBalanceResult;
85
+ }
86
+ }
app/code/local/Easyweb/Smsnotify/Model/Source/Provider.php CHANGED
@@ -1,58 +1,58 @@
1
- <?php
2
- /**
3
- * EasyWeb SmsNotify
4
- *
5
- *
6
- * @category Easyweb
7
- * @package Easyweb_Core
8
- * @copyright Copyright (c) 2014 EasyWeb. (http://easyweb.org.ua)
9
- */
10
-
11
- class Easyweb_Smsnotify_Model_Source_Provider extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
12
- {
13
- /**
14
- * Retrieve all options array
15
- *
16
- * @return array
17
- */
18
- public function getAllOptions()
19
- {
20
- if (is_null($this->_options)) {
21
- $this->_options = array(
22
- array(
23
- 'label' => Mage::helper('easyweb_smsnotify')->__('Please select'),
24
- 'value' => ''
25
- ),
26
- array(
27
- 'label' => Mage::helper('easyweb_smsnotify')->__('Turbosms'),
28
- 'value' => 'turbosms'
29
- ),
30
- array(
31
- 'label' => Mage::helper('easyweb_smsnotify')->__('eSputnik'),
32
- 'value' => 'esputnik'
33
- ),
34
-
35
- );
36
- }
37
- return $this->_options;
38
- }
39
-
40
- /**
41
- * Get all options as key=>value array
42
- * @return array
43
- */
44
- public function getOptionsForFilter()
45
- {
46
- $options = $this->getAllOptions();
47
- $result = array();
48
- foreach ($options as $option) {
49
- $result[$option['value']] = $option['label'];
50
- }
51
- return $result;
52
- }
53
-
54
- public function toOptionArray()
55
- {
56
- return $this->getOptionsForFilter();
57
- }
58
- }
1
+ <?php
2
+ /**
3
+ * EasyWeb SmsNotify
4
+ *
5
+ *
6
+ * @category Easyweb
7
+ * @package Easyweb_Core
8
+ * @copyright Copyright (c) 2014 EasyWeb. (http://easyweb.org.ua)
9
+ */
10
+
11
+ class Easyweb_Smsnotify_Model_Source_Provider extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
12
+ {
13
+ /**
14
+ * Retrieve all options array
15
+ *
16
+ * @return array
17
+ */
18
+ public function getAllOptions()
19
+ {
20
+ if (is_null($this->_options)) {
21
+ $this->_options = array(
22
+ array(
23
+ 'label' => Mage::helper('easyweb_smsnotify')->__('Please select'),
24
+ 'value' => ''
25
+ ),
26
+ array(
27
+ 'label' => Mage::helper('easyweb_smsnotify')->__('Turbosms'),
28
+ 'value' => 'turbosms'
29
+ ),
30
+ array(
31
+ 'label' => Mage::helper('easyweb_smsnotify')->__('eSputnik'),
32
+ 'value' => 'esputnik'
33
+ ),
34
+
35
+ );
36
+ }
37
+ return $this->_options;
38
+ }
39
+
40
+ /**
41
+ * Get all options as key=>value array
42
+ * @return array
43
+ */
44
+ public function getOptionsForFilter()
45
+ {
46
+ $options = $this->getAllOptions();
47
+ $result = array();
48
+ foreach ($options as $option) {
49
+ $result[$option['value']] = $option['label'];
50
+ }
51
+ return $result;
52
+ }
53
+
54
+ public function toOptionArray()
55
+ {
56
+ return $this->getOptionsForFilter();
57
+ }
58
+ }
app/code/local/Easyweb/Smsnotify/controllers/Adminhtml/Config/BalanceController.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * EasyWeb SmsNotify
5
+ *
6
+ *
7
+ * @category Easyweb
8
+ * @package Easyweb_Smsnotify
9
+ * @copyright Copyright (c) 2014 EasyWeb. (http://easyweb.org.ua)
10
+ */
11
+ class Easyweb_Smsnotify_Adminhtml_Config_BalanceController extends Mage_Adminhtml_Controller_Action
12
+ {
13
+ protected function _checkBalance()
14
+ {
15
+ $helper = Mage::helper('easyweb_smsnotify');
16
+
17
+ $providerModel = $helper->getProviderModel();
18
+ if ($providerModel) {
19
+ return $providerModel->checkBalance();
20
+ }
21
+ return 0;
22
+ }
23
+
24
+ /**
25
+ * Check whether vat is valid
26
+ *
27
+ * @return void
28
+ */
29
+ public function checkAction()
30
+ {
31
+ $result = $this->_checkBalance();
32
+ $this->getResponse()->setBody($result);
33
+ }
34
+ }
app/code/local/Easyweb/Smsnotify/etc/adminhtml.xml CHANGED
@@ -1,33 +1,33 @@
1
- <?xml version="1.0"?>
2
- <!--
3
- /**
4
- * EasyWeb SMS Notify
5
- *
6
- *
7
- * @category Easyweb
8
- * @package Easyweb_Smsnotify
9
- * @copyright Copyright (c) 2014 EasyWeb. (http://easyweb.org.ua)
10
- */
11
- -->
12
- <config>
13
- <acl>
14
- <resources>
15
- <admin>
16
- <children>
17
- <system>
18
- <children>
19
- <config>
20
- <children>
21
- <easywebsmsnotify module="easyweb_smsnotify" translate="label">
22
- <title>Sms Notify</title>
23
- <sort_order>50</sort_order>
24
- </easywebsmsnotify>
25
- </children>
26
- </config>
27
- </children>
28
- </system>
29
- </children>
30
- </admin>
31
- </resources>
32
- </acl>
33
- </config>
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * EasyWeb SMS Notify
5
+ *
6
+ *
7
+ * @category Easyweb
8
+ * @package Easyweb_Smsnotify
9
+ * @copyright Copyright (c) 2014 EasyWeb. (http://easyweb.org.ua)
10
+ */
11
+ -->
12
+ <config>
13
+ <acl>
14
+ <resources>
15
+ <admin>
16
+ <children>
17
+ <system>
18
+ <children>
19
+ <config>
20
+ <children>
21
+ <easywebsmsnotify module="easyweb_smsnotify" translate="label">
22
+ <title>Sms Notify</title>
23
+ <sort_order>50</sort_order>
24
+ </easywebsmsnotify>
25
+ </children>
26
+ </config>
27
+ </children>
28
+ </system>
29
+ </children>
30
+ </admin>
31
+ </resources>
32
+ </acl>
33
+ </config>
app/code/local/Easyweb/Smsnotify/etc/config.xml CHANGED
@@ -1,62 +1,78 @@
1
- <?xml version="1.0"?>
2
- <!--
3
- /**
4
- * EasyWeb SMS Notify
5
- *
6
- *
7
- * @category Easyweb
8
- * @package Easyweb_Smsnotify
9
- * @copyright Copyright (c) 2014 EasyWeb. (http://easyweb.org.ua)
10
- */
11
- -->
12
- <config>
13
- <modules>
14
- <Easyweb_Smsnotify>
15
- <version>1.0.1</version>
16
- </Easyweb_Smsnotify>
17
- </modules>
18
- <global>
19
- <models>
20
- <easyweb_smsnotify>
21
- <class>Easyweb_Smsnotify_Model</class>
22
- </easyweb_smsnotify>
23
- </models>
24
- <helpers>
25
- <easyweb_smsnotify>
26
- <class>Easyweb_Smsnotify_Helper</class>
27
- </easyweb_smsnotify>
28
- </helpers>
29
- </global>
30
- <default>
31
- <easywebsmsnotify>
32
- <general>
33
- <enabled>0</enabled>
34
- <text>New order is placed in your shop. # %ORDER_ID%, amount %AMOUNT% $</text>
35
- <esputnik_sender>Test</esputnik_sender>
36
- </general>
37
- </easywebsmsnotify>
38
- </default>
39
- <frontend>
40
- <events>
41
- <sales_order_place_after>
42
- <observers>
43
- <easyweb_smsnotify>
44
- <class>easyweb_smsnotify/observer</class>
45
- <method>sendNotifyToAdminAfterPlaceOrder</method>
46
- </easyweb_smsnotify>
47
- </observers>
48
- </sales_order_place_after>
49
- </events>
50
- </frontend>
51
- <adminhtml>
52
- <translate>
53
- <modules>
54
- <Easyweb_Smsnotify>
55
- <files>
56
- <default>Easyweb_Smsnotify.csv</default>
57
- </files>
58
- </Easyweb_Smsnotify>
59
- </modules>
60
- </translate>
61
- </adminhtml>
62
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * EasyWeb SMS Notify
5
+ *
6
+ *
7
+ * @category Easyweb
8
+ * @package Easyweb_Smsnotify
9
+ * @copyright Copyright (c) 2014 EasyWeb. (http://easyweb.org.ua)
10
+ */
11
+ -->
12
+ <config>
13
+ <modules>
14
+ <Easyweb_Smsnotify>
15
+ <version>1.0.3</version>
16
+ </Easyweb_Smsnotify>
17
+ </modules>
18
+ <global>
19
+ <blocks>
20
+ <easyweb_smsnotify>
21
+ <class>Easyweb_Smsnotify_Block</class>
22
+ </easyweb_smsnotify>
23
+ </blocks>
24
+ <models>
25
+ <easyweb_smsnotify>
26
+ <class>Easyweb_Smsnotify_Model</class>
27
+ </easyweb_smsnotify>
28
+ </models>
29
+ <helpers>
30
+ <easyweb_smsnotify>
31
+ <class>Easyweb_Smsnotify_Helper</class>
32
+ </easyweb_smsnotify>
33
+ </helpers>
34
+ </global>
35
+ <default>
36
+ <easywebsmsnotify>
37
+ <general>
38
+ <enabled>0</enabled>
39
+ <text>New order is placed in your shop. # %ORDER_ID%, amount %AMOUNT% $</text>
40
+ <esputnik_sender>Test</esputnik_sender>
41
+ </general>
42
+ </easywebsmsnotify>
43
+ </default>
44
+ <frontend>
45
+ <events>
46
+ <sales_order_place_after>
47
+ <observers>
48
+ <easyweb_smsnotify>
49
+ <class>easyweb_smsnotify/observer</class>
50
+ <method>sendNotifyToAdminAfterPlaceOrder</method>
51
+ </easyweb_smsnotify>
52
+ </observers>
53
+ </sales_order_place_after>
54
+ </events>
55
+ </frontend>
56
+ <adminhtml>
57
+ <translate>
58
+ <modules>
59
+ <Easyweb_Smsnotify>
60
+ <files>
61
+ <default>Easyweb_Smsnotify.csv</default>
62
+ </files>
63
+ </Easyweb_Smsnotify>
64
+ </modules>
65
+ </translate>
66
+ </adminhtml>
67
+ <admin>
68
+ <routers>
69
+ <adminhtml>
70
+ <args>
71
+ <modules>
72
+ <easyweb_smsnotify before="Mage_Adminhtml">Easyweb_Smsnotify_Adminhtml</easyweb_smsnotify>
73
+ </modules>
74
+ </args>
75
+ </adminhtml>
76
+ </routers>
77
+ </admin>
78
+ </config>
app/code/local/Easyweb/Smsnotify/etc/system.xml CHANGED
@@ -1,132 +1,144 @@
1
- <?xml version="1.0"?>
2
- <!--
3
- /**
4
- * EasyWeb SMS Notify
5
- *
6
- *
7
- * @category Easyweb
8
- * @package Easyweb_Smsnotify
9
- * @copyright Copyright (c) 2014 EasyWeb. (http://easyweb.org.ua)
10
- */
11
- -->
12
- <config>
13
- <tabs>
14
- <easyweb>
15
- <label>EasyWeb</label>
16
- <sort_order>1</sort_order>
17
- </easyweb>
18
- </tabs>
19
- <sections>
20
- <easywebsmsnotify translate="label">
21
- <label>SMS Notify</label>
22
- <tab>easyweb</tab>
23
- <sort_order>10</sort_order>
24
- <show_in_default>1</show_in_default>
25
- <groups>
26
- <general translate="label">
27
- <label>General</label>
28
- <frontend_type>text</frontend_type>
29
- <sort_order>1</sort_order>
30
- <show_in_default>1</show_in_default>
31
- <fields>
32
- <enabled>
33
- <label>Enable SMS Notify</label>
34
- <frontend_type>select</frontend_type>
35
- <source_model>adminhtml/system_config_source_yesno</source_model>
36
- <sort_order>1</sort_order>
37
- <show_in_default>1</show_in_default>
38
- </enabled>
39
- <provider>
40
- <label>Select SMS Provider</label>
41
- <frontend_type>select</frontend_type>
42
- <sort_order>10</sort_order>
43
- <source_model>easyweb_smsnotify/source_provider</source_model>
44
- <show_in_default>1</show_in_default>
45
- <depends>
46
- <enabled>1</enabled>
47
- </depends>
48
- </provider>
49
- <store_phone>
50
- <label>Store Phone Number</label>
51
- <frontend_type>text</frontend_type>
52
- <sort_order>11</sort_order>
53
- <show_in_default>1</show_in_default>
54
- <depends>
55
- <enabled>1</enabled>
56
- </depends>
57
- </store_phone>
58
- <text>
59
- <label>Message Text</label>
60
- <frontend_type>textarea</frontend_type>
61
- <sort_order>12</sort_order>
62
- <show_in_default>1</show_in_default>
63
- <comment>You can use %ORDER_ID%, %AMOUNT</comment>
64
- <depends>
65
- <enabled>1</enabled>
66
- </depends>
67
- </text>
68
- <!-- Turbosms settings -->
69
- <turbosms_sender>
70
- <label>Sender</label>
71
- <frontend_type>text</frontend_type>
72
- <sort_order>13</sort_order>
73
- <show_in_default>1</show_in_default>
74
- <depends>
75
- <provider>turbosms</provider>
76
- </depends>
77
- </turbosms_sender>
78
- <turbosms_login>
79
- <label>Login</label>
80
- <frontend_type>text</frontend_type>
81
- <sort_order>20</sort_order>
82
- <show_in_default>1</show_in_default>
83
- <comment>Login for gateway, not for account</comment>
84
- <depends>
85
- <provider>turbosms</provider>
86
- </depends>
87
- </turbosms_login>
88
- <turbosms_password>
89
- <label>Password</label>
90
- <frontend_type>password</frontend_type>
91
- <sort_order>30</sort_order>
92
- <show_in_default>1</show_in_default>
93
- <comment>Password for gateway, not for account</comment>
94
- <depends>
95
- <provider>turbosms</provider>
96
- </depends>
97
- </turbosms_password>
98
- <!-- eSputnik settings -->
99
- <esputnik_sender>
100
- <label>Sender</label>
101
- <frontend_type>text</frontend_type>
102
- <sort_order>13</sort_order>
103
- <show_in_default>1</show_in_default>
104
- <comment>Test by default. You can add new name on esputnik.com.ua</comment>
105
- <depends>
106
- <provider>esputnik</provider>
107
- </depends>
108
- </esputnik_sender>
109
- <esputnik_login>
110
- <label>Login</label>
111
- <frontend_type>text</frontend_type>
112
- <sort_order>20</sort_order>
113
- <show_in_default>1</show_in_default>
114
- <depends>
115
- <provider>esputnik</provider>
116
- </depends>
117
- </esputnik_login>
118
- <esputnik_password>
119
- <label>Password</label>
120
- <frontend_type>password</frontend_type>
121
- <sort_order>30</sort_order>
122
- <show_in_default>1</show_in_default>
123
- <depends>
124
- <provider>esputnik</provider>
125
- </depends>
126
- </esputnik_password>
127
- </fields>
128
- </general>
129
- </groups>
130
- </easywebsmsnotify>
131
- </sections>
132
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * EasyWeb SMS Notify
5
+ *
6
+ *
7
+ * @category Easyweb
8
+ * @package Easyweb_Smsnotify
9
+ * @copyright Copyright (c) 2014 EasyWeb. (http://easyweb.org.ua)
10
+ */
11
+ -->
12
+ <config>
13
+ <tabs>
14
+ <easyweb>
15
+ <label>EasyWeb</label>
16
+ <sort_order>1</sort_order>
17
+ </easyweb>
18
+ </tabs>
19
+ <sections>
20
+ <easywebsmsnotify translate="label">
21
+ <label>SMS Notify</label>
22
+ <tab>easyweb</tab>
23
+ <sort_order>10</sort_order>
24
+ <show_in_default>1</show_in_default>
25
+ <groups>
26
+ <general translate="label">
27
+ <label>General</label>
28
+ <frontend_type>text</frontend_type>
29
+ <sort_order>1</sort_order>
30
+ <show_in_default>1</show_in_default>
31
+ <fields>
32
+ <enabled>
33
+ <label>Enable SMS Notify</label>
34
+ <frontend_type>select</frontend_type>
35
+ <source_model>adminhtml/system_config_source_yesno</source_model>
36
+ <sort_order>1</sort_order>
37
+ <show_in_default>1</show_in_default>
38
+ </enabled>
39
+ <provider>
40
+ <label>Select SMS Provider</label>
41
+ <frontend_type>select</frontend_type>
42
+ <sort_order>10</sort_order>
43
+ <source_model>easyweb_smsnotify/source_provider</source_model>
44
+ <show_in_default>1</show_in_default>
45
+ <depends>
46
+ <enabled>1</enabled>
47
+ </depends>
48
+ </provider>
49
+ <store_phone>
50
+ <label>Store Phone Number</label>
51
+ <frontend_type>text</frontend_type>
52
+ <sort_order>11</sort_order>
53
+ <show_in_default>1</show_in_default>
54
+ <depends>
55
+ <enabled>1</enabled>
56
+ </depends>
57
+ </store_phone>
58
+ <text>
59
+ <label>Message Text</label>
60
+ <frontend_type>textarea</frontend_type>
61
+ <sort_order>12</sort_order>
62
+ <show_in_default>1</show_in_default>
63
+ <comment>You can use %ORDER_ID%, %AMOUNT</comment>
64
+ <depends>
65
+ <enabled>1</enabled>
66
+ </depends>
67
+ </text>
68
+ <!-- Turbosms settings -->
69
+ <turbosms_sender>
70
+ <label>Sender</label>
71
+ <frontend_type>text</frontend_type>
72
+ <sort_order>13</sort_order>
73
+ <show_in_default>1</show_in_default>
74
+ <depends>
75
+ <provider>turbosms</provider>
76
+ </depends>
77
+ </turbosms_sender>
78
+ <turbosms_login>
79
+ <label>Login</label>
80
+ <frontend_type>text</frontend_type>
81
+ <sort_order>20</sort_order>
82
+ <show_in_default>1</show_in_default>
83
+ <comment>Login for gateway, not for account</comment>
84
+ <depends>
85
+ <provider>turbosms</provider>
86
+ </depends>
87
+ </turbosms_login>
88
+ <turbosms_password>
89
+ <label>Password</label>
90
+ <frontend_type>password</frontend_type>
91
+ <sort_order>30</sort_order>
92
+ <show_in_default>1</show_in_default>
93
+ <comment>Password for gateway, not for account</comment>
94
+ <depends>
95
+ <provider>turbosms</provider>
96
+ </depends>
97
+ </turbosms_password>
98
+ <!-- Turbosms settings end -->
99
+ <!-- eSputnik settings -->
100
+ <esputnik_sender>
101
+ <label>Sender</label>
102
+ <frontend_type>text</frontend_type>
103
+ <sort_order>13</sort_order>
104
+ <show_in_default>1</show_in_default>
105
+ <comment>Test by default. You can add new name on esputnik.com.ua</comment>
106
+ <depends>
107
+ <provider>esputnik</provider>
108
+ </depends>
109
+ </esputnik_sender>
110
+ <esputnik_login>
111
+ <label>Login</label>
112
+ <frontend_type>text</frontend_type>
113
+ <sort_order>20</sort_order>
114
+ <show_in_default>1</show_in_default>
115
+ <depends>
116
+ <provider>esputnik</provider>
117
+ </depends>
118
+ </esputnik_login>
119
+ <esputnik_password>
120
+ <label>Password</label>
121
+ <frontend_type>password</frontend_type>
122
+ <sort_order>30</sort_order>
123
+ <show_in_default>1</show_in_default>
124
+ <depends>
125
+ <provider>esputnik</provider>
126
+ </depends>
127
+ </esputnik_password>
128
+ <!-- eSputnik settings end-->
129
+ <check_balance>
130
+ <label>Check balance</label>
131
+ <button_label>Check Balance</button_label>
132
+ <frontend_model>easyweb_smsnotify/adminhtml_system_config_balance</frontend_model>
133
+ <sort_order>40</sort_order>
134
+ <show_in_default>1</show_in_default>
135
+ <depends>
136
+ <enabled>1</enabled>
137
+ </depends>>
138
+ </check_balance>
139
+ </fields>
140
+ </general>
141
+ </groups>
142
+ </easywebsmsnotify>
143
+ </sections>
144
+ </config>
app/design/adminhtml/default/default/template/smsnotify/system/config/balance.phtml ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * EasyWeb SmsNotify
4
+ *
5
+ *
6
+ * @category Easyweb
7
+ * @package Easyweb_Smsnotify
8
+ * @copyright Copyright (c) 2014 EasyWeb. (http://easyweb.org.ua)
9
+ */
10
+ ?>
11
+ <?php
12
+ /**
13
+ * @see Easyweb_Smsnotify_Block_Adminhtml_System_Config_Balance
14
+ */
15
+ ?>
16
+ <script type="text/javascript">
17
+ //<![CDATA[
18
+ function checkBalance() {
19
+ var elem = $('<?php echo $this->getHtmlId() ?>');
20
+ var provider = $('easywebsmsnotify_general_provider').value;
21
+
22
+ params = {
23
+ provider: provider,
24
+ login: $('easywebsmsnotify_general_'+provider+'_login'),
25
+ password: $('easywebsmsnotify_general_'+provider+'_password')
26
+ };
27
+
28
+ new Ajax.Request('<?php echo $this->getAjaxUrl() ?>', {
29
+ parameters: params,
30
+ onSuccess: function(response) {
31
+ button = '<?php echo $this->__('Error!') ?>';
32
+ try {
33
+ response = response.responseText;
34
+ if (response !== '') {
35
+ button = '<?php echo $this->__('Success!') ?>';
36
+ elem.removeClassName('fail').addClassName('success')
37
+ $('check_balance_result').update('<?php echo $this->__('Your balance is:');?>'+' <strong>'+response+'</strong>');
38
+ } else {
39
+ elem.removeClassName('success').addClassName('fail');
40
+ $('check_balance_result').update('');
41
+ }
42
+ } catch (e) {
43
+ elem.removeClassName('success').addClassName('fail')
44
+ $('check_balance_result').update('');
45
+ }
46
+ $('check_balance_result_button').update(button);
47
+ }
48
+ });
49
+ }
50
+ //]]>
51
+ </script>
52
+ <button onclick="javascript:checkBalance(); return false;" class="scalable" type="button" id="<?php echo $this->getHtmlId() ?>">
53
+ <span id="check_balance_result_button"><?php echo $this->escapeHtml($this->getButtonLabel()) ?></span>
54
+ </button>
55
+ <span id="check_balance_result"></span>
app/etc/modules/Easyweb_Smsnotify.xml CHANGED
@@ -1,19 +1,19 @@
1
- <?xml version="1.0"?>
2
- <!--
3
- /**
4
- * EasyWeb
5
- *
6
- *
7
- * @category Easyweb
8
- * @package Easyweb_Smsnotify
9
- * @copyright Copyright (c) 2014 EasyWeb. (http://easyweb.org.ua)
10
- */
11
- -->
12
- <config>
13
- <modules>
14
- <Easyweb_Smsnotify>
15
- <active>true</active>
16
- <codePool>local</codePool>
17
- </Easyweb_Smsnotify>
18
- </modules>
19
- </config>
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * EasyWeb
5
+ *
6
+ *
7
+ * @category Easyweb
8
+ * @package Easyweb_Smsnotify
9
+ * @copyright Copyright (c) 2014 EasyWeb. (http://easyweb.org.ua)
10
+ */
11
+ -->
12
+ <config>
13
+ <modules>
14
+ <Easyweb_Smsnotify>
15
+ <active>true</active>
16
+ <codePool>local</codePool>
17
+ </Easyweb_Smsnotify>
18
+ </modules>
19
+ </config>
app/locale/en_US/Easyweb_Smsnotify.csv CHANGED
@@ -1,14 +1,14 @@
1
- "SMS Notify", "SMS Notify"
2
- "Enable SMS Notify", "Enable SMS Notify"
3
- "Select SMS Provider", "Select SMS Provider"
4
- "Store Phone Number", "Store Phone Number"
5
- "Message Text", "Message Text"
6
- "Login", "Login"
7
- "Login for gateway, not for account", "Login for gateway, not for account"
8
- "Password", "Password"
9
- "Password for gateway, not for account", "Password for gateway, not for account"
10
- "Sender", "Sender"
11
- "You can use %ORDER_ID%, %AMOUNT", "You can use %ORDER_ID%, %AMOUNT"
12
- "New order is placed in your shop. # %ORDER_ID%, amount %AMOUNT% $", "New order is placed in your shop. # %ORDER_ID%, amount %AMOUNT% $"
13
- "General", "General"
14
  "Test by default. You can add new name on esputnik.com.ua", "Test by default. You can add new name on esputnik.com.ua"
1
+ "SMS Notify", "SMS Notify"
2
+ "Enable SMS Notify", "Enable SMS Notify"
3
+ "Select SMS Provider", "Select SMS Provider"
4
+ "Store Phone Number", "Store Phone Number"
5
+ "Message Text", "Message Text"
6
+ "Login", "Login"
7
+ "Login for gateway, not for account", "Login for gateway, not for account"
8
+ "Password", "Password"
9
+ "Password for gateway, not for account", "Password for gateway, not for account"
10
+ "Sender", "Sender"
11
+ "You can use %ORDER_ID%, %AMOUNT", "You can use %ORDER_ID%, %AMOUNT"
12
+ "New order is placed in your shop. # %ORDER_ID%, amount %AMOUNT% $", "New order is placed in your shop. # %ORDER_ID%, amount %AMOUNT% $"
13
+ "General", "General"
14
  "Test by default. You can add new name on esputnik.com.ua", "Test by default. You can add new name on esputnik.com.ua"
app/locale/ru_RU/Easyweb_Smsnotify.csv CHANGED
@@ -1,14 +1,14 @@
1
- "SMS Notify", "SMS уведомления"
2
- "Enable SMS Notify", "Включить SMS уведомления"
3
- "Select SMS Provider", "Выберите SMS провадера"
4
- "Store Phone Number", "Телефон магазина"
5
- "Message Text", "Текст сообщения"
6
- "Login", "Логин"
7
- "Login for gateway, not for account", "Логин для шлюза, а не для аккаунта"
8
- "Password", "Пароль"
9
- "Password for gateway, not for account", "Пароль для шлюза, а не для аккаунта"
10
- "Sender", "Отправитель"
11
- "You can use %ORDER_ID%, %AMOUNT", "Вы можете использовать %ORDER_ID%, %AMOUNT%"
12
- "New order is placed in your shop. # %ORDER_ID%, amount %AMOUNT% $", "Новый заказ был оформлен в вашем магазине. № %ORDER_ID%, сумма %AMOUNT% $"
13
- "General", "Основные"
14
  "Test by default. You can add new name on esputnik.com.ua", "Test по умолчанию. Вы можете добавить новое имя на сайте esputnik.com.ua"
1
+ "SMS Notify", "SMS уведомления"
2
+ "Enable SMS Notify", "Включить SMS уведомления"
3
+ "Select SMS Provider", "Выберите SMS провадера"
4
+ "Store Phone Number", "Телефон магазина"
5
+ "Message Text", "Текст сообщения"
6
+ "Login", "Логин"
7
+ "Login for gateway, not for account", "Логин для шлюза, а не для аккаунта"
8
+ "Password", "Пароль"
9
+ "Password for gateway, not for account", "Пароль для шлюза, а не для аккаунта"
10
+ "Sender", "Отправитель"
11
+ "You can use %ORDER_ID%, %AMOUNT", "Вы можете использовать %ORDER_ID%, %AMOUNT%"
12
+ "New order is placed in your shop. # %ORDER_ID%, amount %AMOUNT% $", "Новый заказ был оформлен в вашем магазине. № %ORDER_ID%, сумма %AMOUNT% $"
13
+ "General", "Основные"
14
  "Test by default. You can add new name on esputnik.com.ua", "Test по умолчанию. Вы можете добавить новое имя на сайте esputnik.com.ua"
app/locale/uk_UA/Easyweb_Smsnotify.csv CHANGED
@@ -1,14 +1,14 @@
1
- "SMS Notify", "SMS сповіщення"
2
- "Enable SMS Notify", "Включити SMS сповіщення"
3
- "Select SMS Provider", "Вибиріть SMS провадера"
4
- "Store Phone Number", "Телефон магазина"
5
- "Message Text", "Текст повідомлення"
6
- "Login", "Логін"
7
- "Login for gateway, not for account", "Логін для шлюзу, а не для аккаунта"
8
- "Password", "Пароль"
9
- "Password for gateway, not for account", "Пароль для шлюзу, а не для аккаунта"
10
- "Sender", "Отправитель"
11
- "You can use %ORDER_ID%, %AMOUNT", "Ви можете використовувати %ORDER_ID%, %AMOUNT%"
12
- "New order is placed in your shop. # %ORDER_ID%, amount %AMOUNT% $", "Новий заказ був у вашому магазині. № %ORDER_ID%, сума %AMOUNT% $"
13
- "General", "Загальні"
14
  "Test by default. You can add new name on esputnik.com.ua", "Test за замовчуванням. Ви можете додати нове iм'я на сайтi esputnik.com.ua"
1
+ "SMS Notify", "SMS сповіщення"
2
+ "Enable SMS Notify", "Включити SMS сповіщення"
3
+ "Select SMS Provider", "Вибиріть SMS провадера"
4
+ "Store Phone Number", "Телефон магазина"
5
+ "Message Text", "Текст повідомлення"
6
+ "Login", "Логін"
7
+ "Login for gateway, not for account", "Логін для шлюзу, а не для аккаунта"
8
+ "Password", "Пароль"
9
+ "Password for gateway, not for account", "Пароль для шлюзу, а не для аккаунта"
10
+ "Sender", "Отправитель"
11
+ "You can use %ORDER_ID%, %AMOUNT", "Ви можете використовувати %ORDER_ID%, %AMOUNT%"
12
+ "New order is placed in your shop. # %ORDER_ID%, amount %AMOUNT% $", "Новий заказ був у вашому магазині. № %ORDER_ID%, сума %AMOUNT% $"
13
+ "General", "Загальні"
14
  "Test by default. You can add new name on esputnik.com.ua", "Test за замовчуванням. Ви можете додати нове iм'я на сайтi esputnik.com.ua"
package.xml CHANGED
@@ -1,9 +1,9 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Easyweb_Smsnotify</name>
4
- <version>1.0.1</version>
5
  <stability>stable</stability>
6
- <license uri="http://opensource.org/licenses/GPL-3.0">GNU General Public License (GPL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>SMS Notifications about new orders.&#xD;
@@ -15,6 +15,7 @@ SMS notification module integrated with the Ukrainian SMS providers&lt;/p&gt;&#x
15
  List of features:&#xD;
16
  &lt;ul&gt;&#xD;
17
  &lt;li&gt;Notifications of new order&lt;/li&gt;&#xD;
 
18
  &lt;li&gt;Ukrainian SMS Providers&lt;/li&gt;&#xD;
19
  &lt;/ul&gt;&#xD;
20
  Supporting providers:&#xD;
@@ -33,6 +34,7 @@ Supporting providers:&#xD;
33
  &lt;ul&gt;&#xD;
34
  &lt;li&gt;&#x423;&#x432;&#x435;&#x434;&#x43E;&#x43C;&#x43B;&#x435;&#x43D;&#x438;&#x435; &#x43E; &#x43D;&#x43E;&#x432;&#x43E;&#x43C; &#x437;&#x430;&#x43A;&#x430;&#x437;&#x435;&lt;/li&gt;&#xD;
35
  &lt;li&gt;&#x41F;&#x43E;&#x434;&#x434;&#x435;&#x440;&#x436;&#x43A;&#x430; &#x443;&#x43A;&#x440;&#x430;&#x438;&#x43D;&#x441;&#x43A;&#x438;&#x445; &#x43F;&#x440;&#x43E;&#x432;&#x430;&#x439;&#x434;&#x435;&#x440;&#x43E;&#x432; &#x421;&#x41C;&#x421;&lt;/li&gt;&#xD;
 
36
  &lt;/ul&gt;&#xD;
37
  &#xD;
38
  &#x41F;&#x43E;&#x434;&#x434;&#x435;&#x440;&#x436;&#x438;&#x432;&#x430;&#x435;&#x43C;&#x44B;&#x435; &#x43F;&#x440;&#x43E;&#x432;&#x430;&#x439;&#x434;&#x435;&#x440;&#x44B;:&#xD;
@@ -43,11 +45,14 @@ Supporting providers:&#xD;
43
  &lt;/p&gt;&#xD;
44
  &lt;p&gt;&#x41F;&#x43B;&#x430;&#x43D;&#x44B; &#x43D;&#x430; &#x431;&#x443;&#x434;&#x443;&#x449;&#x435;&#x435;: &#x431;&#x43E;&#x43B;&#x44C;&#x448;&#x435; &#x43F;&#x440;&#x43E;&#x432;&#x430;&#x439;&#x434;&#x435;&#x440;&#x43E;&#x432;, &#x43F;&#x440;&#x43E;&#x432;&#x435;&#x440;&#x43A;&#x430; &#x431;&#x430;&#x43B;&#x430;&#x43D;&#x441;&#x430;, &#x438;&#x441;&#x43F;&#x43E;&#x43B;&#x44C;&#x437;&#x43E;&#x432;&#x430;&#x43D;&#x438;&#x435; &#x43D;&#x435;&#x441;&#x43A;&#x43E;&#x43B;&#x44C;&#x43A;&#x438;&#x445; &#x43F;&#x440;&#x43E;&#x432;&#x430;&#x439;&#x434;&#x435;&#x440;&#x43E;&#x432;, &#x43E;&#x442;&#x43F;&#x440;&#x430;&#x432;&#x43A;&#x430; &#x441;&#x43E;&#x43E;&#x431;&#x449;&#x435;&#x43D;&#x438;&#x44F; &#x43F;&#x43E;&#x43B;&#x44C;&#x437;&#x43E;&#x432;&#x430;&#x442;&#x435;&#x43B;&#x44E;, &#x443;&#x432;&#x435;&#x434;&#x43E;&#x43C;&#x43B;&#x435;&#x43D;&#x438;&#x435; &#x43E;&#x431; &#x438;&#x437;&#x43C;&#x435;&#x43D;&#x435;&#x43D;&#x438;&#x438; &#x441;&#x442;&#x430;&#x442;&#x443;&#x441;&#x430; &#x437;&#x430;&#x43A;&#x430;&#x437;&#x430;, &#x43E;&#x442;&#x43F;&#x440;&#x430;&#x432;&#x43A;&#x430; &#x441;&#x43E;&#x43E;&#x431;&#x449;&#x435;&#x43D;&#x438;&#x44F; &#x43D;&#x435;&#x441;&#x43A;&#x43E;&#x43B;&#x44C;&#x43A;&#x438;&#x43C; &#x43F;&#x43E;&#x43B;&#x44C;&#x437;&#x43E;&#x432;&#x430;&#x442;&#x435;&#x43B;&#x44F;&#x43C;.&lt;/p&gt;&#xD;
45
  </description>
46
- <notes>Added new provider</notes>
47
- <authors><author><name>Artem Kruzhalin</name><user>kruzhalin</user><email>artem@easyweb.org.ua</email></author></authors>
48
- <date>2014-03-24</date>
49
- <time>11:57:58</time>
50
- <contents><target name="magelocal"><dir name="Easyweb"><dir name="Smsnotify"><dir name="Helper"><file name="Data.php" hash="fd3e1e1a4cf2f69f4722d8863f1d3095"/></dir><dir name="Model"><file name="Observer.php" hash="bf11592b20f68828aafbef2f953c9146"/><dir name="Provider"><file name="Abstract.php" hash="3af24fba92e1ebd39810efcf0332378b"/><file name="Esputnik.php" hash="8b39fdb6a034d05c4c685ea7d9ede5be"/><file name="Turbosms.php" hash="8e4ec09425804fe0128caa3b3acaa4d7"/></dir><dir name="Source"><file name="Provider.php" hash="7b42afe9fd8a55793ba407100ad520ef"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="0dacac551e86f6524b96ed199d92c088"/><file name="config.xml" hash="119a1b31d98d57f0491011d569474509"/><file name="system.xml" hash="d7340c459343e96ba241ed46535e5afc"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Easyweb_Smsnotify.xml" hash="9c6f0c4de23e20c87491dd4972e13c1b"/></dir></target><target name="magelocale"><dir name="ru_RU"><file name="Easyweb_Smsnotify.csv" hash="855a9e38297735853e3183a0dc08bf84"/></dir><dir name="en_US"><file name="Easyweb_Smsnotify.csv" hash="c50e090eba6380d96704a0a07b2f6698"/></dir><dir name="uk_UA"><file name="Easyweb_Smsnotify.csv" hash="661b849b767f0306a093cd9d53c86873"/></dir></target></contents>
 
 
 
51
  <compatible/>
52
- <dependencies><required><php><min>5.0.0</min><max>6.0.0</max></php></required></dependencies>
53
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Easyweb_Smsnotify</name>
4
+ <version>1.0.3</version>
5
  <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/gpl-license.php">GNU General Public License</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>SMS Notifications about new orders.&#xD;
15
  List of features:&#xD;
16
  &lt;ul&gt;&#xD;
17
  &lt;li&gt;Notifications of new order&lt;/li&gt;&#xD;
18
+ &lt;li&gt;Balance info&lt;/li&gt;&#xD;
19
  &lt;li&gt;Ukrainian SMS Providers&lt;/li&gt;&#xD;
20
  &lt;/ul&gt;&#xD;
21
  Supporting providers:&#xD;
34
  &lt;ul&gt;&#xD;
35
  &lt;li&gt;&#x423;&#x432;&#x435;&#x434;&#x43E;&#x43C;&#x43B;&#x435;&#x43D;&#x438;&#x435; &#x43E; &#x43D;&#x43E;&#x432;&#x43E;&#x43C; &#x437;&#x430;&#x43A;&#x430;&#x437;&#x435;&lt;/li&gt;&#xD;
36
  &lt;li&gt;&#x41F;&#x43E;&#x434;&#x434;&#x435;&#x440;&#x436;&#x43A;&#x430; &#x443;&#x43A;&#x440;&#x430;&#x438;&#x43D;&#x441;&#x43A;&#x438;&#x445; &#x43F;&#x440;&#x43E;&#x432;&#x430;&#x439;&#x434;&#x435;&#x440;&#x43E;&#x432; &#x421;&#x41C;&#x421;&lt;/li&gt;&#xD;
37
+ &lt;li&gt;&#x43F;&#x440;&#x43E;&#x432;&#x435;&#x440;&#x43A;&#x430; &#x431;&#x430;&#x43B;&#x430;&#x43D;&#x441;&#x430;&lt;/li&gt;&#xD;
38
  &lt;/ul&gt;&#xD;
39
  &#xD;
40
  &#x41F;&#x43E;&#x434;&#x434;&#x435;&#x440;&#x436;&#x438;&#x432;&#x430;&#x435;&#x43C;&#x44B;&#x435; &#x43F;&#x440;&#x43E;&#x432;&#x430;&#x439;&#x434;&#x435;&#x440;&#x44B;:&#xD;
45
  &lt;/p&gt;&#xD;
46
  &lt;p&gt;&#x41F;&#x43B;&#x430;&#x43D;&#x44B; &#x43D;&#x430; &#x431;&#x443;&#x434;&#x443;&#x449;&#x435;&#x435;: &#x431;&#x43E;&#x43B;&#x44C;&#x448;&#x435; &#x43F;&#x440;&#x43E;&#x432;&#x430;&#x439;&#x434;&#x435;&#x440;&#x43E;&#x432;, &#x43F;&#x440;&#x43E;&#x432;&#x435;&#x440;&#x43A;&#x430; &#x431;&#x430;&#x43B;&#x430;&#x43D;&#x441;&#x430;, &#x438;&#x441;&#x43F;&#x43E;&#x43B;&#x44C;&#x437;&#x43E;&#x432;&#x430;&#x43D;&#x438;&#x435; &#x43D;&#x435;&#x441;&#x43A;&#x43E;&#x43B;&#x44C;&#x43A;&#x438;&#x445; &#x43F;&#x440;&#x43E;&#x432;&#x430;&#x439;&#x434;&#x435;&#x440;&#x43E;&#x432;, &#x43E;&#x442;&#x43F;&#x440;&#x430;&#x432;&#x43A;&#x430; &#x441;&#x43E;&#x43E;&#x431;&#x449;&#x435;&#x43D;&#x438;&#x44F; &#x43F;&#x43E;&#x43B;&#x44C;&#x437;&#x43E;&#x432;&#x430;&#x442;&#x435;&#x43B;&#x44E;, &#x443;&#x432;&#x435;&#x434;&#x43E;&#x43C;&#x43B;&#x435;&#x43D;&#x438;&#x435; &#x43E;&#x431; &#x438;&#x437;&#x43C;&#x435;&#x43D;&#x435;&#x43D;&#x438;&#x438; &#x441;&#x442;&#x430;&#x442;&#x443;&#x441;&#x430; &#x437;&#x430;&#x43A;&#x430;&#x437;&#x430;, &#x43E;&#x442;&#x43F;&#x440;&#x430;&#x432;&#x43A;&#x430; &#x441;&#x43E;&#x43E;&#x431;&#x449;&#x435;&#x43D;&#x438;&#x44F; &#x43D;&#x435;&#x441;&#x43A;&#x43E;&#x43B;&#x44C;&#x43A;&#x438;&#x43C; &#x43F;&#x43E;&#x43B;&#x44C;&#x437;&#x43E;&#x432;&#x430;&#x442;&#x435;&#x43B;&#x44F;&#x43C;.&lt;/p&gt;&#xD;
47
  </description>
48
+ <notes>Balance info&#xD;
49
+ Fix issues with eSputnik provider&#xD;
50
+ &#xD;
51
+ </notes>
52
+ <authors><author><name>Artem Kruzhalin</name><user>EasyWeb_UA</user><email>artem@easyweb.org.ua</email></author></authors>
53
+ <date>2014-11-05</date>
54
+ <time>17:13:34</time>
55
+ <contents><target name="magelocal"><dir name="Easyweb"><dir name="Smsnotify"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><file name="Balance.php" hash="916c1a7348818d73cf10080e8709db2f"/></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="5d75fa9ed70e8c7b68bb215e5b139e2e"/></dir><dir name="Model"><file name="Observer.php" hash="ea0bc16fbc35bb64dc773018636a66d9"/><dir name="Provider"><file name="Abstract.php" hash="07ecd781e758901208731083ef88d13a"/><file name="Esputnik.php" hash="ab46165ec500b9118e7f2efc29234972"/><file name="Turbosms.php" hash="abf00df0ba296df442f83ae8c54cc606"/></dir><dir name="Source"><file name="Provider.php" hash="3d78e3f1480db24c499682b0e167c950"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Config"><file name="BalanceController.php" hash="8dd5b3dd80dbf3974143b25eb3bc0554"/></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="3febe7f1c4ab64ec2ec586cb8189d07f"/><file name="config.xml" hash="d5d9dd2ff89153ab077273874a989e54"/><file name="system.xml" hash="ab61fd7b71aa74fcab0f48061f37d990"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Easyweb_Smsnotify.xml" hash="cc03671bbc4017389c86cadd9a260ab8"/></dir></target><target name="magelocale"><dir name="ru_RU"><file name="Easyweb_Smsnotify.csv" hash="b097a56212d7653ee8ac79a97ec1bbfc"/></dir><dir name="uk_UA"><file name="Easyweb_Smsnotify.csv" hash="599e5df3049ce1fa352edae9796eb3ab"/></dir><dir name="en_US"><file name="Easyweb_Smsnotify.csv" hash="683f5fd6cff04031388214823fa2d7cf"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="smsnotify"><dir name="system"><dir name="config"><file name="balance.phtml" hash="f33876a7260e46ba25e147154fc48109"/></dir></dir></dir></dir></dir></dir></dir></target></contents>
56
  <compatible/>
57
+ <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
58
  </package>