Cardgate_Cgp - Version 1.0.28

Version Notes

- Changed payment redirect message.

Download this release

Release Info

Developer Magento Core Team
Extension Cardgate_Cgp
Version 1.0.28
Comparing to
See all releases


Version 1.0.28

Files changed (40) hide show
  1. app/code/local/Cardgate/Cgp/Block/Form/Ideal.php +109 -0
  2. app/code/local/Cardgate/Cgp/Block/Form/Klarna.php +649 -0
  3. app/code/local/Cardgate/Cgp/Block/Form/Klarnaaccount.php +637 -0
  4. app/code/local/Cardgate/Cgp/Block/Redirect.php +43 -0
  5. app/code/local/Cardgate/Cgp/Helper/Data.php +32 -0
  6. app/code/local/Cardgate/Cgp/Model/Adminhtml/System/Config/Source/Languages.php +69 -0
  7. app/code/local/Cardgate/Cgp/Model/Adminhtml/System/Config/Source/Modes.php +33 -0
  8. app/code/local/Cardgate/Cgp/Model/Base.php +415 -0
  9. app/code/local/Cardgate/Cgp/Model/Gateway/Abstract.php +555 -0
  10. app/code/local/Cardgate/Cgp/Model/Gateway/Americanexpress.php +23 -0
  11. app/code/local/Cardgate/Cgp/Model/Gateway/Banktransfer.php +23 -0
  12. app/code/local/Cardgate/Cgp/Model/Gateway/Default.php +22 -0
  13. app/code/local/Cardgate/Cgp/Model/Gateway/Directdebit.php +23 -0
  14. app/code/local/Cardgate/Cgp/Model/Gateway/Giropay.php +23 -0
  15. app/code/local/Cardgate/Cgp/Model/Gateway/Ideal.php +24 -0
  16. app/code/local/Cardgate/Cgp/Model/Gateway/Klarna.php +35 -0
  17. app/code/local/Cardgate/Cgp/Model/Gateway/Klarnaaccount.php +36 -0
  18. app/code/local/Cardgate/Cgp/Model/Gateway/Maestro.php +23 -0
  19. app/code/local/Cardgate/Cgp/Model/Gateway/Mastercard.php +23 -0
  20. app/code/local/Cardgate/Cgp/Model/Gateway/Mistercash.php +23 -0
  21. app/code/local/Cardgate/Cgp/Model/Gateway/Paypal.php +23 -0
  22. app/code/local/Cardgate/Cgp/Model/Gateway/Przelewy24.php +23 -0
  23. app/code/local/Cardgate/Cgp/Model/Gateway/Sofortbanking.php +23 -0
  24. app/code/local/Cardgate/Cgp/Model/Gateway/Visa.php +23 -0
  25. app/code/local/Cardgate/Cgp/Model/Gateway/Vpay.php +23 -0
  26. app/code/local/Cardgate/Cgp/Model/Gateway/Webmoney.php +24 -0
  27. app/code/local/Cardgate/Cgp/Model/Observer.php +69 -0
  28. app/code/local/Cardgate/Cgp/controllers/StandardController.php +196 -0
  29. app/code/local/Cardgate/Cgp/etc/adminhtml.xml +40 -0
  30. app/code/local/Cardgate/Cgp/etc/config.xml +318 -0
  31. app/code/local/Cardgate/Cgp/etc/system.xml +1084 -0
  32. app/design/frontend/base/default/template/cardgate/cgp/form/ideal.phtml +26 -0
  33. app/design/frontend/base/default/template/cardgate/cgp/form/klarna.phtml +102 -0
  34. app/design/frontend/base/default/template/cardgate/cgp/form/klarnaaccount.phtml +100 -0
  35. app/design/frontend/base/default/template/cardgate/cgp/redirect.phtml +15 -0
  36. app/etc/modules/Cardgate_Cgp.xml +30 -0
  37. app/locale/nl_NL/Cardgate_Cgp.csv +77 -0
  38. package.xml +18 -0
  39. skin/adminhtml/default/default/cardgate_cgp.css +28 -0
  40. skin/adminhtml/default/default/images/cardgate/cardgate_cgp.png +0 -0
