Inetcash_Epayment - Version 0.1.2

Version Notes

First version

Download this release

Release Info

Developer Magento Core Team
Extension Inetcash_Epayment
Version 0.1.2
Comparing to
See all releases


Version 0.1.2

app/code/community/Inetcash/Epayment/Helper/Data.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @category Inet-Cash EPayment
17
+ * @package inetcash_epayment
18
+ * @copyright Copyright (c) 2011 Inet-Cash GmbH
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ * @version Data.php 0.1.2 2011-01-27 14:30:00
21
+ */
22
+
23
+ class Inetcash_Epayment_Helper_Data extends Mage_Core_Helper_Abstract
24
+ {
25
+
26
+ }
app/code/community/Inetcash/Epayment/Model/Epayment.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @category Inet-Cash EPayment
17
+ * @package inetcash_epayment
18
+ * @copyright Copyright (c) 2011 Inet-Cash GmbH
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ * @version Epayment.php 0.1.2 2011-01-27 14:30:00
21
+ */
22
+
23
+ class Inetcash_Epayment_Model_Epayment extends Mage_Payment_Model_Method_Abstract
24
+ {
25
+
26
+ protected $_code = 'epayment';
27
+
28
+ protected $_paymentMethod = 'epayment';
29
+
30
+
31
+ public function getOrderPlaceRedirectUrl()
32
+ {
33
+ return Mage::getUrl('epayment/epayment/redirect', array('_secure' => true));
34
+ }
35
+
36
+
37
+ }
38
+
app/code/community/Inetcash/Epayment/controllers/EpaymentController.php ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @category Inet-Cash EPayment
17
+ * @package inetcash_epayment
18
+ * @copyright Copyright (c) 2011 Inet-Cash GmbH
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ * @version EpaymentController.php 0.1.2 2011-01-27 14:30:00
21
+ */
22
+
23
+ class Inetcash_Epayment_EpaymentController extends Mage_Core_Controller_Front_Action
24
+ {
25
+
26
+ public function getCheckout()
27
+ {
28
+ return Mage::getSingleton('checkout/session');
29
+ }
30
+
31
+ public function redirectAction()
32
+ {
33
+ $session = $this->getCheckout();
34
+ $order = Mage::getModel('sales/order');
35
+ $order->loadByIncrementId($session->getLastRealOrderId());
36
+ $order->addStatusToHistory(Mage_Sales_Model_Order::STATE_PROCESSING, Mage::helper('epayment')->__('Customer redirected to Inet-Cash Epayment'));
37
+ $order->save();
38
+
39
+ $paymentObj = $order->getPayment()->getMethodInstance();
40
+ $progid = $paymentObj->getConfigData('progid');
41
+ $skey = $paymentObj->getConfigData('skey');
42
+ $gwurl = $paymentObj->getConfigData('gwurl');
43
+ $order_id=Mage::getSingleton('checkout/session')->getLastRealOrderId();
44
+
45
+ $epayment_url = $gwurl."?progid=".$progid."&skey=".$skey."&shopid=".$order_id."&lang=en";
46
+ header("Location:$epayment_url");
47
+ exit;
48
+ }
49
+
50
+
51
+ public function returnAction()
52
+ {
53
+ if (!$this->getRequest()->isGet()) {
54
+ $this->norouteAction();
55
+ return;
56
+ }
57
+ $response = $this->getRequest()->getParams();
58
+
59
+ $session = $this->getCheckout();
60
+ $session->getQuote()->setIsActive(false)->save();
61
+
62
+ if(!$response['orderId']) {
63
+ $this->_redirect('epayment/epayment/errornotice');
64
+ } else {
65
+ $this->_redirect('checkout/onepage/success');
66
+ }
67
+ }
68
+
69
+
70
+ public function getorderdataAction()
71
+ {
72
+ if (!$this->getRequest()->isGet()) {
73
+ $this->norouteAction();
74
+ return;
75
+ }
76
+
77
+ $response = $this->getRequest()->getParams();
78
+ $shopid = $response['shopid'];
79
+ if ($response['art']=='request')
80
+ {
81
+
82
+ $order = Mage::getModel('sales/order');
83
+ $order->loadByIncrementId($shopid);
84
+ $amount=$order->getGrandTotal();
85
+ $amount=number_format($amount*100,0,'.','');
86
+
87
+ $billing=$order->getBillingAddress();
88
+ $ort = $billing->getCity();
89
+ $plz = $billing->getPostcode();
90
+ $strasse = $billing->getStreet();
91
+ $land = $billing->getCountryId();
92
+ $fname = $billing->getFirstname();
93
+ $lname = $billing->getLastname();
94
+ $email = $order->getcustomer_email();
95
+ $ip = $order->getRemoteIp();
96
+ $cur = $order->getorder_currency_code();
97
+ $order->sendNewOrderEmail();
98
+ $paymentObj = $order->getPayment()->getMethodInstance();
99
+ $sid = $paymentObj->getConfigData('umsatzid');
100
+
101
+ echo "$lname;$fname;$strasse[0];$plz;$ort;$land;$email;$amount;$sid;$ip;0;0;0;0;$cur";
102
+
103
+ }
104
+ if ($response['art']=='result')
105
+ {
106
+
107
+ if (!$this->getRequest()->isGet()) {
108
+ $this->norouteAction();
109
+ return;
110
+ }
111
+
112
+ $response = $this->getRequest()->getParams();
113
+ $shopid = $response['shopid'];
114
+ $errcod = $response['errcod'];
115
+ $belegnr = $response['belegnr'];
116
+ If ($errcod=='0')
117
+ {
118
+ //Success
119
+
120
+ $order = Mage::getModel('sales/order');
121
+ $order->loadByIncrementId($shopid);
122
+
123
+ $payment = $order->getPayment()->getMethodInstance();
124
+ $payment->setAdditionalData('XBELEG',$belegnr);
125
+ $payment->setAdditionalinformation('Belegnr',$belegnr);
126
+
127
+ $order->addStatusToHistory('complete', 'Payment was successful via Inet-Cash. '.$belegnr);
128
+ $order->setPayment($payment);
129
+ $update = "UPDATE downloadable_link_purchased_item i INNER JOIN downloadable_link_purchased pp ON i.item_id = pp.purchased_id SET i.status = 'available' WHERE pp.order_increment_id='$shopid'";
130
+ $updare_result = Mage::getSingleton('core/resource') ->getConnection('core_read')->query($update);
131
+
132
+ $order->save();
133
+ $order->sendOrderUpdateEmail();
134
+
135
+
136
+ }else{
137
+ // No success
138
+ $order = Mage::getModel('sales/order');
139
+ $order->loadByIncrementId($shopid);
140
+ $order->cancel();
141
+ $order->addStatusToHistory($order->getStatus(), 'Payment was not successful via Inet-Cash. '.$belegnr);
142
+ $order->save();
143
+ }
144
+ $sql = "select value from core_config_data where path='web/secure/base_url'";
145
+ $html = Mage::getSingleton('core/resource') ->getConnection('core_read')->fetchAll($sql);
146
+ $url_data = $html[0];
147
+ $back_url = $url_data['value'];
148
+ echo "OK;".$back_url."sales/order/history";
149
+ }
150
+ }
151
+
152
+ public function errorAction()
153
+ {
154
+ $session = $this->getCheckout();
155
+ $session->getQuote()->setIsActive(false)->save();
156
+
157
+ $order = Mage::getModel('sales/order');
158
+ $order->load($this->getCheckout()->getLastOrderId());
159
+ $order->cancel();
160
+ $order->addStatusToHistory($order->getStatus(), Mage::helper('epayment')->__('Customer cancled payment'));
161
+ $order->save();
162
+
163
+ }
164
+
165
+ }
app/code/community/Inetcash/Epayment/etc/config.xml ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @category Inet-Cash EPayment
17
+ * @package inetcash_epayment
18
+ * @copyright Copyright (c) 2011 Inet-Cash GmbH
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ * @version config.xml 0.1.2 2011-01-27 14:30:00
21
+ */
22
+ -->
23
+ <config>
24
+
25
+ <modules>
26
+ <Inetcash_Epayment>
27
+ <!-- declare module's version information for database updates -->
28
+ <version>0.1.2</version>
29
+ </Inetcash_Epayment>
30
+ </modules>
31
+ <frontend>
32
+ <routers>
33
+ <epayment>
34
+ <use>standard</use>
35
+ <args>
36
+ <module>Inetcash_Epayment</module>
37
+ <frontName>epayment</frontName>
38
+ </args>
39
+ </epayment>
40
+ </routers>
41
+ </frontend>
42
+
43
+ <global>
44
+ <helpers>
45
+ <epayment>
46
+ <class>Inetcash_Epayment_Helper</class>
47
+ </epayment>
48
+ </helpers>
49
+ <!-- declare model group for new module -->
50
+ <models>
51
+ <!-- model group alias to be used in Mage::getModel('newmodule/...') -->
52
+ <epayment>
53
+ <!-- base class name for the model group -->
54
+ <class>Inetcash_Epayment_Model</class>
55
+ </epayment>
56
+ </models>
57
+
58
+ <!-- declare resource setup for new module -->
59
+ <resources>
60
+ <!-- resource identifier -->
61
+ <epayment_setup>
62
+ <!-- specify that this resource is a setup resource and used for upgrades -->
63
+ <setup>
64
+ <!-- which module to look for install/upgrade files in -->
65
+ <module>Inetcash_Epayment</module>
66
+ </setup>
67
+ <!-- specify database connection for this resource -->
68
+ <connection>
69
+ <!-- do not create new connection, use predefined core setup connection -->
70
+ <use>core_setup</use>
71
+ </connection>
72
+ </epayment_setup>
73
+ <epayment_write>
74
+ <connection>
75
+ <use>core_write</use>
76
+ </connection>
77
+ </epayment_write>
78
+ <epayment_read>
79
+ <connection>
80
+ <use>core_read</use>
81
+ </connection>
82
+ </epayment_read>
83
+ </resources>
84
+ </global>
85
+
86
+ <!-- declare default configuration values for this module -->
87
+ <default>
88
+ <payment>
89
+ <epayment>
90
+ <active>1</active>
91
+ <model>epayment/epayment</model>
92
+ <order_status>1</order_status>
93
+ <title>Inet-Cash</title>
94
+ <progid>1</progid>
95
+ <skey>2</skey>
96
+ <umsatzid>XXXX</umsatzid>
97
+ <gwurl>https://gateway.inet-cash.de/shop/start.php</gwurl>
98
+ <allowspecific>0</allowspecific>
99
+ </epayment>
100
+ </payment>
101
+ </default>
102
+ </config>
app/code/community/Inetcash/Epayment/etc/system.xml ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @category Inet-Cash EPayment
17
+ * @package inetcash_epayment
18
+ * @copyright Copyright (c) 2011 Inet-Cash GmbH
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ * @version system.xml 0.1.2 2011-01-27 14:30:00
21
+ */
22
+ -->
23
+
24
+ <config>
25
+ <sections>
26
+ <!-- payment tab -->
27
+ <payment>
28
+ <groups>
29
+ <!-- newmodule fieldset -->
30
+ <epayment translate="label" module="paygate">
31
+ <!-- will have title 'New Module' -->
32
+ <label>Inet-Cash Payment (Credit cart / Direct Debit (DE/AT) / Direct Pay)</label>
33
+ <sort_order>0</sort_order>
34
+ <!-- do not show this configuration options in store scope -->
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
+ <fields>
39
+ <active translate="label">
40
+ <label>Enabled</label>
41
+ <frontend_type>select</frontend_type>
42
+ <source_model>adminhtml/system_config_source_yesno</source_model>
43
+ <sort_order>2</sort_order>
44
+ <show_in_default>1</show_in_default>
45
+ <show_in_website>1</show_in_website>
46
+ <show_in_store>1</show_in_store>
47
+ <comment><![CDATA[<b>Activate</b> or <b>Deactivate</b> this module.]]></comment>
48
+ </active>
49
+ <progid translate="label">
50
+ <label>Progid</label>
51
+ <frontend_type>text</frontend_type>
52
+ <sort_order>3</sort_order>
53
+ <show_in_default>1</show_in_default>
54
+ <show_in_website>1</show_in_website>
55
+ <show_in_store>1</show_in_store>
56
+ <comment><![CDATA[<b>Progid</b> - Your unique ID from Inet-Cash.]]></comment>
57
+ </progid>
58
+ <skey translate="label">
59
+ <label>Skey</label>
60
+ <frontend_type>text</frontend_type>
61
+ <sort_order>4</sort_order>
62
+ <show_in_default>1</show_in_default>
63
+ <show_in_website>1</show_in_website>
64
+ <show_in_store>1</show_in_store>
65
+ <comment><![CDATA[<b>SKEY</b> = Your PartnerId multiplicate with Securefactor.]]></comment>
66
+ </skey>
67
+ <umsatzid translate="label">
68
+ <label>SalesID/UmsatzId</label>
69
+ <frontend_type>text</frontend_type>
70
+ <sort_order>5</sort_order>
71
+ <show_in_default>1</show_in_default>
72
+ <show_in_website>1</show_in_website>
73
+ <show_in_store>1</show_in_store>
74
+ <comment><![CDATA[<b>UMSATZID</b> = Your Inet-Cash SalesID.]]></comment>
75
+ </umsatzid>
76
+ <order_status translate="label">
77
+ <label>New order status</label>
78
+ <frontend_type>select</frontend_type>
79
+ <source_model>adminhtml/system_config_source_order_status</source_model>
80
+ <sort_order>6</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
+ </order_status>
85
+ <allowspecific translate="label">
86
+ <label>Payment Applicable From</label>
87
+ <frontend_type>select</frontend_type>
88
+ <sort_order>7</sort_order>
89
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
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
+ </allowspecific>
94
+ <specificcountry translate="label">
95
+ <label>Countries Payment Applicable From</label>
96
+ <frontend_type>multiselect</frontend_type>
97
+ <sort_order>8</sort_order>
98
+ <source_model>adminhtml/system_config_source_country</source_model>
99
+ <show_in_default>1</show_in_default>
100
+ <show_in_website>1</show_in_website>
101
+ <show_in_store>0</show_in_store>
102
+ <depends><allowspecific>1</allowspecific></depends>
103
+ </specificcountry>
104
+ <title translate="label">
105
+ <label>Title</label>
106
+ <frontend_type>text</frontend_type>
107
+ <sort_order>1</sort_order>
108
+ <show_in_default>1</show_in_default>
109
+ <show_in_website>1</show_in_website>
110
+ <show_in_store>1</show_in_store>
111
+ </title>
112
+ </fields>
113
+ </epayment>
114
+ </groups>
115
+ </payment>
116
+ </sections>
117
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Inetcash_Epayment</name>
4
+ <version>0.1.2</version>
5
+ <stability>stable</stability>
6
+ <license>OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Enables Payments via Inet-Cash Shop Sollution</summary>
10
+ <description>You you want to use Inet-Cash as Payment Provider for your Shop you have to install this package.</description>
11
+ <notes>First version</notes>
12
+ <authors><author><name>Szpejewski</name><user>auto-converted</user><email>webmaster@inet-cash.com</email></author></authors>
13
+ <date>2011-01-25</date>
14
+ <time>09:43:49</time>
15
+ <contents><target name="magecommunity"><dir name="Inetcash"><dir name="Epayment"><dir name="controllers"><file name="EpaymentController.php" hash="576ffdbf15b4d55939d6019608b0aea8"/></dir><dir name="etc"><file name="config.xml" hash="4c1ae2407dccd6288a7dada0bdac598e"/><file name="system.xml" hash="f6037d83157350af22dec697e2e20b97"/></dir><dir name="Helper"><file name="Data.php" hash="890eff693e22c9d08c0a8af1c72b9372"/></dir><dir name="Model"><file name="Epayment.php" hash="fd95ce02b28cde0a62010559bbbfad96"/></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies/>
18
+ </package>