gate2play - Version 1.0.0

Version Notes

Tested and it works fine

Download this release

Release Info

Developer Ahmad Hattab
Extension gate2play
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/local/Gate2play/Onlinepayment/Block/Form.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Gate2play_Onlinepayment_Block_Form extends Mage_Payment_Block_Form {
3
+ protected function _construct()
4
+ {
5
+ parent::_construct();
6
+ $this->setTemplate('gate2play/onlinepayment/form.phtml');
7
+ }
8
+
9
+ public function getG2pTypes()
10
+ {
11
+ $availableTypes = Mage::getStoreConfig('payment/onlinepayment/g2ptypes');
12
+ if ($availableTypes) {
13
+ $availableTypes = explode(',', $availableTypes);
14
+ foreach ($availableTypes as $key=>$code){
15
+ $types[] = Mage::helper('onlinepayment')->getPaymentLabel($code);
16
+ }
17
+ }
18
+ return $types;
19
+ }
20
+
21
+ }
app/code/local/Gate2play/Onlinepayment/Block/Payment.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Gate2play_Onlinepayment_Block_Payment extends Mage_Core_Block_Template{
3
+
4
+ protected function _getSession(){
5
+ return Mage::getSingleton('checkout/session');
6
+ }
7
+
8
+ public function getGatewayUrl(){
9
+ return Mage::getStoreConfig('payment/onlinepayment/gw_url');
10
+ }
11
+ public function getUrlValues(){
12
+ $session = $this->_getSession();
13
+ $msignature = md5(Mage::getStoreConfig('payment/onlinepayment/appid') .
14
+ $session->getLastRealOrderId() .
15
+ strtolower(Mage::app()->getStore()->getCurrentCurrencyCode()) .
16
+ number_format($session->getQuote()->getGrandTotal(), 2, ".","") .
17
+ Mage::helper('core')->decrypt(Mage::getStoreConfig('payment/onlinepayment/app_sec_key'))
18
+ );
19
+ $values = array(
20
+ 'meid' => Mage::getStoreConfig('payment/onlinepayment/meid'),
21
+ 'appid' => Mage::getStoreConfig('payment/onlinepayment/appid'),
22
+ 'customer_email' => $session->getQuote()->getCustomer()->getEmail(),
23
+ 'currency' => strtolower(Mage::app()->getStore()->getCurrentCurrencyCode()),
24
+ 'orderId' => $session->getLastRealOrderId(),
25
+ 'amount' => number_format($session->getQuote()->getGrandTotal(), 2, ".",""),
26
+ 'msignature' => $msignature,
27
+ );
28
+ return $values;
29
+ }
30
+ }
app/code/local/Gate2play/Onlinepayment/Helper/Data.php ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Gate2play_Onlinepayment_Helper_Data extends Mage_Core_Helper_Abstract {
3
+ public function getPaymentLabel($code){
4
+ switch ($code){
5
+ case '1':
6
+ return array(
7
+ 'value' => '1',
8
+ 'label' => 'Paypal'
9
+ );
10
+ break;
11
+
12
+ case '39':
13
+ return array(
14
+ 'value' => '39',
15
+ 'label' => 'Visa'
16
+ );
17
+ break;
18
+
19
+ case '40':
20
+ return array(
21
+ 'value' => '40',
22
+ 'label' => 'MasterCard'
23
+ );
24
+ break;
25
+
26
+ case '10':
27
+ return array(
28
+ 'value' => '10',
29
+ 'label' => 'CashU'
30
+ );
31
+ break;
32
+
33
+ case '30':
34
+ return array(
35
+ 'value' => '30',
36
+ 'label' => 'OneCard'
37
+ );
38
+ break;
39
+
40
+ case '31':
41
+ return array(
42
+ 'value' => '31',
43
+ 'label' => 'Ukash'
44
+ );
45
+ break;
46
+
47
+ case '32':
48
+ return array(
49
+ 'value' => '32',
50
+ 'label' => 'Cashna'
51
+ );
52
+ break;
53
+
54
+ case '33':
55
+ return array(
56
+ 'value' => '33',
57
+ 'label' => 'Filspay'
58
+ );
59
+ break;
60
+
61
+ case '35':
62
+ return array(
63
+ 'value' => '35',
64
+ 'label' => 'Dixipay'
65
+ );
66
+ break;
67
+
68
+ case '37':
69
+ return array(
70
+ 'value' => '37',
71
+ 'label' => 'Cashi'
72
+ );
73
+ break;
74
+
75
+ case '38':
76
+ return array(
77
+ 'value' => '38',
78
+ 'label' => 'MangirKart'
79
+ );
80
+ break;
81
+
82
+ case '41':
83
+ return array(
84
+ 'value' => '41',
85
+ 'label' => 'CashU Direct'
86
+ );
87
+ break;
88
+
89
+ case '999':
90
+ return array(
91
+ 'value' => '999',
92
+ 'label' => 'Test Bank'
93
+ );
94
+ break;
95
+ }
96
+ }
97
+ }
app/code/local/Gate2play/Onlinepayment/Model/Observer.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Gate2play_Onlinepayment_Model_Observer{
4
+ public function savePaymentType($observer){
5
+ $session = Mage::getSingleton('checkout/session');
6
+ $order = $observer->getEvent()->getOrder();
7
+ $msignature = md5(Mage::getStoreConfig('payment/onlinepayment/appid') .
8
+ $order->getIncrementId() .
9
+ strtolower(Mage::app()->getStore()->getCurrentCurrencyCode()) .
10
+ number_format($session->getQuote()->getGrandTotal(), 2, ".","") .
11
+ Mage::helper('core')->decrypt(Mage::getStoreConfig('payment/onlinepayment/app_sec_key'))
12
+ );
13
+ Mage::getSingleton('onlinepayment/session')->setData('param',
14
+ array(
15
+ 'meid' => Mage::getStoreConfig('payment/onlinepayment/meid'),
16
+ 'appid' => Mage::getStoreConfig('payment/onlinepayment/appid'),
17
+ 'customer_email' => $session->getQuote()->getCustomer()->getEmail(),
18
+ 'currency' => strtolower(Mage::app()->getStore()->getCurrentCurrencyCode()),
19
+ 'orderId' => $order->getIncrementId(),
20
+ 'amount' => number_format($session->getQuote()->getGrandTotal(), 2, ".",""),
21
+ 'payment_method' => Mage::getSingleton('checkout/session')->getQuote()->getPayment()->getCcType(),
22
+ 'msignature' => $msignature,
23
+ 'width' => Mage::getStoreConfig('payment/onlinepayment/img_width'),
24
+ 'height' => Mage::getStoreConfig('payment/onlinepayment/img_height')
25
+ )
26
+ );
27
+ }
28
+ }
app/code/local/Gate2play/Onlinepayment/Model/Onlinepayment.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Gate2play_Onlinepayment_Model_Onlinepayment extends Mage_Payment_Model_Method_Abstract{
3
+
4
+ protected $_code = 'onlinepayment';
5
+ protected $_formBlockType = 'onlinepayment/form';
6
+ protected $_isInitializeNeeded = true;
7
+ protected $_canUseInternal = false;
8
+ protected $_canUseForMultishipping = false;
9
+
10
+ /**
11
+ * Return Order place redirect url
12
+ *
13
+ * @return string
14
+ */
15
+ public function getOrderPlaceRedirectUrl()
16
+ {
17
+ //when you click on place order you will be redirected on this url.
18
+ return Mage::getUrl('gate2play/payment/redirect', array('_secure' => true));
19
+ }
20
+ }
app/code/local/Gate2play/Onlinepayment/Model/Session.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Gate2play_Onlinepayment_Model_Session extends Mage_Core_Model_Session{
4
+ public function __construct(){
5
+ $this->init('onlinepayment');
6
+ }
7
+ }
app/code/local/Gate2play/Onlinepayment/Model/System/Config/Paymenttype.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Gate2play_Onlinepayment_Model_System_Config_Paymenttype {
3
+ public function toOptionArray()
4
+ {
5
+ $options = array();
6
+ $options[] = array(
7
+ 'value' => '1',
8
+ 'label' => 'Paypal'
9
+ );
10
+ $options[] = array(
11
+ 'value' => '39',
12
+ 'label' => 'Visa'
13
+ );
14
+ $options[] = array(
15
+ 'value' => '40',
16
+ 'label' => 'MasterCard'
17
+ );
18
+ $options[] = array(
19
+ 'value' => '10',
20
+ 'label' => 'CashU'
21
+ );
22
+ $options[] = array(
23
+ 'value' => '30',
24
+ 'label' => 'OneCard'
25
+ );
26
+ $options[] = array(
27
+ 'value' => '31',
28
+ 'label' => 'Ukash'
29
+ );
30
+ $options[] = array(
31
+ 'value' => '32',
32
+ 'label' => 'Cashna'
33
+ );
34
+ $options[] = array(
35
+ 'value' => '33',
36
+ 'label' => 'Filspay'
37
+ );
38
+ $options[] = array(
39
+ 'value' => '35',
40
+ 'label' => 'Dixipay'
41
+ );
42
+ $options[] = array(
43
+ 'value' => '37',
44
+ 'label' => 'Cashi'
45
+ );
46
+ $options[] = array(
47
+ 'value' => '38',
48
+ 'label' => 'MangirKart'
49
+ );
50
+ $options[] = array(
51
+ 'value' => '41',
52
+ 'label' => 'CashU Direct'
53
+ );
54
+ $options[] = array(
55
+ 'value' => '999',
56
+ 'label' => 'Test Bank'
57
+ );
58
+ return $options;
59
+ }
60
+ }
app/code/local/Gate2play/Onlinepayment/Model/System/Config/Postback.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Gate2play_Onlinepayment_Model_System_Config_Postback extends Mage_Adminhtml_Block_System_Config_Form_Fieldset {
3
+
4
+ protected $_dummyElement;
5
+ protected $_fieldRenderer;
6
+ protected $_values;
7
+
8
+ public function render(Varien_Data_Form_Element_Abstract $element) {
9
+ $html = 'test';
10
+ return $html;
11
+ }
12
+
13
+ public function toOptionArray()
14
+ {
15
+ $options = array();
16
+ $options[] = array(
17
+ 'value' => '1',
18
+ 'label' => 'Paypal'
19
+ );
20
+ }
21
+ }
app/code/local/Gate2play/Onlinepayment/controllers/PaymentController.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Gate2play_Onlinepayment_PaymentController extends Mage_Core_Controller_Front_Action {
4
+ public function redirectAction(){
5
+ $this->loadLayout();
6
+ $this->renderLayout();
7
+ }
8
+
9
+ public function postbackAction(){
10
+ $tranid = strtolower($_REQUEST['tranid']);
11
+ $mid = $_REQUEST['mid'];
12
+ $appid = $_REQUEST['appid'];
13
+ $muid = $_REQUEST['muid'];
14
+ $orderId = $_REQUEST['orderid'];
15
+ $aamount = $_REQUEST['aamount'];
16
+ $vvalue = $_REQUEST['vvalue'];
17
+ $currency = strtolower($_REQUEST['currency']);
18
+ $status = $_REQUEST['status'];
19
+ $trandatetime = $_REQUEST['trandatetime'];
20
+ $psignature = $_REQUEST['psignature'];
21
+ $secret = Mage::helper('core')->decrypt(Mage::getStoreConfig('payment/onlinepayment/app_sec_key'));
22
+ if ($status == 1){
23
+ if($psignature == md5($appid . $tranid . $orderId . $muid . $currency . $aamount . $vvalue . $status . $secret)){
24
+ $order = Mage::getModel('sales/order');
25
+ $order->loadByIncrementId($orderId);
26
+ /** trying to create invoice **/
27
+ try {
28
+ if(!$order->canInvoice()):
29
+ Mage::throwException(Mage::helper('core')->__('cannot create an invoice !'));
30
+ else:
31
+ /** create invoice **/
32
+ $invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();
33
+ if(!$invoice->getTotalQty()):
34
+ Mage::throwException(Mage::helper('core')->__('cannot create an invoice without products !'));
35
+ endif;
36
+ $invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_OFFLINE);
37
+ $invoice->register();
38
+ $transactionSave = Mage::getModel('core/resource_transaction')->addObject($invoice)->addObject($invoice->getOrder());
39
+ $transactionSave->save();
40
+ $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true, 'Gateway has authorized the payment, Trancation ID: ' . $tranid);
41
+ endif;
42
+ }
43
+ catch(Mage_Core_Exception $e){
44
+ Mage::throwException(Mage::helper('core')->__('cannot create an invoice !'));
45
+ }
46
+ $order->sendNewOrderEmail();
47
+ $order->setEmailSent(true);
48
+ $order->save();
49
+ }
50
+ else {
51
+ Mage::getSingleton('checkout/session')->addError('There\'s an error in the payment please try again or contact the website admin');
52
+ Mage_Core_Controller_Varien_Action::_redirect('checkout/onepage', array('_secure'=>true));
53
+ }
54
+ }
55
+ }
56
+
57
+ public function successAction(){
58
+ //foreach( Mage::getSingleton('checkout/session')->getQuote()->getItemsCollection() as $item ){
59
+ // Mage::getSingleton('checkout/cart')->removeItem( $item->getId() )->save();
60
+ //}
61
+ //Mage::getSingleton('checkout/session')->clear();
62
+ Mage::getSingleton('onlinepayment/session')->unsetData('param');
63
+ Mage_Core_Controller_Varien_Action::_redirect('checkout/onepage/success', array('_secure'=>true));
64
+ }
65
+
66
+ public function failAction(){
67
+ Mage::getSingleton('checkout/session')->addError('There\'s an error in the payment please try again or contact the website admin');
68
+ Mage_Core_Controller_Varien_Action::_redirect('checkout/onepage', array('_secure'=>true));
69
+ }
70
+ }
app/code/local/Gate2play/Onlinepayment/etc/config.xml ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Gate2play_Onlinepayment>
5
+ <version>1.0.0</version>
6
+ </Gate2play_Onlinepayment>
7
+ </modules>
8
+ <global>
9
+ <helpers>
10
+ <onlinepayment>
11
+ <class>Gate2play_Onlinepayment_Helper</class>
12
+ </onlinepayment>
13
+ </helpers>
14
+ <blocks>
15
+ <onlinepayment>
16
+ <class>Gate2play_Onlinepayment_Block</class>
17
+ </onlinepayment>
18
+ </blocks>
19
+ <models>
20
+ <onlinepayment>
21
+ <class>Gate2play_Onlinepayment_Model</class>
22
+ </onlinepayment>
23
+ </models>
24
+ <resources>
25
+ <onlinepayment_setup>
26
+ <setup>
27
+ <module>Gate2play_Onlinepayment</module>
28
+ </setup>
29
+ <connection>
30
+ <use>core_setup</use>
31
+ </connection>
32
+ </onlinepayment_setup>
33
+ <onlinepayment_write>
34
+ <connection>
35
+ <use>core_write</use>
36
+ </connection>
37
+ </onlinepayment_write>
38
+ <onlinepayment_read>
39
+ <connection>
40
+ <use>core_read</use>
41
+ </connection>
42
+ </onlinepayment_read>
43
+ </resources>
44
+ <events>
45
+ <sales_order_place_after>
46
+ <observers>
47
+ <onlinepayment>
48
+ <class>Gate2play_Onlinepayment_Model_Observer</class>
49
+ <method>savePaymentType</method>
50
+ </onlinepayment>
51
+ </observers>
52
+ </sales_order_place_after>
53
+ </events>
54
+ </global>
55
+ <frontend>
56
+ <layout>
57
+ <updates>
58
+ <onlinepayment>
59
+ <file>gate2play.xml</file>
60
+ </onlinepayment>
61
+ </updates>
62
+ </layout>
63
+ <routers>
64
+ <onlinepayment>
65
+ <use>standard</use>
66
+ <args>
67
+ <module>Gate2play_Onlinepayment</module>
68
+ <frontName>gate2play</frontName>
69
+ </args>
70
+ </onlinepayment>
71
+ </routers>
72
+ </frontend>
73
+ <default>
74
+ <payment>
75
+ <onlinepayment>
76
+ <active>1</active>
77
+ <model>onlinepayment/onlinepayment</model>
78
+ <order_status>pending_payment</order_status>
79
+ <title>Online Payment</title>
80
+ <allowspecific>0</allowspecific>
81
+ <allowspecific>0</allowspecific>
82
+ </onlinepayment>
83
+ </payment>
84
+ </default>
85
+ </config>
app/code/local/Gate2play/Onlinepayment/etc/system.xml ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <payment>
5
+ <groups>
6
+ <onlinepayment translate="label" module="payment">
7
+ <label>Gate2play Payment</label>
8
+ <sort_order>750</sort_order>
9
+ <show_in_default>1</show_in_default>
10
+ <show_in_website>1</show_in_website>
11
+ <show_in_store>0</show_in_store>
12
+ <fields>
13
+ <active translate="label">
14
+ <label>Enabled</label>
15
+ <frontend_type>select</frontend_type>
16
+ <source_model>adminhtml/system_config_source_yesno</source_model>
17
+ <sort_order>1</sort_order>
18
+ <show_in_default>1</show_in_default>
19
+ <show_in_website>1</show_in_website>
20
+ <show_in_store>0</show_in_store>
21
+ </active>
22
+ <title translate="label">
23
+ <label>Title</label>
24
+ <frontend_type>text</frontend_type>
25
+ <comment><![CDATA[This title will be displayed on the checkout page]]></comment>
26
+ <sort_order>2</sort_order>
27
+ <show_in_default>1</show_in_default>
28
+ <show_in_website>1</show_in_website>
29
+ <show_in_store>1</show_in_store>
30
+ </title>
31
+ <meid translate="label">
32
+ <label>Merchant ID</label>
33
+ <frontend_type>text</frontend_type>
34
+ <sort_order>3</sort_order>
35
+ <show_in_default>1</show_in_default>
36
+ <show_in_website>1</show_in_website>
37
+ <show_in_store>0</show_in_store>
38
+ </meid>
39
+ <appid translate="label">
40
+ <label>Application ID</label>
41
+ <frontend_type>text</frontend_type>
42
+ <comment><![CDATA[Application ID is a case sensitive field.]]></comment>
43
+ <sort_order>4</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
+ </appid>
48
+ <app_sec_key translate="label comment">
49
+ <label>Application Secret Key</label>
50
+ <backend_model>adminhtml/system_config_backend_encrypted</backend_model>
51
+ <frontend_type>obscure</frontend_type>
52
+ <comment><![CDATA[Use in posting data from Gate2play.]]></comment>
53
+ <sort_order>5</sort_order>
54
+ <show_in_default>1</show_in_default>
55
+ <show_in_website>1</show_in_website>
56
+ <show_in_store>0</show_in_store>
57
+ </app_sec_key>
58
+ <gw_url translate="label">
59
+ <label>Gateway URL</label>
60
+ <frontend_type>text</frontend_type>
61
+ <sort_order>6</sort_order>
62
+ <show_in_default>1</show_in_default>
63
+ <show_in_website>1</show_in_website>
64
+ <show_in_store>0</show_in_store>
65
+ </gw_url>
66
+ <g2ptypes traslate="label">
67
+ <label>Available Payments</label>
68
+ <frontend_type>multiselect</frontend_type>
69
+ <source_model>onlinepayment/system_config_paymenttype</source_model>
70
+ <sort_order>7</sort_order>
71
+ <show_in_default>1</show_in_default>
72
+ <show_in_website>1</show_in_website>
73
+ <show_in_store>0</show_in_store>
74
+ <can_be_empty>0</can_be_empty>
75
+ </g2ptypes>
76
+ <img_width translate="label">
77
+ <label>Image Width</label>
78
+ <frontend_type>text</frontend_type>
79
+ <comment><![CDATA[Width in pixel.]]></comment>
80
+ <sort_order>8</sort_order>
81
+ <show_in_default>1</show_in_default>
82
+ <show_in_website>1</show_in_website>
83
+ <show_in_store>0</show_in_store>
84
+ </img_width>
85
+ <img_height translate="label">
86
+ <label>Image Height</label>
87
+ <frontend_type>text</frontend_type>
88
+ <comment><![CDATA[Height in pixel.]]></comment>
89
+ <sort_order>9</sort_order>
90
+ <show_in_default>1</show_in_default>
91
+ <show_in_website>1</show_in_website>
92
+ <show_in_store>0</show_in_store>
93
+ </img_height>
94
+ <postback translate="label">
95
+ <label>Postback URL</label>
96
+ <frontend_type>label</frontend_type>
97
+ <comment><![CDATA[YourSiteURL/index.php/gate2play/payment/postback]]></comment>
98
+ <source_model>onlinepayment/system_config_postback</source_model>
99
+ <sort_order>10</sort_order>
100
+ <show_in_default>1</show_in_default>
101
+ <show_in_website>1</show_in_website>
102
+ <show_in_store>0</show_in_store>
103
+ <can_be_empty>0</can_be_empty>
104
+ </postback>
105
+ <success translate="label">
106
+ <label>Success URL</label>
107
+ <frontend_type>label</frontend_type>
108
+ <comment><![CDATA[YourSiteURL/index.php/gate2play/payment/success]]></comment>
109
+ <source_model>onlinepayment/system_config_postback</source_model>
110
+ <sort_order>11</sort_order>
111
+ <show_in_default>1</show_in_default>
112
+ <show_in_website>1</show_in_website>
113
+ <show_in_store>0</show_in_store>
114
+ <can_be_empty>0</can_be_empty>
115
+ </success>
116
+ <fail translate="label">
117
+ <label>Fail URL</label>
118
+ <frontend_type>label</frontend_type>
119
+ <comment><![CDATA[YourSiteURL/index.php/gate2play/payment/fail]]></comment>
120
+ <source_model>onlinepayment/system_config_postback</source_model>
121
+ <sort_order>12</sort_order>
122
+ <show_in_default>1</show_in_default>
123
+ <show_in_website>1</show_in_website>
124
+ <show_in_store>0</show_in_store>
125
+ <can_be_empty>0</can_be_empty>
126
+ </fail>
127
+ </fields>
128
+ </onlinepayment>
129
+ </groups>
130
+ </payment>
131
+ </sections>
132
+ </config>
app/design/frontend/base/default/layout/gate2play.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <onlinepayment_payment_redirect>
4
+ <reference name="content">
5
+ <block type="onlinepayment/payment" name="g2p_payment" template="gate2play/onlinepayment/redirect.phtml" />
6
+ </reference>
7
+ </onlinepayment_payment_redirect>
8
+ </layout>
app/design/frontend/base/default/template/gate2play/onlinepayment/form.phtml ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_code=$this->getMethodCode(); ?>
2
+ <ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
3
+ <li id="<?php echo $_code ?>_div">
4
+ <select id="<?php echo $_code ?>_cc_type" name="payment[cc_type]" class="required-entry">
5
+ <option value=""><?php echo $this->__('--Please Select--')?></option>
6
+ <?php foreach ($this->getG2pTypes() as $type): ?>
7
+ <option value="<?php echo $type['value'] ?>"><?php echo $type['label'] ?></option>
8
+ <?php endforeach ?>
9
+ </select>
10
+ <script type="text/javascript">
11
+ //<![CDATA[
12
+ var SSChecked<?php echo $_code ?> = function() {
13
+ var elm = $('<?php echo $_code ?>_cc_type');
14
+ if (['SS','SM','SO'].indexOf(elm.value) != -1) {
15
+ $('<?php echo $_code ?>_div').show();
16
+ } else {
17
+ $('<?php echo $_code ?>_div').hide();
18
+ }
19
+ };
20
+
21
+
22
+ //]]>
23
+ </script>
24
+ </li>
25
+ </ul>
app/design/frontend/base/default/template/gate2play/onlinepayment/redirect.phtml ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+ $param = Mage::getSingleton('onlinepayment/session')->getData('param');
3
+ ?>
4
+ <h1 style="text-align:center">Please click on the Icon of payment to confirm it.</h1>
5
+ <iframe frameborder=0 scrolling="no" src='<?=$this->getGatewayUrl()?>?mid=<?=$param['meid']?>&appid=<?=$param['appid']?>&orderid=<?=$param['orderId']?>&ordercurr=<?=$param['currency']?>&orderamt=<?=$param['amount']?>&msignature=<?=$param['msignature']?>&muid=<?=$param['customer_email']?>&selpaymentmethod=<?=$param['payment_method']?>&imgw=<?=$param['width']?>&imgh=<?=$param['height']?>' width='<?=$param['width']?>' height='<?=$param['height']?>' scrolling='auto' frameborder='0'></iframe>
app/etc/modules/Gate2play_Onlinepayment.xml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Gate2play_Onlinepayment>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ <depends>
8
+ <Mage_Payment />
9
+ </depends>
10
+ </Gate2play_Onlinepayment>
11
+ </modules>
12
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>gate2play</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>This extension will allow your customers to use Gate2play payment gateway.</summary>
10
+ <description>This extension adds (Gate2play Payment Gateway) option to your store payment methods. Upon adding this extension to your store, your customers will be able to complete payment through Gate2play Gateway. This extension is customizable as you can configure it to meet your needs.</description>
11
+ <notes>Tested and it works fine</notes>
12
+ <authors><author><name>Ahmad Hattab</name><user>ahmad_hattab</user><email>ahmhattab@gmail.com</email></author></authors>
13
+ <date>2013-02-07</date>
14
+ <time>13:07:56</time>
15
+ <contents><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="gate2play"><dir name="onlinepayment"><file name="form.phtml" hash="86c461a13ba552502b997fcdc1bfa1fb"/><file name="redirect.phtml" hash="49cda1b772e1f247bd4fc1f6cf30f999"/></dir></dir></dir><dir name="layout"><file name="gate2play.xml" hash="52ac03517320267b003f3abc36632db1"/></dir></dir></dir></dir></target><target name="magelocal"><dir name="Gate2play"><dir name="Onlinepayment"><dir name="Block"><file name="Form.php" hash="f4a757d07ea3f447ef96b063c8e294bc"/><file name="Payment.php" hash="afb3148a018ac1d33c29ed06b8e410a7"/></dir><dir name="Helper"><file name="Data.php" hash="f1f664de5b71cedd2a057ff1d6bdfd5c"/></dir><dir name="Model"><file name="Observer.php" hash="9db539f36a94eaf4eb1d29b84af69a9f"/><file name="Onlinepayment.php" hash="88146a7b5ebce3a9d3f4611753978563"/><file name="Session.php" hash="89975d058eda195d3e47ee0bed4532a1"/><dir name="System"><dir name="Config"><file name="Paymenttype.php" hash="922c074312921050dd989d77ffaf7a64"/><file name="Postback.php" hash="3aaa9e3ef10fcec416f37631086473fc"/></dir></dir></dir><dir name="controllers"><file name="PaymentController.php" hash="62ea24feabf22af4c1b49890ad8d173c"/></dir><dir name="etc"><file name="config.xml" hash="fcae5b1dc4831b6105918d043a0ac8d9"/><file name="system.xml" hash="a0602d5c1360a31811e2ffa0f9380945"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Gate2play_Onlinepayment.xml" hash="2c4a68b4034584f5361bf6e1c443b700"/></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.0.1</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>