Sirateck_Lemonway4ec - Version 1.0.1

Version Notes

- Add ecommerce route by default

Download this release

Release Info

Developer Thomas Roche
Extension Sirateck_Lemonway4ec
Version 1.0.1
Comparing to
See all releases


Version 1.0.1

Files changed (54) hide show
  1. app/code/community/Sirateck/Lemonway4ec/Block/Adminhtml/Moneyout.php +106 -0
  2. app/code/community/Sirateck/Lemonway4ec/Block/Adminhtml/Wallet.php +43 -0
  3. app/code/community/Sirateck/Lemonway4ec/Block/Adminhtml/Wallet/Edit.php +82 -0
  4. app/code/community/Sirateck/Lemonway4ec/Block/Adminhtml/Wallet/Edit/Form.php +52 -0
  5. app/code/community/Sirateck/Lemonway4ec/Block/Adminhtml/Wallet/Edit/Tab/Form.php +424 -0
  6. app/code/community/Sirateck/Lemonway4ec/Block/Adminhtml/Wallet/Edit/Tabs.php +74 -0
  7. app/code/community/Sirateck/Lemonway4ec/Block/Adminhtml/Wallet/Grid.php +636 -0
  8. app/code/community/Sirateck/Lemonway4ec/Block/Form/Webkit.php +97 -0
  9. app/code/community/Sirateck/Lemonway4ec/Block/Info/Webkit.php +52 -0
  10. app/code/community/Sirateck/Lemonway4ec/Controller/Adminhtml/Lemonway.php +60 -0
  11. app/code/community/Sirateck/Lemonway4ec/Helper/Data.php +86 -0
  12. app/code/community/Sirateck/Lemonway4ec/Model/Adminhtml/Search/Wallet.php +60 -0
  13. app/code/community/Sirateck/Lemonway4ec/Model/Apikit/Apimodels/Iban.php +26 -0
  14. app/code/community/Sirateck/Lemonway4ec/Model/Apikit/Apimodels/KycDoc.php +36 -0
  15. app/code/community/Sirateck/Lemonway4ec/Model/Apikit/Apimodels/LwError.php +19 -0
  16. app/code/community/Sirateck/Lemonway4ec/Model/Apikit/Apimodels/LwModel.php +5 -0
  17. app/code/community/Sirateck/Lemonway4ec/Model/Apikit/Apimodels/Operation.php +93 -0
  18. app/code/community/Sirateck/Lemonway4ec/Model/Apikit/Apimodels/SddMandate.php +42 -0
  19. app/code/community/Sirateck/Lemonway4ec/Model/Apikit/Apimodels/Wallet.php +44 -0
  20. app/code/community/Sirateck/Lemonway4ec/Model/Apikit/Apiresponse.php +55 -0
  21. app/code/community/Sirateck/Lemonway4ec/Model/Apikit/Kit.php +300 -0
  22. app/code/community/Sirateck/Lemonway4ec/Model/Attribute/Source/Country.php +47 -0
  23. app/code/community/Sirateck/Lemonway4ec/Model/Config.php +157 -0
  24. app/code/community/Sirateck/Lemonway4ec/Model/Iban.php +106 -0
  25. app/code/community/Sirateck/Lemonway4ec/Model/Method/Webkit.php +274 -0
  26. app/code/community/Sirateck/Lemonway4ec/Model/Moneyout.php +90 -0
  27. app/code/community/Sirateck/Lemonway4ec/Model/Observer.php +53 -0
  28. app/code/community/Sirateck/Lemonway4ec/Model/Resource/Iban.php +37 -0
  29. app/code/community/Sirateck/Lemonway4ec/Model/Resource/Iban/Collection.php +84 -0
  30. app/code/community/Sirateck/Lemonway4ec/Model/Resource/Moneyout.php +37 -0
  31. app/code/community/Sirateck/Lemonway4ec/Model/Resource/Moneyout/Collection.php +84 -0
  32. app/code/community/Sirateck/Lemonway4ec/Model/Resource/Setup.php +26 -0
  33. app/code/community/Sirateck/Lemonway4ec/Model/Resource/Wallet.php +37 -0
  34. app/code/community/Sirateck/Lemonway4ec/Model/Resource/Wallet/Collection.php +84 -0
  35. app/code/community/Sirateck/Lemonway4ec/Model/Wallet.php +129 -0
  36. app/code/community/Sirateck/Lemonway4ec/Model/Wallet/Attribute/Source/Payerorbeneficiary.php +97 -0
  37. app/code/community/Sirateck/Lemonway4ec/controllers/Adminhtml/Lemonway/MoneyoutController.php +134 -0
  38. app/code/community/Sirateck/Lemonway4ec/controllers/Adminhtml/Lemonway/WalletController.php +662 -0
  39. app/code/community/Sirateck/Lemonway4ec/controllers/PaymentController.php +308 -0
  40. app/code/community/Sirateck/Lemonway4ec/etc/adminhtml.xml +69 -0
  41. app/code/community/Sirateck/Lemonway4ec/etc/config.xml +157 -0
  42. app/code/community/Sirateck/Lemonway4ec/etc/system.xml +201 -0
  43. app/code/community/Sirateck/Lemonway4ec/sql/sirateck_lemonway4ec_setup/install-0.1.0.php +246 -0
  44. app/code/community/Sirateck/Lemonway4ec/sql/sirateck_lemonway4ec_setup/mysql4-upgrade-0.1.0-0.1.1.php +59 -0
  45. app/code/community/Sirateck/Lemonway4ec/sql/sirateck_lemonway4ec_setup/mysql4-upgrade-0.1.1-0.1.2.php +115 -0
  46. app/code/community/Sirateck/Lemonway4ec/sql/sirateck_lemonway4ec_setup/mysql4-upgrade-0.1.4-0.1.5.php +63 -0
  47. app/design/adminhtml/default/default/layout/sirateck_lemonway4ec.xml +64 -0
  48. app/design/adminhtml/default/default/template/lemonway4ec/moneyout.phtml +191 -0
  49. app/design/frontend/base/default/template/lemonway4ec/form/webkit.phtml +81 -0
  50. app/design/frontend/base/default/template/lemonway4ec/info/webkit.phtml +19 -0
  51. app/etc/modules/Sirateck_Lemonway4ec.xml +29 -0
  52. app/locale/en_US/Sirateck_Lemonway4ec.csv +153 -0
  53. app/locale/fr_FR/Sirateck_Lemonway4ec.csv +153 -0
  54. package.xml +2 -0
