Ferratum_Ferbuy - Version 1.2.0

Version Notes

FerBuy is now active in Bulgaria! Visit www.ferbuy.bg for more information.

Download this release

Release Info

Developer Fer Buy
Extension Ferratum_Ferbuy
Version 1.2.0
Comparing to
See all releases


Code changes from version 1.1.3 to 1.2.0

app/code/local/Ferratum/Ferbuy/Block/Redirect.php DELETED
@@ -1,43 +0,0 @@
1
- <?php
2
- /**
3
- * Magento Ferbuy 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 Ferratum_Ferbuy
14
- * @author Pavel Saparov, <info@ferbuy.com>
15
- * @copyright Copyright (c) 2013 JT Family Holding OY (http://www.ferbuy.com)
16
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
- */
18
-
19
- class Ferratum_Ferbuy_Block_Redirect extends Mage_Core_Block_Template
20
- {
21
- protected function _construct()
22
- {
23
- $this->setTemplate('ferbuy/redirect.phtml');
24
- }
25
-
26
- public function getForm()
27
- {
28
- $model = Mage::getModel('ferbuy/ferbuy');
29
-
30
- $form = new Varien_Data_Form();
31
- $form->setAction($model->getGatewayUrl())
32
- ->setId('ferbuy_checkout')
33
- ->setName('ferbuy_checkout')
34
- ->setMethod('POST')
35
- ->setUseContainer(true);
36
-
37
- foreach ($model->getCheckoutFormFields() as $field => $value) {
38
- $form->addField($field, 'hidden', array('name' => $field, 'value' => $value));
39
- }
40
-
41
- return $form->getHtml();
42
- }
43
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ferratum/Ferbuy/Helper/Data.php DELETED
@@ -1,22 +0,0 @@
1
- <?php
2
- /**
3
- * Magento Ferbuy 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 Ferratum_Ferbuy
14
- * @author Pavel Saparov, <info@ferbuy.com>
15
- * @copyright Copyright (c) 2013 JT Family Holding OY (http://www.ferbuy.com)
16
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
- */
18
-
19
- class Ferratum_Ferbuy_Helper_Data extends Mage_Core_Helper_Abstract
20
- {
21
-
22
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ferratum/Ferbuy/Model/Adminhtml/System/Config/Source/Modes.php DELETED
@@ -1,33 +0,0 @@
1
- <?php
2
- /**
3
- * Magento Ferbuy 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 Ferratum_Ferbuy
14
- * @author Pavel Saparov, <info@ferbuy.com>
15
- * @copyright Copyright (c) 2013 JT Family Holding OY (http://www.ferbuy.com)
16
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
- */
18
-
19
- class Ferratum_Ferbuy_Model_Adminhtml_System_Config_Source_Modes
20
- {
21
- public function toOptionArray() {
22
- return array(
23
- array(
24
- "value" => "demo",
25
- "label" => Mage::helper("ferbuy")->__("Demo Mode")
26
- ),
27
- array(
28
- "value" => "live",
29
- "label" => Mage::helper("ferbuy")->__("Live Mode")
30
- ),
31
- );
32
- }
33
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ferratum/Ferbuy/Model/Base.php DELETED
@@ -1,369 +0,0 @@
1
- <?php
2
- /**
3
- * Magento Ferbuy 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 Ferratum_Ferbuy
14
- * @author Pavel Saparov, <info@ferbuy.com>
15
- * @copyright Copyright (c) 2013 JT Family Holding OY (http://www.ferbuy.com)
16
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
- */
18
-
19
- class Ferratum_Ferbuy_Model_Base extends Varien_Object
20
- {
21
- protected $_callback;
22
- protected $_config = null;
23
- protected $_isLocked = false;
24
- protected $_logFileName = "ferbuy.log";
25
-
26
- /**
27
- * Initialize basic ferbuy settings
28
- */
29
- public function _construct() {
30
- parent::_construct();
31
- $this->_config = Mage::getStoreConfig('ferbuy/settings');
32
- }
33
-
34
- /**
35
- * Retrieve config value
36
- *
37
- * @param string $field
38
- * @return mixed
39
- */
40
- public function getConfigData($field)
41
- {
42
- if (isset($this->_config[$field])) {
43
- return $this->_config[$field];
44
- } else {
45
- return false;
46
- }
47
- }
48
-
49
- /**
50
- * Set callback data
51
- *
52
- * @param array $data
53
- * @return Ferratum_Ferbuy_Model_Base
54
- */
55
- public function setCallbackData($data)
56
- {
57
- $this->_callback = $data;
58
- return $this;
59
- }
60
-
61
- /**
62
- * Get callback data
63
- *
64
- * @param string $field
65
- * @return string
66
- */
67
- public function getCallbackData($field = null)
68
- {
69
- if ($field === null) {
70
- return $this->_callback;
71
- } else {
72
- return @$this->_callback[$field];
73
- }
74
- }
75
-
76
- /**
77
- * If the debug mode is enabled
78
- *
79
- * @return bool
80
- */
81
- public function isDebug()
82
- {
83
- return $this->getConfigData('debug');
84
- }
85
-
86
- /**
87
- * If the live mode is enabled
88
- *
89
- * @return bool
90
- */
91
- public function isLive()
92
- {
93
- return ($this->getConfigData('live_mode') == 'live');
94
- }
95
-
96
- /**
97
- * Log data into the logfile
98
- *
99
- * @param string $msg
100
- * @return void
101
- */
102
- public function log($msg)
103
- {
104
- if ($this->getConfigData('debug')) {
105
- Mage::log($msg, null, $this->_logFileName);
106
- }
107
- }
108
-
109
- /**
110
- * Create lock file
111
- *
112
- * @return Ferratum_Ferbuy_Model_Base
113
- */
114
- public function lock()
115
- {
116
- $varDir = Mage::getConfig()->getVarDir('locks');
117
- $lockFilename = $varDir . DS . $this->getCallbackData('reference') . '.lock';
118
- $fp = @fopen($lockFilename, 'x');
119
-
120
- if ($fp) {
121
- $this->_isLocked = true;
122
- $pid = getmypid();
123
- $now = date('Y-m-d H:i:s');
124
- fwrite($fp, "Locked by $pid at $now\n");
125
- }
126
-
127
- return $this;
128
- }
129
-
130
- /**
131
- * Unlock file
132
- *
133
- * @return Ferratum_Ferbuy_Model_Base
134
- */
135
- public function unlock()
136
- {
137
- $this->_isLocked = false;
138
- $varDir = Mage::getConfig()->getVarDir('locks');
139
- $lockFilename = $varDir . DS . $this->getCallbackData('reference') . '.lock';
140
- unlink($lockFilename);
141
-
142
- return $this;
143
- }
144
-
145
- /**
146
- * Create and mail invoice
147
- *
148
- * @param Mage_Sales_Model_Order $order
149
- * @return boolean
150
- */
151
- protected function createInvoice(Mage_Sales_Model_Order $order)
152
- {
153
- if ($order->canInvoice() && !$order->hasInvoices()) {
154
- $invoice = $order->prepareInvoice();
155
- $invoice->register();
156
- if ($invoice->canCapture()) {
157
- $invoice->capture();
158
- }
159
- $invoice->save();
160
-
161
- Mage::getModel("core/resource_transaction")
162
- ->addObject($invoice)
163
- ->addObject($invoice->getOrder())
164
- ->save();
165
-
166
- $mail_invoice = $this->getConfigData("mail_invoice");
167
- if ($mail_invoice) {
168
- $invoice->setEmailSent(true);
169
- $invoice->save();
170
- $invoice->sendEmail();
171
- }
172
-
173
- $statusMessage = $mail_invoice ? "Invoice # %s created and send to customer." : "Invoice # %s created.";
174
- $order->addStatusToHistory(
175
- $order->getStatus(),
176
- Mage::helper("ferbuy")->__($statusMessage, $invoice->getIncrementId(),
177
- $mail_invoice)
178
- );
179
-
180
- return true;
181
- }
182
-
183
- return false;
184
- }
185
-
186
- /**
187
- * Notify shop owners on failed invoice creation
188
- *
189
- * @param Mage_Sales_Model_Order $order
190
- * @return void
191
- */
192
- protected function onFailedInvoicing($order) {
193
- $storeId = $order->getStore()->getId();
194
-
195
- $ident = Mage::getStoreConfig('ferbuy/settings/notification_email');
196
- $sender_email = Mage::getStoreConfig('trans_email/ident_general/email', $storeId);
197
- $sender_name = Mage::getStoreConfig('trans_email/ident_general/name', $storeId);
198
- $recipient_email = Mage::getStoreConfig('trans_email/ident_'.$ident.'/email', $storeId);
199
- $recipient_name = Mage::getStoreConfig('trans_email/ident_'.$ident.'/name', $storeId);
200
-
201
- $mail = new Zend_Mail();
202
- $mail->setFrom($sender_email, $sender_name);
203
- $mail->addTo($recipient_email, $recipient_name);
204
- $mail->setSubject(Mage::helper("ferbuy")->__('Automatic invoice creation failed'));
205
- $mail->setBodyText(Mage::helper("ferbuy")->__('Magento was unable to create an invoice for Order # %s after a successful payment via FerBuy (transaction # %s)', $order->getIncrementId(), $this->getCallbackData('transaction_id')));
206
- $mail->setBodyHtml(Mage::helper("ferbuy")->__('Magento was unable to create an invoice for <b>Order # %s</b> after a successful payment via FerBuy <b>(transaction # %s)</b>', $order->getIncrementId(), $this->getCallbackData('transaction_id')));
207
- $mail->send();
208
- }
209
-
210
- /**
211
- * Returns true if the amounts match
212
- *
213
- * @param Mage_Sales_Model_Order $order
214
- * @return boolean
215
- */
216
- protected function validateAmount(Mage_Sales_Model_Order $order)
217
- {
218
- $amountInCents = (int) sprintf('%.0f', $order->getGrandTotal()*100);
219
- $callbackAmount = (int) $this->getCallbackData('amount');
220
-
221
- if (($amountInCents != $callbackAmount) && (abs($callbackAmount - $amountInCents) > 1)) {
222
- $this->log("OrderID: {$order->getId()} do not match amounts. Sent $amountInCents, Received: $callbackAmount");
223
- $statusMessage = Mage::helper("ferbuy")->__("Hacker attempt: Order total amount does not match FerBuy's gross total amount!");
224
- $order->addStatusToHistory($order->getStatus(), $statusMessage);
225
- $order->save();
226
- return false;
227
- }
228
-
229
- return true;
230
- }
231
-
232
- /**
233
- * Process callback for all transactions
234
- *
235
- * @return void
236
- */
237
- public function processCallback()
238
- {
239
- $id = $this->getCallbackData('reference');
240
- $order = Mage::getModel('sales/order');
241
- $order->loadByIncrementId($id);
242
-
243
- // Log callback data
244
- $this->log('Receiving callback data:');
245
- $this->log($this->getCallbackData());
246
-
247
- // Validate amount
248
- if (!$this->validateAmount($order)) {
249
- $this->log('Amount validation failed!');
250
- exit();
251
- }
252
-
253
- $statusComplete = $this->getConfigData("complete_status");
254
- $statusFailed = $this->getConfigData("failed_status");
255
- $statusFraud = $this->getConfigData("fraud_status");
256
- $autocreateInvoice = $this->getConfigData("autocreate_invoice");
257
- $evInvoicingFailed = $this->getConfigData("event_invoicing_failed");
258
-
259
- $complete = false;
260
- $canceled = false;
261
- $newState = null;
262
- $newStatus = true;
263
- $statusMessage = '';
264
-
265
- switch ($this->getCallbackData('status')) {
266
- case "200":
267
- $complete = true;
268
- $newState = Mage_Sales_Model_Order::STATE_PROCESSING;
269
- $newStatus = $statusComplete;
270
- $statusMessage = Mage::helper("ferbuy")->__("Transaction complete.");
271
- break;
272
- case "400":
273
- $canceled = true;
274
- $newState = Mage_Sales_Model_Order::STATE_CANCELED;
275
- $newStatus = $statusFailed;
276
- $statusMessage = Mage::helper("ferbuy")->__("Transaction failed.");
277
- break;
278
- case "408":
279
- $canceled = true;
280
- $newState = Mage_Sales_Model_Order::STATE_CANCELED;
281
- $newStatus = $statusFraud;
282
- $statusMessage = Mage::helper("ferbuy")->__("Transaction timed out.");
283
- break;
284
- case "410":
285
- $canceled = true;
286
- $newState = Mage_Sales_Model_Order::STATE_CANCELED;
287
- $newStatus = $statusFailed;
288
- $statusMessage = Mage::helper("ferbuy")->__("Transaction canceled by user.");
289
- break;
290
- }
291
-
292
- // Update only certain states
293
- $canUpdate = false;
294
- $undoCancel = false;
295
- if ($order->getState() == Mage_Sales_Model_Order::STATE_NEW ||
296
- $order->getState() == Mage_Sales_Model_Order::STATE_PENDING_PAYMENT ||
297
- $order->getState() == Mage_Sales_Model_Order::STATE_PROCESSING ||
298
- $order->getState() == Mage_Sales_Model_Order::STATE_CANCELED) {
299
- $canUpdate = true;
300
- }
301
-
302
- foreach ($order->getStatusHistoryCollection(true) as $_item) {
303
- // Don't update order status if the payment is complete
304
- if ($_item->getStatusLabel() == ucfirst($statusComplete)) {
305
- $canUpdate = false;
306
- // Uncancel an order if the payment is considered complete
307
- } elseif (($_item->getStatusLabel() == ucfirst($statusFailed)) ||
308
- ($_item->getStatusLabel() == ucfirst($statusFraud))) {
309
- $undoCancel = true;
310
- }
311
- }
312
-
313
- // Lock
314
- $this->lock();
315
-
316
- // Uncancel order if necessary
317
- if ($undoCancel) {
318
- foreach($order->getAllItems() as $_item) {
319
- if ($_item->getQtyCanceled() > 0) $_item->setQtyCanceled(0)->save();
320
- if ($_item->getQtyInvoiced() > 0) $_item->setQtyInvoiced(0)->save();
321
- }
322
-
323
- $order->setBaseDiscountCanceled(0)
324
- ->setBaseShippingCanceled(0)
325
- ->setBaseSubtotalCanceled(0)
326
- ->setBaseTaxCanceled(0)
327
- ->setBaseTotalCanceled(0)
328
- ->setDiscountCanceled(0)
329
- ->setShippingCanceled(0)
330
- ->setSubtotalCanceled(0)
331
- ->setTaxCanceled(0)
332
- ->setTotalCanceled(0);
333
- }
334
-
335
- // Update the status if changed
336
- if ($canUpdate && (($newState != $order->getState()) || ($newStatus != $order->getStatus()))) {
337
- // Set order state and status
338
- $order->setState($newState, $newStatus, $statusMessage);
339
- $this->log("Changing state to '$newState' with message '$statusMessage' for order ID: $id.");
340
-
341
- // Send new order e-mail
342
- if ($complete && !$canceled && !$order->getEmailSent()) {
343
- $order->setEmailSent(true);
344
- $order->sendNewOrderEmail();
345
- }
346
-
347
- // Save order status changes
348
- $order->save();
349
-
350
- // Create an invoice when the payment is completed
351
- if ($complete && !$canceled && $autocreateInvoice) {
352
- $invoiceCreated = $this->createInvoice($order);
353
- if ($invoiceCreated) {
354
- $this->log("Creating invoice for order ID: $id.");
355
- } else {
356
- $this->log("Unable to create invoice for order ID: $id.");
357
- }
358
-
359
- // Send notification
360
- if (!$invoiceCreated && $evInvoicingFailed) {
361
- $this->eventInvoicingFailed($order);
362
- }
363
- }
364
- }
365
-
366
- // Unlock
367
- $this->unlock();
368
- }
369
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ferratum/Ferbuy/Model/Ferbuy.php DELETED
@@ -1,248 +0,0 @@
1
- <?php
2
- /**
3
- * Magento Ferbuy 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 Ferratum_Ferbuy
14
- * @author Pavel Saparov, <info@ferbuy.com>
15
- * @copyright Copyright (c) 2013 JT Family Holding OY (http://www.ferbuy.com)
16
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
- */
18
-
19
- class Ferratum_Ferbuy_Model_Ferbuy extends Mage_Payment_Model_Method_Abstract
20
- {
21
- /**
22
- * Payment Method features
23
- *
24
- * @var mixed
25
- */
26
- protected $_code = 'ferbuy';
27
-
28
- /**
29
- * FerBuy settings
30
- *
31
- * @var mixed
32
- */
33
- protected $_url = 'https://gateway.ferbuy.com/';
34
- protected $_supportedCurrencies = array('SGD', 'PLN', 'CZK', 'EUR');
35
-
36
- /**
37
- * Mage_Payment_Model settings
38
- *
39
- * @var bool
40
- */
41
- protected $_isGateway = true;
42
- protected $_canAuthorize = true;
43
- protected $_canCapture = true;
44
- protected $_canUseInternal = false;
45
- protected $_canUseCheckout = true;
46
- protected $_canUseForMultishipping = true;
47
-
48
- /**
49
- * Return Gateway Url
50
- *
51
- * @return string
52
- */
53
- public function getGatewayUrl()
54
- {
55
- $base = Mage::getSingleton('ferbuy/base');
56
- $env = ($base->isLive()) ? 'live/' : 'demo/';
57
-
58
- return $this->_url . $env;
59
- }
60
-
61
- /**
62
- * Get plugin version to send to gateway (debugging purposes)
63
- *
64
- * @return string
65
- */
66
- public function getPluginVersion()
67
- {
68
- return (string) Mage::getConfig()->getNode('modules/Ferratum_Ferbuy/version');
69
- }
70
-
71
- /**
72
- * Get checkout session namespace
73
- *
74
- * @return Mage_Checkout_Model_Session
75
- */
76
- public function getCheckout()
77
- {
78
- return Mage::getSingleton('checkout/session');
79
- }
80
-
81
- /**
82
- * Get current quote
83
- *
84
- * @return Mage_Sales_Model_Quote
85
- */
86
- public function getQuote()
87
- {
88
- return $this->getCheckout()->getQuote();
89
- }
90
-
91
- /**
92
- * Get current order
93
- *
94
- * @return Mage_Sales_Model_Order
95
- */
96
- public function getOrder()
97
- {
98
- $order = Mage::getModel('sales/order');
99
- $order->loadByIncrementId($this->getCheckout()->getLastRealOrderId());
100
- return $order;
101
- }
102
-
103
- /**
104
- * Magento will use this for payment redirection
105
- *
106
- * @return string
107
- */
108
- public function getOrderPlaceRedirectUrl()
109
- {
110
- return Mage::getUrl('ferbuy/payment/redirect/', array('_secure' => true));
111
- }
112
-
113
- /**
114
- * Retrieve config value for store by path
115
- *
116
- * @param string $path
117
- * @param mixed $store
118
- * @return mixed
119
- */
120
- public function getConfigData($field, $storeId = null)
121
- {
122
- if ($storeId === null) {
123
- $storeId = $this->getStore();
124
- }
125
-
126
- $configSettings = Mage::getStoreConfig('ferbuy/settings', $storeId);
127
- $configGateway = Mage::getStoreConfig('ferbuy/ferbuy', $storeId);
128
- $config = array_merge($configSettings, $configGateway);
129
-
130
- return @$config[$field];
131
- }
132
-
133
- /**
134
- * Check method for processing with base currency
135
- *
136
- * @param string $currencyCode
137
- * @return boolean
138
- */
139
- public function canUseForCurrency($currencyCode)
140
- {
141
- return in_array(Mage::app()->getStore()->getCurrentCurrencyCode(), $this->_supportedCurrencies);
142
- }
143
-
144
- /**
145
- * Change order status
146
- *
147
- * @param Mage_Sales_Model_Order $order
148
- * @return void
149
- */
150
- protected function initiateTransactionStatus($order)
151
- {
152
- // Change order status
153
- $newState = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT;
154
- $newStatus = $this->getConfigData('initialized_status');
155
- $statusMessage = Mage::helper('ferbuy')->__('Transaction started, waiting for payment.');
156
- $order->setState($newState, $newStatus, $statusMessage);
157
- $order->save();
158
- }
159
-
160
- /**
161
- * Generates checkout form fields
162
- *
163
- * @return array
164
- */
165
- public function getCheckoutFormFields()
166
- {
167
- $base = Mage::getSingleton('ferbuy/base');
168
-
169
- $order = $this->getOrder();
170
- $customer = $order->getBillingAddress();
171
-
172
- //Shopping Cart
173
- $items = array();
174
- $subtotal = 0;
175
- foreach ($order->getItemsCollection() as $item) {
176
- if ($item->getQtyToShip() > 0) {
177
- $items[] = array(
178
- 'Description' => $item->getSku() . ': ' . ($item->getDescription() ? $item->getDescription() : 'N/A'),
179
- 'Name' => $item->getName(),
180
- 'Price' => round($item->getPrice() * 100, 0),
181
- 'Quantity' => $item->getQtyToShip()
182
- );
183
- }
184
- $subtotal+=round($item->getPrice() * 100, 0) * $item->getQtyToShip();
185
- }
186
-
187
- //shopping_cart
188
- $shopping_cart = array();
189
- $shopping_cart['tax'] = round($order->getTaxAmount()* 100,0) ;
190
- $shopping_cart['discount'] = round($order->getDiscountAmount()* 100,0);
191
- $shopping_cart['shipping'] = round($order->getShippingAmount()* 100,0);
192
- $shopping_cart['items'] = $items;
193
- $shopping_cart['subtotal'] = $subtotal;
194
- $shopping_cart['total'] = round($order->getGrandTotal()* 100,0);
195
-
196
- //Encode the shopping cart
197
- if(function_exists('json_encode')){
198
- $encodedShoppingCart=json_encode($shopping_cart);
199
- }else{
200
- $encodedShoppingCart=serialize($shopping_cart);
201
- }
202
- // Add initiate state
203
- $this->initiateTransactionStatus($order);
204
-
205
- $s_arr = array();
206
- $s_arr['site_id'] = $this->getConfigData('site_id');
207
- $s_arr['reference'] = $order->getIncrementId();
208
- $s_arr['amount'] = sprintf('%.0f', $order->getGrandTotal() * 100);
209
- $s_arr['currency'] = $order->getOrderCurrencyCode();
210
- $s_arr['first_name'] = $customer->getFirstname();
211
- $s_arr['last_name'] = $customer->getLastname();
212
- $s_arr['email_address'] = $order->getCustomerEmail();
213
- $s_arr['address'] = $customer->getStreet(1);
214
- $s_arr['address_line2'] = $customer->getStreet(2);
215
- $s_arr['city'] = $customer->getCity();
216
- $s_arr['country_iso'] = $customer->getCountry();
217
- $s_arr['postal_code'] = $customer->getPostcode();
218
- $s_arr['mobile_phone'] = $customer->getTelephone();
219
- $s_arr['return_url_ok'] = Mage::getUrl('ferbuy/payment/success/', array('_secure' => true));
220
- $s_arr['return_url_cancel'] = Mage::getUrl('ferbuy/payment/cancel/', array('_secure' => true));
221
- $s_arr['shop_version'] = 'Magento '. Mage::getVersion();
222
- $s_arr['plugin_name'] = 'Ferratum_Ferbuy';
223
- $s_arr['plugin_version'] = $this->getPluginVersion();
224
- $s_arr['shopping_cart'] = $encodedShoppingCart;
225
- //$s_arr['extra'] = $this->getCheckout()->getFerbuyQuoteId();
226
-
227
- $env = ($base->isLive()) ? 'live' : 'demo';
228
- $s_arr['checksum'] = sha1(join("&", array(
229
- $env,
230
- $s_arr['site_id'],
231
- $s_arr['reference'],
232
- $s_arr['currency'],
233
- $s_arr['amount'],
234
- $s_arr['first_name'],
235
- $s_arr['last_name'],
236
- $this->getConfigData('hash_key')
237
- )));
238
-
239
- // Logging
240
- $base->log('Initiating a new transaction');
241
- $base->log('Sending customer to FerBuy with values:');
242
- $base->log('URL = ' . $this->getGatewayUrl());
243
-
244
- $base->log($s_arr);
245
-
246
- return $s_arr;
247
- }
248
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ferratum/Ferbuy/controllers/PaymentController.php DELETED
@@ -1,148 +0,0 @@
1
- <?php
2
- /**
3
- * Magento Ferbuy 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 Ferratum_Ferbuy
14
- * @author Pavel Saparov, <info@ferbuy.com>
15
- * @copyright Copyright (c) 2013 JT Family Holding OY (http://www.ferbuy.com)
16
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
- */
18
-
19
- class Ferratum_Ferbuy_PaymentController extends Mage_Core_Controller_Front_Action
20
- {
21
- /**
22
- * Verify the callback
23
- *
24
- * @param array $data
25
- * @return boolean
26
- */
27
- protected function _validate($data)
28
- {
29
- $base = Mage::getSingleton('ferbuy/base');
30
- $env = $base->isLive() ? 'live' : 'demo';
31
-
32
- $verify = join("&", array(
33
- $env,
34
- $data['reference'],
35
- $data['transaction_id'],
36
- $data['status'],
37
- $data['currency'],
38
- $data['amount'],
39
- $base->getConfigData('hash_key')
40
- ));
41
-
42
- if (sha1($verify) == $data['checksum']) {
43
- return true;
44
- }
45
-
46
- return false;
47
- }
48
-
49
- /**
50
- * Reditect customer to the gateway using his prefered payment method
51
- */
52
- public function redirectAction()
53
- {
54
- $session = Mage::getSingleton('checkout/session');
55
- $session->setFerbuyQuoteId($session->getQuoteId());
56
-
57
- $this->loadLayout();
58
- $block = $this->getLayout()->createBlock(
59
- 'Ferratum_Ferbuy_Block_Redirect'
60
- );
61
-
62
- $this->getLayout()->getBlock('content')->append($block);
63
- $this->renderLayout();
64
- }
65
-
66
- /**
67
- * After a failed transaction a customer will be send here
68
- */
69
- public function cancelAction()
70
- {
71
- $base = Mage::getSingleton('ferbuy/base');
72
- $session = Mage::getSingleton('checkout/session');
73
-
74
- $order_id = $session->getLastRealOrderId();
75
- $order = Mage::getSingleton('sales/order')->loadByIncrementId($order_id);
76
- if ($order_id) {
77
- $order->setState($base->getConfigData('order_status_failed'));
78
- $order->cancel();
79
- $order->save();
80
- }
81
-
82
- $quote = Mage::getModel('sales/quote')->load($session->getFerbuyQuoteId());
83
- if ($quote->getId()) {
84
- $quote->setIsActive(true);
85
- $quote->save();
86
- }
87
-
88
- $this->_redirect('checkout/cart');
89
- }
90
-
91
- /**
92
- * After a successful transaction a customer will be send here
93
- */
94
- public function successAction()
95
- {
96
- $session = Mage::getSingleton('checkout/session');
97
- $quote = Mage::getModel('sales/quote')->load($session->getFerbuyQuoteId());
98
- if ($quote->getId()) {
99
- $quote->setIsActive(false);
100
- $quote->delete();
101
- }
102
-
103
- $this->_redirect('checkout/onepage/success', array('_secure'=>true));
104
- }
105
-
106
- /**
107
- * Control URL called by gateway
108
- */
109
- public function controlAction()
110
- {
111
- $base = Mage::getModel('ferbuy/base');
112
- $data = $this->getRequest()->getPost();
113
-
114
- // Verify callback hash
115
- if (!$this->getRequest()->isPost() || !$this->_validate($data)) {
116
- $base->log('Callback hash validation failed!');
117
- $base->log('Received data from FerBuy:');
118
- $base->log($data);
119
- exit();
120
- }
121
-
122
- // Process callback
123
- $base->setCallbackData($data)->processCallback();
124
-
125
- // Obtain quote and status
126
- $status = (int) $data['status'];
127
- $session = Mage::getSingleton('checkout/session');
128
- $quote = Mage::getModel('sales/quote')->load($session->getFerbuyQuoteId());
129
-
130
- // Set Mage_Sales_Model_Quote to inactive and delete
131
- if (200 <= $status && $status <= 299) {
132
- if ($quote->getId()) {
133
- $quote->setIsActive(false);
134
- $quote->delete();
135
- }
136
-
137
- // Set Mage_Sales_Model_Quote to active and save
138
- } else {
139
- if ($quote->getId()) {
140
- $quote->setIsActive(true);
141
- $quote->save();
142
- }
143
- }
144
-
145
- // Display transaction_id and status
146
- echo $data['transaction_id'].'.'.$data['status'];
147
- }
148
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ferratum/Ferbuy/etc/adminhtml.xml DELETED
@@ -1,40 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!--
3
- /**
4
- * Magento Ferbuy 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 Ferratum_Ferbuy
15
- * @author Pavel Saparov, <info@ferbuy.com>
16
- * @copyright Copyright (c) 2013 JT Family Holding OY (http://www.ferbuy.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
- <ferbuy>
30
- <title>Ferbuy Settings</title>
31
- </ferbuy>
32
- </children>
33
- </config>
34
- </children>
35
- </system>
36
- </children>
37
- </admin>
38
- </resources>
39
- </acl>
40
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ferratum/Ferbuy/etc/config.xml DELETED
@@ -1,136 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!--
3
- /**
4
- * Magento Ferbuy 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 Ferratum_Ferbuy
15
- * @author Pavel Saparov, <info@ferbuy.com>
16
- * @copyright Copyright (c) 2013 JT Family Holding OY (http://www.ferbuy.com)
17
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
- */
19
- -->
20
- <config>
21
- <modules>
22
- <Ferratum_Ferbuy>
23
- <version>1.1.3</version>
24
- </Ferratum_Ferbuy>
25
- </modules>
26
-
27
- <global>
28
- <blocks>
29
- <ferbuy>
30
- <class>Ferratum_Ferbuy_Block</class>
31
- </ferbuy>
32
- </blocks>
33
- <helpers>
34
- <ferbuy>
35
- <class>Ferratum_Ferbuy_Helper</class>
36
- </ferbuy>
37
- </helpers>
38
- <models>
39
- <ferbuy>
40
- <class>Ferratum_Ferbuy_Model</class>
41
- </ferbuy>
42
- </models>
43
- <resources>
44
- <ferbuy_setup>
45
- <setup>
46
- <module>Ferratum_Ferbuy</module>
47
- </setup>
48
- <connection>
49
- <use>core_setup</use>
50
- </connection>
51
- </ferbuy_setup>
52
- <ferbuy_read>
53
- <connection>
54
- <use>core_read</use>
55
- </connection>
56
- </ferbuy_read>
57
- <ferbuy_write>
58
- <connection>
59
- <use>core_write</use>
60
- </connection>
61
- </ferbuy_write>
62
- </resources>
63
- </global>
64
-
65
- <adminhtml>
66
- <layout>
67
- <updates>
68
- <ferbuy>
69
- <file>ferbuy.xml</file>
70
- </ferbuy>
71
- </updates>
72
- </layout>
73
- <acl>
74
- <resources>
75
- <admin>
76
- <children>
77
- <system>
78
- <children>
79
- <config>
80
- <children>
81
- <ferbuy>
82
- <title>Ferbuy Settings</title>
83
- </ferbuy>
84
- </children>
85
- </config>
86
- </children>
87
- </system>
88
- </children>
89
- </admin>
90
- </resources>
91
- </acl>
92
- </adminhtml>
93
-
94
- <frontend>
95
- <routers>
96
- <ferbuy>
97
- <use>standard</use>
98
- <args>
99
- <module>Ferratum_Ferbuy</module>
100
- <frontName>ferbuy</frontName>
101
- </args>
102
- </ferbuy>
103
- </routers>
104
- </frontend>
105
-
106
- <default>
107
- <payment>
108
- <ferbuy>
109
- <active>1</active>
110
- <model>ferbuy/ferbuy</model>
111
- <title>FerBuy (Buy Now, Pay Later)</title>
112
- <allowspecific>0</allowspecific>
113
- </ferbuy>
114
- </payment>
115
-
116
- <ferbuy>
117
- <settings>
118
- <initialized_status>pending</initialized_status>
119
- <complete_status>processing</complete_status>
120
- <failed_status>canceled</failed_status>
121
- <autocreate_invoice>1</autocreate_invoice>
122
- <mail_invoice>1</mail_invoice>
123
- <invoicing_failed>0</invoicing_failed>
124
- <notification_email>general</notification_email>
125
- <live_mode>demo</live_mode>
126
- <debug>0</debug>
127
- </settings>
128
- <ferbuy>
129
- <active>1</active>
130
- <model>ferbuy/ferbuy</model>
131
- <title>FerBuy (Buy Now, Pay Later)</title>
132
- <allowspecific>0</allowspecific>
133
- </ferbuy>
134
- </ferbuy>
135
- </default>
136
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ferratum/Ferbuy/etc/system.xml DELETED
@@ -1,220 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!--
3
- /**
4
- * Magento Ferbuy 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 Ferratum_Ferbuy
15
- * @author Pavel Saparov, <info@ferbuy.com>
16
- * @copyright Copyright (c) 2013 JT Family Holding OY (http://www.ferbuy.com)
17
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
- */
19
- -->
20
- <config>
21
- <sections>
22
- <ferbuy module="ferbuy">
23
- <label>Ferbuy</label>
24
- <class>ferbuy-section</class>
25
- <header_css>ferbuy-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="label comment">
34
- <label>Settings</label>
35
- <comment><![CDATA[<strong>Note:</strong> Don't forget to set-up in the <a href="https://my.ferbuy.com/" target="_blank">My Backoffice</a> a Control URL to "http://www.yourdomain.com/ferbuy/payment/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
- <live_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.ferbuy.com/' target='_blank'>Sign Up</a>.]]></comment>
45
- <source_model>ferbuy/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
- </live_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://merchant.ferbuy.com/" target="_blank">Merchant Backoffice</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>Checksum</label>
62
- <frontend_type>text</frontend_type>
63
- <comment><![CDATA[Fill in you secret checksum key for the site. You can create your hash key code at <a href="https://merchant.ferbuy.com/" target="_blank">Merchant Backoffice</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
- <autocreate_invoice translate="label comment">
70
- <label>Create invoice after payment</label>
71
- <frontend_type>select</frontend_type>
72
- <comment>Automatically create invoices after payment.</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
- </autocreate_invoice>
79
- <mail_invoice translate="label comment">
80
- <label>Mail invoice to customer</label>
81
- <frontend_type>select</frontend_type>
82
- <comment>Automatically mail invoices to a customer.</comment>
83
- <source_model>adminhtml/system_config_source_yesno</source_model>
84
- <sort_order>60</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
- </mail_invoice>
89
- <invoicing_failed translate="label">
90
- <label>Notify on failed invoice creation</label>
91
- <frontend_type>select</frontend_type>
92
- <source_model>adminhtml/system_config_source_yesno</source_model>
93
- <sort_order>70</sort_order>
94
- <show_in_default>1</show_in_default>
95
- <show_in_website>1</show_in_website>
96
- <show_in_store>1</show_in_store>
97
- </invoicing_failed>
98
- <notification_email translate="label">
99
- <label>Notifications recipient</label>
100
- <frontend_type>select</frontend_type>
101
- <source_model>adminhtml/system_config_source_email_identity</source_model>
102
- <sort_order>80</sort_order>
103
- <show_in_default>1</show_in_default>
104
- <show_in_website>1</show_in_website>
105
- <show_in_store>1</show_in_store>
106
- </notification_email>
107
- <initialized_status translate="label">
108
- <label>Transaction in progress status</label>
109
- <frontend_type>select</frontend_type>
110
- <source_model>adminhtml/system_config_source_order_status</source_model>
111
- <sort_order>100</sort_order>
112
- <show_in_default>1</show_in_default>
113
- <show_in_website>1</show_in_website>
114
- <show_in_store>1</show_in_store>
115
- </initialized_status>
116
- <complete_status translate="label">
117
- <label>Transaction complete status</label>
118
- <frontend_type>select</frontend_type>
119
- <source_model>adminhtml/system_config_source_order_status</source_model>
120
- <sort_order>110</sort_order>
121
- <show_in_default>1</show_in_default>
122
- <show_in_website>1</show_in_website>
123
- <show_in_store>1</show_in_store>
124
- </complete_status>
125
- <failed_status translate="label">
126
- <label>Transaction failed status</label>
127
- <frontend_type>select</frontend_type>
128
- <source_model>adminhtml/system_config_source_order_status</source_model>
129
- <sort_order>120</sort_order>
130
- <show_in_default>1</show_in_default>
131
- <show_in_website>1</show_in_website>
132
- <show_in_store>1</show_in_store>
133
- </failed_status>
134
- <debug translate="label comment">
135
- <label>Debug</label>
136
- <frontend_type>select</frontend_type>
137
- <comment>Will log details for debugging purposes in /var/log/ferbuy.log file.</comment>
138
- <source_model>adminhtml/system_config_source_yesno</source_model>
139
- <sort_order>130</sort_order>
140
- <show_in_default>1</show_in_default>
141
- <show_in_website>1</show_in_website>
142
- <show_in_store>1</show_in_store>
143
- </debug>
144
- </fields>
145
- </settings>
146
-
147
- <ferbuy translate="label" module="ferbuy">
148
- <label>FerBuy (Buy Now, Pay Later)</label>
149
- <sort_order>200</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
- <fields>
154
- <active translate="label">
155
- <label>Enabled</label>
156
- <frontend_type>select</frontend_type>
157
- <source_model>adminhtml/system_config_source_yesno</source_model>
158
- <sort_order>1</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
- </active>
163
- <title translate="label">
164
- <label>Title</label>
165
- <frontend_type>text</frontend_type>
166
- <sort_order>10</sort_order>
167
- <show_in_default>1</show_in_default>
168
- <show_in_website>1</show_in_website>
169
- <show_in_store>1</show_in_store>
170
- </title>
171
- <min_order_total translate="label comment">
172
- <label>Minimum Order Total</label>
173
- <frontend_type>text</frontend_type>
174
- <comment>Checkout option will not be available with an order that does not meet the minimum.</comment>
175
- <sort_order>20</sort_order>
176
- <show_in_default>1</show_in_default>
177
- <show_in_website>1</show_in_website>
178
- <show_in_store>1</show_in_store>
179
- </min_order_total>
180
- <max_order_total translate="label comment">
181
- <label>Maximum Order Total</label>
182
- <frontend_type>text</frontend_type>
183
- <comment>Checkout option will not be available with an order that does exceeds the maximum.</comment>
184
- <sort_order>30</sort_order>
185
- <show_in_default>1</show_in_default>
186
- <show_in_website>1</show_in_website>
187
- <show_in_store>1</show_in_store>
188
- </max_order_total>
189
- <allowspecific translate="label">
190
- <label>Payment from applicable countries</label>
191
- <frontend_type>allowspecific</frontend_type>
192
- <sort_order>40</sort_order>
193
- <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
194
- <show_in_default>1</show_in_default>
195
- <show_in_website>1</show_in_website>
196
- <show_in_store>1</show_in_store>
197
- </allowspecific>
198
- <specificcountry translate="label">
199
- <label>Payment from Specific countries</label>
200
- <frontend_type>multiselect</frontend_type>
201
- <sort_order>50</sort_order>
202
- <source_model>adminhtml/system_config_source_country</source_model>
203
- <show_in_default>1</show_in_default>
204
- <show_in_website>1</show_in_website>
205
- <show_in_store>1</show_in_store>
206
- </specificcountry>
207
- <sort_order translate="label">
208
- <label>Sort order</label>
209
- <frontend_type>text</frontend_type>
210
- <sort_order>100</sort_order>
211
- <show_in_default>1</show_in_default>
212
- <show_in_website>1</show_in_website>
213
- <show_in_store>1</show_in_store>
214
- </sort_order>
215
- </fields>
216
- </ferbuy>
217
- </groups>
218
- </ferbuy>
219
- </sections>
220
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/ferbuy/redirect.phtml DELETED
@@ -1,3 +0,0 @@
1
- <?php echo Mage::helper("ferbuy")->__("You will be redirected to FerBuy to finish your transaction."); ?>
2
- <?php echo $this->getForm(); ?>
3
- <script type="text/javascript">document.getElementById("ferbuy_checkout").submit();</script>
 
 
 
app/etc/modules/Ferratum_Ferbuy.xml DELETED
@@ -1,30 +0,0 @@
1
- <?xml version="1.0"?>
2
- <!--
3
- /**
4
- * Magento Ferbuy 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 Ferratum_Ferbuy
15
- * @author Pavel Saparov, <info@ferbuy.com>
16
- * @copyright Copyright (c) 2013 JT Family Holding OY (http://www.ferbuy.com)
17
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
- */
19
- -->
20
- <config>
21
- <modules>
22
- <Ferratum_Ferbuy>
23
- <active>true</active>
24
- <codePool>local</codePool>
25
- <depends>
26
- <Mage_Payment />
27
- </depends>
28
- </Ferratum_Ferbuy>
29
- </modules>
30
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
package.xml CHANGED
@@ -1,25 +1,19 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Ferratum_Ferbuy</name>
4
- <version>1.1.3</version>
5
  <stability>stable</stability>
6
- <license uri="http://www.opensource.org/licenses/OSL-3.0">OSL 3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
- <summary>FerBuy Online Payments</summary>
10
- <description>FerBuy payments provides the possibility for your customers to pay by invoice. The FerBuy product is currently available in the following countries:&#xD;
11
- &#xD;
12
- Czech Republic - www.ferbuy.cz&#xD;
13
- Poland - www.ferbuy.pl&#xD;
14
- Singapore - www.ferbuy.com&#xD;
15
- &#xD;
16
- For more information, please visit your local FerBuy website.</description>
17
- <notes>* Send shopping cart information to FerBuy&#xD;
18
- * Correct support for multi-currency shops</notes>
19
- <authors><author><name>ferbuy</name><user>auto-converted</user><email>info@ferbuy.com</email></author></authors>
20
- <date>2013-08-22</date>
21
- <time>09:00:13</time>
22
- <contents><target name="magelocal"><dir name="Ferratum"><dir name="Ferbuy"><dir name="Block"><file name="Redirect.php" hash="3c997c3d6741a67daca980dd5bea6b54"/></dir><dir name="Helper"><file name="Data.php" hash="57656afd9b7578c100e551cd7c661319"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Source"><file name="Modes.php" hash="8745cabaaf2ba688aa07773eb9e4507c"/></dir></dir></dir></dir><file name="Base.php" hash="95df7645281b6da83a11d5d5b6aab321"/><file name="Ferbuy.php" hash="40cfe8b707e4b1536113b83e1cafc006"/></dir><dir name="controllers"><file name="PaymentController.php" hash="d077d19ef89a7233e28da89bb5f212a8"/></dir><dir name="etc"><file name="adminhtml.xml" hash="3ef2013840386516ff6700925b8d3d89"/><file name="config.xml" hash="cddc8f84e0433210de6e677e39487cc3"/><file name="system.xml" hash="6867d0d6cd45adaf384f6069fbe2a4e4"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><file name="ferbuy.xml" hash=""/></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="ferbuy"><file name="redirect.phtml" hash="5e1940098954f124ea7b9b973ba94e72"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Ferratum_Ferbuy.xml" hash="63ac15b41485745bc375b770d71530f4"/></dir></target></contents>
23
  <compatible/>
24
- <dependencies/>
25
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Ferratum_Ferbuy</name>
4
+ <version>1.2.0</version>
5
  <stability>stable</stability>
6
+ <license>OSL</license>
7
  <channel>community</channel>
8
  <extends/>
9
+ <summary>FerBuy "Buy now, Pay later" extension for Magento 1.5 and higher</summary>
10
+ <description>FerBuy is a simple and safe payment solution based on the "buy now, pay later" concept. Through FerBuy you can shop from home and pay after delivery. This gives your customers the chance to see the product before they have to pay for it.&#xD;
11
+ </description>
12
+ <notes>FerBuy is now active in Bulgaria! Visit www.ferbuy.bg for more information.</notes>
13
+ <authors><author><name>Fer Buy</name><user>ferbuy</user><email>bjorn.zwaaneveld@ferbuy.com</email></author></authors>
14
+ <date>2015-05-02</date>
15
+ <time>06:13:17</time>
16
+ <contents><target name="magelocal"><dir name="."><dir name="app"><dir name="design"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="ferbuy.xml" hash=""/></dir></dir></dir></dir></dir><dir name="etc"><dir name="modules"><file name="Ferratum_Ferbuy.xml" hash=""/></dir><dir name="locale"><dir name="bg_BG"><file name="Ferratum_Ferbuy.xml" hash=""/></dir><dir name="en_US"><file name="Ferratum_Ferbuy.xml" hash=""/></dir></dir></dir></dir></dir></target></contents>
 
 
 
 
 
 
17
  <compatible/>
18
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php><extension><name>curl</name><min></min><max></max></extension></required></dependencies>
19
  </package>