app/code/local/Cardgate/Cgp/Block/Form/Ideal.php ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento CardGatePlus payment extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Mage
13
+ * @package Cardgate_Cgp
14
+ * @author Paul Saparov, <support@cardgate.com>
15
+ * @copyright Copyright (c) 2011 CardGatePlus B.V. (http://www.cardgateplus.com)
16
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
+ */
18
+
19
+ class Cardgate_Cgp_Block_Form_Ideal extends Mage_Payment_Block_Form
20
+ {
21
+ protected $_banks = array(
22
+ '0021' => 'Rabobank',
23
+ '0031' => 'ABN Amro',
24
+ '0091' => 'Friesland Bank',
25
+ '0721' => 'ING',
26
+ '0751' => 'SNS Bank',
27
+ '0001' => '------ Additional Banks ------',
28
+ '0161' => 'Van Lanschot Bank',
29
+ '0511' => 'Triodos Bank',
30
+ '0761' => 'ASN Bank',
31
+ '0771' => 'SNS Regio Bank',
32
+ );
33
+
34
+ protected function _construct()
35
+ {
36
+ parent::_construct();
37
+ $this->setTemplate('cardgate/cgp/form/ideal.phtml');
38
+ }
39
+
40
+ /**
41
+ * Return information payment object
42
+ *
43
+ * @return Mage_Payment_Model_Info
44
+ */
45
+ public function getInfoInstance()
46
+ {
47
+ return $this->getMethod()->getInfoInstance();
48
+ }
49
+
50
+ /**
51
+ * Returns HTML options for select field with iDEAL banks
52
+ *
53
+ * @return string
54
+ */
55
+ public function getSelectField()
56
+ {
57
+ $a2 = array();
58
+ $aBanks = $this->getBankOptions();
59
+ foreach ($aBanks as $id => $name) {
60
+ $a2[$id] = Mage::helper('cgp')->__($name);
61
+ }
62
+ $_code = $this->getMethodCode();
63
+
64
+ $form = new Varien_Data_Form();
65
+ $form->addField($_code.'_ideal_issuer', 'select', array(
66
+ 'name' => 'payment[cgp][ideal_issuer_id]',
67
+ 'class' => 'required-entry',
68
+ 'label' => Mage::helper('cgp')->__('Select your bank'),
69
+ 'values' => $a2,
70
+ 'value' => '',
71
+ 'required' => true,
72
+ 'disabled' => false,
73
+ ));
74
+ return $form->getHtml();
75
+ }
76
+
77
+ /**
78
+ * Fetch iDEAL bank options from CardGatePlus if possible and return as array.
79
+ *
80
+ * @return array
81
+ */
82
+
83
+ private function getBankOptions(){
84
+ $url = 'https://gateway.cardgateplus.com/cache/idealDirectoryRabobank.dat';
85
+ if( !ini_get('allow_url_fopen') || !function_exists('file_get_contents') ) {
86
+ $result = false;
87
+ } else {
88
+ $result = file_get_contents($url);
89
+ }
90
+
91
+ $aBanks = array();
92
+
93
+ if ($result) {
94
+ $aBanks = unserialize($result);
95
+ unset($aBanks[0]);
96
+ $a2 = array();
97
+ foreach ($aBanks as $id => $name) {
98
+ if ($id==1) $id='0001';
99
+ $a2[$id] = $name;
100
+ }
101
+ $aBanks = $a2;
102
+ $aBanks = array_merge(array(''=>Mage::helper('cgp')->__('--Please select--')),$aBanks);
103
+ }
104
+ if (count($aBanks)< 1) {
105
+ $aBanks = array_merge(array(''=>Mage::helper('cgp')->__('--Please select--')),$this->_banks);
106
+ }
107
+ return $aBanks;
108
+ }
109
+ }
app/code/local/Cardgate/Cgp/Block/Form/Klarna.php ADDED
@@ -0,0 +1,649 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento CardGatePlus payment extension
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
+ *
13
+ * @category Mage
14
+ * @package Cardgate_Cgp
15
+ * @author Paul Saparov, <support@cardgate.com>
16
+ * @copyright Copyright (c) 2011 CardGatePlus B.V. (http://www.cardgateplus.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+ class Cardgate_Cgp_Block_Form_Klarna extends Mage_Payment_Block_Form {
20
+
21
+ protected function _construct() {
22
+ parent::_construct();
23
+ $this->setTemplate( 'cardgate/cgp/form/klarna.phtml' );
24
+ }
25
+
26
+ /**
27
+ * Return information payment object
28
+ *
29
+ * @return Mage_Payment_Model_Info
30
+ */
31
+ public function getInfoInstance() {
32
+ return $this->getMethod()->getInfoInstance();
33
+ }
34
+
35
+ public function getYear() {
36
+ $yr = 'Year';
37
+ switch ( $this->getLocaleCode() ) {
38
+ case 'de_AT':
39
+ $yr = 'Jahr';
40
+ break;
41
+ case 'da_DK':
42
+ $yr = 'Ar';
43
+ break;
44
+ case 'fi_FI':
45
+ $yr = 'Vuosi';
46
+ break;
47
+ case 'de_DE':
48
+ $yr = 'Jahr';
49
+ break;
50
+ case 'nl_NL';
51
+ $yr = 'Jaar';
52
+ break;
53
+ case 'nb_NO':
54
+ $yr = 'Ar';
55
+ break;
56
+ case 'sv_SE':
57
+ $yr = 'Ar';
58
+ break;
59
+ }
60
+
61
+ $str = '<option value="">' . $yr . '</option>';
62
+ for ( $x = date( 'Y' ); $x >= 1900; $x-- ) {
63
+ $str.='<option value="' . $x . '">' . $x . '</option/>';
64
+ }
65
+ return $str;
66
+ }
67
+
68
+ public function getMonth() {
69
+
70
+ $str = '<option value="">Month</option>';
71
+ for ( $x = 1; $x < 13; $x++ ) {
72
+ $str.= '<option value="' . sprintf( "%02d", $x ) . '">' . date( 'F', mktime( 1, 1, 1, $x, 1, 1970 ) ) . '</option>';
73
+ }
74
+
75
+ switch ( $this->getLocaleCode() ) {
76
+ case 'de_AT':
77
+ $str = '<option value="">Monat</option>
78
+ <option value="01">Januar</option>
79
+ <option value="02">Februar</option>
80
+ <option value="03">März</option>
81
+ <option value="04">April</option>
82
+ <option value="05">Mai</option>
83
+ <option value="06">Juni</option>
84
+ <option value="07">Juli</option>
85
+ <option value="08">August</option>
86
+ <option value="09">September</option>
87
+ <option value="10">Oktober</option>
88
+ <option value="11">November</option>
89
+ <option value="12">Dezember</option>';
90
+ break;
91
+ case 'da_DK':
92
+ $str = '<option value="">Måned</option>
93
+ <option value="01">Januar</option>
94
+ <option value="02">Februar</option>
95
+ <option value="03">Marts</option>
96
+ <option value="04">April</option>
97
+ <option value="05">Maj</option>
98
+ <option value="06">Juni</option>
99
+ <option value="07">Juli</option>
100
+ <option value="08">August</option>
101
+ <option value="09">September</option>
102
+ <option value="10">Oktober</option>
103
+ <option value="11">November</option>
104
+ <option value="12">December</option>';
105
+ break;
106
+ case 'fi_FI':
107
+ $str = '<option value="">Kuukausi</option>
108
+ <option value="01">Tammikuu</option>
109
+ <option value="02">Helmikuu</option>
110
+ <option value="03">Maaliskuu</option>
111
+ <option value="04">Huhtikuu</option>
112
+ <option value="05">Toukokuu</option>
113
+ <option value="06">Kesäkuu</option>
114
+ <option value="07">Heinäkuu</option>
115
+ <option value="08">Elokuu</option>
116
+ <option value="09">Syyskuu</option>
117
+ <option value="10">Lokakuu</option>
118
+ <option value="11">Marraskuu</option>
119
+ <option value="12">Joulukuu</option>';
120
+ break;
121
+ case 'de_DE':
122
+ $str = '<option value="">Monat</option>
123
+ <option value="01">Januar</option>
124
+ <option value="02">Februar</option>
125
+ <option value="03">März</option>
126
+ <option value="04">April</option>
127
+ <option value="05">Mai</option>
128
+ <option value="06">Juni</option>
129
+ <option value="07">Juli</option>
130
+ <option value="08">August</option>
131
+ <option value="09">September</option>
132
+ <option value="10">Oktober</option>
133
+ <option value="11">November</option>
134
+ <option value="12">Dezember</option>';
135
+ break;
136
+ case 'nl_NL';
137
+ $str = '<option value="">Maand</option>
138
+ <option value="01">januari</option>
139
+ <option value="02">februari</option>
140
+ <option value="03">maart</option>
141
+ <option value="04">april</option>
142
+ <option value="05">mei</option>
143
+ <option value="06">juni</option>
144
+ <option value="07">juli</option>
145
+ <option value="08">augustus</option>
146
+ <option value="09">september</option>
147
+ <option value="10">oktober</option>
148
+ <option value="11">november</option>
149
+ <option value="12">december</option>';
150
+ break;
151
+ case 'nb_NO':
152
+ $str = '<option value="">Måned</option>
153
+ <option value="01">Januar</option>
154
+ <option value="02">Februar</option>
155
+ <option value="03">Mars</option>
156
+ <option value="04">April</option>
157
+ <option value="05">Mai</option>
158
+ <option value="06">Juni</option>
159
+ <option value="07">Juli</option>
160
+ <option value="08">August</option>
161
+ <option value="09">September</option>
162
+ <option value="10">Oktober</option>
163
+ <option value="11">November</option>
164
+ <option value="12">Desember</option>';
165
+ break;
166
+ case 'sv_SE':
167
+ $str = '<option value="">Månad</option>
168
+ <option value="01">januari</option>
169
+ <option value="02">februari</option>
170
+ <option value="03">mars</option>
171
+ <option value="04">april</option>
172
+ <option value="05">maj</option>
173
+ <option value="06">juni</option>
174
+ <option value="07">juli</option>
175
+ <option value="08">augusti</option>
176
+ <option value="09">september</option>
177
+ <option value="10">oktober</option>
178
+ <option value="11">november</option>
179
+ <option value="12">december</option>';
180
+ break;
181
+ }
182
+
183
+ return $str;
184
+ }
185
+
186
+ public function getDay() {
187
+ $day = 'Day';
188
+ switch ( $this->getLocaleCode() ) {
189
+ case 'de_AT':
190
+ $day = 'Tag';
191
+ break;
192
+ case 'da_DK':
193
+ $day = 'Dag';
194
+ break;
195
+ case 'fi_FI':
196
+ $day = 'Päivä';
197
+ break;
198
+ case 'de_DE':
199
+ $day = 'Tag';
200
+ break;
201
+ case 'nl_NL';
202
+ $day = 'Dag';
203
+ break;
204
+ case 'nb_NO':
205
+ $day = 'Dag';
206
+ break;
207
+ case 'sv_SE':
208
+ $day = 'Dag';
209
+ break;
210
+ }
211
+
212
+ $str = '<option value="">' . $day . '</option>';
213
+ for ( $x = 1; $x <= 31; $x++ ) {
214
+ $str.= '<option value="' . sprintf( "%02d", $x ) . '">' . sprintf( "%02d", $x ) . '</option>';
215
+ }
216
+ return $str;
217
+ }
218
+
219
+ public function getLanguage() {
220
+ $str = '<option value="de">Austrian</option>
221
+ <option value="da">Danisch</option>
222
+ <option value="fi">Finnisch</option>
223
+ <option selected="selected" value="de">German</option>
224
+ <option value="nl">Dutch</option>
225
+ <option value="nb">Norwegian</option>
226
+ <option value="sv">Swedisch</option>';
227
+
228
+ switch ( $this->getLocaleCode() ) {
229
+ case 'de_AT':
230
+ $str = '<option selected="selected" value="de">Österreichisch</option>
231
+ <option value="da">Dänisch</option>
232
+ <option value="fi">Finnisch</option>
233
+ <option value="de">Deutsch</option>
234
+ <option value="nl">Holländisch</option>
235
+ <option value="nb">Norwegisch</option>
236
+ <option value="sv">Schwedisch</option>';
237
+ break;
238
+ case 'da_DK':
239
+ $str = '<option value="de">østrigsk</option>
240
+ <option selected="selected" value="da">Dansk</option>
241
+ <option value="fi">Finsk</option>
242
+ <option value="de">Tysk</option>
243
+ <option value="nl">Hollandsk</option>
244
+ <option value="nb">Norwegian</option>
245
+ <option value="sv">Svensk</option>';
246
+ break;
247
+ case 'fi_FI':
248
+ $str = '<option value="de">østrigsk</option>
249
+ <option value="da">Dansk</option>
250
+ <option selected="selected" value="fi">Finsk</option>
251
+ <option value="de">German</option>
252
+ <option value="nl">Hollandsk</option>
253
+ <option value="nb">Norja</option>
254
+ <option value="sv">Ruotsi</option>';
255
+ break;
256
+ case 'de_DE':
257
+ $str = '<option value="de">Österreichisch</option>
258
+ <option value="da">Dänisch</option>
259
+ <option value="fi">Finnisch</option>
260
+ <option selected="selected" value="de">Deutsch</option>
261
+ <option value="nl">Holländisch</option>
262
+ <option value="nb">Norwegisch</option>
263
+ <option value="sv">Schwedisch</option>';
264
+ break;
265
+ case 'nl_NL';
266
+ $str = '<option value="de">Oostenrijks</option>
267
+ <option value="da">Deens</option>
268
+ <option value="fi">Fins</option>
269
+ <option value="de">Duits</option>
270
+ <option selected="selected" value="nl">Nederlands</option>
271
+ <option value="nb">Norweegs</option>
272
+ <option value="sv">Zweeds</option>';
273
+ break;
274
+ case 'nb_NO':
275
+ $str = '<option value="de">østerriksk</option>
276
+ <option value="da">Dansk</option>
277
+ <option value="fi">Finsk</option>
278
+ <option value="de">Tyske</option>
279
+ <option value="nl">Dutch</option>
280
+ <option selected="selected" value="nb">Norsk</option>
281
+ <option value="sv">Svensk</option>';
282
+ break;
283
+ case 'sv_SE':
284
+ $str = '<option value="de">österrikiska</option>
285
+ <option value="da">Dansk</option>
286
+ <option value="fi">Finska</option>
287
+ <option value="de">Tysk</option>
288
+ <option value="nl">Holländare</option>
289
+ <option value="nb">Norska</option>
290
+ <option selected="selected" value="sv">Svenska</option>';
291
+ break;
292
+ }
293
+ return $str;
294
+ }
295
+
296
+ public function getGenderLabel() {
297
+ switch ( $this->getLocaleCode() ) {
298
+ case 'de_AT':
299
+ return 'Geslecht';
300
+ break;
301
+ case 'da_DK':
302
+ return 'Køn';
303
+ break;
304
+ case 'fi_FI':
305
+ return 'Sukupuoli';
306
+ break;
307
+ case 'de_DE':
308
+ return 'Geschlecht';
309
+ break;
310
+ case 'nl_NL';
311
+ return 'Geslacht';
312
+ break;
313
+ case 'nb_NO':
314
+ return 'Kjønn';
315
+ break;
316
+ case 'sv_SE':
317
+ return 'Kön';
318
+ break;
319
+ }
320
+ return Mage::helper( 'cgp' )->__( 'Gender' );
321
+ }
322
+
323
+ public function getMaleLabel() {
324
+ switch ( $this->getLocaleCode() ) {
325
+ case 'de_AT':
326
+ return 'Mann';
327
+ break;
328
+ case 'da_DK':
329
+ return 'Mand';
330
+ break;
331
+ case 'fi_FI':
332
+ return 'Mies';
333
+ break;
334
+ case 'de_DE':
335
+ return 'Mann';
336
+ break;
337
+ case 'nl_NL';
338
+ return 'Man';
339
+ break;
340
+ case 'nb_NO':
341
+ return 'Mann';
342
+ break;
343
+ case 'sv_SE':
344
+ return 'Man';
345
+ break;
346
+ }
347
+ return Mage::helper( 'cgp' )->__( 'Male' );
348
+ }
349
+
350
+ public function getFemaleLabel() {
351
+ switch ( $this->getLocaleCode() ) {
352
+ case 'de_AT':
353
+ return 'Frau';
354
+ break;
355
+ case 'da_DK':
356
+ return 'Kvinde';
357
+ break;
358
+ case 'fi_FI':
359
+ return 'Nainen';
360
+ break;
361
+ case 'de_DE':
362
+ return 'Frau';
363
+ break;
364
+ case 'nl_NL';
365
+ return 'Vrouw';
366
+ break;
367
+ case 'nb_NO':
368
+ return 'Kvinne';
369
+ break;
370
+ case 'sv_SE':
371
+ return 'Kvinna';
372
+ break;
373
+ }
374
+ return Mage::helper( 'cgp' )->__( 'Female' );
375
+ }
376
+
377
+ public function getBirthdayLabel() {
378
+ switch ( $this->getLocaleCode() ) {
379
+ case 'de_AT':
380
+ return 'Geburtsdatum';
381
+ break;
382
+ case 'da_DK':
383
+ return 'Fødselsdag';
384
+ break;
385
+ case 'fi_FI':
386
+ return 'Syntymäpäivä';
387
+ break;
388
+ case 'de_DE':
389
+ return 'Geburtsdatum';
390
+ break;
391
+ case 'nl_NL';
392
+ return 'Geboortedatum';
393
+ break;
394
+ case 'nb_NO':
395
+ return 'Bursdag';
396
+ break;
397
+ case 'sv_SE':
398
+ return 'Födelsedag';
399
+ break;
400
+ }
401
+ return Mage::helper( 'cgp' )->__( 'Birthday' );
402
+ }
403
+
404
+ public function getLanguageLabel() {
405
+ switch ( $this->getLocaleCode() ) {
406
+ case 'de_AT':
407
+ return 'Sprache';
408
+ break;
409
+ case 'da_DK':
410
+ return 'Sprog';
411
+ break;
412
+ case 'fi_FI':
413
+ return 'Kieli';
414
+ break;
415
+ case 'de_DE':
416
+ return 'Sprache';
417
+ break;
418
+ case 'nl_NL';
419
+ return 'Taal';
420
+ break;
421
+ case 'nb_NO':
422
+ return 'Språk';
423
+ break;
424
+ case 'sv_SE':
425
+ return 'Språk';
426
+ break;
427
+ }
428
+ }
429
+
430
+ public function getPersonalNumberLabel() {
431
+ switch ( $this->getLocaleCode() ) {
432
+ case 'de_AT':
433
+ return '';
434
+ break;
435
+ case 'da_DK':
436
+ return 'Personnummer';
437
+ break;
438
+ case 'fi_FI':
439
+ return 'Henkilötunnus';
440
+ break;
441
+ case 'de_DE':
442
+ return '';
443
+ break;
444
+ case 'nl_NL';
445
+ return '';
446
+ break;
447
+ case 'nb_NO':
448
+ return 'Fødselsnummer';
449
+ break;
450
+ case 'sv_SE':
451
+ return 'Personnummer';
452
+ break;
453
+ }
454
+ }
455
+
456
+ public function isEU() {
457
+ switch ( $this->getLocaleCode() ) {
458
+ case 'de_AT':
459
+ return true;
460
+ break;
461
+ case 'da_DK':
462
+ return false;
463
+ break;
464
+ case 'fi_FI':
465
+ return false;
466
+ break;
467
+ case 'de_DE':
468
+ return true;
469
+ break;
470
+ case 'nl_NL';
471
+ return true;
472
+ break;
473
+ case 'nb_NO':
474
+ return false;
475
+ break;
476
+ case 'sv_SE':
477
+ return false;
478
+ break;
479
+ }
480
+ }
481
+
482
+ public function beginIsEu() {
483
+ if ( $this->isEU() ) {
484
+ return '';
485
+ } else {
486
+ return '<!--';
487
+ }
488
+ }
489
+
490
+ public function endIsEu() {
491
+ if ( $this->isEU() ) {
492
+ return '';
493
+ } else {
494
+ return '-->';
495
+ }
496
+ }
497
+
498
+ public function beginIsNotEu() {
499
+ if ( !$this->isEU() ) {
500
+ return '';
501
+ } else {
502
+ return '<!--';
503
+ }
504
+ }
505
+
506
+ public function endIsNotEu() {
507
+ if ( !$this->isEU() ) {
508
+ return '';
509
+ } else {
510
+ return '-->';
511
+ }
512
+ }
513
+
514
+ public function getLocaleCode() {
515
+
516
+ $country = Mage::getSingleton( 'checkout/session' )->getQuote()->getBillingAddress()->getCountry();
517
+
518
+ switch ( $country ) {
519
+ case 'AT':
520
+ return 'de_AT';
521
+ break;
522
+ case 'DK':
523
+ return 'da_DK';
524
+ break;
525
+ case 'FI':
526
+ return 'fi_FI';
527
+ break;
528
+ case 'DE':
529
+ return 'de_DE';
530
+ break;
531
+ case 'NL';
532
+ return 'nl_NL';
533
+ break;
534
+ case 'NO':
535
+ return 'nb_NO';
536
+ break;
537
+ case 'SE':
538
+ return 'sv_SE';
539
+ break;
540
+ default:
541
+ return 'not_klarna';
542
+ }
543
+ }
544
+
545
+ public function getGermanNotice() {
546
+ $locale = $this->getLocaleCode();
547
+ if ( strpos( $locale, 'de_' ) === 0 ) {
548
+ $str = '<br>
549
+ <div style="float:left;margin-top:5px;">
550
+ <input
551
+ type="checkbox"
552
+ name="payment[cgp][klarna-check]"
553
+ value="0"
554
+ id="id_cgp_klarna_check"
555
+ class="required-entry"
556
+ />
557
+ Mit der Datenverarbeitung der für die Abwicklungdes Rechnungskaufes und einer Identitäts-und Bonitätsprüfung erforderlichen Daten durch Klarna bin ich einverstanden. Meine <span id="consent02"></span> kann ich jederzeit mit Wirkung für die Zukunft widerrufen. Es gelten die AGB des Händlers. <br>
558
+ </div>';
559
+ } else {
560
+ $str = "";
561
+ }
562
+ return $str;
563
+ }
564
+
565
+ public function getKlarnaInvoiceTerms() {
566
+
567
+ $str = "new Klarna.Terms.Invoice({
568
+ el: 'invoice02',
569
+ eid: '" . $this->getKlarnaEid() . "',
570
+ locale: '" . $this->getLocaleCode() . "',
571
+ charge: 0,
572
+ type: 'desktop'
573
+ });";
574
+ return $str;
575
+ }
576
+
577
+ public function getKlarnaConsent() {
578
+ $str = ' ';
579
+ $locale = $this->getLocaleCode();
580
+ if ( strpos( $locale, 'de_' ) === 0 ) {
581
+ $str = "new Klarna.Terms.Consent({
582
+ el: 'consent02',
583
+ eid: '" . $this->getKlarnaEid() . "',
584
+ locale: '" . $this->getLocaleCode() . "',
585
+ type: 'desktop'
586
+ });";
587
+ }
588
+ return $str;
589
+ }
590
+
591
+ public function getKlarnaEid() {
592
+ $settings = Mage::getStoreConfig( 'cgp/cgp_klarna' );
593
+ return $settings['klarna_eid'];
594
+ }
595
+
596
+ public function getKlarnaLogoUrl() {
597
+
598
+ $str = 'https://cdn.klarna.com/public/images/';
599
+
600
+ $country = substr( $this->getLocaleCode(), 3 );
601
+ $str .= $country;
602
+ $str .='/badges/v1/invoice/';
603
+ $str .= $country;
604
+ $str .= '_invoice_badge_std_blue.png?width=125&eid=';
605
+ $str .= $this->getKlarnaEid();
606
+
607
+ return $str;
608
+ }
609
+
610
+ public function getInvoiceFeeNotice() {
611
+ $str = '';
612
+ $settings = Mage::getStoreConfig( 'cgp/cgp_klarna' );
613
+ $fee = (isset($settings['klarna_invoice_fee_ex'])?$settings['klarna_invoice_fee_ex']:0);
614
+
615
+ if ( $fee > 0 ) {
616
+
617
+ $country = Mage::getSingleton( 'checkout/session' )->getQuote()->getBillingAddress()->getCountry();
618
+
619
+ switch ( $country ) {
620
+ case 'AT':
621
+ $str = 'Zusätzliche Klarna Menge';
622
+ break;
623
+ case 'DK':
624
+ $str = 'Ekstra Klarna beløb';
625
+ break;
626
+ case 'FI':
627
+ $str = 'Extra Klarna määrä';
628
+ break;
629
+ case 'DE':
630
+ $str = 'Zusätzliche Klarna Menge';
631
+ break;
632
+ case 'NL';
633
+ $str = 'Extra Klarna bedrag';
634
+ break;
635
+ case 'NO':
636
+ $str = 'Ekstra Klarna beløp';
637
+ break;
638
+ case 'SE':
639
+ $str = 'Extra Klarna belopp';
640
+ break;
641
+ default:
642
+ $str = 'Extra Klarna invoice Fee';
643
+ }
644
+ $str = '<br><br>'.$str.': ' . Mage::helper( 'core' )->currency( $fee, true, false );
645
+ }
646
+ return $str;
647
+ }
648
+
649
+ }
app/code/local/Cardgate/Cgp/Block/Form/Klarnaaccount.php ADDED
@@ -0,0 +1,637 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento CardGatePlus payment extension
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
+ *
13
+ * @category Mage
14
+ * @package Cardgate_Cgp
15
+ * @author Paul Saparov, <support@cardgate.com>
16
+ * @copyright Copyright (c) 2011 CardGatePlus B.V. (http://www.cardgateplus.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+ class Cardgate_Cgp_Block_Form_Klarnaaccount extends Mage_Payment_Block_Form {
20
+
21
+ protected function _construct() {
22
+
23
+ parent::_construct();
24
+ $this->setTemplate( 'cardgate/cgp/form/klarnaaccount.phtml' );
25
+ }
26
+
27
+ /**
28
+ * Return information payment object
29
+ *
30
+ * @return Mage_Payment_Model_Info
31
+ */
32
+ public function getInfoInstance() {
33
+
34
+ return $this->getMethod()->getInfoInstance();
35
+ }
36
+
37
+ public function getYear() {
38
+
39
+ $yr = 'Year';
40
+ switch ( $this->getLocaleCode() ) {
41
+ case 'de_AT':
42
+ $yr = 'Jahr';
43
+ break;
44
+ case 'da_DK':
45
+ $yr = 'Ar';
46
+ break;
47
+ case 'fi_FI':
48
+ $yr = 'Vuosi';
49
+ break;
50
+ case 'de_DE':
51
+ $yr = 'Jahr';
52
+ break;
53
+ case 'nl_NL';
54
+ $yr = 'Jaar';
55
+ break;
56
+ case 'nb_NO':
57
+ $yr = 'Ar';
58
+ break;
59
+ case 'sv_SE':
60
+ $yr = 'Ar';
61
+ break;
62
+ }
63
+
64
+ $str = '<option value="">' . $yr . '</option>';
65
+ for ( $x = date( 'Y' ); $x >= 1900; $x-- ) {
66
+ $str.='<option value="' . $x . '">' . $x . '</option/>';
67
+ }
68
+ return $str;
69
+ }
70
+
71
+ public function getMonth() {
72
+
73
+ $str = '<option value="">Month</option>';
74
+ for ( $x = 1; $x < 13; $x++ ) {
75
+ $str.= '<option value="' . sprintf( "%02d", $x ) . '">' . date( 'F', mktime( 1, 1, 1, $x, 1, 1970 ) ) . '</option>';
76
+ }
77
+
78
+ switch ( $this->getLocaleCode() ) {
79
+ case 'de_AT':
80
+ $str = '<option value="">Monat</option>
81
+ <option value="01">Januar</option>
82
+ <option value="02">Februar</option>
83
+ <option value="03">März</option>
84
+ <option value="04">April</option>
85
+ <option value="05">Mai</option>
86
+ <option value="06">Juni</option>
87
+ <option value="07">Juli</option>
88
+ <option value="08">August</option>
89
+ <option value="09">September</option>
90
+ <option value="10">Oktober</option>
91
+ <option value="11">November</option>
92
+ <option value="12">Dezember</option>';
93
+ break;
94
+ case 'da_DK':
95
+ $str = '<option value="">Måned</option>
96
+ <option value="01">Januar</option>
97
+ <option value="02">Februar</option>
98
+ <option value="03">Marts</option>
99
+ <option value="04">April</option>
100
+ <option value="05">Maj</option>
101
+ <option value="06">Juni</option>
102
+ <option value="07">Juli</option>
103
+ <option value="08">August</option>
104
+ <option value="09">September</option>
105
+ <option value="10">Oktober</option>
106
+ <option value="11">November</option>
107
+ <option value="12">December</option>';
108
+ break;
109
+ case 'fi_FI':
110
+ $str = '<option value="">Kuukausi</option>
111
+ <option value="01">Tammikuu</option>
112
+ <option value="02">Helmikuu</option>
113
+ <option value="03">Maaliskuu</option>
114
+ <option value="04">Huhtikuu</option>
115
+ <option value="05">Toukokuu</option>
116
+ <option value="06">Kesäkuu</option>
117
+ <option value="07">Heinäkuu</option>
118
+ <option value="08">Elokuu</option>
119
+ <option value="09">Syyskuu</option>
120
+ <option value="10">Lokakuu</option>
121
+ <option value="11">Marraskuu</option>
122
+ <option value="12">Joulukuu</option>';
123
+ break;
124
+ case 'de_DE':
125
+ $str = '<option value="">Monat</option>
126
+ <option value="01">Januar</option>
127
+ <option value="02">Februar</option>
128
+ <option value="03">März</option>
129
+ <option value="04">April</option>
130
+ <option value="05">Mai</option>
131
+ <option value="06">Juni</option>
132
+ <option value="07">Juli</option>
133
+ <option value="08">August</option>
134
+ <option value="09">September</option>
135
+ <option value="10">Oktober</option>
136
+ <option value="11">November</option>
137
+ <option value="12">Dezember</option>';
138
+ break;
139
+ case 'nl_NL';
140
+ $str = '<option value="">Maand</option>
141
+ <option value="01">januari</option>
142
+ <option value="02">februari</option>
143
+ <option value="03">maart</option>
144
+ <option value="04">april</option>
145
+ <option value="05">mei</option>
146
+ <option value="06">juni</option>
147
+ <option value="07">juli</option>
148
+ <option value="08">augustus</option>
149
+ <option value="09">september</option>
150
+ <option value="10">oktober</option>
151
+ <option value="11">november</option>
152
+ <option value="12">december</option>';
153
+ break;
154
+ case 'nb_NO':
155
+ $str = '<option value="">Måned</option>
156
+ <option value="01">Januar</option>
157
+ <option value="02">Februar</option>
158
+ <option value="03">Mars</option>
159
+ <option value="04">April</option>
160
+ <option value="05">Mai</option>
161
+ <option value="06">Juni</option>
162
+ <option value="07">Juli</option>
163
+ <option value="08">August</option>
164
+ <option value="09">September</option>
165
+ <option value="10">Oktober</option>
166
+ <option value="11">November</option>
167
+ <option value="12">Desember</option>';
168
+ break;
169
+ case 'sv_SE':
170
+ $str = '<option value="">Månad</option>
171
+ <option value="01">januari</option>
172
+ <option value="02">februari</option>
173
+ <option value="03">mars</option>
174
+ <option value="04">april</option>
175
+ <option value="05">maj</option>
176
+ <option value="06">juni</option>
177
+ <option value="07">juli</option>
178
+ <option value="08">augusti</option>
179
+ <option value="09">september</option>
180
+ <option value="10">oktober</option>
181
+ <option value="11">november</option>
182
+ <option value="12">december</option>';
183
+ break;
184
+ }
185
+
186
+ return $str;
187
+ }
188
+
189
+ public function getDay() {
190
+
191
+ $day = 'Day';
192
+ switch ( $this->getLocaleCode() ) {
193
+ case 'de_AT':
194
+ $day = 'Tag';
195
+ break;
196
+ case 'da_DK':
197
+ $day = 'Dag';
198
+ break;
199
+ case 'fi_FI':
200
+ $day = 'Päivä';
201
+ break;
202
+ case 'de_DE':
203
+ $day = 'Tag';
204
+ break;
205
+ case 'nl_NL';
206
+ $day = 'Dag';
207
+ break;
208
+ case 'nb_NO':
209
+ $day = 'Dag';
210
+ break;
211
+ case 'sv_SE':
212
+ $day = 'Dag';
213
+ break;
214
+ }
215
+
216
+ $str = '<option value="">' . $day . '</option>';
217
+ for ( $x = 1; $x <= 31; $x++ ) {
218
+ $str.= '<option value="' . sprintf( "%02d", $x ) . '">' . sprintf( "%02d", $x ) . '</option>';
219
+ }
220
+ return $str;
221
+ }
222
+
223
+ public function getLanguage() {
224
+ $str = '<option value="de">Austrian</option>
225
+ <option value="da">Danisch</option>
226
+ <option value="fi">Finnisch</option>
227
+ <option selected="selected" value="de">German</option>
228
+ <option value="nl">Dutch</option>
229
+ <option value="nb">Norwegian</option>
230
+ <option value="sv">Swedisch</option>';
231
+
232
+ switch ( $this->getLocaleCode() ) {
233
+ case 'de_AT':
234
+ $str = '<option selected="selected" value="de">Österreichisch</option>
235
+ <option value="da">Dänisch</option>
236
+ <option value="fi">Finnisch</option>
237
+ <option value="de">Deutsch</option>
238
+ <option value="nl">Holländisch</option>
239
+ <option value="nb">Norwegisch</option>
240
+ <option value="sv">Schwedisch</option>';
241
+ break;
242
+ case 'da_DK':
243
+ $str = '<option value="de">østrigsk</option>
244
+ <option selected="selected" value="da">Dansk</option>
245
+ <option value="fi">Finsk</option>
246
+ <option value="de">Tysk</option>
247
+ <option value="nl">Hollandsk</option>
248
+ <option value="nb">Norwegian</option>
249
+ <option value="sv">Svensk</option>';
250
+ break;
251
+ case 'fi_FI':
252
+ $str = '<option value="de">østrigsk</option>
253
+ <option value="da">Dansk</option>
254
+ <option selected="selected" value="fi">Finsk</option>
255
+ <option value="de">German</option>
256
+ <option value="nl">Hollandsk</option>
257
+ <option value="nb">Norja</option>
258
+ <option value="sv">Ruotsi</option>';
259
+ break;
260
+ case 'de_DE':
261
+ $str = '<option value="de">Österreichisch</option>
262
+ <option value="da">Dänisch</option>
263
+ <option value="fi">Finnisch</option>
264
+ <option selected="selected" value="de">Deutsch</option>
265
+ <option value="nl">Holländisch</option>
266
+ <option value="nb">Norwegisch</option>
267
+ <option value="sv">Schwedisch</option>';
268
+ break;
269
+ case 'nl_NL';
270
+ $str = '<option value="de">Oostenrijks</option>
271
+ <option value="da">Deens</option>
272
+ <option value="fi">Fins</option>
273
+ <option value="de">Duits</option>
274
+ <option selected="selected" value="nl">Nederlands</option>
275
+ <option value="nb">Norweegs</option>
276
+ <option value="sv">Zweeds</option>';
277
+ break;
278
+ case 'nb_NO':
279
+ $str = '<option value="de">østerriksk</option>
280
+ <option value="da">Dansk</option>
281
+ <option value="fi">Finsk</option>
282
+ <option value="de">Tyske</option>
283
+ <option value="nl">Dutch</option>
284
+ <option selected="selected" value="nb">Norsk</option>
285
+ <option value="sv">Svensk</option>';
286
+ break;
287
+ case 'sv_SE':
288
+ $str = '<option value="de">österrikiska</option>
289
+ <option value="da">Dansk</option>
290
+ <option value="fi">Finska</option>
291
+ <option value="de">Tysk</option>
292
+ <option value="nl">Holländare</option>
293
+ <option value="nb">Norska</option>
294
+ <option selected="selected" value="sv">Svenska</option>';
295
+ break;
296
+ }
297
+ return $str;
298
+ }
299
+
300
+ public function getGenderLabel() {
301
+
302
+ switch ( $this->getLocaleCode() ) {
303
+ case 'de_AT':
304
+ return 'Geslecht';
305
+ break;
306
+ case 'da_DK':
307
+ return 'Køn';
308
+ break;
309
+ case 'fi_FI':
310
+ return 'Sukupuoli';
311
+ break;
312
+ case 'de_DE':
313
+ return 'Geschlecht';
314
+ break;
315
+ case 'nl_NL';
316
+ return 'Geslacht';
317
+ break;
318
+ case 'nb_NO':
319
+ return 'Kjønn';
320
+ break;
321
+ case 'sv_SE':
322
+ return 'Kön';
323
+ break;
324
+ }
325
+ return Mage::helper( 'cgp' )->__( 'Gender' );
326
+ }
327
+
328
+ public function getMaleLabel() {
329
+
330
+ switch ( $this->getLocaleCode() ) {
331
+ case 'de_AT':
332
+ return 'Mann';
333
+ break;
334
+ case 'da_DK':
335
+ return 'Mand';
336
+ break;
337
+ case 'fi_FI':
338
+ return 'Mies';
339
+ break;
340
+ case 'de_DE':
341
+ return 'Mann';
342
+ break;
343
+ case 'nl_NL';
344
+ return 'Man';
345
+ break;
346
+ case 'nb_NO':
347
+ return 'Mann';
348
+ break;
349
+ case 'sv_SE':
350
+ return 'Man';
351
+ break;
352
+ }
353
+ return Mage::helper( 'cgp' )->__( 'Male' );
354
+ }
355
+
356
+ public function getFemaleLabel() {
357
+
358
+ switch ( $this->getLocaleCode() ) {
359
+ case 'de_AT':
360
+ return 'Frau';
361
+ break;
362
+ case 'da_DK':
363
+ return 'Kvinde';
364
+ break;
365
+ case 'fi_FI':
366
+ return 'Nainen';
367
+ break;
368
+ case 'de_DE':
369
+ return 'Frau';
370
+ break;
371
+ case 'nl_NL';
372
+ return 'Vrouw';
373
+ break;
374
+ case 'nb_NO':
375
+ return 'Kvinne';
376
+ break;
377
+ case 'sv_SE':
378
+ return 'Kvinna';
379
+ break;
380
+ }
381
+ return Mage::helper( 'cgp' )->__( 'Female' );
382
+ }
383
+
384
+ public function getLanguageLabel() {
385
+ $locale = $this->getLocaleCode();
386
+ switch ( $this->getLocaleCode() ) {
387
+ case 'de_AT':
388
+ return 'Sprache';
389
+ break;
390
+ case 'da_DK':
391
+ return 'Sprog';
392
+ break;
393
+ case 'fi_FI':
394
+ return 'Kieli';
395
+ break;
396
+ case 'de_DE':
397
+ return 'Sprache';
398
+ break;
399
+ case 'nl_NL';
400
+ return 'Taal';
401
+ break;
402
+ case 'nb_NO':
403
+ return 'Språk';
404
+ break;
405
+ case 'sv_SE':
406
+ return 'Språk';
407
+ break;
408
+ }
409
+ }
410
+
411
+ public function getPersonalNumberLabel() {
412
+ switch ( $this->getLocaleCode() ) {
413
+ case 'de_AT':
414
+ return '';
415
+ break;
416
+ case 'da_DK':
417
+ return 'Personnummer';
418
+ break;
419
+ case 'fi_FI':
420
+ return 'Henkilötunnus';
421
+ break;
422
+ case 'de_DE':
423
+ return '';
424
+ break;
425
+ case 'nl_NL';
426
+ return '';
427
+ break;
428
+ case 'nb_NO':
429
+ return 'Fødselsnummer';
430
+ break;
431
+ case 'sv_SE':
432
+ return 'Personnummer';
433
+ break;
434
+ }
435
+ }
436
+
437
+ public function isEU() {
438
+ switch ( $this->getLocaleCode() ) {
439
+ case 'de_AT':
440
+ return true;
441
+ break;
442
+ case 'da_DK':
443
+ return false;
444
+ break;
445
+ case 'fi_FI':
446
+ return false;
447
+ break;
448
+ case 'de_DE':
449
+ return true;
450
+ break;
451
+ case 'nl_NL';
452
+ return true;
453
+ break;
454
+ case 'nb_NO':
455
+ return false;
456
+ break;
457
+ case 'sv_SE':
458
+ return false;
459
+ break;
460
+ }
461
+ }
462
+
463
+ public function beginIsEu() {
464
+ if ( $this->isEU() ) {
465
+ return '';
466
+ } else {
467
+ return '<!--';
468
+ }
469
+ }
470
+
471
+ public function endIsEu() {
472
+ if ( $this->isEU() ) {
473
+ return '';
474
+ } else {
475
+ return '-->';
476
+ }
477
+ }
478
+
479
+ public function beginIsNotEu() {
480
+ if ( !$this->isEU() ) {
481
+ return '';
482
+ } else {
483
+ return '<!--';
484
+ }
485
+ }
486
+
487
+ public function endIsNotEu() {
488
+ if ( !$this->isEU() ) {
489
+ return '';
490
+ } else {
491
+ return '-->';
492
+ }
493
+ }
494
+
495
+
496
+ public function getBirthdayLabel() {
497
+
498
+ switch ( $this->getLocaleCode() ) {
499
+ case 'de_AT':
500
+ return 'Geburtsdatum';
501
+ break;
502
+ case 'da_DK':
503
+ return 'Fødselsdag';
504
+ break;
505
+ case 'fi_FI':
506
+ return 'Syntymäpäivä';
507
+ break;
508
+ case 'de_DE':
509
+ return 'Geburtsdatum';
510
+ break;
511
+ case 'nl_NL';
512
+ return 'Geboortedatum';
513
+ break;
514
+ case 'nb_NO':
515
+ return 'Bursdag';
516
+ break;
517
+ case 'sv_SE':
518
+ return 'Födelsedag';
519
+ break;
520
+ }
521
+ return Mage::helper( 'cgp' )->__( 'Birthday' );
522
+ }
523
+
524
+ public function getLocaleCode() {
525
+
526
+ $country = Mage::getSingleton('checkout/session')->getQuote()->getBillingAddress()->getCountry();
527
+
528
+ switch ( $country ) {
529
+ case 'AT':
530
+ return 'de_AT';
531
+ break;
532
+ case 'DK':
533
+ return 'da_DK';
534
+ break;
535
+ case 'FI':
536
+ return 'fi_FI';
537
+ break;
538
+ case 'DE':
539
+ return 'de_DE';
540
+ break;
541
+ case 'NL';
542
+ return 'nl_NL';
543
+ break;
544
+ case 'NO':
545
+ return 'nb_NO';
546
+ break;
547
+ case 'SE':
548
+ return 'sv_SE';
549
+ break;
550
+ default:
551
+ return 'not_klarna';
552
+ }
553
+ }
554
+
555
+ public function getGermanNotice() {
556
+
557
+ $locale = $this->getLocaleCode();
558
+ if ( strpos( $locale, 'de_' ) === 0 ) {
559
+ $str = '<br>
560
+ <div style="float:left;margin-top:5px;">
561
+ <input
562
+ type="checkbox"
563
+ name="payment[cgp][klarna-account-check]"
564
+ value="0"
565
+ id="id_cgp_klarna-account-check"
566
+ class="required-entry"
567
+ />
568
+ Mit der Datenverarbeitung der für die Abwicklungdes Rechnungskaufes und einer Identitäts-und Bonitätsprüfung erforderlichen Daten durch Klarna bin ich einverstanden. Meine <span id="consent01"></span> kann ich jederzeit mit Wirkung für die Zukunft widerrufen. Es gelten die AGB des Händlers. <br>
569
+ </div>';
570
+ } else {
571
+ $str = "";
572
+ }
573
+ return $str;
574
+ }
575
+
576
+ public function getKlarnaAccountTerms() {
577
+
578
+ switch ( $this->getLocaleCode() ) {
579
+ case 'de_AT':
580
+ return '';
581
+ break;
582
+ case 'da_DK':
583
+ break;
584
+ case 'fi_FI':
585
+ break;
586
+ case 'de_DE':
587
+ break;
588
+ case 'nl_NL';
589
+ break;
590
+ case 'nb_NO':
591
+ break;
592
+ case 'sv_SE':
593
+ break;
594
+ }
595
+
596
+ $str = "new Klarna.Terms.Account({
597
+ el: 'account01',
598
+ eid: '" . $this->getKlarnaAccountEid() . "',
599
+ locale: '" . $this->getLocaleCode() . "',
600
+ type: 'desktop'
601
+ });";
602
+ return $str;
603
+ }
604
+
605
+ public function getKlarnaAccountConsent() {
606
+ $str = ' ';
607
+ $locale = $this->getLocaleCode();
608
+ if ( strpos( $locale, 'de_' ) === 0 ) {
609
+ $str = "new Klarna.Terms.Consent({
610
+ el: 'consent01',
611
+ eid: '" . $this->getKlarnaAccountEid() . "',
612
+ locale: '" . $this->getLocaleCode() . "',
613
+ type: 'desktop'
614
+ });";
615
+ }
616
+ return $str;
617
+ }
618
+
619
+ public function getKlarnaAccountEid() {
620
+
621
+ $settings = Mage::getStoreConfig( 'cgp/cgp_klarnaaccount');
622
+ return $settings['klarna_eid'];
623
+ }
624
+
625
+ public function getKlarnaAccountLogoUrl() {
626
+
627
+ $str = 'https://cdn.klarna.com/public/images/';
628
+ $country = substr( $this->getLocaleCode(), 3 );
629
+ $str .= $country;
630
+ $str .='/badges/v1/account/';
631
+ $str .= $country;
632
+ $str .= '_account_badge_std_blue.png?width=125&eid=';
633
+ $str .= $this->getKlarnaAccountEid();
634
+ return $str;
635
+ }
636
+
637
+ }
app/code/local/Cardgate/Cgp/Block/Redirect.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento CardGatePlus payment extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Mage
13
+ * @package Cardgate_Cgp
14
+ * @author Paul Saparov, <support@cardgate.com>
15
+ * @copyright Copyright (c) 2011 CardGatePlus B.V. (http://www.cardgateplus.com)
16
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
+ */
18
+
19
+ class Cardgate_Cgp_Block_Redirect extends Mage_Core_Block_Template
20
+ {
21
+ protected function _construct()
22
+ {
23
+ $this->setTemplate('cardgate/cgp/redirect.phtml');
24
+ }
25
+
26
+ public function getForm()
27
+ {
28
+ $model = Mage::getModel(Mage::registry('cgp_model'));
29
+ Mage::unregister('cgp_model');
30
+
31
+ $form = new Varien_Data_Form();
32
+ $form->setAction($model->getGatewayUrl())
33
+ ->setId('cardgateplus_checkout')
34
+ ->setName('cardgateplus_checkout')
35
+ ->setMethod('POST')
36
+ ->setUseContainer(true);
37
+
38
+ foreach ($model->getCheckoutFormFields() as $field => $value) {
39
+ $form->addField($field, 'hidden', array('name' => $field, 'value' => $value));
40
+ }
41
+ return $form->getHtml();
42
+ }
43
+ }
app/code/local/Cardgate/Cgp/Helper/Data.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento CardGatePlus payment extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Mage
13
+ * @package Cardgate_Cgp
14
+ * @author Paul Saparov, <support@cardgate.com>
15
+ * @copyright Copyright (c) 2011 CardGatePlus B.V. (http://www.cardgateplus.com)
16
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
+ */
18
+
19
+ class Cardgate_Cgp_Helper_Data extends Mage_Core_Helper_Abstract
20
+ {
21
+ /**
22
+ * Check if OneStepCheckout is activated or not
23
+ *
24
+ * @return bool
25
+ */
26
+ public function isOneStepCheckout()
27
+ {
28
+ return (bool) Mage::getStoreConfig(
29
+ 'onestepcheckout/general/rewrite_checkout_links'
30
+ );
31
+ }
32
+ }
app/code/local/Cardgate/Cgp/Model/Adminhtml/System/Config/Source/Languages.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento CardGatePlus payment extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Mage
13
+ * @package Cardgate_Cgp
14
+ * @author Paul Saparov, <support@cardgate.com>
15
+ * @copyright Copyright (c) 2011 CardGatePlus B.V. (http://www.cardgateplus.com)
16
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
+ */
18
+
19
+ class Cardgate_Cgp_Model_Adminhtml_System_Config_Source_Languages
20
+ {
21
+ public function toOptionArray() {
22
+ return array(
23
+ array(
24
+ "value" => "nl",
25
+ "label" => Mage::helper("cgp")->__('Dutch')
26
+ ),
27
+ array(
28
+ "value" => "en",
29
+ "label" => Mage::helper("cgp")->__('English')
30
+ ),
31
+ array(
32
+ "value" => "de",
33
+ "label" => Mage::helper("cgp")->__('German')
34
+ ),
35
+ array(
36
+ "value" => "fr",
37
+ "label" => Mage::helper("cgp")->__('French')
38
+ ),
39
+ array(
40
+ "value" => "es",
41
+ "label" => Mage::helper("cgp")->__('Spanish')
42
+ ),
43
+ array(
44
+ "value" => "gr",
45
+ "label" => Mage::helper("cgp")->__('Greek')
46
+ ),
47
+ array(
48
+ "value" => "hr",
49
+ "label" => Mage::helper("cgp")->__('Croatian')
50
+ ),
51
+ array(
52
+ "value" => "it",
53
+ "label" => Mage::helper("cgp")->__('Italian')
54
+ ),
55
+ array(
56
+ "value" => "cz",
57
+ "label" => Mage::helper("cgp")->__('Czech')
58
+ ),
59
+ array(
60
+ "value" => "ru",
61
+ "label" => Mage::helper("cgp")->__('Russian')
62
+ ),
63
+ array(
64
+ "value" => "se",
65
+ "label" => Mage::helper("cgp")->__('Swedish')
66
+ ),
67
+ );
68
+ }
69
+ }
app/code/local/Cardgate/Cgp/Model/Adminhtml/System/Config/Source/Modes.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Carg Gate Plus payment extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Mage
13
+ * @package Cardgate_Cgp
14
+ * @author Paul Saparov, <support@cardgate.com>
15
+ * @copyright Copyright (c) 2011 CardGatePlus B.V. (http://www.cardgateplus.com)
16
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
+ */
18
+
19
+ class Cardgate_Cgp_Model_Adminhtml_System_Config_Source_Modes
20
+ {
21
+ public function toOptionArray() {
22
+ return array(
23
+ array(
24
+ "value" => "test",
25
+ "label" => Mage::helper("cgp")->__("Test Mode")
26
+ ),
27
+ array(
28
+ "value" => "live",
29
+ "label" => Mage::helper("cgp")->__("Live Mode")
30
+ ),
31
+ );
32
+ }
33
+ }
app/code/local/Cardgate/Cgp/Model/Base.php ADDED
@@ -0,0 +1,415 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento CardGatePlus payment extension
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
+ *
13
+ * @category Mage
14
+ * @package Cardgate_Cgp
15
+ * @author Paul Saparov, <support@cardgate.com>
16
+ * @copyright Copyright (c) 2011 CardGatePlus B.V. (http://www.cardgateplus.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+ class Cardgate_Cgp_Model_Base extends Varien_Object {
20
+
21
+ protected $_callback;
22
+ protected $_config = null;
23
+ protected $_isLocked = false;
24
+ protected $_logFileName = "cardgateplus.log";
25
+
26
+ /**
27
+ * Initialize basic cgp settings
28
+ */
29
+ public function _construct() {
30
+ $this->_config = Mage::getStoreConfig( 'cgp/settings' );
31
+ }
32
+
33
+ /**
34
+ * Retrieve config value
35
+ *
36
+ * @param string $field
37
+ * @return mixed
38
+ */
39
+ public function getConfigData( $field ) {
40
+ if ( isset( $this->_config[$field] ) ) {
41
+ return $this->_config[$field];
42
+ } else {
43
+ return false;
44
+ }
45
+ }
46
+
47
+ /**
48
+ * Set callback data
49
+ *
50
+ * @param array $data
51
+ * @return Cardgate_Cgp_Model_Base
52
+ */
53
+ public function setCallbackData( $data ) {
54
+ $this->_callback = $data;
55
+ return $this;
56
+ }
57
+
58
+ /**
59
+ * Get callback data
60
+ *
61
+ * @param string $field
62
+ * @return string
63
+ */
64
+ public function getCallbackData( $field = null ) {
65
+ if ( $field === null ) {
66
+ return $this->_callback;
67
+ } else {
68
+ return @$this->_callback[$field];
69
+ }
70
+ }
71
+
72
+ /**
73
+ * If the debug mode is enabled
74
+ *
75
+ * @return bool
76
+ */
77
+ public function isDebug() {
78
+ return $this->getConfigData( 'debug' );
79
+ }
80
+
81
+ /**
82
+ * If the test mode is enabled
83
+ *
84
+ * @return bool
85
+ */
86
+ public function isTest() {
87
+ return ($this->getConfigData( 'test_mode' ) == "test");
88
+ }
89
+
90
+ /**
91
+ * Log data into the logfile
92
+ *
93
+ * @param string $msg
94
+ * @return void
95
+ */
96
+ public function log( $msg ) {
97
+ if ( $this->getConfigData( 'debug' ) ) {
98
+ Mage::log( $msg, null, $this->_logFileName );
99
+ }
100
+ }
101
+
102
+ /**
103
+ * Create lock file
104
+ *
105
+ * @return Cardgate_Cgp_Model_Base
106
+ */
107
+ public function lock() {
108
+ $varDir = Mage::getConfig()->getVarDir( 'locks' );
109
+ $lockFilename = $varDir . DS . $this->getCallbackData( 'ref' ) . '.lock';
110
+ $fp = @fopen( $lockFilename, 'x' );
111
+
112
+ if ( $fp ) {
113
+ $this->_isLocked = true;
114
+ $pid = getmypid();
115
+ $now = date( 'Y-m-d H:i:s' );
116
+ fwrite( $fp, "Locked by $pid at $now\n" );
117
+ }
118
+
119
+ return $this;
120
+ }
121
+
122
+ /**
123
+ * Unlock file
124
+ *
125
+ * @return Cardgate_Cgp_Model_Base
126
+ */
127
+ public function unlock() {
128
+ $this->_isLocked = false;
129
+ $varDir = Mage::getConfig()->getVarDir( 'locks' );
130
+ $lockFilename = $varDir . DS . $this->getCallbackData( 'ref' ) . '.lock';
131
+ unlink( $lockFilename );
132
+
133
+ return $this;
134
+ }
135
+
136
+ /**
137
+ * Create and mail invoice
138
+ *
139
+ * @param Mage_Sales_Model_Order $order
140
+ * @return boolean
141
+ */
142
+ protected function createInvoice( Mage_Sales_Model_Order $order ) {
143
+ if ( $order->canInvoice() && !$order->hasInvoices() ) {
144
+ $invoice = $order->prepareInvoice();
145
+ $invoice->register();
146
+ if ( $invoice->canCapture() ) {
147
+ $invoice->capture();
148
+ }
149
+ $invoice->save();
150
+
151
+ Mage::getModel( "core/resource_transaction" )
152
+ ->addObject( $invoice )
153
+ ->addObject( $invoice->getOrder() )
154
+ ->save();
155
+
156
+ $mail_invoice = $this->getConfigData( "mail_invoice" );
157
+ if ( $mail_invoice ) {
158
+ $invoice->setEmailSent( true );
159
+ $invoice->save();
160
+ $invoice->sendEmail();
161
+ }
162
+
163
+ $statusMessage = $mail_invoice ? "Invoice # %s created and send to customer." : "Invoice # %s created.";
164
+ $order->addStatusToHistory(
165
+ $order->getStatus(), Mage::helper( "cgp" )->__( $statusMessage, $invoice->getIncrementId(), $mail_invoice )
166
+ );
167
+
168
+ return true;
169
+ }
170
+
171
+ return false;
172
+ }
173
+
174
+ /**
175
+ * Notify shop owners on failed invoicing creation
176
+ *
177
+ * @param Mage_Sales_Model_Order $order
178
+ * @return void
179
+ */
180
+ protected function eventInvoicingFailed( $order ) {
181
+ $storeId = $order->getStore()->getId();
182
+
183
+ $ident = Mage::getStoreConfig( 'cgp/settings/notification_email' );
184
+ $sender_email = Mage::getStoreConfig( 'trans_email/ident_general/email', $storeId );
185
+ $sender_name = Mage::getStoreConfig( 'trans_email/ident_general/name', $storeId );
186
+ $recipient_email = Mage::getStoreConfig( 'trans_email/ident_' . $ident . '/email', $storeId );
187
+ $recipient_name = Mage::getStoreConfig( 'trans_email/ident_' . $ident . '/name', $storeId );
188
+
189
+ $mail = new Zend_Mail();
190
+ $mail->setFrom( $sender_email, $sender_name );
191
+ $mail->addTo( $recipient_email, $recipient_name );
192
+ $mail->setSubject( Mage::helper( "cgp" )->__( 'Automatic invoice creation failed' ) );
193
+ $mail->setBodyText( Mage::helper( "cgp" )->__( 'Magento was unable to create an invoice for Order # %s after a successful payment via Card Gate Plus (transaction # %s)', $order->getIncrementId(), $this->getCallbackData( 'transaction_id' ) ) );
194
+ $mail->setBodyHtml( Mage::helper( "cgp" )->__( 'Magento was unable to create an invoice for <b>Order # %s</b> after a successful payment via Card Gate Plus <b>(transaction # %s)</b>', $order->getIncrementId(), $this->getCallbackData( 'transaction_id' ) ) );
195
+ $mail->send();
196
+ }
197
+
198
+ /**
199
+ * Returns true if the amounts match
200
+ *
201
+ * @param Mage_Sales_Model_Order $order
202
+ * @return boolean
203
+ */
204
+ protected function validateAmount( Mage_Sales_Model_Order $order ) {
205
+ $amountInCents = ( int ) sprintf( '%.0f', $order->getGrandTotal() * 100 );
206
+ $callbackAmount = ( int ) $this->getCallbackData( 'amount' );
207
+
208
+ if ( ($amountInCents != $callbackAmount) AND (abs( $callbackAmount - $amountInCents ) > 1) ) {
209
+ $this->log( 'OrderID: ' . $order->getId() . ' do not match amounts. Sent ' . $amountInCents . ', received: ' . $callbackAmount );
210
+ $statusMessage = Mage::helper( "cgp" )->__( "Hacker attempt: Order total amount does not match CardGatePlus's gross total amount!" );
211
+ $order->addStatusToHistory( $order->getStatus(), $statusMessage );
212
+ $order->save();
213
+ return false;
214
+ }
215
+
216
+ return true;
217
+ }
218
+
219
+ /**
220
+ * Process callback for all transactions
221
+ *
222
+ * @return void
223
+ */
224
+ public function processCallback() {
225
+ $id = $this->getCallbackData( 'ref' );
226
+ $order = Mage::getModel( 'sales/order' );
227
+ $order->loadByIncrementId( $id );
228
+
229
+ // Log callback data
230
+ $this->log( 'Receiving callback data:' );
231
+ $this->log( $this->getCallbackData() );
232
+
233
+ // Validate amount
234
+ if ( !$this->validateAmount( $order ) ) {
235
+ $this->log( 'Amount validation failed!' );
236
+ exit();
237
+ }
238
+
239
+ $statusPending = $this->getConfigData( "pending_status" );
240
+ $statusComplete = $this->getConfigData( "complete_status" );
241
+ $statusFailed = $this->getConfigData( "failed_status" );
242
+ $statusFraud = $this->getConfigData( "fraud_status" );
243
+ $autocreateInvoice = $this->getConfigData( "autocreate_invoice" );
244
+ $evInvoicingFailed = $this->getConfigData( "event_invoicing_failed" );
245
+
246
+ $complete = false;
247
+ $canceled = false;
248
+ $newState = null;
249
+ $newStatus = true;
250
+ $statusMessage = '';
251
+
252
+ switch ( $this->getCallbackData( 'status' ) ) {
253
+ case "0":
254
+ $complete = false;
255
+ $newState = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT;
256
+ $newStatus = $statusPending;
257
+ $statusMessage = Mage::helper( 'cgp' )->__( 'Payment sucessfully authorised.' );
258
+ break;
259
+ case "100":
260
+ $complete = false;
261
+ $newState = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT;
262
+ $newStatus = $statusPending;
263
+ $statusMessage = Mage::helper( 'cgp' )->__( 'Payment sucessfully authorised.' );
264
+ break;
265
+ case "200":
266
+ $complete = true;
267
+ $newState = Mage_Sales_Model_Order::STATE_PROCESSING;
268
+ $newStatus = $statusComplete;
269
+ $statusMessage = Mage::helper( 'cgp' )->__( 'Payment complete.' );
270
+ break;
271
+ case "300":
272
+ $canceled = true;
273
+ $newState = Mage_Sales_Model_Order::STATE_CANCELED;
274
+ $newStatus = $statusFailed;
275
+ $statusMessage = Mage::helper( 'cgp' )->__( 'Payment failed or canceled by user.' );
276
+ break;
277
+ case "301":
278
+ $canceled = true;
279
+ $newState = Mage_Sales_Model_Order::STATE_CANCELED;
280
+ $newStatus = $statusFraud;
281
+ $statusMessage = Mage::helper( 'cgp' )->__( 'Transaction failed, payment is fraud.' );
282
+ break;
283
+ case "700":
284
+ // Banktransfer pending status
285
+ $complete = false;
286
+ $newState = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT;
287
+ $newStatus = $statusPending;
288
+ $statusMessage = Mage::helper( 'cgp' )->__( 'Bank transfer: Waiting for customer action.' );
289
+ $order->sendNewOrderEmail();
290
+ $order->addStatusToHistory( $order->getStatus(), $statusMessage, true );
291
+ $order->save();
292
+ break;
293
+ case "701":
294
+ // Direct debit pending status
295
+ $complete = false;
296
+ $newState = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT;
297
+ $newStatus = $statusPending;
298
+ $statusMessage = Mage::helper( 'cgp' )->__( 'Direct debit: Waiting for confirmation.' );
299
+ $order->sendNewOrderEmail();
300
+ $order->addStatusToHistory( $order->getStatus(), $statusMessage, true );
301
+ $order->save();
302
+ break;
303
+ default:
304
+ $msg = 'Status not recognised: ' . $this->getCallbackData( 'status' );
305
+ $this->log( $msg );
306
+ die($msg);
307
+ }
308
+ // Update only certain states
309
+ $canUpdate = false;
310
+ $undoCancel = false;
311
+ if ( $order->getState() == Mage_Sales_Model_Order::STATE_NEW ||
312
+ $order->getState() == Mage_Sales_Model_Order::STATE_PENDING_PAYMENT ||
313
+ $order->getState() == Mage_Sales_Model_Order::STATE_CANCELED ) {
314
+ $canUpdate = true;
315
+ }
316
+
317
+ foreach ( $order->getStatusHistoryCollection( true ) as $_item ) {
318
+ // Don't update order status if the payment is complete
319
+ if ( $_item->getStatusLabel() == ucfirst( $statusComplete ) ) {
320
+ $canUpdate = false;
321
+ // Uncancel an order if the payment is considered complete
322
+ } elseif ( ($_item->getStatusLabel() == ucfirst( $statusFailed )) ||
323
+ ($_item->getStatusLabel() == ucfirst( $statusFraud )) ) {
324
+ $undoCancel = true;
325
+ }
326
+ }
327
+
328
+ // increase inventory if the payment failed
329
+ if ( $canUpdate && !$complete && $canceled && $order->getStatus() != Mage_Sales_Model_Order::STATE_CANCELED ) {
330
+ foreach ( $order->getAllItems() as $_item ) {
331
+ $qty = $_item->getQtyOrdered();
332
+ $stockItem = Mage::getModel( 'cataloginventory/stock_item' )->loadByProduct( $_item->getProductId() );
333
+ $stockItemId = $stockItem->getId();
334
+ $stock = array();
335
+ // then set product's stock data to update
336
+ if ( !$stockItemId ) {
337
+ $stockItem->setData( 'product_id', $product->getId() );
338
+ $stockItem->setData( 'stock_id', 1 );
339
+ } else {
340
+ $stock = $stockItem->getData();
341
+ }
342
+
343
+ $oldQty = $stockItem->getData( 'qty' );
344
+ $stockItem->setData( 'qty', $oldQty + $qty );
345
+ // call save() method to save your product with updated data
346
+ try {
347
+ $stockItem->save();
348
+ // $product->save($p);
349
+ } catch ( Exception $ex ) {
350
+ // handle the error here!!
351
+ }
352
+ }
353
+ }
354
+
355
+ // Lock
356
+ $this->lock();
357
+
358
+ // Uncancel order if necessary
359
+ if ( $undoCancel ) {
360
+ foreach ( $order->getAllItems() as $_item ) {
361
+ if ( $_item->getQtyCanceled() > 0 )
362
+ $_item->setQtyCanceled( 0 )->save();
363
+ if ( $_item->getQtyInvoiced() > 0 )
364
+ $_item->setQtyInvoiced( 0 )->save();
365
+ }
366
+
367
+ $order->setBaseDiscountCanceled( 0 )
368
+ ->setBaseShippingCanceled( 0 )
369
+ ->setBaseSubtotalCanceled( 0 )
370
+ ->setBaseTaxCanceled( 0 )
371
+ ->setBaseTotalCanceled( 0 )
372
+ ->setDiscountCanceled( 0 )
373
+ ->setShippingCanceled( 0 )
374
+ ->setSubtotalCanceled( 0 )
375
+ ->setTaxCanceled( 0 )
376
+ ->setTotalCanceled( 0 );
377
+ }
378
+
379
+ // Update the status if changed
380
+ if ( $canUpdate && (($newState != $order->getState()) || ($newStatus != $order->getStatus())) ) {
381
+
382
+ // Create an invoice when the payment is completed
383
+ if ( $complete && !$canceled && $autocreateInvoice ) {
384
+ $invoiceCreated = $this->createInvoice( $order );
385
+ if ( $invoiceCreated ) {
386
+ $this->log( "Creating invoice for order ID: $id." );
387
+ } else {
388
+ $this->log( "Unable to create invoice for order ID: $id." );
389
+ }
390
+
391
+ // Send notification
392
+ if ( !$invoiceCreated && $evInvoicingFailed ) {
393
+ $this->eventInvoicingFailed( $order );
394
+ }
395
+ }
396
+
397
+ // Set order state and status
398
+ $order->setState( $newState, $newStatus, $statusMessage );
399
+ $this->log( "Changing state to '$newState' with message '$statusMessage' for order ID: $id." );
400
+
401
+ // Send new order e-mail
402
+ if ( $complete && !$canceled && !$order->getEmailSent() ) {
403
+ $order->sendNewOrderEmail();
404
+ $order->setEmailSent( true );
405
+ }
406
+
407
+ // Save order status changes
408
+ $order->save();
409
+ }
410
+
411
+ // Unlock
412
+ $this->unlock();
413
+ }
414
+
415
+ }
app/code/local/Cardgate/Cgp/Model/Gateway/Abstract.php ADDED
@@ -0,0 +1,555 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento CardGatePlus payment extension
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
+ *
13
+ * @category Mage
14
+ * @package Cardgate_Cgp
15
+ * @author Paul Saparov, <support@cardgate.com>
16
+ * @copyright Copyright (c) 2011 CardGatePlus B.V. (http://www.cardgateplus.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+ abstract class Cardgate_Cgp_Model_Gateway_Abstract extends Mage_Payment_Model_Method_Abstract {
20
+
21
+ /**
22
+ * Payment Method features
23
+ *
24
+ * @var mixed
25
+ */
26
+ protected $_module = 'cgp'; // config root (cgp or payment)
27
+ protected $_code; // payment method code (used for loading settings)
28
+ protected $_model; // payment model
29
+
30
+ /**
31
+ * CardGatePlus features
32
+ *
33
+ * @var mixed
34
+ */
35
+ //protected $_url = 'https://gateway.cardgateplus.com/';
36
+ protected $_url = 'http://gateway.cardgate.dev/';
37
+ protected $_supportedCurrencies = array( 'EUR', 'USD', 'JPY', 'BGN', 'CZK',
38
+ 'DKK', 'GBP', 'HUF', 'LTL', 'LVL',
39
+ 'PLN', 'RON', 'SEK', 'CHF', 'NOK',
40
+ 'HRK', 'RUB', 'TRY', 'AUD', 'BRL',
41
+ 'CAD', 'CNY', 'HKD', 'IDR', 'ILS',
42
+ 'INR', 'KRW', 'MXN', 'MYR', 'NZD',
43
+ 'PHP', 'SGD', 'THB', 'ZAR' );
44
+
45
+ /**
46
+ * Mage_Payment_Model settings
47
+ *
48
+ * @var bool
49
+ */
50
+ protected $_isGateway = true;
51
+ protected $_canAuthorize = true;
52
+ protected $_canCapture = true;
53
+ protected $_canUseInternal = false;
54
+ protected $_canUseCheckout = true;
55
+ protected $_canUseForMultishipping = false;
56
+
57
+ /**
58
+ * Return Gateway Url
59
+ *
60
+ * @return string
61
+ */
62
+ public function getGatewayUrl() {
63
+ return $this->_url;
64
+ }
65
+
66
+ /**
67
+ * Get plugin version to send to gateway (debugging purposes)
68
+ *
69
+ * @return string
70
+ */
71
+ public function getPluginVersion() {
72
+ return ( string ) Mage::getConfig()->getNode( 'modules/Cardgate_Cgp/version' );
73
+ }
74
+
75
+ /**
76
+ * Get checkout session namespace
77
+ *
78
+ * @return Mage_Checkout_Model_Session
79
+ */
80
+ public function getCheckout() {
81
+ return Mage::getSingleton( 'checkout/session' );
82
+ }
83
+
84
+ /**
85
+ * Get current quote
86
+ *
87
+ * @return Mage_Sales_Model_Quote
88
+ */
89
+ public function getQuote() {
90
+ return $this->getCheckout()->getQuote();
91
+ }
92
+
93
+ /**
94
+ * Get current order
95
+ *
96
+ * @return Mage_Sales_Model_Order
97
+ */
98
+ public function getOrder() {
99
+ $order = Mage::getModel( 'sales/order' );
100
+ $order->loadByIncrementId( $this->getCheckout()->getLastRealOrderId() );
101
+ return $order;
102
+ }
103
+
104
+ /**
105
+ * Magento tries to set the order from payment/, instead of cgp/
106
+ *
107
+ * @param Mage_Sales_Model_Order $order
108
+ * @return void
109
+ */
110
+ public function setSortOrder( $order ) {
111
+ $this->sort_order = $this->getConfigData( 'sort_order' );
112
+ }
113
+
114
+ /**
115
+ * Append the current model to the URL
116
+ *
117
+ * @param string $url
118
+ * @return string
119
+ */
120
+ function getModelUrl( $url ) {
121
+ if ( !empty( $this->_model ) ) {
122
+ $url .= '/model/' . $this->_model;
123
+ }
124
+ return Mage::getUrl( $url, array( '_secure' => true ) );
125
+ }
126
+
127
+ /**
128
+ * Magento will use this for payment redirection
129
+ *
130
+ * @return string
131
+ */
132
+ public function getOrderPlaceRedirectUrl() {
133
+ $session = Mage::getSingleton( 'checkout/session' );
134
+ $session->cgp_onestepcheckout = false;
135
+ if ( isset( $_POST['payment']['cgp'] ) ) {
136
+ $session->_additional_information = $_POST['payment']['cgp'];
137
+ }
138
+ return $this->getModelUrl( 'cgp/standard/redirect' );
139
+ }
140
+
141
+ /**
142
+ * Retrieve config value for store by path
143
+ *
144
+ * @param string $path
145
+ * @param mixed $store
146
+ * @return mixed
147
+ */
148
+ public function getConfigData( $field, $storeId = null ) {
149
+ if ( $storeId === null ) {
150
+ $storeId = $this->getStore();
151
+ }
152
+
153
+ $configSettings = Mage::getStoreConfig( $this->_module . '/settings', $storeId );
154
+ $configGateway = Mage::getStoreConfig( $this->_module . '/' . $this->_code, $storeId );
155
+ $config = array_merge( $configSettings, $configGateway );
156
+
157
+ return @$config[$field];
158
+ }
159
+
160
+ /**
161
+ * Validate if the currency code is supported by Card Gate Plus
162
+ *
163
+ * @return Cardgate_Cgp_Model_Abstract
164
+ */
165
+ public function validate() {
166
+ parent::validate();
167
+ $base = Mage::getSingleton( 'cgp/base' );
168
+
169
+ $currency_code = $this->getQuote()->getBaseCurrencyCode();
170
+ if ( !in_array( $currency_code, $this->_supportedCurrencies ) ) {
171
+ $base->log( 'Unacceptable currency code (' . $currency_code . ').' );
172
+ Mage::throwException(
173
+ Mage::helper( 'cgp' )->__( 'Selected currency code ' ) . $currency_code .
174
+ Mage::helper( 'cgp' )->__( ' is not compatible with Card Gate Plus' ) );
175
+ }
176
+
177
+ return $this;
178
+ }
179
+
180
+ /**
181
+ * Change order status
182
+ *
183
+ * @param Mage_Sales_Model_Order $order
184
+ * @return void
185
+ */
186
+ protected function initiateTransactionStatus( $order ) {
187
+ // Change order status
188
+ $newState = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT;
189
+ $newStatus = $this->getConfigData( 'initialized_status' );
190
+ $statusMessage = Mage::helper( 'cgp' )->__( 'Transaction started, waiting for payment.' );
191
+ if ( $order->getState() != Mage_Sales_Model_Order::STATE_PROCESSING ) {
192
+ $order->setState( $newState, $newStatus, $statusMessage );
193
+ $order->save();
194
+ }
195
+ }
196
+
197
+ /**
198
+ * Generates checkout form fields
199
+ *
200
+ * @return array
201
+ */
202
+ public function getCheckoutFormFields() {
203
+ $base = Mage::getSingleton( 'cgp/base' );
204
+
205
+ $session = Mage::getSingleton( 'checkout/session' );
206
+ $extra_data = $session->_additional_information;
207
+ $order = $this->getOrder();
208
+ $customer = $order->getBillingAddress();
209
+
210
+ $s_arr = array();
211
+ $s_arr['language'] = $this->getConfigData( 'lang' );
212
+
213
+ switch ( $this->_model ) {
214
+ // CreditCards
215
+ case 'visa':
216
+ case 'mastercard':
217
+ case 'americanexpress':
218
+ case 'maestro':
219
+ case 'vpay':
220
+ $s_arr['option'] = 'creditcard';
221
+ break;
222
+
223
+ // DIRECTebanking, Sofortbanking
224
+ case 'sofortbanking':
225
+ $s_arr['option'] = 'directebanking';
226
+ break;
227
+
228
+ // iDEAL
229
+ case 'ideal':
230
+ $s_arr['option'] = 'ideal';
231
+ $s_arr['suboption'] = $extra_data['ideal_issuer_id'];
232
+ break;
233
+
234
+ // Giropay
235
+ case 'giropay':
236
+ $s_arr['option'] = 'giropay';
237
+ break;
238
+
239
+ // Mister Cash
240
+ case 'mistercash':
241
+ $s_arr['option'] = 'mistercash';
242
+ break;
243
+
244
+ // PayPal
245
+ case 'paypal':
246
+ $s_arr['option'] = 'paypal';
247
+ break;
248
+
249
+ // Webmoney
250
+ case 'webmoney':
251
+ $s_arr['option'] = 'webmoney';
252
+ break;
253
+
254
+ // Klarna
255
+ case 'klarna':
256
+ $s_arr['option'] = 'klarna';
257
+ if ( isset( $extra_data['klarna-personal-number'] ) ) {
258
+ $s_arr['dob'] = $extra_data['klarna-personal-number'];
259
+ } else {
260
+ $s_arr['dob'] = $extra_data['klarna-dob_day'] . '-' . $extra_data['klarna-dob_month'] . '-' . $extra_data['klarna-dob_year'];
261
+ $s_arr['gender'] = $extra_data['klarna-gender'];
262
+ }
263
+ $s_arr['language'] = $extra_data['klarna-language'];
264
+ $s_arr['account'] = 0;
265
+
266
+ $cartitems = array();
267
+
268
+ foreach ( $order->getAllItems() as $itemId => $item ) {
269
+ // add item
270
+ if ( $item->getQtyToInvoice() > 0 ) {
271
+ $cartitem = array();
272
+ $cartitem['qty'] = $item->getQtyToInvoice();
273
+ $cartitem['id'] = $item->getSku();
274
+ $cartitem['name'] = $item->getName();
275
+ $cartitem['price'] = sprintf( '%01.2f', ( float ) $item->getPriceInclTax() );
276
+
277
+ $item_tax = ( float ) $item->getData( 'tax_percent' );
278
+ $cartitem['vat'] = $item_tax;
279
+ //$cartitem['discount'] = sprintf( '%01.2f', $item->getData( 'discount_percent' ) );
280
+ if ( $item_tax > 0 ) {
281
+ $cartitem['flags'] = 32;
282
+ } else {
283
+ $cartitem['flags'] = 0;
284
+ }
285
+ $cartitems[] = $cartitem;
286
+ }
287
+ }
288
+
289
+ if ( $order->getDiscountAmount() < 0 ) {
290
+ $amount = $order->getDiscountAmount();
291
+ $applyAfter = Mage::helper( 'tax' )->applyTaxAfterDiscount(
292
+ $order->getStoreId()
293
+ );
294
+ if ( $applyAfter == true ) {
295
+ //With this setting active the discount will not have the correct
296
+ //value. We need to take each respective products rate and calculate
297
+ //a new value.
298
+ $amount = 0;
299
+ foreach ( $order->getAllVisibleItems() as $product ) {
300
+ $rate = $product->getTaxPercent();
301
+ $newAmount = $product->getDiscountAmount() * (($rate / 100 ) + 1);
302
+ $amount -= $newAmount;
303
+ }
304
+ //If the discount also extends to shipping
305
+ $shippingDiscount = $order->getShippingDiscountAmount();
306
+ if ( $shippingDiscount ) {
307
+ $taxClass = Mage::getStoreConfig( 'tax/classes/shipping_tax_class' );
308
+ $rate = $this->getTaxRate( $taxClass );
309
+ $newAmount = $shippingDiscount * (($rate / 100 ) + 1);
310
+ $amount -= $newAmount;
311
+ }
312
+ }
313
+
314
+ $discount = array();
315
+ $discount['qty'] = 1;
316
+ $discount['id'] = '';
317
+ $discount['name'] = 'Discount total';
318
+ $discount['price'] = sprintf( '%01.2f', round( $amount, 2 ) );
319
+ $discount['vat'] = 0;
320
+ $discount['flags'] = 32;
321
+
322
+ $cartitems[] = $discount;
323
+ }
324
+
325
+ $settings = Mage::getStoreConfig( 'cgp/cgp_klarna' );
326
+ $handlingFee = (isset( $settings['klarna_invoice_fee_ex'] ) ? $settings['klarna_invoice_fee_ex'] : 0);
327
+
328
+ //add shipping
329
+ if ( $order->getShippingAmount() > 0 ) {
330
+
331
+ $tax_info = $order->getFullTaxInfo();
332
+
333
+ $flags = 8;
334
+ if ( !isset( $tax_info[0]['percent'] ) ) {
335
+ $tax_rate = 0;
336
+ } else {
337
+ $tax_rate = $tax_info[0]['percent'];
338
+ $flags += 32;
339
+ }
340
+
341
+ if ( $handlingFee > 0 ) {
342
+ $shippingText = 'Shipping fee + Klarna invoice fee';
343
+ } else {
344
+ $shippingText = 'Shipping fee';
345
+ }
346
+ $price = round( $order->getShippingAmount() * (1 + $tax_rate / 100), 2 );
347
+ $shipping = array();
348
+ $shipping['qty'] = 1;
349
+ $shipping['id'] = '';
350
+ $shipping['name'] = $shippingText;
351
+ $shipping['price'] = sprintf( '%01.2f', $price );
352
+
353
+ $shipping['flags'] = $flags;
354
+ $shipping['vat'] = $tax_rate;
355
+
356
+ /*
357
+ $baseShippingAmount = ( float ) $order->getBaseShippingAmount();
358
+ $baseShippingDiscountAmount = ( float ) $order->getBaseShippingDiscountAmount();
359
+
360
+ if ( $baseShippingDiscountAmount > 0 && $baseShippingAmount > 0 ) {
361
+ $discountRate = ($baseShippingDiscountAmount / $baseShippingAmount) * 100;
362
+ $shipping['discount'] = sprintf( '%01.2f', $discountRate );
363
+ $shipping['flags'] += 16;
364
+ } else {
365
+ $shipping['discount'] = sprintf( '%01.2f', 0 );
366
+ }
367
+ */
368
+
369
+ $cartitems[] = $shipping;
370
+ }
371
+
372
+ $s_arr['cartitems'] = serialize( $cartitems );
373
+
374
+ break;
375
+
376
+ // Klarna
377
+ case 'klarnaaccount':
378
+ $s_arr['option'] = 'klarna';
379
+
380
+ if ( isset( $extra_data['klarna-account-personal-number'] ) ) {
381
+ $s_arr['dob'] = $extra_data['klarna-account-personal-number'];
382
+ } else {
383
+ $s_arr['dob'] = $extra_data['klarna-account-dob_day'] . '-' . $extra_data['klarna-account-dob_month'] . '-' . $extra_data['klarna-account-dob_year'];
384
+ $s_arr['gender'] = $extra_data['klarna-account-gender'];
385
+ }
386
+ $s_arr['language'] = $extra_data['klarna-account-language'];
387
+ $s_arr['account'] = 1;
388
+
389
+ $cartitems = array();
390
+ foreach ( $order->getAllItems() as $itemId => $item ) {
391
+ if ( $item->getQtyToInvoice() > 0 ) {
392
+ $cartitem = array();
393
+ $cartitem['qty'] = $item->getQtyToInvoice();
394
+ $cartitem['id'] = $item->getSku();
395
+ $cartitem['name'] = $item->getName();
396
+
397
+ $cartitem['price'] = sprintf( '%01.2f', ( float ) $item->getPriceInclTax() );
398
+
399
+
400
+
401
+ $item_tax = ( float ) $item->getData( 'tax_percent' );
402
+ $cartitem['vat'] = $item_tax;
403
+ if ( $item_tax > 0 ) {
404
+ $cartitem['flags'] = 32;
405
+ } else {
406
+ $cartitem['flags'] = 0;
407
+ }
408
+ $cartitems[] = $cartitem;
409
+ }
410
+ }
411
+
412
+ if ( $order->getDiscountAmount() < 0 ) {
413
+ $amount = $order->getDiscountAmount();
414
+ $applyAfter = Mage::helper( 'tax' )->applyTaxAfterDiscount(
415
+ $order->getStoreId()
416
+ );
417
+ if ( $applyAfter == true ) {
418
+ //With this setting active the discount will not have the correct
419
+ //value. We need to take each respective products rate and calculate
420
+ //a new value.
421
+ $amount = 0;
422
+ foreach ( $order->getAllVisibleItems() as $product ) {
423
+ $rate = $product->getTaxPercent();
424
+ $newAmount = $product->getDiscountAmount() * (($rate / 100 ) + 1);
425
+ $amount -= $newAmount;
426
+ }
427
+ //If the discount also extends to shipping
428
+ $shippingDiscount = $order->getShippingDiscountAmount();
429
+ if ( $shippingDiscount ) {
430
+ $taxClass = Mage::getStoreConfig( 'tax/classes/shipping_tax_class' );
431
+ $rate = $this->getTaxRate( $taxClass );
432
+ $newAmount = $shippingDiscount * (($rate / 100 ) + 1);
433
+ $amount -= $newAmount;
434
+ }
435
+ }
436
+
437
+ $discount = array();
438
+ $discount['qty'] = 1;
439
+ $discount['id'] = '';
440
+ $discount['name'] = 'Discount total';
441
+ $discount['price'] = sprintf( '%01.2f', round( $amount, 2 ) );
442
+ $discount['vat'] = 0;
443
+ $discount['flags'] = 32;
444
+
445
+ $cartitems[] = $discount;
446
+ }
447
+
448
+ //add shipping
449
+ if ( $order->getShippingAmount() > 0 ) {
450
+
451
+ $tax_info = $order->getFullTaxInfo();
452
+
453
+ $flags = 8;
454
+ if ( !isset( $tax_info[0]['percent'] ) ) {
455
+ $tax_rate = 0;
456
+ } else {
457
+ $tax_rate = $tax_info[0]['percent'];
458
+ $flags += 32;
459
+ }
460
+
461
+ if ( $handlingFee > 0 ) {
462
+ $shippingText = 'Shipping fee + Klarna invoice fee';
463
+ } else {
464
+ $shippingText = 'Shipping fee';
465
+ }
466
+ $price = round( $order->getShippingAmount() * (1 + $tax_rate / 100), 2 );
467
+ $shipping = array();
468
+ $shipping['qty'] = 1;
469
+ $shipping['id'] = '';
470
+ $shipping['name'] = $shippingText;
471
+ $shipping['price'] = sprintf( '%01.2f', $price );
472
+
473
+ $shipping['flags'] = $flags;
474
+ $shipping['vat'] = $tax_rate;
475
+
476
+ $cartitems[] = $shipping;
477
+ }
478
+ $s_arr['cartitems'] = serialize( $cartitems );
479
+ break;
480
+
481
+ // Banktransfer
482
+ case 'banktransfer':
483
+ $s_arr['option'] = 'banktransfer';
484
+ break;
485
+
486
+ // Directdebit
487
+ case 'directdebit':
488
+ $s_arr['option'] = 'directdebit';
489
+ break;
490
+
491
+ // Przelewy24
492
+ case 'przelewy24':
493
+ $s_arr['option'] = 'przelewy24';
494
+ break;
495
+
496
+ // Default
497
+ default:
498
+ $s_arr['option'] = '';
499
+ $s_arr['suboption'] = '';
500
+ break;
501
+ }
502
+
503
+ // Add new state
504
+ $this->initiateTransactionStatus( $order );
505
+
506
+
507
+ $s_arr['siteid'] = $this->getConfigData( 'site_id' );
508
+ $s_arr['ref'] = $order->getIncrementId();
509
+ $s_arr['first_name'] = $customer->getFirstname();
510
+ $s_arr['last_name'] = $customer->getLastname();
511
+ $s_arr['email'] = $order->getCustomerEmail();
512
+ $s_arr['address'] = $customer->getStreet( 1 ) .
513
+ ($customer->getStreet( 2 ) ? ', ' . $customer->getStreet( 2 ) : '');
514
+ $s_arr['city'] = $customer->getCity();
515
+ $s_arr['country_code'] = $customer->getCountry();
516
+ $s_arr['postal_code'] = $customer->getPostcode();
517
+ $s_arr['phone_number'] = $customer->getTelephone();
518
+ $s_arr['state'] = $customer->getRegionCode();
519
+
520
+ if ( $this->getConfigData( 'use_backoffice_urls' ) == false ) {
521
+ $s_arr['return_url'] = Mage::getUrl( 'cgp/standard/success/', array( '_secure' => true ) );
522
+ $s_arr['return_url_failed'] = Mage::getUrl( 'cgp/standard/cancel/', array( '_secure' => true ) );
523
+ }
524
+
525
+ $s_arr['shop_version'] = 'Magento ' . Mage::getVersion();
526
+ $s_arr['plugin_name'] = 'Cardgate_Cgp';
527
+ $s_arr['plugin_version'] = $this->getPluginVersion();
528
+ $s_arr['extra'] = $this->getCheckout()->getCardgateQuoteId();
529
+
530
+ if ( $base->isTest() ) {
531
+ $s_arr['test'] = '1';
532
+ $hash_prefix = 'TEST';
533
+ } else {
534
+ $hash_prefix = '';
535
+ }
536
+
537
+ $s_arr['amount'] = sprintf( '%.0f', $order->getGrandTotal() * 100 );
538
+ $s_arr['currency'] = $order->getOrderCurrencyCode();
539
+ $s_arr['description'] = str_replace( '%id%', $order->getIncrementId(), $this->getConfigData( 'order_description' ) );
540
+ $s_arr['hash'] = md5( $hash_prefix .
541
+ $this->getConfigData( 'site_id' ) .
542
+ $s_arr['amount'] .
543
+ $s_arr['ref'] .
544
+ $this->getConfigData( 'hash_key' ) );
545
+ // Logging
546
+ $base->log( 'Initiating a new transaction' );
547
+ $base->log( 'Sending customer to Card Gate Plus with values:' );
548
+ $base->log( 'URL = ' . $this->getGatewayUrl() );
549
+ $base->log( $s_arr );
550
+
551
+ $locale = Mage::app()->getLocale()->getLocaleCode();
552
+ return $s_arr;
553
+ }
554
+
555
+ }
app/code/local/Cardgate/Cgp/Model/Gateway/Americanexpress.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento CardGatePlus payment extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Mage
13
+ * @package Cardgate_Cgp
14
+ * @author Paul Saparov, <support@cardgate.com>
15
+ * @copyright Copyright (c) 2011 CardGatePlus B.V. (http://www.cardgateplus.com)
16
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
+ */
18
+
19
+ class Cardgate_Cgp_Model_Gateway_Americanexpress extends Cardgate_Cgp_Model_Gateway_Abstract
20
+ {
21
+ protected $_code = 'cgp_americanexpress';
22
+ protected $_model = 'americanexpress';
23
+ }
app/code/local/Cardgate/Cgp/Model/Gateway/Banktransfer.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento CardGatePlus payment extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Mage
13
+ * @package Cardgate_Cgp
14
+ * @author Paul Saparov, <support@cardgate.com>
15
+ * @copyright Copyright (c) 2011 CardGatePlus B.V. (http://www.cardgateplus.com)
16
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
+ */
18
+
19
+ class Cardgate_Cgp_Model_Gateway_Banktransfer extends Cardgate_Cgp_Model_Gateway_Abstract
20
+ {
21
+ protected $_code = 'cgp_banktransfer';
22
+ protected $_model = 'banktransfer';
23
+ }
app/code/local/Cardgate/Cgp/Model/Gateway/Default.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento CardGatePlus payment extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Mage
13
+ * @package Cardgate_Cgp
14
+ * @author Paul Saparov, <support@cardgate.com>
15
+ * @copyright Copyright (c) 2011 CardGatePlus B.V. (http://www.cardgateplus.com)
16
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
+ */
18
+
19
+ class Cardgate_Cgp_Model_Gateway_Default extends Cardgate_Cgp_Model_Gateway_Abstract
20
+ {
21
+ // Will redirect user to splash screen
22
+ }
app/code/local/Cardgate/Cgp/Model/Gateway/Directdebit.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento CardGatePlus payment extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Mage
13
+ * @package Cardgate_Cgp
14
+ * @author Paul Saparov, <support@cardgate.com>
15
+ * @copyright Copyright (c) 2011 CardGatePlus B.V. (http://www.cardgateplus.com)
16
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
+ */
18
+
19
+ class Cardgate_Cgp_Model_Gateway_Directdebit extends Cardgate_Cgp_Model_Gateway_Abstract
20
+ {
21
+ protected $_code = 'cgp_directdebit';
22
+ protected $_model = 'directdebit';
23
+ }
app/code/local/Cardgate/Cgp/Model/Gateway/Giropay.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento CardGatePlus payment extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Mage
13
+ * @package Cardgate_Cgp
14
+ * @author Paul Saparov, <support@cardgate.com>
15
+ * @copyright Copyright (c) 2011 CardGatePlus B.V. (http://www.cardgateplus.com)
16
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
+ */
18
+
19
+ class Cardgate_Cgp_Model_Gateway_Giropay extends Cardgate_Cgp_Model_Gateway_Abstract
20
+ {
21
+ protected $_code = 'cgp_giropay';
22
+ protected $_model = 'giropay';
23
+ }
app/code/local/Cardgate/Cgp/Model/Gateway/Ideal.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento CardGatePlus payment extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Mage
13
+ * @package Cardgate_Cgp
14
+ * @author Paul Saparov, <support@cardgate.com>
15
+ * @copyright Copyright (c) 2011 CardGatePlus B.V. (http://www.cardgateplus.com)
16
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
+ */
18
+
19
+ class Cardgate_Cgp_Model_Gateway_Ideal extends Cardgate_Cgp_Model_Gateway_Abstract
20
+ {
21
+ protected $_code = 'cgp_ideal';
22
+ protected $_model = 'ideal';
23
+ protected $_formBlockType = 'cgp/form_ideal';
24
+ }
app/code/local/Cardgate/Cgp/Model/Gateway/Klarna.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento CardGatePlus payment extension
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
+ *
13
+ * @category Mage
14
+ * @package Cardgate_Cgp
15
+ * @author Paul Saparov, <support@cardgate.com>
16
+ * @copyright Copyright (c) 2011 CardGatePlus B.V. (http://www.cardgateplus.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+ class Cardgate_Cgp_Model_Gateway_Klarna extends Cardgate_Cgp_Model_Gateway_Abstract {
20
+
21
+ protected $_code = 'cgp_klarna';
22
+ protected $_model = 'klarna';
23
+ protected $_formBlockType = 'cgp/form_klarna';
24
+ protected $_canUseCheckout = false;
25
+
26
+ public function __construct() {
27
+ parent::__construct();
28
+ $klarna_countries = array( 'AT', 'DK', 'FI', 'DE', 'NL', 'NO', 'SE' );
29
+ $country = Mage::getSingleton( 'checkout/session' )->getQuote()->getBillingAddress()->getCountry();
30
+ if ( isset( $country ) && in_array( $country, $klarna_countries ) ) {
31
+ $this->_canUseCheckout = true;
32
+ }
33
+ }
34
+
35
+ }
app/code/local/Cardgate/Cgp/Model/Gateway/Klarnaaccount.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento CardGatePlus payment extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Mage
13
+ * @package Cardgate_Cgp
14
+ * @author Paul Saparov, <support@cardgate.com>
15
+ * @copyright Copyright (c) 2011 CardGatePlus B.V. (http://www.cardgateplus.com)
16
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
+ */
18
+
19
+ class Cardgate_Cgp_Model_Gateway_Klarnaaccount extends Cardgate_Cgp_Model_Gateway_Abstract
20
+ {
21
+ protected $_code = 'cgp_klarnaaccount';
22
+ protected $_model = 'klarnaaccount';
23
+ protected $_formBlockType = 'cgp/form_klarnaaccount';
24
+ protected $_canUseCheckout = false;
25
+
26
+ public function __construct() {
27
+ parent::__construct();
28
+ // This payment method is not used in Austria;
29
+ $klarna_countries = array('DK','FI','DE','NL','NO','SE');
30
+ $country = Mage::getSingleton('checkout/session')->getQuote()->getBillingAddress()->getCountry();
31
+ if (isset($country) && in_array($country,$klarna_countries)){
32
+ $this->_canUseCheckout = true;
33
+ }
34
+ }
35
+ }
36
+
app/code/local/Cardgate/Cgp/Model/Gateway/Maestro.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento CardGatePlus payment extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Mage
13
+ * @package Cardgate_Cgp
14
+ * @author Paul Saparov, <support@cardgate.com>
15
+ * @copyright Copyright (c) 2011 CardGatePlus B.V. (http://www.cardgateplus.com)
16
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
+ */
18
+
19
+ class Cardgate_Cgp_Model_Gateway_Maestro extends Cardgate_Cgp_Model_Gateway_Abstract
20
+ {
21
+ protected $_code = 'cgp_maestro';
22
+ protected $_model = 'maestro';
23
+ }
app/code/local/Cardgate/Cgp/Model/Gateway/Mastercard.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento CardGatePlus payment extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Mage
13
+ * @package Cardgate_Cgp
14
+ * @author Paul Saparov, <support@cardgate.com>
15
+ * @copyright Copyright (c) 2011 CardGatePlus B.V. (http://www.cardgateplus.com)
16
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
+ */
18
+
19
+ class Cardgate_Cgp_Model_Gateway_Mastercard extends Cardgate_Cgp_Model_Gateway_Abstract
20
+ {
21
+ protected $_code = 'cgp_mastercard';
22
+ protected $_model = 'mastercard';
23
+ }
app/code/local/Cardgate/Cgp/Model/Gateway/Mistercash.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento CardGatePlus payment extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Mage
13
+ * @package Cardgate_Cgp
14
+ * @author Paul Saparov, <support@cardgate.com>
15
+ * @copyright Copyright (c) 2011 CardGatePlus B.V. (http://www.cardgateplus.com)
16
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
+ */
18
+
19
+ class Cardgate_Cgp_Model_Gateway_Mistercash extends Cardgate_Cgp_Model_Gateway_Abstract
20
+ {
21
+ protected $_code = 'cgp_mistercash';
22
+ protected $_model = 'mistercash';
23
+ }
app/code/local/Cardgate/Cgp/Model/Gateway/Paypal.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento CardGatePlus payment extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Mage
13
+ * @package Cardgate_Cgp
14
+ * @author Paul Saparov, <support@cardgate.com>
15
+ * @copyright Copyright (c) 2011 CardGatePlus B.V. (http://www.cardgateplus.com)
16
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
+ */
18
+
19
+ class Cardgate_Cgp_Model_Gateway_Paypal extends Cardgate_Cgp_Model_Gateway_Abstract
20
+ {
21
+ protected $_code = 'cgp_paypal';
22
+ protected $_model = 'paypal';
23
+ }
app/code/local/Cardgate/Cgp/Model/Gateway/Przelewy24.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento CardGatePlus payment extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Mage
13
+ * @package Cardgate_Cgp
14
+ * @author Paul Saparov, <support@cardgate.com>
15
+ * @copyright Copyright (c) 2011 CardGatePlus B.V. (http://www.cardgateplus.com)
16
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
+ */
18
+
19
+ class Cardgate_Cgp_Model_Gateway_Przelewy24 extends Cardgate_Cgp_Model_Gateway_Abstract
20
+ {
21
+ protected $_code = 'cgp_przelewy24';
22
+ protected $_model = 'przelewy24';
23
+ }
app/code/local/Cardgate/Cgp/Model/Gateway/Sofortbanking.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento CardGatePlus payment extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Mage
13
+ * @package Cardgate_Cgp
14
+ * @author Paul Saparov, <support@cardgate.com>
15
+ * @copyright Copyright (c) 2011 CardGatePlus B.V. (http://www.cardgateplus.com)
16
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
+ */
18
+
19
+ class Cardgate_Cgp_Model_Gateway_Sofortbanking extends Cardgate_Cgp_Model_Gateway_Abstract
20
+ {
21
+ protected $_code = 'cgp_sofortbanking';
22
+ protected $_model = 'sofortbanking';
23
+ }
app/code/local/Cardgate/Cgp/Model/Gateway/Visa.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento CardGatePlus payment extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Mage
13
+ * @package Cardgate_Cgp
14
+ * @author Paul Saparov, <support@cardgate.com>
15
+ * @copyright Copyright (c) 2011 CardGatePlus B.V. (http://www.cardgateplus.com)
16
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
+ */
18
+
19
+ class Cardgate_Cgp_Model_Gateway_Visa extends Cardgate_Cgp_Model_Gateway_Abstract
20
+ {
21
+ protected $_code = 'cgp_visa';
22
+ protected $_model = 'visa';
23
+ }
app/code/local/Cardgate/Cgp/Model/Gateway/Vpay.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento CardGatePlus payment extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Mage
13
+ * @package Cardgate_Cgp
14
+ * @author Paul Saparov, <support@cardgate.com>
15
+ * @copyright Copyright (c) 2011 CardGatePlus B.V. (http://www.cardgateplus.com)
16
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
+ */
18
+
19
+ class Cardgate_Cgp_Model_Gateway_Vpay extends Cardgate_Cgp_Model_Gateway_Abstract
20
+ {
21
+ protected $_code = 'cgp_vpay';
22
+ protected $_model = 'vpay';
23
+ }
app/code/local/Cardgate/Cgp/Model/Gateway/Webmoney.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento CardGatePlus payment extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Mage
13
+ * @package Cardgate_Cgp
14
+ * @author Paul Saparov, <support@cardgate.com>
15
+ * @copyright Copyright (c) 2011 CardGatePlus B.V. (http://www.cardgateplus.com)
16
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
+ */
18
+
19
+ class Cardgate_Cgp_Model_Gateway_Webmoney extends Cardgate_Cgp_Model_Gateway_Abstract
20
+ {
21
+ protected $_code = 'cgp_webmoney';
22
+ protected $_model = 'webmoney';
23
+ }
24
+
app/code/local/Cardgate/Cgp/Model/Observer.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Event observer
5
+ *
6
+ * PHP Version 5.3
7
+ *
8
+ * @category Payment
9
+ * @package Klarna_Module_Magento
10
+ * @author MS Dev <ms.modules@klarna.com>
11
+ * @license http://opensource.org/licenses/BSD-2-Clause BSD2
12
+ * @link http://integration.klarna.com
13
+ */
14
+
15
+ /**
16
+ * Class to observe and handle Magento events
17
+ *
18
+ * @category Payment
19
+ * @package Klarna_Module_Magento
20
+ * @author MS Dev <ms.modules@klarna.com>
21
+ * @license http://opensource.org/licenses/BSD-2-Clause BSD2
22
+ * @link http://integration.klarna.com
23
+ */
24
+ class Cardgate_Cgp_Model_Observer extends Mage_Core_Model_Abstract {
25
+
26
+ public function salesQuoteCollectTotalsBefore( Varien_Event_Observer $observer ) {
27
+ /** @var Mage_Sales_Model_Quote $quote */
28
+ $quote = $observer->getQuote();
29
+
30
+ if ( $quote->getCustomer()->getId() ) {
31
+ $address = $quote->getCustomer()->getAddress();
32
+
33
+ $payment = $quote->getPayment();
34
+
35
+ try {
36
+ /**
37
+ * Instead of relying on hasMethodInstance which would not always
38
+ * work when i.e the order total is reloaded with coupon codes, we
39
+ * try to get the instance directly instead.
40
+ */
41
+ $p = $payment->getMethodInstance();
42
+ } catch ( Mage_Core_Exception $e ) {
43
+ return;
44
+ }
45
+ $paymentMethod = $p->getCode();
46
+
47
+ // For Klarna invoice, add Invoice fee
48
+ if ( $paymentMethod == 'cgp_klarna' ) {
49
+
50
+ $settings = Mage::getStoreConfig( 'cgp/cgp_klarna', $quote->getStoreId() );
51
+ $fee = floatval( $settings['klarna_invoice_fee_ex'] );
52
+
53
+ $store = Mage::app()->getStore( $quote->getStoreId() );
54
+ $carriers = Mage::getStoreConfig( 'carriers', $store );
55
+
56
+ foreach ( $carriers as $carrierCode => $carrierConfig ) {
57
+
58
+ // F for fixed, P for percentage
59
+ $store->setConfig( "carriers/{$carrierCode}/handling_type", 'F' );
60
+
61
+ // 0 for no fee, otherwise fixed of percentage value
62
+ $handlingFee = $store->getConfig( "carriers/{$carrierCode}/handling_fee" );
63
+ $store->setConfig( "carriers/{$carrierCode}/handling_fee", $handlingFee + $fee );
64
+ }
65
+ }
66
+ }
67
+ }
68
+
69
+ }
app/code/local/Cardgate/Cgp/controllers/StandardController.php ADDED
@@ -0,0 +1,196 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento CardGatePlus payment extension
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
+ *
13
+ * @category Mage
14
+ * @package Cardgate_Cgp
15
+ * @author Paul Saparov, <support@cardgate.com>
16
+ * @copyright Copyright (c) 2011 CardGatePlus B.V. (http://www.cardgateplus.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+ class Cardgate_Cgp_StandardController extends Mage_Core_Controller_Front_Action {
20
+
21
+ private $_gatewayModel;
22
+
23
+ /**
24
+ * Verify the callback
25
+ *
26
+ * @param array $data
27
+ * @return boolean
28
+ */
29
+ protected function validate( $data ) {
30
+ $base = Mage::getSingleton( 'cgp/base' );
31
+
32
+ $hashString = ($base->isTest() ? 'TEST' : '') .
33
+ $data['transaction_id'] .
34
+ $data['currency'] .
35
+ $data['amount'] .
36
+ $data['ref'] .
37
+ $data['status'] .
38
+ $base->getConfigData( 'hash_key' );
39
+
40
+ if ( md5( $hashString ) == $data['hash'] ) {
41
+ return true;
42
+ }
43
+
44
+ return false;
45
+ }
46
+
47
+ /**
48
+ * Check if within the URL is param model
49
+ * if not, return default gateway model
50
+ * @return string
51
+ */
52
+ protected function getGatewayModel() {
53
+ if ( $this->_gatewayModel ) {
54
+ return $this->_gatewayModel;
55
+ }
56
+
57
+ $model = $this->getRequest()->getParam( 'model' );
58
+ $model = preg_replace( '/[^[[:alnum:]]]+/', '', $model );
59
+
60
+ if ( !empty( $model ) ) {
61
+ return 'gateway_' . $model;
62
+ } else {
63
+ return 'gateway_default';
64
+ }
65
+ }
66
+
67
+ /**
68
+ * Redirect customer to the gateway using his prefered payment method
69
+ */
70
+ public function redirectAction() {
71
+ $paymentModel = 'cgp/' . $this->getGatewayModel();
72
+ Mage::register( 'cgp_model', $paymentModel );
73
+
74
+ $session = Mage::getSingleton( 'checkout/session' );
75
+ $session->setCardgateQuoteId( $session->getQuoteId() );
76
+
77
+ $this->loadLayout();
78
+ $block = $this->getLayout()->createBlock(
79
+ 'Cardgate_Cgp_Block_Redirect'
80
+ );
81
+
82
+ $this->getLayout()->getBlock( 'content' )->append( $block );
83
+ $this->renderLayout();
84
+ }
85
+
86
+ /**
87
+ * After a failed transaction a customer will be send here
88
+ */
89
+ public function cancelAction() {
90
+ switch ( $_REQUEST['cgpstatusid'] ) {
91
+ case 0:
92
+ $message = $this->__( 'Your payment is being evaluated by the bank. Please do not attempt to pay again, until your payment is either confirmed or denied by the bank.' );
93
+ break;
94
+ case 305:
95
+ break;
96
+ case 300:
97
+ $message = $this->__( 'Your payment has failed. If you wish, you can try using a different payment method.' );
98
+ break;
99
+ }
100
+ if ( isset( $message ) ) {
101
+ Mage::getSingleton( 'core/session' )->addError( $message );
102
+ }
103
+
104
+ $base = Mage::getSingleton( 'cgp/base' );
105
+ $session = Mage::getSingleton( 'checkout/session' );
106
+ /*
107
+ $order_id = $session->getLastRealOrderId();
108
+ if ( $order_id ) {
109
+ // if order has failed it is canceled via the control url and should not be canceled a second time
110
+ $order = Mage::getSingleton( 'sales/order' )->loadByIncrementId( $order_id );
111
+
112
+ if ( $order->getState() != Mage_Sales_Model_Order::STATE_CANCELED ) {
113
+ $order->setState( $base->getConfigData( 'order_status_failed' ) );
114
+ $order->cancel();
115
+ $order->save();
116
+ }
117
+ }
118
+
119
+ if ( $session->getCgpOnestepCheckout() == true ) {
120
+ $quote = Mage::getModel( 'sales/quote' )->load( $session->getCgpOnestepQuoteId() );
121
+ } else {
122
+ $quote = Mage::getModel( 'sales/quote' )->load( $session->getCardgateQuoteId() );
123
+ }
124
+ */
125
+ $quote = Mage::getModel( 'sales/quote' )->load( $session->getCardgateQuoteId() );
126
+
127
+ if ( $quote->getId() ) {
128
+ $quote->setIsActive( true );
129
+ $quote->save();
130
+ }
131
+
132
+ // clear session flag so that it will redirect to the gateway, and not to cancel
133
+ // $session->setCgpOnestepCheckout(false);
134
+ $this->_redirect( 'checkout/cart' );
135
+ }
136
+
137
+ /**
138
+ * After a successful transaction a customer will be send here
139
+ */
140
+ public function successAction() {
141
+ $session = Mage::getSingleton( 'checkout/session' );
142
+ $quote = Mage::getModel( 'sales/quote' )->load( $session->getCardgateQuoteId() );
143
+ if ( $quote->getId() ) {
144
+ $quote->setIsActive( false );
145
+ $quote->delete();
146
+ }
147
+ // clear session flag so that next order will redirect to the gateway
148
+ //$session->setCgpOnestepCheckout(false);
149
+
150
+ $this->_redirect( 'checkout/onepage/success', array( '_secure' => true ) );
151
+ }
152
+
153
+ /**
154
+ * Control URL called by gateway
155
+ */
156
+ public function controlAction() {
157
+
158
+ $base = Mage::getModel( 'cgp/base' );
159
+ $data = $this->getRequest()->getPost();
160
+
161
+ // Verify callback hash
162
+ if ( !$this->getRequest()->isPost() || !$this->validate( $data ) ) {
163
+ $message = 'Callback hash validation failed!';
164
+ $base->log( $message );
165
+ echo $message;
166
+ exit();
167
+ }
168
+
169
+ // Process callback
170
+ $base->setCallbackData( $data )->processCallback();
171
+
172
+ // Obtain quote and status
173
+ $status = ( int ) $data['status'];
174
+ $quote = Mage::getModel( 'sales/quote' )->load( $data['extra'] );
175
+
176
+ // Set Mage_Sales_Model_Quote to inactive and delete
177
+ if ( 200 <= $status && $status <= 299 ) {
178
+
179
+ //$retain = $base->getConfigData('retain_cart_on_cancel');
180
+ if ( $quote->getId() ) {
181
+ $quote->setIsActive( false );
182
+ $quote->delete();
183
+ }
184
+ // Set Mage_Sales_Model_Quote to active and save
185
+ } else {
186
+ if ( $quote->getId() ) {
187
+ $quote->setIsActive( true );
188
+ $quote->save();
189
+ }
190
+ }
191
+
192
+ // Display transaction_id and status
193
+ echo $data['transaction_id'] . '.' . $data['status'];
194
+ }
195
+
196
+ }
app/code/local/Cardgate/Cgp/etc/adminhtml.xml ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ /**
4
+ * Magento Carg Gate Plus payment extension
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
+ *
13
+ * @category Mage
14
+ * @package Cardgate_Cgp
15
+ * @author Paul Saparov, <support@cardgate.com>
16
+ * @copyright Copyright (c) 2011 CardGatePlus B.V. (http://www.cardgateplus.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+ -->
20
+ <config>
21
+ <acl>
22
+ <resources>
23
+ <admin>
24
+ <children>
25
+ <system>
26
+ <children>
27
+ <config>
28
+ <children>
29
+ <cgp>
30
+ <title>CardGate+ Settings</title>
31
+ </cgp>
32
+ </children>
33
+ </config>
34
+ </children>
35
+ </system>
36
+ </children>
37
+ </admin>
38
+ </resources>
39
+ </acl>
40
+ </config>
app/code/local/Cardgate/Cgp/etc/config.xml ADDED
@@ -0,0 +1,318 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ /**
4
+ * Magento CardGatePlus payment extension
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
+ *
13
+ * @category Mage
14
+ * @package Cardgate_Cgp
15
+ * @author Paul Saparov, <support@cardgate.com>
16
+ * @copyright Copyright (c) 2011 CardGatePlus B.V. (http://www.cardgateplus.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+ -->
20
+ <config>
21
+ <modules>
22
+ <Cardgate_Cgp>
23
+ <version>1.0.28</version>
24
+ </Cardgate_Cgp>
25
+ </modules>
26
+
27
+ <global>
28
+ <blocks>
29
+ <cgp>
30
+ <class>Cardgate_Cgp_Block</class>
31
+ </cgp>
32
+ </blocks>
33
+ <helpers>
34
+ <cgp>
35
+ <class>Cardgate_Cgp_Helper</class>
36
+ </cgp>
37
+ </helpers>
38
+ <models>
39
+ <cgp>
40
+ <class>Cardgate_Cgp_Model</class>
41
+ </cgp>
42
+ </models>
43
+ <resources>
44
+ <cgp_setup>
45
+ <setup>
46
+ <module>Cardgate_Cgp</module>
47
+ </setup>
48
+ <connection>
49
+ <use>core_setup</use>
50
+ </connection>
51
+ </cgp_setup>
52
+ <cgp_read>
53
+ <connection>
54
+ <use>core_read</use>
55
+ </connection>
56
+ </cgp_read>
57
+ <cgp_write>
58
+ <connection>
59
+ <use>core_write</use>
60
+ </connection>
61
+ </cgp_write>
62
+ </resources>
63
+ <events>
64
+ <sales_quote_collect_totals_before>
65
+ <observers>
66
+ <cgp>
67
+ <type>singleton</type>
68
+ <class>cgp/observer</class>
69
+ <method>salesQuoteCollectTotalsBefore</method>
70
+ </cgp>
71
+ </observers>
72
+ </sales_quote_collect_totals_before>
73
+ </events>
74
+ </global>
75
+
76
+ <adminhtml>
77
+ <translate>
78
+ <modules>
79
+ <Cardgate_Cgp>
80
+ <files>
81
+ <default>Cardgate_Cgp.csv</default>
82
+ </files>
83
+ </Cardgate_Cgp>
84
+ </modules>
85
+ </translate>
86
+ <layout>
87
+ <updates>
88
+ <cgp>
89
+ <file>cardgate_cgp.xml</file>
90
+ </cgp>
91
+ </updates>
92
+ </layout>
93
+ <acl>
94
+ <resources>
95
+ <admin>
96
+ <children>
97
+ <system>
98
+ <children>
99
+ <config>
100
+ <children>
101
+ <cgp>
102
+ <title>CardGate+ Settings</title>
103
+ </cgp>
104
+ </children>
105
+ </config>
106
+ </children>
107
+ </system>
108
+ </children>
109
+ </admin>
110
+ </resources>
111
+ </acl>
112
+ </adminhtml>
113
+
114
+ <frontend>
115
+ <routers>
116
+ <cgp>
117
+ <use>standard</use>
118
+ <args>
119
+ <module>Cardgate_Cgp</module>
120
+ <frontName>cgp</frontName>
121
+ </args>
122
+ </cgp>
123
+ </routers>
124
+ <translate>
125
+ <modules>
126
+ <Cardgate_Cgp>
127
+ <files>
128
+ <default>Cardgate_Cgp.csv</default>
129
+ </files>
130
+ </Cardgate_Cgp>
131
+ </modules>
132
+ </translate>
133
+ </frontend>
134
+
135
+ <default>
136
+ <payment>
137
+ <cgp_visa>
138
+ <active>1</active>
139
+ <model>cgp/gateway_visa</model>
140
+ <title>CGP Visa</title>
141
+ </cgp_visa>
142
+ <cgp_mastercard>
143
+ <active>1</active>
144
+ <model>cgp/gateway_mastercard</model>
145
+ <title>CGP MasterCard</title>
146
+ </cgp_mastercard>
147
+ <cgp_americanexpress>
148
+ <active>1</active>
149
+ <model>cgp/gateway_americanexpress</model>
150
+ <title>CGP AmericanExpress</title>
151
+ </cgp_americanexpress>
152
+ <cgp_maestro>
153
+ <active>1</active>
154
+ <model>cgp/gateway_maestro</model>
155
+ <title>CGP Maestro</title>
156
+ </cgp_maestro>
157
+ <cgp_vpay>
158
+ <active>1</active>
159
+ <model>cgp/gateway_vpay</model>
160
+ <title>CGP V-Pay</title>
161
+ </cgp_vpay>
162
+ <cgp_sofortbanking>
163
+ <active>1</active>
164
+ <model>cgp/gateway_sofortbanking</model>
165
+ <title>CGP SofortBanking</title>
166
+ </cgp_sofortbanking>
167
+ <cgp_ideal>
168
+ <active>1</active>
169
+ <model>cgp/gateway_ideal</model>
170
+ <title>CGP iDEAL</title>
171
+ </cgp_ideal>
172
+ <cgp_mistercash>
173
+ <active>1</active>
174
+ <model>cgp/gateway_mistercash</model>
175
+ <title>CGP MisterCash</title>
176
+ </cgp_mistercash>
177
+ <cgp_paypal>
178
+ <active>1</active>
179
+ <model>cgp/gateway_paypal</model>
180
+ <title>CGP PayPal</title>
181
+ </cgp_paypal>
182
+ <cgp_webmoney>
183
+ <active>1</active>
184
+ <model>cgp/gateway_webmoney</model>
185
+ <title>CGP Webmoney</title>
186
+ </cgp_webmoney>
187
+ <cgp_klarna>
188
+ <active>1</active>
189
+ <model>cgp/gateway_klarna</model>
190
+ <title>CGP KlarnaInvoice</title>
191
+ </cgp_klarna>
192
+ <cgp_klarnaaccount>
193
+ <active>1</active>
194
+ <model>cgp/gateway_klarnaaccount</model>
195
+ <title>CGP KlarnaAccount</title>
196
+ </cgp_klarnaaccount>
197
+ <cgp_giropay>
198
+ <active>1</active>
199
+ <model>cgp/gateway_giropay</model>
200
+ <title>CGP Giropay</title>
201
+ </cgp_giropay>
202
+ <cgp_banktransfer>
203
+ <active>1</active>
204
+ <model>cgp/gateway_banktransfer</model>
205
+ <title>CGP Bank Transfer</title>
206
+ </cgp_banktransfer>
207
+ <cgp_directdebit>
208
+ <active>1</active>
209
+ <model>cgp/gateway_directdebit</model>
210
+ <title>CGP Direct Debit</title>
211
+ </cgp_directdebit>
212
+ <cgp_przelewy24>
213
+ <active>1</active>
214
+ <model>cgp/gateway_przelewy24</model>
215
+ <title>CGP Przelewy24</title>
216
+ </cgp_przelewy24>
217
+ </payment>
218
+
219
+ <cgp>
220
+ <settings>
221
+ <active>0</active>
222
+ <lang>nl</lang>
223
+ <initialized_status>pending</initialized_status>
224
+ <complete_status>processing</complete_status>
225
+ <failed_status>canceled</failed_status>
226
+ <fraud_status>canceled</fraud_status>
227
+ <use_backoffice_urls>0</use_backoffice_urls>
228
+ <autocreate_invoice>1</autocreate_invoice>
229
+ <mail_invoice>1</mail_invoice>
230
+ <notification_email>general</notification_email>
231
+ <event_invoicing_failed>0</event_invoicing_failed>
232
+ <order_description>Order %id%</order_description>
233
+ <test_mode>test</test_mode>
234
+ <debug>1</debug>
235
+ </settings>
236
+ <cgp_visa translate="title" module="cgp">
237
+ <active>0</active>
238
+ <model>cgp/gateway_visa</model>
239
+ <title>Visa</title>
240
+ </cgp_visa>
241
+ <cgp_mastercard translate="title" module="cgp">
242
+ <active>0</active>
243
+ <model>cgp/gateway_mastercard</model>
244
+ <title>MasterCard</title>
245
+ </cgp_mastercard>
246
+ <cgp_americanexpress translate="title" module="cgp">
247
+ <active>0</active>
248
+ <model>cgp/gateway_americanexpress</model>
249
+ <title>AmericanExpress</title>
250
+ </cgp_americanexpress>
251
+ <cgp_maestro translate="title" module="cgp">
252
+ <active>0</active>
253
+ <model>cgp/gateway_maestro</model>
254
+ <title>Maestro</title>
255
+ </cgp_maestro>
256
+ <cgp_vpay translate="title" module="cgp">
257
+ <active>0</active>
258
+ <model>cgp/gateway_vpay</model>
259
+ <title>V-Pay</title>
260
+ </cgp_vpay>
261
+ <cgp_sofortbanking translate="title" module="cgp">
262
+ <active>0</active>
263
+ <model>cgp/gateway_sofortbanking</model>
264
+ <title>SofortBanking</title>
265
+ </cgp_sofortbanking>
266
+ <cgp_ideal translate="title" module="cgp">
267
+ <active>0</active>
268
+ <model>cgp/gateway_ideal</model>
269
+ <title>iDEAL</title>
270
+ </cgp_ideal>
271
+ <cgp_mistercash translate="title" module="cgp">
272
+ <active>0</active>
273
+ <model>cgp/gateway_mistercash</model>
274
+ <title>MisterCash</title>
275
+ </cgp_mistercash>
276
+ <cgp_paypal translate="title" module="cgp">
277
+ <active>0</active>
278
+ <model>cgp/gateway_paypal</model>
279
+ <title>PayPal</title>
280
+ </cgp_paypal>
281
+ <cgp_webmoney translate="title" module="cgp">
282
+ <active>0</active>
283
+ <model>cgp/gateway_webmoney</model>
284
+ <title>Webmoney</title>
285
+ </cgp_webmoney>
286
+ <cgp_klarna translate="title" module="cgp">
287
+ <active>0</active>
288
+ <model>cgp/gateway_klarna</model>
289
+ <title>Klarna Invoice</title>
290
+ </cgp_klarna>
291
+ <cgp_klarnaaccount translate="title" module="cgp">
292
+ <active>0</active>
293
+ <model>cgp/gateway_klarnaaccount</model>
294
+ <title>Klarna Account</title>
295
+ </cgp_klarnaaccount>
296
+ <cgp_giropay translate="title" module="cgp">
297
+ <active>0</active>
298
+ <model>cgp/gateway_giropay</model>
299
+ <title>Giropay</title>
300
+ </cgp_giropay>
301
+ <cgp_banktransfer translate="title" module="cgp">
302
+ <active>0</active>
303
+ <model>cgp/gateway_banktransfer</model>
304
+ <title>Bank Transfer</title>
305
+ </cgp_banktransfer>
306
+ <cgp_directdebit translate="title" module="cgp">
307
+ <active>0</active>
308
+ <model>cgp/gateway_directdebit</model>
309
+ <title>Direct Debit</title>
310
+ </cgp_directdebit>
311
+ <cgp_przelewy24 translate="title" module="cgp">
312
+ <active>0</active>
313
+ <model>cgp/gateway_przelewy24</model>
314
+ <title>Przelewy24</title>
315
+ </cgp_przelewy24>
316
+ </cgp>
317
+ </default>
318
+ </config>
app/code/local/Cardgate/Cgp/etc/system.xml ADDED
@@ -0,0 +1,1084 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ /**
4
+ * Magento CardGatePlus payment extension
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
+ *
13
+ * @category Mage
14
+ * @package Cardgate_Cgp
15
+ * @author Paul Saparov, <support@cardgate.com>
16
+ * @copyright Copyright (c) 2011 CardGatePlus B.V. (http://www.cardgateplus.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+ -->
20
+ <config>
21
+ <sections>
22
+ <cgp module="cgp">
23
+ <label>CardGatePlus</label>
24
+ <class>cardgate-section</class>
25
+ <header_css>cardgate-header</header_css>
26
+ <tab>sales</tab>
27
+ <frontend_type>text</frontend_type>
28
+ <sort_order>999</sort_order>
29
+ <show_in_default>1</show_in_default>
30
+ <show_in_website>1</show_in_website>
31
+ <show_in_store>1</show_in_store>
32
+ <groups>
33
+ <settings translate="comment">
34
+ <label>Settings</label>
35
+ <comment><![CDATA[<strong>Note:</strong> Don't forget to set-up in the <a href="https://merchants.cardgateplus.com/" target="_blank">Merchant Backoffice</a> a Control URL to "http://www.yourdomain.com/cgp/standard/control/".]]></comment>
36
+ <sort_order>100</sort_order>
37
+ <show_in_default>1</show_in_default>
38
+ <show_in_website>1</show_in_website>
39
+ <show_in_store>1</show_in_store>
40
+ <fields>
41
+ <test_mode translate="label comment">
42
+ <label>Test/Live Mode</label>
43
+ <frontend_type>select</frontend_type>
44
+ <comment><![CDATA[Switching between test and live mode. If you don't have an account <a href='http://www.cardgate.com/' target='_blank'>sign up here.</a>]]></comment>
45
+ <source_model>cgp/adminhtml_system_config_source_modes</source_model>
46
+ <sort_order>20</sort_order>
47
+ <show_in_default>1</show_in_default>
48
+ <show_in_website>1</show_in_website>
49
+ <show_in_store>1</show_in_store>
50
+ </test_mode>
51
+ <site_id translate="label comment">
52
+ <label>Site ID</label>
53
+ <frontend_type>text</frontend_type>
54
+ <comment><![CDATA[Fill in you site ID number. You can find your site ID number at <a href="https://merchants.cardgateplus.com/" target="_blank">merchant back-office</a>]]></comment>
55
+ <sort_order>30</sort_order>
56
+ <show_in_default>1</show_in_default>
57
+ <show_in_website>1</show_in_website>
58
+ <show_in_store>1</show_in_store>
59
+ </site_id>
60
+ <hash_key translate="label comment">
61
+ <label>Hash Key</label>
62
+ <frontend_type>text</frontend_type>
63
+ <comment><![CDATA[Fill in you secret hash key for the site. You can create your hash key code at <a href="https://merchants.cardgateplus.com/" target="_blank">merchant back-office</a>]]></comment>
64
+ <sort_order>40</sort_order>
65
+ <show_in_default>1</show_in_default>
66
+ <show_in_website>1</show_in_website>
67
+ <show_in_store>1</show_in_store>
68
+ </hash_key>
69
+ <use_backoffice_urls translate="label comment">
70
+ <label>Use back-office URLs</label>
71
+ <frontend_type>select</frontend_type>
72
+ <comment><![CDATA[Use the return URLs as filled in at <a href="https://merchants.cardgateplus.com/" target="_blank">merchant back-office</a> instead of the default plugin values.]]></comment>
73
+ <source_model>adminhtml/system_config_source_yesno</source_model>
74
+ <sort_order>50</sort_order>
75
+ <show_in_default>1</show_in_default>
76
+ <show_in_website>1</show_in_website>
77
+ <show_in_store>1</show_in_store>
78
+ </use_backoffice_urls>
79
+ <autocreate_invoice translate="label comment">
80
+ <label>Create invoice after payment</label>
81
+ <frontend_type>select</frontend_type>
82
+ <comment>Automatically create invoices after payment.</comment>
83
+ <source_model>adminhtml/system_config_source_yesno</source_model>
84
+ <sort_order>70</sort_order>
85
+ <show_in_default>1</show_in_default>
86
+ <show_in_website>1</show_in_website>
87
+ <show_in_store>1</show_in_store>
88
+ </autocreate_invoice>
89
+ <mail_invoice translate="label comment">
90
+ <label>Mail invoice to customer</label>
91
+ <frontend_type>select</frontend_type>
92
+ <comment>Automatically mail invoices to a customer.</comment>
93
+ <source_model>adminhtml/system_config_source_yesno</source_model>
94
+ <sort_order>80</sort_order>
95
+ <show_in_default>1</show_in_default>
96
+ <show_in_website>1</show_in_website>
97
+ <show_in_store>1</show_in_store>
98
+ </mail_invoice>
99
+ <notification_email translate="label">
100
+ <label>Notifications recipient</label>
101
+ <frontend_type>select</frontend_type>
102
+ <source_model>adminhtml/system_config_source_email_identity</source_model>
103
+ <sort_order>90</sort_order>
104
+ <show_in_default>1</show_in_default>
105
+ <show_in_website>1</show_in_website>
106
+ <show_in_store>1</show_in_store>
107
+ </notification_email>
108
+ <event_invoicing_failed translate="label">
109
+ <label>Notify on failed invoice creation</label>
110
+ <frontend_type>select</frontend_type>
111
+ <source_model>adminhtml/system_config_source_yesno</source_model>
112
+ <sort_order>100</sort_order>
113
+ <show_in_default>1</show_in_default>
114
+ <show_in_website>1</show_in_website>
115
+ <show_in_store>1</show_in_store>
116
+ </event_invoicing_failed>
117
+ <lang translate="label source_model">
118
+ <label>Gateway language</label>
119
+ <frontend_type>select</frontend_type>
120
+ <comment>Setting a default language interface of the gateway.</comment>
121
+ <source_model>cgp/adminhtml_system_config_source_languages</source_model>
122
+ <sort_order>110</sort_order>
123
+ <show_in_default>1</show_in_default>
124
+ <show_in_website>1</show_in_website>
125
+ <show_in_store>1</show_in_store>
126
+ </lang>
127
+ <order_description translate="label comment">
128
+ <label>Order description</label>
129
+ <frontend_type>text</frontend_type>
130
+ <comment><![CDATA[Payment description that will be shown to the customer in the gateway screen. <br />Variables: <b>%id%</b> = Order ID]]></comment>
131
+ <sort_order>120</sort_order>
132
+ <show_in_default>1</show_in_default>
133
+ <show_in_website>1</show_in_website>
134
+ <show_in_store>1</show_in_store>
135
+ </order_description>
136
+ <initialized_status translate="label">
137
+ <label>Payment in progress status</label>
138
+ <frontend_type>select</frontend_type>
139
+ <source_model>adminhtml/system_config_source_order_status</source_model>
140
+ <sort_order>130</sort_order>
141
+ <show_in_default>1</show_in_default>
142
+ <show_in_website>1</show_in_website>
143
+ <show_in_store>1</show_in_store>
144
+ </initialized_status>
145
+ <complete_status translate="label">
146
+ <label>Payment complete status</label>
147
+ <frontend_type>select</frontend_type>
148
+ <source_model>adminhtml/system_config_source_order_status</source_model>
149
+ <sort_order>140</sort_order>
150
+ <show_in_default>1</show_in_default>
151
+ <show_in_website>1</show_in_website>
152
+ <show_in_store>1</show_in_store>
153
+ </complete_status>
154
+ <failed_status translate="label">
155
+ <label>Payment failed status</label>
156
+ <frontend_type>select</frontend_type>
157
+ <source_model>adminhtml/system_config_source_order_status</source_model>
158
+ <sort_order>150</sort_order>
159
+ <show_in_default>1</show_in_default>
160
+ <show_in_website>1</show_in_website>
161
+ <show_in_store>1</show_in_store>
162
+ </failed_status>
163
+ <fraud_status translate="label">
164
+ <label>Payment fraud status</label>
165
+ <frontend_type>select</frontend_type>
166
+ <source_model>adminhtml/system_config_source_order_status</source_model>
167
+ <sort_order>160</sort_order>
168
+ <show_in_default>1</show_in_default>
169
+ <show_in_website>1</show_in_website>
170
+ <show_in_store>1</show_in_store>
171
+ </fraud_status>
172
+
173
+ <allowspecific translate="label">
174
+ <label>Payment from applicable countries</label>
175
+ <frontend_type>allowspecific</frontend_type>
176
+ <sort_order>200</sort_order>
177
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
178
+ <show_in_default>1</show_in_default>
179
+ <show_in_website>1</show_in_website>
180
+ <show_in_store>1</show_in_store>
181
+ </allowspecific>
182
+ <specificcountry translate="label">
183
+ <label>Payment from Specific countries</label>
184
+ <frontend_type>multiselect</frontend_type>
185
+ <sort_order>210</sort_order>
186
+ <source_model>adminhtml/system_config_source_country</source_model>
187
+ <show_in_default>1</show_in_default>
188
+ <show_in_website>1</show_in_website>
189
+ <show_in_store>1</show_in_store>
190
+ </specificcountry>
191
+ <sort_order translate="label">
192
+ <label>Sort order</label>
193
+ <frontend_type>text</frontend_type>
194
+ <sort_order>220</sort_order>
195
+ <show_in_default>1</show_in_default>
196
+ <show_in_website>1</show_in_website>
197
+ <show_in_store>1</show_in_store>
198
+ </sort_order>
199
+ <debug translate="label comment">
200
+ <label>Debug</label>
201
+ <frontend_type>select</frontend_type>
202
+ <comment>Will log details for debugging purposes in /var/log/cardgateplus.log file.</comment>
203
+ <source_model>adminhtml/system_config_source_yesno</source_model>
204
+ <sort_order>230</sort_order>
205
+ <show_in_default>1</show_in_default>
206
+ <show_in_website>1</show_in_website>
207
+ <show_in_store>1</show_in_store>
208
+ </debug>
209
+ </fields>
210
+ </settings>
211
+
212
+ <cgp_visa translate="label" module="cgp">
213
+ <label>Visa</label>
214
+ <sort_order>200</sort_order>
215
+ <show_in_default>1</show_in_default>
216
+ <show_in_website>1</show_in_website>
217
+ <show_in_store>1</show_in_store>
218
+ <fields>
219
+ <active translate="label">
220
+ <label>Enabled</label>
221
+ <frontend_type>select</frontend_type>
222
+ <source_model>adminhtml/system_config_source_yesno</source_model>
223
+ <sort_order>1</sort_order>
224
+ <show_in_default>1</show_in_default>
225
+ <show_in_website>1</show_in_website>
226
+ <show_in_store>1</show_in_store>
227
+ </active>
228
+ <title translate="label">
229
+ <label>Title</label>
230
+ <frontend_type>text</frontend_type>
231
+ <sort_order>10</sort_order>
232
+ <show_in_default>1</show_in_default>
233
+ <show_in_website>1</show_in_website>
234
+ <show_in_store>1</show_in_store>
235
+ </title>
236
+ <allowspecific translate="label">
237
+ <label>Payment from applicable countries</label>
238
+ <frontend_type>allowspecific</frontend_type>
239
+ <sort_order>20</sort_order>
240
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
241
+ <show_in_default>1</show_in_default>
242
+ <show_in_website>1</show_in_website>
243
+ <show_in_store>1</show_in_store>
244
+ </allowspecific>
245
+ <specificcountry translate="label">
246
+ <label>Payment from Specific countries</label>
247
+ <frontend_type>multiselect</frontend_type>
248
+ <sort_order>30</sort_order>
249
+ <source_model>adminhtml/system_config_source_country</source_model>
250
+ <show_in_default>1</show_in_default>
251
+ <show_in_website>1</show_in_website>
252
+ <show_in_store>1</show_in_store>
253
+ </specificcountry>
254
+ <sort_order translate="label">
255
+ <label>Sort order</label>
256
+ <frontend_type>text</frontend_type>
257
+ <sort_order>100</sort_order>
258
+ <show_in_default>1</show_in_default>
259
+ <show_in_website>1</show_in_website>
260
+ <show_in_store>1</show_in_store>
261
+ </sort_order>
262
+ </fields>
263
+ </cgp_visa>
264
+
265
+ <cgp_mastercard translate="label" module="cgp">
266
+ <label>MasterCard</label>
267
+ <sort_order>210</sort_order>
268
+ <show_in_default>1</show_in_default>
269
+ <show_in_website>1</show_in_website>
270
+ <show_in_store>1</show_in_store>
271
+ <fields>
272
+ <active translate="label">
273
+ <label>Enabled</label>
274
+ <frontend_type>select</frontend_type>
275
+ <source_model>adminhtml/system_config_source_yesno</source_model>
276
+ <sort_order>1</sort_order>
277
+ <show_in_default>1</show_in_default>
278
+ <show_in_website>1</show_in_website>
279
+ <show_in_store>1</show_in_store>
280
+ </active>
281
+ <title translate="label">
282
+ <label>Title</label>
283
+ <frontend_type>text</frontend_type>
284
+ <sort_order>10</sort_order>
285
+ <show_in_default>1</show_in_default>
286
+ <show_in_website>1</show_in_website>
287
+ <show_in_store>1</show_in_store>
288
+ </title>
289
+ <allowspecific translate="label">
290
+ <label>Payment from applicable countries</label>
291
+ <frontend_type>allowspecific</frontend_type>
292
+ <sort_order>20</sort_order>
293
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
294
+ <show_in_default>1</show_in_default>
295
+ <show_in_website>1</show_in_website>
296
+ <show_in_store>1</show_in_store>
297
+ </allowspecific>
298
+ <specificcountry translate="label">
299
+ <label>Payment from Specific countries</label>
300
+ <frontend_type>multiselect</frontend_type>
301
+ <sort_order>30</sort_order>
302
+ <source_model>adminhtml/system_config_source_country</source_model>
303
+ <show_in_default>1</show_in_default>
304
+ <show_in_website>1</show_in_website>
305
+ <show_in_store>1</show_in_store>
306
+ </specificcountry>
307
+ <sort_order translate="label">
308
+ <label>Sort order</label>
309
+ <frontend_type>text</frontend_type>
310
+ <sort_order>100</sort_order>
311
+ <show_in_default>1</show_in_default>
312
+ <show_in_website>1</show_in_website>
313
+ <show_in_store>1</show_in_store>
314
+ </sort_order>
315
+ </fields>
316
+ </cgp_mastercard>
317
+
318
+ <cgp_americanexpress translate="label" module="cgp">
319
+ <label>AmericanExpress</label>
320
+ <sort_order>220</sort_order>
321
+ <show_in_default>1</show_in_default>
322
+ <show_in_website>1</show_in_website>
323
+ <show_in_store>1</show_in_store>
324
+ <fields>
325
+ <active translate="label">
326
+ <label>Enabled</label>
327
+ <frontend_type>select</frontend_type>
328
+ <source_model>adminhtml/system_config_source_yesno</source_model>
329
+ <sort_order>1</sort_order>
330
+ <show_in_default>1</show_in_default>
331
+ <show_in_website>1</show_in_website>
332
+ <show_in_store>1</show_in_store>
333
+ </active>
334
+ <title translate="label">
335
+ <label>Title</label>
336
+ <frontend_type>text</frontend_type>
337
+ <sort_order>10</sort_order>
338
+ <show_in_default>1</show_in_default>
339
+ <show_in_website>1</show_in_website>
340
+ <show_in_store>1</show_in_store>
341
+ </title>
342
+ <allowspecific translate="label">
343
+ <label>Payment from applicable countries</label>
344
+ <frontend_type>allowspecific</frontend_type>
345
+ <sort_order>20</sort_order>
346
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
347
+ <show_in_default>1</show_in_default>
348
+ <show_in_website>1</show_in_website>
349
+ <show_in_store>1</show_in_store>
350
+ </allowspecific>
351
+ <specificcountry translate="label">
352
+ <label>Payment from Specific countries</label>
353
+ <frontend_type>multiselect</frontend_type>
354
+ <sort_order>30</sort_order>
355
+ <source_model>adminhtml/system_config_source_country</source_model>
356
+ <show_in_default>1</show_in_default>
357
+ <show_in_website>1</show_in_website>
358
+ <show_in_store>1</show_in_store>
359
+ </specificcountry>
360
+ <sort_order translate="label">
361
+ <label>Sort order</label>
362
+ <frontend_type>text</frontend_type>
363
+ <sort_order>100</sort_order>
364
+ <show_in_default>1</show_in_default>
365
+ <show_in_website>1</show_in_website>
366
+ <show_in_store>1</show_in_store>
367
+ </sort_order>
368
+ </fields>
369
+ </cgp_americanexpress>
370
+
371
+ <cgp_maestro translate="label" module="cgp">
372
+ <label>Maestro</label>
373
+ <sort_order>230</sort_order>
374
+ <show_in_default>1</show_in_default>
375
+ <show_in_website>1</show_in_website>
376
+ <show_in_store>1</show_in_store>
377
+ <fields>
378
+ <active translate="label">
379
+ <label>Enabled</label>
380
+ <frontend_type>select</frontend_type>
381
+ <source_model>adminhtml/system_config_source_yesno</source_model>
382
+ <sort_order>1</sort_order>
383
+ <show_in_default>1</show_in_default>
384
+ <show_in_website>1</show_in_website>
385
+ <show_in_store>1</show_in_store>
386
+ </active>
387
+ <title translate="label">
388
+ <label>Title</label>
389
+ <frontend_type>text</frontend_type>
390
+ <sort_order>10</sort_order>
391
+ <show_in_default>1</show_in_default>
392
+ <show_in_website>1</show_in_website>
393
+ <show_in_store>1</show_in_store>
394
+ </title>
395
+ <allowspecific translate="label">
396
+ <label>Payment from applicable countries</label>
397
+ <frontend_type>allowspecific</frontend_type>
398
+ <sort_order>20</sort_order>
399
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
400
+ <show_in_default>1</show_in_default>
401
+ <show_in_website>1</show_in_website>
402
+ <show_in_store>1</show_in_store>
403
+ </allowspecific>
404
+ <specificcountry translate="label">
405
+ <label>Payment from Specific countries</label>
406
+ <frontend_type>multiselect</frontend_type>
407
+ <sort_order>30</sort_order>
408
+ <source_model>adminhtml/system_config_source_country</source_model>
409
+ <show_in_default>1</show_in_default>
410
+ <show_in_website>1</show_in_website>
411
+ <show_in_store>1</show_in_store>
412
+ </specificcountry>
413
+ <sort_order translate="label">
414
+ <label>Sort order</label>
415
+ <frontend_type>text</frontend_type>
416
+ <sort_order>100</sort_order>
417
+ <show_in_default>1</show_in_default>
418
+ <show_in_website>1</show_in_website>
419
+ <show_in_store>1</show_in_store>
420
+ </sort_order>
421
+ </fields>
422
+ </cgp_maestro>
423
+
424
+ <cgp_vpay translate="label" module="cgp">
425
+ <label>V-Pay</label>
426
+ <sort_order>232</sort_order>
427
+ <show_in_default>1</show_in_default>
428
+ <show_in_website>1</show_in_website>
429
+ <show_in_store>1</show_in_store>
430
+ <fields>
431
+ <active translate="label">
432
+ <label>Enabled</label>
433
+ <frontend_type>select</frontend_type>
434
+ <source_model>adminhtml/system_config_source_yesno</source_model>
435
+ <sort_order>1</sort_order>
436
+ <show_in_default>1</show_in_default>
437
+ <show_in_website>1</show_in_website>
438
+ <show_in_store>1</show_in_store>
439
+ </active>
440
+ <title translate="label">
441
+ <label>Title</label>
442
+ <frontend_type>text</frontend_type>
443
+ <sort_order>10</sort_order>
444
+ <show_in_default>1</show_in_default>
445
+ <show_in_website>1</show_in_website>
446
+ <show_in_store>1</show_in_store>
447
+ </title>
448
+ <allowspecific translate="label">
449
+ <label>Payment from applicable countries</label>
450
+ <frontend_type>allowspecific</frontend_type>
451
+ <sort_order>20</sort_order>
452
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
453
+ <show_in_default>1</show_in_default>
454
+ <show_in_website>1</show_in_website>
455
+ <show_in_store>1</show_in_store>
456
+ </allowspecific>
457
+ <specificcountry translate="label">
458
+ <label>Payment from Specific countries</label>
459
+ <frontend_type>multiselect</frontend_type>
460
+ <sort_order>30</sort_order>
461
+ <source_model>adminhtml/system_config_source_country</source_model>
462
+ <show_in_default>1</show_in_default>
463
+ <show_in_website>1</show_in_website>
464
+ <show_in_store>1</show_in_store>
465
+ </specificcountry>
466
+ <sort_order translate="label">
467
+ <label>Sort order</label>
468
+ <frontend_type>text</frontend_type>
469
+ <sort_order>100</sort_order>
470
+ <show_in_default>1</show_in_default>
471
+ <show_in_website>1</show_in_website>
472
+ <show_in_store>1</show_in_store>
473
+ </sort_order>
474
+ </fields>
475
+ </cgp_vpay>
476
+
477
+ <cgp_sofortbanking translate="label" module="cgp">
478
+ <label>SofortBanking</label>
479
+ <sort_order>235</sort_order>
480
+ <show_in_default>1</show_in_default>
481
+ <show_in_website>1</show_in_website>
482
+ <show_in_store>1</show_in_store>
483
+ <fields>
484
+ <active translate="label">
485
+ <label>Enabled</label>
486
+ <frontend_type>select</frontend_type>
487
+ <source_model>adminhtml/system_config_source_yesno</source_model>
488
+ <sort_order>1</sort_order>
489
+ <show_in_default>1</show_in_default>
490
+ <show_in_website>1</show_in_website>
491
+ <show_in_store>1</show_in_store>
492
+ </active>
493
+ <title translate="label">
494
+ <label>Title</label>
495
+ <frontend_type>text</frontend_type>
496
+ <sort_order>10</sort_order>
497
+ <show_in_default>1</show_in_default>
498
+ <show_in_website>1</show_in_website>
499
+ <show_in_store>1</show_in_store>
500
+ </title>
501
+ <allowspecific translate="label">
502
+ <label>Payment from applicable countries</label>
503
+ <frontend_type>allowspecific</frontend_type>
504
+ <sort_order>20</sort_order>
505
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
506
+ <show_in_default>1</show_in_default>
507
+ <show_in_website>1</show_in_website>
508
+ <show_in_store>1</show_in_store>
509
+ </allowspecific>
510
+ <specificcountry translate="label">
511
+ <label>Payment from Specific countries</label>
512
+ <frontend_type>multiselect</frontend_type>
513
+ <sort_order>30</sort_order>
514
+ <source_model>adminhtml/system_config_source_country</source_model>
515
+ <show_in_default>1</show_in_default>
516
+ <show_in_website>1</show_in_website>
517
+ <show_in_store>1</show_in_store>
518
+ </specificcountry>
519
+ <sort_order translate="label">
520
+ <label>Sort order</label>
521
+ <frontend_type>text</frontend_type>
522
+ <sort_order>100</sort_order>
523
+ <show_in_default>1</show_in_default>
524
+ <show_in_website>1</show_in_website>
525
+ <show_in_store>1</show_in_store>
526
+ </sort_order>
527
+ </fields>
528
+ </cgp_sofortbanking>
529
+
530
+ <cgp_ideal translate="label" module="cgp">
531
+ <label>iDEAL</label>
532
+ <sort_order>240</sort_order>
533
+ <show_in_default>1</show_in_default>
534
+ <show_in_website>1</show_in_website>
535
+ <show_in_store>1</show_in_store>
536
+ <fields>
537
+ <active translate="label">
538
+ <label>Enabled</label>
539
+ <frontend_type>select</frontend_type>
540
+ <source_model>adminhtml/system_config_source_yesno</source_model>
541
+ <sort_order>1</sort_order>
542
+ <show_in_default>1</show_in_default>
543
+ <show_in_website>1</show_in_website>
544
+ <show_in_store>1</show_in_store>
545
+ </active>
546
+ <title translate="label">
547
+ <label>Title</label>
548
+ <frontend_type>text</frontend_type>
549
+ <sort_order>10</sort_order>
550
+ <show_in_default>1</show_in_default>
551
+ <show_in_website>1</show_in_website>
552
+ <show_in_store>1</show_in_store>
553
+ </title>
554
+ <allowspecific translate="label">
555
+ <label>Payment from applicable countries</label>
556
+ <frontend_type>allowspecific</frontend_type>
557
+ <sort_order>20</sort_order>
558
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
559
+ <show_in_default>1</show_in_default>
560
+ <show_in_website>1</show_in_website>
561
+ <show_in_store>1</show_in_store>
562
+ </allowspecific>
563
+ <specificcountry translate="label">
564
+ <label>Payment from Specific countries</label>
565
+ <frontend_type>multiselect</frontend_type>
566
+ <sort_order>30</sort_order>
567
+ <source_model>adminhtml/system_config_source_country</source_model>
568
+ <show_in_default>1</show_in_default>
569
+ <show_in_website>1</show_in_website>
570
+ <show_in_store>1</show_in_store>
571
+ </specificcountry>
572
+ <sort_order translate="label">
573
+ <label>Sort order</label>
574
+ <frontend_type>text</frontend_type>
575
+ <sort_order>100</sort_order>
576
+ <show_in_default>1</show_in_default>
577
+ <show_in_website>1</show_in_website>
578
+ <show_in_store>1</show_in_store>
579
+ </sort_order>
580
+ </fields>
581
+ </cgp_ideal>
582
+
583
+ <cgp_mistercash translate="label" module="cgp">
584
+ <label>MisterCash</label>
585
+ <sort_order>250</sort_order>
586
+ <show_in_default>1</show_in_default>
587
+ <show_in_website>1</show_in_website>
588
+ <show_in_store>1</show_in_store>
589
+ <fields>
590
+ <active translate="label">
591
+ <label>Enabled</label>
592
+ <frontend_type>select</frontend_type>
593
+ <source_model>adminhtml/system_config_source_yesno</source_model>
594
+ <sort_order>1</sort_order>
595
+ <show_in_default>1</show_in_default>
596
+ <show_in_website>1</show_in_website>
597
+ <show_in_store>1</show_in_store>
598
+ </active>
599
+ <title translate="label">
600
+ <label>Title</label>
601
+ <frontend_type>text</frontend_type>
602
+ <sort_order>10</sort_order>
603
+ <show_in_default>1</show_in_default>
604
+ <show_in_website>1</show_in_website>
605
+ <show_in_store>1</show_in_store>
606
+ </title>
607
+ <allowspecific translate="label">
608
+ <label>Payment from applicable countries</label>
609
+ <frontend_type>allowspecific</frontend_type>
610
+ <sort_order>20</sort_order>
611
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
612
+ <show_in_default>1</show_in_default>
613
+ <show_in_website>1</show_in_website>
614
+ <show_in_store>1</show_in_store>
615
+ </allowspecific>
616
+ <specificcountry translate="label">
617
+ <label>Payment from Specific countries</label>
618
+ <frontend_type>multiselect</frontend_type>
619
+ <sort_order>30</sort_order>
620
+ <source_model>adminhtml/system_config_source_country</source_model>
621
+ <show_in_default>1</show_in_default>
622
+ <show_in_website>1</show_in_website>
623
+ <show_in_store>1</show_in_store>
624
+ </specificcountry>
625
+ <sort_order translate="label">
626
+ <label>Sort order</label>
627
+ <frontend_type>text</frontend_type>
628
+ <sort_order>100</sort_order>
629
+ <show_in_default>1</show_in_default>
630
+ <show_in_website>1</show_in_website>
631
+ <show_in_store>1</show_in_store>
632
+ </sort_order>
633
+ </fields>
634
+ </cgp_mistercash>
635
+
636
+ <cgp_paypal translate="label" module="cgp">
637
+ <label>PayPal</label>
638
+ <sort_order>260</sort_order>
639
+ <show_in_default>1</show_in_default>
640
+ <show_in_website>1</show_in_website>
641
+ <show_in_store>1</show_in_store>
642
+ <fields>
643
+ <active translate="label">
644
+ <label>Enabled</label>
645
+ <frontend_type>select</frontend_type>
646
+ <source_model>adminhtml/system_config_source_yesno</source_model>
647
+ <sort_order>1</sort_order>
648
+ <show_in_default>1</show_in_default>
649
+ <show_in_website>1</show_in_website>
650
+ <show_in_store>1</show_in_store>
651
+ </active>
652
+ <title translate="label">
653
+ <label>Title</label>
654
+ <frontend_type>text</frontend_type>
655
+ <sort_order>10</sort_order>
656
+ <show_in_default>1</show_in_default>
657
+ <show_in_website>1</show_in_website>
658
+ <show_in_store>1</show_in_store>
659
+ </title>
660
+ <allowspecific translate="label">
661
+ <label>Payment from applicable countries</label>
662
+ <frontend_type>allowspecific</frontend_type>
663
+ <sort_order>20</sort_order>
664
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
665
+ <show_in_default>1</show_in_default>
666
+ <show_in_website>1</show_in_website>
667
+ <show_in_store>1</show_in_store>
668
+ </allowspecific>
669
+ <specificcountry translate="label">
670
+ <label>Payment from Specific countries</label>
671
+ <frontend_type>multiselect</frontend_type>
672
+ <sort_order>30</sort_order>
673
+ <source_model>adminhtml/system_config_source_country</source_model>
674
+ <show_in_default>1</show_in_default>
675
+ <show_in_website>1</show_in_website>
676
+ <show_in_store>1</show_in_store>
677
+ </specificcountry>
678
+ <sort_order translate="label">
679
+ <label>Sort order</label>
680
+ <frontend_type>text</frontend_type>
681
+ <sort_order>100</sort_order>
682
+ <show_in_default>1</show_in_default>
683
+ <show_in_website>1</show_in_website>
684
+ <show_in_store>1</show_in_store>
685
+ </sort_order>
686
+ </fields>
687
+ </cgp_paypal>
688
+
689
+ <cgp_webmoney translate="label" module="cgp">
690
+ <label>Webmoney</label>
691
+ <sort_order>270</sort_order>
692
+ <show_in_default>1</show_in_default>
693
+ <show_in_website>1</show_in_website>
694
+ <show_in_store>1</show_in_store>
695
+ <fields>
696
+ <active translate="label">
697
+ <label>Enabled</label>
698
+ <frontend_type>select</frontend_type>
699
+ <source_model>adminhtml/system_config_source_yesno</source_model>
700
+ <sort_order>1</sort_order>
701
+ <show_in_default>1</show_in_default>
702
+ <show_in_website>1</show_in_website>
703
+ <show_in_store>1</show_in_store>
704
+ </active>
705
+ <title translate="label">
706
+ <label>Title</label>
707
+ <frontend_type>text</frontend_type>
708
+ <sort_order>10</sort_order>
709
+ <show_in_default>1</show_in_default>
710
+ <show_in_website>1</show_in_website>
711
+ <show_in_store>1</show_in_store>
712
+ </title>
713
+ <allowspecific translate="label">
714
+ <label>Payment from applicable countries</label>
715
+ <frontend_type>allowspecific</frontend_type>
716
+ <sort_order>20</sort_order>
717
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
718
+ <show_in_default>1</show_in_default>
719
+ <show_in_website>1</show_in_website>
720
+ <show_in_store>1</show_in_store>
721
+ </allowspecific>
722
+ <specificcountry translate="label">
723
+ <label>Payment from Specific countries</label>
724
+ <frontend_type>multiselect</frontend_type>
725
+ <sort_order>30</sort_order>
726
+ <source_model>adminhtml/system_config_source_country</source_model>
727
+ <show_in_default>1</show_in_default>
728
+ <show_in_website>1</show_in_website>
729
+ <show_in_store>1</show_in_store>
730
+ </specificcountry>
731
+ <sort_order translate="label">
732
+ <label>Sort order</label>
733
+ <frontend_type>text</frontend_type>
734
+ <sort_order>100</sort_order>
735
+ <show_in_default>1</show_in_default>
736
+ <show_in_website>1</show_in_website>
737
+ <show_in_store>1</show_in_store>
738
+ </sort_order>
739
+ </fields>
740
+ </cgp_webmoney>
741
+
742
+ <cgp_klarna translate="label" module="cgp">
743
+ <label>Klarna Invoice</label>
744
+ <sort_order>280</sort_order>
745
+ <show_in_default>1</show_in_default>
746
+ <show_in_website>1</show_in_website>
747
+ <show_in_store>1</show_in_store>
748
+ <fields>
749
+ <active translate="label">
750
+ <label>Enabled</label>
751
+ <frontend_type>select</frontend_type>
752
+ <source_model>adminhtml/system_config_source_yesno</source_model>
753
+ <sort_order>1</sort_order>
754
+ <show_in_default>1</show_in_default>
755
+ <show_in_website>1</show_in_website>
756
+ <show_in_store>1</show_in_store>
757
+ </active>
758
+ <title translate="label">
759
+ <label>Title</label>
760
+ <frontend_type>text</frontend_type>
761
+ <sort_order>10</sort_order>
762
+ <show_in_default>1</show_in_default>
763
+ <show_in_website>1</show_in_website>
764
+ <show_in_store>1</show_in_store>
765
+ </title>
766
+ <klarna_eid translate="label">
767
+ <label>Your Klarna EID</label>
768
+ <frontend_type>text</frontend_type>
769
+ <sort_order>20</sort_order>
770
+ <show_in_default>1</show_in_default>
771
+ <show_in_website>1</show_in_website>
772
+ <show_in_store>1</show_in_store>
773
+ </klarna_eid>
774
+ <klarna_invoice_fee_ex translate="label">
775
+ <label>Invoice Fee (excl. VAT)</label>
776
+ <frontend_type>text</frontend_type>
777
+ <sort_order>30</sort_order>
778
+ <show_in_default>1</show_in_default>
779
+ <show_in_website>1</show_in_website>
780
+ <show_in_store>1</show_in_store>
781
+ </klarna_invoice_fee_ex>
782
+ <allowspecific translate="label">
783
+ <label>Payment from applicable countries</label>
784
+ <frontend_type>allowspecific</frontend_type>
785
+ <sort_order>50</sort_order>
786
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
787
+ <show_in_default>1</show_in_default>
788
+ <show_in_website>1</show_in_website>
789
+ <show_in_store>1</show_in_store>
790
+ </allowspecific>
791
+ <specificcountry translate="label">
792
+ <label>Payment from Specific countries</label>
793
+ <frontend_type>multiselect</frontend_type>
794
+ <sort_order>60</sort_order>
795
+ <source_model>adminhtml/system_config_source_country</source_model>
796
+ <show_in_default>1</show_in_default>
797
+ <show_in_website>1</show_in_website>
798
+ <show_in_store>1</show_in_store>
799
+ </specificcountry>
800
+ <sort_order translate="label">
801
+ <label>Sort order</label>
802
+ <frontend_type>text</frontend_type>
803
+ <sort_order>100</sort_order>
804
+ <show_in_default>1</show_in_default>
805
+ <show_in_website>1</show_in_website>
806
+ <show_in_store>1</show_in_store>
807
+ </sort_order>
808
+ </fields>
809
+ </cgp_klarna>
810
+
811
+ <cgp_klarnaaccount translate="label" module="cgp">
812
+ <label>KlarnaAccount</label>
813
+ <sort_order>290</sort_order>
814
+ <show_in_default>1</show_in_default>
815
+ <show_in_website>1</show_in_website>
816
+ <show_in_store>1</show_in_store>
817
+ <fields>
818
+ <active translate="label">
819
+ <label>Enabled</label>
820
+ <frontend_type>select</frontend_type>
821
+ <source_model>adminhtml/system_config_source_yesno</source_model>
822
+ <sort_order>1</sort_order>
823
+ <show_in_default>1</show_in_default>
824
+ <show_in_website>1</show_in_website>
825
+ <show_in_store>1</show_in_store>
826
+ </active>
827
+ <title translate="label">
828
+ <label>Title</label>
829
+ <frontend_type>text</frontend_type>
830
+ <sort_order>10</sort_order>
831
+ <show_in_default>1</show_in_default>
832
+ <show_in_website>1</show_in_website>
833
+ <show_in_store>1</show_in_store>
834
+ </title>
835
+ <klarna_eid translate="label">
836
+ <label>Your Klarna EID</label>
837
+ <frontend_type>text</frontend_type>
838
+ <sort_order>20</sort_order>
839
+ <show_in_default>1</show_in_default>
840
+ <show_in_website>1</show_in_website>
841
+ <show_in_store>1</show_in_store>
842
+ </klarna_eid>
843
+ <allowspecific translate="label">
844
+ <label>Payment from applicable countries</label>
845
+ <frontend_type>allowspecific</frontend_type>
846
+ <sort_order>30</sort_order>
847
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
848
+ <show_in_default>1</show_in_default>
849
+ <show_in_website>1</show_in_website>
850
+ <show_in_store>1</show_in_store>
851
+ </allowspecific>
852
+ <specificcountry translate="label">
853
+ <label>Payment from Specific countries</label>
854
+ <frontend_type>multiselect</frontend_type>
855
+ <sort_order>40</sort_order>
856
+ <source_model>adminhtml/system_config_source_country</source_model>
857
+ <show_in_default>1</show_in_default>
858
+ <show_in_website>1</show_in_website>
859
+ <show_in_store>1</show_in_store>
860
+ </specificcountry>
861
+ <sort_order translate="label">
862
+ <label>Sort order</label>
863
+ <frontend_type>text</frontend_type>
864
+ <sort_order>100</sort_order>
865
+ <show_in_default>1</show_in_default>
866
+ <show_in_website>1</show_in_website>
867
+ <show_in_store>1</show_in_store>
868
+ </sort_order>
869
+ </fields>
870
+ </cgp_klarnaaccount>
871
+
872
+ <cgp_giropay translate="label" module="cgp">
873
+ <label>Giropay</label>
874
+ <sort_order>300</sort_order>
875
+ <show_in_default>1</show_in_default>
876
+ <show_in_website>1</show_in_website>
877
+ <show_in_store>1</show_in_store>
878
+ <fields>
879
+ <active translate="label">
880
+ <label>Enabled</label>
881
+ <frontend_type>select</frontend_type>
882
+ <source_model>adminhtml/system_config_source_yesno</source_model>
883
+ <sort_order>1</sort_order>
884
+ <show_in_default>1</show_in_default>
885
+ <show_in_website>1</show_in_website>
886
+ <show_in_store>1</show_in_store>
887
+ </active>
888
+ <title translate="label">
889
+ <label>Title</label>
890
+ <frontend_type>text</frontend_type>
891
+ <sort_order>10</sort_order>
892
+ <show_in_default>1</show_in_default>
893
+ <show_in_website>1</show_in_website>
894
+ <show_in_store>1</show_in_store>
895
+ </title>
896
+ <allowspecific translate="label">
897
+ <label>Payment from applicable countries</label>
898
+ <frontend_type>allowspecific</frontend_type>
899
+ <sort_order>20</sort_order>
900
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
901
+ <show_in_default>1</show_in_default>
902
+ <show_in_website>1</show_in_website>
903
+ <show_in_store>1</show_in_store>
904
+ </allowspecific>
905
+ <specificcountry translate="label">
906
+ <label>Payment from Specific countries</label>
907
+ <frontend_type>multiselect</frontend_type>
908
+ <sort_order>30</sort_order>
909
+ <source_model>adminhtml/system_config_source_country</source_model>
910
+ <show_in_default>1</show_in_default>
911
+ <show_in_website>1</show_in_website>
912
+ <show_in_store>1</show_in_store>
913
+ </specificcountry>
914
+ <sort_order translate="label">
915
+ <label>Sort order</label>
916
+ <frontend_type>text</frontend_type>
917
+ <sort_order>100</sort_order>
918
+ <show_in_default>1</show_in_default>
919
+ <show_in_website>1</show_in_website>
920
+ <show_in_store>1</show_in_store>
921
+ </sort_order>
922
+ </fields>
923
+ </cgp_giropay>
924
+ <cgp_banktransfer translate="label" module="cgp">
925
+ <label>Bank Transfer</label>
926
+ <sort_order>310</sort_order>
927
+ <show_in_default>1</show_in_default>
928
+ <show_in_website>1</show_in_website>
929
+ <show_in_store>1</show_in_store>
930
+ <fields>
931
+ <active translate="label">
932
+ <label>Enabled</label>
933
+ <frontend_type>select</frontend_type>
934
+ <source_model>adminhtml/system_config_source_yesno</source_model>
935
+ <sort_order>1</sort_order>
936
+ <show_in_default>1</show_in_default>
937
+ <show_in_website>1</show_in_website>
938
+ <show_in_store>1</show_in_store>
939
+ </active>
940
+ <title translate="label">
941
+ <label>Title</label>
942
+ <frontend_type>text</frontend_type>
943
+ <sort_order>10</sort_order>
944
+ <show_in_default>1</show_in_default>
945
+ <show_in_website>1</show_in_website>
946
+ <show_in_store>1</show_in_store>
947
+ </title>
948
+ <allowspecific translate="label">
949
+ <label>Payment from applicable countries</label>
950
+ <frontend_type>allowspecific</frontend_type>
951
+ <sort_order>20</sort_order>
952
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
953
+ <show_in_default>1</show_in_default>
954
+ <show_in_website>1</show_in_website>
955
+ <show_in_store>1</show_in_store>
956
+ </allowspecific>
957
+ <specificcountry translate="label">
958
+ <label>Payment from Specific countries</label>
959
+ <frontend_type>multiselect</frontend_type>
960
+ <sort_order>30</sort_order>
961
+ <source_model>adminhtml/system_config_source_country</source_model>
962
+ <show_in_default>1</show_in_default>
963
+ <show_in_website>1</show_in_website>
964
+ <show_in_store>1</show_in_store>
965
+ </specificcountry>
966
+ <sort_order translate="label">
967
+ <label>Sort order</label>
968
+ <frontend_type>text</frontend_type>
969
+ <sort_order>100</sort_order>
970
+ <show_in_default>1</show_in_default>
971
+ <show_in_website>1</show_in_website>
972
+ <show_in_store>1</show_in_store>
973
+ </sort_order>
974
+ </fields>
975
+ </cgp_banktransfer>
976
+
977
+ <cgp_directdebit translate="label" module="cgp">
978
+ <label>Direct Debit</label>
979
+ <sort_order>320</sort_order>
980
+ <show_in_default>1</show_in_default>
981
+ <show_in_website>1</show_in_website>
982
+ <show_in_store>1</show_in_store>
983
+ <fields>
984
+ <active translate="label">
985
+ <label>Enabled</label>
986
+ <frontend_type>select</frontend_type>
987
+ <source_model>adminhtml/system_config_source_yesno</source_model>
988
+ <sort_order>1</sort_order>
989
+ <show_in_default>1</show_in_default>
990
+ <show_in_website>1</show_in_website>
991
+ <show_in_store>1</show_in_store>
992
+ </active>
993
+ <title translate="label">
994
+ <label>Title</label>
995
+ <frontend_type>text</frontend_type>
996
+ <sort_order>10</sort_order>
997
+ <show_in_default>1</show_in_default>
998
+ <show_in_website>1</show_in_website>
999
+ <show_in_store>1</show_in_store>
1000
+ </title>
1001
+ <allowspecific translate="label">
1002
+ <label>Payment from applicable countries</label>
1003
+ <frontend_type>allowspecific</frontend_type>
1004
+ <sort_order>20</sort_order>
1005
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
1006
+ <show_in_default>1</show_in_default>
1007
+ <show_in_website>1</show_in_website>
1008
+ <show_in_store>1</show_in_store>
1009
+ </allowspecific>
1010
+ <specificcountry translate="label">
1011
+ <label>Payment from Specific countries</label>
1012
+ <frontend_type>multiselect</frontend_type>
1013
+ <sort_order>30</sort_order>
1014
+ <source_model>adminhtml/system_config_source_country</source_model>
1015
+ <show_in_default>1</show_in_default>
1016
+ <show_in_website>1</show_in_website>
1017
+ <show_in_store>1</show_in_store>
1018
+ </specificcountry>
1019
+ <sort_order translate="label">
1020
+ <label>Sort order</label>
1021
+ <frontend_type>text</frontend_type>
1022
+ <sort_order>100</sort_order>
1023
+ <show_in_default>1</show_in_default>
1024
+ <show_in_website>1</show_in_website>
1025
+ <show_in_store>1</show_in_store>
1026
+ </sort_order>
1027
+ </fields>
1028
+ </cgp_directdebit>
1029
+ <cgp_przelewy24 translate="label" module="cgp">
1030
+ <label>Przelewy24</label>
1031
+ <sort_order>320</sort_order>
1032
+ <show_in_default>1</show_in_default>
1033
+ <show_in_website>1</show_in_website>
1034
+ <show_in_store>1</show_in_store>
1035
+ <fields>
1036
+ <active translate="label">
1037
+ <label>Enabled</label>
1038
+ <frontend_type>select</frontend_type>
1039
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1040
+ <sort_order>1</sort_order>
1041
+ <show_in_default>1</show_in_default>
1042
+ <show_in_website>1</show_in_website>
1043
+ <show_in_store>1</show_in_store>
1044
+ </active>
1045
+ <title translate="label">
1046
+ <label>Title</label>
1047
+ <frontend_type>text</frontend_type>
1048
+ <sort_order>10</sort_order>
1049
+ <show_in_default>1</show_in_default>
1050
+ <show_in_website>1</show_in_website>
1051
+ <show_in_store>1</show_in_store>
1052
+ </title>
1053
+ <allowspecific translate="label">
1054
+ <label>Payment from applicable countries</label>
1055
+ <frontend_type>allowspecific</frontend_type>
1056
+ <sort_order>20</sort_order>
1057
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
1058
+ <show_in_default>1</show_in_default>
1059
+ <show_in_website>1</show_in_website>
1060
+ <show_in_store>1</show_in_store>
1061
+ </allowspecific>
1062
+ <specificcountry translate="label">
1063
+ <label>Payment from Specific countries</label>
1064
+ <frontend_type>multiselect</frontend_type>
1065
+ <sort_order>30</sort_order>
1066
+ <source_model>adminhtml/system_config_source_country</source_model>
1067
+ <show_in_default>1</show_in_default>
1068
+ <show_in_website>1</show_in_website>
1069
+ <show_in_store>1</show_in_store>
1070
+ </specificcountry>
1071
+ <sort_order translate="label">
1072
+ <label>Sort order</label>
1073
+ <frontend_type>text</frontend_type>
1074
+ <sort_order>100</sort_order>
1075
+ <show_in_default>1</show_in_default>
1076
+ <show_in_website>1</show_in_website>
1077
+ <show_in_store>1</show_in_store>
1078
+ </sort_order>
1079
+ </fields>
1080
+ </cgp_przelewy24>
1081
+ </groups>
1082
+ </cgp>
1083
+ </sections>
1084
+ </config>
app/design/frontend/base/default/template/cardgate/cgp/form/ideal.phtml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento CardGatePlus payment extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Mage
13
+ * @package CardGate_Payment
14
+ * @author Paul Saparov, <support@cardgate.com>
15
+ * @copyright Copyright (c) 2011 CardGatePlus B.V. (http://www.cardgateplus.com)
16
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
+ */
18
+ ?>
19
+ <?php $_code=$this->getMethodCode() ?>
20
+ <ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
21
+ <li>
22
+ <div class="input-box">
23
+ <?php echo $this->getSelectField(); ?>
24
+ </div>
25
+ </li>
26
+ </ul>
app/design/frontend/base/default/template/cardgate/cgp/form/klarna.phtml ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento CardGatePlus payment extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Mage
13
+ * @package CardGate_Payment
14
+ * @author Paul Saparov, <support@cardgate.com>
15
+ * @copyright Copyright (c) 2011 CardGatePlus B.V. (http://www.cardgateplus.com)
16
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
+ */
18
+ ?>
19
+ <?php $_code = $this->getMethodCode() ?>
20
+ <ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
21
+ <li>
22
+ <div style="border:1px solid #7ba7c9;min-width:110px;width:100%;max-width:800px;background-color:#fff;display:inline-block;padding:3px;">
23
+ <div style="float:left;margin-left:5px;margin-top:5px;margin-bottom:5px;">
24
+ <img src='<?php echo $this->getKlarnaLogoUrl(); ?>'><br>
25
+ <div id="invoice02"></div>
26
+ <br>
27
+
28
+ <?php echo $this->beginIsEu(); ?>
29
+
30
+ <label><?php echo $this->getGenderLabel(); ?></label><br>
31
+ <div class="v-fix" >
32
+ <input
33
+ type="radio"
34
+ name="payment[cgp][klarna-gender]"
35
+ value="m"
36
+ id="id_cgp_klarna_gender_male"
37
+ />
38
+ <label style="float: none;" for="id_cgp_klarna_gender_male">
39
+ <?php echo $this->getMaleLabel(); ?>
40
+ </label>
41
+ &nbsp;&nbsp;
42
+ <input
43
+ type="radio"
44
+ name="payment[cgp][klarna-gender]"
45
+ value="f"
46
+ id="id_cgp_klarna_gender_female"
47
+ class="validate-one-required"
48
+ />
49
+ <label style="float: none;" for="id_cgp_klarna_gender_female">
50
+ <?php echo $this->getFemaleLabel(); ?>
51
+ </label>
52
+ </div><br>
53
+ <div style="float:left;margin-top:5px;">
54
+ <label><?php echo $this->getBirthdayLabel(); ?></label><br>
55
+ <div class="v-fix" >
56
+ <select name="payment[cgp][klarna-dob_day]" class="validate-select" style="width:50px;">
57
+ <?php echo $this->getDay(); ?>
58
+ </select>
59
+ </div>
60
+ <div class="v-fix" style="padding-left:6px;">
61
+ <select name="payment[cgp][klarna-dob_month]" class="validate-select" style="width:80px;">
62
+ <?php echo $this->getMonth(); ?>
63
+ </select>
64
+ </div>
65
+ <div class="v-fix" style="padding-left:7px;">
66
+ <select name="payment[cgp][klarna-dob_year]" class="validate-select" style="width:80px;">
67
+ <?php echo $this->getYear(); ?>
68
+ </select>
69
+ </div>
70
+ </div>
71
+ <br><br><br>
72
+
73
+ <?php echo $this->endIsEu(); ?>
74
+ <?php echo $this->beginIsNotEu(); ?>
75
+ <div style="float:left;margin-top:5px;">
76
+ <label><?php echo $this->getPersonalNumberLabel(); ?></label><br>
77
+ <input name="payment[cgp][klarna-personal-number]" class="required-entry" style="width:100px;">
78
+ </div><br><br>
79
+ <?php echo $this->endIsNotEu(); ?>
80
+
81
+ <div style="float:left;margin-top:0px;">
82
+ <label><?php echo $this->getLanguageLabel(); ?></label><br>
83
+ <select name="payment[cgp][klarna-language]" class="validate-select" style="width:100px;">
84
+ <?php echo $this->getLanguage(); ?>
85
+ </select>
86
+ </div>
87
+ <br>
88
+ <?php echo $this->getGermanNotice(); ?>
89
+ <?php echo $this->getInvoiceFeeNotice(); ?>
90
+ </div>
91
+ </div>
92
+
93
+ <script src="https://cdn.klarna.com/public/kitt/core/v1.0/js/klarna.min.js"></script>
94
+ <script src="https://cdn.klarna.com/public/kitt/toc/v1.1/js/klarna.terms.min.js"></script>
95
+ <script>
96
+ <?php
97
+ echo $this->getKlarnaInvoiceTerms();
98
+ echo $this->getKlarnaConsent();
99
+ ?>
100
+ </script>
101
+ </li>
102
+ </ul>
app/design/frontend/base/default/template/cardgate/cgp/form/klarnaaccount.phtml ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento CardGatePlus payment extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Mage
13
+ * @package CardGate_Payment
14
+ * @author Paul Saparov, <support@cardgate.com>
15
+ * @copyright Copyright (c) 2011 CardGatePlus B.V. (http://www.cardgateplus.com)
16
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
+ */
18
+ ?>
19
+ <?php $_code = $this->getMethodCode() ?>
20
+ <ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
21
+ <li>
22
+ <div style="border:1px solid #7ba7c9;min-width:110px;width:100%;max-width:800px;background-color:#fff;display:inline-block;padding:3px;">
23
+ <div style="float:left;margin-left:5px;margin-top:5px;margin-bottom:5px;">
24
+ <img src='<?php echo $this->getKlarnaAccountLogoUrl(); ?>'><br>
25
+ <div id="account01"></div>
26
+ <br>
27
+
28
+ <?php echo $this->beginIsEu(); ?>
29
+
30
+ <label><?php echo $this->getGenderLabel(); ?></label><br>
31
+ <div class="v-fix" >
32
+ <input
33
+ type="radio"
34
+ name="payment[cgp][klarna-account-gender]"
35
+ value="m"
36
+ id="id_cgp_klarna_account_gender_male"
37
+ />
38
+ <label style="float: none;" for="id_cgp_klarna_account_gender_male">
39
+ <?php echo $this->getMaleLabel(); ?>
40
+ </label>
41
+ &nbsp;&nbsp;
42
+ <input
43
+ type="radio"
44
+ name="payment[cgp][klarna-account-gender]"
45
+ value="f"
46
+ id="id_cgp_klarna_account_gender_female"
47
+ class="validate-one-required"
48
+ />
49
+ <label style="float: none;" for="id_cgp_klarna_account_gender_female">
50
+ <?php echo $this->getFemaleLabel(); ?>
51
+ </label>
52
+ </div><br>
53
+ <div style="float:left;margin-top:5px;">
54
+ <label><?php echo $this->getBirthdayLabel(); ?></label><br>
55
+ <div class="v-fix" >
56
+ <select name="payment[cgp][klarna-account-dob_day]" class="validate-select" style="width:50px;">
57
+ <?php echo $this->getDay(); ?>
58
+ </select>
59
+ </div>
60
+ <div class="v-fix" style="padding-left:6px;">
61
+ <select name="payment[cgp][klarna-account-dob_month]" class="validate-select" style="width:80px;">
62
+ <?php echo $this->getMonth(); ?>
63
+ </select>
64
+ </div>
65
+ <div class="v-fix" style="padding-left:7px;">
66
+ <select name="payment[cgp][klarna-account-dob_year]" class="validate-select" style="width:80px;">
67
+ <?php echo $this->getYear(); ?>
68
+ </select>
69
+ </div>
70
+ </div>
71
+ <br><br><br>
72
+
73
+ <?php echo $this->endIsEu(); ?>
74
+ <?php echo $this->beginIsNotEu(); ?>
75
+ <div style="float:left;margin-top:5px;">
76
+ <label><?php echo $this->getPersonalNumberLabel(); ?></label><br>
77
+ <input name="payment[cgp][klarna-account-personal-number]" class="required-entry" style="width:100px;">
78
+ </div><br><br>
79
+ <?php echo $this->endIsNotEu(); ?>
80
+
81
+ <div style="float:left;margin-top:0px;">
82
+ <label><?php echo $this->getLanguageLabel(); ?></label><br>
83
+ <select name="payment[cgp][klarna-account-language]" class="validate-select" style="width:100px;">
84
+ <?php echo $this->getLanguage(); ?>
85
+ </select>
86
+ </div>
87
+ <br>
88
+ <?php echo $this->getGermanNotice(); ?>
89
+ </div>
90
+ </div>
91
+ <script src="https://cdn.klarna.com/public/kitt/core/v1.0/js/klarna.min.js"></script>
92
+ <script src="https://cdn.klarna.com/public/kitt/toc/v1.1/js/klarna.terms.min.js"></script>
93
+ <script>
94
+ <?php
95
+ echo $this->getKlarnaAccountTerms();
96
+ echo $this->getKlarnaAccountConsent();
97
+ ?>
98
+ </script>
99
+ </li>
100
+ </ul>
app/design/frontend/base/default/template/cardgate/cgp/redirect.phtml ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ $session = Mage::getSingleton('checkout/session');
4
+ if ($session->getCgpOnestepCheckout() == true) {
5
+ $url = Mage::getUrl('cgp/standard/cancel/', array('_secure' => true));
6
+ header("Location: $url");
7
+ exit();
8
+ }
9
+ $session->setCgpOnestepQuoteId($session->getCardgateQuoteId());
10
+ $session->setCgpOnestepCheckout(true);
11
+ */
12
+ ?>
13
+ <?php echo Mage::helper('cgp')->__('You will be redirected to finish your payment.'); ?>
14
+ <?php echo $this->getForm(); ?>
15
+ <script type="text/javascript">document.getElementById("cardgateplus_checkout").submit();</script>
app/etc/modules/Cardgate_Cgp.xml ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ /**
4
+ * Magento CardGatePlus payment extension
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
+ *
13
+ * @category Mage
14
+ * @package CardGate_Cgp
15
+ * @author Paul Saparov, <support@cardgate.com>
16
+ * @copyright Copyright (c) 2011 CardGatePlus B.V. (http://www.cardgateplus.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+ -->
20
+ <config>
21
+ <modules>
22
+ <Cardgate_Cgp>
23
+ <active>true</active>
24
+ <codePool>local</codePool>
25
+ <depends>
26
+ <Mage_Payment />
27
+ </depends>
28
+ </Cardgate_Cgp>
29
+ </modules>
30
+ </config>
app/locale/nl_NL/Cardgate_Cgp.csv ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Dutch","Nederlands"
2
+ "English","Engels"
3
+ "German","Duits"
4
+ "French","Frans"
5
+ "Spanish","Spaans"
6
+ "Greek","Grieks"
7
+ "Croatian","Kroatisch"
8
+ "Italian","Italiaans"
9
+ "Czech","Tsjechisch"
10
+ "Russian","Russisch"
11
+ "Swedish","Zweeds"
12
+ "<strong>Note:</strong> Don't forget to set-up in the <a href="https://merchants.cardgateplus.com/" target="_blank">Merchant Backoffice</a> a Control URL to "http://www.yourdomain.com/cgp/standard/control/".","<strong>Let op!</strong> Vergeet niet uw 'Control URL (http://www.yourdomain.com/cgp/standard/control/)' op te geven in de <a href="https://merchants.cardgateplus.com/" target="_blank">Merchant Backoffice</a>."
13
+ "Test Mode","Test modus"
14
+ "Live Mode","Live modus"
15
+ "Test/Live Mode","Test/Live modus"
16
+ "Switching between test and live mode. If you don't have an account <a href='http://www.cardgate.com/' target='_blank'>sign up here</a>.","Schakelen tussen test en live modus. Als u nog geen account heeft, kunt u zich <a href='http://www.cardgate.com/r/magento/' target='_blank'>hier aanmelden</a>."
17
+ "Site ID","Site ID"
18
+ "Fill in you site ID number. You can find your site ID number at <a href=https://merchants.cardgateplus.com/" target="_blank">merchant backoffice</a>.","Vul hier uw site ID in. Dit nummer kunt u vinden in de <a href=https://merchants.cardgateplus.com/" target="_blank">merchant backoffice</a>."
19
+ "Hash Key","Codeer Sleutel"
20
+ "Fill in you secret hash key for the site. You can create your hash key code at <a href=https://merchants.cardgateplus.com/" target="_blank">merchant backoffice</a>.","Vul hier uw codeer sleutel in. Deze kunt u aanmaken in de <a href=https://merchants.cardgateplus.com/" target="_blank">merchant backoffice</a>."
21
+ "Use back-office URLs","Gebruik back-office URLs"
22
+ "Use the return URLs as filled in at <a href="https://merchants.cardgateplus.com/" target="_blank">merchant back-office</a> instead of the default plugin values.","Gebruik de return URLs, zoals door u aangemaakt in de <a href=https://merchants.cardgateplus.com/" target="_blank">merchant back-office</a> i.p.v. de standaard plugin waarden."
23
+ "Create invoice after payment","Maak een factuur aan na betaling"
24
+ "Automatically create invoices after payment.","Maak automatisch een factuur aan na betaling."
25
+ "Mail invoice to customer","Email factuur aan klant"
26
+ "Gateway language","Taal betaalpagina"
27
+ "Setting a default language interface of the gateway.","Stel een standaard taal in voor de betaal pagina"
28
+ "Order description","Order omschrijving"
29
+ "Payment description that will be shown to the customer in the gateway screen. <br />Variables: <b>%id%</b> = Order ID","Omschrijving welke getoond wordt op de betaalpagina. <br />Variabele: <b>%id%</b> = Order ID"
30
+ "Payment in progress status","Betaling aan de gang status"
31
+ "Payment complete status","Betaling compleet status"
32
+ "Payment failed status","Betaling mislukt status"
33
+ "Payment fraud status","Fraude status"
34
+ "Payment from applicable countries","Betaling toegestaan vanuit"
35
+ "Payment from Specific countries","Betaling vanuit specifieke landen"
36
+ "Sort order","Volgorde"
37
+ "Debug","Debug"
38
+ "Will log details for debugging purposes in var/log/cardgateplus.log file.","Dit zal debug gegevens loggen in het bestand var/log/cardgateplus.log"
39
+ "Enabled","Ingeschakeld"
40
+ "Title","Titel"
41
+ "You will be redirected to finish your payment.","U zult worden doorgelinkt om uw betaling af te ronden."
42
+ "Selected currency code ","Geselecteerde valuta code "
43
+ " is not compatible with Card Gate Plus"," wordt niet ondersteund door Card Gate Plus"
44
+ "Transaction started, waiting for payment.","Transactie gestart, wacht op betaling"
45
+ "--Please select--","--Maak uw keuze--"
46
+ "------ Additional Banks ------","----- Overige Banken -----"
47
+ "Select your bank","Selecteer uw bank"
48
+ "Invoice # %s created and send to customer.","Factuur # %s is aangemaakt en verzonden naar de klant."
49
+ "Invoice # %s created.","Factuur # %s is aangemaakt."
50
+ "Hacker attempt: Order total amount does not match Card Gate Plus' gross total amount!","Hack poging: Het order bedrag komt niet overeen met het bedrag verzonden naar Card Gate Plus"
51
+ "Payment complete.","Betaling afgerond."
52
+ "Payment failed or canceled by user.","Betaling mislukt of geannuleerd door de klant."
53
+ "Transaction failed, payment is fraud.","Betaling afgewezen door anti-fraude instellingen."
54
+ "Automatically mail invoices to a customer.","Stuur facturen automatisch aan klant."
55
+ "Notifications recipient","Ontvanger van meldingen"
56
+ "Notify on failed invoice creation","Melden van mislukte poging om een factuur aan te maken"
57
+ "Automatic invoice creation failed","Het automatisch genereren van de factuur is mislukt"
58
+ "Magento was unable to create an invoice for Order # %s after a successful payment via Card Gate Plus (transaction # %s)","Het is Magento niet gelukt een factuur aan te maken voor Order # %s na een succesvolle transactie via Card Gate Plus (transactie # %s)"
59
+ "Year","Jaar"
60
+ "Month","Maand"
61
+ "Day","Dag"
62
+ "Gender","Geslacht"
63
+ "Male","Man"
64
+ "Female","Vrouw"
65
+ "Birthday","Geboortedatum"
66
+ "Your Klarna EID","Uw Klarna EID"
67
+ "Bank Transfer","Bank Overboeking"
68
+ "Klarna Invoice", "Klarna Factuur"
69
+ "Direct Debit","Incasso"
70
+ "Bank transfer: Waiting for customer action.","Overboeking: Wacht op consument."
71
+ "Direct debit: Waiting for confirmation.","Incasso: wacht op bevestiging."
72
+ "Your payment is being evaluated by the bank. Please do not attempt to pay again, until your payment is either confirmed or denied by the bank.","Uw betaling wordt beoordeeld door de bank. Probeer niet nogmaals te betalen, totdat de betaling goed- of afgekeurd is door de bank."
73
+ "Your payment has failed. If you wish, you can try using a different payment method.","Uw betaling is niet geslaagd. Indien gewenst, kunt u een andere betaalmethode proberen."
74
+ "Invoice Fee (excl. VAT)","Factuurkosten (excl. BTW)"
75
+ "Invoice Fee (incl. VAT)","Factuurkosten (incl. BTW)"
76
+ "Invoice fee tax class","Factuurkosten BTW class"
77
+ "The tax class to use to calculate the invoice fee tax","De BTW class die gebruikt wordt voor het berekenen van de factuurkosten BTW."
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Cardgate_Cgp</name>
4
+ <version>1.0.28</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Card Gate Plus Payment Module</summary>
10
+ <description>Card Gate Plus is a Payment Service Provider from the Netherlands. We offer various payment methods against competitive rates.</description>
11
+ <notes>- Changed payment redirect message.</notes>
12
+ <authors><author><name>Richard Schoots</name><user>auto-converted</user><email>support@cardgate.com</email></author></authors>
13
+ <date>2014-12-02</date>
14
+ <time>11:39:34</time>
15
+ <contents><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="images"><dir name="cardgate"><file name="cardgate_cgp.png" hash="b97b15baba0b27042733c8ea4b4fb6bc"/></dir></dir><file name="cardgate_cgp.css" hash="bebfc13fca1b36867c17864ae70fdabd"/></dir></dir></dir></target><target name="magelocale"><dir name="nl_NL"><file name="Cardgate_Cgp.csv" hash="26124aa7700a35aa27e3032f61e3aa85"/></dir></target><target name="mageetc"><dir name="modules"><file name="Cardgate_Cgp.xml" hash="c7a72af045f4b737b50cc6c360d4300d"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="cardgate"><dir name="cgp"><dir name="form"><file name="ideal.phtml" hash="42fdfee86ba3a098f5f73e9240332581"/><file name="klarna.phtml" hash="590c98ab018c474e8e4dc65e9199ba85"/><file name="klarnaaccount.phtml" hash="419f88941703c8562369844bb6a1d692"/></dir><file name="redirect.phtml" hash="0bbc40f290a5c0b8a634620adf6106f0"/></dir></dir></dir></dir></dir></dir></target><target name="magelocal"><dir name="Cardgate"><dir name="Cgp"><dir name="Block"><dir name="Form"><file name="Ideal.php" hash="286d495abf8a0876182b4a5012b5f567"/><file name="Klarna.php" hash="9bdbe1886bcdb283b86b6d208c3aa712"/><file name="Klarnaaccount.php" hash="0b4b84d9c472e815a30d5977ac53c932"/></dir><file name="Redirect.php" hash="668b52ec0c5fba7f42223d4e40a99987"/></dir><dir name="Helper"><file name="Data.php" hash="c94c725de2e14dc8019323c1ecf08962"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Source"><file name="Languages.php" hash="4fe09e45e3d9f3866d4b7c8437832972"/><file name="Modes.php" hash="888158f9118ba5087357d5c1ad8514d4"/></dir></dir></dir></dir><dir name="Gateway"><file name="Abstract.php" hash="796fd2959cee486fbdbc7ed9183a20be"/><file name="Americanexpress.php" hash="63988a4b6ec2b92c41115bac80b489c0"/><file name="Banktransfer.php" hash="a5e4a42135b0e8da48941869bb0b1435"/><file name="Default.php" hash="956d1ff0c2cfe0698efc23277e602cec"/><file name="Directdebit.php" hash="6ecd143d3d0b91c818fd8a9bf3858d0f"/><file name="Giropay.php" hash="aff19feafd61a08e3e298a865d52c3d5"/><file name="Ideal.php" hash="8ba0ccae24cde16a65ec17b462a64b6d"/><file name="Klarna.php" hash="330efb073aba572606b1f25b597bb106"/><file name="Klarnaaccount.php" hash="2012566e77136f823e965c8811321ea3"/><file name="Maestro.php" hash="b2887cc1de0590ab78e4373324924486"/><file name="Mastercard.php" hash="f1bfabcc244175c3e691e1707a541415"/><file name="Mistercash.php" hash="cc750b3e2d0cab9e345e77124d652115"/><file name="Paypal.php" hash="5831bb3e2e3f6d3e9506e9c6bbcf76c9"/><file name="Przelewy24.php" hash="62dc63f9d029d3f1599ffa6f4ec91e27"/><file name="Sofortbanking.php" hash="c680c21fa1a8a6427519664e1b1c1a94"/><file name="Visa.php" hash="d977468b9dac7c70d637b6167918c569"/><file name="Vpay.php" hash="2eb70f7616beada4fe23f2554f575e2e"/><file name="Webmoney.php" hash="b0f44c9232cf456778123c05127d3f12"/></dir><file name="Base.php" hash="b8a2f888d0d8e86a639b8379720c9e7a"/><file name="Observer.php" hash="81f7a3c5149f52dcb2d4c7434d250003"/></dir><dir name="controllers"><file name="StandardController.php" hash="2070748231cc42d40c67869c14c289d6"/></dir><dir name="etc"><file name="adminhtml.xml" hash="1caa98cae31103bb77143f821f68f451"/><file name="config.xml" hash="50894d77b87b45eae72e239ed9ead655"/><file name="system.xml" hash="6c58bf6def08cec53f1bf5f1d0ca7983"/></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies/>
18
+ </package>
skin/adminhtml/default/default/cardgate_cgp.css ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* cardgate */
2
+ h3.cardgate-header { background:url(images/cardgate/cardgate_cgp.png) no-repeat 0 0; height:0; overflow:hidden; padding:14px 0 0; width:71px; }
3
+
4
+ ul.tabs a.cardgate-section,
5
+ ul.tabs a.cardgate-section:hover { background:url(images/tabs_span_bg.gif) repeat-x 0 100%; border-bottom:none; padding:0.5em 0.5em 0.28em 1.5em; }
6
+ ul.tabs a.cardgate-section:hover { background-color:#d8e6e6; }
7
+ ul.tabs a.cardgate-section.active, ul.tabs a.cardgate-section.active:hover { background-color:#fff; }
8
+ ul.tabs a.cardgate-section span,
9
+ ul.tabs a.cardgate-section:hover span { background:url(images/cardgate/cardgate_cgp.png) no-repeat 0 0; height:0; overflow:hidden; padding:14px 0 0; width:71px; }
10
+
11
+ .cardgate-selection { border-collapse:collapse; width:100%; }
12
+ .cardgate-selection .cardgate-selection-info { text-align:right; }
13
+ .cardgate-selection th { font-size:13px; padding:5px 0; text-align:left; vertical-align:middle; }
14
+ .cardgate-selection td { background:#f2f2f2; border-bottom:5px solid #fff; padding:5px; vertical-align:top; }
15
+ .cardgate-selection .cardgate-selection-simplified { background:#fff; padding-left:35px; }
16
+ .cardgate-selection td a { color:#2997d8; }
17
+ .cardgate-selection td strong { color:#3c616a; }
18
+ .cardgate-selection td label { display:block; padding-left:30px; text-indent:-30px; }
19
+ .cardgate-selection td div label { display:inline; padding:0; text-indent:0; }
20
+ .cardgate-selection td input { height:13px; overflow:hidden; margin-right:15px; position:relative; top:-1px; width:13px; vertical-align:middle; }
21
+
22
+ .cardgate-config .form-list { width:100%; }
23
+ .cardgate-config tr.hover { background:#f7f7f7; }
24
+ .cardgate-config tr.hover label { cursor:help; }
25
+
26
+ .cardgate-credentials { border:1px solid #f2f2f2; }
27
+ .cardgate-credentials caption { padding:5px; text-align:left; }
28
+ .cardgate-credentials .value { color:#ccc; }
skin/adminhtml/default/default/images/cardgate/cardgate_cgp.png ADDED
Binary file