app/code/community/Sirateck/Lemonway4ec/Block/Adminhtml/Moneyout.php ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sirateck_Lemonway4ec extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Sirateck
13
+ * @package Sirateck_Lemonway4ec
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Wallet admin block
19
+ *
20
+ * @category Sirateck
21
+ * @package Sirateck_Lemonway4ec
22
+ * @author Kassim Belghait kassim@sirateck.com
23
+ */
24
+ class Sirateck_Lemonway4ec_Block_Adminhtml_Moneyout extends Mage_Adminhtml_Block_Template
25
+ {
26
+ protected $_walletDetails = null;
27
+
28
+
29
+ protected function _prepareLayout(){
30
+ $this->setChild(
31
+ 'submit_button',
32
+ $this->getLayout()->createBlock('adminhtml/widget_button')->setData(array(
33
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Pay'),
34
+ 'class' => 'save submit-button',
35
+ 'onclick' => 'moneyoutForm.submit()',
36
+ ))
37
+ );
38
+ }
39
+
40
+ /**
41
+ * Get page header text
42
+ *
43
+ * @return string
44
+ */
45
+ protected function getHeader()
46
+ {
47
+ return $this->__("Money out");
48
+ }
49
+
50
+ /**
51
+ * Get html code of pay button
52
+ *
53
+ * @return string
54
+ */
55
+ protected function getPayButtonHtml()
56
+ {
57
+ return $this->getChildHtml('pay_button');
58
+ }
59
+
60
+ /**
61
+ * Get process pay url
62
+ *
63
+ * @return string
64
+ */
65
+ public function getPayFormAction()
66
+ {
67
+ return $this->getUrl('*/*/payPost');
68
+ }
69
+
70
+ /**
71
+ * Check if main wallet is configured and if Iban is present
72
+ * @TODO check validation (wallet exist and have a positive balance,iban exist and status is ok)
73
+ * @return bool
74
+ */
75
+ public function canPayMoneyOut()
76
+ {
77
+ return !$this->getWalletDetails()->lwError && count($this->getWalletDetails()->wallet->getIbans());
78
+ }
79
+
80
+ public function formatPrice($price){
81
+
82
+ return Mage::helper('core')->formatPrice($price);
83
+ }
84
+
85
+
86
+ /**
87
+ * @return Sirateck_Lemonway4ec_Model_Apikit_Apiresponse
88
+ */
89
+ public function getWalletDetails(){
90
+ if(is_null($this->_walletDetails))
91
+ {
92
+ /* @var $_helper Sirateck_Lemonway4ec_Helper_Data */
93
+ $_helper = $this->helper('sirateck_lemonway4ec');
94
+ $params = array("wallet"=>$_helper->getConfig()->getWalletMerchantId()
95
+ );
96
+
97
+ $this->_walletDetails = Mage::getSingleton('sirateck_lemonway4ec/apikit_kit')->GetWalletDetails($params);
98
+
99
+ }
100
+
101
+ return $this->_walletDetails;
102
+
103
+ }
104
+
105
+
106
+ }
app/code/community/Sirateck/Lemonway4ec/Block/Adminhtml/Wallet.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sirateck_Lemonway4ec extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Sirateck
13
+ * @package Sirateck_Lemonway4ec
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Wallet admin block
19
+ *
20
+ * @category Sirateck
21
+ * @package Sirateck_Lemonway4ec
22
+ * @author Kassim Belghait kassim@sirateck.com
23
+ */
24
+ class Sirateck_Lemonway4ec_Block_Adminhtml_Wallet extends Mage_Adminhtml_Block_Widget_Grid_Container
25
+ {
26
+ /**
27
+ * constructor
28
+ *
29
+ * @access public
30
+ * @return void
31
+ * @author Kassim Belghait kassim@sirateck.com
32
+ */
33
+ public function __construct()
34
+ {
35
+ $this->_controller = 'adminhtml_wallet';
36
+ $this->_blockGroup = 'sirateck_lemonway4ec';
37
+ parent::__construct();
38
+ $this->_headerText = Mage::helper('sirateck_lemonway4ec')->__('Wallet');
39
+ $this->_removeButton('add');
40
+ //$this->_updateButton('add', 'label', Mage::helper('sirateck_lemonway4ec')->__('Add Wallet'));
41
+
42
+ }
43
+ }
app/code/community/Sirateck/Lemonway4ec/Block/Adminhtml/Wallet/Edit.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sirateck_Lemonway4ec extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Sirateck
13
+ * @package Sirateck_Lemonway4ec
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Wallet admin edit form
19
+ *
20
+ * @category Sirateck
21
+ * @package Sirateck_Lemonway4ec
22
+ * @author Kassim Belghait kassim@sirateck.com
23
+ */
24
+ class Sirateck_Lemonway4ec_Block_Adminhtml_Wallet_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
25
+ {
26
+ /**
27
+ * constructor
28
+ *
29
+ * @access public
30
+ * @return void
31
+ * @author Kassim Belghait kassim@sirateck.com
32
+ */
33
+ public function __construct()
34
+ {
35
+ parent::__construct();
36
+ $this->_blockGroup = 'sirateck_lemonway4ec';
37
+ $this->_controller = 'adminhtml_wallet';
38
+ $this->_updateButton(
39
+ 'save',
40
+ 'label',
41
+ Mage::helper('sirateck_lemonway4ec')->__('Save Wallet')
42
+ );
43
+ $this->_updateButton(
44
+ 'delete',
45
+ 'label',
46
+ Mage::helper('sirateck_lemonway4ec')->__('Delete Wallet')
47
+ );
48
+ $this->_addButton(
49
+ 'saveandcontinue',
50
+ array(
51
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Save And Continue Edit'),
52
+ 'onclick' => 'saveAndContinueEdit()',
53
+ 'class' => 'save',
54
+ ),
55
+ -100
56
+ );
57
+ $this->_formScripts[] = "
58
+ function saveAndContinueEdit() {
59
+ editForm.submit($('edit_form').action+'back/edit/');
60
+ }
61
+ ";
62
+ }
63
+
64
+ /**
65
+ * get the edit form header
66
+ *
67
+ * @access public
68
+ * @return string
69
+ * @author Kassim Belghait kassim@sirateck.com
70
+ */
71
+ public function getHeaderText()
72
+ {
73
+ if (Mage::registry('current_wallet') && Mage::registry('current_wallet')->getId()) {
74
+ return Mage::helper('sirateck_lemonway4ec')->__(
75
+ "Edit Wallet '%s'",
76
+ $this->escapeHtml(Mage::registry('current_wallet')->getWalletId())
77
+ );
78
+ } else {
79
+ return Mage::helper('sirateck_lemonway4ec')->__('Add Wallet');
80
+ }
81
+ }
82
+ }
app/code/community/Sirateck/Lemonway4ec/Block/Adminhtml/Wallet/Edit/Form.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sirateck_Lemonway4ec extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Sirateck
13
+ * @package Sirateck_Lemonway4ec
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Wallet edit form
19
+ *
20
+ * @category Sirateck
21
+ * @package Sirateck_Lemonway4ec
22
+ * @author Kassim Belghait kassim@sirateck.com
23
+ */
24
+ class Sirateck_Lemonway4ec_Block_Adminhtml_Wallet_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
25
+ {
26
+ /**
27
+ * prepare form
28
+ *
29
+ * @access protected
30
+ * @return Sirateck_Lemonway4ec_Block_Adminhtml_Wallet_Edit_Form
31
+ * @author Kassim Belghait kassim@sirateck.com
32
+ */
33
+ protected function _prepareForm()
34
+ {
35
+ $form = new Varien_Data_Form(
36
+ array(
37
+ 'id' => 'edit_form',
38
+ 'action' => $this->getUrl(
39
+ '*/*/save',
40
+ array(
41
+ 'id' => $this->getRequest()->getParam('id')
42
+ )
43
+ ),
44
+ 'method' => 'post',
45
+ 'enctype' => 'multipart/form-data'
46
+ )
47
+ );
48
+ $form->setUseContainer(true);
49
+ $this->setForm($form);
50
+ return parent::_prepareForm();
51
+ }
52
+ }
app/code/community/Sirateck/Lemonway4ec/Block/Adminhtml/Wallet/Edit/Tab/Form.php ADDED
@@ -0,0 +1,424 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sirateck_Lemonway4ec extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Sirateck
13
+ * @package Sirateck_Lemonway4ec
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Wallet edit form tab
19
+ *
20
+ * @category Sirateck
21
+ * @package Sirateck_Lemonway4ec
22
+ * @author Kassim Belghait kassim@sirateck.com
23
+ */
24
+ class Sirateck_Lemonway4ec_Block_Adminhtml_Wallet_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
25
+ {
26
+ /**
27
+ * prepare the form
28
+ *
29
+ * @access protected
30
+ * @return Sirateck_Lemonway4ec_Block_Adminhtml_Wallet_Edit_Tab_Form
31
+ * @author Kassim Belghait kassim@sirateck.com
32
+ */
33
+ protected function _prepareForm()
34
+ {
35
+ $form = new Varien_Data_Form();
36
+ $form->setHtmlIdPrefix('wallet_');
37
+ $form->setFieldNameSuffix('wallet');
38
+ $this->setForm($form);
39
+ $fieldset = $form->addFieldset(
40
+ 'wallet_form',
41
+ array('legend' => Mage::helper('sirateck_lemonway4ec')->__('Wallet'))
42
+ );
43
+
44
+ $fieldset->addField(
45
+ 'lw_id',
46
+ 'text',
47
+ array(
48
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Lemonway ID'),
49
+ 'name' => 'lw_id',
50
+ 'required' => true,
51
+ 'class' => 'required-entry',
52
+
53
+ )
54
+ );
55
+
56
+ $fieldset->addField(
57
+ 'customer_id',
58
+ 'text',
59
+ array(
60
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Customer ID'),
61
+ 'name' => 'customer_id',
62
+ 'required' => true,
63
+ 'class' => 'required-entry',
64
+
65
+ )
66
+ );
67
+
68
+ $fieldset->addField(
69
+ 'wallet_id',
70
+ 'text',
71
+ array(
72
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Wallet ID'),
73
+ 'name' => 'wallet_id',
74
+ 'required' => true,
75
+ 'class' => 'required-entry',
76
+
77
+ )
78
+ );
79
+
80
+ $fieldset->addField(
81
+ 'is_admin',
82
+ 'select',
83
+ array(
84
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Is Admin'),
85
+ 'name' => 'is_admin',
86
+ 'required' => true,
87
+ 'class' => 'required-entry',
88
+
89
+ 'values'=> array(
90
+ array(
91
+ 'value' => 1,
92
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Yes'),
93
+ ),
94
+ array(
95
+ 'value' => 0,
96
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('No'),
97
+ ),
98
+ ),
99
+ )
100
+ );
101
+
102
+ $fieldset->addField(
103
+ 'customer_email',
104
+ 'text',
105
+ array(
106
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Email'),
107
+ 'name' => 'customer_email',
108
+ 'required' => true,
109
+ 'class' => 'required-entry',
110
+
111
+ )
112
+ );
113
+
114
+ $fieldset->addField(
115
+ 'customer_prefix',
116
+ 'text',
117
+ array(
118
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Prefix'),
119
+ 'name' => 'customer_prefix',
120
+ 'required' => true,
121
+ 'class' => 'required-entry',
122
+
123
+ )
124
+ );
125
+
126
+ $fieldset->addField(
127
+ 'customer_firstname',
128
+ 'text',
129
+ array(
130
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Firstname'),
131
+ 'name' => 'customer_firstname',
132
+ 'required' => true,
133
+ 'class' => 'required-entry',
134
+
135
+ )
136
+ );
137
+
138
+ $fieldset->addField(
139
+ 'customer_lastname',
140
+ 'text',
141
+ array(
142
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Lastname'),
143
+ 'name' => 'customer_lastname',
144
+ 'required' => true,
145
+ 'class' => 'required-entry',
146
+
147
+ )
148
+ );
149
+
150
+ $fieldset->addField(
151
+ 'billing_address_street',
152
+ 'text',
153
+ array(
154
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Street'),
155
+ 'name' => 'billing_address_street',
156
+
157
+ )
158
+ );
159
+
160
+ $fieldset->addField(
161
+ 'billing_address_postcode',
162
+ 'text',
163
+ array(
164
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Postcode'),
165
+ 'name' => 'billing_address_postcode',
166
+
167
+ )
168
+ );
169
+
170
+ $fieldset->addField(
171
+ 'billing_address_city',
172
+ 'text',
173
+ array(
174
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('City'),
175
+ 'name' => 'billing_address_city',
176
+
177
+ )
178
+ );
179
+
180
+ $fieldset->addField(
181
+ 'billing_address_country',
182
+ 'select',
183
+ array(
184
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Country'),
185
+ 'name' => 'billing_address_country',
186
+
187
+ 'values'=> Mage::getResourceModel('directory/country_collection')->toOptionArray(),
188
+ )
189
+ );
190
+
191
+ $fieldset->addField(
192
+ 'billing_address_phone',
193
+ 'text',
194
+ array(
195
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Phone Number'),
196
+ 'name' => 'billing_address_phone',
197
+
198
+ )
199
+ );
200
+
201
+ $fieldset->addField(
202
+ 'billing_address_mobile',
203
+ 'text',
204
+ array(
205
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Mobile Number'),
206
+ 'name' => 'billing_address_mobile',
207
+
208
+ )
209
+ );
210
+
211
+ $fieldset->addField(
212
+ 'customer_dob',
213
+ 'date',
214
+ array(
215
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Dob'),
216
+ 'name' => 'customer_dob',
217
+
218
+ 'image' => $this->getSkinUrl('images/grid-cal.gif'),
219
+ 'format' => Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT),
220
+ )
221
+ );
222
+
223
+ $fieldset->addField(
224
+ 'is_company',
225
+ 'select',
226
+ array(
227
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Is company'),
228
+ 'name' => 'is_company',
229
+
230
+ 'values'=> array(
231
+ array(
232
+ 'value' => 1,
233
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Yes'),
234
+ ),
235
+ array(
236
+ 'value' => 0,
237
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('No'),
238
+ ),
239
+ ),
240
+ )
241
+ );
242
+
243
+ $fieldset->addField(
244
+ 'company_name',
245
+ 'text',
246
+ array(
247
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Company name'),
248
+ 'name' => 'company_name',
249
+ 'required' => true,
250
+ 'class' => 'required-entry',
251
+
252
+ )
253
+ );
254
+
255
+ $fieldset->addField(
256
+ 'company_website',
257
+ 'text',
258
+ array(
259
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Company website'),
260
+ 'name' => 'company_website',
261
+ 'required' => true,
262
+ 'class' => 'required-entry',
263
+
264
+ )
265
+ );
266
+
267
+ $fieldset->addField(
268
+ 'company_description',
269
+ 'textarea',
270
+ array(
271
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Company description'),
272
+ 'name' => 'company_description',
273
+
274
+ )
275
+ );
276
+
277
+ $fieldset->addField(
278
+ 'company_id_number',
279
+ 'text',
280
+ array(
281
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Company ID number'),
282
+ 'name' => 'company_id_number',
283
+
284
+ )
285
+ );
286
+
287
+ $fieldset->addField(
288
+ 'is_debtor',
289
+ 'select',
290
+ array(
291
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Is debtor'),
292
+ 'name' => 'is_debtor',
293
+
294
+ 'values'=> array(
295
+ array(
296
+ 'value' => 1,
297
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Yes'),
298
+ ),
299
+ array(
300
+ 'value' => 0,
301
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('No'),
302
+ ),
303
+ ),
304
+ )
305
+ );
306
+
307
+ $fieldset->addField(
308
+ 'customer_nationality',
309
+ 'select',
310
+ array(
311
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Nationality'),
312
+ 'name' => 'customer_nationality',
313
+
314
+ 'values'=> Mage::getResourceModel('directory/country_collection')->toOptionArray(),
315
+ )
316
+ );
317
+
318
+ $fieldset->addField(
319
+ 'customer_birth_city',
320
+ 'text',
321
+ array(
322
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('City of Birth'),
323
+ 'name' => 'customer_birth_city',
324
+
325
+ )
326
+ );
327
+
328
+ $fieldset->addField(
329
+ 'customer_birth_country',
330
+ 'select',
331
+ array(
332
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Birth country'),
333
+ 'name' => 'customer_birth_country',
334
+
335
+ 'values'=> Mage::getResourceModel('directory/country_collection')->toOptionArray(),
336
+ )
337
+ );
338
+
339
+ $fieldset->addField(
340
+ 'payer_or_beneficiary',
341
+ 'select',
342
+ array(
343
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Payer or beneficiary'),
344
+ 'name' => 'payer_or_beneficiary',
345
+
346
+ 'values'=> Mage::getModel('sirateck_lemonway4ec/wallet_attribute_source_payerorbeneficiary')->getAllOptions(true),
347
+ )
348
+ );
349
+
350
+ $fieldset->addField(
351
+ 'is_onetime_customer',
352
+ 'select',
353
+ array(
354
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Is One time customer'),
355
+ 'name' => 'is_onetime_customer',
356
+ 'required' => true,
357
+ 'class' => 'required-entry',
358
+
359
+ 'values'=> array(
360
+ array(
361
+ 'value' => 1,
362
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Yes'),
363
+ ),
364
+ array(
365
+ 'value' => 0,
366
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('No'),
367
+ ),
368
+ ),
369
+ )
370
+ );
371
+
372
+ $fieldset->addField(
373
+ 'is_default',
374
+ 'select',
375
+ array(
376
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Is default'),
377
+ 'name' => 'is_default',
378
+ 'required' => true,
379
+ 'class' => 'required-entry',
380
+
381
+ 'values'=> array(
382
+ array(
383
+ 'value' => 1,
384
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Yes'),
385
+ ),
386
+ array(
387
+ 'value' => 0,
388
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('No'),
389
+ ),
390
+ ),
391
+ )
392
+ );
393
+ $fieldset->addField(
394
+ 'status',
395
+ 'select',
396
+ array(
397
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Status'),
398
+ 'name' => 'status',
399
+ 'values' => array(
400
+ array(
401
+ 'value' => 1,
402
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Enabled'),
403
+ ),
404
+ array(
405
+ 'value' => 0,
406
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Disabled'),
407
+ ),
408
+ ),
409
+ )
410
+ );
411
+ $formValues = Mage::registry('current_wallet')->getDefaultValues();
412
+ if (!is_array($formValues)) {
413
+ $formValues = array();
414
+ }
415
+ if (Mage::getSingleton('adminhtml/session')->getWalletData()) {
416
+ $formValues = array_merge($formValues, Mage::getSingleton('adminhtml/session')->getWalletData());
417
+ Mage::getSingleton('adminhtml/session')->setWalletData(null);
418
+ } elseif (Mage::registry('current_wallet')) {
419
+ $formValues = array_merge($formValues, Mage::registry('current_wallet')->getData());
420
+ }
421
+ $form->setValues($formValues);
422
+ return parent::_prepareForm();
423
+ }
424
+ }
app/code/community/Sirateck/Lemonway4ec/Block/Adminhtml/Wallet/Edit/Tabs.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sirateck_Lemonway4ec extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Sirateck
13
+ * @package Sirateck_Lemonway4ec
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Wallet admin edit tabs
19
+ *
20
+ * @category Sirateck
21
+ * @package Sirateck_Lemonway4ec
22
+ * @author Kassim Belghait kassim@sirateck.com
23
+ */
24
+ class Sirateck_Lemonway4ec_Block_Adminhtml_Wallet_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
25
+ {
26
+ /**
27
+ * Initialize Tabs
28
+ *
29
+ * @access public
30
+ * @author Kassim Belghait kassim@sirateck.com
31
+ */
32
+ public function __construct()
33
+ {
34
+ parent::__construct();
35
+ $this->setId('wallet_tabs');
36
+ $this->setDestElementId('edit_form');
37
+ $this->setTitle(Mage::helper('sirateck_lemonway4ec')->__('Wallet'));
38
+ }
39
+
40
+ /**
41
+ * before render html
42
+ *
43
+ * @access protected
44
+ * @return Sirateck_Lemonway4ec_Block_Adminhtml_Wallet_Edit_Tabs
45
+ * @author Kassim Belghait kassim@sirateck.com
46
+ */
47
+ protected function _beforeToHtml()
48
+ {
49
+ $this->addTab(
50
+ 'form_wallet',
51
+ array(
52
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Wallet'),
53
+ 'title' => Mage::helper('sirateck_lemonway4ec')->__('Wallet'),
54
+ 'content' => $this->getLayout()->createBlock(
55
+ 'sirateck_lemonway4ec/adminhtml_wallet_edit_tab_form'
56
+ )
57
+ ->toHtml(),
58
+ )
59
+ );
60
+ return parent::_beforeToHtml();
61
+ }
62
+
63
+ /**
64
+ * Retrieve wallet entity
65
+ *
66
+ * @access public
67
+ * @return Sirateck_Lemonway4ec_Model_Wallet
68
+ * @author Kassim Belghait kassim@sirateck.com
69
+ */
70
+ public function getWallet()
71
+ {
72
+ return Mage::registry('current_wallet');
73
+ }
74
+ }
app/code/community/Sirateck/Lemonway4ec/Block/Adminhtml/Wallet/Grid.php ADDED
@@ -0,0 +1,636 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sirateck_Lemonway4ec extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Sirateck
13
+ * @package Sirateck_Lemonway4ec
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Wallet admin grid block
19
+ *
20
+ * @category Sirateck
21
+ * @package Sirateck_Lemonway4ec
22
+ * @author Kassim Belghait kassim@sirateck.com
23
+ */
24
+ class Sirateck_Lemonway4ec_Block_Adminhtml_Wallet_Grid extends Mage_Adminhtml_Block_Widget_Grid
25
+ {
26
+ /**
27
+ * constructor
28
+ *
29
+ * @access public
30
+ * @author Kassim Belghait kassim@sirateck.com
31
+ */
32
+ public function __construct()
33
+ {
34
+ parent::__construct();
35
+ $this->setId('walletGrid');
36
+ $this->setDefaultSort('entity_id');
37
+ $this->setDefaultDir('ASC');
38
+ $this->setSaveParametersInSession(true);
39
+ $this->setUseAjax(true);
40
+ }
41
+
42
+ /**
43
+ * prepare collection
44
+ *
45
+ * @access protected
46
+ * @return Sirateck_Lemonway4ec_Block_Adminhtml_Wallet_Grid
47
+ * @author Kassim Belghait kassim@sirateck.com
48
+ */
49
+ protected function _prepareCollection()
50
+ {
51
+ $collection = Mage::getModel('sirateck_lemonway4ec/wallet')
52
+ ->getCollection();
53
+
54
+ $this->setCollection($collection);
55
+ return parent::_prepareCollection();
56
+ }
57
+
58
+ /**
59
+ * prepare grid collection
60
+ *
61
+ * @access protected
62
+ * @return Sirateck_Lemonway4ec_Block_Adminhtml_Wallet_Grid
63
+ * @author Kassim Belghait kassim@sirateck.com
64
+ */
65
+ protected function _prepareColumns()
66
+ {
67
+ $this->addColumn(
68
+ 'entity_id',
69
+ array(
70
+ 'header' => Mage::helper('sirateck_lemonway4ec')->__('Id'),
71
+ 'index' => 'entity_id',
72
+ 'type' => 'number'
73
+ )
74
+ );
75
+ $this->addColumn(
76
+ 'wallet_id',
77
+ array(
78
+ 'header' => Mage::helper('sirateck_lemonway4ec')->__('Wallet ID'),
79
+ 'align' => 'left',
80
+ 'index' => 'wallet_id',
81
+ )
82
+ );
83
+
84
+ /* $options = array();
85
+ foreach (Sirateck_Lemonway4ec_Model_Wallet::$statuesLabel as $key=>$label){
86
+ $options[$key] = Mage::helper('sirateck_lemonway4ec')->__($label);
87
+ }
88
+
89
+ $this->addColumn(
90
+ 'status',
91
+ array(
92
+ 'header' => Mage::helper('sirateck_lemonway4ec')->__('Status'),
93
+ 'index' => 'status',
94
+ 'type' => 'options',
95
+ 'options' => $options
96
+ )
97
+ );
98
+ $this->addColumn(
99
+ 'lw_id',
100
+ array(
101
+ 'header' => Mage::helper('sirateck_lemonway4ec')->__('Lemonway ID'),
102
+ 'index' => 'lw_id',
103
+ 'type'=> 'text',
104
+
105
+ )
106
+ );*/
107
+ $this->addColumn(
108
+ 'customer_id',
109
+ array(
110
+ 'header' => Mage::helper('sirateck_lemonway4ec')->__('Customer ID'),
111
+ 'index' => 'customer_id',
112
+ 'type'=> 'number',
113
+
114
+ )
115
+ );
116
+ $this->addColumn(
117
+ 'is_admin',
118
+ array(
119
+ 'header' => Mage::helper('sirateck_lemonway4ec')->__('Is Admin'),
120
+ 'index' => 'is_admin',
121
+ 'type' => 'options',
122
+ 'options' => array(
123
+ '1' => Mage::helper('sirateck_lemonway4ec')->__('Yes'),
124
+ '0' => Mage::helper('sirateck_lemonway4ec')->__('No'),
125
+ )
126
+
127
+ )
128
+ );
129
+ $this->addColumn(
130
+ 'customer_email',
131
+ array(
132
+ 'header' => Mage::helper('sirateck_lemonway4ec')->__('Email'),
133
+ 'index' => 'customer_email',
134
+ 'type'=> 'text',
135
+
136
+ )
137
+ );
138
+ /* $this->addColumn(
139
+ 'customer_prefix',
140
+ array(
141
+ 'header' => Mage::helper('sirateck_lemonway4ec')->__('Prefix'),
142
+ 'index' => 'customer_prefix',
143
+ 'type'=> 'text',
144
+
145
+ )
146
+ );
147
+ $this->addColumn(
148
+ 'customer_firstname',
149
+ array(
150
+ 'header' => Mage::helper('sirateck_lemonway4ec')->__('Firstname'),
151
+ 'index' => 'customer_firstname',
152
+ 'type'=> 'text',
153
+
154
+ )
155
+ );
156
+ $this->addColumn(
157
+ 'customer_lastname',
158
+ array(
159
+ 'header' => Mage::helper('sirateck_lemonway4ec')->__('Lastname'),
160
+ 'index' => 'customer_lastname',
161
+ 'type'=> 'text',
162
+
163
+ )
164
+ );
165
+ $this->addColumn(
166
+ 'billing_address_street',
167
+ array(
168
+ 'header' => Mage::helper('sirateck_lemonway4ec')->__('Street'),
169
+ 'index' => 'billing_address_street',
170
+ 'type'=> 'text',
171
+
172
+ )
173
+ );
174
+ $this->addColumn(
175
+ 'billing_address_postcode',
176
+ array(
177
+ 'header' => Mage::helper('sirateck_lemonway4ec')->__('Postcode'),
178
+ 'index' => 'billing_address_postcode',
179
+ 'type'=> 'text',
180
+
181
+ )
182
+ );
183
+ $this->addColumn(
184
+ 'billing_address_city',
185
+ array(
186
+ 'header' => Mage::helper('sirateck_lemonway4ec')->__('City'),
187
+ 'index' => 'billing_address_city',
188
+ 'type'=> 'text',
189
+
190
+ )
191
+ );
192
+ $this->addColumn(
193
+ 'billing_address_country',
194
+ array(
195
+ 'header' => Mage::helper('sirateck_lemonway4ec')->__('Country'),
196
+ 'index' => 'billing_address_country',
197
+ 'type'=> 'country',
198
+
199
+ )
200
+ );
201
+ $this->addColumn(
202
+ 'billing_address_phone',
203
+ array(
204
+ 'header' => Mage::helper('sirateck_lemonway4ec')->__('Phone Number'),
205
+ 'index' => 'billing_address_phone',
206
+ 'type'=> 'text',
207
+
208
+ )
209
+ );
210
+ $this->addColumn(
211
+ 'billing_address_mobile',
212
+ array(
213
+ 'header' => Mage::helper('sirateck_lemonway4ec')->__('Mobile Number'),
214
+ 'index' => 'billing_address_mobile',
215
+ 'type'=> 'text',
216
+
217
+ )
218
+ );
219
+ $this->addColumn(
220
+ 'customer_dob',
221
+ array(
222
+ 'header' => Mage::helper('sirateck_lemonway4ec')->__('Dob'),
223
+ 'index' => 'customer_dob',
224
+ 'type'=> 'date',
225
+
226
+ )
227
+ );
228
+ $this->addColumn(
229
+ 'is_company',
230
+ array(
231
+ 'header' => Mage::helper('sirateck_lemonway4ec')->__('Is company'),
232
+ 'index' => 'is_company',
233
+ 'type' => 'options',
234
+ 'options' => array(
235
+ '1' => Mage::helper('sirateck_lemonway4ec')->__('Yes'),
236
+ '0' => Mage::helper('sirateck_lemonway4ec')->__('No'),
237
+ )
238
+
239
+ )
240
+ );
241
+ $this->addColumn(
242
+ 'company_name',
243
+ array(
244
+ 'header' => Mage::helper('sirateck_lemonway4ec')->__('Company name'),
245
+ 'index' => 'company_name',
246
+ 'type'=> 'text',
247
+
248
+ )
249
+ );
250
+ $this->addColumn(
251
+ 'company_website',
252
+ array(
253
+ 'header' => Mage::helper('sirateck_lemonway4ec')->__('Company website'),
254
+ 'index' => 'company_website',
255
+ 'type'=> 'text',
256
+
257
+ )
258
+ );
259
+ $this->addColumn(
260
+ 'company_id_number',
261
+ array(
262
+ 'header' => Mage::helper('sirateck_lemonway4ec')->__('Company ID number'),
263
+ 'index' => 'company_id_number',
264
+ 'type'=> 'text',
265
+
266
+ )
267
+ );
268
+ $this->addColumn(
269
+ 'is_debtor',
270
+ array(
271
+ 'header' => Mage::helper('sirateck_lemonway4ec')->__('Is debtor'),
272
+ 'index' => 'is_debtor',
273
+ 'type' => 'options',
274
+ 'options' => array(
275
+ '1' => Mage::helper('sirateck_lemonway4ec')->__('Yes'),
276
+ '0' => Mage::helper('sirateck_lemonway4ec')->__('No'),
277
+ )
278
+
279
+ )
280
+ );
281
+ $this->addColumn(
282
+ 'customer_nationality',
283
+ array(
284
+ 'header' => Mage::helper('sirateck_lemonway4ec')->__('Nationality'),
285
+ 'index' => 'customer_nationality',
286
+ 'type'=> 'country',
287
+
288
+ )
289
+ );
290
+ $this->addColumn(
291
+ 'customer_birth_city',
292
+ array(
293
+ 'header' => Mage::helper('sirateck_lemonway4ec')->__('City of Birth'),
294
+ 'index' => 'customer_birth_city',
295
+ 'type'=> 'text',
296
+
297
+ )
298
+ );
299
+ $this->addColumn(
300
+ 'customer_birth_country',
301
+ array(
302
+ 'header' => Mage::helper('sirateck_lemonway4ec')->__('Birth country'),
303
+ 'index' => 'customer_birth_country',
304
+ 'type'=> 'country',
305
+
306
+ )
307
+ );
308
+ $this->addColumn(
309
+ 'payer_or_beneficiary',
310
+ array(
311
+ 'header' => Mage::helper('sirateck_lemonway4ec')->__('Payer or beneficiary'),
312
+ 'index' => 'payer_or_beneficiary',
313
+ 'type' => 'options',
314
+ 'options' => Mage::helper('sirateck_lemonway4ec')->convertOptions(
315
+ Mage::getModel('sirateck_lemonway4ec/wallet_attribute_source_payerorbeneficiary')->getAllOptions(false)
316
+ )
317
+
318
+ )
319
+ );
320
+ $this->addColumn(
321
+ 'is_onetime_customer',
322
+ array(
323
+ 'header' => Mage::helper('sirateck_lemonway4ec')->__('Is One time customer'),
324
+ 'index' => 'is_onetime_customer',
325
+ 'type' => 'options',
326
+ 'options' => array(
327
+ '1' => Mage::helper('sirateck_lemonway4ec')->__('Yes'),
328
+ '0' => Mage::helper('sirateck_lemonway4ec')->__('No'),
329
+ )
330
+
331
+ )
332
+ );
333
+ $this->addColumn(
334
+ 'is_default',
335
+ array(
336
+ 'header' => Mage::helper('sirateck_lemonway4ec')->__('Is default'),
337
+ 'index' => 'is_default',
338
+ 'type' => 'options',
339
+ 'options' => array(
340
+ '1' => Mage::helper('sirateck_lemonway4ec')->__('Yes'),
341
+ '0' => Mage::helper('sirateck_lemonway4ec')->__('No'),
342
+ )
343
+
344
+ )
345
+ ); */
346
+ $this->addColumn(
347
+ 'created_at',
348
+ array(
349
+ 'header' => Mage::helper('sirateck_lemonway4ec')->__('Created at'),
350
+ 'index' => 'created_at',
351
+ 'width' => '120px',
352
+ 'type' => 'datetime',
353
+ )
354
+ );
355
+ $this->addColumn(
356
+ 'updated_at',
357
+ array(
358
+ 'header' => Mage::helper('sirateck_lemonway4ec')->__('Updated at'),
359
+ 'index' => 'updated_at',
360
+ 'width' => '120px',
361
+ 'type' => 'datetime',
362
+ )
363
+ );
364
+ $this->addColumn(
365
+ 'action',
366
+ array(
367
+ 'header' => Mage::helper('sirateck_lemonway4ec')->__('Action'),
368
+ 'width' => '100',
369
+ 'type' => 'action',
370
+ 'getter' => 'getId',
371
+ 'actions' => array(
372
+ array(
373
+ 'caption' => Mage::helper('sirateck_lemonway4ec')->__('Edit'),
374
+ 'url' => array('base'=> '*/*/edit'),
375
+ 'field' => 'id'
376
+ )
377
+ ),
378
+ 'filter' => false,
379
+ 'is_system' => true,
380
+ 'sortable' => false,
381
+ )
382
+ );
383
+ $this->addExportType('*/*/exportCsv', Mage::helper('sirateck_lemonway4ec')->__('CSV'));
384
+ $this->addExportType('*/*/exportExcel', Mage::helper('sirateck_lemonway4ec')->__('Excel'));
385
+ $this->addExportType('*/*/exportXml', Mage::helper('sirateck_lemonway4ec')->__('XML'));
386
+ return parent::_prepareColumns();
387
+ }
388
+
389
+ /**
390
+ * prepare mass action
391
+ *
392
+ * @access protected
393
+ * @return Sirateck_Lemonway4ec_Block_Adminhtml_Wallet_Grid
394
+ * @author Kassim Belghait kassim@sirateck.com
395
+ */
396
+ protected function _prepareMassaction()
397
+ {
398
+ $this->setMassactionIdField('entity_id');
399
+ $this->getMassactionBlock()->setFormFieldName('wallet');
400
+ $this->getMassactionBlock()->addItem(
401
+ 'delete',
402
+ array(
403
+ 'label'=> Mage::helper('sirateck_lemonway4ec')->__('Delete'),
404
+ 'url' => $this->getUrl('*/*/massDelete'),
405
+ 'confirm' => Mage::helper('sirateck_lemonway4ec')->__('Are you sure?')
406
+ )
407
+ );
408
+ $this->getMassactionBlock()->addItem(
409
+ 'status',
410
+ array(
411
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Change status'),
412
+ 'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
413
+ 'additional' => array(
414
+ 'status' => array(
415
+ 'name' => 'status',
416
+ 'type' => 'select',
417
+ 'class' => 'required-entry',
418
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Status'),
419
+ 'values' => array(
420
+ '1' => Mage::helper('sirateck_lemonway4ec')->__('Enabled'),
421
+ '0' => Mage::helper('sirateck_lemonway4ec')->__('Disabled'),
422
+ )
423
+ )
424
+ )
425
+ )
426
+ );
427
+ $this->getMassactionBlock()->addItem(
428
+ 'is_admin',
429
+ array(
430
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Change Is Admin'),
431
+ 'url' => $this->getUrl('*/*/massIsAdmin', array('_current'=>true)),
432
+ 'additional' => array(
433
+ 'flag_is_admin' => array(
434
+ 'name' => 'flag_is_admin',
435
+ 'type' => 'select',
436
+ 'class' => 'required-entry',
437
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Is Admin'),
438
+ 'values' => array(
439
+ '1' => Mage::helper('sirateck_lemonway4ec')->__('Yes'),
440
+ '0' => Mage::helper('sirateck_lemonway4ec')->__('No'),
441
+ )
442
+
443
+ )
444
+ )
445
+ )
446
+ );
447
+ $this->getMassactionBlock()->addItem(
448
+ 'billing_address_country',
449
+ array(
450
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Change Country'),
451
+ 'url' => $this->getUrl('*/*/massBillingAddressCountry', array('_current'=>true)),
452
+ 'additional' => array(
453
+ 'flag_billing_address_country' => array(
454
+ 'name' => 'flag_billing_address_country',
455
+ 'type' => 'select',
456
+ 'class' => 'required-entry',
457
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Country'),
458
+ 'values' => Mage::getResourceModel('directory/country_collection')->toOptionArray()
459
+
460
+ )
461
+ )
462
+ )
463
+ );
464
+ $this->getMassactionBlock()->addItem(
465
+ 'is_company',
466
+ array(
467
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Change Is company'),
468
+ 'url' => $this->getUrl('*/*/massIsCompany', array('_current'=>true)),
469
+ 'additional' => array(
470
+ 'flag_is_company' => array(
471
+ 'name' => 'flag_is_company',
472
+ 'type' => 'select',
473
+ 'class' => 'required-entry',
474
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Is company'),
475
+ 'values' => array(
476
+ '1' => Mage::helper('sirateck_lemonway4ec')->__('Yes'),
477
+ '0' => Mage::helper('sirateck_lemonway4ec')->__('No'),
478
+ )
479
+
480
+ )
481
+ )
482
+ )
483
+ );
484
+ $this->getMassactionBlock()->addItem(
485
+ 'is_debtor',
486
+ array(
487
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Change Is debtor'),
488
+ 'url' => $this->getUrl('*/*/massIsDebtor', array('_current'=>true)),
489
+ 'additional' => array(
490
+ 'flag_is_debtor' => array(
491
+ 'name' => 'flag_is_debtor',
492
+ 'type' => 'select',
493
+ 'class' => 'required-entry',
494
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Is debtor'),
495
+ 'values' => array(
496
+ '1' => Mage::helper('sirateck_lemonway4ec')->__('Yes'),
497
+ '0' => Mage::helper('sirateck_lemonway4ec')->__('No'),
498
+ )
499
+
500
+ )
501
+ )
502
+ )
503
+ );
504
+ $this->getMassactionBlock()->addItem(
505
+ 'customer_nationality',
506
+ array(
507
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Change Nationality'),
508
+ 'url' => $this->getUrl('*/*/massCustomerNationality', array('_current'=>true)),
509
+ 'additional' => array(
510
+ 'flag_customer_nationality' => array(
511
+ 'name' => 'flag_customer_nationality',
512
+ 'type' => 'select',
513
+ 'class' => 'required-entry',
514
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Nationality'),
515
+ 'values' => Mage::getResourceModel('directory/country_collection')->toOptionArray()
516
+
517
+ )
518
+ )
519
+ )
520
+ );
521
+ $this->getMassactionBlock()->addItem(
522
+ 'customer_birth_country',
523
+ array(
524
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Change Birth country'),
525
+ 'url' => $this->getUrl('*/*/massCustomerBirthCountry', array('_current'=>true)),
526
+ 'additional' => array(
527
+ 'flag_customer_birth_country' => array(
528
+ 'name' => 'flag_customer_birth_country',
529
+ 'type' => 'select',
530
+ 'class' => 'required-entry',
531
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Birth country'),
532
+ 'values' => Mage::getResourceModel('directory/country_collection')->toOptionArray()
533
+
534
+ )
535
+ )
536
+ )
537
+ );
538
+ $this->getMassactionBlock()->addItem(
539
+ 'payer_or_beneficiary',
540
+ array(
541
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Change Payer or beneficiary'),
542
+ 'url' => $this->getUrl('*/*/massPayerOrBeneficiary', array('_current'=>true)),
543
+ 'additional' => array(
544
+ 'flag_payer_or_beneficiary' => array(
545
+ 'name' => 'flag_payer_or_beneficiary',
546
+ 'type' => 'select',
547
+ 'class' => 'required-entry',
548
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Payer or beneficiary'),
549
+ 'values' => Mage::getModel('sirateck_lemonway4ec/wallet_attribute_source_payerorbeneficiary')
550
+ ->getAllOptions(true),
551
+
552
+ )
553
+ )
554
+ )
555
+ );
556
+ $this->getMassactionBlock()->addItem(
557
+ 'is_onetime_customer',
558
+ array(
559
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Change Is One time customer'),
560
+ 'url' => $this->getUrl('*/*/massIsOnetimeCustomer', array('_current'=>true)),
561
+ 'additional' => array(
562
+ 'flag_is_onetime_customer' => array(
563
+ 'name' => 'flag_is_onetime_customer',
564
+ 'type' => 'select',
565
+ 'class' => 'required-entry',
566
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Is One time customer'),
567
+ 'values' => array(
568
+ '1' => Mage::helper('sirateck_lemonway4ec')->__('Yes'),
569
+ '0' => Mage::helper('sirateck_lemonway4ec')->__('No'),
570
+ )
571
+
572
+ )
573
+ )
574
+ )
575
+ );
576
+ $this->getMassactionBlock()->addItem(
577
+ 'is_default',
578
+ array(
579
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Change Is default'),
580
+ 'url' => $this->getUrl('*/*/massIsDefault', array('_current'=>true)),
581
+ 'additional' => array(
582
+ 'flag_is_default' => array(
583
+ 'name' => 'flag_is_default',
584
+ 'type' => 'select',
585
+ 'class' => 'required-entry',
586
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Is default'),
587
+ 'values' => array(
588
+ '1' => Mage::helper('sirateck_lemonway4ec')->__('Yes'),
589
+ '0' => Mage::helper('sirateck_lemonway4ec')->__('No'),
590
+ )
591
+
592
+ )
593
+ )
594
+ )
595
+ );
596
+ return $this;
597
+ }
598
+
599
+ /**
600
+ * get the row url
601
+ *
602
+ * @access public
603
+ * @param Sirateck_Lemonway4ec_Model_Wallet
604
+ * @return string
605
+ * @author Kassim Belghait kassim@sirateck.com
606
+ */
607
+ public function getRowUrl($row)
608
+ {
609
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
610
+ }
611
+
612
+ /**
613
+ * get the grid url
614
+ *
615
+ * @access public
616
+ * @return string
617
+ * @author Kassim Belghait kassim@sirateck.com
618
+ */
619
+ public function getGridUrl()
620
+ {
621
+ return $this->getUrl('*/*/grid', array('_current'=>true));
622
+ }
623
+
624
+ /**
625
+ * after collection load
626
+ *
627
+ * @access protected
628
+ * @return Sirateck_Lemonway4ec_Block_Adminhtml_Wallet_Grid
629
+ * @author Kassim Belghait kassim@sirateck.com
630
+ */
631
+ protected function _afterLoadCollection()
632
+ {
633
+ $this->getCollection()->walk('afterLoad');
634
+ parent::_afterLoadCollection();
635
+ }
636
+ }
app/code/community/Sirateck/Lemonway4ec/Block/Form/Webkit.php ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sirateck_Lemonway4ec extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Sirateck
13
+ * @package Sirateck_Lemonway4ec
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+
18
+ /**
19
+ * Block for select payment method FORM
20
+ *
21
+ * @author Kassim Belghait <kassim@sirateck.com>
22
+ */
23
+ class Sirateck_Lemonway4ec_Block_Form_Webkit extends Mage_Payment_Block_Form
24
+ {
25
+
26
+ protected function _construct()
27
+ {
28
+ parent::_construct();
29
+ $this->setTemplate('lemonway4ec/form/webkit.phtml');
30
+ }
31
+
32
+ /**
33
+ *
34
+ * @return Mage_Checkout_Model_Session
35
+ */
36
+ public function getCheckout()
37
+ {
38
+ return Mage::getSingleton('checkout/session');
39
+ }
40
+
41
+ /**
42
+ *
43
+ * @return Mage_Sales_Model_Quote
44
+ */
45
+ public function getQuote()
46
+ {
47
+ return $this->getCheckout()->getQuote();
48
+ }
49
+
50
+ /**
51
+ * @return Mage_Customer_Model_Customer
52
+ */
53
+ public function getCustomer(){
54
+ return Mage::getSingleton('customer/session')->getCustomer();
55
+ }
56
+
57
+ public function oneClicAllowed()
58
+ {
59
+ $checkoutMethod = Mage::getSingleton('checkout/session')->getQuote()->getCheckoutMethod();
60
+
61
+ if($checkoutMethod == Mage_Checkout_Model_Type_Onepage::METHOD_GUEST || !$this->getMethod()->getConfigData('allow_oneclic'))
62
+ return false;
63
+
64
+ return true;
65
+
66
+ }
67
+
68
+ public function customerHasCardId()
69
+ {
70
+ return $this->getCardId() != "";
71
+ }
72
+
73
+ public function getCardId()
74
+ {
75
+ return $this->getCustomer()->getLwCardId();
76
+ }
77
+
78
+ public function getCardNum(){
79
+ return $this->getCustomer()->getLwCardNum();
80
+ }
81
+
82
+ public function customerHasCardNum()
83
+ {
84
+ return $this->getCardNum() != "";
85
+ }
86
+
87
+ public function getCardType(){
88
+ return $this->getCustomer()->getLwCardType();
89
+ }
90
+
91
+ public function getCardExp(){
92
+ return $this->getCustomer()->getLwCardExp();
93
+ }
94
+
95
+
96
+
97
+ }
app/code/community/Sirateck/Lemonway4ec/Block/Info/Webkit.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sirateck_Lemonway4ec extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Sirateck
13
+ * @package Sirateck_Lemonway4ec
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+
18
+ /**
19
+ * Block INFO
20
+ *
21
+ * @author Kassim Belghait <kassim@sirateck.com>
22
+ */
23
+ class Sirateck_Lemonway4ec_Block_Info_Webkit extends Mage_Payment_Block_Info
24
+ {
25
+
26
+
27
+ protected function _construct()
28
+ {
29
+ parent::_construct();
30
+ $this->setTemplate('lemonway4ec/info/webkit.phtml');
31
+ }
32
+
33
+
34
+ /**
35
+ *
36
+ * @return Mage_Checkout_Model_Session
37
+ */
38
+ public function getCheckout()
39
+ {
40
+ return Mage::getSingleton('checkout/session');
41
+ }
42
+
43
+ /**
44
+ *
45
+ * @return Mage_Sales_Model_Quote
46
+ */
47
+ public function getQuote()
48
+ {
49
+ return $this->getCheckout()->getQuote();
50
+ }
51
+
52
+ }
app/code/community/Sirateck/Lemonway4ec/Controller/Adminhtml/Lemonway.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sirateck_Lemonway4ec extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Sirateck
13
+ * @package Sirateck_Lemonway4ec
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * module base admin controller
19
+ *
20
+ * @category Sirateck
21
+ * @package Sirateck_Lemonway4ec
22
+ * @author Kassim Belghait kassim@sirateck.com
23
+ */
24
+ class Sirateck_Lemonway4ec_Controller_Adminhtml_Lemonway extends Mage_Adminhtml_Controller_Action
25
+ {
26
+ /**
27
+ * upload file and get the uploaded name
28
+ *
29
+ * @access public
30
+ * @param string $input
31
+ * @param string $destinationFolder
32
+ * @param array $data
33
+ * @return string
34
+ * @author Kassim Belghait kassim@sirateck.com
35
+ */
36
+ protected function _uploadAndGetName($input, $destinationFolder, $data)
37
+ {
38
+ try {
39
+ if (isset($data[$input]['delete'])) {
40
+ return '';
41
+ } else {
42
+ $uploader = new Varien_File_Uploader($input);
43
+ $uploader->setAllowRenameFiles(true);
44
+ $uploader->setFilesDispersion(true);
45
+ $uploader->setAllowCreateFolders(true);
46
+ $result = $uploader->save($destinationFolder);
47
+ return $result['file'];
48
+ }
49
+ } catch (Exception $e) {
50
+ if ($e->getCode() != Varien_File_Uploader::TMP_NAME_EMPTY) {
51
+ throw $e;
52
+ } else {
53
+ if (isset($data[$input]['value'])) {
54
+ return $data[$input]['value'];
55
+ }
56
+ }
57
+ }
58
+ return '';
59
+ }
60
+ }
app/code/community/Sirateck/Lemonway4ec/Helper/Data.php ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sirateck_Lemonway4ec extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Sirateck
13
+ * @package Sirateck_Lemonway4ec
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Lemonway default helper
19
+ *
20
+ * @category Sirateck
21
+ * @package Sirateck_Lemonway4ec
22
+ * @author Kassim Belghait kassim@sirateck.com
23
+ */
24
+ class Sirateck_Lemonway4ec_Helper_Data extends Mage_Core_Helper_Abstract
25
+ {
26
+ /**
27
+ * convert array to options
28
+ *
29
+ * @access public
30
+ * @param $options
31
+ * @return array
32
+ * @author Kassim Belghait kassim@sirateck.com
33
+ */
34
+ public function convertOptions($options)
35
+ {
36
+ $converted = array();
37
+ foreach ($options as $option) {
38
+ if (isset($option['value']) && !is_array($option['value']) &&
39
+ isset($option['label']) && !is_array($option['label'])) {
40
+ $converted[$option['value']] = $option['label'];
41
+ }
42
+ }
43
+ return $converted;
44
+ }
45
+
46
+ public function reAddToCart($incrementId) {
47
+
48
+ $cart = Mage::getSingleton('checkout/cart');
49
+ $order = Mage::getModel('sales/order')->loadByIncrementId($incrementId);
50
+
51
+ if ($order->getId()) {
52
+ $items = $order->getItemsCollection();
53
+ foreach ($items as $item) {
54
+ try {
55
+ $cart->addOrderItem($item);
56
+ } catch (Mage_Core_Exception $e) {
57
+ if (Mage::getSingleton('checkout/session')->getUseNotice(true)) {
58
+ Mage::getSingleton('checkout/session')->addNotice($e->getMessage());
59
+ } else {
60
+ Mage::getSingleton('checkout/session')->addError($e->getMessage());
61
+ }
62
+ } catch (Exception $e) {
63
+ Mage::getSingleton('checkout/session')->addException($e, Mage::helper('checkout')->__('Cannot add the item to shopping cart.')
64
+ );
65
+ }
66
+ }
67
+ }
68
+
69
+ $cart->save();
70
+ }
71
+
72
+ /**
73
+ * @return Sirateck_Lemonway4ec_Model_Config
74
+ */
75
+ public function getConfig(){
76
+ return Mage::getSingleton('sirateck_lemonway4ec/config');
77
+ }
78
+
79
+ /**
80
+ *
81
+ * @return boolean
82
+ */
83
+ public function oneStepCheckoutInstalled(){
84
+ return Mage::getStoreConfigFlag('onestepcheckout/general/enabled');
85
+ }
86
+ }
app/code/community/Sirateck/Lemonway4ec/Model/Adminhtml/Search/Wallet.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sirateck_Lemonway4ec extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Sirateck
13
+ * @package Sirateck_Lemonway4ec
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Admin search model
19
+ *
20
+ * @category Sirateck
21
+ * @package Sirateck_Lemonway4ec
22
+ * @author Kassim Belghait kassim@sirateck.com
23
+ */
24
+ class Sirateck_Lemonway4ec_Model_Adminhtml_Search_Wallet extends Varien_Object
25
+ {
26
+ /**
27
+ * Load search results
28
+ *
29
+ * @access public
30
+ * @return Sirateck_Lemonway4ec_Model_Adminhtml_Search_Wallet
31
+ * @author Kassim Belghait kassim@sirateck.com
32
+ */
33
+ public function load()
34
+ {
35
+ $arr = array();
36
+ if (!$this->hasStart() || !$this->hasLimit() || !$this->hasQuery()) {
37
+ $this->setResults($arr);
38
+ return $this;
39
+ }
40
+ $collection = Mage::getResourceModel('sirateck_lemonway4ec/wallet_collection')
41
+ ->addFieldToFilter('wallet_id', array('like' => $this->getQuery().'%'))
42
+ ->setCurPage($this->getStart())
43
+ ->setPageSize($this->getLimit())
44
+ ->load();
45
+ foreach ($collection->getItems() as $wallet) {
46
+ $arr[] = array(
47
+ 'id' => 'wallet/1/'.$wallet->getId(),
48
+ 'type' => Mage::helper('sirateck_lemonway4ec')->__('Wallet'),
49
+ 'name' => $wallet->getWalletId(),
50
+ 'description' => $wallet->getWalletId(),
51
+ 'url' => Mage::helper('adminhtml')->getUrl(
52
+ '*/lemonway_wallet/edit',
53
+ array('id'=>$wallet->getId())
54
+ ),
55
+ );
56
+ }
57
+ $this->setResults($arr);
58
+ return $this;
59
+ }
60
+ }
app/code/community/Sirateck/Lemonway4ec/Model/Apikit/Apimodels/Iban.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @method int getIbanId() ID as defined by merchant
4
+ * @method int getStatus() {0,5,6,8,9}
5
+ * @method string getIban() iban number
6
+ * @method string getSwift() BIC or swift code
7
+ */
8
+ class Sirateck_Lemonway4ec_Model_Apikit_Apimodels_Iban extends Varien_Object{
9
+
10
+ function __construct($nodeArr=array()) {
11
+ if(count($nodeArr))
12
+ {
13
+ $node = $nodeArr[0];
14
+ $this->_data['iban_id'] = $node->ID;
15
+ if (isset($node->STATUS))
16
+ $this->_data['status'] = $node->STATUS;
17
+ if (isset($node->S))
18
+ $this->_data['status'] = $node->S;
19
+ if (isset($node->DATA))
20
+ $this->_data['iban'] = $node->DATA;
21
+ if (isset($node->SWIFT))
22
+ $this->_data['swift'] = $node->SWIFT;
23
+ }
24
+ }
25
+
26
+ }
app/code/community/Sirateck/Lemonway4ec/Model/Apikit/Apimodels/KycDoc.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Sirateck_Lemonway4ec_Model_Apikit_Apimodels_KycDoc {
4
+
5
+ /**
6
+ * ID as defined by Lemon Way
7
+ * @var string
8
+ */
9
+ public $ID;
10
+
11
+ /**
12
+ * STATUS {1,2,3,4,5}
13
+ * @var string
14
+ */
15
+ public $STATUS;
16
+
17
+ /**
18
+ * TYPE {0,1,2,3,4,5,6,7,11,12,13,14,15,16,17,18,19,20}
19
+ * @var string
20
+ */
21
+ public $TYPE;
22
+
23
+ /**
24
+ * VD validity date
25
+ * @var string
26
+ */
27
+ public $VD;
28
+
29
+ function __construct($nodeArr) {
30
+ $node = $nodeArr[0];
31
+ $this->ID = $node->ID;
32
+ $this->STATUS = $node->S;
33
+ $this->TYPE = $node->TYPE;
34
+ $this->VD = $node->VD;
35
+ }
36
+ }
app/code/community/Sirateck/Lemonway4ec/Model/Apikit/Apimodels/LwError.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ *
5
+ * @method string getMessage()
6
+ * @method int getCode()
7
+ *
8
+ */
9
+ class Sirateck_Lemonway4ec_Model_Apikit_Apimodels_LwError Extends Varien_Object{
10
+
11
+
12
+ function __construct($arr = array()) {
13
+ if(count($arr) > 0)
14
+ {
15
+ $this->_data['code'] = $arr[0];
16
+ $this->_data['message'] = $arr[1];
17
+ }
18
+ }
19
+ }
app/code/community/Sirateck/Lemonway4ec/Model/Apikit/Apimodels/LwModel.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+
3
+ class Sirateck_Lemonway4ec_Model_Apikit_Apimodels_LwModel {
4
+
5
+ }
app/code/community/Sirateck/Lemonway4ec/Model/Apikit/Apimodels/Operation.php ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @method string getType() {p2p, moneyin, moneyout}
4
+ * @method int getHpayId() id lemonway
5
+ * @method string getLabelCode() IBAN or Card number
6
+ * @method string getSenderWallet() sender wallet id
7
+ * @method string getReceiverWallet() receiver wallet id
8
+ * @method float getDebitAmount() amount debited from sender wallet
9
+ * @method float getCreditAmount() amount credited to receiver wallet or external bank account
10
+ * @method float getFees() fees automatically sent to merchant wallet
11
+ * @method string getMessage() comment
12
+ * @method int getStatus() {0,3,4}
13
+ * @method string getErrorMessage() internal error message with codes
14
+ * @method EXTRA getExtra() Detailed information regarding Card payment
15
+ *
16
+ * @author kassim belghait
17
+ *
18
+ */
19
+ class Sirateck_Lemonway4ec_Model_Apikit_Apimodels_Operation extends Varien_Object {
20
+
21
+
22
+
23
+ function __construct($hpayXmlArr = array()) {
24
+ if(count($hpayXmlArr))
25
+ {
26
+
27
+ $hpayXml = $hpayXmlArr[0];
28
+ $this->_data['hpay_id'] = (int)$hpayXml->ID;
29
+ $this->_data['sender_wallet'] = (string)$hpayXml->SEN;
30
+ $this->_data['receiver_wallet'] = (string)$hpayXml->REC;
31
+ $this->_data['debit_amount'] = (float)$hpayXml->DEB;
32
+ $this->_data['credit_amount'] = (float)$hpayXml->CRED;
33
+ $this->_data['fees'] = (float)$hpayXml->COM;
34
+ $this->_data['status'] = (int)$hpayXml->STATUS;
35
+ $this->_data['label_code'] = (string)$hpayXml->MLABEL;
36
+ $this->_data['error_message'] = (string)$hpayXml->INT_MSG;
37
+ $this->_data['extra'] = new EXTRA($hpayXml->EXTRA);
38
+ }
39
+ }
40
+ }
41
+
42
+ /**
43
+ * Detailed information regarding Card payment
44
+ */
45
+ class EXTRA{
46
+ /**
47
+ * IS3DS indicates if payment was 3D Secure
48
+ * @var bool
49
+ */
50
+ public $IS3DS;
51
+
52
+ /**
53
+ * CTRY country of card
54
+ * @var string
55
+ */
56
+ public $CTRY;
57
+
58
+ /**
59
+ * AUTH authorization number
60
+ * @var string
61
+ */
62
+ public $AUTH;
63
+
64
+ /**
65
+ * Number of registered card
66
+ * @var string
67
+ * @since api version 1.8
68
+ */
69
+ public $NUM;
70
+
71
+ /**
72
+ * Expiration date of registered card
73
+ * @var string
74
+ * @since api version 1.8
75
+ */
76
+ public $EXP;
77
+
78
+ /**
79
+ * Type of card
80
+ * @var string
81
+ * @since api version 1.8
82
+ */
83
+ public $TYP;
84
+
85
+ function __construct($extraXml) {
86
+ $this->AUTH = $extraXml->AUTH;
87
+ $this->IS3DS = $extraXml->IS3DS;
88
+ $this->CTRY = $extraXml->CTRY;
89
+ $this->NUM = $extraXml->NUM;
90
+ $this->EXP = $extraXml->EXP;
91
+ $this->TYP = $extraXml->TYP;
92
+ }
93
+ }
app/code/community/Sirateck/Lemonway4ec/Model/Apikit/Apimodels/SddMandate.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Sirateck_Lemonway4ec_Model_Apikit_Apimodels_SddMandate{
4
+
5
+ /**
6
+ * ID as defined by Lemon Way
7
+ * @var string
8
+ */
9
+ public $ID;
10
+
11
+ /**
12
+ * STATUS {0,5,6,8,9}
13
+ * @var string
14
+ */
15
+ public $STATUS;
16
+
17
+ /**
18
+ * IBAN number
19
+ * @var string
20
+ */
21
+ public $IBAN;
22
+
23
+ /**
24
+ * BIC or swift code
25
+ * @var string
26
+ */
27
+ public $BIC;
28
+
29
+ function __construct($nodeArr) {
30
+ $node = $nodeArr[0];
31
+ $this->ID = $node->ID;
32
+ if (isset($node->STATUS))
33
+ $this->STATUS = $node->STATUS;
34
+ if (isset($node->S))
35
+ $this->STATUS = $node->S;
36
+ if (isset($node->DATA))
37
+ $this->IBAN = $node->DATA;
38
+ if (isset($node->SWIFT))
39
+ $this->BIC = $node->SWIFT;
40
+ }
41
+
42
+ }
app/code/community/Sirateck/Lemonway4ec/Model/Apikit/Apimodels/Wallet.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @method int getWalletId() ID as defined by merchant
4
+ * @method int getLwid() LWID number ID as defined by Lemon Way
5
+ * @method int getStatus() {2,3,4,5,6,7,8,12}
6
+ * @method float getBal() balance
7
+ * @method string getName() full name
8
+ * @method string getEmail()
9
+ * @method array getKycDocs()
10
+ * @method array getIbans()
11
+ * @method array getssdMandates()
12
+ */
13
+ class Sirateck_Lemonway4ec_Model_Apikit_Apimodels_Wallet extends Varien_Object{
14
+
15
+ function __construct($WALLETArr = array()) {
16
+ if(count($WALLETArr))
17
+ {
18
+
19
+ $WALLET = $WALLETArr[0];
20
+ $this->_data['wallet_id'] = $WALLET->ID;
21
+ $this->_data['lwid'] = $WALLET->LWID;
22
+ $this->_data['status'] = $WALLET->STATUS;
23
+ $this->_data['bal'] = $WALLET->BAL;
24
+ $this->_data['name'] = $WALLET->NAME;
25
+ $this->_data['email'] = $WALLET->EMAIL;
26
+ $this->_data['kyc_docs'] = array();
27
+ if (isset($WALLET->DOCS))
28
+ foreach ($WALLET->DOCS->DOC as $DOC){
29
+ $this->_data['kyc_docs'][] = Mage::getModel('sirateck_lemonway4ec/apikit_apimodels_kycDoc',array($DOC));//new KycDoc($DOC);
30
+ }
31
+ $this->_data['ibans'] = array();
32
+ if (isset($WALLET->IBANS))
33
+ foreach ($WALLET->IBANS->IBAN as $IBAN){
34
+ $this->_data['ibans'][] = Mage::getModel('sirateck_lemonway4ec/apikit_apimodels_iban',array($IBAN));//new Iban($IBAN);
35
+ }
36
+ $this->_data['ssd_mandates'] = array();
37
+ if (isset($WALLET->SDDMANDATES))
38
+ foreach ($WALLET->SDDMANDATES->SDDMANDATE as $SDDMANDATE){
39
+ $this->_data['ssd_mandates'][] = Mage::getModel('sirateck_lemonway4ec/apikit_apimodels_ssdMandate',array($SDDMANDATE));//new SddMandate($SDDMANDATE);
40
+ }
41
+ }
42
+ }
43
+
44
+ }
app/code/community/Sirateck/Lemonway4ec/Model/Apikit/Apiresponse.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Sirateck_Lemonway4ec_Model_Apikit_Apiresponse{
3
+
4
+ function __construct($xmlResponseArr) {
5
+ $xmlResponse = $xmlResponseArr[0];
6
+ $this->lwXml = $xmlResponse;
7
+ if (isset($xmlResponse->E)){
8
+ $this->lwError = Mage::getModel("sirateck_lemonway4ec/apikit_apimodels_lwError",array($xmlResponse->E->Code, $xmlResponse->E->Msg));
9
+ }
10
+ }
11
+
12
+ /**
13
+ * lwXml
14
+ * @var SimpleXMLElement
15
+ */
16
+ public $lwXml;
17
+
18
+ /**
19
+ * lwError
20
+ * @var Sirateck_Lemonway4ec_Model_Apikit_Apimodels_LwError
21
+ */
22
+ public $lwError;
23
+
24
+ /**
25
+ * wallet
26
+ * @var Sirateck_Lemonway4ec_Model_Apikit_Apimodels_Wallet
27
+ */
28
+ public $wallet;
29
+
30
+ /**
31
+ * operations
32
+ * @var array Sirateck_Lemonway4ec_Model_Apikit_Apimodels_Operation
33
+ */
34
+ public $operations;
35
+
36
+ /**
37
+ * kycDoc
38
+ * @var Sirateck_Lemonway4ec_Model_Apikit_Apimodels_KycDoc
39
+ */
40
+ public $kycDoc;
41
+
42
+ /**
43
+ * iban
44
+ * @var Sirateck_Lemonway4ec_Model_Apikit_Apimodels_Iban
45
+ */
46
+ public $iban;
47
+
48
+ /**
49
+ * sddMandate
50
+ * @var Sirateck_Lemonway4ec_Model_Apikit_Apimodels_SddMandate
51
+ */
52
+ public $sddMandate;
53
+ }
54
+
55
+ ?>
app/code/community/Sirateck/Lemonway4ec/Model/Apikit/Kit.php ADDED
@@ -0,0 +1,300 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Sirateck_Lemonway4ec_Model_Apikit_Kit{
4
+
5
+ public function RegisterWallet($params) {
6
+ $res = $this->sendRequest('RegisterWallet', $params, '1.1');
7
+ if (!isset($res->lwError)){
8
+ $res->wallet = Mage::getModel('sirateck_lemonway4ec/apikit_apimodels_wallet',array($res->lwXml->WALLET));//new Wallet($res->lwXml->WALLET);
9
+ }
10
+ return $res;
11
+ }
12
+ public function MoneyIn($params) {
13
+ $res = $this->sendRequest('MoneyIn', $params, '1.1');
14
+ if (!isset($res->lwError)){
15
+ $res->operations = array(Mage::getModel('sirateck_lemonway4ec/apikit_apimodels_operation',array($res->lwXml->TRANS->HPAY)));// array(new Operation($res->lwXml->TRANS->HPAY));
16
+ }
17
+ return $res;
18
+ }
19
+ public function UpdateWalletDetails($params) {
20
+ $res = $this->sendRequest('UpdateWalletDetails', $params, '1.0');
21
+ if (!isset($res->lwError)){
22
+ $res->wallet = Mage::getModel('sirateck_lemonway4ec/apikit_apimodels_wallet',array($res->lwXml->WALLET));
23
+ }
24
+ return $res;
25
+ }
26
+ public function GetWalletDetails($params) {
27
+ $res = $this->sendRequest('GetWalletDetails', $params, '1.5');
28
+ if (!isset($res->lwError)){
29
+ $res->wallet = Mage::getModel('sirateck_lemonway4ec/apikit_apimodels_wallet',array($res->lwXml->WALLET));
30
+ }
31
+ return $res;
32
+ }
33
+ public function MoneyIn3DInit($params) {
34
+ return $this->sendRequest('MoneyIn3DInit', $params, '1.1');
35
+ }
36
+ public function MoneyIn3DConfirm($params) {
37
+ return $this->sendRequest('MoneyIn3DConfirm', $params, '1.1');
38
+ }
39
+ public function MoneyInWebInit($params) {
40
+ return $this->sendRequest('MoneyInWebInit', $params, '1.3');
41
+ }
42
+ public function RegisterCard($params) {
43
+ return $this->sendRequest('RegisterCard', $params, '1.1');
44
+ }
45
+ public function UnregisterCard($params) {
46
+ return $this->sendRequest('UnregisterCard', $params, '1.0');
47
+ }
48
+ public function MoneyInWithCardId($params) {
49
+ $res = $this->sendRequest('MoneyInWithCardId', $params, '1.1');
50
+ if (!isset($res->lwError)){
51
+ $res->operations = array(Mage::getModel('sirateck_lemonway4ec/apikit_apimodels_operation',array($res->lwXml->TRANS->HPAY)));
52
+ }
53
+ return $res;
54
+ }
55
+ public function MoneyInValidate($params) {
56
+ return $this->sendRequest('MoneyInValidate', $params, '1.0');
57
+ }
58
+ public function SendPayment($params) {
59
+ $res = $this->sendRequest('SendPayment', $params, '1.0');
60
+ if (!isset($res->lwError)){
61
+ $res->operations = array(Mage::getModel('sirateck_lemonway4ec/apikit_apimodels_operation',array($res->lwXml->TRANS->HPAY)));
62
+ }
63
+ return $res;
64
+ }
65
+ public function RegisterIBAN($params) {
66
+ $res = $this->sendRequest('RegisterIBAN', $params, '1.1');
67
+ if (!isset($res->lwError)){
68
+ $res->iban = Mage::getModel('sirateck_lemonway4ec/apikit_apimodels_iban',array($res->lwXml->IBAN));;//new Iban($res->lwXml->IBAN);
69
+ }
70
+ return $res;
71
+ }
72
+ public function MoneyOut($params) {
73
+ $res = $this->sendRequest('MoneyOut', $params, '1.3');
74
+ if (!isset($res->lwError)){
75
+ $res->operations = array(Mage::getModel('sirateck_lemonway4ec/apikit_apimodels_operation',array($res->lwXml->TRANS->HPAY)));
76
+ }
77
+ return $res;
78
+ }
79
+ public function GetPaymentDetails($params) {
80
+ $res = $this->sendRequest('GetPaymentDetails', $params, '1.0');
81
+ if (!isset($res->lwError)){
82
+ $res->operations = array();
83
+ foreach ($res->lwXml->TRANS->HPAY as $HPAY){
84
+ $res->operations[] = Mage::getModel('sirateck_lemonway4ec/apikit_apimodels_operation',array($HPAY));
85
+ }
86
+ }
87
+ return $res;
88
+ }
89
+ public function GetMoneyInTransDetails($params) {
90
+ $res = $this->sendRequest('GetMoneyInTransDetails', $params, '1.8');
91
+ if (!isset($res->lwError)){
92
+ $res->operations = array();
93
+ foreach ($res->lwXml->TRANS->HPAY as $HPAY){
94
+ $res->operations[] = Mage::getModel('sirateck_lemonway4ec/apikit_apimodels_operation',array($HPAY));
95
+ }
96
+ }
97
+ return $res;
98
+ }
99
+ public function GetMoneyOutTransDetails($params) {
100
+ $res = $this->sendRequest('GetMoneyOutTransDetails', $params, '1.4');
101
+ if (!isset($res->lwError)){
102
+ $res->operations = array();
103
+ foreach ($res->lwXml->TRANS->HPAY as $HPAY){
104
+ $res->operations[] = Mage::getModel('sirateck_lemonway4ec/apikit_apimodels_operation',array($HPAY));
105
+ }
106
+ }
107
+ return $res;
108
+ }
109
+ public function UploadFile($params) {
110
+ $res = $this->sendRequest('UploadFile', $params, '1.1');
111
+ if (!isset($res->lwError)){
112
+ $res->kycDoc = Mage::getModel('sirateck_lemonway4ec/apikit_apimodels_kycDoc',array($res->lwXml->UPLOAD));;//new KycDoc($res->lwXml->UPLOAD);
113
+ }
114
+ return $res;
115
+ }
116
+ public function GetKycStatus($params) {
117
+ return $this->sendRequest('GetKycStatus', $params, '1.5');
118
+ }
119
+ public function GetMoneyInIBANDetails($params) {
120
+ return $this->sendRequest('GetMoneyInIBANDetails', $params, '1.4');
121
+ }
122
+ public function RefundMoneyIn($params) {
123
+ return $this->sendRequest('RefundMoneyIn', $params, '1.2');
124
+ }
125
+ public function GetBalances($params) {
126
+ return $this->sendRequest('GetBalances', $params, '1.0');
127
+ }
128
+ public function MoneyIn3DAuthenticate($params) {
129
+ return $this->sendRequest('MoneyIn3DAuthenticate', $params, '1.0');
130
+ }
131
+ public function MoneyInIDealInit($params) {
132
+ return $this->sendRequest('MoneyInIDealInit', $params, '1.0');
133
+ }
134
+ public function MoneyInIDealConfirm($params) {
135
+ return $this->sendRequest('MoneyInIDealConfirm', $params, '1.0');
136
+ }
137
+ public function RegisterSddMandate($params) {
138
+ $res = $this->sendRequest('RegisterSddMandate', $params, '1.0');
139
+ if (!isset($res->lwError)){
140
+ $res->sddMandate = Mage::getModel('sirateck_lemonway4ec/apikit_apimodels_sddMandate',array($res->lwXml->SDDMANDATE));;//new SddMandate($res->lwXml->SDDMANDATE);
141
+ }
142
+ return $res;
143
+ }
144
+ public function UnregisterSddMandate($params) {
145
+ return $this->sendRequest('UnregisterSddMandate', $params, '1.0');
146
+ }
147
+ public function MoneyInSddInit($params) {
148
+ return $this->sendRequest('MoneyInSddInit', $params, '1.0');
149
+ }
150
+ public function GetMoneyInSdd($params) {
151
+ return $this->sendRequest('GetMoneyInSdd', $params, '1.0');
152
+ }
153
+ public function GetMoneyInChequeDetails($params) {
154
+ return $this->sendRequest('GetMoneyInChequeDetails', $params, '1.4');
155
+ }
156
+
157
+ /**
158
+ *
159
+ * @param string $methodName
160
+ * @param array $params
161
+ * @param float $version
162
+ * @return Sirateck_Lemonway4ec_Model_Apikit_Apiresponse $apiResponse
163
+ */
164
+ private function sendRequest($methodName, $params, $version){
165
+ $ua = '';
166
+ if (isset($_SERVER['HTTP_USER_AGENT']))
167
+ $ua = $_SERVER['HTTP_USER_AGENT'];
168
+ $ip = '';
169
+ if (isset($_SERVER['REMOTE_ADDR']))
170
+ $ip = $_SERVER['REMOTE_ADDR'];
171
+
172
+ $xml_soap = '<?xml version="1.0" encoding="utf-8"?><soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"><soap12:Body><'.$methodName.' xmlns="Service_mb_xml">';
173
+
174
+ foreach ($params as $key => $value) {
175
+ $xml_soap .= '<'.$key.'>'.$value.'</'.$key.'>';
176
+ }
177
+ $xml_soap .= '<version>'.$version.'</version>';
178
+ $xml_soap .= '<wlPass>'.$this->getConfig()->getApiPass().'</wlPass>';
179
+ $xml_soap .= '<wlLogin>'.$this->getConfig()->getApiLogin().'</wlLogin>';
180
+ $xml_soap .= '<language>fr</language>';
181
+ $xml_soap .= '<walletIp>'.$ip.'</walletIp>';
182
+ $xml_soap .= '<walletUa>'.$ua.'</walletUa>';
183
+
184
+ $xml_soap .= '</'.$methodName.'></soap12:Body></soap12:Envelope>';
185
+
186
+
187
+ $headers = array("Content-type: text/xml;charset=utf-8",
188
+ "Accept: application/xml",
189
+ "Cache-Control: no-cache",
190
+ "Pragma: no-cache",
191
+ 'SOAPAction: "Service_mb_xml/'.$methodName.'"',
192
+ "Content-length: ".strlen($xml_soap),
193
+ );
194
+
195
+ $ch = curl_init();
196
+ curl_setopt($ch, CURLOPT_URL, $this->getConfig()->getDirectkitUrl());
197
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
198
+ curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
199
+ curl_setopt($ch, CURLOPT_TIMEOUT, 30);
200
+ curl_setopt($ch, CURLOPT_POST, true);
201
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_soap);
202
+ curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
203
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, !$this->getConfig()->isTestMode());
204
+
205
+ $response = curl_exec($ch);
206
+ if (curl_errno($ch)) {
207
+ Mage::throwException(curl_error($ch));
208
+ }
209
+
210
+ $returnCode = (int)curl_getinfo($ch, CURLINFO_HTTP_CODE);
211
+ $error = true;
212
+ $message = "";
213
+ switch($returnCode){
214
+ case 200:
215
+ //General parsing
216
+ //Cleanup XML
217
+ $response = (string)str_replace('<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">', '', $response);
218
+ $response = (string)str_replace('</soap:Envelope>', '', $response);
219
+ libxml_use_internal_errors(true);
220
+ $xml = new \SimpleXMLElement($response);
221
+
222
+ //Retrieve result
223
+ $content = '';
224
+
225
+ switch($methodName) {
226
+ case 'UnregisterSddMandate':
227
+ $content = $xml->{$methodName . 'Response'}->{'UnRegisterSddMandateResult'};
228
+ break;
229
+
230
+ case 'MoneyInWithCardId':
231
+ $content = $xml->{$methodName . 'Response'}->{'MoneyInResult'};
232
+ break;
233
+
234
+ default:
235
+ $content = $xml->{$methodName . 'Response'}->{$methodName . 'Result'};
236
+ break;
237
+ }
238
+
239
+ curl_close($ch);
240
+ $apiResponse = Mage::getModel('sirateck_lemonway4ec/apikit_apiresponse',array($content));
241
+ return $apiResponse;
242
+
243
+ case 400:
244
+ $message = "Bad Request : The server cannot or will not process the request due to something that is perceived to be a client error";
245
+ break;
246
+ case 403:
247
+ $message = "IP is not allowed to access Lemon Way's API, please contact support@lemonway.fr";
248
+ break;
249
+ case 404:
250
+ $message = "Check that the access URLs are correct. If yes, please contact support@lemonway.fr";
251
+ break;
252
+ case 500:
253
+ $message = "Lemon Way internal server error, please contact support@lemonway.fr";
254
+ break;
255
+ default:
256
+ $message = "Code: {$returnCode} not processed!";
257
+ break;
258
+ }
259
+
260
+ if($error)
261
+ {
262
+ Mage::throwException($message);
263
+ }
264
+
265
+ curl_close($ch);
266
+ }
267
+
268
+ public function printCardForm($moneyInToken, $cssUrl = '', $language = 'fr'){
269
+
270
+ $ch = curl_init();
271
+ curl_setopt($ch, CURLOPT_URL, $this->getConfig()->getWebkitUrl()."?moneyintoken=".$moneyInToken.'&p='.urlencode($cssUrl).'&lang='.$language);
272
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
273
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, !$this->getConfig()->isTestMode());
274
+
275
+ $server_output = curl_exec ($ch);
276
+ if(curl_errno($ch))
277
+ {
278
+ print(curl_error($ch));//TODO : handle error
279
+ } else {
280
+ $returnCode = (int)curl_getinfo($ch, CURLINFO_HTTP_CODE);
281
+ switch($returnCode){
282
+ case 200:
283
+ curl_close ($ch);
284
+ print($server_output);
285
+ break;
286
+ default:
287
+ print($returnCode);//TODO : handle error
288
+ break;
289
+ }
290
+ }
291
+ }
292
+
293
+ /**
294
+ * @return Sirateck_Lemonway4ec_Model_Config
295
+ */
296
+ protected function getConfig(){
297
+ return Mage::getSingleton('sirateck_lemonway4ec/config');
298
+ }
299
+ }
300
+ ?>
app/code/community/Sirateck/Lemonway4ec/Model/Attribute/Source/Country.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sirateck_Lemonway4ec extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Sirateck
13
+ * @package Sirateck_Lemonway4ec
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * country attribute source model
19
+ *
20
+ * @category Sirateck
21
+ * @package Sirateck_Lemonway4ec
22
+ * @author Kassim Belghait kassim@sirateck.com
23
+ */
24
+ class Sirateck_Lemonway4ec_Model_Attribute_Source_Country extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
25
+ {
26
+ /**
27
+ * Get list of all available countries
28
+ *
29
+ * @access public
30
+ * @return mixed
31
+ * @author Kassim Belghait kassim@sirateck.com
32
+ */
33
+ public function getAllOptions()
34
+ {
35
+ $cacheKey = 'DIRECTORY_COUNTRY_SELECT_STORE_' . Mage::app()->getStore()->getCode();
36
+ if (Mage::app()->useCache('config') && $cache = Mage::app()->loadCache($cacheKey)) {
37
+ $options = unserialize($cache);
38
+ } else {
39
+ $collection = Mage::getModel('directory/country')->getResourceCollection();
40
+ $options = $collection->toOptionArray();
41
+ if (Mage::app()->useCache('config')) {
42
+ Mage::app()->saveCache(serialize($options), $cacheKey, array('config'));
43
+ }
44
+ }
45
+ return $options;
46
+ }
47
+ }
app/code/community/Sirateck/Lemonway4ec/Model/Config.php ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sirateck_Lemonway4ec extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Sirateck
13
+ * @package Sirateck_Lemonway4ec
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Base configuration
19
+ *
20
+ * @category Sirateck
21
+ * @package Sirateck_Lemonway4ec
22
+ * @author Kassim Belghait kassim@sirateck.com
23
+ */
24
+ class Sirateck_Lemonway4ec_Model_Config extends Varien_Object
25
+ {
26
+
27
+ const API_PLATFORM_NAME = 'api_platform_name';
28
+ const API_LOGIN = 'api_login';
29
+ const API_PASS = 'api_pass';
30
+ const WALLET_MERCHANT_ID = 'wallet_merchant_id';
31
+ const DIRECTKIT_URL = "https://ws.lemonway.fr/mb/lwecommerce/prod/directkitxml/service.asmx";
32
+ const WEBKIT_URL = 'https://webkit.lemonway.fr/mb/lwecommerce/prod/';
33
+ const DIRECTKIT_URL_TEST = "https://sandbox-api.lemonway.fr/mb/lwecommerce/dev/directkitxml/service.asmx";
34
+ const WEBKIT_URL_TEST = 'https://sandbox-webkit.lemonway.fr/lwecommerce/dev/';
35
+ const IS_TEST_MODE = 'is_test_mode';
36
+ const MODE_TEST = 'dev';
37
+ const MODE_PROD = 'prod';
38
+
39
+
40
+ const BASE_CONFIG = 'sirateck_lemonway4ec/lemonway_api/';
41
+
42
+ /**
43
+ * Return config var
44
+ *
45
+ * @param string $key Var path key
46
+ * @param int $storeId Store View Id
47
+ * @return mixed
48
+ */
49
+ public function getConfigData($key, $storeId = null)
50
+ {
51
+
52
+ if (!$this->hasData($key)) {
53
+ $value = Mage::getStoreConfig(self::BASE_CONFIG . $key, $storeId);
54
+ $this->setData($key, $value);
55
+ }
56
+ return $this->getData($key);
57
+ }
58
+
59
+ /**
60
+ * Return config var
61
+ *
62
+ * @param string $key Var path key
63
+ * @param int $storeId Store View Id
64
+ * @return mixed
65
+ */
66
+ public function getConfigFlag($key, $storeId = null)
67
+ {
68
+
69
+ if (!$this->hasData($key)) {
70
+ $value = Mage::getStoreConfigFlag(self::BASE_CONFIG . $key, $storeId);
71
+ $this->setData($key, $value);
72
+ }
73
+ return $this->getData($key);
74
+ }
75
+
76
+ /**
77
+ * @deprecated since version 0.1.3
78
+ * Return platform name for construct api urls
79
+ * @param string $storeId
80
+ * @return string
81
+ */
82
+ public function getApiPlatformName($storeId =null)
83
+ {
84
+ return $this->getConfigData(self::API_PLATFORM_NAME,$storeId);
85
+ }
86
+
87
+ /**
88
+ * Return username to connect to API
89
+ * @param string $storeId
90
+ * @return string
91
+ */
92
+ public function getApiLogin($storeId =null)
93
+ {
94
+ return $this->getConfigData(self::API_LOGIN,$storeId);
95
+ }
96
+
97
+ /**
98
+ * Retieve api password
99
+ * @param string $storeId
100
+ * @return string
101
+ */
102
+ public function getApiPass($storeId=null)
103
+ {
104
+ return $this->getConfigData(self::API_PASS,$storeId);
105
+ }
106
+
107
+ /**
108
+ * Return main wallet merchant
109
+ * @param string $storeId
110
+ * @return string
111
+ */
112
+ public function getWalletMerchantId($storeId=null){
113
+ return $this->getConfigData(self::WALLET_MERCHANT_ID,$storeId);
114
+ }
115
+
116
+ /**
117
+ *
118
+ * @param string $storeId
119
+ * @return bool
120
+ */
121
+ public function isTestMode($storeId=null){
122
+ return $this->getConfigFlag(self::IS_TEST_MODE);
123
+ }
124
+
125
+ /**
126
+ * @deprecated since version 0.1.3
127
+ * @param string $storeId
128
+ * @return string $mode
129
+ */
130
+ public function getMode($storeId=null){
131
+ if($this->isTestMode($storeId)) return self::MODE_TEST;
132
+
133
+ return self::MODE_PROD;
134
+ }
135
+
136
+ public function getDirectkitUrl($storeId=null){
137
+
138
+ $url = self::DIRECTKIT_URL;
139
+ if($this->isTestMode($storeId))
140
+ $url = self::DIRECTKIT_URL_TEST;
141
+
142
+ return $url;
143
+
144
+ }
145
+
146
+ public function getWebkitUrl($storeId=null){
147
+
148
+ $url = self::WEBKIT_URL;
149
+ if($this->isTestMode($storeId))
150
+ $url = self::WEBKIT_URL_TEST;
151
+
152
+ return $url;
153
+
154
+ }
155
+
156
+
157
+ }
app/code/community/Sirateck/Lemonway4ec/Model/Iban.php ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sirateck_Lemonway4ec extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Sirateck
13
+ * @package Sirateck_Lemonway4ec
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Iban model
19
+ *
20
+ * @category Sirateck
21
+ * @package Sirateck_Lemonway4ec
22
+ * @author Kassim Belghait kassim@sirateck.com
23
+ */
24
+ class Sirateck_Lemonway4ec_Model_Iban extends Mage_Core_Model_Abstract
25
+ {
26
+ /**
27
+ * Entity code.
28
+ * Can be used as part of method name for entity processing
29
+ */
30
+ const ENTITY = 'sirateck_lemonway4ec_iban';
31
+ const CACHE_TAG = 'sirateck_lemonway4ec_iban';
32
+
33
+ /**
34
+ * Prefix of model events names
35
+ *
36
+ * @var string
37
+ */
38
+ protected $_eventPrefix = 'sirateck_lemonway4ec_iban';
39
+
40
+ /**
41
+ * Parameter name in event
42
+ *
43
+ * @var string
44
+ */
45
+ protected $_eventObject = 'iban';
46
+
47
+ /**
48
+ * constructor
49
+ *
50
+ * @access public
51
+ * @return void
52
+ * @author Kassim Belghait kassim@sirateck.com
53
+ */
54
+ public function _construct()
55
+ {
56
+ parent::_construct();
57
+ $this->_init('sirateck_lemonway4ec/iban');
58
+ }
59
+
60
+ /**
61
+ * before save iban
62
+ *
63
+ * @access protected
64
+ * @return Sirateck_Lemonway4ec_Model_Iban
65
+ * @author Kassim Belghait kassim@sirateck.com
66
+ */
67
+ protected function _beforeSave()
68
+ {
69
+ parent::_beforeSave();
70
+ $now = Mage::getSingleton('core/date')->gmtDate();
71
+ if ($this->isObjectNew()) {
72
+ $this->setCreatedAt($now);
73
+ }
74
+ $this->setUpdatedAt($now);
75
+ return $this;
76
+ }
77
+
78
+ /**
79
+ * save iban relation
80
+ *
81
+ * @access public
82
+ * @return Sirateck_Lemonway4ec_Model_Iban
83
+ * @author Kassim Belghait kassim@sirateck.com
84
+ */
85
+ protected function _afterSave()
86
+ {
87
+ return parent::_afterSave();
88
+ }
89
+
90
+ /**
91
+ * get default values
92
+ *
93
+ * @access public
94
+ * @return array
95
+ * @author Kassim Belghait kassim@sirateck.com
96
+ */
97
+ public function getDefaultValues()
98
+ {
99
+ $values = array();
100
+ $values['status'] = 1;
101
+ $values['is_default'] = '1';
102
+
103
+ return $values;
104
+ }
105
+
106
+ }
app/code/community/Sirateck/Lemonway4ec/Model/Method/Webkit.php ADDED
@@ -0,0 +1,274 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sirateck_Lemonway4ec extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Sirateck
13
+ * @package Sirateck_Lemonway4ec
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Method standard model
19
+ *
20
+ * @category Sirateck
21
+ * @package Sirateck_Lemonway4ec
22
+ * @author Kassim Belghait kassim@sirateck.com
23
+ */
24
+ class Sirateck_Lemonway4ec_Model_Method_Webkit extends Mage_Payment_Model_Method_Abstract{
25
+
26
+
27
+ protected $_code = 'lemonway4ec_webkit';
28
+ protected $_formBlockType = 'sirateck_lemonway4ec/form_webkit';
29
+ protected $_infoBlockType = 'sirateck_lemonway4ec/info_webkit';
30
+
31
+ /**
32
+ * Availability options
33
+ */
34
+ protected $_isGateway = true;
35
+ protected $_canAuthorize = true;
36
+ protected $_canCapture = true;
37
+ protected $_canCapturePartial = false;
38
+ protected $_canRefund = false;
39
+ protected $_canVoid = false;
40
+ protected $_canUseInternal = false;
41
+ protected $_canUseCheckout = true;
42
+ protected $_canUseForMultishipping = false;
43
+ protected $_isInitializeNeeded = true; // when initialize we get token for webkit url
44
+
45
+ protected $_order;
46
+
47
+ protected $_supportedLangs = array('no', 'jp', 'ko', 'sp', 'fr', 'xz', 'ge', 'it', 'br', 'da', 'fi', 'sw', 'po', 'fl', 'ci', 'pl','ne');
48
+ protected $_defaultLang = 'en';
49
+
50
+ const IS_TEST_MODE = 'is_test_mode';
51
+
52
+
53
+
54
+ /**
55
+ * @return Mage_Checkout_Model_Session
56
+ */
57
+ protected function _getCheckout()
58
+ {
59
+ return Mage::getSingleton('checkout/session');
60
+ }
61
+
62
+ /**
63
+ * Assign data to info model instance
64
+ *
65
+ * @param mixed $data
66
+ * @return Mage_Payment_Model_Info
67
+ */
68
+ public function assignData($data)
69
+ {
70
+ if (!($data instanceof Varien_Object)) {
71
+ $data = new Varien_Object($data);
72
+ }
73
+ $info = $this->getInfoInstance();
74
+
75
+ $info->setAdditionalInformation('register_card',$data->getOneclic() == "register_card" ? 1 : 0)
76
+ ->setAdditionalInformation('use_card',$data->getOneclic() == "use_card" ? 1 : 0);
77
+
78
+ return $this;
79
+ }
80
+
81
+ public function initialize($paymentAction, $stateObject){
82
+ $useCard = (bool)$this->getInfoInstance()->getAdditionalInformation('use_card');
83
+ $registerCard = (bool)$this->getInfoInstance()->getAdditionalInformation('register_card');
84
+
85
+ //Init APi kit
86
+ /* @var $kit Sirateck_Lemonway4ec_Model_Apikit_Kit */
87
+ $kit = Mage::getSingleton('sirateck_lemonway4ec/apikit_kit');
88
+
89
+ $amountCom = 0;
90
+
91
+ $comment = Mage::helper('sirateck_lemonway4ec')->__("Order #%s by %s %s %s", $this->getOrder()->getIncrementId(),
92
+ $this->getOrder()->getCustomerLastname(),
93
+ $this->getOrder()->getCustomerFirstname(),
94
+ $this->getOrder()->getCustomerEmail());
95
+
96
+ //We call MoneyInwebInit and save token in session
97
+ //Token is used in getOrderRedirectUrl method
98
+ if(!$useCard)
99
+ {
100
+
101
+ //call directkit to get Webkit Token
102
+ $params = array('wkToken' => $this->getOrder()->getIncrementId(),
103
+ 'wallet' => $this->getHelper()->getConfig()->getWalletMerchantId(),
104
+ 'amountTot' => sprintf("%.2f" ,(float)$this->getOrder()->getBaseGrandTotal()),
105
+ 'amountCom' => sprintf("%.2f" ,(float)$amountCom),
106
+ 'comment' => $comment,
107
+ 'returnUrl' => urlencode(Mage::getUrl($this->getConfigData('return_url'))),
108
+ 'cancelUrl' => urlencode(Mage::getUrl($this->getConfigData('cancel_url'))),
109
+ 'errorUrl' => urlencode(Mage::getUrl($this->getConfigData('error_url'))),
110
+ 'autoCommission' => 0,
111
+ 'registerCard' => $registerCard, //For Atos
112
+ 'useRegisteredCard' => $registerCard || $useCard, //For payline
113
+ );
114
+ $this->_debug($params);
115
+
116
+
117
+ $res = $kit->MoneyInWebInit($params);
118
+
119
+ $this->_debug($res);
120
+
121
+ if (isset($res->lwError)){
122
+ Mage::throwException("Error code: " . $res->lwError->getCode() . " Message: " . $res->lwError->getMessage());
123
+ }
124
+ $moneyInToken = (string)$res->lwXml->MONEYINWEB->TOKEN;
125
+ $this->getInfoInstance()->setAdditionalInformation('moneyin_token',$moneyInToken);
126
+ $this->_getCheckout()->setMoneyInToken($moneyInToken);
127
+
128
+ $hasCardId = isset($res->lwXml->MONEYINWEB->CARD->ID);
129
+
130
+ //Save CardId if register card asked by user
131
+ if($registerCard && $hasCardId){
132
+
133
+ $cardId = (string)$res->lwXml->MONEYINWEB->CARD->ID;
134
+
135
+ $customer = Mage::getModel('customer/customer')->load($this->getOrder()->getCustomerId());
136
+ if($customer->getId())
137
+ {
138
+ $customer->setLwCardId($cardId);
139
+ $customer->getResource()->saveAttribute($customer, 'lw_card_id');
140
+ }
141
+ }
142
+ }
143
+ else{ //Customer want to use his last card, so we call MoneyInWithCardID directly
144
+
145
+ $customer = Mage::getModel('customer/customer')->load($this->getOrder()->getCustomerId());
146
+ if($customer->getId())
147
+ {
148
+ $cardId = $customer->getLwCardId();
149
+ //call directkit for MoneyInWithCardId
150
+ $params = array(
151
+ 'wkToken'=>$this->getOrder()->getIncrementId(),
152
+ 'wallet'=> $this->getHelper()->getConfig()->getWalletMerchantId(),
153
+ 'amountTot'=>sprintf("%.2f" ,(float)$this->getOrder()->getBaseGrandTotal()),
154
+ 'amountCom'=>sprintf("%.2f" ,(float)$amountCom),
155
+ 'message'=>$comment . " -- " .Mage::helper('sirateck_lemonway4ec')->__('Oneclic mode (card id: %s)',$cardId),
156
+ 'autoCommission'=>0,
157
+ 'cardId'=>$cardId,
158
+ 'isPreAuth'=>0,
159
+ 'specialConfig'=>'',
160
+ 'delayedDays'=>6 //not used because isPreAuth always false
161
+ );
162
+
163
+ $this->_debug($params);
164
+ $res = $kit->MoneyInWithCardId($params);
165
+ $this->_debug($res);
166
+
167
+ if (isset($res->lwError)){
168
+ Mage::throwException("Error code: " . $res->lwError->getCode() . " Message: " . $res->lwError->getMessage());
169
+ }
170
+
171
+ /* @var $op Sirateck_Lemonway4ec_Model_Apikit_Apimodels_Operation */
172
+ foreach ($res->operations as $op) {
173
+
174
+ if($op->getStatus() == "3")
175
+ {
176
+ $this->getOrder()->getPayment()->setAmountAuthorized($this->getOrder()->getTotalDue());
177
+ $this->getOrder()->getPayment()->setBaseAmountAuthorized($this->getOrder()->getBaseTotalDue());
178
+ $this->getOrder()->getPayment()->capture(null);
179
+ $stateObject->setState(Mage_Sales_Model_Order::STATE_PROCESSING);
180
+ $stateObject->setStatus(true);
181
+ $stateObject->setIsNotified(false);
182
+
183
+ $this->getOrder()->setCanSendNewEmailFlag(true);
184
+ break;
185
+ }
186
+
187
+ }
188
+
189
+ }
190
+ else{
191
+ Mage::throwException(Mage::helper('sirateck_lemonway4ec')->__("Customer not found!"));
192
+ }
193
+ }
194
+
195
+ }
196
+
197
+ /**
198
+ * Retrieve payment iformation model object
199
+ *
200
+ * @return Mage_Payment_Model_Info
201
+ */
202
+ public function getInfoInstance()
203
+ {
204
+ $instance = $this->getData('info_instance');
205
+ if (!($instance instanceof Mage_Payment_Model_Info)) {
206
+ Mage::throwException(Mage::helper('payment')->__('Cannot retrieve the payment information object instance.'));
207
+ }
208
+ return $instance;
209
+ }
210
+
211
+ /**
212
+ * Get order model
213
+ *
214
+ * @return Mage_Sales_Model_Order
215
+ */
216
+ public function getOrder()
217
+ {
218
+ if (!$this->_order) {
219
+ $this->_order = $this->getInfoInstance()->getOrder();
220
+ }
221
+ return $this->_order;
222
+ }
223
+
224
+ /**
225
+ * Return url for redirection after order placed
226
+ * @return string
227
+ */
228
+ public function getOrderPlaceRedirectUrl()
229
+ {
230
+ $moneyInToken = $this->_getCheckout()->getMoneyInToken();
231
+ if(!empty($moneyInToken)){
232
+
233
+ $this->_getCheckout()->unsMoneyInToken();
234
+
235
+ $cssUrl = $this->getConfigData('css_url');
236
+ $redirectUrl = $this->getHelper()->getConfig()->getWebkitUrl() . "?moneyintoken=".$moneyInToken.'&p='.urlencode($cssUrl).'&lang='.$this->getLang();
237
+ Mage::log($redirectUrl,null,"debug_lw.log");
238
+ //Redirect to webkit page
239
+ return $redirectUrl;
240
+ }
241
+
242
+ return false;
243
+ }
244
+
245
+
246
+ /**
247
+ * Return url current lang code
248
+ *
249
+ * @return string
250
+ */
251
+ public function getLang()
252
+ {
253
+ $locale = explode('_', Mage::app()->getLocale()->getLocaleCode());
254
+ if (is_array($locale) && !empty($locale) && in_array($locale[0], $this->_supportedLangs)) {
255
+ return $locale[0];
256
+ }
257
+ return $this->getDefaultLang();
258
+ }
259
+
260
+ /**
261
+ * @return Sirateck_Lemonway4ec_Helper_Data
262
+ */
263
+ public function getHelper(){
264
+ return Mage::helper('sirateck_lemonway4ec');
265
+ }
266
+
267
+ /*
268
+ Generate random ID for wallet IDs or tokens
269
+ */
270
+ private function getRandomId(){
271
+ return str_replace('.', '', microtime(true).rand());
272
+ }
273
+
274
+ }
app/code/community/Sirateck/Lemonway4ec/Model/Moneyout.php ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sirateck_Lemonway4ec extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Sirateck
13
+ * @package Sirateck_Lemonway4ec
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Moneyout model
19
+ *
20
+ * @category Sirateck
21
+ * @package Sirateck_Lemonway4ec
22
+ * @author Kassim Belghait kassim@sirateck.com
23
+ */
24
+ class Sirateck_Lemonway4ec_Model_Moneyout extends Mage_Core_Model_Abstract
25
+ {
26
+ /**
27
+ * Entity code.
28
+ * Can be used as part of method name for entity processing
29
+ */
30
+ const ENTITY = 'sirateck_lemonway4ec_moneyout';
31
+ const CACHE_TAG = 'sirateck_lemonway4ec_moneyout';
32
+
33
+ /**
34
+ * Prefix of model events names
35
+ *
36
+ * @var string
37
+ */
38
+ protected $_eventPrefix = 'sirateck_lemonway4ec_moneyout';
39
+
40
+ /**
41
+ * Parameter name in event
42
+ *
43
+ * @var string
44
+ */
45
+ protected $_eventObject = 'moneyout';
46
+
47
+ /**
48
+ * constructor
49
+ *
50
+ * @access public
51
+ * @return void
52
+ * @author Kassim Belghait kassim@sirateck.com
53
+ */
54
+ public function _construct()
55
+ {
56
+ parent::_construct();
57
+ $this->_init('sirateck_lemonway4ec/moneyout');
58
+ }
59
+
60
+ /**
61
+ * before save moneyout
62
+ *
63
+ * @access protected
64
+ * @return Sirateck_Lemonway4ec_Model_Moneyout
65
+ * @author Kassim Belghait kassim@sirateck.com
66
+ */
67
+ protected function _beforeSave()
68
+ {
69
+ parent::_beforeSave();
70
+ $now = Mage::getSingleton('core/date')->gmtDate();
71
+ if ($this->isObjectNew()) {
72
+ $this->setCreatedAt($now);
73
+ }
74
+ $this->setUpdatedAt($now);
75
+ return $this;
76
+ }
77
+
78
+ /**
79
+ * save moneyout relation
80
+ *
81
+ * @access public
82
+ * @return Sirateck_Lemonway4ec_Model_Moneyout
83
+ * @author Kassim Belghait kassim@sirateck.com
84
+ */
85
+ protected function _afterSave()
86
+ {
87
+ return parent::_afterSave();
88
+ }
89
+
90
+ }
app/code/community/Sirateck/Lemonway4ec/Model/Observer.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Sirateck_Lemonway4ec_Model_Observer {
4
+
5
+
6
+ /**
7
+ * Cancel orders stayed in pending because customer not validated payment form
8
+ */
9
+ public function cancelOrdersInPending()
10
+ {
11
+
12
+ if(!Mage::getStoreConfigFlag('payment/lemonway4ec_webkit/cancel_pending_order'))
13
+ return $this;
14
+
15
+ //Limited time in minutes
16
+ $limitedTime = 30;
17
+
18
+ $date = new Zend_Date();
19
+
20
+ /* @var $collection Mage_Sales_Model_Resource_Order_Collection */
21
+ $collection = Mage::getResourceModel('sales/order_collection');
22
+ $collection->addFieldToSelect(array('entity_id','increment_id','store_id','state'))
23
+ ->addFieldToFilter('main_table.state',Mage_Sales_Model_Order::STATE_NEW)
24
+ ->addFieldToFilter('op.method',array('eq'=>'lemonway4ec_webkit'))
25
+ ->addAttributeToFilter('created_at', array('to' => ($date->subMinute($limitedTime)->toString('Y-MM-dd HH:mm:ss'))))
26
+ ->join(array('op' => 'sales/order_payment'), 'main_table.entity_id=op.parent_id', array('method'));
27
+
28
+ /* @var $order Mage_Sales_Model_Order */
29
+ foreach ($collection as $order)
30
+ {
31
+ if($order->canCancel())
32
+ {
33
+ try {
34
+
35
+ $order->cancel();
36
+ $order
37
+ ->addStatusToHistory($order->getStatus(),// keep order status/state
38
+ Mage::helper('sirateck_lemonway4ec')->__("Order canceled automatically by cron because order is pending since %d minutes",$limitedTime));
39
+
40
+ $order->save();
41
+
42
+ } catch (Exception $e) {
43
+ Mage::logException($e);
44
+ }
45
+ }
46
+
47
+ }
48
+
49
+ return $this;
50
+ }
51
+
52
+
53
+ }
app/code/community/Sirateck/Lemonway4ec/Model/Resource/Iban.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sirateck_Lemonway4ec extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Sirateck
13
+ * @package Sirateck_Lemonway4ec
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Iban resource model
19
+ *
20
+ * @category Sirateck
21
+ * @package Sirateck_Lemonway4ec
22
+ * @author Kassim Belghait kassim@sirateck.com
23
+ */
24
+ class Sirateck_Lemonway4ec_Model_Resource_Iban extends Mage_Core_Model_Resource_Db_Abstract
25
+ {
26
+
27
+ /**
28
+ * constructor
29
+ *
30
+ * @access public
31
+ * @author Kassim Belghait kassim@sirateck.com
32
+ */
33
+ public function _construct()
34
+ {
35
+ $this->_init('sirateck_lemonway4ec/iban', 'iban_id');
36
+ }
37
+ }
app/code/community/Sirateck/Lemonway4ec/Model/Resource/Iban/Collection.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sirateck_Lemonway4ec extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Sirateck
13
+ * @package Sirateck_Lemonway4ec
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Iban collection resource model
19
+ *
20
+ * @category Sirateck
21
+ * @package Sirateck_Lemonway4ec
22
+ * @author Kassim Belghait kassim@sirateck.com
23
+ */
24
+ class Sirateck_Lemonway4ec_Model_Resource_Iban_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
25
+ {
26
+ protected $_joinedFields = array();
27
+
28
+ /**
29
+ * constructor
30
+ *
31
+ * @access public
32
+ * @return void
33
+ * @author Kassim Belghait kassim@sirateck.com
34
+ */
35
+ protected function _construct()
36
+ {
37
+ parent::_construct();
38
+ $this->_init('sirateck_lemonway4ec/iban');
39
+ }
40
+
41
+ /**
42
+ * get ibans as array
43
+ *
44
+ * @access protected
45
+ * @param string $valueField
46
+ * @param string $labelField
47
+ * @param array $additional
48
+ * @return array
49
+ * @author Kassim Belghait kassim@sirateck.com
50
+ */
51
+ protected function _toOptionArray($valueField='iban_id', $labelField='iban_id', $additional=array())
52
+ {
53
+ return parent::_toOptionArray($valueField, $labelField, $additional);
54
+ }
55
+
56
+ /**
57
+ * get options hash
58
+ *
59
+ * @access protected
60
+ * @param string $valueField
61
+ * @param string $labelField
62
+ * @return array
63
+ * @author Kassim Belghait kassim@sirateck.com
64
+ */
65
+ protected function _toOptionHash($valueField='iban_id', $labelField='iban_id')
66
+ {
67
+ return parent::_toOptionHash($valueField, $labelField);
68
+ }
69
+
70
+ /**
71
+ * Get SQL for get record count.
72
+ * Extra GROUP BY strip added.
73
+ *
74
+ * @access public
75
+ * @return Varien_Db_Select
76
+ * @author Kassim Belghait kassim@sirateck.com
77
+ */
78
+ public function getSelectCountSql()
79
+ {
80
+ $countSelect = parent::getSelectCountSql();
81
+ $countSelect->reset(Zend_Db_Select::GROUP);
82
+ return $countSelect;
83
+ }
84
+ }
app/code/community/Sirateck/Lemonway4ec/Model/Resource/Moneyout.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sirateck_Lemonway4ec extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Sirateck
13
+ * @package Sirateck_Lemonway4ec
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Moneyout resource model
19
+ *
20
+ * @category Sirateck
21
+ * @package Sirateck_Lemonway4ec
22
+ * @author Kassim Belghait kassim@sirateck.com
23
+ */
24
+ class Sirateck_Lemonway4ec_Model_Resource_Moneyout extends Mage_Core_Model_Resource_Db_Abstract
25
+ {
26
+
27
+ /**
28
+ * constructor
29
+ *
30
+ * @access public
31
+ * @author Kassim Belghait kassim@sirateck.com
32
+ */
33
+ public function _construct()
34
+ {
35
+ $this->_init('sirateck_lemonway4ec/moneyout', 'moneyout_id');
36
+ }
37
+ }
app/code/community/Sirateck/Lemonway4ec/Model/Resource/Moneyout/Collection.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sirateck_Lemonway4ec extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Sirateck
13
+ * @package Sirateck_Lemonway4ec
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Moneyout collection resource model
19
+ *
20
+ * @category Sirateck
21
+ * @package Sirateck_Lemonway4ec
22
+ * @author Kassim Belghait kassim@sirateck.com
23
+ */
24
+ class Sirateck_Lemonway4ec_Model_Resource_Moneyout_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
25
+ {
26
+ protected $_joinedFields = array();
27
+
28
+ /**
29
+ * constructor
30
+ *
31
+ * @access public
32
+ * @return void
33
+ * @author Kassim Belghait kassim@sirateck.com
34
+ */
35
+ protected function _construct()
36
+ {
37
+ parent::_construct();
38
+ $this->_init('sirateck_lemonway4ec/moneyout');
39
+ }
40
+
41
+ /**
42
+ * get moneyouts as array
43
+ *
44
+ * @access protected
45
+ * @param string $valueField
46
+ * @param string $labelField
47
+ * @param array $additional
48
+ * @return array
49
+ * @author Kassim Belghait kassim@sirateck.com
50
+ */
51
+ protected function _toOptionArray($valueField='moneyout_id', $labelField='moneyout_id', $additional=array())
52
+ {
53
+ return parent::_toOptionArray($valueField, $labelField, $additional);
54
+ }
55
+
56
+ /**
57
+ * get options hash
58
+ *
59
+ * @access protected
60
+ * @param string $valueField
61
+ * @param string $labelField
62
+ * @return array
63
+ * @author Kassim Belghait kassim@sirateck.com
64
+ */
65
+ protected function _toOptionHash($valueField='moneyout_id', $labelField='moneyout_id')
66
+ {
67
+ return parent::_toOptionHash($valueField, $labelField);
68
+ }
69
+
70
+ /**
71
+ * Get SQL for get record count.
72
+ * Extra GROUP BY strip added.
73
+ *
74
+ * @access public
75
+ * @return Varien_Db_Select
76
+ * @author Kassim Belghait kassim@sirateck.com
77
+ */
78
+ public function getSelectCountSql()
79
+ {
80
+ $countSelect = parent::getSelectCountSql();
81
+ $countSelect->reset(Zend_Db_Select::GROUP);
82
+ return $countSelect;
83
+ }
84
+ }
app/code/community/Sirateck/Lemonway4ec/Model/Resource/Setup.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sirateck_Lemonway4ec extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Sirateck
13
+ * @package Sirateck_Lemonway4ec
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Lemonway setup
19
+ *
20
+ * @category Sirateck
21
+ * @package Sirateck_Lemonway4ec
22
+ * @author Kassim Belghait kassim@sirateck.com
23
+ */
24
+ class Sirateck_Lemonway4ec_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup
25
+ {
26
+ }
app/code/community/Sirateck/Lemonway4ec/Model/Resource/Wallet.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sirateck_Lemonway4ec extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Sirateck
13
+ * @package Sirateck_Lemonway4ec
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Wallet resource model
19
+ *
20
+ * @category Sirateck
21
+ * @package Sirateck_Lemonway4ec
22
+ * @author Kassim Belghait kassim@sirateck.com
23
+ */
24
+ class Sirateck_Lemonway4ec_Model_Resource_Wallet extends Mage_Core_Model_Resource_Db_Abstract
25
+ {
26
+
27
+ /**
28
+ * constructor
29
+ *
30
+ * @access public
31
+ * @author Kassim Belghait kassim@sirateck.com
32
+ */
33
+ public function _construct()
34
+ {
35
+ $this->_init('sirateck_lemonway4ec/wallet', 'entity_id');
36
+ }
37
+ }
app/code/community/Sirateck/Lemonway4ec/Model/Resource/Wallet/Collection.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sirateck_Lemonway4ec extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Sirateck
13
+ * @package Sirateck_Lemonway4ec
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Wallet collection resource model
19
+ *
20
+ * @category Sirateck
21
+ * @package Sirateck_Lemonway4ec
22
+ * @author Kassim Belghait kassim@sirateck.com
23
+ */
24
+ class Sirateck_Lemonway4ec_Model_Resource_Wallet_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
25
+ {
26
+ protected $_joinedFields = array();
27
+
28
+ /**
29
+ * constructor
30
+ *
31
+ * @access public
32
+ * @return void
33
+ * @author Kassim Belghait kassim@sirateck.com
34
+ */
35
+ protected function _construct()
36
+ {
37
+ parent::_construct();
38
+ $this->_init('sirateck_lemonway4ec/wallet');
39
+ }
40
+
41
+ /**
42
+ * get wallets as array
43
+ *
44
+ * @access protected
45
+ * @param string $valueField
46
+ * @param string $labelField
47
+ * @param array $additional
48
+ * @return array
49
+ * @author Kassim Belghait kassim@sirateck.com
50
+ */
51
+ protected function _toOptionArray($valueField='entity_id', $labelField='wallet_id', $additional=array())
52
+ {
53
+ return parent::_toOptionArray($valueField, $labelField, $additional);
54
+ }
55
+
56
+ /**
57
+ * get options hash
58
+ *
59
+ * @access protected
60
+ * @param string $valueField
61
+ * @param string $labelField
62
+ * @return array
63
+ * @author Kassim Belghait kassim@sirateck.com
64
+ */
65
+ protected function _toOptionHash($valueField='entity_id', $labelField='wallet_id')
66
+ {
67
+ return parent::_toOptionHash($valueField, $labelField);
68
+ }
69
+
70
+ /**
71
+ * Get SQL for get record count.
72
+ * Extra GROUP BY strip added.
73
+ *
74
+ * @access public
75
+ * @return Varien_Db_Select
76
+ * @author Kassim Belghait kassim@sirateck.com
77
+ */
78
+ public function getSelectCountSql()
79
+ {
80
+ $countSelect = parent::getSelectCountSql();
81
+ $countSelect->reset(Zend_Db_Select::GROUP);
82
+ return $countSelect;
83
+ }
84
+ }
app/code/community/Sirateck/Lemonway4ec/Model/Wallet.php ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sirateck_Lemonway4ec extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Sirateck
13
+ * @package Sirateck_Lemonway4ec
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Wallet model
19
+ *
20
+ * @category Sirateck
21
+ * @package Sirateck_Lemonway4ec
22
+ * @author Kassim Belghait kassim@sirateck.com
23
+ */
24
+ class Sirateck_Lemonway4ec_Model_Wallet extends Mage_Core_Model_Abstract
25
+ {
26
+ /**
27
+ * Entity code.
28
+ * Can be used as part of method name for entity processing
29
+ */
30
+ const ENTITY = 'sirateck_lemonway4ec_wallet';
31
+ const CACHE_TAG = 'sirateck_lemonway4ec_wallet';
32
+
33
+ /**
34
+ * Prefix of model events names
35
+ *
36
+ * @var string
37
+ */
38
+ protected $_eventPrefix = 'sirateck_lemonway4ec_wallet';
39
+
40
+ /**
41
+ * Parameter name in event
42
+ *
43
+ * @var string
44
+ */
45
+ protected $_eventObject = 'wallet';
46
+
47
+ /* public static $statuesLabel = array(1 => "Document uniquement reçu",
48
+ 2 => "Document vérifié et accepté",
49
+ 3 => "Document vérifié mais non accepté",
50
+ 4 => "Document remplacé par un autre document",
51
+ 5 => "Validité du document expiré"); */
52
+
53
+ public static $statuesLabel = array(1 => "Document only received",
54
+ 2 => "Document checked and accepted",
55
+ 3 => "Document checked but not accepted",
56
+ 4 => "Document replaced by another document",
57
+ 5 => "Document validity expired");
58
+
59
+ public static $docsType = array(
60
+ 0=>"ID card (UE)",
61
+ 1=>"Proof of address",
62
+ 2=>"RIB",
63
+ 3=>"Passport (UE)",
64
+ 4=>"Passport (Not UE)",
65
+ 5=>"Residence permit",
66
+ 7=>"Kbis",
67
+ 11=>"Miscellaneous",
68
+ );
69
+
70
+ /**
71
+ * constructor
72
+ *
73
+ * @access public
74
+ * @return void
75
+ * @author Kassim Belghait kassim@sirateck.com
76
+ */
77
+ public function _construct()
78
+ {
79
+ parent::_construct();
80
+ $this->_init('sirateck_lemonway4ec/wallet');
81
+ }
82
+
83
+ /**
84
+ * before save wallet
85
+ *
86
+ * @access protected
87
+ * @return Sirateck_Lemonway4ec_Model_Wallet
88
+ * @author Kassim Belghait kassim@sirateck.com
89
+ */
90
+ protected function _beforeSave()
91
+ {
92
+ parent::_beforeSave();
93
+ $now = Mage::getSingleton('core/date')->gmtDate();
94
+ if ($this->isObjectNew()) {
95
+ $this->setCreatedAt($now);
96
+ }
97
+ $this->setUpdatedAt($now);
98
+ return $this;
99
+ }
100
+
101
+ /**
102
+ * save wallet relation
103
+ *
104
+ * @access public
105
+ * @return Sirateck_Lemonway4ec_Model_Wallet
106
+ * @author Kassim Belghait kassim@sirateck.com
107
+ */
108
+ protected function _afterSave()
109
+ {
110
+ return parent::_afterSave();
111
+ }
112
+
113
+ /**
114
+ * get default values
115
+ *
116
+ * @access public
117
+ * @return array
118
+ * @author Kassim Belghait kassim@sirateck.com
119
+ */
120
+ public function getDefaultValues()
121
+ {
122
+ $values = array();
123
+ $values['status'] = 1;
124
+ $values['is_default'] = '1';
125
+
126
+ return $values;
127
+ }
128
+
129
+ }
app/code/community/Sirateck/Lemonway4ec/Model/Wallet/Attribute/Source/Payerorbeneficiary.php ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sirateck_Lemonway4ec extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Sirateck
13
+ * @package Sirateck_Lemonway4ec
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Admin source model for Payer or beneficiary
19
+ *
20
+ * @category Sirateck
21
+ * @package Sirateck_Lemonway4ec
22
+ * @author Kassim Belghait kassim@sirateck.com
23
+ */
24
+ class Sirateck_Lemonway4ec_Model_Wallet_Attribute_Source_Payerorbeneficiary extends Mage_Eav_Model_Entity_Attribute_Source_Table
25
+ {
26
+ /**
27
+ * get possible values
28
+ *
29
+ * @access public
30
+ * @param bool $withEmpty
31
+ * @param bool $defaultValues
32
+ * @return array
33
+ * @author Kassim Belghait kassim@sirateck.com
34
+ */
35
+ public function getAllOptions($withEmpty = true, $defaultValues = false)
36
+ {
37
+ $options = array(
38
+ array(
39
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Unknow state'),
40
+ 'value' => 1
41
+ ),
42
+ array(
43
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Payer'),
44
+ 'value' => 2
45
+ ),
46
+ array(
47
+ 'label' => Mage::helper('sirateck_lemonway4ec')->__('Beneficiary'),
48
+ 'value' => 3
49
+ ),
50
+ );
51
+ if ($withEmpty) {
52
+ array_unshift($options, array('label'=>'', 'value'=>''));
53
+ }
54
+ return $options;
55
+
56
+ }
57
+
58
+ /**
59
+ * get options as array
60
+ *
61
+ * @access public
62
+ * @param bool $withEmpty
63
+ * @return string
64
+ * @author Kassim Belghait kassim@sirateck.com
65
+ */
66
+ public function getOptionsArray($withEmpty = true)
67
+ {
68
+ $options = array();
69
+ foreach ($this->getAllOptions($withEmpty) as $option) {
70
+ $options[$option['value']] = $option['label'];
71
+ }
72
+ return $options;
73
+ }
74
+
75
+ /**
76
+ * get option text
77
+ *
78
+ * @access public
79
+ * @param mixed $value
80
+ * @return string
81
+ * @author Kassim Belghait kassim@sirateck.com
82
+ */
83
+ public function getOptionText($value)
84
+ {
85
+ $options = $this->getOptionsArray();
86
+ if (!is_array($value)) {
87
+ $value = explode(',', $value);
88
+ }
89
+ $texts = array();
90
+ foreach ($value as $v) {
91
+ if (isset($options[$v])) {
92
+ $texts[] = $options[$v];
93
+ }
94
+ }
95
+ return implode(', ', $texts);
96
+ }
97
+ }
app/code/community/Sirateck/Lemonway4ec/controllers/Adminhtml/Lemonway/MoneyoutController.php ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sirateck_Lemonway4ec extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Sirateck
13
+ * @package Sirateck_Lemonway4ec
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Wallet admin controller
19
+ *
20
+ * @category Sirateck
21
+ * @package Sirateck_Lemonway4ec
22
+ * @author Kassim Belghait kassim@sirateck.com
23
+ */
24
+ class Sirateck_Lemonway4ec_Adminhtml_Lemonway_MoneyoutController extends Sirateck_Lemonway4ec_Controller_Adminhtml_Lemonway
25
+ {
26
+
27
+
28
+ /**
29
+ * view action
30
+ *
31
+ * @access public
32
+ * @return void
33
+ * @author Kassim Belghait kassim@sirateck.com
34
+ */
35
+ public function payAction()
36
+ {
37
+ $this->loadLayout();
38
+ $this->_title(Mage::helper('sirateck_lemonway4ec')->__('Lemonway'))
39
+ ->_title(Mage::helper('sirateck_lemonway4ec')->__('MoneyOut'));
40
+ $this->renderLayout();
41
+ }
42
+
43
+ public function payPostAction(){
44
+
45
+ if ($this->getRequest()->isPost()) {
46
+
47
+ $iban = "";
48
+
49
+ $walletId= $this->getRequest()->getPost('wallet_id', false);
50
+ $bal= (float)$this->getRequest()->getPost('bal', 0);
51
+ $balFormated = Mage::helper("core")->formatPrice((float)$bal);
52
+ $ibanId = 0;
53
+ $ibanIds = $this->getRequest()->getPost('iban_id', array());
54
+ if(count($ibanIds) > 0)
55
+ {
56
+ $ibanId = current($ibanIds);
57
+ $iban = $this->getRequest()->getPost('iban_' . $ibanId, "");
58
+ }
59
+ $amountToPay = (float)str_replace(",", ".",$this->getRequest()->getPost('amountToPay', 0));
60
+ $amountFormated = Mage::helper("core")->formatPrice((float)$amountToPay);
61
+
62
+ if($amountToPay > $bal)
63
+ {
64
+ $this->_getSession()->addError($this->__("You can't paid amount upper of your balance amount: %s",$balFormated));
65
+ $this->_redirect("*/*/pay");
66
+ return $this;
67
+ }
68
+
69
+ if($walletId && $ibanId && $amountToPay > 0 && $bal > 0)
70
+ {
71
+ try {
72
+ $params = array(
73
+ "wallet"=>$walletId,
74
+ "amountTot"=>sprintf("%.2f" ,$amountToPay),
75
+ "amountCom"=>sprintf("%.2f" ,(float)0),
76
+ "message"=>$this->__("Moneyout from Magento module"),
77
+ "ibanId"=>$ibanId,
78
+ "autoCommission" => 0,
79
+ );
80
+ //Init APi kit
81
+ /* @var $kit Sirateck_Lemonway4ec_Model_Apikit_Kit */
82
+ $kit = Mage::getSingleton('sirateck_lemonway4ec/apikit_kit');
83
+ $apiResponse = $kit->MoneyOut($params);
84
+
85
+ if($apiResponse->lwError)
86
+ Mage::throwException($apiResponse->lwError->getMessage());
87
+
88
+ if(count($apiResponse->operations))
89
+ {
90
+ /* @var $op Sirateck_Lemonway4ec_Model_Apikit_Apimodels_Operation */
91
+ $op = $apiResponse->operations[0];
92
+ if($op->getHpayId())
93
+ {
94
+
95
+ $this->_getSession()->addSuccess($this->__("You paid %s to your Iban %s from your wallet <b>%s</b>",$amountFormated,$iban,$walletId));
96
+ }
97
+ else {
98
+ Mage::throwException($this->__("An error occurred. Please contact support."));
99
+ }
100
+ }
101
+
102
+
103
+ } catch (Exception $e) {
104
+
105
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
106
+
107
+ }
108
+
109
+ }
110
+ }
111
+
112
+ $this->_redirect('*/*/pay');
113
+ }
114
+
115
+ /**
116
+ * Check if admin has permissions to visit related pages
117
+ *
118
+ * @access protected
119
+ * @return boolean
120
+ * @author Kassim Belghait kassim@sirateck.com
121
+ */
122
+ protected function _isAllowed()
123
+ {
124
+ return Mage::getSingleton('admin/session')->isAllowed('sales/sirateck_lemonway4ec/moneyout');
125
+ }
126
+
127
+ /**
128
+ *
129
+ * @return Sirateck_Lemonway4ec_Model_Method_Webkit
130
+ */
131
+ protected function getMethodInstance(){
132
+ return MAge::getSingleton('sirateck_lemonway4ec/method_webkit');
133
+ }
134
+ }
app/code/community/Sirateck/Lemonway4ec/controllers/Adminhtml/Lemonway/WalletController.php ADDED
@@ -0,0 +1,662 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sirateck_Lemonway4ec extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Sirateck
13
+ * @package Sirateck_Lemonway4ec
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Wallet admin controller
19
+ *
20
+ * @category Sirateck
21
+ * @package Sirateck_Lemonway4ec
22
+ * @author Kassim Belghait kassim@sirateck.com
23
+ */
24
+ class Sirateck_Lemonway4ec_Adminhtml_Lemonway_WalletController extends Sirateck_Lemonway4ec_Controller_Adminhtml_Lemonway
25
+ {
26
+ /**
27
+ * init the wallet
28
+ *
29
+ * @access protected
30
+ * @return Sirateck_Lemonway4ec_Model_Wallet
31
+ */
32
+ protected function _initWallet()
33
+ {
34
+ $walletId = (int) $this->getRequest()->getParam('id');
35
+ $wallet = Mage::getModel('sirateck_lemonway4ec/wallet');
36
+ if ($walletId) {
37
+ $wallet->load($walletId);
38
+ }
39
+ Mage::register('current_wallet', $wallet);
40
+ return $wallet;
41
+ }
42
+
43
+ /**
44
+ * default action
45
+ *
46
+ * @access public
47
+ * @return void
48
+ * @author Kassim Belghait kassim@sirateck.com
49
+ */
50
+ public function indexAction()
51
+ {
52
+ $this->loadLayout();
53
+ $this->_title(Mage::helper('sirateck_lemonway4ec')->__('LW'))
54
+ ->_title(Mage::helper('sirateck_lemonway4ec')->__('Wallets'));
55
+ $this->renderLayout();
56
+ }
57
+
58
+ /**
59
+ * grid action
60
+ *
61
+ * @access public
62
+ * @return void
63
+ * @author Kassim Belghait kassim@sirateck.com
64
+ */
65
+ public function gridAction()
66
+ {
67
+ $this->loadLayout()->renderLayout();
68
+ }
69
+
70
+ /**
71
+ * edit wallet - action
72
+ *
73
+ * @access public
74
+ * @return void
75
+ * @author Kassim Belghait kassim@sirateck.com
76
+ */
77
+ public function editAction()
78
+ {
79
+ $walletId = $this->getRequest()->getParam('id');
80
+ $wallet = $this->_initWallet();
81
+ if ($walletId && !$wallet->getId()) {
82
+ $this->_getSession()->addError(
83
+ Mage::helper('sirateck_lemonway4ec')->__('This wallet no longer exists.')
84
+ );
85
+ $this->_redirect('*/*/');
86
+ return;
87
+ }
88
+ $data = Mage::getSingleton('adminhtml/session')->getWalletData(true);
89
+ if (!empty($data)) {
90
+ $wallet->setData($data);
91
+ }
92
+ Mage::register('wallet_data', $wallet);
93
+ $this->loadLayout();
94
+ $this->_title(Mage::helper('sirateck_lemonway4ec')->__('LW'))
95
+ ->_title(Mage::helper('sirateck_lemonway4ec')->__('Wallets'));
96
+ if ($wallet->getId()) {
97
+ $this->_title($wallet->getWalletId());
98
+ } else {
99
+ $this->_title(Mage::helper('sirateck_lemonway4ec')->__('Add wallet'));
100
+ }
101
+ if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
102
+ $this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
103
+ }
104
+ $this->renderLayout();
105
+ }
106
+
107
+ /**
108
+ * new wallet action
109
+ *
110
+ * @access public
111
+ * @return void
112
+ * @author Kassim Belghait kassim@sirateck.com
113
+ */
114
+ public function newAction()
115
+ {
116
+ $this->_forward('edit');
117
+ }
118
+
119
+ /**
120
+ * save wallet - action
121
+ *
122
+ * @access public
123
+ * @return void
124
+ * @author Kassim Belghait kassim@sirateck.com
125
+ */
126
+ public function saveAction()
127
+ {
128
+ if ($data = $this->getRequest()->getPost('wallet')) {
129
+ try {
130
+ $data = $this->_filterDates($data, array('customer_dob'));
131
+ $wallet = $this->_initWallet();
132
+ $wallet->addData($data);
133
+ $wallet->save();
134
+ Mage::getSingleton('adminhtml/session')->addSuccess(
135
+ Mage::helper('sirateck_lemonway4ec')->__('Wallet was successfully saved')
136
+ );
137
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
138
+ if ($this->getRequest()->getParam('back')) {
139
+ $this->_redirect('*/*/edit', array('id' => $wallet->getId()));
140
+ return;
141
+ }
142
+ $this->_redirect('*/*/');
143
+ return;
144
+ } catch (Mage_Core_Exception $e) {
145
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
146
+ Mage::getSingleton('adminhtml/session')->setWalletData($data);
147
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
148
+ return;
149
+ } catch (Exception $e) {
150
+ Mage::logException($e);
151
+ Mage::getSingleton('adminhtml/session')->addError(
152
+ Mage::helper('sirateck_lemonway4ec')->__('There was a problem saving the wallet.')
153
+ );
154
+ Mage::getSingleton('adminhtml/session')->setWalletData($data);
155
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
156
+ return;
157
+ }
158
+ }
159
+ Mage::getSingleton('adminhtml/session')->addError(
160
+ Mage::helper('sirateck_lemonway4ec')->__('Unable to find wallet to save.')
161
+ );
162
+ $this->_redirect('*/*/');
163
+ }
164
+
165
+ /**
166
+ * delete wallet - action
167
+ *
168
+ * @access public
169
+ * @return void
170
+ * @author Kassim Belghait kassim@sirateck.com
171
+ */
172
+ public function deleteAction()
173
+ {
174
+ if ( $this->getRequest()->getParam('id') > 0) {
175
+ try {
176
+ $wallet = Mage::getModel('sirateck_lemonway4ec/wallet');
177
+ $wallet->setId($this->getRequest()->getParam('id'))->delete();
178
+ Mage::getSingleton('adminhtml/session')->addSuccess(
179
+ Mage::helper('sirateck_lemonway4ec')->__('Wallet was successfully deleted.')
180
+ );
181
+ $this->_redirect('*/*/');
182
+ return;
183
+ } catch (Mage_Core_Exception $e) {
184
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
185
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
186
+ } catch (Exception $e) {
187
+ Mage::getSingleton('adminhtml/session')->addError(
188
+ Mage::helper('sirateck_lemonway4ec')->__('There was an error deleting wallet.')
189
+ );
190
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
191
+ Mage::logException($e);
192
+ return;
193
+ }
194
+ }
195
+ Mage::getSingleton('adminhtml/session')->addError(
196
+ Mage::helper('sirateck_lemonway4ec')->__('Could not find wallet to delete.')
197
+ );
198
+ $this->_redirect('*/*/');
199
+ }
200
+
201
+ /**
202
+ * mass delete wallet - action
203
+ *
204
+ * @access public
205
+ * @return void
206
+ * @author Kassim Belghait kassim@sirateck.com
207
+ */
208
+ public function massDeleteAction()
209
+ {
210
+ $walletIds = $this->getRequest()->getParam('wallet');
211
+ if (!is_array($walletIds)) {
212
+ Mage::getSingleton('adminhtml/session')->addError(
213
+ Mage::helper('sirateck_lemonway4ec')->__('Please select wallets to delete.')
214
+ );
215
+ } else {
216
+ try {
217
+ foreach ($walletIds as $walletId) {
218
+ $wallet = Mage::getModel('sirateck_lemonway4ec/wallet');
219
+ $wallet->setId($walletId)->delete();
220
+ }
221
+ Mage::getSingleton('adminhtml/session')->addSuccess(
222
+ Mage::helper('sirateck_lemonway4ec')->__('Total of %d wallets were successfully deleted.', count($walletIds))
223
+ );
224
+ } catch (Mage_Core_Exception $e) {
225
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
226
+ } catch (Exception $e) {
227
+ Mage::getSingleton('adminhtml/session')->addError(
228
+ Mage::helper('sirateck_lemonway4ec')->__('There was an error deleting wallets.')
229
+ );
230
+ Mage::logException($e);
231
+ }
232
+ }
233
+ $this->_redirect('*/*/index');
234
+ }
235
+
236
+ /**
237
+ * mass status change - action
238
+ *
239
+ * @access public
240
+ * @return void
241
+ * @author Kassim Belghait kassim@sirateck.com
242
+ */
243
+ public function massStatusAction()
244
+ {
245
+ $walletIds = $this->getRequest()->getParam('wallet');
246
+ if (!is_array($walletIds)) {
247
+ Mage::getSingleton('adminhtml/session')->addError(
248
+ Mage::helper('sirateck_lemonway4ec')->__('Please select wallets.')
249
+ );
250
+ } else {
251
+ try {
252
+ foreach ($walletIds as $walletId) {
253
+ $wallet = Mage::getSingleton('sirateck_lemonway4ec/wallet')->load($walletId)
254
+ ->setStatus($this->getRequest()->getParam('status'))
255
+ ->setIsMassupdate(true)
256
+ ->save();
257
+ }
258
+ $this->_getSession()->addSuccess(
259
+ $this->__('Total of %d wallets were successfully updated.', count($walletIds))
260
+ );
261
+ } catch (Mage_Core_Exception $e) {
262
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
263
+ } catch (Exception $e) {
264
+ Mage::getSingleton('adminhtml/session')->addError(
265
+ Mage::helper('sirateck_lemonway4ec')->__('There was an error updating wallets.')
266
+ );
267
+ Mage::logException($e);
268
+ }
269
+ }
270
+ $this->_redirect('*/*/index');
271
+ }
272
+
273
+ /**
274
+ * mass Is Admin change - action
275
+ *
276
+ * @access public
277
+ * @return void
278
+ * @author Kassim Belghait kassim@sirateck.com
279
+ */
280
+ public function massIsAdminAction()
281
+ {
282
+ $walletIds = $this->getRequest()->getParam('wallet');
283
+ if (!is_array($walletIds)) {
284
+ Mage::getSingleton('adminhtml/session')->addError(
285
+ Mage::helper('sirateck_lemonway4ec')->__('Please select wallets.')
286
+ );
287
+ } else {
288
+ try {
289
+ foreach ($walletIds as $walletId) {
290
+ $wallet = Mage::getSingleton('sirateck_lemonway4ec/wallet')->load($walletId)
291
+ ->setIsAdmin($this->getRequest()->getParam('flag_is_admin'))
292
+ ->setIsMassupdate(true)
293
+ ->save();
294
+ }
295
+ $this->_getSession()->addSuccess(
296
+ $this->__('Total of %d wallets were successfully updated.', count($walletIds))
297
+ );
298
+ } catch (Mage_Core_Exception $e) {
299
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
300
+ } catch (Exception $e) {
301
+ Mage::getSingleton('adminhtml/session')->addError(
302
+ Mage::helper('sirateck_lemonway4ec')->__('There was an error updating wallets.')
303
+ );
304
+ Mage::logException($e);
305
+ }
306
+ }
307
+ $this->_redirect('*/*/index');
308
+ }
309
+
310
+ /**
311
+ * mass Country change - action
312
+ *
313
+ * @access public
314
+ * @return void
315
+ * @author Kassim Belghait kassim@sirateck.com
316
+ */
317
+ public function massBillingAddressCountryAction()
318
+ {
319
+ $walletIds = $this->getRequest()->getParam('wallet');
320
+ if (!is_array($walletIds)) {
321
+ Mage::getSingleton('adminhtml/session')->addError(
322
+ Mage::helper('sirateck_lemonway4ec')->__('Please select wallets.')
323
+ );
324
+ } else {
325
+ try {
326
+ foreach ($walletIds as $walletId) {
327
+ $wallet = Mage::getSingleton('sirateck_lemonway4ec/wallet')->load($walletId)
328
+ ->setBillingAddressCountry($this->getRequest()->getParam('flag_billing_address_country'))
329
+ ->setIsMassupdate(true)
330
+ ->save();
331
+ }
332
+ $this->_getSession()->addSuccess(
333
+ $this->__('Total of %d wallets were successfully updated.', count($walletIds))
334
+ );
335
+ } catch (Mage_Core_Exception $e) {
336
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
337
+ } catch (Exception $e) {
338
+ Mage::getSingleton('adminhtml/session')->addError(
339
+ Mage::helper('sirateck_lemonway4ec')->__('There was an error updating wallets.')
340
+ );
341
+ Mage::logException($e);
342
+ }
343
+ }
344
+ $this->_redirect('*/*/index');
345
+ }
346
+
347
+ /**
348
+ * mass Is company change - action
349
+ *
350
+ * @access public
351
+ * @return void
352
+ * @author Kassim Belghait kassim@sirateck.com
353
+ */
354
+ public function massIsCompanyAction()
355
+ {
356
+ $walletIds = $this->getRequest()->getParam('wallet');
357
+ if (!is_array($walletIds)) {
358
+ Mage::getSingleton('adminhtml/session')->addError(
359
+ Mage::helper('sirateck_lemonway4ec')->__('Please select wallets.')
360
+ );
361
+ } else {
362
+ try {
363
+ foreach ($walletIds as $walletId) {
364
+ $wallet = Mage::getSingleton('sirateck_lemonway4ec/wallet')->load($walletId)
365
+ ->setIsCompany($this->getRequest()->getParam('flag_is_company'))
366
+ ->setIsMassupdate(true)
367
+ ->save();
368
+ }
369
+ $this->_getSession()->addSuccess(
370
+ $this->__('Total of %d wallets were successfully updated.', count($walletIds))
371
+ );
372
+ } catch (Mage_Core_Exception $e) {
373
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
374
+ } catch (Exception $e) {
375
+ Mage::getSingleton('adminhtml/session')->addError(
376
+ Mage::helper('sirateck_lemonway4ec')->__('There was an error updating wallets.')
377
+ );
378
+ Mage::logException($e);
379
+ }
380
+ }
381
+ $this->_redirect('*/*/index');
382
+ }
383
+
384
+ /**
385
+ * mass Is debtor change - action
386
+ *
387
+ * @access public
388
+ * @return void
389
+ * @author Kassim Belghait kassim@sirateck.com
390
+ */
391
+ public function massIsDebtorAction()
392
+ {
393
+ $walletIds = $this->getRequest()->getParam('wallet');
394
+ if (!is_array($walletIds)) {
395
+ Mage::getSingleton('adminhtml/session')->addError(
396
+ Mage::helper('sirateck_lemonway4ec')->__('Please select wallets.')
397
+ );
398
+ } else {
399
+ try {
400
+ foreach ($walletIds as $walletId) {
401
+ $wallet = Mage::getSingleton('sirateck_lemonway4ec/wallet')->load($walletId)
402
+ ->setIsDebtor($this->getRequest()->getParam('flag_is_debtor'))
403
+ ->setIsMassupdate(true)
404
+ ->save();
405
+ }
406
+ $this->_getSession()->addSuccess(
407
+ $this->__('Total of %d wallets were successfully updated.', count($walletIds))
408
+ );
409
+ } catch (Mage_Core_Exception $e) {
410
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
411
+ } catch (Exception $e) {
412
+ Mage::getSingleton('adminhtml/session')->addError(
413
+ Mage::helper('sirateck_lemonway4ec')->__('There was an error updating wallets.')
414
+ );
415
+ Mage::logException($e);
416
+ }
417
+ }
418
+ $this->_redirect('*/*/index');
419
+ }
420
+
421
+ /**
422
+ * mass Nationality change - action
423
+ *
424
+ * @access public
425
+ * @return void
426
+ * @author Kassim Belghait kassim@sirateck.com
427
+ */
428
+ public function massCustomerNationalityAction()
429
+ {
430
+ $walletIds = $this->getRequest()->getParam('wallet');
431
+ if (!is_array($walletIds)) {
432
+ Mage::getSingleton('adminhtml/session')->addError(
433
+ Mage::helper('sirateck_lemonway4ec')->__('Please select wallets.')
434
+ );
435
+ } else {
436
+ try {
437
+ foreach ($walletIds as $walletId) {
438
+ $wallet = Mage::getSingleton('sirateck_lemonway4ec/wallet')->load($walletId)
439
+ ->setCustomerNationality($this->getRequest()->getParam('flag_customer_nationality'))
440
+ ->setIsMassupdate(true)
441
+ ->save();
442
+ }
443
+ $this->_getSession()->addSuccess(
444
+ $this->__('Total of %d wallets were successfully updated.', count($walletIds))
445
+ );
446
+ } catch (Mage_Core_Exception $e) {
447
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
448
+ } catch (Exception $e) {
449
+ Mage::getSingleton('adminhtml/session')->addError(
450
+ Mage::helper('sirateck_lemonway4ec')->__('There was an error updating wallets.')
451
+ );
452
+ Mage::logException($e);
453
+ }
454
+ }
455
+ $this->_redirect('*/*/index');
456
+ }
457
+
458
+ /**
459
+ * mass Birth country change - action
460
+ *
461
+ * @access public
462
+ * @return void
463
+ * @author Kassim Belghait kassim@sirateck.com
464
+ */
465
+ public function massCustomerBirthCountryAction()
466
+ {
467
+ $walletIds = $this->getRequest()->getParam('wallet');
468
+ if (!is_array($walletIds)) {
469
+ Mage::getSingleton('adminhtml/session')->addError(
470
+ Mage::helper('sirateck_lemonway4ec')->__('Please select wallets.')
471
+ );
472
+ } else {
473
+ try {
474
+ foreach ($walletIds as $walletId) {
475
+ $wallet = Mage::getSingleton('sirateck_lemonway4ec/wallet')->load($walletId)
476
+ ->setCustomerBirthCountry($this->getRequest()->getParam('flag_customer_birth_country'))
477
+ ->setIsMassupdate(true)
478
+ ->save();
479
+ }
480
+ $this->_getSession()->addSuccess(
481
+ $this->__('Total of %d wallets were successfully updated.', count($walletIds))
482
+ );
483
+ } catch (Mage_Core_Exception $e) {
484
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
485
+ } catch (Exception $e) {
486
+ Mage::getSingleton('adminhtml/session')->addError(
487
+ Mage::helper('sirateck_lemonway4ec')->__('There was an error updating wallets.')
488
+ );
489
+ Mage::logException($e);
490
+ }
491
+ }
492
+ $this->_redirect('*/*/index');
493
+ }
494
+
495
+ /**
496
+ * mass Payer or beneficiary change - action
497
+ *
498
+ * @access public
499
+ * @return void
500
+ * @author Kassim Belghait kassim@sirateck.com
501
+ */
502
+ public function massPayerOrBeneficiaryAction()
503
+ {
504
+ $walletIds = $this->getRequest()->getParam('wallet');
505
+ if (!is_array($walletIds)) {
506
+ Mage::getSingleton('adminhtml/session')->addError(
507
+ Mage::helper('sirateck_lemonway4ec')->__('Please select wallets.')
508
+ );
509
+ } else {
510
+ try {
511
+ foreach ($walletIds as $walletId) {
512
+ $wallet = Mage::getSingleton('sirateck_lemonway4ec/wallet')->load($walletId)
513
+ ->setPayerOrBeneficiary($this->getRequest()->getParam('flag_payer_or_beneficiary'))
514
+ ->setIsMassupdate(true)
515
+ ->save();
516
+ }
517
+ $this->_getSession()->addSuccess(
518
+ $this->__('Total of %d wallets were successfully updated.', count($walletIds))
519
+ );
520
+ } catch (Mage_Core_Exception $e) {
521
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
522
+ } catch (Exception $e) {
523
+ Mage::getSingleton('adminhtml/session')->addError(
524
+ Mage::helper('sirateck_lemonway4ec')->__('There was an error updating wallets.')
525
+ );
526
+ Mage::logException($e);
527
+ }
528
+ }
529
+ $this->_redirect('*/*/index');
530
+ }
531
+
532
+ /**
533
+ * mass Is One time customer change - action
534
+ *
535
+ * @access public
536
+ * @return void
537
+ * @author Kassim Belghait kassim@sirateck.com
538
+ */
539
+ public function massIsOnetimeCustomerAction()
540
+ {
541
+ $walletIds = $this->getRequest()->getParam('wallet');
542
+ if (!is_array($walletIds)) {
543
+ Mage::getSingleton('adminhtml/session')->addError(
544
+ Mage::helper('sirateck_lemonway4ec')->__('Please select wallets.')
545
+ );
546
+ } else {
547
+ try {
548
+ foreach ($walletIds as $walletId) {
549
+ $wallet = Mage::getSingleton('sirateck_lemonway4ec/wallet')->load($walletId)
550
+ ->setIsOnetimeCustomer($this->getRequest()->getParam('flag_is_onetime_customer'))
551
+ ->setIsMassupdate(true)
552
+ ->save();
553
+ }
554
+ $this->_getSession()->addSuccess(
555
+ $this->__('Total of %d wallets were successfully updated.', count($walletIds))
556
+ );
557
+ } catch (Mage_Core_Exception $e) {
558
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
559
+ } catch (Exception $e) {
560
+ Mage::getSingleton('adminhtml/session')->addError(
561
+ Mage::helper('sirateck_lemonway4ec')->__('There was an error updating wallets.')
562
+ );
563
+ Mage::logException($e);
564
+ }
565
+ }
566
+ $this->_redirect('*/*/index');
567
+ }
568
+
569
+ /**
570
+ * mass Is default change - action
571
+ *
572
+ * @access public
573
+ * @return void
574
+ * @author Kassim Belghait kassim@sirateck.com
575
+ */
576
+ public function massIsDefaultAction()
577
+ {
578
+ $walletIds = $this->getRequest()->getParam('wallet');
579
+ if (!is_array($walletIds)) {
580
+ Mage::getSingleton('adminhtml/session')->addError(
581
+ Mage::helper('sirateck_lemonway4ec')->__('Please select wallets.')
582
+ );
583
+ } else {
584
+ try {
585
+ foreach ($walletIds as $walletId) {
586
+ $wallet = Mage::getSingleton('sirateck_lemonway4ec/wallet')->load($walletId)
587
+ ->setIsDefault($this->getRequest()->getParam('flag_is_default'))
588
+ ->setIsMassupdate(true)
589
+ ->save();
590
+ }
591
+ $this->_getSession()->addSuccess(
592
+ $this->__('Total of %d wallets were successfully updated.', count($walletIds))
593
+ );
594
+ } catch (Mage_Core_Exception $e) {
595
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
596
+ } catch (Exception $e) {
597
+ Mage::getSingleton('adminhtml/session')->addError(
598
+ Mage::helper('sirateck_lemonway4ec')->__('There was an error updating wallets.')
599
+ );
600
+ Mage::logException($e);
601
+ }
602
+ }
603
+ $this->_redirect('*/*/index');
604
+ }
605
+
606
+ /**
607
+ * export as csv - action
608
+ *
609
+ * @access public
610
+ * @return void
611
+ * @author Kassim Belghait kassim@sirateck.com
612
+ */
613
+ public function exportCsvAction()
614
+ {
615
+ $fileName = 'wallet.csv';
616
+ $content = $this->getLayout()->createBlock('sirateck_lemonway4ec/adminhtml_wallet_grid')
617
+ ->getCsv();
618
+ $this->_prepareDownloadResponse($fileName, $content);
619
+ }
620
+
621
+ /**
622
+ * export as MsExcel - action
623
+ *
624
+ * @access public
625
+ * @return void
626
+ * @author Kassim Belghait kassim@sirateck.com
627
+ */
628
+ public function exportExcelAction()
629
+ {
630
+ $fileName = 'wallet.xls';
631
+ $content = $this->getLayout()->createBlock('sirateck_lemonway4ec/adminhtml_wallet_grid')
632
+ ->getExcelFile();
633
+ $this->_prepareDownloadResponse($fileName, $content);
634
+ }
635
+
636
+ /**
637
+ * export as xml - action
638
+ *
639
+ * @access public
640
+ * @return void
641
+ * @author Kassim Belghait kassim@sirateck.com
642
+ */
643
+ public function exportXmlAction()
644
+ {
645
+ $fileName = 'wallet.xml';
646
+ $content = $this->getLayout()->createBlock('sirateck_lemonway4ec/adminhtml_wallet_grid')
647
+ ->getXml();
648
+ $this->_prepareDownloadResponse($fileName, $content);
649
+ }
650
+
651
+ /**
652
+ * Check if admin has permissions to visit related pages
653
+ *
654
+ * @access protected
655
+ * @return boolean
656
+ * @author Kassim Belghait kassim@sirateck.com
657
+ */
658
+ protected function _isAllowed()
659
+ {
660
+ return Mage::getSingleton('admin/session')->isAllowed('sales/sirateck_lemonway4ec/wallet');
661
+ }
662
+ }
app/code/community/Sirateck/Lemonway4ec/controllers/PaymentController.php ADDED
@@ -0,0 +1,308 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sirateck_Lemonway4ec extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Sirateck
13
+ * @package Sirateck_Lemonway4ec
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+
18
+ /**
19
+ * Main Controller
20
+ *
21
+ * @category Sirateck
22
+ * @package Sirateck_Lemonway4ec
23
+ * @author Kassim Belghait kassim@sirateck.com
24
+ */
25
+ class Sirateck_Lemonway4ec_PaymentController extends Mage_Core_Controller_Front_Action {
26
+
27
+ protected $_order = null;
28
+ /**
29
+ *
30
+ * @var Sirateck_Lemonway4ec_Model_Apikit_Apimodels_Operation
31
+ */
32
+ protected $_moneyin_trans_details = null;
33
+
34
+ public function preDispatch()
35
+ {
36
+ parent::preDispatch();
37
+
38
+ $action = $this->getRequest()->getRequestedActionName();
39
+ if($this->getRequest()->isPost() && !$this->_validateOperation($action))
40
+ {
41
+ $this->getResponse()->setBody("NOK. Wrong Operation!");
42
+ $this->setFlag('', 'no-dispatch', true);
43
+ }
44
+ }
45
+
46
+ protected function _validateOperation($action){
47
+
48
+ $actionToStatus = array("return"=>"3","error"=>"0","cancel"=>"0");
49
+ if(!isset($actionToStatus[$action]))
50
+ return false;
51
+
52
+ if($this->getMoneyInTransDetails()->getStatus() == $actionToStatus[$action])
53
+ return true;
54
+
55
+ return false;
56
+
57
+ }
58
+
59
+ /**
60
+ * Call api to get transaction detail for this transaction
61
+ * @return Sirateck_Lemonway4ec_Model_Apikit_Apimodels_Operation
62
+ */
63
+ protected function getMoneyInTransDetails()
64
+ {
65
+ if(is_null($this->_moneyin_trans_details))
66
+ {
67
+ //call directkit to get Webkit Token
68
+ $params = array('transactionMerchantToken'=>$this->_getOrder()->getIncrementId());
69
+ //Init APi kit
70
+ /* @var $kit Sirateck_Lemonway4ec_Model_Apikit_Kit */
71
+ $kit = Mage::getSingleton('sirateck_lemonway4ec/apikit_kit');
72
+ $res = $kit->GetMoneyInTransDetails($params);
73
+
74
+ if (isset($res->lwError)){
75
+ Mage::throwException("Error code: " . $res->lwError->getCode() . " Message: " . $res->lwError->getMessage());
76
+ }
77
+
78
+ $this->_moneyin_trans_details = current($res->operations);
79
+
80
+ }
81
+ return $this->_moneyin_trans_details;
82
+ }
83
+
84
+ /**
85
+ * Get singleton of Checkout Session Model
86
+ *
87
+ * @return Mage_Checkout_Model_Session
88
+ */
89
+ protected function _getCheckout()
90
+ {
91
+ return Mage::getSingleton('checkout/session');
92
+ }
93
+
94
+ /**
95
+ * @return Mage_Sales_Model_Order
96
+ */
97
+ protected function _getOrder(){
98
+ if(is_null($this->_order))
99
+ {
100
+
101
+ $order = Mage::getModel('sales/order')->loadByIncrementId($this->getRequest()->getParam('response_wkToken'));
102
+
103
+ if($order->getId())
104
+ $this->_order = $order;
105
+ else
106
+ {
107
+ Mage::logException(new Exception("Order not Found"));
108
+ Mage::throwException("Order not found!");
109
+ }
110
+ }
111
+
112
+ return $this->_order;
113
+ }
114
+
115
+ /**
116
+ * Create invoice for order
117
+ *
118
+ * @param Mage_Sales_Model_Order $order
119
+ * @return boolean Can save invoice or not
120
+ */
121
+ protected function createInvoice($order)
122
+ {
123
+ if ($order->canInvoice()) {
124
+
125
+ $version = Mage::getVersion();
126
+ $version = substr($version, 0, 5);
127
+ $version = str_replace('.', '', $version);
128
+ while (strlen($version) < 3) {
129
+ $version .= "0";
130
+ }
131
+
132
+ if (((int) $version) < 111) {
133
+ $convertor = Mage::getModel('sales/convert_order');
134
+ $invoice = $convertor->toInvoice($order);
135
+ foreach ($order->getAllItems() as $orderItem) {
136
+ if (!$orderItem->getQtyToInvoice()) {
137
+ continue;
138
+ }
139
+ $item = $convertor->itemToInvoiceItem($orderItem);
140
+ $item->setQty($orderItem->getQtyToInvoice());
141
+ $invoice->addItem($item);
142
+ }
143
+ $invoice->collectTotals();
144
+ } else {
145
+ $invoice = $order->prepareInvoice();
146
+ }
147
+
148
+ $invoice->register()->capture();
149
+ Mage::getModel('core/resource_transaction')
150
+ ->addObject($invoice)
151
+ ->addObject($invoice->getOrder())
152
+ ->save();
153
+ return true;
154
+ }
155
+
156
+ return false;
157
+ }
158
+
159
+ /**
160
+ * Success Action
161
+ * Used for redirection and notification process
162
+ */
163
+ public function returnAction(){
164
+
165
+ $params = $this->getRequest()->getParams();
166
+ if($this->getRequest()->isGet())
167
+ {
168
+ $successUrl = 'checkout/onepage/success';
169
+ if(Mage::helper('sirateck_lemonway4ec')->oneStepCheckoutInstalled()){
170
+ $successUrl = 'onestepcheckout/index/success';
171
+ }
172
+ $this->_redirect($successUrl);
173
+
174
+ return $this;
175
+ }
176
+ elseif($this->getRequest()->isPost())
177
+ {
178
+
179
+ if($params['response_code'] == "0000")
180
+ {
181
+
182
+ //DATA POST FROM NOTIFICATION
183
+ $order = $this->_getOrder();
184
+ $payment = $order->getPayment();
185
+ $payment->registerCaptureNotification(
186
+ $params['response_transactionAmount'],
187
+ false
188
+ );
189
+ $order->save();
190
+
191
+ // notify customer
192
+ $invoice = $payment->getCreatedInvoice();
193
+ if ($invoice && !$order->getEmailSent()) {
194
+ $order->sendNewOrderEmail();
195
+ }
196
+
197
+ $methodInstance = Mage::getSingleton('sirateck_lemonway4ec/method_webkit');
198
+ if (!$status = $methodInstance->getConfigData('order_status_success')) {
199
+ $status = $order->getStatus();
200
+ }
201
+
202
+ $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, $status);
203
+
204
+ $order->save();
205
+
206
+
207
+
208
+ $customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
209
+ if($customer->getId())
210
+ {
211
+ $customer->setLwCardType($this->getMoneyInTransDetails()->getExtra()->TYP);
212
+ $customer->setLwCardNum($this->getMoneyInTransDetails()->getExtra()->NUM);
213
+ $customer->setLwCardExp($this->getMoneyInTransDetails()->getExtra()->EXP);
214
+ $customer->getResource()->saveAttribute($customer, 'lw_card_type');
215
+ $customer->getResource()->saveAttribute($customer, 'lw_card_num');
216
+ $customer->getResource()->saveAttribute($customer, 'lw_card_exp');
217
+ }
218
+ }
219
+ else{
220
+ $this->_forward('error');
221
+ }
222
+
223
+ }
224
+ else
225
+ {
226
+ die("HTTP Method not Allowed");
227
+ }
228
+
229
+ }
230
+
231
+ /**
232
+ * Transaction canceled by user
233
+ */
234
+ public function cancelAction(){
235
+
236
+ //When canceled by user, notification by POST not sended
237
+ //So we cancel with get request
238
+ if($this->getRequest()->isGet())
239
+ {
240
+ $order = $this->_getOrder();
241
+ $status = $order->getStatus();
242
+
243
+ $message = $this->__('Transaction was canceled by customer');
244
+ $order->addStatusToHistory($status, $message);
245
+
246
+ if($order->canCancel())
247
+ {
248
+ $order->cancel();
249
+ }
250
+
251
+ $order->save();
252
+
253
+ //Reload products in cart
254
+ Mage::helper('sirateck_lemonway4ec')->reAddToCart($order->getIncrementId());
255
+
256
+ $this->_getCheckout()->addSuccess($this->__('Your order is canceled.'));
257
+
258
+ $this->_redirect('checkout/cart');
259
+ }
260
+ else
261
+ {
262
+ die("HTTP Method not Allowed");
263
+ }
264
+
265
+ return $this;
266
+
267
+ }
268
+
269
+ /**
270
+ * Transaction Failure action.
271
+ */
272
+ public function errorAction(){
273
+
274
+ //When transaction failed, notification by POST not sended
275
+ //So we cancel the order with GET request
276
+ if($this->getRequest()->isGet())
277
+ {
278
+ //DATA POST FROM NOTIFICATION
279
+ $order = $this->_getOrder();
280
+
281
+ if($order->canCancel())
282
+ {
283
+ $order->cancel();
284
+ }
285
+
286
+ $status = $order->getStatus();
287
+ $message = $this->__('Transaction Failed. Order was canceled automatically.');
288
+ $order->addStatusToHistory($status, $message);
289
+
290
+ try {
291
+ $order->save();
292
+ } catch (Exception $e) {
293
+ Mage::logException($e);
294
+ Mage::throwException($e->getMessage());
295
+ }
296
+
297
+ $this->_redirect('checkout/onepage/failure');
298
+ return $this;
299
+ }
300
+ else
301
+ {
302
+ die("HTTP Method not Allowed");
303
+ }
304
+
305
+ }
306
+
307
+
308
+ }
app/code/community/Sirateck/Lemonway4ec/etc/adminhtml.xml ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Sirateck_Lemonway4ec extension
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the MIT License
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/mit-license.php
12
+ *
13
+ * @category Sirateck
14
+ * @package Sirateck_Lemonway4ec
15
+ * @copyright Copyright (c) 2015
16
+ * @license http://opensource.org/licenses/mit-license.php MIT License
17
+ */
18
+ -->
19
+ <config>
20
+ <acl>
21
+ <resources>
22
+ <admin>
23
+ <children>
24
+ <system>
25
+ <children>
26
+ <config>
27
+ <children>
28
+ <sirateck_lemonway4ec translate="title" module="sirateck_lemonway4ec">
29
+ <title>Lemonway</title>
30
+ </sirateck_lemonway4ec>
31
+ </children>
32
+ </config>
33
+ </children>
34
+ </system>
35
+ <!-- <sales>
36
+ <children>
37
+ <sirateck_lemonway4ec translate="title" module="sirateck_lemonway4ec">
38
+ <title>LW</title>
39
+ <children>
40
+ <moneyout translate="title" module="sirateck_lemonway4ec">
41
+ <title>Moneyout</title>
42
+ <sort_order>300</sort_order>
43
+ </moneyout>
44
+ </children>
45
+ </sirateck_lemonway4ec>
46
+ </children>
47
+ </sales> -->
48
+ </children>
49
+ </admin>
50
+ </resources>
51
+ </acl>
52
+ <!-- <menu>
53
+ <sales>
54
+ <children>
55
+ <sirateck_lemonway4ec translate="title" module="sirateck_lemonway4ec">
56
+ <title>Lemonway</title>
57
+ <sort_order>5</sort_order>
58
+ <children>
59
+ <moneyout translate="title" module="sirateck_lemonway4ec">
60
+ <title>MoneyOut</title>
61
+ <action>adminhtml/lemonway_moneyout/pay</action>
62
+ <sort_order>300</sort_order>
63
+ </moneyout>
64
+ </children>
65
+ </sirateck_lemonway4ec>
66
+ </children>
67
+ </sales>
68
+ </menu> -->
69
+ </config>
app/code/community/Sirateck/Lemonway4ec/etc/config.xml ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Sirateck_Lemonway4ec extension
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the MIT License
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/mit-license.php
12
+ *
13
+ * @category Sirateck
14
+ * @package Sirateck_Lemonway4ec
15
+ * @copyright Copyright (c) 2015
16
+ * @license http://opensource.org/licenses/mit-license.php MIT License
17
+ */
18
+ -->
19
+ <config>
20
+ <modules>
21
+ <Sirateck_Lemonway4ec>
22
+ <version>1.0.1</version>
23
+ </Sirateck_Lemonway4ec>
24
+ </modules>
25
+ <global>
26
+ <resources>
27
+ <sirateck_lemonway4ec_setup>
28
+ <setup>
29
+ <module>Sirateck_Lemonway4ec</module>
30
+ <class>Sirateck_Lemonway4ec_Model_Resource_Setup</class>
31
+ </setup>
32
+ </sirateck_lemonway4ec_setup>
33
+ </resources>
34
+ <blocks>
35
+ <sirateck_lemonway4ec>
36
+ <class>Sirateck_Lemonway4ec_Block</class>
37
+ </sirateck_lemonway4ec>
38
+ </blocks>
39
+ <helpers>
40
+ <sirateck_lemonway4ec>
41
+ <class>Sirateck_Lemonway4ec_Helper</class>
42
+ </sirateck_lemonway4ec>
43
+ </helpers>
44
+ <models>
45
+ <sirateck_lemonway4ec>
46
+ <class>Sirateck_Lemonway4ec_Model</class>
47
+ <resourceModel>sirateck_lemonway4ec_resource</resourceModel>
48
+ </sirateck_lemonway4ec>
49
+ <sirateck_lemonway4ec_resource>
50
+ <class>Sirateck_Lemonway4ec_Model_Resource</class>
51
+ <entities>
52
+ <wallet>
53
+ <table>sirateck_lemonway4ec_wallet</table>
54
+ </wallet>
55
+ <iban>
56
+ <table>sirateck_lemonway4ec_iban</table>
57
+ </iban>
58
+ <moneyout>
59
+ <table>sirateck_lemonway4ec_moneyout</table>
60
+ </moneyout>
61
+ </entities>
62
+ </sirateck_lemonway4ec_resource>
63
+ </models>
64
+ </global>
65
+ <frontend>
66
+ <secure_url>
67
+ <sirateck_lemonway4ec>/lemonway/payment</sirateck_lemonway4ec>
68
+ </secure_url>
69
+ <routers>
70
+ <sirateck_lemonway4ec>
71
+ <use>standard</use>
72
+ <args>
73
+ <module>Sirateck_Lemonway4ec</module>
74
+ <frontName>lemonway</frontName>
75
+ </args>
76
+ </sirateck_lemonway4ec>
77
+ </routers>
78
+ <translate>
79
+ <modules>
80
+ <Sirateck_Lemonway4ec>
81
+ <files>
82
+ <default>Sirateck_Lemonway4ec.csv</default>
83
+ </files>
84
+ </Sirateck_Lemonway4ec>
85
+ </modules>
86
+ </translate>
87
+ </frontend>
88
+ <adminhtml>
89
+ <layout>
90
+ <updates>
91
+ <sirateck_lemonway4ec>
92
+ <file>sirateck_lemonway4ec.xml</file>
93
+ </sirateck_lemonway4ec>
94
+ </updates>
95
+ </layout>
96
+ <translate>
97
+ <modules>
98
+ <Sirateck_Lemonway4ec>
99
+ <files>
100
+ <default>Sirateck_Lemonway4ec.csv</default>
101
+ </files>
102
+ </Sirateck_Lemonway4ec>
103
+ </modules>
104
+ </translate>
105
+ <global_search>
106
+ <wallet>
107
+ <class>sirateck_lemonway4ec/adminhtml_search_wallet</class>
108
+ <acl>sirateck_lemonway4ec</acl>
109
+ </wallet>
110
+ </global_search>
111
+ </adminhtml>
112
+ <admin>
113
+ <routers>
114
+ <adminhtml>
115
+ <args>
116
+ <modules>
117
+ <Sirateck_Lemonway4ec before="Mage_Adminhtml">Sirateck_Lemonway4ec_Adminhtml</Sirateck_Lemonway4ec>
118
+ </modules>
119
+ </args>
120
+ </adminhtml>
121
+ </routers>
122
+ </admin>
123
+ <crontab>
124
+ <jobs>
125
+ <clean_orders_lw_in_pending>
126
+ <schedule><cron_expr>*/15 * * * *</cron_expr></schedule>
127
+ <run><model>sirateck_lemonway4ec/observer::cancelOrdersInPending</model></run>
128
+ </clean_orders_lw_in_pending>
129
+ </jobs>
130
+ </crontab>
131
+ <default>
132
+ <sirateck_lemonway4ec>
133
+ <lemonway_api>
134
+ <api_pass backend_model="adminhtml/system_config_backend_encrypted"/>
135
+ <is_test_mode>0</is_test_mode>
136
+ </lemonway_api>
137
+ </sirateck_lemonway4ec>
138
+ <payment>
139
+ <lemonway4ec_webkit>
140
+ <active>0</active>
141
+ <title>Lemonway payment</title>
142
+ <order_status>pending</order_status>
143
+ <order_status_success>processing</order_status_success>
144
+ <allow_oneclic>0</allow_oneclic>
145
+ <css_url>https://webkit.lemonway.fr/css/mercanet/mercanet_lw_custom.css</css_url>
146
+ <cancel_pending_order>0</cancel_pending_order>
147
+ <payment_action>initialize</payment_action>
148
+ <allowspecific>0</allowspecific>
149
+ <debug>0</debug>
150
+ <model>sirateck_lemonway4ec/method_webkit</model>
151
+ <return_url>lemonway/payment/return</return_url>
152
+ <cancel_url>lemonway/payment/cancel</cancel_url>
153
+ <error_url>lemonway/payment/error</error_url>
154
+ </lemonway4ec_webkit>
155
+ </payment>
156
+ </default>
157
+ </config>
app/code/community/Sirateck/Lemonway4ec/etc/system.xml ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <sections>
4
+ <sirateck_lemonway4ec translate="label" module="sirateck_lemonway4ec">
5
+ <label>Lemonway payment</label>
6
+ <tab>sales</tab>
7
+ <frontend_type>text</frontend_type>
8
+ <sort_order>400</sort_order>
9
+ <show_in_default>1</show_in_default>
10
+ <show_in_website>1</show_in_website>
11
+ <show_in_store>1</show_in_store>
12
+ <groups>
13
+ <lemonway_api translate="label">
14
+ <label>Lemonway account configuration</label>
15
+ <frontend_type>text</frontend_type>
16
+ <comment></comment>
17
+ <sort_order>10</sort_order>
18
+ <show_in_default>1</show_in_default>
19
+ <show_in_website>1</show_in_website>
20
+ <show_in_store>0</show_in_store>
21
+ <fields>
22
+ <!-- @deprecated since version 0.1.3 -->
23
+ <!-- <api_platform_name translate="label"> -->
24
+ <!-- <label>Api platform name</label> -->
25
+ <!-- <frontend_type>text</frontend_type> -->
26
+ <!-- <sort_order>1</sort_order> -->
27
+ <!-- <show_in_default>1</show_in_default> -->
28
+ <!-- <show_in_website>1</show_in_website> -->
29
+ <!-- <show_in_store>0</show_in_store> -->
30
+ <!-- </api_platform_name> -->
31
+ <api_login translate="label">
32
+ <label>Login Lemon Way for E-commerce</label>
33
+ <frontend_type>text</frontend_type>
34
+ <sort_order>10</sort_order>
35
+ <show_in_default>1</show_in_default>
36
+ <show_in_website>1</show_in_website>
37
+ <show_in_store>0</show_in_store>
38
+ </api_login>
39
+ <api_pass translate="label">
40
+ <label>Password Lemon Way for E-commerce</label>
41
+ <frontend_type>obscure</frontend_type>
42
+ <backend_model>adminhtml/system_config_backend_encrypted</backend_model>
43
+ <sort_order>20</sort_order>
44
+ <show_in_default>1</show_in_default>
45
+ <show_in_website>1</show_in_website>
46
+ <show_in_store>0</show_in_store>
47
+ </api_pass>
48
+ <wallet_merchant_id translate="label comment">
49
+ <label>Account Lemon Way for E-commerce</label>
50
+ <comment>This information has been sent to you by e-mail</comment>
51
+ <frontend_type>text</frontend_type>
52
+ <sort_order>30</sort_order>
53
+ <show_in_default>1</show_in_default>
54
+ <show_in_website>1</show_in_website>
55
+ <show_in_store>0</show_in_store>
56
+ </wallet_merchant_id>
57
+ <is_test_mode translate="label comment">
58
+ <label>Enable test mode</label>
59
+ <comment>Yes for tests, No to go Live</comment>
60
+ <frontend_type>select</frontend_type>
61
+ <source_model>adminhtml/system_config_source_yesno</source_model>
62
+ <sort_order>150</sort_order>
63
+ <show_in_default>1</show_in_default>
64
+ <show_in_website>1</show_in_website>
65
+ <show_in_store>0</show_in_store>
66
+ </is_test_mode>
67
+ </fields>
68
+ </lemonway_api>
69
+ </groups>
70
+ </sirateck_lemonway4ec>
71
+ <payment>
72
+ <groups>
73
+ <lemonway4ec_webkit translate="label" module="sirateck_lemonway4ec">
74
+ <label>Lemonway payment method (webkit)</label>
75
+ <frontend_type>text</frontend_type>
76
+ <sort_order>200</sort_order>
77
+ <show_in_default>1</show_in_default>
78
+ <show_in_website>1</show_in_website>
79
+ <show_in_store>1</show_in_store>
80
+ <fields>
81
+ <active translate="label" module="payment">
82
+ <label>Enabled</label>
83
+ <frontend_type>select</frontend_type>
84
+ <source_model>adminhtml/system_config_source_yesno</source_model>
85
+ <sort_order>10</sort_order>
86
+ <show_in_default>1</show_in_default>
87
+ <show_in_website>1</show_in_website>
88
+ <show_in_store>1</show_in_store>
89
+ </active>
90
+ <title translate="label" module="payment">
91
+ <label>Title</label>
92
+ <frontend_type>text</frontend_type>
93
+ <sort_order>20</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
+ </title>
98
+ <order_status translate="label" module="payment">
99
+ <label>New Order Status</label>
100
+ <frontend_type>select</frontend_type>
101
+ <source_model>adminhtml/system_config_source_order_status_new</source_model>
102
+ <sort_order>25</sort_order>
103
+ <show_in_default>1</show_in_default>
104
+ <show_in_website>1</show_in_website>
105
+ <show_in_store>0</show_in_store>
106
+ </order_status>
107
+ <order_status_success translate="label">
108
+ <label>Success Order Status</label>
109
+ <frontend_type>select</frontend_type>
110
+ <source_model>adminhtml/system_config_source_order_status_processing</source_model>
111
+ <sort_order>30</sort_order>
112
+ <show_in_default>1</show_in_default>
113
+ <show_in_website>1</show_in_website>
114
+ <show_in_store>0</show_in_store>
115
+ </order_status_success>
116
+ <allow_oneclic translate="label comment">
117
+ <label>Allow One clic</label>
118
+ <comment><![CDATA[Display checkbox in frontend form]]></comment>
119
+ <frontend_type>select</frontend_type>
120
+ <source_model>adminhtml/system_config_source_yesno</source_model>
121
+ <sort_order>45</sort_order>
122
+ <show_in_default>1</show_in_default>
123
+ <show_in_website>1</show_in_website>
124
+ <show_in_store>1</show_in_store>
125
+ </allow_oneclic>
126
+ <css_url translate="label">
127
+ <label>Css url</label>
128
+ <frontend_type>text</frontend_type>
129
+ <sort_order>50</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
+ </css_url>
134
+ <cancel_pending_order translate="label comment">
135
+ <label>Cancel orders in pending status</label>
136
+ <comment>Cancel orders in pending status since more 30 minutes. Useful when a customer don't send his credit card information in hosted page.</comment>
137
+ <frontend_type>select</frontend_type>
138
+ <source_model>adminhtml/system_config_source_yesno</source_model>
139
+ <sort_order>60</sort_order>
140
+ <show_in_default>1</show_in_default>
141
+ <show_in_website>1</show_in_website>
142
+ <show_in_store>0</show_in_store>
143
+ </cancel_pending_order>
144
+ <allowspecific translate="label" module="payment">
145
+ <label>Payment from Applicable Countries</label>
146
+ <frontend_type>allowspecific</frontend_type>
147
+ <sort_order>100</sort_order>
148
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
149
+ <show_in_default>1</show_in_default>
150
+ <show_in_website>1</show_in_website>
151
+ <show_in_store>1</show_in_store>
152
+ </allowspecific>
153
+ <specificcountry translate="label" module="payment">
154
+ <label>Payment from Specific Countries</label>
155
+ <frontend_type>multiselect</frontend_type>
156
+ <sort_order>110</sort_order>
157
+ <source_model>adminhtml/system_config_source_country</source_model>
158
+ <show_in_default>1</show_in_default>
159
+ <show_in_website>1</show_in_website>
160
+ <show_in_store>1</show_in_store>
161
+ </specificcountry>
162
+ <min_order_total translate="label" module="payment">
163
+ <label>Minimum Order Total</label>
164
+ <frontend_type>text</frontend_type>
165
+ <sort_order>120</sort_order>
166
+ <show_in_default>1</show_in_default>
167
+ <show_in_website>1</show_in_website>
168
+ <show_in_store>1</show_in_store>
169
+ </min_order_total>
170
+ <max_order_total translate="label" module="payment">
171
+ <label>Maximum Order Total</label>
172
+ <frontend_type>text</frontend_type>
173
+ <sort_order>121</sort_order>
174
+ <show_in_default>1</show_in_default>
175
+ <show_in_website>1</show_in_website>
176
+ <show_in_store>1</show_in_store>
177
+ </max_order_total>
178
+ <sort_order translate="label" module="payment">
179
+ <label>Sort Order</label>
180
+ <frontend_type>text</frontend_type>
181
+ <sort_order>130</sort_order>
182
+ <show_in_default>1</show_in_default>
183
+ <show_in_website>1</show_in_website>
184
+ <show_in_store>1</show_in_store>
185
+ </sort_order>
186
+ <debug translate="label comment">
187
+ <label>Enable debug log</label>
188
+ <comment>Log all queries to and from lemonway API</comment>
189
+ <frontend_type>select</frontend_type>
190
+ <source_model>adminhtml/system_config_source_yesno</source_model>
191
+ <sort_order>150</sort_order>
192
+ <show_in_default>1</show_in_default>
193
+ <show_in_website>1</show_in_website>
194
+ <show_in_store>1</show_in_store>
195
+ </debug>
196
+ </fields>
197
+ </lemonway4ec_webkit>
198
+ </groups>
199
+ </payment>
200
+ </sections>
201
+ </config>
app/code/community/Sirateck/Lemonway4ec/sql/sirateck_lemonway4ec_setup/install-0.1.0.php ADDED
@@ -0,0 +1,246 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sirateck_Lemonway4ec extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Sirateck
13
+ * @package Sirateck_Lemonway4ec
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Lemonway module install script
19
+ *
20
+ * @category Sirateck
21
+ * @package Sirateck_Lemonway4ec
22
+ * @author Kassim Belghait kassim@sirateck.com
23
+ */
24
+ $this->startSetup();
25
+ $table = $this->getConnection()
26
+ ->newTable($this->getTable('sirateck_lemonway4ec/wallet'))
27
+ ->addColumn(
28
+ 'entity_id',
29
+ Varien_Db_Ddl_Table::TYPE_INTEGER,
30
+ null,
31
+ array(
32
+ 'identity' => true,
33
+ 'nullable' => false,
34
+ 'primary' => true,
35
+ ),
36
+ 'Wallet ID'
37
+ )
38
+ ->addColumn(
39
+ 'lw_id',
40
+ Varien_Db_Ddl_Table::TYPE_TEXT, 255,
41
+ array(
42
+ 'nullable' => false,
43
+ ),
44
+ 'Lemonway ID'
45
+ )
46
+ ->addColumn(
47
+ 'customer_id',
48
+ Varien_Db_Ddl_Table::TYPE_INTEGER, null,
49
+ array(
50
+ 'nullable' => false,
51
+ ),
52
+ 'Customer ID'
53
+ )
54
+ ->addColumn(
55
+ 'wallet_id',
56
+ Varien_Db_Ddl_Table::TYPE_TEXT, 255,
57
+ array(
58
+ 'nullable' => false,
59
+ ),
60
+ 'Wallet ID'
61
+ )
62
+ ->addColumn(
63
+ 'is_admin',
64
+ Varien_Db_Ddl_Table::TYPE_SMALLINT, null,
65
+ array(
66
+ 'nullable' => false,
67
+ ),
68
+ 'Is Admin'
69
+ )
70
+ ->addColumn(
71
+ 'customer_email',
72
+ Varien_Db_Ddl_Table::TYPE_TEXT, 255,
73
+ array(
74
+ 'nullable' => false,
75
+ ),
76
+ 'Email'
77
+ )
78
+ ->addColumn(
79
+ 'customer_prefix',
80
+ Varien_Db_Ddl_Table::TYPE_TEXT, 100,
81
+ array(
82
+ 'nullable' => false,
83
+ ),
84
+ 'Prefix'
85
+ )
86
+ ->addColumn(
87
+ 'customer_firstname',
88
+ Varien_Db_Ddl_Table::TYPE_TEXT, 255,
89
+ array(
90
+ 'nullable' => false,
91
+ ),
92
+ 'Firstname'
93
+ )
94
+ ->addColumn(
95
+ 'customer_lastname',
96
+ Varien_Db_Ddl_Table::TYPE_TEXT, 255,
97
+ array(
98
+ 'nullable' => false,
99
+ ),
100
+ 'Lastname'
101
+ )
102
+ ->addColumn(
103
+ 'billing_address_street',
104
+ Varien_Db_Ddl_Table::TYPE_TEXT, 255,
105
+ array(),
106
+ 'Street'
107
+ )
108
+ ->addColumn(
109
+ 'billing_address_postcode',
110
+ Varien_Db_Ddl_Table::TYPE_TEXT, 255,
111
+ array(),
112
+ 'Postcode'
113
+ )
114
+ ->addColumn(
115
+ 'billing_address_city',
116
+ Varien_Db_Ddl_Table::TYPE_TEXT, 255,
117
+ array(),
118
+ 'City'
119
+ )
120
+ ->addColumn(
121
+ 'billing_address_country',
122
+ Varien_Db_Ddl_Table::TYPE_TEXT, 2,
123
+ array(),
124
+ 'Country'
125
+ )
126
+ ->addColumn(
127
+ 'billing_address_phone',
128
+ Varien_Db_Ddl_Table::TYPE_TEXT, 255,
129
+ array(),
130
+ 'Phone Number'
131
+ )
132
+ ->addColumn(
133
+ 'billing_address_mobile',
134
+ Varien_Db_Ddl_Table::TYPE_TEXT, 255,
135
+ array(),
136
+ 'Mobile Number'
137
+ )
138
+ ->addColumn(
139
+ 'customer_dob',
140
+ Varien_Db_Ddl_Table::TYPE_DATETIME, 255,
141
+ array(),
142
+ 'Dob'
143
+ )
144
+ ->addColumn(
145
+ 'is_company',
146
+ Varien_Db_Ddl_Table::TYPE_SMALLINT, null,
147
+ array(),
148
+ 'Is company'
149
+ )
150
+ ->addColumn(
151
+ 'company_name',
152
+ Varien_Db_Ddl_Table::TYPE_TEXT, 255,
153
+ array(
154
+ 'nullable' => false,
155
+ ),
156
+ 'Company name'
157
+ )
158
+ ->addColumn(
159
+ 'company_website',
160
+ Varien_Db_Ddl_Table::TYPE_TEXT, 255,
161
+ array(
162
+ 'nullable' => false,
163
+ ),
164
+ 'Company website'
165
+ )
166
+ ->addColumn(
167
+ 'company_description',
168
+ Varien_Db_Ddl_Table::TYPE_TEXT, '64k',
169
+ array(),
170
+ 'Company description'
171
+ )
172
+ ->addColumn(
173
+ 'company_id_number',
174
+ Varien_Db_Ddl_Table::TYPE_TEXT, 255,
175
+ array(),
176
+ 'Company ID number'
177
+ )
178
+ ->addColumn(
179
+ 'is_debtor',
180
+ Varien_Db_Ddl_Table::TYPE_SMALLINT, null,
181
+ array(),
182
+ 'Is debtor'
183
+ )
184
+ ->addColumn(
185
+ 'customer_nationality',
186
+ Varien_Db_Ddl_Table::TYPE_TEXT, 2,
187
+ array(),
188
+ 'Nationality'
189
+ )
190
+ ->addColumn(
191
+ 'customer_birth_city',
192
+ Varien_Db_Ddl_Table::TYPE_TEXT, 255,
193
+ array(),
194
+ 'City of Birth'
195
+ )
196
+ ->addColumn(
197
+ 'customer_birth_country',
198
+ Varien_Db_Ddl_Table::TYPE_TEXT, 2,
199
+ array(),
200
+ 'Birth country'
201
+ )
202
+ ->addColumn(
203
+ 'payer_or_beneficiary',
204
+ Varien_Db_Ddl_Table::TYPE_INTEGER, null,
205
+ array(),
206
+ 'Payer or beneficiary'
207
+ )
208
+ ->addColumn(
209
+ 'is_onetime_customer',
210
+ Varien_Db_Ddl_Table::TYPE_SMALLINT, null,
211
+ array(
212
+ 'nullable' => false,
213
+ ),
214
+ 'Is One time customer'
215
+ )
216
+ ->addColumn(
217
+ 'is_default',
218
+ Varien_Db_Ddl_Table::TYPE_SMALLINT, null,
219
+ array(
220
+ 'nullable' => false,
221
+ ),
222
+ 'Is default'
223
+ )
224
+ ->addColumn(
225
+ 'status',
226
+ Varien_Db_Ddl_Table::TYPE_SMALLINT, null,
227
+ array(),
228
+ 'Enabled'
229
+ )
230
+ ->addColumn(
231
+ 'updated_at',
232
+ Varien_Db_Ddl_Table::TYPE_TIMESTAMP,
233
+ null,
234
+ array(),
235
+ 'Wallet Modification Time'
236
+ )
237
+ ->addColumn(
238
+ 'created_at',
239
+ Varien_Db_Ddl_Table::TYPE_TIMESTAMP,
240
+ null,
241
+ array(),
242
+ 'Wallet Creation Time'
243
+ )
244
+ ->setComment('Wallet Table');
245
+ $this->getConnection()->createTable($table);
246
+ $this->endSetup();
app/code/community/Sirateck/Lemonway4ec/sql/sirateck_lemonway4ec_setup/mysql4-upgrade-0.1.0-0.1.1.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sirateck_Lemonway4ec extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Sirateck
13
+ * @package Sirateck_Lemonway4ec
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Lemonway module update script
19
+ *
20
+ * @category Sirateck
21
+ * @package Sirateck_Lemonway4ec
22
+ * @author Kassim Belghait kassim@sirateck.com
23
+ */
24
+ $installerCustomer = new Mage_Customer_Model_Entity_Setup('sirateck_lemonway4ec_setup');
25
+ /* @var $installerCustomer Mage_Customer_Model_Entity_Setup */
26
+
27
+ $installerCustomer->startSetup();
28
+
29
+ $entityId = $installerCustomer->getEntityTypeId('customer');
30
+ $attribute = $installerCustomer->getAttribute($entityId,'lw_card_id');
31
+ if(!$attribute)
32
+ {
33
+
34
+ $installerCustomer->addAttribute('customer','lw_card_id',array(
35
+ 'type' => 'varchar',
36
+ 'label' => 'Card ID one clic',
37
+ 'visible' => true,
38
+ 'required' => false,
39
+ 'unique' => false,
40
+ 'sort_order' => 700,
41
+ 'default' => 0,
42
+ 'input' => 'text',
43
+
44
+ ));
45
+
46
+ $usedInForms = array(
47
+ 'adminhtml_customer',
48
+ );
49
+
50
+ $attribute = Mage::getSingleton('eav/config')->getAttribute('customer', 'lw_card_id');
51
+ $attribute->setData('used_in_forms', $usedInForms);
52
+ $attribute->setData('sort_order', 700);
53
+
54
+ $attribute->save();
55
+
56
+ }
57
+
58
+ $installerCustomer->endSetup();
59
+
app/code/community/Sirateck/Lemonway4ec/sql/sirateck_lemonway4ec_setup/mysql4-upgrade-0.1.1-0.1.2.php ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sirateck_Lemonway4ec extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Sirateck
13
+ * @package Sirateck_Lemonway4ec
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Lemonway module update script
19
+ *
20
+ * @category Sirateck
21
+ * @package Sirateck_Lemonway4ec
22
+ * @author Kassim Belghait kassim@sirateck.com
23
+ */
24
+ $installerCustomer = new Mage_Customer_Model_Entity_Setup('sirateck_lemonway4ec_setup');
25
+ /* @var $installerCustomer Mage_Customer_Model_Entity_Setup */
26
+
27
+ $installerCustomer->startSetup();
28
+
29
+ $entityId = $installerCustomer->getEntityTypeId('customer');
30
+ $attribute = $installerCustomer->getAttribute($entityId,'lw_card_num');
31
+ if(!$attribute)
32
+ {
33
+
34
+ $installerCustomer->addAttribute('customer','lw_card_num',array(
35
+ 'type' => 'varchar',
36
+ 'label' => 'Card Num (one clic)',
37
+ 'visible' => true,
38
+ 'required' => false,
39
+ 'unique' => false,
40
+ 'sort_order' => 700,
41
+ 'default' => 0,
42
+ 'input' => 'text',
43
+
44
+ ));
45
+
46
+ $usedInForms = array(
47
+ 'adminhtml_customer',
48
+ );
49
+
50
+ $attribute = Mage::getSingleton('eav/config')->getAttribute('customer', 'lw_card_num');
51
+ $attribute->setData('used_in_forms', $usedInForms);
52
+ $attribute->setData('sort_order', 700);
53
+
54
+ $attribute->save();
55
+
56
+ }
57
+
58
+ $attribute = $installerCustomer->getAttribute($entityId,'lw_card_exp');
59
+ if(!$attribute)
60
+ {
61
+
62
+ $installerCustomer->addAttribute('customer','lw_card_exp',array(
63
+ 'type' => 'varchar',
64
+ 'label' => 'Card Expiration date (one clic)',
65
+ 'visible' => true,
66
+ 'required' => false,
67
+ 'unique' => false,
68
+ 'sort_order' => 700,
69
+ 'default' => 0,
70
+ 'input' => 'text',
71
+
72
+ ));
73
+
74
+ $usedInForms = array(
75
+ 'adminhtml_customer',
76
+ );
77
+
78
+ $attribute = Mage::getSingleton('eav/config')->getAttribute('customer', 'lw_card_exp');
79
+ $attribute->setData('used_in_forms', $usedInForms);
80
+ $attribute->setData('sort_order', 700);
81
+
82
+ $attribute->save();
83
+
84
+ }
85
+
86
+ $attribute = $installerCustomer->getAttribute($entityId,'lw_card_type');
87
+ if(!$attribute)
88
+ {
89
+
90
+ $installerCustomer->addAttribute('customer','lw_card_type',array(
91
+ 'type' => 'varchar',
92
+ 'label' => 'Card type (one clic)',
93
+ 'visible' => true,
94
+ 'required' => false,
95
+ 'unique' => false,
96
+ 'sort_order' => 700,
97
+ 'default' => 0,
98
+ 'input' => 'text',
99
+
100
+ ));
101
+
102
+ $usedInForms = array(
103
+ 'adminhtml_customer',
104
+ );
105
+
106
+ $attribute = Mage::getSingleton('eav/config')->getAttribute('customer', 'lw_card_type');
107
+ $attribute->setData('used_in_forms', $usedInForms);
108
+ $attribute->setData('sort_order', 700);
109
+
110
+ $attribute->save();
111
+
112
+ }
113
+
114
+ $installerCustomer->endSetup();
115
+
app/code/community/Sirateck/Lemonway4ec/sql/sirateck_lemonway4ec_setup/mysql4-upgrade-0.1.4-0.1.5.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sirateck_Lemonway4ec extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Sirateck
13
+ * @package Sirateck_Lemonway4ec
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Lemonway module install script
19
+ *
20
+ * @category Sirateck
21
+ * @package Sirateck_Lemonway4ec
22
+ * @author Kassim Belghait kassim@sirateck.com
23
+ */
24
+ $this->startSetup();
25
+ $sql[] = "CREATE TABLE IF NOT EXISTS {$this->getTable('sirateck_lemonway4ec_moneyout')} (
26
+ `moneyout_id` int(11) NOT NULL AUTO_INCREMENT,
27
+ `wallet_id` varchar(255) NOT NULL,
28
+ `customer_id` int(11) NOT NULL DEFAULT 0,
29
+ `is_admin` tinyint(1) NOT NULL DEFAULT 0,
30
+ `lw_iban_id` int(11) NOT NULL,
31
+ `prev_bal` decimal(20,6) NOT NULL,
32
+ `new_bal` decimal(20,6) NOT NULL,
33
+ `iban` varchar(34) NOT NULL,
34
+ `amount_to_pay` decimal(20,6) NOT NULL,
35
+ `created_at` datetime NOT NULL,
36
+ `updated_at` datetime NOT NULL,
37
+ PRIMARY KEY (`moneyout_id`)
38
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;";
39
+
40
+ $sql[] = "CREATE TABLE IF NOT EXISTS {$this->getTable('sirateck_lemonway4ec_iban')} (
41
+ `iban_id` int(11) NOT NULL AUTO_INCREMENT,
42
+ `lw_iban_id` int(11) NOT NULL,
43
+ `customer_id` int(11) NOT NULL,
44
+ `wallet_id` varchar(255) NOT NULL,
45
+ `holder` varchar(100) NOT NULL,
46
+ `iban` varchar(34) NOT NULL,
47
+ `bic` varchar(50) NOT NULL DEFAULT '',
48
+ `dom1` text NOT NULL DEFAULT '',
49
+ `dom2` text NOT NULL DEFAULT '',
50
+ `comment` text NOT NULL DEFAULT '',
51
+ `status_id` int(2) DEFAULT NULL,
52
+ `created_at` datetime NOT NULL,
53
+ `updated_at` datetime NOT NULL,
54
+ PRIMARY KEY (`iban_id`),
55
+ UNIQUE KEY (`lw_iban_id`)
56
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;";
57
+
58
+ foreach ($sql as $q){
59
+ $this->run($q);
60
+ }
61
+
62
+
63
+ $this->endSetup();
app/design/adminhtml/default/default/layout/sirateck_lemonway4ec.xml ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Sirateck_Lemonway4ec extension
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the MIT License
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/mit-license.php
12
+ *
13
+ * @category Sirateck
14
+ * @package Sirateck_Lemonway4ec
15
+ * @copyright Copyright (c) 2015
16
+ * @license http://opensource.org/licenses/mit-license.php MIT License
17
+ */
18
+ -->
19
+ <layout>
20
+ <adminhtml_lemonway_wallet_index>
21
+ <reference name="menu">
22
+ <action method="setActive">
23
+ <menupath>sales/sirateck_lemonway4ec/wallet</menupath>
24
+ </action>
25
+ </reference>
26
+ <reference name="content">
27
+ <block type="sirateck_lemonway4ec/adminhtml_wallet" name="wallet" />
28
+
29
+ </reference>
30
+ </adminhtml_lemonway_wallet_index>
31
+ <adminhtml_lemonway_wallet_grid>
32
+ <block type="core/text_list" name="root" output="toHtml">
33
+ <block type="sirateck_lemonway4ec/adminhtml_wallet_grid" name="wallet_grid"/>
34
+ </block>
35
+ </adminhtml_lemonway_wallet_grid>
36
+ <!-- Wallet add/edit action -->
37
+ <adminhtml_lemonway_wallet_edit>
38
+ <update handle="editor"/>
39
+ <reference name="menu">
40
+ <action method="setActive">
41
+ <menupath>sales/sirateck_lemonway4ec/wallet</menupath>
42
+ </action>
43
+ </reference>
44
+ <reference name="content">
45
+ <block type="sirateck_lemonway4ec/adminhtml_wallet_edit" name="wallet_edit"></block>
46
+ </reference>
47
+ <reference name="left">
48
+ <block type="sirateck_lemonway4ec/adminhtml_wallet_edit_tabs" name="wallet_tabs"></block>
49
+ </reference>
50
+ </adminhtml_lemonway_wallet_edit>
51
+
52
+ <adminhtml_lemonway_moneyout_pay>
53
+ <reference name="menu">
54
+ <action method="setActive">
55
+ <menupath>sales/sirateck_lemonway4ec/moneyout</menupath>
56
+ </action>
57
+ </reference>
58
+ <reference name="content">
59
+ <block type="sirateck_lemonway4ec/adminhtml_moneyout" name="moneyout" template="lemonway4ec/moneyout.phtml" />
60
+
61
+ </reference>
62
+ </adminhtml_lemonway_moneyout_pay>
63
+
64
+ </layout>
app/design/adminhtml/default/default/template/lemonway4ec/moneyout.phtml ADDED
@@ -0,0 +1,191 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magento.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magento.com for more information.
20
+ *
21
+ * @category design
22
+ * @package default_default
23
+ * @copyright Copyright (c) 2006-2014 X.commerce, Inc. (http://www.magento.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ /**
27
+ * @var $this Sirateck_Lemonway4ec_Block_Adminhtml_Moneyout
28
+ */
29
+ ?>
30
+ <div class="content-header">
31
+ <table cellspacing="0">
32
+ <tr>
33
+ <td style="width:50%;"><h3 class="icon-head head-compilation"><?php echo $this->getHeader() ?></h3></td>
34
+ <td class="form-buttons">
35
+ <?php echo $this->getPayButtonHtml() ?>
36
+ </td>
37
+ </tr>
38
+ </table>
39
+ </div>
40
+ <div class="entry-edit">
41
+ <?php if(isset($this->getWalletDetails()->lwError)): ?>
42
+ <div class="entry-edit-head">
43
+ <h4 class="icon-head head-edit-form fieldset-legend"><?php echo $this->__('Wallet informations') ?></h4>
44
+ </div>
45
+ <div class="box">
46
+ <h5><?php echo $this->__("We can't retrieve your wallet!")?></h5>
47
+ <?php echo $this->__('<a href="%s">Please check your module configuration</a> or create your wallet in <a href="%s">Lemonway BO</a>.',Mage::helper("adminhtml")->getUrl('adminhtml/system_config/edit',array('section'=>"sirateck_lemonway4ec")),"https://www.lemonway.fr/MbDev/bo") ?>
48
+ </div>
49
+ <?php else : ?>
50
+ <?php
51
+ /* @var $wallet Sirateck_Lemonway4ec_Model_Apikit_Apimodels_Wallet */
52
+ $_wallet = $this->getWalletDetails()->wallet;
53
+ ?>
54
+ <form name="moneyout_form" id="moneyout_form" method="post" action="<?php echo $this->getPayFormAction(); ?>">
55
+ <?php echo $this->getBlockHtml('formkey')?>
56
+ <div class="box-left">
57
+ <div class="entry-edit-head">
58
+ <h4 class="icon-head head-edit-form fieldset-legend"><?php echo $this->__('Wallet informations') ?></h4>
59
+ </div>
60
+ <fieldset>
61
+ <legend><?php echo $this->__('Wallet informations') ?></legend>
62
+ <table cellspacing="0" class="form-list" style="width:100%">
63
+ <tr>
64
+ <td class="label"><label ><?php echo $this->__('Wallet ID')?></label></td>
65
+ <td class="value">
66
+ <strong><?php echo $_wallet->getWalletId() ?></strong>
67
+ <input type="hidden" value="<?php echo $_wallet->getWalletId() ?>" name="wallet_id" />
68
+ </td>
69
+ </tr>
70
+ <tr>
71
+ <td class="label"><label ><?php echo $this->__('Balance')?></label></td>
72
+ <td class="value">
73
+ <strong><?php echo $this->formatPrice($_wallet->getBal())?></strong>
74
+ <input type="hidden" value="<?php echo $_wallet->getBal() ?>" name="bal" />
75
+ </td>
76
+ </tr>
77
+ <tr>
78
+ <td class="label"><label ><?php echo $this->__('Owner name')?></label></td>
79
+ <td class="value">
80
+ <strong><?php echo $_wallet->getName() ?></strong>
81
+ </td>
82
+ </tr>
83
+ <tr>
84
+ <td class="label"><label ><?php echo $this->__('Owner email')?></label></td>
85
+ <td class="value">
86
+ <strong><?php echo $_wallet->getEmail() ?></strong>
87
+ </td>
88
+ </tr>
89
+ <tr>
90
+ <td class="label"><label ><?php echo $this->__('Status')?></label></td>
91
+ <td class="value">
92
+ <strong><?php echo $_wallet->getStatus() ?></strong>
93
+ </td>
94
+ </tr>
95
+ <!--<tr>
96
+ <td class="label"><label ><?php echo $this->__('Is Blocked')?></label></td>
97
+ <td class="value">
98
+ <strong><?php echo $_wallet->getBlocked() ?></strong>
99
+ </td>
100
+ </tr>
101
+ -->
102
+ </table>
103
+ </fieldset>
104
+ </div>
105
+ <div class="box-right">
106
+ <div class="entry-edit-head">
107
+ <h4 class="icon-head head-edit-form fieldset-legend"><?php echo $this->__('Iban informations') ?></h4>
108
+ </div>
109
+ <fieldset>
110
+ <legend><?php echo $this->__('Iban informations') ?></legend>
111
+ <?php if(count($_wallet->getIbans())) :?>
112
+ <table>
113
+ <?php foreach ($_wallet->getIbans() as $_iban) :?>
114
+ <tr>
115
+ <td>
116
+ <input class="required-entry" id="iban_<?php echo $_iban->getIbanId() ?>" type="radio" name="iban_id[]" value="<?php echo $_iban->getIbanId() ?>" />
117
+ <input type="hidden" value="<?php echo $_iban->getIban() ?>" name="iban_<?php echo $_iban->getIbanId() ?>" />
118
+ </td>
119
+ <td class="a-left">
120
+ <label for="iban_<?php echo $_iban->getIbanId() ?>" >
121
+ <strong><?php echo $_iban->getIban() ?></strong>
122
+ <br />
123
+ <strong><?php echo $_iban->getSwift() ?></strong>
124
+ <br />
125
+ <?php echo $this->__('Status')?>&nbsp;<strong><?php echo $_iban->getStatus()?></strong>
126
+ </label>
127
+ </td>
128
+ </tr>
129
+ <?php endforeach; ?>
130
+ </table>
131
+ <?php else:?>
132
+ <div class="box">
133
+ <h5><?php echo $this->__("You don't have any Iban!")?></h5>
134
+ <?php echo $this->__('Please create at least one for wallet <b>%s</b> in <a href="%s">Lemonway BO </a>.',$_wallet->getWalletId(),Mage::helper("adminhtml")->getUrl('adminhtml/system_config/edit',array('section'=>"sirateck_lemonway4ec")),"https://www.lemonway.fr/MbDev/bo") ?>
135
+ </div>
136
+ <?php endif; ?>
137
+ </fieldset>
138
+ </div>
139
+
140
+ <?php if ($this->canPayMoneyOut()): ?>
141
+ <div class="clear"></div>
142
+ <div class="box">
143
+ <div class="entry-edit-head">
144
+ <h4 class="icon-head head-edit-form fieldset-legend"><?php echo $this->__('Payment informations') ?></h4>
145
+ </div>
146
+ <fieldset>
147
+ <legend><?php echo $this->__('Payment informations') ?></legend>
148
+ <div class="order-totals">
149
+ <table cellspacing="0" width="100%">
150
+ <colgroup>
151
+ <col>
152
+ <col width="1">
153
+ </colgroup>
154
+ <tr>
155
+ <td class="label"><?php echo $this->__('Current balance')?></td>
156
+ <td><strong><?php echo $this->formatPrice($_wallet->getBal())?></strong></td>
157
+ </tr>
158
+ <tr>
159
+ <td class="label"><?php echo $this->__('Amount to pay')?></td>
160
+ <td><input id="amountToPay" class="input-text not-negative-amount a-right" type="text" value="<?php echo $_wallet->getBal()?>" name="amountToPay" /></td>
161
+ </tr>
162
+ </table>
163
+ <div class="order-totals-bottom">
164
+ <div class="divider"></div>
165
+ <?php echo $this->getChildHtml('submit_button') ?>
166
+ </div>
167
+ </div>
168
+ </fieldset>
169
+ <script type="text/javascript">
170
+ //<![CDATA[
171
+ Validation.addAllThese([
172
+ ['not-negative-amount', '<?php echo $this->helper('sales')->__('Please enter positive number in this field.') ?>', function(v) {
173
+ if(v.length)
174
+ return /^\s*\d+([,.]\d+)*\s*%?\s*$/.test(v);
175
+ else
176
+ return true;
177
+ }]
178
+ ]);
179
+
180
+ //]]>
181
+ </script>
182
+ </div>
183
+ <?php endif; ?>
184
+ </form>
185
+ <script type="text/javascript">
186
+ moneyoutForm = new varienForm('moneyout_form');
187
+ </script>
188
+ <?php endif;?>
189
+ </div>
190
+
191
+
app/design/frontend/base/default/template/lemonway4ec/form/webkit.phtml ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* @var $this Sirateck_Lemonway4ec_Block_Form_Webkit */
3
+ $_code=$this->getMethodCode();
4
+ ?>
5
+ <div id="payment_form_<?php echo $_code ?>" style="display:none;">
6
+ <?php if($this->oneClicAllowed()) : ?>
7
+ <ul class="form-list" id="oneclic_payment_form_<?php echo $_code ?>">
8
+ <li>
9
+
10
+ <?php if (!$this->customerHasCardId() || !$this->customerHasCardNum()) :?>
11
+ <div class="input-box">
12
+ <input id="<?php echo $_code ?>_register_card" value="register_card" type="checkbox" name="payment[oneclic]" />
13
+ <label style="float: none;" for="<?php echo $_code ?>_register_card"><?php echo $this->__('Save your card data for a next buy.') ?></label>
14
+ </div>
15
+ <?php else :?>
16
+
17
+ <div class="input-box">
18
+ <input id="<?php echo $_code ?>_use_card" value="use_card" checked="checked" type="radio" name="payment[oneclic]" checked/>
19
+ <label style="float: none;" for="<?php echo $_code ?>_use_card"><?php echo $this->__('Use my recorded card') ?></label>
20
+ </div>
21
+ <div class="input-box info-card">
22
+ <label><?php echo $this->__('Actual card') ?> :</label>
23
+ <span><?php echo $this->getCardNum() ?></span>
24
+ </div>
25
+ <?php if($this->getCardExp() != ""):?>
26
+ <div class="input-box info-card">
27
+ <label><?php echo $this->__('Expiration date') ?> : <?php echo $this->getCardExp() ?></label>
28
+ </div>
29
+ <?php endif;?>
30
+
31
+ <div class="input-box">
32
+ <input id="<?php echo $_code ?>_register_card" type="radio" name="payment[oneclic]" value="register_card"/>
33
+ <label style="float: none;" for="<?php echo $_code ?>_create_alias_oneclick"><?php echo $this->__('Save new card data') ?></label>
34
+ </div>
35
+
36
+ <div class="input-box">
37
+ <input id="<?php echo $_code ?>_no_use_card" type="radio" name="payment[oneclic]" value="no_use_card" />
38
+ <label style="float: none;" for="<?php echo $_code ?>_no_use_card"><?php echo $this->__('Not use recorded card data') ?></label>
39
+ </div>
40
+
41
+ <?php endif;?>
42
+ </li>
43
+
44
+ </ul>
45
+ <br />
46
+ <?php endif; ?>
47
+ <div id="<?php echo $_code ?>_redirect_text">
48
+ <?php $_base_message = $this->__('You will be redirect to payment page after you submit order.') ?>
49
+ <?php $_use_card_message = $this->__('Your order will be paid with your registered card after you submit order') ?>
50
+ <?php echo $_base_message ?>
51
+ </div>
52
+ </div>
53
+ <script type="text/javascript">
54
+ //<![CDATA[
55
+
56
+ if($('<?php echo $_code ?>_use_card') != undefined && $('<?php echo $_code ?>_use_card').checked)
57
+ {
58
+ $('<?php echo $_code ?>_redirect_text').innerHTML = '<?php echo $_use_card_message ?>';
59
+ }
60
+
61
+
62
+
63
+ var updateRedirectText = function (){
64
+
65
+ if($('<?php echo $_code ?>_use_card').checked)
66
+ {
67
+ $('<?php echo $_code ?>_redirect_text').innerHTML = '<?php echo $_use_card_message ?>';
68
+
69
+ }
70
+ else
71
+ {
72
+ $('<?php echo $_code ?>_redirect_text').innerHTML = '<?php echo $_base_message ?>';
73
+
74
+ }
75
+ }
76
+ Event.observe($('<?php echo $_code ?>_use_card'),'change',updateRedirectText);
77
+ Event.observe($('<?php echo $_code ?>_register_card'),'change',updateRedirectText);
78
+ Event.observe($('<?php echo $_code ?>_no_use_card'),'change',updateRedirectText);
79
+
80
+ //]]>
81
+ </script>
app/design/frontend/base/default/template/lemonway4ec/info/webkit.phtml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @see Mage_Payment_Block_Info
4
+ */
5
+ ?>
6
+ <?php echo $this->htmlEscape($this->getMethod()->getTitle()) ?>
7
+
8
+ <?php if ($_specificInfo = $this->getSpecificInformation()):?>
9
+ <table>
10
+ <?php foreach ($_specificInfo as $_label => $_value):?>
11
+ <tr>
12
+ <td><?php echo $this->escapeHtml($_label)?>:</td>
13
+ <td><?php echo nl2br(implode($this->getValueAsArray($_value, true), "\n"))?></td>
14
+ </tr>
15
+ <?php endforeach; ?>
16
+ </table>
17
+ <?php endif;?>
18
+
19
+ <?php echo $this->getChildHtml()?>
app/etc/modules/Sirateck_Lemonway4ec.xml ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Sirateck_Lemonway4ec extension
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the MIT License
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/mit-license.php
12
+ *
13
+ * @category Sirateck
14
+ * @package Sirateck_Lemonway4ec
15
+ * @copyright Copyright (c) 2015
16
+ * @license http://opensource.org/licenses/mit-license.php MIT License
17
+ */
18
+ -->
19
+ <config>
20
+ <modules>
21
+ <Sirateck_Lemonway4ec>
22
+ <active>true</active>
23
+ <codePool>community</codePool>
24
+ <depends>
25
+ <Mage_Core />
26
+ </depends>
27
+ </Sirateck_Lemonway4ec>
28
+ </modules>
29
+ </config>
app/locale/en_US/Sirateck_Lemonway4ec.csv ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "",""
2
+ "<a href="""%s""">Please check your module configuration</a> or create your wallet in <a href="""%s""">Lemonway BO</a>.","<a href="""%s""">Please check your module configuration</a> or create your wallet in <a href="""%s""">Lemonway BO</a>."
3
+ "Account Lemon Way for E-commerce","Account Lemon Way for E-commerce"
4
+ "Action","Action"
5
+ "Actual card","Actual card"
6
+ "Add Wallet","Add Wallet"
7
+ "Allow One clic","Allow One clic"
8
+ "Amount to pay","Amount to pay"
9
+ "An error occurred while updating the wallets.","An error occurred while updating the wallets."
10
+ "An error occurred. Please contact support.","An error occurred. Please contact support."
11
+ "Are you sure?","Are you sure?"
12
+ "Auto commission","Auto commission"
13
+ "Balance","Balance"
14
+ "Birth country","Birth country"
15
+ "Cancel orders in pending status since more 30 minutes. Useful when a customer don't send his credit card information in hosted page.","Cancel orders in pending status since more 30 minutes. Useful when a customer don't send his credit card information in hosted page."
16
+ "Cancel orders in pending status","Cancel orders in pending status"
17
+ "Card Expiration date (one clic)","Card Expiration date (one clic)"
18
+ "Card ID one clic","Card ID one clic"
19
+ "Card Num (one clic)","Card Num (one clic)"
20
+ "Card type (one clic)","Card type (one clic)"
21
+ "Change Is Admin","Change Is Admin"
22
+ "Change Is company","Change Is company"
23
+ "Change Is debtor","Change Is debtor"
24
+ "Change Is default","Change Is default"
25
+ "Change Is One time customer","Change Is One time customer"
26
+ "Change status","Change status"
27
+ "City of Birth","City of Birth"
28
+ "City","City"
29
+ "Commission amount","Commission amount"
30
+ "Company description","Company description"
31
+ "Company ID number","Company ID number"
32
+ "Company name","Company name"
33
+ "Company website","Company website"
34
+ "Could not find wallet to delete.","Could not find wallet to delete."
35
+ "Country","Country"
36
+ "Created at","Created at"
37
+ "Css url","Css url"
38
+ "CSV","CSV"
39
+ "Current balance","Current balance"
40
+ "Customer ID","Customer ID"
41
+ "Customer not found!","Customer not found!"
42
+ "Delete Wallet","Delete Wallet"
43
+ "Delete","Delete"
44
+ "Disabled","Disabled"
45
+ "Display checkbox in frontend form","Display checkbox in frontend form"
46
+ "Dob","Dob"
47
+ "Document checked and accepted","Document checked and accepted"
48
+ "Document checked but not accepted","Document checked but not accepted"
49
+ "Document only received","Document only received"
50
+ "Document replaced by another document","Document replaced by another document"
51
+ "Document validity expired","Document validity expired"
52
+ "Edit Wallet '%s'","Edit Wallet '%s'"
53
+ "Edit","Edit"
54
+ "Email related to your wallet. It's used for retrieve wallet's informations.","Email related to your wallet. It's used for retrieve wallet's informations.
55
+ "Email","Email"
56
+ "Enable debug log","Enable debug log"
57
+ "Enable test mode","Enable test mode"
58
+ "Enabled","Enabled"
59
+ "Error saving wallet","Error saving wallet"
60
+ "Excel","Excel"
61
+ "Expiration date","Expiration date"
62
+ "Firstname","Firstname"
63
+ "Home","Home"
64
+ "Iban informations","Iban informations"
65
+ "ID card (UE)","ID card (UE)"
66
+ "Id","Id"
67
+ "If <b>No</b> <u>you must fill field Commission amount below</u>.","If <b>No</b> <u>you must fill field Commission amount below</u>."
68
+ "If you have cutomized marketplace module to include shipping amount in seller's amount, enable it.","Enable it, if you have cutomized marketplace module to include shipping amount in seller's total before commision calculation."
69
+ "Is Admin","Is Admin"
70
+ "Is Blocked","Is Blocked"
71
+ "Is company","Is company"
72
+ "Is debtor","Is debtor"
73
+ "Is default","Is default"
74
+ "Is One time customer","Is One time customer"
75
+ "Kbis","Kbis"
76
+ "Lastname","Lastname"
77
+ "Lemonway account configuration","Lemonway account configuration"
78
+ "Lemonway ID","Lemonway ID"
79
+ "Lemonway payment method (webkit)","Lemonway payment method (webkit)"
80
+ "Lemonway payment","Lemonway payment"
81
+ "Log all queries to and from lemonway API","Log all queries to and from lemonway API"
82
+ "Login Lemon Way for E-commerce","Login Lemon Way for E-commerce"
83
+ "Miscellaneous","Miscellaneous"
84
+ "Mobile Number","Mobile Number"
85
+ "Money out","Money out"
86
+ "Moneyout from Magento module","Moneyout from Magento module"
87
+ "MoneyOut","Money out"
88
+ "Nationality","Nationality"
89
+ "No","No"
90
+ "None","None"
91
+ "Not use recorded card data","Not use recorded card data"
92
+ "Oneclic mode (card id: %s)","Oneclic mode (card id: %s)"
93
+ "Order canceled automatically by cron because order is pending since %d minutes","Order canceled automatically by cron because order is pending since %d minutes"
94
+ "Owner email","Owner email"
95
+ "Owner name","Owner name"
96
+ "Passport (Not UE)","Passport (Not UE)"
97
+ "Passport (UE)","Passport (UE)"
98
+ "Password Lemon Way for E-commerce","Password Lemon Way for E-commerce"
99
+ "Pay","Pay"
100
+ "Payer or beneficiary","Payer or beneficiary"
101
+ "Payment informations","Payment informations"
102
+ "Phone Number","Phone Number"
103
+ "Please create at least one for wallet <b>%s</b> in <a href="%s">Lemonway BO </a>."
104
+ "Please select wallets to delete.","Please select wallets to delete."
105
+ "Please select wallets.","Please select wallets."
106
+ "Postcode","Postcode"
107
+ "Prefix","Prefix"
108
+ "Proof of address","Proof of address"
109
+ "Reset","Reset"
110
+ "Residence permit","Residence permit"
111
+ "RIB","RIB"
112
+ "Save And Continue Edit","Save And Continue Edit"
113
+ "Save new card data","Save new card data"
114
+ "Save Wallet","Save Wallet"
115
+ "Save your card data for a next buy.","Save your card data for a next buy."
116
+ "Shipping amount in marketplace total","Shipping amount in marketplace total"
117
+ "Status","Status"
118
+ "Store views","Store views"
119
+ "Street","Street"
120
+ "The wallets has been deleted.","The wallets has been deleted."
121
+ "There was a problem saving the wallet.","There was a problem saving the wallet."
122
+ "There was an error deleting wallet.","There was an error deleting wallet."
123
+ "There was an error deleting wallets.","There was an error deleting wallets."
124
+ "There was an error updating wallets.","There was an error updating wallets."
125
+ "This information has been sent to you by e-mail","This information has been sent to you by e-mail"
126
+ "This wallet no longer exists.","This wallet no longer exists."
127
+ "Title","Title"
128
+ "Total of %d record(s) have been deleted.","Total of %d record(s) have been deleted."
129
+ "Total of %d record(s) have been updated.","Total of %d record(s) have been updated."
130
+ "Total of %d wallets were successfully deleted.","Total of %d wallets were successfully deleted."
131
+ "Total of %d wallets were successfully updated.","Total of %d wallets were successfully updated."
132
+ "Transaction Failed. Order was canceled automatically.","Transaction Failed. Order was canceled automatically."
133
+ "Unable to find wallet to save.","Unable to find wallet to save."
134
+ "Updated at","Updated at"
135
+ "Use my recorded card","Use my recorded card"
136
+ "Wallet ID","Wallet ID"
137
+ "Wallet informations","Wallet informations"
138
+ "Wallet was saved","Wallet was saved"
139
+ "Wallet was successfully deleted.","Wallet was successfully deleted."
140
+ "Wallet was successfully saved","Wallet was successfully saved"
141
+ "Wallet","Wallet"
142
+ "Wallets","Wallets"
143
+ "We can't retrieve your wallet!","We can't retrieve your wallet!"
144
+ "WYSIWYG Editor","WYSIWYG Editor"
145
+ "XML","XML"
146
+ "Yes for tests, No to go Live","Yes for tests, No to go Live"
147
+ "Yes","Yes"
148
+ "You can't paid amount upper of your balance amount: %s","You can't paid amount upper of your balance amount: %s"
149
+ "You don't have any Iban!","You don't have any Iban!"
150
+ "You paid %s to your Iban %s from your wallet <b>%s</b>","You paid %s to your Iban %s from your wallet <b>%s</b>"
151
+ "You will be redirect to payment page after you submit order.","You will be redirect to payment page after you submit order."
152
+ "Your order will be paid with your registered card after you submit order","Your order will be paid with your registered card after you submit order"
153
+ "Your wallet email","Your wallet email"
app/locale/fr_FR/Sirateck_Lemonway4ec.csv ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "",""
2
+ "<a href="""%s""">Please check your module configuration</a> or create your wallet in <a href="""%s""">Lemonway BO</a>.","<a href="""%s""">Veuillez vérifier la configuration du module</a> ou créer votre premier wallet sur <a href="""%s""">le BO Lemonway</a>."
3
+ "Account Lemon Way for E-commerce","Identifiant de votre compte Lemon Way for E-commerce"
4
+ "Action","Action"
5
+ "Actual card","Carte enregistrée"
6
+ "Add Wallet","Ajouter un wallet"
7
+ "Allow One clic","Autoriser le one clic"
8
+ "Amount to pay","Montant à payer"
9
+ "An error occurred while updating the wallets.","Une erreur est survenue lors de la mise à jour des wallets."
10
+ "An error occurred. Please contact support.","Une erreur est survenue. Veuillez contacter le support."
11
+ "Are you sure?","Etes vous sûr ?"
12
+ "Auto commission","Auto commission"
13
+ "Balance","Solde"
14
+ "Birth country","Pays de naissance"
15
+ "Cancel orders in pending status since more 30 minutes. Useful when a customer don't send his credit card information in hosted page.","Annule les commandes au statut ""en attente"" depuis plus de 30 minutes. Utile quand les clients ne valident pas le formulaire de saisie bancaire."
16
+ "Cancel orders in pending status","Annule les commandes au statut ""en attente"""
17
+ "Card Expiration date (one clic)","Date d'expiration de la carte enregistrée"
18
+ "Card ID one clic","Id de la carte enregistrée"
19
+ "Card Num (one clic)","Numéro de la carte enregistrée"
20
+ "Card type (one clic)","Type de carte enregistrée"
21
+ "Change Is Admin","Change Is Admin"
22
+ "Change Is company","Change Is company"
23
+ "Change Is debtor","Change Is debtor"
24
+ "Change Is default","Change Is default"
25
+ "Change Is One time customer","Change Is One time customer"
26
+ "Change status","Change status"
27
+ "City of Birth","Ville de naissance"
28
+ "City","Ville"
29
+ "Commission amount","Montant de la commission"
30
+ "Company description","Description de la société"
31
+ "Company ID number","SIRET/SIREN de la société"
32
+ "Company name","Nom de la société"
33
+ "Company website","Site web de la société"
34
+ "Could not find wallet to delete.","Le wallet à supprimer n'a pas été trouvé."
35
+ "Country","Pays"
36
+ "Created at","Créé le"
37
+ "Css url","Url de votre fichier CSS"
38
+ "CSV","CSV"
39
+ "Current balance","Solde actuel"
40
+ "Customer ID","ID du Client"
41
+ "Customer not found!","Le client n'a pas été trouvé!"
42
+ "Delete Wallet","Supprimé le wallet"
43
+ "Delete","Supprimer"
44
+ "Disabled","Désactivé"
45
+ "Display checkbox in frontend form","Affiche les boites à cocher sur le formulaire de la méthode en front (checkout)"
46
+ "Dob","Date de naissance"
47
+ "Document checked and accepted","Document vérifié et accepté"
48
+ "Document checked but not accepted","Document vérifié mais pas accepté"
49
+ "Document only received","Document reçu uniquement"
50
+ "Document replaced by another document","Document remplacé par un autre document"
51
+ "Document validity expired","Validité du document expiré"
52
+ "Edit Wallet '%s'","Editer le wallet '%s'"
53
+ "Edit","Editer"
54
+ "Email related to your wallet. It's used for retrieve wallet's informations.","Email correspondant à votre wallet. Il sera utilisé pour récupérer les informations du wallet."
55
+ "Email","Email"
56
+ "Enable debug log","Activer les log du debug"
57
+ "Enable test mode","Activer le mode test"
58
+ "Enabled","Activé"
59
+ "Error saving wallet","Erreur de sauvegarde du wallet"
60
+ "Excel","Excel"
61
+ "Expiration date","Date expiration"
62
+ "Firstname","Prénom"
63
+ "Home","Accueil"
64
+ "Iban informations","Information des Ibans"
65
+ "ID card (UE)","Carte d'identité (Zone UE)"
66
+ "Id","Id"
67
+ "If <b>No</b> <u>you must fill field Commission amount below</u>.","Si <b>Non</b> <u>vous devez renseigner le champs Commission ci-dessous.</u>."
68
+ "If you have cutomized marketplace module to include shipping amount in seller's amount, enable it.","A activer,si vous avez personnalisé le module Marketplace pour inclure le montant des frais de port dans le total marketplace avant le prélèvement de la commission."
69
+ "Is Admin","Est Admin"
70
+ "Is Blocked","Is Blocked"
71
+ "Is company","Is company"
72
+ "Is debtor","Is debtor"
73
+ "Is default","Is default"
74
+ "Is One time customer","Is One time customer"
75
+ "Kbis","Kbis"
76
+ "Lastname","Nom"
77
+ "Lemonway account configuration","Configuration du compte Lemonway"
78
+ "Lemonway ID","Lemonway ID"
79
+ "Lemonway payment method (webkit)","Lemonway - Webkit"
80
+ "Lemonway payment","Lemonway"
81
+ "Log all queries to and from lemonway API","Log toutes les requêtes entrantes/sortantes de l'API"
82
+ "Login Lemon Way for E-commerce","Identifiant de connexion à Lemon Way for E-commerce"
83
+ "Miscellaneous","Divers"
84
+ "Mobile Number","Numéro mobile"
85
+ "Money out","Money out"
86
+ "Moneyout from Magento module","Moneyout depuis le module magento"
87
+ "MoneyOut","Money out"
88
+ "Nationality","Nationalité"
89
+ "No","Non"
90
+ "None","Aucun"
91
+ "Not use recorded card data","Ne pas utliser ma carte enregistrer"
92
+ "Oneclic mode (card id: %s)","Mode Oneclic (ID carte: %s)"
93
+ "Order canceled automatically by cron because order is pending since %d minutes","Commande annulée automatiquement par la tâche planifiée car la commande était en attente depuis plus de %s minutes"
94
+ "Owner email","Email du porteur"
95
+ "Owner name","Nom du porteur"
96
+ "Passport (Not UE)","Passeport (NON UE)"
97
+ "Passport (UE)","Passeport (UE)"
98
+ "Password Lemon Way for E-commerce","Mot de passe de connexion à Lemon Way for E-commerce"
99
+ "Pay","Payer"
100
+ "Payer or beneficiary","Payeur ou bénéficiaire"
101
+ "Payment informations","Informations du paiement money out"
102
+ "Phone Number","Numéro de téléphone"
103
+ "Please create at least one for wallet <b>%s</b> in <a href="""%s""">Lemonway BO </a>.","Veuillez en créer au moins un pour le wallet <b>%s</b> sur le <a href="""%s""">BO lemonway</a>."
104
+ "Please select wallets to delete.","Veuillez sélectionner les wallets à supprimer"
105
+ "Please select wallets.","Veuillez sélectionner les wallets."
106
+ "Postcode","Code postal"
107
+ "Prefix","Préfix"
108
+ "Proof of address","Justificatif de domicile"
109
+ "Reset","Reset"
110
+ "Residence permit","Carte de séjour"
111
+ "RIB","RIB"
112
+ "Save And Continue Edit","Sauvegarder et continuer l'édition"
113
+ "Save new card data","Enregister une nouvelle empreinte de carte"
114
+ "Save Wallet","Sauvegarder le wallet"
115
+ "Save your card data for a next buy.","Enregister une empreinte de carte pour faciliter mes prochains achats."
116
+ "Shipping amount in marketplace total","Montant des frais de port dans le total marketplace"
117
+ "Status","Statut"
118
+ "Store views","Vue magasin"
119
+ "Street","Rue"
120
+ "The wallets has been deleted.","Le wallet a bien été supprimé."
121
+ "There was a problem saving the wallet.","Il y a eu un problème lors de la sauvegarde du wallet."
122
+ "There was an error deleting wallet.","Il y a eu un problème lors de la suppression du wallet."
123
+ "There was an error deleting wallets.","Il y a eu un problème lors de la suppression des wallets."
124
+ "There was an error updating wallets.","Il y a eu un problème lors de la mise ) jour des wallets."
125
+ "This information has been sent to you by e-mail","Cet identifiant vous a été envoyé par mail"
126
+ "This wallet no longer exists.","Ce wallet n'existe plus."
127
+ "Title","Titre"
128
+ "Total of %d record(s) have been deleted.","%d enregistrements supprimés."
129
+ "Total of %d record(s) have been updated.","%d enregistrements mis à jour."
130
+ "Total of %d wallets were successfully deleted.","%d wallets supprimés."
131
+ "Total of %d wallets were successfully updated.","%d wallets mis à jours."
132
+ "Transaction Failed. Order was canceled automatically.","Échec de transaction. Commande annulée automatiquement."
133
+ "Unable to find wallet to save.","Le wallet à sauvegarder n'a pas été trouvé."
134
+ "Updated at","Mis à jour le"
135
+ "Use my recorded card","Utiliser ma carte enregistrée"
136
+ "Wallet ID","Wallet ID"
137
+ "Wallet informations","Information du wallet"
138
+ "Wallet was saved","Le wallet à été sauvegardé"
139
+ "Wallet was successfully deleted.","Le wallet à été supprimé"
140
+ "Wallet was successfully saved","Le wallet à été sauvegardé"
141
+ "Wallet","Wallet"
142
+ "Wallets","Wallets"
143
+ "We can't retrieve your wallet!","Les informations de votre wallet n'ont pu être récupérer!"
144
+ "WYSIWYG Editor","WYSIWYG Editor"
145
+ "XML","XML"
146
+ "Yes for tests, No to go Live","OUI pour être en test, NON pour être en Live"
147
+ "Yes","Oui"
148
+ "You can't paid amount upper of your balance amount: %s","Vous ne pouvez pas payer un montant supérieur à votre solde de %s"
149
+ "You don't have any Iban!","Vous n'avez aucun Iban enregistré!"
150
+ "You paid %s to your Iban %s from your wallet <b>%s</b>","Vous avez payer %s vers l'IBAN %s depuis le wallet <b>%s</b>"
151
+ "You will be redirect to payment page after you submit order.","Vous serez redirigé vers la page de paiement après avoir validé votre commande."
152
+ "Your order will be paid with your registered card after you submit order","Votre commande sera payée avec votre carte enregistrée dés que vous aurez validé votre commande."
153
+ "Your wallet email","L'email de votre wallet"
package.xml ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?xml version="1.0"?>
2
+ <package><name>Sirateck_Lemonway4ec</name><version>1.0.1</version><stability>stable</stability><license>http://opensource.org/licenses/mit-license.php MIT licence</license><channel>community</channel><extends></extends><summary>A 1 minute integration for the cheapest payment solution in Europe.Accept payment by credit cards from all around the world.</summary><description>Through its API, Lemon Way offers you state-of-the-art payment technology. Beyond their technological expertise, Lemon Way also offers a multitude of complementary regulation and management services.</description><notes>- Add ecommerce route by default</notes><authors><author><name>Thomas Roche</name><user>lemonway</user><email>troche@lemonway.com</email></author></authors><date>2017-03-03</date><time>3:12:17</time><compatible></compatible><dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies><contents><target name="mage"><dir name="app"><dir name="code"><dir name="community"><dir name="Sirateck"><dir name="Lemonway4ec"><dir name="Block"><dir name="Adminhtml"><file name="Moneyout.php" hash="f6877c2ab4990c7a64240c3d43216e53"/><file name="Wallet.php" hash="4f9bb0a11561b5c8cad7be20790085b0"/><dir name="Wallet"><file name="Edit.php" hash="9893d4039714f718d95461af3f1a6f82"/><file name="Grid.php" hash="0b0227f3faf0d01cdf6449aa1a4817cd"/><dir name="Edit"><file name="Form.php" hash="39fc259697bc80e12613fa91dcf85342"/><file name="Tabs.php" hash="a186c5ff52f9f2337e203d919ae561ea"/><dir name="Tab"><file name="Form.php" hash="6c3cd25eafc8d2510be9eead65f503a1"/></dir></dir></dir></dir><dir name="Form"><file name="Webkit.php" hash="fd189efe684bf10267aeb362e79744b1"/></dir><dir name="Info"><file name="Webkit.php" hash="e7d9e4a2e1eae57870604853460bd74f"/></dir></dir><dir name="Controller"><dir name="Adminhtml"><file name="Lemonway.php" hash="c7128a4264abab23db24c900c87f5868"/></dir></dir><dir name="controllers"><file name="PaymentController.php" hash="1f02fd738d50ae5a46974bfc8eef0f7a"/><dir name="Adminhtml"><dir name="Lemonway"><file name="MoneyoutController.php" hash="a2415d3bf64079842e95b4e86627e481"/><file name="WalletController.php" hash="801a1dfb2a1fda019218cae8139bfa6e"/></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="c728f7e3ed0099992a08136b7fde2cc9"/><file name="config.xml" hash="a2733bc915dd26d0635b4e6b0d40d4cd"/><file name="system.xml" hash="3713253413417a29ecdc64c86573f4a0"/></dir><dir name="Helper"><file name="Data.php" hash="1859554ecee1ede986bf62891ce2b04a"/></dir><dir name="Model"><file name="Config.php" hash="f2bff5869be7966e9e3efe3f5e815e0b"/><file name="Iban.php" hash="f551bf08bbee7b990b2e90eaf3e7efe8"/><file name="Moneyout.php" hash="5331cc2be53f184f226557218e59001f"/><file name="Observer.php" hash="75581e46effd0cbacfb6e9b16917ab73"/><file name="Wallet.php" hash="6572e1b381d1709e0e11e753b3fb3e47"/><dir name="Adminhtml"><dir name="Search"><file name="Wallet.php" hash="1acbb8816a07fb44cb641220680783b5"/></dir></dir><dir name="Apikit"><file name="Apiresponse.php" hash="d597a6c63ef3151817f2261e661d67f0"/><file name="Kit.php" hash="95816dc9006749f48eb3976d78056263"/><dir name="Apimodels"><file name="Iban.php" hash="9f85277e550ca19a0226f7b2a9aa7ad1"/><file name="KycDoc.php" hash="5d62c0a2ac27026ae79c7e213387423b"/><file name="LwError.php" hash="7b719c89d29478a4d64a923ea4fd0dee"/><file name="LwModel.php" hash="f81e065c3a28a896d48640f054286903"/><file name="Operation.php" hash="b153c3bf0cb71fbbcdfd14bb959f218f"/><file name="SddMandate.php" hash="66b7587c14cb30fe224f64a986001d7b"/><file name="Wallet.php" hash="33953653990794c2db68c89e510539be"/></dir></dir><dir name="Attribute"><dir name="Source"><file name="Country.php" hash="21d65cc487263ec1cfe741cb59735480"/></dir></dir><dir name="Method"><file name="Webkit.php" hash="367c85e97302dd223360c58b3c9396bf"/></dir><dir name="Resource"><file name="Iban.php" hash="7585d4e7988d69be54d59d6d4e16a5bc"/><file name="Moneyout.php" hash="27ef20be0331069c3791007c5c4859c8"/><file name="Setup.php" hash="cecf151193b4a08f3de1dd04d5481f5b"/><file name="Wallet.php" hash="5dab68b07398ccf34d261d7f4cec3aa6"/><dir name="Iban"><file name="Collection.php" hash="d73f03ab614fee53e3cb3ad0ae9309bb"/></dir><dir name="Moneyout"><file name="Collection.php" hash="45c17045e5071dd7b0c4ec95a1ba5f3c"/></dir><dir name="Wallet"><file name="Collection.php" hash="3e92ebd3704b1df414795237d3df6860"/></dir></dir><dir name="Wallet"><dir name="Attribute"><dir name="Source"><file name="Payerorbeneficiary.php" hash="e4f5e23c013cbf09afc1c8d1a73cf0a1"/></dir></dir></dir></dir><dir name="sql"><dir name="sirateck_lemonway4ec_setup"><file name="install-0.1.0.php" hash="dd073685890d366eea750bd0179eb8e9"/><file name="mysql4-upgrade-0.1.0-0.1.1.php" hash="543532ec39293cba6b8051105e765b56"/><file name="mysql4-upgrade-0.1.1-0.1.2.php" hash="000fa8ee202c2b0de61c1ab5f1f97f4b"/><file name="mysql4-upgrade-0.1.4-0.1.5.php" hash="ad896b0b062ba0112ef748c58a96e215"/></dir></dir></dir></dir></dir></dir><dir name="design"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="sirateck_lemonway4ec.xml" hash="0f638ac5aa8689e667c6f450f973088a"/></dir><dir name="template"><dir name="lemonway4ec"><file name="moneyout.phtml" hash="8acce1a731c88b1758d7faa0092eb61b"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="lemonway4ec"><dir name="form"><file name="webkit.phtml" hash="6f7f97cffef66cd988a659f101201c76"/></dir><dir name="info"><file name="webkit.phtml" hash="96e92e2b6564392e7294b8f96469940f"/></dir></dir></dir></dir></dir></dir></dir><dir name="etc"><dir name="modules"><file name="Sirateck_Lemonway4ec.xml" hash="03c8748dd58bd9ca80d01ab8a9906a1f"/></dir></dir><dir name="locale"><dir name="en_US"><file name="Sirateck_Lemonway4ec.csv" hash="2282bad75b5dab3e147a832668cdcd16"/></dir><dir name="fr_FR"><file name="Sirateck_Lemonway4ec.csv" hash="e18be308ddcce548bfb33e9398b072de"/></dir></dir></dir></target></contents></package>