ET_PaymentRobokassa - Version 1.0.0

Version Notes

stable release

Download this release

Release Info

Developer Magento Core Team
Extension ET_PaymentRobokassa
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (26) hide show
  1. app/code/community/ET/PaymentRobokassa/Block/Adminhtml/Support.php +122 -0
  2. app/code/community/ET/PaymentRobokassa/Block/Adminhtml/System/Config/Form/Field/Heading.php +41 -0
  3. app/code/community/ET/PaymentRobokassa/Block/Adminhtml/System/Config/Form/Field/Linktoinfo.php +29 -0
  4. app/code/community/ET/PaymentRobokassa/Block/Adminhtml/System/Config/Form/Field/Linktooptions.php +29 -0
  5. app/code/community/ET/PaymentRobokassa/Block/Form.php +22 -0
  6. app/code/community/ET/PaymentRobokassa/Block/Info.php +22 -0
  7. app/code/community/ET/PaymentRobokassa/Block/Redirect.php +43 -0
  8. app/code/community/ET/PaymentRobokassa/Block/Single/Form.php +27 -0
  9. app/code/community/ET/PaymentRobokassa/Block/Single/Info.php +27 -0
  10. app/code/community/ET/PaymentRobokassa/Controller/Router.php +79 -0
  11. app/code/community/ET/PaymentRobokassa/Helper/Data.php +91 -0
  12. app/code/community/ET/PaymentRobokassa/Model/Culture.php +32 -0
  13. app/code/community/ET/PaymentRobokassa/Model/Method/Etrobokassa.php +314 -0
  14. app/code/community/ET/PaymentRobokassa/Model/Paysystem.php +75 -0
  15. app/code/community/ET/PaymentRobokassa/controllers/GateController.php +177 -0
  16. app/code/community/ET/PaymentRobokassa/etc/config.xml +200 -0
  17. app/code/community/ET/PaymentRobokassa/etc/system.xml +299 -0
  18. app/code/community/ET/PaymentRobokassa/sql/etpaymentrobokassa_setup/mysql4-install-1.0.0.php +84 -0
  19. app/design/adminhtml/default/default/template/et_paymentrobokassa/single/form.phtml +22 -0
  20. app/design/adminhtml/default/default/template/et_paymentrobokassa/single/info.phtml +20 -0
  21. app/design/frontend/base/default/template/et_paymentrobokassa/single/form.phtml +28 -0
  22. app/design/frontend/base/default/template/et_paymentrobokassa/single/info.phtml +20 -0
  23. app/etc/modules/ET_PaymentRobokassa.xml +33 -0
  24. app/locale/en_US/ET_PaymentRobokassa.csv +0 -0
  25. app/locale/ru_RU/ET_PaymentRobokassa.csv +62 -0
  26. package.xml +18 -0
