Version Notes
Next release
Download this release
Release Info
Developer | Magento Core Team |
Extension | mollie_ideal |
Version | 1.2.0 |
Comparing to | |
See all releases |
Version 1.2.0
- app/code/community/Mollie/Ideal/Block/Form/Ideal.php +46 -0
- app/code/community/Mollie/Ideal/Block/Info/Ideal.php +56 -0
- app/code/community/Mollie/Ideal/Core.php +442 -0
- app/code/community/Mollie/Ideal/Helper/Data.php +41 -0
- app/code/community/Mollie/Ideal/Model/Api.php +138 -0
- app/code/community/Mollie/Ideal/Model/Ideal.php +99 -0
- app/code/community/Mollie/Ideal/Model/Mysql4/Ideal.php +44 -0
- app/code/community/Mollie/Ideal/Model/Mysql4/Ideal/Collection.php +44 -0
- app/code/community/Mollie/Ideal/controllers/ApiController.php +123 -0
- app/code/community/Mollie/Ideal/etc/config.xml +146 -0
- app/code/community/Mollie/Ideal/etc/system.xml +88 -0
- app/code/community/Mollie/Ideal/sql/ideal_setup/mysql4-install-1.2.0.php +51 -0
- app/design/frontend/default/default/layout/ideal.xml +20 -0
- app/design/frontend/default/default/template/ideal/form/ideal.phtml +15 -0
- app/design/frontend/default/default/template/ideal/partner/logo.phtml +8 -0
- app/etc/modules/Mollie_Ideal.xml +13 -0
- package.xml +18 -0
app/code/community/Mollie/Ideal/Block/Form/Ideal.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Copyright (c) 2011, Mollie B.V. (A subsidiary of Stash Holding B.V.)
|
5 |
+
* All rights reserved.
|
6 |
+
*
|
7 |
+
* Redistribution and use in source and binary forms, with or without
|
8 |
+
* modification, are permitted provided that the following conditions are met:
|
9 |
+
*
|
10 |
+
* - Redistributions of source code must retain the above copyright notice,
|
11 |
+
* this list of conditions and the following disclaimer.
|
12 |
+
* - Redistributions in binary form must reproduce the above copyright
|
13 |
+
* notice, this list of conditions and the following disclaimer in the
|
14 |
+
* documentation and/or other materials provided with the distribution.
|
15 |
+
*
|
16 |
+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
|
17 |
+
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
18 |
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
19 |
+
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY
|
20 |
+
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
21 |
+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
22 |
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
23 |
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
24 |
+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
25 |
+
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
26 |
+
* DAMAGE.
|
27 |
+
*
|
28 |
+
* @category Mollie
|
29 |
+
* @package Mollie_Ideal
|
30 |
+
* @author Youssef Airoude (youssef@mollie.nl)
|
31 |
+
* @version v0.10
|
32 |
+
* @copyright Copyright (c) 2011 Mollie B.V. (http://www.mollie.nl)
|
33 |
+
* @license http://www.opensource.org/licenses/bsd-license.php Open Software License (OSL 3.0)
|
34 |
+
*
|
35 |
+
**/
|
36 |
+
|
37 |
+
class Mollie_Ideal_Block_Form_Ideal extends Mage_Payment_Block_Form {
|
38 |
+
|
39 |
+
public function _construct() {
|
40 |
+
parent::_construct();
|
41 |
+
$this->setTemplate('ideal/form/ideal.phtml');
|
42 |
+
}
|
43 |
+
|
44 |
+
}
|
45 |
+
|
46 |
+
?>
|
app/code/community/Mollie/Ideal/Block/Info/Ideal.php
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Copyright (c) 2011, Mollie B.V. (A subsidiary of Stash Holding B.V.)
|
5 |
+
* All rights reserved.
|
6 |
+
*
|
7 |
+
* Redistribution and use in source and binary forms, with or without
|
8 |
+
* modification, are permitted provided that the following conditions are met:
|
9 |
+
*
|
10 |
+
* - Redistributions of source code must retain the above copyright notice,
|
11 |
+
* this list of conditions and the following disclaimer.
|
12 |
+
* - Redistributions in binary form must reproduce the above copyright
|
13 |
+
* notice, this list of conditions and the following disclaimer in the
|
14 |
+
* documentation and/or other materials provided with the distribution.
|
15 |
+
*
|
16 |
+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
|
17 |
+
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
18 |
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
19 |
+
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY
|
20 |
+
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
21 |
+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
22 |
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
23 |
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
24 |
+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
25 |
+
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
26 |
+
* DAMAGE.
|
27 |
+
*
|
28 |
+
* @category Mollie
|
29 |
+
* @package Mollie_Ideal
|
30 |
+
* @author Youssef Airoude (youssef@mollie.nl)
|
31 |
+
* @version v0.10
|
32 |
+
* @copyright Copyright (c) 2011 Mollie B.V. (http://www.mollie.nl)
|
33 |
+
* @license http://www.opensource.org/licenses/bsd-license.php Open Software License (OSL 3.0)
|
34 |
+
*
|
35 |
+
**/
|
36 |
+
|
37 |
+
class Mollie_Ideal_Block_Info_Ideal extends Mage_Payment_Block_Info {
|
38 |
+
/*
|
39 |
+
// TODO: Ik moet uit DB een bank kunnen selecteren... (Sessie is allang dood)
|
40 |
+
protected function _prepareSpecificInformation($transport = null) {
|
41 |
+
if (null !== $this->_paymentSpecificInformation) {
|
42 |
+
return $this->_paymentSpecificInformation;
|
43 |
+
}
|
44 |
+
$info = $this->getInfo();
|
45 |
+
$transport = new Varien_Object();
|
46 |
+
$transport = parent::_prepareSpecificInformation($transport);
|
47 |
+
$transport->addData(array(
|
48 |
+
Mage::helper('payment')->__('Bank') => $info->getBankName() . ' - ' . $_SESSION['bank']
|
49 |
+
));
|
50 |
+
|
51 |
+
return $transport;
|
52 |
+
}
|
53 |
+
*/
|
54 |
+
}
|
55 |
+
|
56 |
+
?>
|
app/code/community/Mollie/Ideal/Core.php
ADDED
@@ -0,0 +1,442 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2011, Mollie B.V. (A subsidiary of Stash Holding B.V.)
|
4 |
+
* All rights reserved.
|
5 |
+
*
|
6 |
+
* Redistribution and use in source and binary forms, with or without
|
7 |
+
* modification, are permitted provided that the following conditions are met:
|
8 |
+
*
|
9 |
+
* - Redistributions of source code must retain the above copyright notice,
|
10 |
+
* this list of conditions and the following disclaimer.
|
11 |
+
* - Redistributions in binary form must reproduce the above copyright
|
12 |
+
* notice, this list of conditions and the following disclaimer in the
|
13 |
+
* documentation and/or other materials provided with the distribution.
|
14 |
+
*
|
15 |
+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
|
16 |
+
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
17 |
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
18 |
+
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY
|
19 |
+
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
20 |
+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
21 |
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
22 |
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
23 |
+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
24 |
+
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
25 |
+
* DAMAGE.
|
26 |
+
*
|
27 |
+
* ----------------------------------------------------------------------------------------------------
|
28 |
+
*
|
29 |
+
* @category Mollie
|
30 |
+
* @package Mollie_Ideal
|
31 |
+
* @author Youssef Airoude (youssef@mollie.nl)
|
32 |
+
* @version v0.10
|
33 |
+
* @copyright Copyright (c) 2011 Mollie B.V. (http://www.mollie.nl)
|
34 |
+
* @license http://www.opensource.org/licenses/bsd-license.php Open Software License (OSL 3.0)
|
35 |
+
*
|
36 |
+
* ----------------------------------------------------------------------------------------------------
|
37 |
+
*
|
38 |
+
* Start : 24 februari 2009
|
39 |
+
* Door : Mollie B.V. (RDF) © 2009
|
40 |
+
* Versie : 1.13 (gebaseerd op de Mollie iDEAL class van Concepto IT Solution - http://www.concepto.nl/)
|
41 |
+
* Laatste aanpassing : 18-04-2011
|
42 |
+
* Aard v. aanpassing : Ondersteuning voor het nieuwe 'status' veld
|
43 |
+
* Door : MK
|
44 |
+
*
|
45 |
+
**/
|
46 |
+
|
47 |
+
class Mollie_Ideal_Core extends Mage_Core_Model_Abstract {
|
48 |
+
const MIN_TRANS_AMOUNT = 118;
|
49 |
+
|
50 |
+
protected $partner_id = null;
|
51 |
+
protected $profile_key = null;
|
52 |
+
protected $testmode = false;
|
53 |
+
protected $bank_id = null;
|
54 |
+
protected $amount = 0;
|
55 |
+
protected $description = null;
|
56 |
+
protected $return_url = null;
|
57 |
+
protected $report_url = null;
|
58 |
+
protected $bank_url = null;
|
59 |
+
protected $payment_url = null;
|
60 |
+
protected $transaction_id = null;
|
61 |
+
protected $paid_status = false;
|
62 |
+
protected $consumer_info = array();
|
63 |
+
protected $error_message = '';
|
64 |
+
protected $error_code = 0;
|
65 |
+
protected $api_host = 'ssl://secure.mollie.nl';
|
66 |
+
protected $api_port = 443;
|
67 |
+
|
68 |
+
public function __construct($partner_id, $api_host = 'ssl://secure.mollie.nl', $api_port = 443) {
|
69 |
+
$this->partner_id = $partner_id;
|
70 |
+
$this->api_host = $api_host;
|
71 |
+
$this->api_port = $api_port;
|
72 |
+
}
|
73 |
+
|
74 |
+
// Haal de lijst van beschikbare banken
|
75 |
+
public function getBanks() {
|
76 |
+
$query_variables = array(
|
77 |
+
'a' => 'banklist',
|
78 |
+
'partner_id' => $this->partner_id,
|
79 |
+
);
|
80 |
+
|
81 |
+
if ($this->testmode) {
|
82 |
+
$query_variables['testmode'] = 'true';
|
83 |
+
}
|
84 |
+
|
85 |
+
$banks_xml = $this->_sendRequest(
|
86 |
+
$this->api_host, $this->api_port, '/xml/ideal/', http_build_query($query_variables, '', '&')
|
87 |
+
);
|
88 |
+
|
89 |
+
if (empty($banks_xml)) {
|
90 |
+
return false;
|
91 |
+
}
|
92 |
+
|
93 |
+
$banks_object = $this->_XMLtoObject($banks_xml);
|
94 |
+
|
95 |
+
if (!$banks_object or $this->_XMlisError($banks_object)) {
|
96 |
+
return false;
|
97 |
+
}
|
98 |
+
|
99 |
+
$banks_array = array();
|
100 |
+
|
101 |
+
foreach ($banks_object->bank as $bank) {
|
102 |
+
$banks_array["{$bank->bank_id}"] = "{$bank->bank_name}";
|
103 |
+
}
|
104 |
+
|
105 |
+
return $banks_array;
|
106 |
+
}
|
107 |
+
|
108 |
+
// Zet een betaling klaar bij de bank en maak de betalings URL beschikbaar
|
109 |
+
public function createPayment($bank_id, $amount, $description, $return_url, $report_url) {
|
110 |
+
|
111 |
+
if (!$this->setBankId($bank_id) or
|
112 |
+
!$this->setDescription($description) or
|
113 |
+
!$this->setAmount($amount) or
|
114 |
+
!$this->setReturnUrl($return_url) or
|
115 |
+
!$this->setReportUrl($report_url)) {
|
116 |
+
$this->error_message = "De opgegeven betalings gegevens zijn onjuist of incompleet: ";
|
117 |
+
return false;
|
118 |
+
}
|
119 |
+
|
120 |
+
$query_variables = array(
|
121 |
+
'a' => 'fetch',
|
122 |
+
'partnerid' => $this->getPartnerId(),
|
123 |
+
'bank_id' => $this->getBankId(),
|
124 |
+
'amount' => $this->getAmount(),
|
125 |
+
'description' => $this->getDescription(),
|
126 |
+
'reporturl' => $this->getReportURL(),
|
127 |
+
'returnurl' => $this->getReturnURL(),
|
128 |
+
);
|
129 |
+
|
130 |
+
if ($this->profile_key)
|
131 |
+
$query_variables['profile_key'] = $this->profile_key;
|
132 |
+
|
133 |
+
$create_xml = $this->_sendRequest(
|
134 |
+
$this->api_host, $this->api_port, '/xml/ideal/', http_build_query($query_variables, '', '&')
|
135 |
+
);
|
136 |
+
|
137 |
+
if (empty($create_xml)) {
|
138 |
+
return false;
|
139 |
+
}
|
140 |
+
|
141 |
+
$create_object = $this->_XMLtoObject($create_xml);
|
142 |
+
|
143 |
+
if (!$create_object or $this->_XMLisError($create_object)) {
|
144 |
+
return false;
|
145 |
+
}
|
146 |
+
|
147 |
+
$this->transaction_id = (string) $create_object->order->transaction_id;
|
148 |
+
$this->bank_url = (string) $create_object->order->URL;
|
149 |
+
|
150 |
+
return true;
|
151 |
+
}
|
152 |
+
|
153 |
+
// Kijk of er daadwerkelijk betaald is
|
154 |
+
public function checkPayment($transaction_id) {
|
155 |
+
if (!$this->setTransactionId($transaction_id)) {
|
156 |
+
$this->error_message = "Er is een onjuist transactie ID opgegeven";
|
157 |
+
return false;
|
158 |
+
}
|
159 |
+
|
160 |
+
$query_variables = array(
|
161 |
+
'a' => 'check',
|
162 |
+
'partnerid' => $this->partner_id,
|
163 |
+
'transaction_id' => $this->getTransactionId(),
|
164 |
+
);
|
165 |
+
|
166 |
+
if ($this->testmode) {
|
167 |
+
$query_variables['testmode'] = 'true';
|
168 |
+
}
|
169 |
+
|
170 |
+
$check_xml = $this->_sendRequest(
|
171 |
+
$this->api_host, $this->api_port, '/xml/ideal/', http_build_query($query_variables, '', '&')
|
172 |
+
);
|
173 |
+
|
174 |
+
if (empty($check_xml))
|
175 |
+
return false;
|
176 |
+
|
177 |
+
$check_object = $this->_XMLtoObject($check_xml);
|
178 |
+
|
179 |
+
if (!$check_object or $this->_XMLisError($check_object)) {
|
180 |
+
return false;
|
181 |
+
}
|
182 |
+
|
183 |
+
$this->paid_status = (bool) ($check_object->order->payed == 'true');
|
184 |
+
$this->status = (string) $check_object->order->status;
|
185 |
+
$this->amount = (int) $check_object->order->amount;
|
186 |
+
$this->consumer_info = (isset($check_object->order->consumer)) ? (array) $check_object->order->consumer : array();
|
187 |
+
|
188 |
+
return true;
|
189 |
+
}
|
190 |
+
|
191 |
+
public function CreatePaymentLink($description, $amount) {
|
192 |
+
if (!$this->setDescription($description) or !$this->setAmount($amount)) {
|
193 |
+
$this->error_message = "U moet een omschrijving én bedrag (in centen) opgeven voor de iDEAL link. Tevens moet het bedrag minstens " . self::MIN_TRANS_AMOUNT . ' eurocent zijn. U gaf ' . (int) $amount . ' cent op.';
|
194 |
+
return false;
|
195 |
+
}
|
196 |
+
|
197 |
+
$query_variables = array(
|
198 |
+
'a' => 'create-link',
|
199 |
+
'partnerid' => $this->partner_id,
|
200 |
+
'amount' => $this->getAmount(),
|
201 |
+
'description' => $this->getDescription(),
|
202 |
+
);
|
203 |
+
|
204 |
+
$create_xml = $this->_sendRequest(
|
205 |
+
$this->api_host, $this->api_port, '/xml/ideal/', http_build_query($query_variables, '', '&')
|
206 |
+
);
|
207 |
+
|
208 |
+
$create_object = $this->_XMLtoObject($create_xml);
|
209 |
+
|
210 |
+
if (!$create_object or $this->_XMLisError($create_object)) {
|
211 |
+
return false;
|
212 |
+
}
|
213 |
+
|
214 |
+
$this->payment_url = (string) $create_object->link->URL;
|
215 |
+
}
|
216 |
+
|
217 |
+
/*
|
218 |
+
PROTECTED FUNCTIONS
|
219 |
+
*/
|
220 |
+
|
221 |
+
protected function _sendRequest($host, $port, $path, $data) {
|
222 |
+
if (function_exists('curl_init')) {
|
223 |
+
return $this->_sendRequestCurl($host, $port, $path, $data);
|
224 |
+
} else {
|
225 |
+
return $this->_sendRequestFsock($host, $port, $path, $data);
|
226 |
+
}
|
227 |
+
}
|
228 |
+
|
229 |
+
protected function _sendRequestFsock($host, $port, $path, $data) {
|
230 |
+
$hostname = str_replace('ssl://', '', $host);
|
231 |
+
$fp = @fsockopen($host, $port, $errno, $errstr);
|
232 |
+
$buf = '';
|
233 |
+
|
234 |
+
if (!$fp) {
|
235 |
+
$this->error_message = 'Kon geen verbinding maken met server: ' . $errstr;
|
236 |
+
$this->error_code = 0;
|
237 |
+
|
238 |
+
return false;
|
239 |
+
}
|
240 |
+
|
241 |
+
@fputs($fp, "POST $path HTTP/1.0\n");
|
242 |
+
@fputs($fp, "Host: $hostname\n");
|
243 |
+
@fputs($fp, "Content-type: application/x-www-form-urlencoded\n");
|
244 |
+
@fputs($fp, "Content-length: " . strlen($data) . "\n");
|
245 |
+
@fputs($fp, "Connection: close\n\n");
|
246 |
+
@fputs($fp, $data);
|
247 |
+
|
248 |
+
while (!feof($fp)) {
|
249 |
+
$buf .= fgets($fp, 128);
|
250 |
+
}
|
251 |
+
|
252 |
+
fclose($fp);
|
253 |
+
|
254 |
+
if (empty($buf)) {
|
255 |
+
$this->error_message = 'Zero-sized reply';
|
256 |
+
return false;
|
257 |
+
} else {
|
258 |
+
list($headers, $body) = preg_split("/(\r?\n){2}/", $buf, 2);
|
259 |
+
}
|
260 |
+
|
261 |
+
return $body;
|
262 |
+
}
|
263 |
+
|
264 |
+
protected function _sendRequestCurl($host, $port, $path, $data) {
|
265 |
+
$host = str_replace('ssl://', 'https://', $host);
|
266 |
+
|
267 |
+
$ch = curl_init();
|
268 |
+
|
269 |
+
curl_setopt($ch, CURLOPT_URL, $host . $path);
|
270 |
+
curl_setopt($ch, CURLOPT_PORT, $port);
|
271 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
272 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
273 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
274 |
+
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
|
275 |
+
curl_setopt($ch, CURLOPT_HEADER, false);
|
276 |
+
curl_setopt($ch, CURLOPT_POST, true);
|
277 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
|
278 |
+
|
279 |
+
$body = curl_exec($ch);
|
280 |
+
|
281 |
+
curl_close($ch);
|
282 |
+
|
283 |
+
return $body;
|
284 |
+
}
|
285 |
+
|
286 |
+
protected function _XMLtoObject($xml) {
|
287 |
+
try {
|
288 |
+
$xml_object = new SimpleXMLElement($xml);
|
289 |
+
if ($xml_object == false) {
|
290 |
+
$this->error_message = "Kon XML resultaat niet verwerken";
|
291 |
+
return false;
|
292 |
+
}
|
293 |
+
} catch (Exception $e) {
|
294 |
+
return false;
|
295 |
+
}
|
296 |
+
|
297 |
+
return $xml_object;
|
298 |
+
}
|
299 |
+
|
300 |
+
protected function _XMLisError($xml) {
|
301 |
+
if (isset($xml->item)) {
|
302 |
+
$attributes = $xml->item->attributes();
|
303 |
+
if ($attributes['type'] == 'error') {
|
304 |
+
$this->error_message = (string) $xml->item->message;
|
305 |
+
$this->error_code = (string) $xml->item->errorcode;
|
306 |
+
|
307 |
+
return true;
|
308 |
+
}
|
309 |
+
}
|
310 |
+
|
311 |
+
return false;
|
312 |
+
}
|
313 |
+
|
314 |
+
/* Getters en setters */
|
315 |
+
|
316 |
+
public function setProfileKey($profile_key) {
|
317 |
+
if (is_null($profile_key))
|
318 |
+
return false;
|
319 |
+
|
320 |
+
return ($this->profile_key = $profile_key);
|
321 |
+
}
|
322 |
+
|
323 |
+
public function getProfileKey() {
|
324 |
+
return $this->profile_key;
|
325 |
+
}
|
326 |
+
|
327 |
+
public function setPartnerId($partner_id) {
|
328 |
+
if (!is_numeric($partner_id)) {
|
329 |
+
return false;
|
330 |
+
}
|
331 |
+
|
332 |
+
return ($this->partner_id = $partner_id);
|
333 |
+
}
|
334 |
+
|
335 |
+
public function getPartnerId() {
|
336 |
+
return $this->partner_id;
|
337 |
+
}
|
338 |
+
|
339 |
+
public function setTestmode($enable = true) {
|
340 |
+
return ($this->testmode = $enable);
|
341 |
+
}
|
342 |
+
|
343 |
+
public function setBankId($bank_id) {
|
344 |
+
if (!is_numeric($bank_id))
|
345 |
+
return false;
|
346 |
+
|
347 |
+
return ($this->bank_id = $bank_id);
|
348 |
+
}
|
349 |
+
|
350 |
+
public function getBankId() {
|
351 |
+
return $this->bank_id;
|
352 |
+
}
|
353 |
+
|
354 |
+
public function setAmount($amount) {
|
355 |
+
if (!preg_match('~^[0-9]+$~', $amount)) {
|
356 |
+
return false;
|
357 |
+
}
|
358 |
+
|
359 |
+
if (self::MIN_TRANS_AMOUNT > $amount) {
|
360 |
+
return false;
|
361 |
+
}
|
362 |
+
|
363 |
+
return ($this->amount = $amount);
|
364 |
+
}
|
365 |
+
|
366 |
+
public function getAmount() {
|
367 |
+
return $this->amount;
|
368 |
+
}
|
369 |
+
|
370 |
+
public function setDescription($description) {
|
371 |
+
$description = substr($description, 0, 29);
|
372 |
+
|
373 |
+
return ($this->description = $description);
|
374 |
+
}
|
375 |
+
|
376 |
+
public function getDescription() {
|
377 |
+
return $this->description;
|
378 |
+
}
|
379 |
+
|
380 |
+
public function setReturnURL($return_url) {
|
381 |
+
if (!preg_match('|(\w+)://([^/:]+)(:\d+)?(.*)|', $return_url))
|
382 |
+
return false;
|
383 |
+
|
384 |
+
return ($this->return_url = $return_url);
|
385 |
+
}
|
386 |
+
|
387 |
+
public function getReturnURL() {
|
388 |
+
return $this->return_url;
|
389 |
+
}
|
390 |
+
|
391 |
+
public function setReportURL($report_url) {
|
392 |
+
if (!preg_match('|(\w+)://([^/:]+)(:\d+)?(.*)|', $report_url)) {
|
393 |
+
return false;
|
394 |
+
}
|
395 |
+
|
396 |
+
return ($this->report_url = $report_url);
|
397 |
+
}
|
398 |
+
|
399 |
+
public function getReportURL() {
|
400 |
+
return $this->report_url;
|
401 |
+
}
|
402 |
+
|
403 |
+
public function setTransactionId($transaction_id) {
|
404 |
+
if (empty($transaction_id))
|
405 |
+
return false;
|
406 |
+
|
407 |
+
return ($this->transaction_id = $transaction_id);
|
408 |
+
}
|
409 |
+
|
410 |
+
public function getTransactionId() {
|
411 |
+
return $this->transaction_id;
|
412 |
+
}
|
413 |
+
|
414 |
+
public function getBankURL() {
|
415 |
+
return $this->bank_url;
|
416 |
+
}
|
417 |
+
|
418 |
+
public function getPaymentURL() {
|
419 |
+
return (string) $this->payment_url;
|
420 |
+
}
|
421 |
+
|
422 |
+
public function getPaidStatus() {
|
423 |
+
return $this->paid_status;
|
424 |
+
}
|
425 |
+
|
426 |
+
public function getBankStatus() {
|
427 |
+
return $this->status;
|
428 |
+
}
|
429 |
+
|
430 |
+
public function getConsumerInfo() {
|
431 |
+
return $this->consumer_info;
|
432 |
+
}
|
433 |
+
|
434 |
+
public function getErrorMessage() {
|
435 |
+
return $this->error_message;
|
436 |
+
}
|
437 |
+
|
438 |
+
public function getErrorCode() {
|
439 |
+
return $this->error_code;
|
440 |
+
}
|
441 |
+
|
442 |
+
}
|
app/code/community/Mollie/Ideal/Helper/Data.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Copyright (c) 2011, Mollie B.V. (A subsidiary of Stash Holding B.V.)
|
5 |
+
* All rights reserved.
|
6 |
+
*
|
7 |
+
* Redistribution and use in source and binary forms, with or without
|
8 |
+
* modification, are permitted provided that the following conditions are met:
|
9 |
+
*
|
10 |
+
* - Redistributions of source code must retain the above copyright notice,
|
11 |
+
* this list of conditions and the following disclaimer.
|
12 |
+
* - Redistributions in binary form must reproduce the above copyright
|
13 |
+
* notice, this list of conditions and the following disclaimer in the
|
14 |
+
* documentation and/or other materials provided with the distribution.
|
15 |
+
*
|
16 |
+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
|
17 |
+
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
18 |
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
19 |
+
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY
|
20 |
+
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
21 |
+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
22 |
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
23 |
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
24 |
+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
25 |
+
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
26 |
+
* DAMAGE.
|
27 |
+
*
|
28 |
+
* @category Mollie
|
29 |
+
* @package Mollie_Ideal
|
30 |
+
* @author Youssef Airoude (youssef@mollie.nl)
|
31 |
+
* @version v0.10
|
32 |
+
* @copyright Copyright (c) 2011 Mollie B.V. (http://www.mollie.nl)
|
33 |
+
* @license http://www.opensource.org/licenses/bsd-license.php Open Software License (OSL 3.0)
|
34 |
+
*
|
35 |
+
**/
|
36 |
+
|
37 |
+
class Mollie_Ideal_Helper_Data extends Mage_Core_Helper_Abstract {
|
38 |
+
|
39 |
+
}
|
40 |
+
|
41 |
+
?>
|
app/code/community/Mollie/Ideal/Model/Api.php
ADDED
@@ -0,0 +1,138 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Copyright (c) 2011, Mollie B.V. (A subsidiary of Stash Holding B.V.)
|
5 |
+
* All rights reserved.
|
6 |
+
*
|
7 |
+
* Redistribution and use in source and binary forms, with or without
|
8 |
+
* modification, are permitted provided that the following conditions are met:
|
9 |
+
*
|
10 |
+
* - Redistributions of source code must retain the above copyright notice,
|
11 |
+
* this list of conditions and the following disclaimer.
|
12 |
+
* - Redistributions in binary form must reproduce the above copyright
|
13 |
+
* notice, this list of conditions and the following disclaimer in the
|
14 |
+
* documentation and/or other materials provided with the distribution.
|
15 |
+
*
|
16 |
+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
|
17 |
+
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
18 |
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
19 |
+
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY
|
20 |
+
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
21 |
+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
22 |
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
23 |
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
24 |
+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
25 |
+
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
26 |
+
* DAMAGE.
|
27 |
+
*
|
28 |
+
* @category Mollie
|
29 |
+
* @package Mollie_Ideal
|
30 |
+
* @author Youssef Airoude (youssef@mollie.nl)
|
31 |
+
* @version v0.10
|
32 |
+
* @copyright Copyright (c) 2011 Mollie B.V. (http://www.mollie.nl)
|
33 |
+
* @license http://www.opensource.org/licenses/bsd-license.php Open Software License (OSL 3.0)
|
34 |
+
*
|
35 |
+
**/
|
36 |
+
|
37 |
+
class Mollie_Ideal_Model_Api extends Mollie_Ideal_Core {
|
38 |
+
|
39 |
+
public function __construct() {
|
40 |
+
// iDeal parent constructor //
|
41 |
+
parent::__construct($this->mePartnerId());
|
42 |
+
// Zet partner id voor double check. //
|
43 |
+
$this->setPartnerId($this->mePartnerId());
|
44 |
+
// Zet de profile-key //
|
45 |
+
$this->setProfileKey($this->meProfileKey());
|
46 |
+
// Zet de testmode //
|
47 |
+
if ($this->meTestMode() == 1) {
|
48 |
+
$this->setTestmode(false);
|
49 |
+
} else {
|
50 |
+
$this->setTestmode(true);
|
51 |
+
}
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Get module state
|
56 |
+
*
|
57 |
+
* @return Bool (Ex: true/false)
|
58 |
+
*/
|
59 |
+
public function meActive() {
|
60 |
+
return Mage::getStoreConfig('mollie/ideal/active');
|
61 |
+
exit;
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Get Test Mode state
|
66 |
+
*
|
67 |
+
* @return Bool (Ex: true/false)
|
68 |
+
*/
|
69 |
+
public function meTestMode() {
|
70 |
+
return Mage::getStoreConfig('mollie/ideal/testmode');
|
71 |
+
exit;
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Get PartnerID
|
76 |
+
*
|
77 |
+
* @link https://www.mollie.nl/beheer/account/
|
78 |
+
* @return Int (Ex: 123456)
|
79 |
+
*/
|
80 |
+
public function mePartnerId() {
|
81 |
+
return Mage::getStoreConfig('mollie/ideal/partnerid');
|
82 |
+
exit;
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Get profilekey
|
87 |
+
*
|
88 |
+
* @link https://www.mollie.nl/beheer/betaaldiensten/profielen/
|
89 |
+
* @return String (Ex: 123rp456)
|
90 |
+
*/
|
91 |
+
public function meProfileKey() {
|
92 |
+
return Mage::getStoreConfig('mollie/ideal/profilekey');
|
93 |
+
exit;
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Get Payment description
|
98 |
+
*
|
99 |
+
* @return String (Ex: Order - M59874531)
|
100 |
+
*/
|
101 |
+
public function meDescription() {
|
102 |
+
return Mage::getStoreConfig('mollie/ideal/description');
|
103 |
+
exit;
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Get Minimal order
|
108 |
+
*
|
109 |
+
* @return Int (Ex: 118 (Default))
|
110 |
+
*/
|
111 |
+
public function meMinOrder() {
|
112 |
+
return Mage::getStoreConfig('mollie/ideal/minpay');
|
113 |
+
exit;
|
114 |
+
}
|
115 |
+
|
116 |
+
/**
|
117 |
+
* Get Return URL
|
118 |
+
*
|
119 |
+
* @return String (Ex: http://www.mollie.nl/return.php)
|
120 |
+
*/
|
121 |
+
public function meReturnUrl() {
|
122 |
+
return Mage::getStoreConfig('mollie/ideal/returnurl');
|
123 |
+
exit;
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Get Report URL
|
128 |
+
*
|
129 |
+
* @return String (Ex: http://www.mollie.nl/report.php)
|
130 |
+
*/
|
131 |
+
public function meReportUrl() {
|
132 |
+
return Mage::getStoreConfig('mollie/ideal/reporturl');
|
133 |
+
exit;
|
134 |
+
}
|
135 |
+
|
136 |
+
}
|
137 |
+
|
138 |
+
?>
|
app/code/community/Mollie/Ideal/Model/Ideal.php
ADDED
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Copyright (c) 2011, Mollie B.V. (A subsidiary of Stash Holding B.V.)
|
5 |
+
* All rights reserved.
|
6 |
+
*
|
7 |
+
* Redistribution and use in source and binary forms, with or without
|
8 |
+
* modification, are permitted provided that the following conditions are met:
|
9 |
+
*
|
10 |
+
* - Redistributions of source code must retain the above copyright notice,
|
11 |
+
* this list of conditions and the following disclaimer.
|
12 |
+
* - Redistributions in binary form must reproduce the above copyright
|
13 |
+
* notice, this list of conditions and the following disclaimer in the
|
14 |
+
* documentation and/or other materials provided with the distribution.
|
15 |
+
*
|
16 |
+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
|
17 |
+
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
18 |
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
19 |
+
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY
|
20 |
+
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
21 |
+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
22 |
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
23 |
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
24 |
+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
25 |
+
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
26 |
+
* DAMAGE.
|
27 |
+
*
|
28 |
+
* @category Mollie
|
29 |
+
* @package Mollie_Ideal
|
30 |
+
* @author Youssef Airoude (youssef@mollie.nl)
|
31 |
+
* @version v0.10
|
32 |
+
* @copyright Copyright (c) 2011 Mollie B.V. (http://www.mollie.nl)
|
33 |
+
* @license http://www.opensource.org/licenses/bsd-license.php Open Software License (OSL 3.0)
|
34 |
+
*
|
35 |
+
**/
|
36 |
+
|
37 |
+
class Mollie_Ideal_Model_Ideal extends Mage_Payment_Model_Method_Abstract {
|
38 |
+
|
39 |
+
// iDeal
|
40 |
+
protected $_iDeal;
|
41 |
+
// Magento payment settings //
|
42 |
+
protected $_isGateway = true;
|
43 |
+
protected $_canAuthorize = true;
|
44 |
+
protected $_canUseCheckout = true;
|
45 |
+
protected $_code = "ideal";
|
46 |
+
protected $_formBlockType = 'ideal/form_ideal';
|
47 |
+
protected $_infoBlockType = 'ideal/info_ideal';
|
48 |
+
|
49 |
+
public function __construct() {
|
50 |
+
parent::_construct();
|
51 |
+
// iDEAL //
|
52 |
+
$this->_iDeal = Mage::getModel('ideal/api');
|
53 |
+
// Set banks //
|
54 |
+
$this->setData('banks', $this->_iDeal->getBanks());
|
55 |
+
}
|
56 |
+
|
57 |
+
// iDEAL kan alleen in NL gebruikt worden dus word ook alleen maar geactiveerd als de billing country NL is, NIET de shipping country.
|
58 |
+
public function canUseForCountry($country) {
|
59 |
+
if($country !== 'NL'){
|
60 |
+
return false;
|
61 |
+
}
|
62 |
+
|
63 |
+
return true;
|
64 |
+
}
|
65 |
+
|
66 |
+
// iDEAL kan alleen in euro's worden afgerekend.
|
67 |
+
public function canUseForCurrency($currencyCode) {
|
68 |
+
if ($currencyCode !== "EUR") {
|
69 |
+
return false;
|
70 |
+
}
|
71 |
+
|
72 |
+
return true;
|
73 |
+
}
|
74 |
+
|
75 |
+
public function assignData($data) {
|
76 |
+
if (!($data instanceof Varien_Object)) {
|
77 |
+
$data = new Varien_Object($data);
|
78 |
+
}
|
79 |
+
|
80 |
+
$info = $this->getInfoInstance();
|
81 |
+
foreach ($this->_iDeal->getBanks() as $id => $name) {
|
82 |
+
if ($data->getBankid() == $id) {
|
83 |
+
$info->setBankid($data->getBankid())->setBankName($name);
|
84 |
+
// Unofficial
|
85 |
+
$_SESSION['bank'] = $name;
|
86 |
+
Mage::register('bank_id', $id);
|
87 |
+
}
|
88 |
+
}
|
89 |
+
return $this;
|
90 |
+
}
|
91 |
+
|
92 |
+
// Redirect naar de mollie-gateway
|
93 |
+
public function getOrderPlaceRedirectUrl() {
|
94 |
+
return Mage::getUrl('ideal/api/payment', array('_secure' => true, '_query' => array('bank_id' => Mage::registry('bank_id'))));
|
95 |
+
}
|
96 |
+
|
97 |
+
}
|
98 |
+
|
99 |
+
?>
|
app/code/community/Mollie/Ideal/Model/Mysql4/Ideal.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Copyright (c) 2011, Mollie B.V. (A subsidiary of Stash Holding B.V.)
|
5 |
+
* All rights reserved.
|
6 |
+
*
|
7 |
+
* Redistribution and use in source and binary forms, with or without
|
8 |
+
* modification, are permitted provided that the following conditions are met:
|
9 |
+
*
|
10 |
+
* - Redistributions of source code must retain the above copyright notice,
|
11 |
+
* this list of conditions and the following disclaimer.
|
12 |
+
* - Redistributions in binary form must reproduce the above copyright
|
13 |
+
* notice, this list of conditions and the following disclaimer in the
|
14 |
+
* documentation and/or other materials provided with the distribution.
|
15 |
+
*
|
16 |
+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
|
17 |
+
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
18 |
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
19 |
+
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY
|
20 |
+
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
21 |
+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
22 |
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
23 |
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
24 |
+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
25 |
+
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
26 |
+
* DAMAGE.
|
27 |
+
*
|
28 |
+
* @category Mollie
|
29 |
+
* @package Mollie_Ideal
|
30 |
+
* @author Youssef Airoude (youssef@mollie.nl)
|
31 |
+
* @version v0.10
|
32 |
+
* @copyright Copyright (c) 2011 Mollie B.V. (http://www.mollie.nl)
|
33 |
+
* @license http://www.opensource.org/licenses/bsd-license.php Open Software License (OSL 3.0)
|
34 |
+
*
|
35 |
+
**/
|
36 |
+
|
37 |
+
class Mollie_Ideal_Model_Mysql4_Ideal extends Mage_Core_Model_Mysql4_Abstract
|
38 |
+
{
|
39 |
+
public function _construct()
|
40 |
+
{
|
41 |
+
// Note that the pos_id refers to the key field in your database table.
|
42 |
+
$this->_init('ideal/ideal', 'mollie_ideal_bankid');
|
43 |
+
}
|
44 |
+
}
|
app/code/community/Mollie/Ideal/Model/Mysql4/Ideal/Collection.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Copyright (c) 2011, Mollie B.V. (A subsidiary of Stash Holding B.V.)
|
5 |
+
* All rights reserved.
|
6 |
+
*
|
7 |
+
* Redistribution and use in source and binary forms, with or without
|
8 |
+
* modification, are permitted provided that the following conditions are met:
|
9 |
+
*
|
10 |
+
* - Redistributions of source code must retain the above copyright notice,
|
11 |
+
* this list of conditions and the following disclaimer.
|
12 |
+
* - Redistributions in binary form must reproduce the above copyright
|
13 |
+
* notice, this list of conditions and the following disclaimer in the
|
14 |
+
* documentation and/or other materials provided with the distribution.
|
15 |
+
*
|
16 |
+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
|
17 |
+
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
18 |
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
19 |
+
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY
|
20 |
+
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
21 |
+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
22 |
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
23 |
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
24 |
+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
25 |
+
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
26 |
+
* DAMAGE.
|
27 |
+
*
|
28 |
+
* @category Mollie
|
29 |
+
* @package Mollie_Ideal
|
30 |
+
* @author Youssef Airoude (youssef@mollie.nl)
|
31 |
+
* @version v0.10
|
32 |
+
* @copyright Copyright (c) 2011 Mollie B.V. (http://www.mollie.nl)
|
33 |
+
* @license http://www.opensource.org/licenses/bsd-license.php Open Software License (OSL 3.0)
|
34 |
+
*
|
35 |
+
**/
|
36 |
+
|
37 |
+
class Mollie_Ideal_Model_Mysql4_Ideal_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
|
38 |
+
|
39 |
+
public function _construct() {
|
40 |
+
parent::_construct();
|
41 |
+
$this->_init('ideal/ideal');
|
42 |
+
}
|
43 |
+
|
44 |
+
}
|
app/code/community/Mollie/Ideal/controllers/ApiController.php
ADDED
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Copyright (c) 2011, Mollie B.V. (A subsidiary of Stash Holding B.V.)
|
5 |
+
* All rights reserved.
|
6 |
+
*
|
7 |
+
* Redistribution and use in source and binary forms, with or without
|
8 |
+
* modification, are permitted provided that the following conditions are met:
|
9 |
+
*
|
10 |
+
* - Redistributions of source code must retain the above copyright notice,
|
11 |
+
* this list of conditions and the following disclaimer.
|
12 |
+
* - Redistributions in binary form must reproduce the above copyright
|
13 |
+
* notice, this list of conditions and the following disclaimer in the
|
14 |
+
* documentation and/or other materials provided with the distribution.
|
15 |
+
*
|
16 |
+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
|
17 |
+
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
18 |
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
19 |
+
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY
|
20 |
+
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
21 |
+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
22 |
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
23 |
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
24 |
+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
25 |
+
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
26 |
+
* DAMAGE.
|
27 |
+
*
|
28 |
+
* @category Mollie
|
29 |
+
* @package Mollie_Ideal
|
30 |
+
* @author Youssef Airoude (youssef@mollie.nl)
|
31 |
+
* @version v0.10
|
32 |
+
* @copyright Copyright (c) 2011 Mollie B.V. (http://www.mollie.nl)
|
33 |
+
* @license http://www.opensource.org/licenses/bsd-license.php Berkeley Software Distribution License (BSD-License 2)
|
34 |
+
*
|
35 |
+
**/
|
36 |
+
|
37 |
+
class Mollie_Ideal_ApiController extends Mage_Core_Controller_Front_Action {
|
38 |
+
|
39 |
+
// Ideal settings //
|
40 |
+
protected $_iDeal;
|
41 |
+
CONST IDEAL_STATE_PAYMENT_SUCCESS = "Betaling ontvangen";
|
42 |
+
CONST IDEAL_STATE_PAYMENT_PENDING = "Betaling afwachten";
|
43 |
+
CONST IDEAL_STATE_PAYMENT_CANCELD = "Betaling mislukt/afgebroken";
|
44 |
+
|
45 |
+
public function _construct() {
|
46 |
+
parent::_construct();
|
47 |
+
$this->_iDeal = Mage::getModel('ideal/api');
|
48 |
+
}
|
49 |
+
|
50 |
+
protected function _getCheckout() {
|
51 |
+
return Mage::getSingleton('checkout/session');
|
52 |
+
}
|
53 |
+
|
54 |
+
public function paymentAction() {
|
55 |
+
$session = $this->_getCheckout();
|
56 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($session->getLastRealOrderId());
|
57 |
+
$write = Mage::getSingleton('core/resource')->getConnection('core_write');
|
58 |
+
|
59 |
+
try {
|
60 |
+
if ($this->_iDeal->createPayment($_GET['bank_id'], intval(round($order->getGrandTotal(), 2) * 100), $this->_iDeal->meDescription(), $this->_iDeal->meReturnUrl(), $this->_iDeal->meReportUrl())) {
|
61 |
+
if (!$order->getId()) {
|
62 |
+
Mage::throwException('Geen order voor verwerking gevonden');
|
63 |
+
}
|
64 |
+
|
65 |
+
if ($write->query("INSERT INTO `mollie_ideal_payments` (`order_id`, `transaction_id`) VALUES ('{$order->getIncrementId()}', '{$this->_iDeal->getTransactionId()}')") &&
|
66 |
+
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, self::IDEAL_STATE_PAYMENT_PENDING, Mage::helper('ideal')->__('De klant is doorverwezen naar de geselecteerde bank'), false)->save()) {
|
67 |
+
$this->_redirectUrl($this->_iDeal->getBankURL());
|
68 |
+
}
|
69 |
+
}
|
70 |
+
} catch (Exception $e) {
|
71 |
+
Mage::throwException($e);
|
72 |
+
$order->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, self::IDEAL_STATE_PAYMENT_CANCELD, Mage::helper('ideal')->__($e), true)->save();
|
73 |
+
}
|
74 |
+
}
|
75 |
+
|
76 |
+
public function reportAction() {
|
77 |
+
$w = Mage::getSingleton('core/resource')->getConnection('core_write');
|
78 |
+
$r = Mage::getSingleton('core/resource')->getConnection('core_read');
|
79 |
+
|
80 |
+
try {
|
81 |
+
if (isset($_GET['transaction_id'])) {
|
82 |
+
$this->_iDeal->checkPayment($_GET['transaction_id']);
|
83 |
+
|
84 |
+
$order_id = $r->fetchAll("SELECT `order_id` FROM `mollie_ideal_payments` WHERE `transaction_id` = '{$_GET['transaction_id']}'");
|
85 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($order_id[0]['order_id']);
|
86 |
+
|
87 |
+
$user = $this->_iDeal->getConsumerInfo();
|
88 |
+
$w->query("UPDATE `mollie_ideal_payments` SET `bank_status` = '{$this->_iDeal->getBankStatus()}', `bank_account` = '{$user['consumerAccount']}'
|
89 |
+
WHERE `transaction_id` = '{$_GET['transaction_id']}' AND `bank_status` = ''");
|
90 |
+
|
91 |
+
if ($this->_iDeal->getPaidStatus() == true) {
|
92 |
+
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, self::IDEAL_STATE_PAYMENT_SUCCESS, Mage::helper('ideal')->__('De betaling is gelukt'), true)->save();
|
93 |
+
}
|
94 |
+
}
|
95 |
+
} catch (Exception $e) {
|
96 |
+
Mage::throwException($e);
|
97 |
+
$order->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, self::IDEAL_STATE_PAYMENT_CANCELD, Mage::helper('ideal')->__($e), true)->save();
|
98 |
+
}
|
99 |
+
}
|
100 |
+
|
101 |
+
public function returnAction() {
|
102 |
+
$r = Mage::getSingleton('core/resource')->getConnection('core_read');
|
103 |
+
|
104 |
+
try {
|
105 |
+
$oStatus = $r->fetchAll("SELECT `bank_status` FROM `mollie_ideal_payments` WHERE `transaction_id` = '{$_GET['transaction_id']}'");
|
106 |
+
|
107 |
+
if (isset($_GET['transaction_id'])) {
|
108 |
+
if ($oStatus[0]['bank_status'] == "Success") {
|
109 |
+
$this->_redirect('checkout/onepage/success');
|
110 |
+
} else {
|
111 |
+
$this->_redirect('checkout/onepage/failure');
|
112 |
+
}
|
113 |
+
} else {
|
114 |
+
$this->_redirect('checkout/onepage/failure');
|
115 |
+
}
|
116 |
+
} catch (Exception $e) {
|
117 |
+
Mage::throwException($e);
|
118 |
+
}
|
119 |
+
}
|
120 |
+
|
121 |
+
}
|
122 |
+
|
123 |
+
?>
|
app/code/community/Mollie/Ideal/etc/config.xml
ADDED
@@ -0,0 +1,146 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<!-- Mollie Ideal Module -->
|
4 |
+
<modules>
|
5 |
+
<Mollie_Ideal>
|
6 |
+
<version>1.2.0</version>
|
7 |
+
</Mollie_Ideal>
|
8 |
+
</modules>
|
9 |
+
|
10 |
+
<!-- Global settings -->
|
11 |
+
<global>
|
12 |
+
<!-- DB voor payment onecheckpage -->
|
13 |
+
<fieldsets>
|
14 |
+
<sales_convert_quote_payment>
|
15 |
+
<mollie_ideal_bankid>
|
16 |
+
<to_order_payment>*</to_order_payment>
|
17 |
+
</mollie_ideal_bankid>
|
18 |
+
<mollie_ideal_bankname>
|
19 |
+
<to_order_payment>*</to_order_payment>
|
20 |
+
</mollie_ideal_bankname>
|
21 |
+
</sales_convert_quote_payment>
|
22 |
+
</fieldsets>
|
23 |
+
<!-- ideal models -->
|
24 |
+
<models>
|
25 |
+
<ideal>
|
26 |
+
<class>Mollie_Ideal_Model</class>
|
27 |
+
<resourceModel>ideal_mysql4</resourceModel>
|
28 |
+
</ideal>
|
29 |
+
<ideal_mysql4>
|
30 |
+
<class>Mollie_Ideal_Model_Mysql4</class>
|
31 |
+
<entities>
|
32 |
+
<ideal>
|
33 |
+
<table>mollie_ideal_payments</table>
|
34 |
+
<table>sales_flat_quote_payment</table>
|
35 |
+
<table>sales_flat_order_payment</table>
|
36 |
+
<table>sales_flat_order_grid</table>
|
37 |
+
<table>sales_flat_order</table>
|
38 |
+
</ideal>
|
39 |
+
</entities>
|
40 |
+
</ideal_mysql4>
|
41 |
+
</models>
|
42 |
+
<!-- ideal blocks -->
|
43 |
+
<blocks>
|
44 |
+
<ideal>
|
45 |
+
<class>Mollie_Ideal_Block</class>
|
46 |
+
</ideal>
|
47 |
+
<payment>
|
48 |
+
<class>Mollie_Ideal_Block</class>
|
49 |
+
<class>Mage_Payment_Block</class>
|
50 |
+
</payment>
|
51 |
+
</blocks>
|
52 |
+
<!-- ideal helpers -->
|
53 |
+
<helpers>
|
54 |
+
<ideal>
|
55 |
+
<class>Mollie_Ideal_Helper</class>
|
56 |
+
</ideal>
|
57 |
+
</helpers>
|
58 |
+
<!-- ideal payment -->
|
59 |
+
<payment>
|
60 |
+
<groups>
|
61 |
+
<mollie>Mollie</mollie>
|
62 |
+
</groups>
|
63 |
+
</payment>
|
64 |
+
<!-- ideal core resources -->
|
65 |
+
<resources>
|
66 |
+
<ideal_setup>
|
67 |
+
<setup>
|
68 |
+
<module>Mollie_Ideal</module>
|
69 |
+
</setup>
|
70 |
+
<connection>
|
71 |
+
<use>core_setup</use>
|
72 |
+
</connection>
|
73 |
+
</ideal_setup>
|
74 |
+
<ideal_write>
|
75 |
+
<connection>
|
76 |
+
<use>core_write</use>
|
77 |
+
</connection>
|
78 |
+
</ideal_write>
|
79 |
+
<ideal_read>
|
80 |
+
<connection>
|
81 |
+
<use>core_read</use>
|
82 |
+
</connection>
|
83 |
+
</ideal_read>
|
84 |
+
</resources>
|
85 |
+
</global>
|
86 |
+
|
87 |
+
<!-- Dit is de mollie menu in sales tab -->
|
88 |
+
<adminhtml>
|
89 |
+
<acl>
|
90 |
+
<resources>
|
91 |
+
<all>
|
92 |
+
<title>Allow Everything</title>
|
93 |
+
</all>
|
94 |
+
<admin>
|
95 |
+
<children>
|
96 |
+
<system>
|
97 |
+
<children>
|
98 |
+
<config>
|
99 |
+
<children>
|
100 |
+
<mollie>
|
101 |
+
<title>Mollie Betaal Methode(s)</title>
|
102 |
+
</mollie>
|
103 |
+
</children>
|
104 |
+
</config>
|
105 |
+
</children>
|
106 |
+
</system>
|
107 |
+
</children>
|
108 |
+
</admin>
|
109 |
+
</resources>
|
110 |
+
</acl>
|
111 |
+
</adminhtml>
|
112 |
+
|
113 |
+
<!-- Frontend for controllers -->
|
114 |
+
<frontend>
|
115 |
+
<routers>
|
116 |
+
<ideal>
|
117 |
+
<use>standard</use>
|
118 |
+
<args>
|
119 |
+
<module>Mollie_Ideal</module>
|
120 |
+
<frontName>ideal</frontName>
|
121 |
+
</args>
|
122 |
+
</ideal>
|
123 |
+
</routers>
|
124 |
+
<layout>
|
125 |
+
<updates>
|
126 |
+
<ideal>
|
127 |
+
<file>ideal.xml</file>
|
128 |
+
</ideal>
|
129 |
+
</updates>
|
130 |
+
</layout>
|
131 |
+
</frontend>
|
132 |
+
|
133 |
+
<!-- iDeal in Payment lijst zetten in -->
|
134 |
+
<default>
|
135 |
+
<payment>
|
136 |
+
<ideal>
|
137 |
+
<active>1</active>
|
138 |
+
<title>iDEAL via Mollie</title>
|
139 |
+
<model>ideal/ideal</model>
|
140 |
+
<allowspecific>0</allowspecific>
|
141 |
+
<group>mollie</group>
|
142 |
+
<specificcountry>NL</specificcountry>
|
143 |
+
</ideal>
|
144 |
+
</payment>
|
145 |
+
</default>
|
146 |
+
</config>
|
app/code/community/Mollie/Ideal/etc/system.xml
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
|
3 |
+
<config>
|
4 |
+
<sections>
|
5 |
+
<mollie>
|
6 |
+
<label><![CDATA[ <img src="https://www.mollie.nl/files/Mollie-Logo-Style-Small.png" alt='Mollie' height='22' /> ]]>
|
7 |
+
</label>
|
8 |
+
<tab>sales</tab>
|
9 |
+
<frontend_type>text</frontend_type>
|
10 |
+
<sort_order>910</sort_order>
|
11 |
+
<show_in_default>1</show_in_default>
|
12 |
+
<show_in_website>1</show_in_website>
|
13 |
+
<show_in_store>1</show_in_store>
|
14 |
+
<groups>
|
15 |
+
<ideal translate="label" module="ideal">
|
16 |
+
<label>iDeal</label>
|
17 |
+
<sort_order>1</sort_order>
|
18 |
+
<frontend_type>text</frontend_type>
|
19 |
+
<show_in_default>1</show_in_default>
|
20 |
+
<show_in_website>0</show_in_website>
|
21 |
+
<show_in_store>0</show_in_store>
|
22 |
+
|
23 |
+
<fields>
|
24 |
+
<active translate="label">
|
25 |
+
<label>Enabled</label>
|
26 |
+
<frontend_type>select</frontend_type>
|
27 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
28 |
+
<sort_order>1</sort_order>
|
29 |
+
<show_in_default>1</show_in_default>
|
30 |
+
<show_in_website>1</show_in_website>
|
31 |
+
<show_in_store>0</show_in_store>
|
32 |
+
</active>
|
33 |
+
|
34 |
+
<testmode translate="label">
|
35 |
+
<label>Testmode</label>
|
36 |
+
<frontend_type>select</frontend_type>
|
37 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
38 |
+
<sort_order>2</sort_order>
|
39 |
+
<show_in_default>1</show_in_default>
|
40 |
+
<show_in_website>1</show_in_website>
|
41 |
+
<show_in_store>0</show_in_store>
|
42 |
+
</testmode>
|
43 |
+
|
44 |
+
<partnerid translate="label">
|
45 |
+
<label>Partner ID</label>
|
46 |
+
<frontend_type>text</frontend_type>
|
47 |
+
<sort_order>3</sort_order>
|
48 |
+
<show_in_default>1</show_in_default>
|
49 |
+
<show_in_website>1</show_in_website>
|
50 |
+
<show_in_store>0</show_in_store>
|
51 |
+
<validate>required-entry validate-not-negative-number validate-digits</validate>
|
52 |
+
</partnerid>
|
53 |
+
|
54 |
+
<profilekey translate="label">
|
55 |
+
<label>Profile Key</label>
|
56 |
+
<frontend_type>text</frontend_type>
|
57 |
+
<sort_order>5</sort_order>
|
58 |
+
<show_in_default>1</show_in_default>
|
59 |
+
<show_in_website>1</show_in_website>
|
60 |
+
<show_in_store>1</show_in_store>
|
61 |
+
<validate>validate-not-negative-number validate-alphanum</validate>
|
62 |
+
</profilekey>
|
63 |
+
|
64 |
+
<description translate="label">
|
65 |
+
<label>Beschrijving</label>
|
66 |
+
<frontend_type>text</frontend_type>
|
67 |
+
<sort_order>6</sort_order>
|
68 |
+
<show_in_default>1</show_in_default>
|
69 |
+
<show_in_website>1</show_in_website>
|
70 |
+
<show_in_store>1</show_in_store>
|
71 |
+
<validate>required-entry</validate>
|
72 |
+
</description>
|
73 |
+
|
74 |
+
<minpay translate="label">
|
75 |
+
<label>Minimale order bedrag</label>
|
76 |
+
<frontend_type>text</frontend_type>
|
77 |
+
<sort_order>7</sort_order>
|
78 |
+
<show_in_default>1</show_in_default>
|
79 |
+
<show_in_website>1</show_in_website>
|
80 |
+
<show_in_store>1</show_in_store>
|
81 |
+
<validate>required-entry validate-not-negative-number validate-digits validate-greater-than-zero</validate>
|
82 |
+
</minpay>
|
83 |
+
</fields>
|
84 |
+
</ideal>
|
85 |
+
</groups>
|
86 |
+
</mollie>
|
87 |
+
</sections>
|
88 |
+
</config>
|
app/code/community/Mollie/Ideal/sql/ideal_setup/mysql4-install-1.2.0.php
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Copyright (c) 2011, Mollie B.V. (A subsidiary of Stash Holding B.V.)
|
5 |
+
* All rights reserved.
|
6 |
+
*
|
7 |
+
* Redistribution and use in source and binary forms, with or without
|
8 |
+
* modification, are permitted provided that the following conditions are met:
|
9 |
+
*
|
10 |
+
* - Redistributions of source code must retain the above copyright notice,
|
11 |
+
* this list of conditions and the following disclaimer.
|
12 |
+
* - Redistributions in binary form must reproduce the above copyright
|
13 |
+
* notice, this list of conditions and the following disclaimer in the
|
14 |
+
* documentation and/or other materials provided with the distribution.
|
15 |
+
*
|
16 |
+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
|
17 |
+
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
18 |
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
19 |
+
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY
|
20 |
+
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
21 |
+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
22 |
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
23 |
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
24 |
+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
25 |
+
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
26 |
+
* DAMAGE.
|
27 |
+
*
|
28 |
+
* @category Mollie
|
29 |
+
* @package Mollie_Ideal
|
30 |
+
* @author Youssef Airoude (youssef@mollie.nl)
|
31 |
+
* @version v0.10
|
32 |
+
* @copyright Copyright (c) 2011 Mollie B.V. (http://www.mollie.nl)
|
33 |
+
* @license http://www.opensource.org/licenses/bsd-license.php Open Software License (OSL 3.0)
|
34 |
+
*
|
35 |
+
**/
|
36 |
+
|
37 |
+
$installer = $this;
|
38 |
+
$installer->startSetup();
|
39 |
+
/*
|
40 |
+
$installer->run("
|
41 |
+
|
42 |
+
ALTER TABLE `{$installer->getTable('sales/quote_payment')}` ADD `mollie_ideal_bankid` INT( 11 ) NOT NULL ;
|
43 |
+
ALTER TABLE `{$installer->getTable('sales/quote_payment')}` ADD `mollie_ideal_bankname` VARCHAR( 20 ) NOT NULL ;
|
44 |
+
|
45 |
+
ALTER TABLE `{$installer->getTable('sales/order_payment')}` ADD `mollie_ideal_bankid` INT( 11 ) NOT NULL ;
|
46 |
+
ALTER TABLE `{$installer->getTable('sales/order_payment')}` ADD `mollie_ideal_bankname` VARCHAR( 20 ) NOT NULL ;
|
47 |
+
|
48 |
+
");
|
49 |
+
*/
|
50 |
+
$installer->endSetup();
|
51 |
+
?>
|
app/design/frontend/default/default/layout/ideal.xml
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="1.2.0">
|
3 |
+
<default></default>
|
4 |
+
<!--
|
5 |
+
<ideal_api_return translate="label">
|
6 |
+
<label>iDeal Betaling (Powerd by Mollie.nl)</label>
|
7 |
+
<reference name="root">
|
8 |
+
<action method="setTemplate">
|
9 |
+
<template>page/2columns-right.phtml</template>
|
10 |
+
</action>
|
11 |
+
<action method="setHeaderTitle" translate="title" module="ideal">
|
12 |
+
<title>iDeal</title>
|
13 |
+
</action>
|
14 |
+
</reference>
|
15 |
+
<reference name="content">
|
16 |
+
<block type="core/template" name="contactForm" template="ideal/payment/return.phtml"/>
|
17 |
+
</reference>
|
18 |
+
</ideal_api_return>
|
19 |
+
-->
|
20 |
+
</layout>
|
app/design/frontend/default/default/template/ideal/form/ideal.phtml
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php $_code = $this->getMethodCode(); ?>
|
2 |
+
<?php $_banks = $this->getMethod()->getData('banks'); ?>
|
3 |
+
<ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
|
4 |
+
<li>
|
5 |
+
<label for="<?php echo $_code ?>_bank_id" class="required"><em>*</em><?php echo $this->__('Selecteer uw bank:') ?></label>
|
6 |
+
<span class="input-box">
|
7 |
+
<select name="payment[bankid]" class="required-entry input-text" id="<?php echo $_code; ?>_bank_id" title="<?php echo $_code; ?>_bank_id">
|
8 |
+
<option value=''>Kies uw bank</option>
|
9 |
+
<?php foreach ($_banks as $bank_id => $bank_name): ?>
|
10 |
+
<option value="<?php echo $bank_id ?>"><?php echo $bank_name ?></option>
|
11 |
+
<?php endforeach; ?>
|
12 |
+
</select>
|
13 |
+
</span>
|
14 |
+
</li>
|
15 |
+
</ul>
|
app/design/frontend/default/default/template/ideal/partner/logo.phtml
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @see Mage_Paypal_Block_Logo
|
4 |
+
*/
|
5 |
+
?>
|
6 |
+
<div class="ideal-logo">
|
7 |
+
<a href="#" title="<?php echo Mage::helper('ideal')->__('Additional Options') ?>" onclick="javascript:window.open('<?php echo $this->getAboutPaypalPageUrl() ?>','paypal','width=600,height=350,left=0,top=0,location=no,status=yes,scrollbars=yes,resizable=yes'); return false;"><img src="<?php echo $this->escapeHtml($this->getLogoImageUrl()) ?>" alt="<?php echo Mage::helper('paypal')->__('Additional Options') ?>" /></a>
|
8 |
+
</div>
|
app/etc/modules/Mollie_Ideal.xml
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Mollie_Ideal>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
<depends>
|
8 |
+
<Mage_Payment />
|
9 |
+
</depends>
|
10 |
+
<version>1.2.0</version>
|
11 |
+
</Mollie_Ideal>
|
12 |
+
</modules>
|
13 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>mollie_ideal</name>
|
4 |
+
<version>1.2.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://www.opensource.org/licenses/bsd-license.php">BSDL</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>iDEAL betaal methode voor Magento door Mollie</summary>
|
10 |
+
<description>Zeer stabiel en gratis iDEAL module voor Mollie klanten.</description>
|
11 |
+
<notes>Next release</notes>
|
12 |
+
<authors><author><name>Youssef</name><user>auto-converted</user><email>youssef@mollie.nl</email></author></authors>
|
13 |
+
<date>2011-11-16</date>
|
14 |
+
<time>15:17:49</time>
|
15 |
+
<contents><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="ideal.xml" hash="d8ad2032d97d0cc27fd441b22925d248"/></dir><dir name="template"><dir name="ideal"><dir name="form"><file name="ideal.phtml" hash="33c61539eeaf9586e5faace02bb2bcee"/></dir><dir name="partner"><file name="logo.phtml" hash="2ad55fb9608bba24dcc780d81cadcd43"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Mollie_Ideal.xml" hash="f2d308d49aa883cc33b8d3d0d77084d8"/></dir></target><target name="magecommunity"><dir name="Mollie"><dir name="Ideal"><dir name="Block"><dir name="Form"><file name="Ideal.php" hash="00c0ba149af75c8a8a992a3ebc6ff209"/></dir><dir name="Info"><file name="Ideal.php" hash="a391be324eb86ba57d3c7d5e609207a2"/></dir></dir><dir name="controllers"><file name="ApiController.php" hash="a28e938e94b02802abaa932fa12246df"/></dir><dir name="etc"><file name="config.xml" hash="36a1eda50638177753b23c25496f980f"/><file name="system.xml" hash="81a1d5486b82efa9c064467d026c8680"/></dir><dir name="Helper"><file name="Data.php" hash="14461b593b17a6acc65c02ceb783acf9"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Ideal"><file name="Collection.php" hash="b4ae069205137334a8227711901f85c6"/></dir><file name="Ideal.php" hash="d3cc137ab6f322ded7ef84af06361539"/></dir><file name="Api.php" hash="d6ef39d112275f89c00b4062bade02bb"/><file name="Ideal.php" hash="16e202e118c94861acea9c213553c255"/></dir><dir name="sql"><dir name="ideal_setup"><file name="mysql4-install-1.2.0.php" hash="83c756060cf772b22654a69b9741f3eb"/></dir></dir><file name="Core.php" hash="69e400b7ccbca0a2e04ed795e5d4a098"/></dir></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies/>
|
18 |
+
</package>
|