Billingmaker_Payment_SEPA_Lastschrift - Version 1.0.0

Version Notes

stable version

Download this release

Release Info

Developer Billingmaker Payment
Extension Billingmaker_Payment_SEPA_Lastschrift
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/local/Myname/Mygateway/Helper/Data.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+ class Myname_Mygateway_Helper_Data extends Mage_Core_Helper_Abstract
3
+ {
4
+
5
+ }
app/code/local/Myname/Mygateway/Model/Standard.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Myname_Mygateway_Model_Standard extends Mage_Payment_Model_Method_Abstract {
3
+ protected $_code = 'mygateway';
4
+
5
+ protected $_isInitializeNeeded = true;
6
+ protected $_canUseInternal = true;
7
+ protected $_canUseForMultishipping = false;
8
+
9
+ public function getOrderPlaceRedirectUrl() {
10
+ return Mage::getUrl('mygateway/payment/redirect', array('_secure' => true));
11
+ }
12
+ }
13
+ ?>
app/code/local/Myname/Mygateway/controllers/PaymentController.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Myname_Mygateway_PaymentController extends Mage_Core_Controller_Front_Action {
3
+ // The redirect action is triggered when someone places an order
4
+ public function redirectAction() {
5
+ $this->loadLayout();
6
+ $block = $this->getLayout()->createBlock('Mage_Core_Block_Template','mygateway',array('template' => 'mygateway/redirect.phtml'));
7
+ $this->getLayout()->getBlock('content')->append($block);
8
+ $this->renderLayout();
9
+ }
10
+
11
+ // The response action is triggered when your gateway sends back a response after processing the customer's payment
12
+ public function responseAction() {
13
+ //if($this->getRequest()->isPost()) {
14
+ if($_GET['hash']) {
15
+
16
+ $id=$_GET['id'];
17
+ $hash=$_GET['hash'];
18
+ $json=file_get_contents("https://payment.billingmaker.com/sepa/c/?id=".$id."&hash=".$hash);
19
+ $json=json_decode($json, true);
20
+ if ($json['name']!='') {
21
+ $validated=true;
22
+ $orderId =$json['c'];
23
+ }
24
+
25
+ if($validated) {
26
+ // Payment was successful, so update the order's state, send order email and move to the success page
27
+ $order = Mage::getModel('sales/order');
28
+ $order->loadByIncrementId($orderId);
29
+ $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true, 'Gateway has authorized the payment.');
30
+
31
+ $order->sendNewOrderEmail();
32
+ $order->setEmailSent(true);
33
+
34
+ $order->save();
35
+
36
+ Mage::getSingleton('checkout/session')->unsQuoteId();
37
+
38
+ Mage_Core_Controller_Varien_Action::_redirect('checkout/onepage/success', array('_secure'=>true));
39
+ }
40
+ else {
41
+ // There is a problem in the response we got
42
+ $this->cancelAction();
43
+ Mage_Core_Controller_Varien_Action::_redirect('checkout/onepage/failure', array('_secure'=>true));
44
+ }
45
+ }
46
+ else
47
+ Mage_Core_Controller_Varien_Action::_redirect('');
48
+ }
49
+
50
+ // The cancel action is triggered when an order is to be cancelled
51
+ public function cancelAction() {
52
+ if (Mage::getSingleton('checkout/session')->getLastRealOrderId()) {
53
+ $order = Mage::getModel('sales/order')->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId());
54
+ if($order->getId()) {
55
+ // Flag the order as 'cancelled' and save it
56
+ $order->cancel()->setState(Mage_Sales_Model_Order::STATE_CANCELED, true, 'Gateway has declined the payment.')->save();
57
+ }
58
+ }
59
+ }
60
+ }
app/code/local/Myname/Mygateway/etc/config.xml ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Myname_Mygateway>
5
+ <version>1.0.0</version>
6
+ </Myname_Mygateway>
7
+ </modules>
8
+ <global>
9
+ <models>
10
+ <mygateway>
11
+ <class>Myname_Mygateway_Model</class>
12
+ </mygateway>
13
+ </models>
14
+ <helpers>
15
+ <mygateway>
16
+ <class>Myname_Mygateway_Helper</class>
17
+ </mygateway>
18
+ </helpers>
19
+ <blocks>
20
+ <mygateway>
21
+ <class>Myname_Mygateway_Block</class>
22
+ </mygateway>
23
+ </blocks>
24
+ </global>
25
+ <default>
26
+ <payment>
27
+ <mygateway>
28
+ <model>mygateway/standard</model>
29
+ <active>1</active>
30
+ <order_status>pending</order_status>
31
+ <title>SEPA Lastschrift</title>
32
+ <payment_action>sale</payment_action>
33
+ <allowspecific>0</allowspecific>
34
+ <sort_order>1</sort_order>
35
+ </mygateway>
36
+ </payment>
37
+ </default>
38
+ <frontend>
39
+ <routers>
40
+ <mygateway>
41
+ <use>standard</use>
42
+ <args>
43
+ <module>Myname_Mygateway</module>
44
+ <frontName>mygateway</frontName>
45
+ </args>
46
+ </mygateway>
47
+ </routers>
48
+ </frontend>
49
+ </config>
app/code/local/Myname/Mygateway/etc/system.xml ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <payment>
5
+ <groups>
6
+ <mygateway translate="label comment" module="paygate">
7
+ <label>Billingmaker Payment</label>
8
+ <frontend_type>text</frontend_type>
9
+ <sort_order>0</sort_order>
10
+ <show_in_default>1</show_in_default>
11
+ <show_in_website>1</show_in_website>
12
+ <show_in_store>1</show_in_store>
13
+ <fields>
14
+ <active translate="label">
15
+ <label>Enabled</label>
16
+ <frontend_type>select</frontend_type>
17
+ <source_model>adminhtml/system_config_source_yesno</source_model>
18
+ <sort_order>10</sort_order>
19
+ <show_in_default>1</show_in_default>
20
+ <show_in_website>1</show_in_website>
21
+ <show_in_store>0</show_in_store>
22
+ </active>
23
+ <title translate="label">
24
+ <label>Title</label>
25
+ <frontend_type>text</frontend_type>
26
+ <sort_order>20</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
+ <order_status translate="label">
32
+ <label>New Order Status</label>
33
+ <frontend_type>select</frontend_type>
34
+ <source_model>adminhtml/system_config_source_order_status</source_model>
35
+ <sort_order>50</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
+ </order_status>
40
+ <allowspecific translate="label">
41
+ <label>Payment Applicable From</label>
42
+ <frontend_type>select</frontend_type>
43
+ <sort_order>61</sort_order>
44
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
45
+ <show_in_default>1</show_in_default>
46
+ <show_in_website>1</show_in_website>
47
+ <show_in_store>0</show_in_store>
48
+ </allowspecific>
49
+ <specificcountry translate="label">
50
+ <label>Countries Payment Applicable From</label>
51
+ <frontend_type>multiselect</frontend_type>
52
+ <sort_order>70</sort_order>
53
+ <source_model>adminhtml/system_config_source_country</source_model>
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
+ <depends>
58
+ <allowspecific>1</allowspecific>
59
+ </depends>
60
+ </specificcountry>
61
+ <sort_order translate="label">
62
+ <label>Sort Order</label>
63
+ <frontend_type>text</frontend_type>
64
+ <sort_order>100</sort_order>
65
+ <show_in_default>1</show_in_default>
66
+ <show_in_website>1</show_in_website>
67
+ <show_in_store>0</show_in_store>
68
+ </sort_order>
69
+ <bp_id translate="label">
70
+ <label>Handler ID</label>
71
+ <frontend_type>text</frontend_type>
72
+ <sort_order>150</sort_order>
73
+ <show_in_default>1</show_in_default>
74
+ <show_in_website>1</show_in_website>
75
+ <show_in_store>1</show_in_store>
76
+ </bp_id>
77
+ </fields>
78
+ </mygateway>
79
+ </groups>
80
+ </payment>
81
+ </sections>
82
+ </config>
app/design/frontend/base/default/template/mygateway/redirect.phtml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $_order = new Mage_Sales_Model_Order();
3
+ $orderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
4
+ $_order->loadByIncrementId($orderId);
5
+ ?>
6
+ <form name="billingmaker" action="https://payment.billingmaker.com/sepa/" method="post">
7
+ <input type="hidden" name="h" value="<?php echo Mage::getStoreConfig('payment/mygateway/bp_id'); ?>" />
8
+ <input type="hidden" name="p" value="<?php echo str_replace('.',',',number_format($_order->getBaseGrandTotal(),2)); ?>" />
9
+ <input type="hidden" name="m" value="1" />
10
+ <input type="hidden" name="b" value="ID <?php echo $orderId; ?>" />
11
+ <input type="hidden" name="c" value="<?php echo $orderId; ?>" />
12
+ <input type="hidden" name="rurl" value="<?php echo Mage::getBaseUrl('web', true); ?>" />
13
+ <input type="hidden" name="nurl" value="<?php echo Mage::getBaseUrl('web', true).'mygateway/payment/response'; ?>" />
14
+ </form>
15
+ <script type="text/javascript">
16
+ document.billingmaker.submit();
17
+ </script>
app/etc/modules/Myname_Mygateway.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Myname_Mygateway>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ </Myname_Mygateway>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Billingmaker_Payment_SEPA_Lastschrift</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license>GPL</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Mit dieser Erweiterung k&#xF6;nnen Sie die Bezahlart SEPA-Lastschriften im Shop anbieten.</summary>
10
+ <description>Mit dieser Erweiterung k&#xF6;nnen Sie die Bezahlart SEPA-Lastschriften in wenigen Schritten im Online Shop hinzuf&#xFC;gen.&#xD;
11
+ &#xD;
12
+ Sie ben&#xF6;tigen einen Account bei https://payment.billingmaker.com</description>
13
+ <notes>stable version</notes>
14
+ <authors><author><name>Billingmaker Payment</name><user>Billingmaker</user><email>support@codemec.com</email></author></authors>
15
+ <date>2015-07-08</date>
16
+ <time>11:07:25</time>
17
+ <contents><target name="magelocal"><dir><dir name="Myname"><dir name="Mygateway"><dir name="Helper"><file name="Data.php" hash="86928b761e7987891d81450b03b03aa1"/></dir><dir name="Model"><file name="Standard.php" hash="8959372e8722dabeaec0c91e7b097af6"/></dir><dir name="controllers"><file name="PaymentController.php" hash="cc8701c3f4171c889e9e91e0aab43b9e"/></dir><dir name="etc"><file name="config.xml" hash="801683300e96cacdc6679ae97b64e080"/><file name="system.xml" hash="741906caf06305b556df579a70486245"/></dir></dir></dir></dir></target><target name="magedesign"><dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="mygateway"><file name="redirect.phtml" hash="6b2d30d29335c382d51b9b3ff1444035"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir><dir name="modules"><file name="Myname_Mygateway.xml" hash="c4c31756794ff9ded83e9798e15e9403"/></dir></dir></target></contents>
18
+ <compatible/>
19
+ <dependencies><required><php><min>3.0.0</min><max>7.0.0</max></php></required></dependencies>
20
+ </package>