app/code/community/ET/PaymentRobokassa/Block/Adminhtml/Support.php ADDED
@@ -0,0 +1,122 @@
1
+ <?php
2
+ /**
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * You may not sell, sub-license, rent or lease
6
+ * any portion of the Software or Documentation to anyone.
7
+ *
8
+ * DISCLAIMER
9
+ *
10
+ * Do not edit or add to this file if you wish to upgrade to newer
11
+ * versions in the future.
12
+ *
13
+ * @category ET
14
+ * @package ET_PaymentRobokassa
15
+ * @copyright Copyright (c) 2013 ET Web Solutions (http://etwebsolutions.com)
16
+ * @contacts support@etwebsolutions.com
17
+ * @license http://shop.etwebsolutions.com/etws-license-free-v1/ ETWS Free License (EFL1)
18
+ */
19
+
20
+ class ET_PaymentRobokassa_Block_Adminhtml_Support
21
+ extends Mage_Adminhtml_Block_Abstract
22
+ implements Varien_Data_Form_Element_Renderer_Interface
23
+ {
24
+ /**
25
+ * Support tab
26
+ * version 1.0.1
27
+ */
28
+ public function render(Varien_Data_Form_Element_Abstract $element)
29
+ {
30
+ $helper = Mage::helper('etpaymentrobokassa');
31
+ $moduleNameId = 'ET_PaymentRobokassa';
32
+
33
+ $moduleVersion = $this->_getConfigValue($moduleNameId, 'version');
34
+ $moduleName = $this->_getConfigValue($moduleNameId, 'name');
35
+ $moduleShortDescription = $this->_getConfigValue($moduleNameId, 'descr');
36
+ $moduleLicense = $this->_getConfigValue($moduleNameId, 'license');
37
+
38
+ $linkParameters = '?module=' . $moduleNameId . '&ver=' . $moduleVersion . '&ref=' . $_SERVER['HTTP_HOST'];
39
+ $moduleLicenseLink = $this->_getConfigValue($moduleNameId, 'licenselink') . $linkParameters;
40
+ $moduleSupportLink = $this->_getConfigValue($moduleNameId, 'redminelink') . $linkParameters;
41
+ $moduleLink = $this->_getConfigValue($moduleNameId, 'permanentlink') . $linkParameters;
42
+ $servicesLink = $this->_getConfigValue($moduleNameId, 'ourserviceslink') . $linkParameters;
43
+
44
+ $html =
45
+ '<style>
46
+ .line {border-top: 1px solid #c6c6c6; }
47
+ .developer-label {color: #000000; font-weight:bold; width: 150px;}
48
+ .developer-text { padding-bottom: 15px;}
49
+ .developer {width: 600px; }
50
+ </style>';
51
+
52
+ $html .= '
53
+ <table cellspacing="0" cellpading="0" class="developer">
54
+ <tr>
55
+ <td class="developer-label">' . $helper->__('Extension:') . '</td>
56
+ <td class="developer-text">' . $helper->__(
57
+ '<strong>%s</strong> (version %s)',
58
+ $moduleName,
59
+ $moduleVersion
60
+ ) . '</td>
61
+ </tr>
62
+ <tr>
63
+ <td class="developer-label">' . $helper->__('License:') . '</td>
64
+ <td class="developer-text">' . $helper->__(
65
+ '<a href="%s" target="_blank">%s</a>',
66
+ $moduleLicenseLink,
67
+ $moduleLicense
68
+ ) . '</td>
69
+ </tr>
70
+ <tr>
71
+ <td class="developer-label">' . $helper->__('Short Description:') . '</td>
72
+ <td class="developer-text">' .$moduleShortDescription. '</td>
73
+ </tr>
74
+ <tr>
75
+ <td class="developer-label">' . $helper->__('Documentation:') . '</td>
76
+ <td class="developer-text">' . $helper->__(
77
+ 'You can see description of extension features and answers to the ' .
78
+ 'frequently asked questions on <a href="%s" target="_balnk">our website</a>.',
79
+ $moduleLink) . '</td>
80
+ </tr>
81
+ <tr>
82
+ <td class="developer-label line">' . $helper->__('Support:') . '</td>
83
+ <td class="developer-text line">' . $helper->__(
84
+ 'Extension support is available through <a href="%s" target="_blank">issue tracking system' .
85
+ '</a>.<br>You can see information freely, but you will have to sign up to open a ticket.<br>' .
86
+ '<br>Please, report all bugs and feature requests that are related to this extension.<br>' .
87
+ '<br>If by some reason you can not submit a question, bug report or feature request to our ' .
88
+ 'ticket system, you can write us an email - support@etwebsolutions.com.',
89
+ $moduleSupportLink) . '</td>
90
+ </tr>
91
+ <tr>
92
+ <td class="developer-label line">' . $helper->__('Advertisement:') . '</td>
93
+ <td class="developer-text line">' . $helper->__(
94
+ 'You can hire our team to customize the extension. E-mail us on sales@etwebsolutions.com.<br>' .
95
+ '<br>You can see a list of provided services on <a href="%s" target="_blank">our website</a>.',
96
+ $servicesLink) . '</td>
97
+ </tr>
98
+ </table>';
99
+
100
+
101
+ return $html;
102
+ }
103
+
104
+ protected function _getConfigValue($module, $config)
105
+ {
106
+ $locale = Mage::app()->getLocale()->getLocaleCode();
107
+ $defaultLocale = 'en_US';
108
+ $mainConfig = Mage::getConfig();
109
+ $moduleConfig = $mainConfig->getNode('modules/' . $module . '/' . $config);
110
+
111
+ if ((string)$moduleConfig) {
112
+ return $moduleConfig;
113
+ }
114
+
115
+ if ($moduleConfig->$locale) {
116
+ return $moduleConfig->$locale;
117
+ } else {
118
+ return $moduleConfig->$defaultLocale;
119
+ }
120
+ }
121
+
122
+ }
app/code/community/ET/PaymentRobokassa/Block/Adminhtml/System/Config/Form/Field/Heading.php ADDED
@@ -0,0 +1,41 @@
1
+ <?php
2
+ /**
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * You may not sell, sub-license, rent or lease
6
+ * any portion of the Software or Documentation to anyone.
7
+ *
8
+ * DISCLAIMER
9
+ *
10
+ * Do not edit or add to this file if you wish to upgrade to newer
11
+ * versions in the future.
12
+ *
13
+ * @category ET
14
+ * @package ET_PaymentRobokassa
15
+ * @copyright Copyright (c) 2013 ET Web Solutions (http://etwebsolutions.com)
16
+ * @contacts support@etwebsolutions.com
17
+ * @license http://shop.etwebsolutions.com/etws-license-free-v1/ ETWS Free License (EFL1)
18
+ */
19
+
20
+ //if (!class_exists('Mage_Adminhtml_Block_System_Config_Form_Field_Heading')) {
21
+ // https://bugs.php.net/bug.php?id=52339
22
+ if (version_compare(Mage::getVersion(), '1.4.1', '<')) {
23
+ class ET_PaymentRobokassa_Block_Adminhtml_System_Config_Form_Field_Heading
24
+ extends Mage_Adminhtml_Block_Abstract
25
+ implements Varien_Data_Form_Element_Renderer_Interface
26
+ {
27
+
28
+ public function render(Varien_Data_Form_Element_Abstract $element)
29
+ {
30
+ return sprintf(
31
+ '<tr class="system-fieldset-sub-head" id="row_%s"><td colspan="5"><h4 id="%s">%s</h4></td></tr>',
32
+ $element->getHtmlId(), $element->getHtmlId(), $element->getLabel()
33
+ );
34
+ }
35
+ }
36
+ } else {
37
+ class ET_PaymentRobokassa_Block_Adminhtml_System_Config_Form_Field_Heading
38
+ extends Mage_Adminhtml_Block_System_Config_Form_Field_Heading
39
+ {
40
+ }
41
+ }
app/code/community/ET/PaymentRobokassa/Block/Adminhtml/System/Config/Form/Field/Linktoinfo.php ADDED
@@ -0,0 +1,29 @@
1
+ <?php
2
+ /**
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * You may not sell, sub-license, rent or lease
6
+ * any portion of the Software or Documentation to anyone.
7
+ *
8
+ * DISCLAIMER
9
+ *
10
+ * Do not edit or add to this file if you wish to upgrade to newer
11
+ * versions in the future.
12
+ *
13
+ * @category ET
14
+ * @package ET_PaymentRobokassa
15
+ * @copyright Copyright (c) 2013 ET Web Solutions (http://etwebsolutions.com)
16
+ * @contacts support@etwebsolutions.com
17
+ * @license http://shop.etwebsolutions.com/etws-license-free-v1/ ETWS Free License (EFL1)
18
+ */
19
+
20
+ class ET_PaymentRobokassa_Block_Adminhtml_System_Config_Form_Field_Linktoinfo
21
+ extends Mage_Adminhtml_Block_System_Config_Form_Field
22
+ {
23
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
24
+ {
25
+ return '<a href="' . $this->getUrl('*/system_config/edit', array('section' => 'etpaymentrobokassa')) . '">' .
26
+ Mage::helper('etpaymentrobokassa')->__('Extension information') .
27
+ '</a>';
28
+ }
29
+ }
app/code/community/ET/PaymentRobokassa/Block/Adminhtml/System/Config/Form/Field/Linktooptions.php ADDED
@@ -0,0 +1,29 @@
1
+ <?php
2
+ /**
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * You may not sell, sub-license, rent or lease
6
+ * any portion of the Software or Documentation to anyone.
7
+ *
8
+ * DISCLAIMER
9
+ *
10
+ * Do not edit or add to this file if you wish to upgrade to newer
11
+ * versions in the future.
12
+ *
13
+ * @category ET
14
+ * @package ET_PaymentRobokassa
15
+ * @copyright Copyright (c) 2013 ET Web Solutions (http://etwebsolutions.com)
16
+ * @contacts support@etwebsolutions.com
17
+ * @license http://shop.etwebsolutions.com/etws-license-free-v1/ ETWS Free License (EFL1)
18
+ */
19
+
20
+ class ET_PaymentRobokassa_Block_Adminhtml_System_Config_Form_Field_Linktooptions
21
+ extends Mage_Adminhtml_Block_System_Config_Form_Field
22
+ {
23
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
24
+ {
25
+ return '<a href="' . $this->getUrl('*/system_config/edit', array('section' => 'payment')) . '">' .
26
+ Mage::helper('etpaymentrobokassa')->__('Go to Payment Methods settings section') .
27
+ '</a>';
28
+ }
29
+ }
app/code/community/ET/PaymentRobokassa/Block/Form.php ADDED
@@ -0,0 +1,22 @@
1
+ <?php
2
+ /**
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * You may not sell, sub-license, rent or lease
6
+ * any portion of the Software or Documentation to anyone.
7
+ *
8
+ * DISCLAIMER
9
+ *
10
+ * Do not edit or add to this file if you wish to upgrade to newer
11
+ * versions in the future.
12
+ *
13
+ * @category ET
14
+ * @package ET_PaymentRobokassa
15
+ * @copyright Copyright (c) 2013 ET Web Solutions (http://etwebsolutions.com)
16
+ * @contacts support@etwebsolutions.com
17
+ * @license http://shop.etwebsolutions.com/etws-license-free-v1/ ETWS Free License (EFL1)
18
+ */
19
+
20
+ class ET_PaymentRobokassa_Block_Form extends Mage_Payment_Block_Form
21
+ {
22
+ }
app/code/community/ET/PaymentRobokassa/Block/Info.php ADDED
@@ -0,0 +1,22 @@
1
+ <?php
2
+ /**
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * You may not sell, sub-license, rent or lease
6
+ * any portion of the Software or Documentation to anyone.
7
+ *
8
+ * DISCLAIMER
9
+ *
10
+ * Do not edit or add to this file if you wish to upgrade to newer
11
+ * versions in the future.
12
+ *
13
+ * @category ET
14
+ * @package ET_PaymentRobokassa
15
+ * @copyright Copyright (c) 2013 ET Web Solutions (http://etwebsolutions.com)
16
+ * @contacts support@etwebsolutions.com
17
+ * @license http://shop.etwebsolutions.com/etws-license-free-v1/ ETWS Free License (EFL1)
18
+ */
19
+
20
+ class ET_PaymentRobokassa_Block_Info extends Mage_Payment_Block_Info
21
+ {
22
+ }
app/code/community/ET/PaymentRobokassa/Block/Redirect.php ADDED
@@ -0,0 +1,43 @@
1
+ <?php
2
+ /**
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * You may not sell, sub-license, rent or lease
6
+ * any portion of the Software or Documentation to anyone.
7
+ *
8
+ * DISCLAIMER
9
+ *
10
+ * Do not edit or add to this file if you wish to upgrade to newer
11
+ * versions in the future.
12
+ *
13
+ * @category ET
14
+ * @package ET_PaymentRobokassa
15
+ * @copyright Copyright (c) 2013 ET Web Solutions (http://etwebsolutions.com)
16
+ * @contacts support@etwebsolutions.com
17
+ * @license http://shop.etwebsolutions.com/etws-license-free-v1/ ETWS Free License (EFL1)
18
+ */
19
+
20
+ class ET_PaymentRobokassa_Block_Redirect extends Mage_Core_Block_Abstract
21
+ {
22
+ protected $_postData;
23
+
24
+ protected function _toHtml()
25
+ {
26
+ $html = '<html><body>';
27
+ $html .= $this->__('You will be redirected to payment form in a few seconds.');
28
+ $html .= '<form method="get" action="' . $this->getGateUrl() . '" id="gate_post_form">';
29
+ foreach ($this->_postData as $key => $value) {
30
+ $html .= '<input type="hidden" name="' . $key . '" value="' . $value . '">';
31
+ }
32
+ print '<input type="submit" value="' . $this->__("Click here, if not redirected for 30 seconds") . '">';
33
+ $html .= '</form><script type="text/javascript">document.getElementById("gate_post_form").submit();</script>';
34
+ $html .= '</body></html>';
35
+ return $html;
36
+ }
37
+
38
+ public function setPostData($data)
39
+ {
40
+ $this->_postData = $data;
41
+ return $this;
42
+ }
43
+ }
app/code/community/ET/PaymentRobokassa/Block/Single/Form.php ADDED
@@ -0,0 +1,27 @@
1
+ <?php
2
+ /**
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * You may not sell, sub-license, rent or lease
6
+ * any portion of the Software or Documentation to anyone.
7
+ *
8
+ * DISCLAIMER
9
+ *
10
+ * Do not edit or add to this file if you wish to upgrade to newer
11
+ * versions in the future.
12
+ *
13
+ * @category ET
14
+ * @package ET_PaymentRobokassa
15
+ * @copyright Copyright (c) 2013 ET Web Solutions (http://etwebsolutions.com)
16
+ * @contacts support@etwebsolutions.com
17
+ * @license http://shop.etwebsolutions.com/etws-license-free-v1/ ETWS Free License (EFL1)
18
+ */
19
+
20
+ class ET_PaymentRobokassa_Block_Single_Form extends Mage_Payment_Block_Form
21
+ {
22
+ protected function _construct()
23
+ {
24
+ parent::_construct();
25
+ $this->setTemplate('et_paymentrobokassa/single/form.phtml');
26
+ }
27
+ }
app/code/community/ET/PaymentRobokassa/Block/Single/Info.php ADDED
@@ -0,0 +1,27 @@
1
+ <?php
2
+ /**
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * You may not sell, sub-license, rent or lease
6
+ * any portion of the Software or Documentation to anyone.
7
+ *
8
+ * DISCLAIMER
9
+ *
10
+ * Do not edit or add to this file if you wish to upgrade to newer
11
+ * versions in the future.
12
+ *
13
+ * @category ET
14
+ * @package ET_PaymentRobokassa
15
+ * @copyright Copyright (c) 2013 ET Web Solutions (http://etwebsolutions.com)
16
+ * @contacts support@etwebsolutions.com
17
+ * @license http://shop.etwebsolutions.com/etws-license-free-v1/ ETWS Free License (EFL1)
18
+ */
19
+
20
+ class ET_PaymentRobokassa_Block_Single_Info extends Mage_Payment_Block_Info
21
+ {
22
+ protected function _construct()
23
+ {
24
+ parent::_construct();
25
+ $this->setTemplate('et_paymentrobokassa/single/info.phtml');
26
+ }
27
+ }
app/code/community/ET/PaymentRobokassa/Controller/Router.php ADDED
@@ -0,0 +1,79 @@
1
+ <?php
2
+ /**
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * You may not sell, sub-license, rent or lease
6
+ * any portion of the Software or Documentation to anyone.
7
+ *
8
+ * DISCLAIMER
9
+ *
10
+ * Do not edit or add to this file if you wish to upgrade to newer
11
+ * versions in the future.
12
+ *
13
+ * @category ET
14
+ * @package ET_PaymentRobokassa
15
+ * @copyright Copyright (c) 2013 ET Web Solutions (http://etwebsolutions.com)
16
+ * @contacts support@etwebsolutions.com
17
+ * @license http://shop.etwebsolutions.com/etws-license-free-v1/ ETWS Free License (EFL1)
18
+ */
19
+
20
+ // Нужен из-за того, что платёжный сервер в любом случае
21
+ // возвращает на один и тот же адрес, независимо
22
+ // от успеха операции и языка.
23
+
24
+ class ET_PaymentRobokassa_Controller_Router extends Mage_Core_Controller_Varien_Router_Abstract
25
+ {
26
+ protected $_routerController;
27
+ protected $_routerName = 'etrobokassa';
28
+ protected $_moduleName = 'etpaymentrobokassa';
29
+
30
+
31
+ public function initControllerRouters($observer)
32
+ {
33
+ $front = $observer->getEvent()->getFront();
34
+ $this->setRouterController();
35
+ $front->addRouter($this->_routerName, $this->_routerController);
36
+ }
37
+
38
+ public function setRouterController()
39
+ {
40
+ $this->_routerController = new ET_PaymentRobokassa_Controller_Router();
41
+ }
42
+
43
+ public function match(Zend_Controller_Request_Http $request)
44
+ {
45
+ if (!Mage::isInstalled()) {
46
+ Mage::app()->getFrontController()->getResponse()
47
+ ->setRedirect(Mage::getUrl('install'))
48
+ ->sendResponse();
49
+ exit;
50
+ }
51
+
52
+ $identifier = trim($request->getPathInfo(), '/');
53
+ $allpath = explode("/", $identifier);
54
+
55
+ //ne nash modulj
56
+ if ($allpath[0] != $this->_routerName) {
57
+ return false;
58
+ }
59
+
60
+ /* to avoid /gate/ in return urls */
61
+ $allpath[2] = $allpath[1];
62
+ $allpath[1] = 'gate';
63
+
64
+ if ($orderId = $request->getParam("InvId")) {
65
+ Mage::app()->getStore()->load(Mage::getModel("sales/order")->load($orderId)->getStoreId());
66
+ }
67
+ // var_dump($allpath);
68
+ //exit();
69
+ $request->setModuleName($this->_moduleName)
70
+ ->setControllerName(isset($allpath[1]) ? $allpath[1] : 'gate')
71
+ ->setActionName(isset($allpath[2]) ? $allpath[2] : 'success');
72
+ $request->setAlias(
73
+ Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS,
74
+ trim($request->getPathInfo(), '/')
75
+ );
76
+
77
+ return true;
78
+ }
79
+ }
app/code/community/ET/PaymentRobokassa/Helper/Data.php ADDED
@@ -0,0 +1,91 @@
1
+ <?php
2
+ /**
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * You may not sell, sub-license, rent or lease
6
+ * any portion of the Software or Documentation to anyone.
7
+ *
8
+ * DISCLAIMER
9
+ *
10
+ * Do not edit or add to this file if you wish to upgrade to newer
11
+ * versions in the future.
12
+ *
13
+ * @category ET
14
+ * @package ET_PaymentRobokassa
15
+ * @copyright Copyright (c) 2013 ET Web Solutions (http://etwebsolutions.com)
16
+ * @contacts support@etwebsolutions.com
17
+ * @license http://shop.etwebsolutions.com/etws-license-free-v1/ ETWS Free License (EFL1)
18
+ */
19
+
20
+ class ET_PaymentRobokassa_Helper_Data extends Mage_Core_Helper_Abstract
21
+ {
22
+
23
+ public function refillCart($order)
24
+ {
25
+ //probujem zanovo nabitj korzinu
26
+ $cartRefilled = true;
27
+
28
+ $cart = Mage::getSingleton('checkout/cart');
29
+ $items = $order->getItemsCollection();
30
+ foreach ($items as $item) {
31
+ try {
32
+ $cart->addOrderItem($item);
33
+ } catch (Mage_Core_Exception $e) {
34
+ $cartRefilled = false;
35
+ if (Mage::getSingleton('checkout/session')->getUseNotice(true)) {
36
+ Mage::getSingleton('checkout/session')->addNotice($e->getMessage());
37
+ } else {
38
+ Mage::getSingleton('checkout/session')->addError($e->getMessage());
39
+ }
40
+ $this->_redirect('customer/account/history');
41
+ } catch (Exception $e) {
42
+ $cartRefilled = false;
43
+ Mage::getSingleton('checkout/session')->addException(
44
+ $e,
45
+ Mage::helper('checkout')->__('Cannot add the item to shopping cart.')
46
+ );
47
+ }
48
+ }
49
+ $cart->save();
50
+
51
+ return $cartRefilled;
52
+ }
53
+
54
+ public function log($message)
55
+ {
56
+ if ($this->isLogEnabled()) {
57
+ $file = $this->getLogFileName();
58
+ if (is_array($message)) {
59
+ Mage::dispatchEvent('robokassa_log_file_write_before', $message);
60
+ $forLog = array();
61
+ foreach ($message as $answerKey => $answerValue) {
62
+ $forLog[] = $answerKey . ": " . $answerValue;
63
+ }
64
+ $forLog[] = '***************************';
65
+ $message = implode("\r\n", $forLog);
66
+ }
67
+ Mage::log($message, Zend_Log::DEBUG, $file, true);
68
+ }
69
+ return true;
70
+ }
71
+
72
+ public function arrayToRawData($array)
73
+ {
74
+ foreach ($array as $key => $value) {
75
+ $newArray[] = $key . ": " . $value;
76
+ }
77
+ $raw = implode("\r\n", $newArray);
78
+ return $raw;
79
+ }
80
+
81
+ public function isLogEnabled()
82
+ {
83
+ return Mage::getStoreConfig('payment/etrobokassa/enable_log');
84
+ }
85
+
86
+ public function getLogFileName()
87
+ {
88
+ return 'et_robokassa.log';
89
+ }
90
+
91
+ }
app/code/community/ET/PaymentRobokassa/Model/Culture.php ADDED
@@ -0,0 +1,32 @@
1
+ <?php
2
+ /**
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * You may not sell, sub-license, rent or lease
6
+ * any portion of the Software or Documentation to anyone.
7
+ *
8
+ * DISCLAIMER
9
+ *
10
+ * Do not edit or add to this file if you wish to upgrade to newer
11
+ * versions in the future.
12
+ *
13
+ * @category ET
14
+ * @package ET_PaymentRobokassa
15
+ * @copyright Copyright (c) 2013 ET Web Solutions (http://etwebsolutions.com)
16
+ * @contacts support@etwebsolutions.com
17
+ * @license http://shop.etwebsolutions.com/etws-license-free-v1/ ETWS Free License (EFL1)
18
+ */
19
+
20
+ class ET_PaymentRobokassa_Model_Culture extends Mage_Core_Model_Abstract
21
+ {
22
+
23
+ public function toOptionArray()
24
+ {
25
+ $data = array(
26
+ array('value' => "en", 'label' => Mage::helper('etpaymentrobokassa')->__('English')),
27
+ array('value' => "ru", 'label' => Mage::helper('etpaymentrobokassa')->__('Russian'))
28
+ );
29
+ return $data;
30
+ }
31
+
32
+ }
app/code/community/ET/PaymentRobokassa/Model/Method/Etrobokassa.php ADDED
@@ -0,0 +1,314 @@
1
+ <?php
2
+ /**
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * You may not sell, sub-license, rent or lease
6
+ * any portion of the Software or Documentation to anyone.
7
+ *
8
+ * DISCLAIMER
9
+ *
10
+ * Do not edit or add to this file if you wish to upgrade to newer
11
+ * versions in the future.
12
+ *
13
+ * @category ET
14
+ * @package ET_PaymentRobokassa
15
+ * @copyright Copyright (c) 2013 ET Web Solutions (http://etwebsolutions.com)
16
+ * @contacts support@etwebsolutions.com
17
+ * @license http://shop.etwebsolutions.com/etws-license-free-v1/ ETWS Free License (EFL1)
18
+ */
19
+
20
+ class ET_PaymentRobokassa_Model_Method_Etrobokassa extends Mage_Payment_Model_Method_Abstract
21
+ {
22
+
23
+ protected $_code = 'etrobokassa';
24
+ protected $_formBlockType = 'etpaymentrobokassa/single_form';
25
+ protected $_infoBlockType = 'etpaymentrobokassa/single_info';
26
+
27
+ /**
28
+ * Payment Method features
29
+ * @var bool
30
+ */
31
+ protected $_isGateway = true;
32
+ protected $_canOrder = false;
33
+ protected $_canAuthorize = false;
34
+ protected $_canCapture = true;
35
+ protected $_canCapturePartial = false;
36
+ protected $_canRefund = false;
37
+ protected $_canRefundInvoicePartial = false;
38
+ protected $_canVoid = false;
39
+ protected $_canUseRobonal = false;
40
+ protected $_canUseCheckout = true;
41
+ protected $_canUseForMultishipping = false;
42
+ protected $_isInitializeNeeded = false;
43
+ protected $_canFetchTransactionInfo = false;
44
+ protected $_canReviewPayment = false;
45
+ protected $_canCreateBillingAgreement = false;
46
+ protected $_canManageRecurringProfiles = false;
47
+ protected $_canEdit = false;
48
+
49
+ protected $_canUseInternal = false; // Payment method will not work in admin panel order
50
+
51
+ /**
52
+ * Payment Method instance configuration
53
+ * @var bool
54
+ */
55
+ protected $_isActive = 0;
56
+ protected $_title;
57
+ protected $_description;
58
+ protected $_testMode;
59
+
60
+ protected $_isLogenabled = 0;
61
+
62
+
63
+ protected $_sMerchantLogin;
64
+ protected $_sInvDesc;
65
+ protected $_paymentText;
66
+ protected $_sIncCurrLabel;
67
+ protected $_sCulture;
68
+ protected $_transferCurrency;
69
+
70
+
71
+ protected $_sMerchantPassOne;
72
+ protected $_sMerchantPassTwo;
73
+
74
+ protected $_cartRefill;
75
+
76
+ protected $_gateUrl = "https://merchant.roboxchange.com/Index.aspx";
77
+ //protected $_testUrl="shell/rktest.php";
78
+ protected $_testUrl = "http://test.robokassa.ru/Index.aspx";
79
+
80
+
81
+ protected $_configRead = false;
82
+
83
+
84
+ public function __construct()
85
+ {
86
+ parent::__construct();
87
+ $this->readConfig();
88
+ }
89
+
90
+
91
+ protected function readConfig()
92
+ {
93
+ if ($this->_configRead) {
94
+ return;
95
+ }
96
+ $this->_isActive = $this->getConfigData('active');
97
+ $this->_title = $this->getConfigData('title');
98
+ $this->_testMode = $this->getConfigDataRobo('test_mode');
99
+
100
+ $this->_paymentText = $this->getConfigData('payment_text');
101
+ $this->_description = Mage::helper('cms')->getBlockTemplateProcessor()->filter($this->_paymentText);
102
+
103
+
104
+ $this->_sMerchantLogin = $this->getConfigDataRobo('sMerchantLogin');
105
+
106
+ $this->_sInvDesc = $this->getConfigDataRobo('sInvDesc');
107
+
108
+ $this->_sIncCurrLabel = $this->getConfigData('sIncCurrLabel');
109
+ $this->_transferCurrency = Mage::app()->getBaseCurrencyCode();
110
+
111
+ $this->_sCulture = $this->getConfigDataRobo('sCulture');
112
+
113
+ $this->_sMerchantPassOne = Mage::helper('core')->decrypt($this->getConfigDataRobo('sMerchantPass1'));
114
+ $this->_sMerchantPassTwo = Mage::helper('core')->decrypt($this->getConfigDataRobo('sMerchantPass2'));
115
+
116
+ $this->_cartRefill = $this->getConfigDataRobo('cart_refill');
117
+
118
+ $this->_configRead = true;
119
+
120
+ return;
121
+ }
122
+
123
+ /**
124
+ * To read common settings, like login and passwords.
125
+ * all specific methot setting must be read with default function
126
+ *
127
+ */
128
+ public function getConfigDataRobo($field, $storeId = null)
129
+ {
130
+ if (null === $storeId) {
131
+ $storeId = $this->getStore();
132
+ }
133
+ $path = 'payment/etrobokassa/' . $field;
134
+ return Mage::getStoreConfig($path, $storeId);
135
+ }
136
+
137
+
138
+ public function getDescription()
139
+ {
140
+ $this->readConfig();
141
+ return $this->_description;
142
+ }
143
+
144
+
145
+ public function getOrderPlaceRedirectUrl()
146
+ {
147
+ return $this->getRedirectUrl();
148
+ }
149
+
150
+ public function getRedirectUrl()
151
+ {
152
+ return Mage::getUrl('etrobokassa/redirect');
153
+ }
154
+
155
+ /**
156
+ * Check whether payment method can be used
157
+ * @param Mage_Sales_Model_Quote
158
+ * @return bool
159
+ */
160
+ public function isAvailable($quote = null)
161
+ {
162
+ return parent::isAvailable($quote);
163
+ }
164
+
165
+ public function canUseForCurrency($currencyCode)
166
+ {
167
+ if (!Mage::app()->getStore()->getCurrentCurrency()->getRate($this->_transferCurrency)) {
168
+ Mage::helper("etpaymentrobokassa")->log('Currency [' . $this->_transferCurrency
169
+ . '] has no rate to convert order amount. Payment method Robokassa not displayed.');
170
+ return false;
171
+ }
172
+ return true;
173
+ }
174
+
175
+ public function canUseForCountry($country)
176
+ {
177
+ if (Mage::getStoreConfig('payment/etrobokassa/allowspecific') == 1) {
178
+ $availableCountries = explode(',', Mage::getStoreConfig('payment/etrobokassa/specificcountry'));
179
+ if (!in_array($country, $availableCountries)) {
180
+ return false;
181
+ }
182
+ }
183
+ return true;
184
+ }
185
+
186
+ /**
187
+ * @param $order Mage_Sales_Model_Order
188
+ * @return array
189
+ */
190
+ public function preparePaymentData($order)
191
+ {
192
+ $this->readConfig();
193
+
194
+ if (empty($this->_sMerchantLogin) || empty($this->_sMerchantPassOne) || empty($this->_sMerchantPassTwo)) {
195
+ Mage::helper("etpaymentrobokassa")
196
+ ->log('Please enter login information about your Robokassa merchant in admin panel!');
197
+ }
198
+
199
+ $hash = $this->generateHash($order, $writeLog = true);
200
+ $outSum = $this->getOutSum($order);
201
+ $postData = array(
202
+ "MrchLogin" => $this->_sMerchantLogin,
203
+ "OutSum" => round($outSum, 2),
204
+ "InvId" => $order->getId(),
205
+ "Desc" => $this->_sInvDesc,
206
+ "SignatureValue" => $hash,
207
+ "IncCurrLabel" => $this->_sIncCurrLabel,
208
+ "Email" => $order->getCustomerEmail(),
209
+ "Culture" => $this->_sCulture
210
+ );
211
+ $result = array(
212
+ 'postData' => new Varien_Object($postData),
213
+ 'order' => $order,
214
+ );
215
+ Mage::dispatchEvent('robokassa_prepare_payment_data', $result);
216
+ $postData = $result['postData']->getData();
217
+ return $postData;
218
+ }
219
+
220
+ public function checkAnswerData($answer)
221
+ {
222
+ try {
223
+ $errors = array();
224
+ $this->readConfig();
225
+ $order = Mage::getModel("sales/order")->load($this->getOrderId($answer));
226
+ $hashArray = array(
227
+ $answer["OutSum"],
228
+ $answer["InvId"],
229
+ $this->_sMerchantPassTwo
230
+ );
231
+
232
+
233
+ $hashCurrent = strtoupper(md5(implode(":", $hashArray)));
234
+ $correctHash = (strcmp($hashCurrent, strtoupper($answer['SignatureValue'])) == 0);
235
+
236
+ if (!$correctHash) {
237
+ $errors[] = "Incorrect HASH (need:" . $hashCurrent . ", got:"
238
+ . strtoupper($answer['SignatureValue']) . ") - fraud data or wrong secret Key";
239
+ $errors[] = "Maybe success payment";
240
+ }
241
+
242
+ /**
243
+ * @var $order Mage_Sales_Model_Order
244
+ */
245
+ if ($this->_transferCurrency != $order->getOrderCurrencyCode()) {
246
+ $outSum = round(
247
+ $order->getBaseCurrency()->convert($order->getBaseGrandTotal(), $this->_transferCurrency),
248
+ 2
249
+ );
250
+ } else {
251
+ $outSum = round($order->getGrandTotal(), 2);
252
+ }
253
+
254
+ if ($outSum != $answer["OutSum"]) {
255
+ $errors[] = "Incorrect Amount: " . $answer["OutSum"] . " (need: " . $outSum . ")";
256
+ }
257
+
258
+ if (count($errors) > 0) {
259
+ return $errors;
260
+ }
261
+
262
+ return (bool)$correctHash;
263
+ } catch (Exception $e) {
264
+ return array("Internal error:" . $e->getMessage());
265
+ }
266
+ }
267
+
268
+
269
+ public function getGateUrl()
270
+ {
271
+ $this->readConfig();
272
+ if ($this->_testMode) {
273
+ return $this->_testUrl;
274
+ }
275
+ return $this->_gateUrl;
276
+ }
277
+
278
+
279
+ public function getOrderId($answer)
280
+ {
281
+ return isset($answer["InvId"]) ? $answer["InvId"] : "";
282
+ }
283
+
284
+ public function generateHash($order, $writeLog = false)
285
+ {
286
+ if ($this->_transferCurrency != $order->getOrderCurrencyCode()) {
287
+ $outSum = $this->getOutSum($order);
288
+ if ($writeLog) {
289
+ Mage::helper("etpaymentrobokassa")->log('Currency converted from [' .
290
+ Mage::app()->getStore()->getCurrentCurrencyCode() . '] to [' .
291
+ $this->_transferCurrency . '] ' . $order->getBaseGrandTotal() . ' ' . $outSum . '');
292
+ }
293
+ } else {
294
+ $outSum = $order->getGrandTotal();
295
+ }
296
+
297
+ $hashData = array(
298
+ "MrchLogin" => $this->_sMerchantLogin,
299
+ "OutSum" => round($outSum, 2),
300
+ "InvId" => $order->getId(),
301
+ "pass" => $this->_sMerchantPassOne,
302
+ );
303
+
304
+ $hash = strtoupper(md5(implode(":", $hashData)));
305
+ return $hash;
306
+ }
307
+
308
+ public function getOutSum($order)
309
+ {
310
+ $outSum = $order->getBaseCurrency()->convert($order->getBaseGrandTotal(), $this->_transferCurrency);
311
+ return $outSum;
312
+ }
313
+
314
+ }
app/code/community/ET/PaymentRobokassa/Model/Paysystem.php ADDED
@@ -0,0 +1,75 @@
1
+ <?php
2
+ /**
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * You may not sell, sub-license, rent or lease
6
+ * any portion of the Software or Documentation to anyone.
7
+ *
8
+ * DISCLAIMER
9
+ *
10
+ * Do not edit or add to this file if you wish to upgrade to newer
11
+ * versions in the future.
12
+ *
13
+ * @category ET
14
+ * @package ET_PaymentRobokassa
15
+ * @copyright Copyright (c) 2013 ET Web Solutions (http://etwebsolutions.com)
16
+ * @contacts support@etwebsolutions.com
17
+ * @license http://shop.etwebsolutions.com/etws-license-free-v1/ ETWS Free License (EFL1)
18
+ */
19
+
20
+ class ET_PaymentRobokassa_Model_Paysystem extends Mage_Core_Model_Abstract
21
+ {
22
+ /**
23
+ * Options getter
24
+ *
25
+ * @return array
26
+ */
27
+ public function toOptionArray()
28
+ {
29
+ $helper = Mage::helper('etpaymentrobokassa');
30
+ $data = array(
31
+ array('value' => "", 'label' => $helper->__('Any')),
32
+ array('value' => "BANKOCEAN2R", 'label' => $helper->__("Интернет-Банк Океан")),
33
+ array('value' => "OceanBankOceanR", 'label' => $helper->__("Интернет-Банк Океан (platezh.ru)")),
34
+ array('value' => "Qiwi29OceanR", 'label' => $helper->__("Платежи через терминалы QIWI")),
35
+ array('value' => "YandexMerchantR", 'label' => $helper->__("Яндекс.Деньги")),
36
+ array('value' => "WMRM", 'label' => $helper->__("Webmoney WMR (Рубли)")),
37
+ array('value' => "WMZM", 'label' => $helper->__("Webmoney WMZ (Доллары)")),
38
+ array('value' => "WMEM", 'label' => $helper->__("Webmoney WME (Евро)")),
39
+ array('value' => "WMUM", 'label' => $helper->__("Webmoney WMU (Украинские гривны)")),
40
+ array('value' => "WMBM", 'label' => $helper->__("Webmoney WMB (Белорусские рубли)")),
41
+ array('value' => "WMGM", 'label' => $helper->__("Webmoney WMG (Эквивалент золота)")),
42
+ array('value' => "MoneyMailR", 'label' => $helper->__("Электронная платежная система MoneyMail")),
43
+ array('value' => "RuPayR", 'label' => $helper->__("Платежный сервис RBK Money")),
44
+ array('value' => "W1R", 'label' => $helper->__("Платежный сервис Единый кошелек")),
45
+ array('value' => "EasyPayB", 'label' => $helper->__("Электронные деньги EasyPay")),
46
+ array('value' => "LiqPayZ", 'label' => $helper->__("Электронные платежи LiqPay")),
47
+ array('value' => "MailRuR", 'label' => $helper->__("Электронные платежи Деньги@Mail.Ru")),
48
+ array('value' => "ZPaymentR", 'label' => $helper->__("Платежная система Z-Payment")),
49
+ array('value' => "TeleMoneyR", 'label' => $helper->__("Платежный сервис TeleMoney")),
50
+ array('value' => "AlfaBankOceanR", 'label' => $helper->__("Интернет-Банк Альфа-Банк")),
51
+ array('value' => "PSKBR", 'label' => $helper->__("Интернет-Банк Промсвязьбанк")),
52
+ array('value' => "HandyBankMerchantOceanR", 'label' => $helper->__("Система интернет-банкинга HandyBank")),
53
+ array('value' => "BSSFederalBankForInnovationAndDevelopmentR",
54
+ 'label' => $helper->__("Федеральный банк инноваций и развития (АК ФБ Инноваций и Развития (ЗАО))")),
55
+ array('value' => "BSSMezhtopenergobankR", 'label' => $helper->__("Интернет-банк Межтопэнергобанк")),
56
+ array('value' => "RapidaOceanSvyaznoyR", 'label' => $helper->__("Салоны сети Связной")),
57
+ array('value' => "RapidaOceanEurosetR", 'label' => $helper->__("Салоны сети Евросеть")),
58
+ array('value' => "TerminalsElecsnetOceanR", 'label' => $helper->__("Терминалы самообслуживания Элекснет")),
59
+ array('value' => "TerminalsUnikassaR", 'label' => $helper->__("Платежные терминалы Кассира.нет")),
60
+ array('value' => "TerminalsMElementR", 'label' => $helper->__("Платежные терминалы Мобил Элемент")),
61
+ array('value' => "TerminalsAbsolutplatR", 'label' => $helper->__("Платежные терминалы Абсолют Плат")),
62
+ array('value' => "TerminalsPinpayR", 'label' => $helper->__("Платежные терминалы Pinpay")),
63
+ array('value' => "TerminalsMoneyMoneyR", 'label' => $helper->__("Платежные терминалы Money-Money")),
64
+ array('value' => "TerminalsPkbR", 'label' => $helper->__("Банкоматы банка Петрокоммерц")),
65
+ array('value' => "VTB24R", 'label' => $helper->__("Банк ВТБ24")),
66
+ array('value' => "MtsR", 'label' => $helper->__("Мобильный оператор МТС")),
67
+ array('value' => "MegafonR", 'label' => $helper->__("Мобильный оператор Мегафон")),
68
+ array('value' => "BANKOCEANCHECKR", 'label' => $helper->__("Оплата с помощью Iphone")),
69
+ array('value' => "IFreeR", 'label' => $helper->__("Оплата с помощью SMS(i-FREE)")),
70
+ array('value' => "ContactR", 'label' => $helper->__("Платежная система Contact"))
71
+ );
72
+
73
+ return $data;
74
+ }
75
+ }
app/code/community/ET/PaymentRobokassa/controllers/GateController.php ADDED
@@ -0,0 +1,177 @@
1
+ <?php
2
+ /**
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * You may not sell, sub-license, rent or lease
6
+ * any portion of the Software or Documentation to anyone.
7
+ *
8
+ * DISCLAIMER
9
+ *
10
+ * Do not edit or add to this file if you wish to upgrade to newer
11
+ * versions in the future.
12
+ *
13
+ * @category ET
14
+ * @package ET_PaymentRobokassa
15
+ * @copyright Copyright (c) 2013 ET Web Solutions (http://etwebsolutions.com)
16
+ * @contacts support@etwebsolutions.com
17
+ * @license http://shop.etwebsolutions.com/etws-license-free-v1/ ETWS Free License (EFL1)
18
+ */
19
+
20
+ class ET_PaymentRobokassa_GateController extends Mage_Core_Controller_Front_Action
21
+ {
22
+ const MODULENAME = "etpaymentrobokassa";
23
+ const PAYMENTNAME = "etrobokassa";
24
+
25
+ /**
26
+ * Setting right header of response if session died
27
+ *
28
+ */
29
+ protected function _expireAjax()
30
+ {
31
+ if (!Mage::getSingleton('checkout/session')->getQuote()->hasItems()) {
32
+ $this->getResponse()->setHeader('HTTP/1.1', '403 Session Expired');
33
+ exit;
34
+ }
35
+ }
36
+
37
+ public function redirectAction()
38
+ {
39
+ $session = Mage::getSingleton('checkout/session');
40
+ $state = Mage_Sales_Model_Order::STATE_NEW;
41
+ $status = Mage::getStoreConfig('payment/etrobokassa/order_status');
42
+ if (strlen($status) == 0) {
43
+ //$status = 'pending';
44
+ $status = Mage::getModel('sales/order')->getConfig()->getStateDefaultStatus($state);
45
+ }
46
+
47
+ $order = Mage::getModel('sales/order')->load($session->getLastOrderId());
48
+ $order->setState($state,
49
+ $status,
50
+ $this->__('Customer redirected to payment Gateway Robokassa'),
51
+ false);
52
+ // send new order email
53
+ $order->sendNewOrderEmail();
54
+ $order->setEmailSent(true);
55
+ $order->save();
56
+
57
+ $payment = $order->getPayment()->getMethodInstance();
58
+ if (!$payment) {
59
+ $payment = Mage::getSingleton("etpaymentrobokassa/method_etrobokassa");
60
+ }
61
+
62
+ $dataForSending = $payment->preparePaymentData($order);
63
+ $dataForSending = array_merge(array('Data transfer' => 'To Robokassa'), $dataForSending);
64
+ Mage::helper("etpaymentrobokassa")->log($dataForSending);
65
+ $this->getResponse()->setHeader('Content-type', 'text/html; charset=UTF8');
66
+ $this->getResponse()->setBody(
67
+ $this->getLayout()->createBlock('etpaymentrobokassa/redirect')->setGateUrl(
68
+ $payment->getGateUrl())->setPostData($dataForSending)->toHtml()
69
+ );
70
+ }
71
+
72
+ public function statusAction()
73
+ {
74
+ $state = Mage_Sales_Model_Order::STATE_PROCESSING;
75
+ $paidStatus = 'paid_robokassa';
76
+ $errorStatus = 'error_robokassa';
77
+ $answer = $this->getRequest()->getParams();
78
+ $payment = Mage::getSingleton(self::MODULENAME . "/method_" . self::PAYMENTNAME);
79
+ if ($payment->getOrderId($answer)) {
80
+ $order = Mage::getModel('sales/order')->load($payment->getOrderId($answer));
81
+
82
+ //true un success, false on fail or array of text on error
83
+ $checkedAnswer = $payment->checkAnswerData($answer);
84
+ if (is_array($checkedAnswer)) {
85
+ $answer['Errors'] = Mage::helper("etpaymentrobokassa")->arrayToRawData($checkedAnswer);
86
+ }
87
+ $result = array(
88
+ 'answer' => new Varien_Object($answer),
89
+ 'order' => $order,
90
+ );
91
+ Mage::dispatchEvent('robokassa_success_answer', $result);
92
+ $answer = $result['answer']->getData();
93
+ $answer = array_merge(array('Data transfer' => 'From Robokassa'), $answer);
94
+
95
+ Mage::helper("etpaymentrobokassa")->log($answer);
96
+
97
+ if ($checkedAnswer === true) {
98
+ Mage::dispatchEvent('robokassa_success_answer_without_error', $answer);
99
+ if ($order->getState() == Mage_Sales_Model_Order::STATE_NEW) {
100
+ if ($order->canInvoice()) {
101
+ $invoice = $order->prepareInvoice();
102
+ $invoice->register()->capture();
103
+ $order->addRelatedObject($invoice);
104
+ }
105
+ $order->setState($state,
106
+ $paidStatus,
107
+ $this->__(
108
+ Mage::helper('etpaymentrobokassa')->__(
109
+ 'The amount has been authorized and captured by Robokassa.')
110
+ ),
111
+ false);
112
+ $order->save();
113
+ }
114
+ print 'OK' . $payment->getOrderId($answer);
115
+ } else {
116
+ if ($order->getId()) {
117
+ $order->addStatusToHistory($errorStatus, implode(" / ", $checkedAnswer), false);
118
+ $order->save();
119
+ }
120
+ print "Error";
121
+ }
122
+ } else {
123
+ Mage::getSingleton('checkout/session')->addError(
124
+ Mage::helper('etpaymentrobokassa')->__('Incorrect order number.')
125
+ );
126
+ $this->_redirect('/');
127
+ }
128
+ }
129
+
130
+ public function failureAction()
131
+ {
132
+
133
+ $payment = Mage::getSingleton(self::MODULENAME . "/method_" . self::PAYMENTNAME);
134
+ $answer = $this->getRequest()->getParams();
135
+
136
+ if ($payment->getOrderId($answer)) {
137
+ $order = Mage::getModel('sales/order')->load($payment->getOrderId($answer));
138
+ $result = new Varien_Object(array(
139
+ 'answer' => $answer,
140
+ 'order' => $order,
141
+ ));
142
+ Mage::dispatchEvent('robokassa_failure_answer', $result);
143
+ $answer = $result->getData('answer');
144
+ $answer = array_merge(array('Data transfer' => 'From Robokassa'), $answer);
145
+ Mage::helper("etpaymentrobokassa")->log($answer);
146
+ if (Mage::getStoreConfig('payment/' . self::PAYMENTNAME . '/cart_refill')) {
147
+ Mage::helper(self::MODULENAME)->refillCart($order);
148
+ }
149
+
150
+ $order->addStatusToHistory(
151
+ $order->getStatus(),
152
+ Mage::helper('etpaymentrobokassa')->__('Payment failed'),
153
+ false
154
+ );
155
+ $order->save();
156
+ $order->cancel()->save();
157
+
158
+ $this->_redirect('checkout/onepage/failure');
159
+ } else {
160
+ Mage::getSingleton('checkout/session')->addError(
161
+ Mage::helper('etpaymentrobokassa')->__('Incorrect order number.')
162
+ );
163
+ $this->_redirect('/');
164
+ }
165
+ }
166
+
167
+ public function successAction()
168
+ {
169
+ $session = Mage::getSingleton('checkout/session');
170
+ if(!$session->getLastOrderId() || !$session->getLastQuoteId() || !$session->getLastSuccessQuoteId()){
171
+ $answer = $this->getRequest()->getParams();
172
+ Mage::dispatchEvent('robokassa_no_session_data_for_success', $answer);
173
+ }
174
+ $this->_redirect("checkout/onepage/success");
175
+ }
176
+
177
+ }
app/code/community/ET/PaymentRobokassa/etc/config.xml ADDED
@@ -0,0 +1,200 @@
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * You may not sell, sub-license, rent or lease
7
+ * any portion of the Software or Documentation to anyone.
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade to newer
12
+ * versions in the future.
13
+ *
14
+ * @category ET
15
+ * @package ET_PaymentRobokassa
16
+ * @copyright Copyright (c) 2013 ET Web Solutions (http://etwebsolutions.com)
17
+ * @contacts support@etwebsolutions.com
18
+ * @license http://shop.etwebsolutions.com/etws-license-free-v1/ ETWS Free License (EFL1)
19
+ */
20
+ -->
21
+ <config>
22
+ <modules>
23
+ <ET_PaymentRobokassa>
24
+ <name>ET Payment Robokassa</name>
25
+ <version>1.0.0</version>
26
+ <descr>
27
+ <ru_RU><![CDATA[Платёжный модуль Robokassa. Позволяет использовать сервис приёма платежей Robokassa (robokassa.ru) на вашем Magento сайте.]]>
28
+ </ru_RU>
29
+ <en_US><![CDATA[Payment extension Robokassa. Allows to use payment service Robokassa (robokassa.ru) on your Magento site.]]>
30
+ </en_US>
31
+ </descr>
32
+ <permanentlink>
33
+ <ru_RU>http://shop.etwebsolutions.com/rus/et-payment-robokassa.html</ru_RU>
34
+ <en_US>http://shop.etwebsolutions.com/eng/et-payment-robokassa.html</en_US>
35
+ </permanentlink>
36
+ <license>
37
+ <ru_RU><![CDATA[ETWS Свободная лицензия (EFL1)]]></ru_RU>
38
+ <en_US><![CDATA[ETWS Free License (EFL1)]]></en_US>
39
+ </license>
40
+ <licenselink>
41
+ <ru_RU>http://shop.etwebsolutions.com/rus/etws-license-free-v1</ru_RU>
42
+ <en_US>http://shop.etwebsolutions.com/eng/etws-license-free-v1</en_US>
43
+ </licenselink>
44
+ <redminelink>http://support.etwebsolutions.com/projects/et-payment-robokassa/roadmap</redminelink>
45
+ <ourserviceslink>
46
+ <ru_RU>http://shop.etwebsolutions.com/rus/our-services</ru_RU>
47
+ <en_US>http://shop.etwebsolutions.com/eng/our-services</en_US>
48
+ </ourserviceslink>
49
+ </ET_PaymentRobokassa>
50
+ </modules>
51
+
52
+ <global>
53
+ <helpers>
54
+ <etpaymentrobokassa>
55
+ <class>ET_PaymentRobokassa_Helper</class>
56
+ </etpaymentrobokassa>
57
+ </helpers>
58
+
59
+ <blocks>
60
+ <etpaymentrobokassa>
61
+ <class>ET_PaymentRobokassa_Block</class>
62
+ </etpaymentrobokassa>
63
+ </blocks>
64
+
65
+ <models>
66
+ <etpaymentrobokassa>
67
+ <class>ET_PaymentRobokassa_Model</class>
68
+ <resourceModel>etpaymentrobokassa_mysql4</resourceModel>
69
+ </etpaymentrobokassa>
70
+ </models>
71
+ <resources>
72
+ <etpaymentrobokassa_setup>
73
+ <setup>
74
+ <module>ET_PaymentRobokassa</module>
75
+ <class>Mage_Sales_Model_Mysql4_Setup</class>
76
+ </setup>
77
+ <connection>
78
+ <use>core_setup</use>
79
+ </connection>
80
+ </etpaymentrobokassa_setup>
81
+ <etpaymentrobokassa_write>
82
+ <connection>
83
+ <use>core_write</use>
84
+ </connection>
85
+ </etpaymentrobokassa_write>
86
+ <etpaymentrobokassa_read>
87
+ <connection>
88
+ <use>core_read</use>
89
+ </connection>
90
+ </etpaymentrobokassa_read>
91
+ </resources>
92
+
93
+ <sales>
94
+ <order>
95
+ <statuses>
96
+ <waiting_robokassa translate="label"><label>Waiting Robokassa payment</label></waiting_robokassa>
97
+ <paid_robokassa translate="label"><label>Paid by Robokassa</label></paid_robokassa>
98
+ <error_robokassa translate="label"><label>Error data from Robokassa</label></error_robokassa>
99
+ </statuses>
100
+ <states>
101
+ <new>
102
+ <statuses>
103
+ <waiting_robokassa/>
104
+ <error_robokassa/>
105
+ </statuses>
106
+ <visible_on_front/>
107
+ </new>
108
+ <processing translate="label">
109
+ <label>Processing</label>
110
+ <statuses>
111
+ <paid_robokassa/>
112
+ </statuses>
113
+ <visible_on_front/>
114
+ </processing>
115
+ </states>
116
+ </order>
117
+ </sales>
118
+ <events>
119
+ <controller_front_init_routers>
120
+ <observers>
121
+ <etrobokassa>
122
+ <class>ET_PaymentRobokassa_Controller_Router</class>
123
+ <method>initControllerRouters</method>
124
+ </etrobokassa>
125
+ </observers>
126
+ </controller_front_init_routers>
127
+ </events>
128
+ </global>
129
+
130
+ <frontend>
131
+ <translate>
132
+ <modules>
133
+ <ET_PaymentRobokassa>
134
+ <files>
135
+ <default>ET_PaymentRobokassa.csv</default>
136
+ </files>
137
+ </ET_PaymentRobokassa>
138
+ </modules>
139
+ </translate>
140
+ <routers>
141
+ <etpaymentrobokassa>
142
+ <use>standard</use>
143
+ <args>
144
+ <module>ET_PaymentRobokassa</module>
145
+ <frontName>etpaymentrobokassa</frontName>
146
+ </args>
147
+ </etpaymentrobokassa>
148
+ </routers>
149
+ </frontend>
150
+
151
+ <adminhtml>
152
+ <acl>
153
+ <resources>
154
+ <admin>
155
+ <children>
156
+ <system>
157
+ <children>
158
+ <config>
159
+ <children>
160
+ <etpaymentrobokassa translate="title" module="etpaymentrobokassa">
161
+ <title>ET Payment Robokassa Section</title>
162
+ <sort_order>400</sort_order>
163
+ </etpaymentrobokassa>
164
+ </children>
165
+ </config>
166
+ </children>
167
+ </system>
168
+ </children>
169
+ </admin>
170
+ </resources>
171
+ </acl>
172
+ <translate>
173
+ <modules>
174
+ <ET_PaymentRobokassa>
175
+ <files>
176
+ <default>ET_PaymentRobokassa.csv</default>
177
+ </files>
178
+ </ET_PaymentRobokassa>
179
+ </modules>
180
+ </translate>
181
+ </adminhtml>
182
+
183
+ <default>
184
+ <payment>
185
+ <etrobokassa>
186
+ <active>0</active>
187
+ <title>Сервис приёма платежей Робокасса</title>
188
+ <payment_text><![CDATA[Платите с помощью банковских карт, в любой электронной валюте, с помощью сервисов мобильной коммерции (МТС, Мегафон, Билайн), платежи через интернет-банк ведущих Банков РФ, платежи через банкоматы, через терминалы мгновенной оплаты, через систему денежных переводов Contact.]]></payment_text>
189
+ <cart_refill>0</cart_refill>
190
+ <allowspecific>0</allowspecific>
191
+ <order_status>waiting_robokassa</order_status>
192
+ <model>etpaymentrobokassa/method_etrobokassa</model>
193
+ <order_status>waiting_robokassa</order_status>
194
+ <test_mode>0</test_mode>
195
+ <enable_log>1</enable_log>
196
+ <sInvDesc>Покупка в интернет магазине</sInvDesc>
197
+ </etrobokassa>
198
+ </payment>
199
+ </default>
200
+ </config>
app/code/community/ET/PaymentRobokassa/etc/system.xml ADDED
@@ -0,0 +1,299 @@
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * You may not sell, sub-license, rent or lease
7
+ * any portion of the Software or Documentation to anyone.
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade to newer
12
+ * versions in the future.
13
+ *
14
+ * @category ET
15
+ * @package ET_PaymentRobokassa
16
+ * @copyright Copyright (c) 2013 ET Web Solutions (http://etwebsolutions.com)
17
+ * @contacts support@etwebsolutions.com
18
+ * @license http://shop.etwebsolutions.com/etws-license-free-v1/ ETWS Free License (EFL1)
19
+ */
20
+ -->
21
+ <config>
22
+ <tabs>
23
+ <etall translate="label">
24
+ <label>ET Extensions</label>
25
+ <sort_order>400</sort_order>
26
+ </etall>
27
+ </tabs>
28
+
29
+ <sections>
30
+ <etpaymentrobokassa translate="label" module="etpaymentrobokassa">
31
+ <label>Payment Robokassa</label>
32
+ <tab>etall</tab>
33
+ <frontend_type>text</frontend_type>
34
+ <sort_order>300</sort_order>
35
+ <show_in_default>1</show_in_default>
36
+ <show_in_website>1</show_in_website>
37
+ <show_in_store>1</show_in_store>
38
+ <groups>
39
+ <info translate="label">
40
+ <label>Payment Robokassa information</label>
41
+ <sort_order>1</sort_order>
42
+ <show_in_default>1</show_in_default>
43
+ <show_in_website>1</show_in_website>
44
+ <show_in_store>1</show_in_store>
45
+ <fields>
46
+ <support_information>
47
+ <frontend_model>etpaymentrobokassa/adminhtml_support</frontend_model>
48
+ <sort_order>100</sort_order>
49
+ <show_in_default>1</show_in_default>
50
+ <show_in_website>1</show_in_website>
51
+ <show_in_store>1</show_in_store>
52
+ </support_information>
53
+ </fields>
54
+ </info>
55
+ <general translate="label comment" module="etpaymentrobokassa">
56
+ <label>Payment Robokassa Options</label>
57
+ <frontend_type>text</frontend_type>
58
+ <sort_order>10</sort_order>
59
+ <show_in_default>1</show_in_default>
60
+ <show_in_website>1</show_in_website>
61
+ <show_in_store>1</show_in_store>
62
+ <fields>
63
+ <linktooptions translate="label comment">
64
+ <label>Settings</label>
65
+ <comment><![CDATA[Extension options available in System -> Configuration -> Sales -> Payment Methods -> Robokassa by ET Web Solutions]]></comment>
66
+ <frontend_type>label</frontend_type>
67
+ <frontend_model>etpaymentrobokassa/adminhtml_system_config_form_field_linktooptions</frontend_model>
68
+ <sort_order>100</sort_order>
69
+ <show_in_default>1</show_in_default>
70
+ <show_in_website>1</show_in_website>
71
+ <show_in_store>1</show_in_store>
72
+ </linktooptions>
73
+ </fields>
74
+ </general>
75
+ </groups>
76
+ </etpaymentrobokassa>
77
+
78
+ <payment translate="label" module="etpaymentrobokassa">
79
+ <groups>
80
+ <etrobokassa translate="label" module="etpaymentrobokassa">
81
+ <label>Robokassa by ET Web Solutions</label>
82
+ <frontend_type>text</frontend_type>
83
+ <sort_order>1</sort_order>
84
+ <show_in_default>1</show_in_default>
85
+ <show_in_website>1</show_in_website>
86
+ <show_in_store>1</show_in_store>
87
+ <fields>
88
+ <linktoinfo translate="label">
89
+ <label>ET Payment Robokassa</label>
90
+ <frontend_type>label</frontend_type>
91
+ <frontend_model>etpaymentrobokassa/adminhtml_system_config_form_field_linktoinfo</frontend_model>
92
+ <sort_order>1</sort_order>
93
+ <show_in_default>1</show_in_default>
94
+ <show_in_website>1</show_in_website>
95
+ <show_in_store>1</show_in_store>
96
+ </linktoinfo>
97
+ <active translate="label">
98
+ <label>Enabled</label>
99
+ <frontend_type>select</frontend_type>
100
+ <source_model>adminhtml/system_config_source_yesno</source_model>
101
+ <sort_order>10</sort_order>
102
+ <show_in_default>1</show_in_default>
103
+ <show_in_website>1</show_in_website>
104
+ <show_in_store>0</show_in_store>
105
+ </active>
106
+ <title translate="label">
107
+ <label>Title</label>
108
+ <frontend_type>text</frontend_type>
109
+ <sort_order>20</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
+ </title>
114
+ <payment_text translate="label">
115
+ <label>Description</label>
116
+ <frontend_type>textarea</frontend_type>
117
+ <sort_order>30</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
+ </payment_text>
122
+ <sort_order translate="label">
123
+ <label>Sort order</label>
124
+ <frontend_type>text</frontend_type>
125
+ <sort_order>40</sort_order>
126
+ <show_in_default>1</show_in_default>
127
+ <show_in_website>1</show_in_website>
128
+ <show_in_store>1</show_in_store>
129
+ </sort_order>
130
+
131
+ <heading_robokassa translate="label">
132
+ <label>Robokassa Gateway options</label>
133
+ <frontend_model>etpaymentrobokassa/adminhtml_system_config_form_field_heading</frontend_model>
134
+ <sort_order>100</sort_order>
135
+ <show_in_default>1</show_in_default>
136
+ <show_in_website>1</show_in_website>
137
+ </heading_robokassa>
138
+ <test_mode translate="label comment">
139
+ <label>Test Mode</label>
140
+ <comment><![CDATA[If Enabled - module will connect Robokassa test server for transactions. This server available only for new merchants (not activated).]]></comment>
141
+ <frontend_type>select</frontend_type>
142
+ <source_model>adminhtml/system_config_source_yesno</source_model>
143
+ <sort_order>110</sort_order>
144
+ <show_in_default>1</show_in_default>
145
+ <show_in_website>1</show_in_website>
146
+ <show_in_store>0</show_in_store>
147
+ </test_mode>
148
+ <enable_log translate="label comment">
149
+ <label>Debug Mode</label>
150
+ <comment><![CDATA[If Enabled - technical information records into a log file /var/log/et_robokassa.log]]></comment>
151
+ <frontend_type>select</frontend_type>
152
+ <source_model>adminhtml/system_config_source_yesno</source_model>
153
+ <sort_order>115</sort_order>
154
+ <show_in_default>1</show_in_default>
155
+ <show_in_website>0</show_in_website>
156
+ <show_in_store>0</show_in_store>
157
+ </enable_log>
158
+
159
+ <sMerchantLogin translate="label comment">
160
+ <label>Merchant Login</label>
161
+ <comment><![CDATA[Merchant login of Robokassa merchant account]]></comment>
162
+ <frontend_type>text</frontend_type>
163
+ <sort_order>120</sort_order>
164
+ <show_in_default>1</show_in_default>
165
+ <show_in_website>1</show_in_website>
166
+ </sMerchantLogin>
167
+
168
+ <sMerchantPass1 translate="label comment">
169
+ <label>Merchant Pass #1</label>
170
+ <comment><![CDATA[Password #1 in administration section of Robokassa merchant account]]></comment>
171
+ <frontend_type>obscure</frontend_type>
172
+ <backend_model>adminhtml/system_config_backend_encrypted</backend_model>
173
+ <sort_order>130</sort_order>
174
+ <show_in_default>1</show_in_default>
175
+ <show_in_website>1</show_in_website>
176
+ </sMerchantPass1>
177
+
178
+ <sMerchantPass2 translate="label comment">
179
+ <label>Merchant Pass #2</label>
180
+ <comment><![CDATA[Password #2 in administration section of Robokassa merchant account]]></comment>
181
+ <frontend_type>obscure</frontend_type>
182
+ <backend_model>adminhtml/system_config_backend_encrypted</backend_model>
183
+ <sort_order>140</sort_order>
184
+ <show_in_default>1</show_in_default>
185
+ <show_in_website>1</show_in_website>
186
+ </sMerchantPass2>
187
+
188
+ <sCulture translate="label comment">
189
+ <label>Language</label>
190
+ <comment><![CDATA[Language on Payment Robokassa website]]></comment>
191
+ <frontend_type>select</frontend_type>
192
+ <source_model>etpaymentrobokassa/culture</source_model>
193
+ <sort_order>150</sort_order>
194
+ <show_in_default>1</show_in_default>
195
+ <show_in_website>1</show_in_website>
196
+ <show_in_store>1</show_in_store>
197
+ </sCulture>
198
+
199
+ <sInvDesc>
200
+ <label>Order description</label>
201
+ <comment><![CDATA[Order description on Payment Robokassa website]]></comment>
202
+ <frontend_type>text</frontend_type>
203
+ <sort_order>160</sort_order>
204
+ <show_in_default>1</show_in_default>
205
+ <show_in_website>1</show_in_website>
206
+ <show_in_store>1</show_in_store>
207
+ </sInvDesc>
208
+
209
+ <sIncCurrLabel translate="label comment">
210
+ <label>Payment System</label>
211
+ <comment><![CDATA[Default payment system. Customer can choose other payment system on Robokassa website. If you do not know what to choose, keep the default value - Any.]]></comment>
212
+ <frontend_type>select</frontend_type>
213
+ <source_model>etpaymentrobokassa/paysystem</source_model>
214
+ <sort_order>170</sort_order>
215
+ <show_in_default>1</show_in_default>
216
+ <show_in_website>1</show_in_website>
217
+ <show_in_store>1</show_in_store>
218
+ </sIncCurrLabel>
219
+
220
+ <heading_restrictions translate="label">
221
+ <label>Restrictions</label>
222
+ <frontend_model>etpaymentrobokassa/adminhtml_system_config_form_field_heading</frontend_model>
223
+ <sort_order>700</sort_order>
224
+ <show_in_default>1</show_in_default>
225
+ <show_in_website>1</show_in_website>
226
+ </heading_restrictions>
227
+ <allowspecific translate="label">
228
+ <label>Payment from Applicable Countries</label>
229
+ <frontend_type>allowspecific</frontend_type>
230
+ <sort_order>710</sort_order>
231
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
232
+ <show_in_default>1</show_in_default>
233
+ <show_in_website>1</show_in_website>
234
+ <show_in_store>0</show_in_store>
235
+ </allowspecific>
236
+ <specificcountry translate="label">
237
+ <label>Payment from Specific Countries</label>
238
+ <frontend_type>multiselect</frontend_type>
239
+ <sort_order>720</sort_order>
240
+ <source_model>adminhtml/system_config_source_country</source_model>
241
+ <show_in_default>1</show_in_default>
242
+ <show_in_website>1</show_in_website>
243
+ <show_in_store>0</show_in_store>
244
+ <!--depends><allowspecific>1</allowspecific></depends-->
245
+ </specificcountry>
246
+ <min_order_total translate="label">
247
+ <label>Minimum Order Total</label>
248
+ <frontend_type>text</frontend_type>
249
+ <sort_order>730</sort_order>
250
+ <show_in_default>1</show_in_default>
251
+ <show_in_website>1</show_in_website>
252
+ <show_in_store>0</show_in_store>
253
+ </min_order_total>
254
+ <max_order_total translate="label">
255
+ <label>Maximum Order Total</label>
256
+ <frontend_type>text</frontend_type>
257
+ <sort_order>740</sort_order>
258
+ <show_in_default>1</show_in_default>
259
+ <show_in_website>1</show_in_website>
260
+ <show_in_store>0</show_in_store>
261
+ </max_order_total>
262
+
263
+ <heading_ordercart translate="label">
264
+ <label>Order and Shopping Cart</label>
265
+ <frontend_model>etpaymentrobokassa/adminhtml_system_config_form_field_heading</frontend_model>
266
+ <sort_order>810</sort_order>
267
+ <show_in_default>1</show_in_default>
268
+ <show_in_website>1</show_in_website>
269
+ </heading_ordercart>
270
+ <order_status translate="label">
271
+ <label>New Order Status</label>
272
+ <comment><![CDATA[Order will receive this status right after creation. Status will be changed the moment payment is received.]]></comment>
273
+ <frontend_type>select</frontend_type>
274
+ <source_model>adminhtml/system_config_source_order_status_new</source_model>
275
+ <sort_order>820</sort_order>
276
+ <show_in_default>1</show_in_default>
277
+ <show_in_website>1</show_in_website>
278
+ <show_in_store>0</show_in_store>
279
+ </order_status>
280
+ <cart_refill translate="label comment">
281
+ <label>Do not empty Cart</label>
282
+ <comment><![CDATA[If Yes - Shopping cart will be refilled if payment failed.]]></comment>
283
+ <frontend_type>select</frontend_type>
284
+ <source_model>adminhtml/system_config_source_yesno</source_model>
285
+ <sort_order>830</sort_order>
286
+ <show_in_default>1</show_in_default>
287
+ <show_in_website>1</show_in_website>
288
+ <show_in_store>0</show_in_store>
289
+ </cart_refill>
290
+ </fields>
291
+ </etrobokassa>
292
+ </groups>
293
+ </payment>
294
+ </sections>
295
+ </config>
296
+
297
+
298
+
299
+
app/code/community/ET/PaymentRobokassa/sql/etpaymentrobokassa_setup/mysql4-install-1.0.0.php ADDED
@@ -0,0 +1,84 @@
1
+ <?php
2
+ /**
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * You may not sell, sub-license, rent or lease
6
+ * any portion of the Software or Documentation to anyone.
7
+ *
8
+ * DISCLAIMER
9
+ *
10
+ * Do not edit or add to this file if you wish to upgrade to newer
11
+ * versions in the future.
12
+ *
13
+ * @category ET
14
+ * @package ET_PaymentRobokassa
15
+ * @copyright Copyright (c) 2013 ET Web Solutions (http://etwebsolutions.com)
16
+ * @contacts support@etwebsolutions.com
17
+ * @license http://shop.etwebsolutions.com/etws-license-free-v1/ ETWS Free License (EFL1)
18
+ */
19
+
20
+ $installstatus = version_compare(Mage::getVersion(), '1.4.2.0', '>');
21
+
22
+ if ($installstatus) {
23
+ /* @var $installer Mage_Sales_Model_Entity_Setup */
24
+ $installer = $this;
25
+
26
+ $installer->startSetup();
27
+ $statusTable = $installer->getTable('sales/order_status');
28
+ $statusStateTable = $installer->getTable('sales/order_status_state');
29
+ $statusLabelTable = $installer->getTable('sales/order_status_label');
30
+
31
+ $paymentStatuses = array();
32
+ $paymentStatuses[] = array(
33
+ 'status' => 'waiting_robokassa',
34
+ 'label' => 'Waiting Robokassa payment');
35
+ $paymentStatuses[] = array(
36
+ 'status' => 'error_robokassa',
37
+ 'label' => 'Error data from Robokassa');
38
+ $paymentStatuses[] = array(
39
+ 'status' => 'paid_robokassa',
40
+ 'label' => 'Paid by Robokassa');
41
+
42
+ foreach ($paymentStatuses as $paymentStatus) {
43
+ try {
44
+ $installer->getConnection()->insertArray($statusTable, array('status', 'label'), array($paymentStatus));
45
+ } catch (Exception $e) {
46
+ //none
47
+ }
48
+ }
49
+
50
+ $paymentStatusToState = array();
51
+ $paymentStatusToState[] = array(
52
+ 'status' => 'waiting_robokassa',
53
+ 'state' => 'new',
54
+ 'is_default' => 0
55
+ );
56
+
57
+ $paymentStatusToState[] = array(
58
+ 'status' => 'error_robokassa',
59
+ 'state' => 'new',
60
+ 'is_default' => 0
61
+ );
62
+
63
+ $paymentStatusToState[] = array(
64
+ 'status' => 'paid_robokassa',
65
+ 'state' => 'processing',
66
+ 'is_default' => 0
67
+ );
68
+
69
+ foreach ($paymentStatusToState as $statusToState) {
70
+ try {
71
+ $installer->getConnection()->insertArray(
72
+ $statusStateTable,
73
+ array('status', 'state', 'is_default'),
74
+ array($statusToState)
75
+ );
76
+ } catch (Exception $e) {
77
+ //none
78
+ }
79
+ }
80
+
81
+ $installer->endSetup();
82
+ } else {
83
+ // statuses for old Magento versions are in config.xml
84
+ }
app/design/adminhtml/default/default/template/et_paymentrobokassa/single/form.phtml ADDED
@@ -0,0 +1,22 @@
1
+ <?php
2
+ /**
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * You may not sell, sub-license, rent or lease
6
+ * any portion of the Software or Documentation to anyone.
7
+ *
8
+ * DISCLAIMER
9
+ *
10
+ * Do not edit or add to this file if you wish to upgrade to newer
11
+ * versions in the future.
12
+ *
13
+ * @category ET
14
+ * @package ET_PaymentRobokassa
15
+ * @copyright Copyright (c) 2013 ET Web Solutions (http://etwebsolutions.com)
16
+ * @contacts support@etwebsolutions.com
17
+ * @license http://shop.etwebsolutions.com/etws-license-free-v1/ ETWS Free License (EFL1)
18
+ */
19
+ ?>
20
+ <fieldset class="form-list">
21
+ <?php echo $this->getMethod()->getTitle() ?>
22
+ </fieldset>
app/design/adminhtml/default/default/template/et_paymentrobokassa/single/info.phtml ADDED
@@ -0,0 +1,20 @@
1
+ <?php
2
+ /**
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * You may not sell, sub-license, rent or lease
6
+ * any portion of the Software or Documentation to anyone.
7
+ *
8
+ * DISCLAIMER
9
+ *
10
+ * Do not edit or add to this file if you wish to upgrade to newer
11
+ * versions in the future.
12
+ *
13
+ * @category ET
14
+ * @package ET_PaymentRobokassa
15
+ * @copyright Copyright (c) 2013 ET Web Solutions (http://etwebsolutions.com)
16
+ * @contacts support@etwebsolutions.com
17
+ * @license http://shop.etwebsolutions.com/etws-license-free-v1/ ETWS Free License (EFL1)
18
+ */
19
+ ?>
20
+ <p><?php echo $this->getMethod()->getTitle() ?></p>
app/design/frontend/base/default/template/et_paymentrobokassa/single/form.phtml ADDED
@@ -0,0 +1,28 @@
1
+ <?php
2
+ /**
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * You may not sell, sub-license, rent or lease
6
+ * any portion of the Software or Documentation to anyone.
7
+ *
8
+ * DISCLAIMER
9
+ *
10
+ * Do not edit or add to this file if you wish to upgrade to newer
11
+ * versions in the future.
12
+ *
13
+ * @category ET
14
+ * @package ET_PaymentRobokassa
15
+ * @copyright Copyright (c) 2013 ET Web Solutions (http://etwebsolutions.com)
16
+ * @contacts support@etwebsolutions.com
17
+ * @license http://shop.etwebsolutions.com/etws-license-free-v1/ ETWS Free License (EFL1)
18
+ */
19
+
20
+ $descr = $this->getMethod()->getDescription();
21
+ if (strlen($descr) > 0) {
22
+ ?>
23
+ <ul class="form-list" id="payment_form_<?php echo $this->getMethodCode() ?>" style="display:none;">
24
+ <li><?php echo $descr;?></li>
25
+ </ul>
26
+ <?php
27
+ }
28
+ ?>
app/design/frontend/base/default/template/et_paymentrobokassa/single/info.phtml ADDED
@@ -0,0 +1,20 @@
1
+ <?php
2
+ /**
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * You may not sell, sub-license, rent or lease
6
+ * any portion of the Software or Documentation to anyone.
7
+ *
8
+ * DISCLAIMER
9
+ *
10
+ * Do not edit or add to this file if you wish to upgrade to newer
11
+ * versions in the future.
12
+ *
13
+ * @category ET
14
+ * @package ET_PaymentRobokassa
15
+ * @copyright Copyright (c) 2013 ET Web Solutions (http://etwebsolutions.com)
16
+ * @contacts support@etwebsolutions.com
17
+ * @license http://shop.etwebsolutions.com/etws-license-free-v1/ ETWS Free License (EFL1)
18
+ */
19
+ ?>
20
+ <p><?php echo $this->getMethod()->getTitle() ?></p>
app/etc/modules/ET_PaymentRobokassa.xml ADDED
@@ -0,0 +1,33 @@
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * You may not sell, sub-license, rent or lease
7
+ * any portion of the Software or Documentation to anyone.
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade to newer
12
+ * versions in the future.
13
+ *
14
+ * @category ET
15
+ * @package ET_PaymentRobokassa
16
+ * @copyright Copyright (c) 2013 ET Web Solutions (http://etwebsolutions.com)
17
+ * @contacts support@etwebsolutions.com
18
+ * @license http://shop.etwebsolutions.com/etws-license-free-v1/ ETWS Free License (EFL1)
19
+ */
20
+ -->
21
+
22
+ <config>
23
+ <modules>
24
+ <ET_PaymentRobokassa>
25
+ <active>true</active>
26
+ <codePool>community</codePool>
27
+ <depends>
28
+ <Mage_Sales />
29
+ <Mage_Payment />
30
+ </depends>
31
+ </ET_PaymentRobokassa>
32
+ </modules>
33
+ </config>
app/locale/en_US/ET_PaymentRobokassa.csv ADDED
File without changes
app/locale/ru_RU/ET_PaymentRobokassa.csv ADDED
@@ -0,0 +1,62 @@
1
+ "Extension:","Модуль:"
2
+ "<strong>%s</strong> (version %s)","<strong>%s</strong> (версия %s)"
3
+ "License:","Лицензия:"
4
+ "Short Description:","Краткое описание:"
5
+ "Documentation:","Документация:"
6
+ "Support:","Поддержка:"
7
+ "Advertisement:","Реклама:"
8
+ "You can see description of extension features and answers to the frequently asked questions on <a href=""%s"" target=""_balnk"">our website</a>.","Описание позможностей модуля и ответы на часто задаваемые вопросы смотрите на <a href=""%s"" target=""_balnk"">нашем сайте</a>."
9
+ "You can hire our team to customize the extension. E-mail us on sales@etwebsolutions.com.<br><br>You can see a list of provided services on <a href=""%s"" target=""_blank"">our website</a>.","Вы можете нанять нашу команду для любых работ по модификации модуля. Пишите на адрес sales@etwebsolutions.com.<br><br>Со списком предоставляемых нами услуг вы можете ознакомиться <a href=""%s"" target=""_blank"">на нашем сайте</a>."
10
+ "Extension support is available through <a href=""%s"" target=""_blank"">issue tracking system</a>.<br>You can see information freely, but you will have to sign up to open a ticket.<br><br>Please, report all bugs and feature requests that are related to this extension.<br><br>If by some reason you can not submit a question, bug report or feature request to our ticket system, you can write us an email - support@etwebsolutions.com.","Поддержка модуля осуществляется через <a href=""%s"" target=""_blank"">систему отслеживания заданий</a>.<br>Для создания задачи будет необходимо зарегистрироваться. Для просмотра информации регистрация не требуется.<br><br>Пожалуйста, сообщайте нам о найденных ошибках и о своих пожеланиях в рамках этого модуля.<br><br>Если по каким-либо причинам вы не можете размеситить вопрос/сообщение об ошибке/пожелание в списке задач, то можете написать нам по адресу support@etwebsolutions.com."
11
+
12
+ "Payment Robokassa information","Информация о платежном модуле Робокасса"
13
+ "Payment Robokassa Options","Настройки модуля Робокасса"
14
+ "Settings","Настройки"
15
+ "Go to Payment Methods settings section","Перейти к секции настроек Методов Оплаты"
16
+ "Extension options available in System -> Configuration -> Sales -> Payment Methods -> Robokassa by ET Web Solutions","Настройки модуля находятся в Система -> Конфигурация -> Продажи -> Методы оплаты"
17
+ "Extension information","Информация о модуле"
18
+ "Enabled","Включен"
19
+ "Title","Заголовок"
20
+ "Description","Описание"
21
+ "Sort order","Порядок сортировки"
22
+ "Robokassa Gateway options","Настройки соединения платёжным сервисом Робокасса"
23
+ "Test Mode","Тестовый режим"
24
+ "If Enabled - module will connect Robokassa test server for transactions. This server available only for new merchants (not activated).","Если включен - модуль будет подключаться к тестовому серверу Робокассы для транзакций. Данный сервер доступен для использования только для новых продавцов (непрошедших процедуру активации)."
25
+ "Debug Mode","Режим о