Chrono - Version 1.0.0

Version Notes

1.0.0

Download this release

Release Info

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


Version 1.0.0

app/code/community/Magetrix/Chrono/Block/Form.php ADDED
@@ -0,0 +1,12 @@
1
+ <?php
2
+
3
+
4
+ class Magetrix_Chrono_Block_Form extends Mage_Payment_Block_Form
5
+ {
6
+ protected function _construct()
7
+ {
8
+ parent::_construct();
9
+ $this->setTemplate('magetrix/chrono/form.phtml');
10
+
11
+ }
12
+ }
app/code/community/Magetrix/Chrono/Block/Info.php ADDED
@@ -0,0 +1,9 @@
1
+ <?php
2
+
3
+ class Magetrix_Chrono_Block_Info extends Mage_Payment_Block_Info {
4
+
5
+ protected function _construct() {
6
+ parent::_construct();
7
+ $this->setTemplate('magetrix/chrono/info.phtml');
8
+ }
9
+ }
app/code/community/Magetrix/Chrono/Block/Magentrix.php ADDED
@@ -0,0 +1,65 @@
1
+ <?php
2
+
3
+ class Magetrix_Chrono_Block_Magentrix extends Mage_Adminhtml_Block_System_Config_Form_Fieldset {
4
+
5
+ public function render(Varien_Data_Form_Element_Abstract $element) {
6
+ $content.= '<p></p>';
7
+ $content.= '<style>';
8
+ $content.= '.magtrix {
9
+ background:#FAFAFA;
10
+ border: 1px solid #CCCCCC;
11
+ margin-bottom: 10px;
12
+ padding: 10px;
13
+ height:auto;
14
+
15
+ }
16
+ .magtrix h3 {
17
+ color: #EA7601;
18
+ }
19
+ .contact-type {
20
+ color: #EA7601;
21
+ font-weight:bold;
22
+ }
23
+ .magtrix img {
24
+ border: 1px solid #CCCCCC;
25
+ float:left;
26
+ height:235px;
27
+ }
28
+ .magtrix .info {
29
+ border: 1px solid #CCCCCC;
30
+ background:#E7EFEF;
31
+ padding: 5px 10px 0 5px;
32
+ margin-left:215px;
33
+ height:230px;
34
+ }
35
+ ';
36
+ $content.= '</style>';
37
+
38
+
39
+ $content.= '<div class="magtrix">';
40
+ $content.= '<img src="'.Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN).'frontend/default/default/magetrix/general/magetrix.jpg" alt="www.magetrix.com" />';
41
+ $content.= '<div class="info">';
42
+ $content.= '<h3>Magento extensions</h3>';
43
+ $content.= '<a href="http://www.magetrix.com/" target="_blank">www.magetrix.com</a> - experts are specializing in custom extension development for the world\'s fastest growing eCommerce platform - Magento. <br/>';
44
+ $content.= 'All extensions are designed for the Magento CMS archetecture, using native libraries and only the most efficient approaches to development.<br/>';
45
+ $content.= 'If you need Magento development or have a concept for an extension you\'d like developed for the Magento CMS platform, please contact us.</br>';
46
+ $content.= '-----------------------------------------------------<br>';
47
+ $content.= '<span class="contact-type">Company website:</span> <a href="http://www.magetrix.com/" target="_blank">www.magetrix.com</a> <br/>';
48
+ $content.= '<span class="contact-type">E-mail:</span> volgodark@gmail.com <br/>';
49
+ $content.= '<span class="contact-type">Skype:</span> volgodark <br/>';
50
+ $content.= '<span class="contact-type">Phone:</span> +7 909389 2222 <br/>';
51
+ // $content.= '<span class="contact-type">Magento profile:</span> <a href="http://www.magentocommerce.com/magento-connect/developer/Magetrix" target="_blank">visit</a> <br/>';
52
+ // $content.= '<span class="contact-type">LinkedIn profile:</span> <a href="http://www.linkedin.com/pub/ivan-proskuryakov/31/200/316" target="_blank">visit</a> <br/>';
53
+ // $content.= '<span class="contact-type">Facebook profile:</span> <a href="http://www.facebook.com/ivan.proskuryakov" target="_blank">visit</a> <br/>';
54
+
55
+ $content.= '</div>';
56
+
57
+ $content.= '</div>';
58
+
59
+ return $content;
60
+
61
+
62
+ }
63
+
64
+
65
+ }
app/code/community/Magetrix/Chrono/Block/Redirect.php ADDED
@@ -0,0 +1,32 @@
1
+ <?php
2
+
3
+ class Magetrix_Chrono_Block_Redirect extends Mage_Core_Block_Abstract
4
+ {
5
+ protected function _toHtml()
6
+ {
7
+ $chrono = Mage::getModel('chrono/checkout');
8
+ $form = new Varien_Data_Form();
9
+ $form->setAction($chrono->getChronoUrl())
10
+ ->setId('pay')
11
+ ->setName('pay')
12
+ ->setMethod('POST')
13
+ ->setUseContainer(true);
14
+ foreach ($chrono->getFormFields() as $field=>$value) {
15
+ $form->addField($field, 'hidden', array('name'=>$field, 'value'=>$value));
16
+ echo 'name=>'.$field.'value=>'.$value.'<br>';
17
+ }
18
+
19
+ $form->addField('input', 'submit', array('value'=>'Pay'));
20
+
21
+ $html = '<html><body>';
22
+ $html.= Mage::getStoreConfig('payment/chrono/redirecttext');
23
+ $html.= '<br>';
24
+ $html.= $form->toHtml();
25
+ $html.= '<br>';
26
+ // $html.= '<script type="text/javascript">document.getElementById("pay").submit();</script>';
27
+ $html.= '</body></html>';
28
+
29
+
30
+ return $html;
31
+ }
32
+ }
app/code/community/Magetrix/Chrono/Helper/Data.php ADDED
@@ -0,0 +1,6 @@
1
+ <?php
2
+
3
+ class Magetrix_Chrono_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+
6
+ }
app/code/community/Magetrix/Chrono/Model/Checkout.php ADDED
@@ -0,0 +1,70 @@
1
+ <?php
2
+
3
+ class Magetrix_Chrono_Model_Checkout extends Mage_Payment_Model_Method_Abstract {
4
+
5
+ protected $_code = 'chrono';
6
+ protected $_formBlockType = 'chrono/form';
7
+ protected $_infoBlockType = 'chrono/info';
8
+
9
+
10
+ public function getCheckout() {
11
+ return Mage::getSingleton('checkout/session');
12
+ }
13
+
14
+ public function getOrderPlaceRedirectUrl() {
15
+ return Mage::getUrl('chrono/redirect', array('_secure' => true));
16
+ }
17
+
18
+ public function getChronoUrl() {
19
+ $url = 'https://payments.chronopay.com/';
20
+ return $url;
21
+ }
22
+
23
+ public function getQuote() {
24
+
25
+ $orderIncrementId = $this->getCheckout()->getLastRealOrderId();
26
+ $order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
27
+ return $order;
28
+ }
29
+
30
+ public function getFormFields() {
31
+
32
+ $order_id = $this->getCheckout()->getLastRealOrderId();
33
+ $order = Mage::getModel('sales/order')->loadByIncrementId($order_id);
34
+ $amount = trim(round($order->getGrandTotal(), 2));
35
+ $product_id = Mage::getStoreConfig('payment/chrono/product_id');
36
+ $sharedsec = Mage::getStoreConfig('payment/chrono/sharedsec');
37
+ $sign = md5($product_id.'-'.$amount.'-'.$sharedsec);
38
+
39
+ $params = array(
40
+ 'product_id' => $product_id,
41
+ 'product_price' => $amount,
42
+ 'cb_url' => Mage::getUrl('chrono/redirect/callback'),
43
+ 'success_url' => Mage::getUrl('chrono/redirect/success'),
44
+ 'decline_url' => Mage::getUrl('chrono/redirect/decline'),
45
+ 'sign' => $sign,
46
+ 'cs1' => Mage::helper('chrono')->__('Payment for order #').$order_id,
47
+ );
48
+
49
+ return $params;
50
+
51
+
52
+ }
53
+ }
54
+
55
+
56
+
57
+
58
+
59
+ //<form action="https://payments.chrono.com/" method="POST">
60
+ //<input type="hidden" name="product_id" value="000214-0001-0001" />
61
+ //<input type="hidden" name="product_price" value="12.34" />
62
+ //
63
+ //<input type="hidden" name="cs1" value="client value 1" />
64
+ //
65
+ //<input type="hidden" name="cb_url" value="https://example.com/callback/" />
66
+ //<input type="hidden" name="success_url" value="https://example.com/payment_success/" />
67
+ //<input type="hidden" name="decline_url" value="https://example.com/payment_failed/" />
68
+ //<input type="hidden" name="sign" value="27cca10af110fa9d13861de1f6ba34c4" />
69
+ //<input type="submit" value="Pay via ChronoPay" />
70
+ //</form>
app/code/community/Magetrix/Chrono/controllers/RedirectController.php ADDED
@@ -0,0 +1,39 @@
1
+ <?php
2
+
3
+ class Magetrix_Chrono_RedirectController extends Mage_Core_Controller_Front_Action {
4
+
5
+ protected $_order;
6
+
7
+ protected function _expireAjax() {
8
+ if (!Mage::getSingleton('checkout/session')->getQuote()->hasItems()) {
9
+ $this->getResponse()->setHeader('HTTP/1.1','403 Session Expired');
10
+ exit;
11
+ }
12
+ }
13
+
14
+ public function indexAction() {
15
+ $this->getResponse()
16
+ ->setHeader('Content-type', 'text/html; charset=utf8')
17
+ ->setBody($this->getLayout()
18
+ ->createBlock('chrono/redirect')
19
+ ->toHtml());
20
+ }
21
+
22
+ public function callbackAction() {
23
+ header( 'Location: ' . Mage::helper('checkout/url')->getCheckoutUrl() );
24
+ }
25
+
26
+ public function declineAction() {
27
+ Mage::getSingleton('core/session')->addError('Choronopay: Your transaction has been declined.');
28
+ $this->_redirect('customer/account/', array('_secure'=>true));
29
+ }
30
+
31
+ public function successAction() {
32
+ Mage::getSingleton('core/session')->addSuccess('Choronopay: Your transaction not accepted.');
33
+ Mage::getSingleton('checkout/session')->getQuote()->setIsActive(false)->save();
34
+ $this->_redirect('checkout/onepage/success', array('_secure'=>true));
35
+ }
36
+
37
+ }
38
+
39
+ ?>
app/code/community/Magetrix/Chrono/etc/config.xml ADDED
@@ -0,0 +1,95 @@
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Magetrix_Chrono>
5
+ <version>1.0.0</version>
6
+ </Magetrix_Chrono>
7
+ </modules>
8
+ <global>
9
+ <models>
10
+ <chrono>
11
+ <class>Magetrix_Chrono_Model</class>
12
+ </chrono>
13
+ </models>
14
+ <blocks>
15
+ <chrono>
16
+ <class>Magetrix_Chrono_Block</class>
17
+ </chrono>
18
+ </blocks>
19
+ <resources>
20
+ <chrono_setup>
21
+ <setup>
22
+ <module>Magetrix_Chrono</module>
23
+ </setup>
24
+ <connection>
25
+ <use>core_setup</use>
26
+ </connection>
27
+ </chrono_setup>
28
+ <chrono_write>
29
+ <connection>
30
+ <use>core_write</use>
31
+ </connection>
32
+ </chrono_write>
33
+ <chrono_read>
34
+ <connection>
35
+ <use>core_read</use>
36
+ </connection>
37
+ </chrono_read>
38
+ </resources>
39
+ <helpers>
40
+ <chrono>
41
+ <class>Magetrix_Chrono_Helper</class>
42
+ </chrono>
43
+ </helpers>
44
+ </global>
45
+ <frontend>
46
+ <secure_url>
47
+ <chrono_redirect>/chrono/redirect/</chrono_redirect>
48
+ </secure_url>
49
+ <routers>
50
+ <chrono>
51
+ <use>standard</use>
52
+ <args>
53
+ <module>Magetrix_Chrono</module>
54
+ <frontName>chrono</frontName>
55
+ </args>
56
+ </chrono>
57
+ </routers>
58
+ <translate>
59
+ <modules>
60
+ <Magetrix_Chrono>
61
+ <files>
62
+ <default>Magetrix_Chrono.csv</default>
63
+ </files>
64
+ </Magetrix_Chrono>
65
+ </modules>
66
+ </translate>
67
+ </frontend>
68
+ <adminhtml>
69
+ <translate>
70
+ <modules>
71
+ <Magetrix_Chrono>
72
+ <files>
73
+ <default>Magetrix_Chrono.csv</default>
74
+ </files>
75
+ </Magetrix_Chrono>
76
+ </modules>
77
+ </translate>
78
+ </adminhtml>
79
+ <default>
80
+ <payment>
81
+ <chrono>
82
+ <active>0</active>
83
+ <model>chrono/checkout</model>
84
+ <title> -- Chronopay --</title>
85
+ <info>You will be redirected to Chronopay.com website when you place an order...</info>
86
+ <redirecttext>Entering Chronopay.com ...</redirecttext>
87
+ <client_id>000000</client_id>
88
+ <site_id>000000-0001</site_id>
89
+ <product_id>000000-0001-0001</product_id>
90
+ <sharedsec>sharedsec</sharedsec>
91
+ <order_status>processing</order_status>
92
+ </chrono>
93
+ </payment>
94
+ </default>
95
+ </config>
app/code/community/Magetrix/Chrono/etc/system.xml ADDED
@@ -0,0 +1,129 @@
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <payment>
5
+ <groups>
6
+ <chrono translate="label" module="chrono">
7
+ <label>Chronopay.com</label>
8
+ <frontend_type>text</frontend_type>
9
+ <sort_order>103</sort_order>
10
+ <show_in_default>1</show_in_default>
11
+ <show_in_website>1</show_in_website>
12
+ <show_in_store>0</show_in_store>
13
+
14
+ <fields>
15
+ <active translate="label">
16
+ <label>Enabled</label>
17
+ <frontend_type>select</frontend_type>
18
+ <source_model>adminhtml/system_config_source_yesno</source_model>
19
+ <sort_order>1</sort_order>
20
+ <show_in_default>1</show_in_default>
21
+ <show_in_website>1</show_in_website>
22
+ <show_in_store>0</show_in_store>
23
+ </active>
24
+ <product_id translate="label">
25
+ <label>Product ID</label>
26
+ <frontend_type>text</frontend_type>
27
+ <sort_order>2</sort_order>
28
+ <show_in_default>1</show_in_default>
29
+ <show_in_website>1</show_in_website>
30
+ <show_in_store>0</show_in_store>
31
+ </product_id>
32
+ <sharedsec translate="label">
33
+ <label>Sharedsec</label>
34
+ <frontend_type>text</frontend_type>
35
+ <sort_order>3</sort_order>
36
+ <show_in_default>1</show_in_default>
37
+ <show_in_website>1</show_in_website>
38
+ <show_in_store>0</show_in_store>
39
+ </sharedsec>
40
+ <title translate="label">
41
+ <label>Title</label>
42
+ <frontend_type>text</frontend_type>
43
+ <sort_order>11</sort_order>
44
+ <show_in_default>1</show_in_default>
45
+ <show_in_website>1</show_in_website>
46
+ <show_in_store>0</show_in_store>
47
+ </title>
48
+ <info translate="label">
49
+ <label>Text for info</label>
50
+ <frontend_type>text</frontend_type>
51
+ <sort_order>12</sort_order>
52
+ <show_in_default>1</show_in_default>
53
+ <show_in_website>1</show_in_website>
54
+ <show_in_store>0</show_in_store>
55
+ </info>
56
+ <redirecttext translate="label">
57
+ <label>Text for redirect</label>
58
+ <frontend_type>text</frontend_type>
59
+ <sort_order>13</sort_order>
60
+ <show_in_default>1</show_in_default>
61
+ <show_in_website>1</show_in_website>
62
+ <show_in_store>0</show_in_store>
63
+ </redirecttext>
64
+ <!-- <client_id translate="label">
65
+ <label>Client ID</label>
66
+ <frontend_type>text</frontend_type>
67
+ <sort_order>5</sort_order>
68
+ <show_in_default>1</show_in_default>
69
+ <show_in_website>1</show_in_website>
70
+ <show_in_store>0</show_in_store>
71
+ </client_id>
72
+ <site_id translate="label">
73
+ <label>Site ID</label>
74
+ <frontend_type>text</frontend_type>
75
+ <sort_order>6</sort_order>
76
+ <show_in_default>1</show_in_default>
77
+ <show_in_website>1</show_in_website>
78
+ <show_in_store>0</show_in_store>
79
+ </site_id>-->
80
+ <order_status translate="label">
81
+ <label>New order status</label>
82
+ <frontend_type>select</frontend_type>
83
+ <source_model>adminhtml/system_config_source_order_status_processing</source_model>
84
+ <sort_order>22</sort_order>
85
+ <show_in_default>1</show_in_default>
86
+ <show_in_website>1</show_in_website>
87
+ <show_in_store>0</show_in_store>
88
+ </order_status>
89
+ <allowspecific translate="label">
90
+ <label>Payment from applicable countries</label>
91
+ <frontend_type>allowspecific</frontend_type>
92
+ <sort_order>50</sort_order>
93
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
94
+ <show_in_default>1</show_in_default>
95
+ <show_in_website>1</show_in_website>
96
+ <show_in_store>0</show_in_store>
97
+ </allowspecific>
98
+ <specificcountry translate="label">
99
+ <label>Payment from Specific countries</label>
100
+ <frontend_type>multiselect</frontend_type>
101
+ <sort_order>51</sort_order>
102
+ <source_model>adminhtml/system_config_source_country</source_model>
103
+ <show_in_default>1</show_in_default>
104
+ <show_in_website>1</show_in_website>
105
+ <show_in_store>0</show_in_store>
106
+ </specificcountry>
107
+ <!-- <about translate="label">
108
+ <label>Developer</label>
109
+ <frontend_type>text</frontend_type>
110
+ <frontend_model>chrono/developer</frontend_model>
111
+ <sort_order>70</sort_order>
112
+ <show_in_default>1</show_in_default>
113
+ <show_in_website>1</show_in_website>
114
+ <show_in_store>1</show_in_store>
115
+ </about>-->
116
+ </fields>
117
+ </chrono>
118
+ <magentrix>
119
+ <frontend_model>chrono/magentrix</frontend_model>
120
+ <sort_order>9999</sort_order>
121
+ <show_in_default>1</show_in_default>
122
+ <show_in_website>1</show_in_website>
123
+ <show_in_store>1</show_in_store>
124
+ </magentrix>
125
+ </groups>
126
+
127
+ </payment>
128
+ </sections>
129
+ </config>
app/design/frontend/default/default/template/magetrix/chrono/form.phtml ADDED
@@ -0,0 +1,3 @@
1
+ <?php
2
+ echo Mage::getStoreConfig('payment/chrono/info');
3
+ ?>
app/design/frontend/default/default/template/magetrix/chrono/info.phtml ADDED
@@ -0,0 +1,4 @@
1
+ <?php
2
+ echo Mage::getStoreConfig('payment/chrono/title');
3
+ ?>
4
+
app/etc/modules/Magetrix_Chrono.xml ADDED
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Magetrix_Chrono>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Magetrix_Chrono>
8
+ </modules>
9
+ </config>
app/locale/en_US/Magetrix_Chrono.csv ADDED
File without changes
package.xml ADDED
@@ -0,0 +1,18 @@
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Chrono</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license>GPL</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Chrono</summary>
10
+ <description>Chrono</description>
11
+ <notes>1.0.0</notes>
12
+ <authors><author><name>volgodark</name><user>auto-converted</user><email>volgodark@gmail.com</email></author></authors>
13
+ <date>2011-04-12</date>
14
+ <time>09:56:35</time>
15
+ <contents><target name="magelocale"><dir name="en_US"><file name="Magetrix_Chrono.csv" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="magetrix"><dir name="general"><file name="magetrix.jpg" hash="286b5647bcf2fa35163d655ad4965414"/></dir></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="magetrix"><dir name="chrono"><file name="form.phtml" hash="5f2a6f09578dc497411a6299249161d0"/><file name="info.phtml" hash="289ab12c3774a99b4dd5adf9a1ab0b71"/></dir></dir></dir></dir></dir></dir></target><target name="magecommunity"><dir name="Magetrix"><dir name="Chrono"><dir name="Block"><file name="Form.php" hash="de66e85db42b623f6df9695566ae7455"/><file name="Info.php" hash="8c43420e2b98e9384d4d054b0660a529"/><file name="Magentrix.php" hash="147bb71e7ab37e05adeea1223bc606b7"/><file name="Redirect.php" hash="bed163026eb06e51dcda4428c91b05bc"/></dir><dir name="controllers"><file name="RedirectController.php" hash="57cb66f30c384a282d471ac06cb7fe3e"/></dir><dir name="etc"><file name="config.xml" hash="5803243466a5a46d2484864a3d02d8df"/><file name="system.xml" hash="0df0862415a073f8d03faa05de085407"/></dir><dir name="Helper"><file name="Data.php" hash="33f83d7cd4005d9f7649ad29f0388f19"/></dir><dir name="Model"><file name="Checkout.php" hash="8614d8171742bb2dbeb8f04e218af58e"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Magetrix_Chrono.xml" hash="970927db797b1ee2c71dd7f47c617a53"/></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies/>
18
+ </package>
skin/frontend/default/default/magetrix/general/magetrix.jpg ADDED
Binary file