Ced_LayBuy - Version 2.0.2

Version Notes

1. Order page modified with installment plans details in payment information section.
2. Customer can view there installment plans of a order from account panel for detail read the user guide
3. Enhance the payment association with order
4. Installment plan can be canceled on order cancellation
5. admin Interfaces are modified.
6. payment method only active at checkout per:
- min. checkout cart total
- allowed categories
- allowed customer groups

Download this release

Release Info

Developer Warrin
Extension Ced_LayBuy
Version 2.0.2
Comparing to
See all releases


Version 2.0.2

Files changed (67) hide show
  1. app/code/local/Ced/LayBuy/Block/Adminhtml/Report.php +47 -0
  2. app/code/local/Ced/LayBuy/Block/Adminhtml/Report/Details.php +82 -0
  3. app/code/local/Ced/LayBuy/Block/Adminhtml/Report/Details/Form.php +211 -0
  4. app/code/local/Ced/LayBuy/Block/Adminhtml/Report/Edit.php +79 -0
  5. app/code/local/Ced/LayBuy/Block/Adminhtml/Report/Edit/Form.php +348 -0
  6. app/code/local/Ced/LayBuy/Block/Adminhtml/Report/Grid.php +165 -0
  7. app/code/local/Ced/LayBuy/Block/Adminhtml/Report/Renderer/Email.php +39 -0
  8. app/code/local/Ced/LayBuy/Block/Adminhtml/Report/Renderer/Order.php +45 -0
  9. app/code/local/Ced/LayBuy/Block/Adminhtml/Report/Renderer/Record.php +73 -0
  10. app/code/local/Ced/LayBuy/Block/Customer/Account/Details.php +63 -0
  11. app/code/local/Ced/LayBuy/Block/Customer/Account/Grid.php +78 -0
  12. app/code/local/Ced/LayBuy/Block/Form/Laybuy.php +72 -0
  13. app/code/local/Ced/LayBuy/Block/Info/Laybuy.php +86 -0
  14. app/code/local/Ced/LayBuy/Block/Revise/Redirect.php +86 -0
  15. app/code/local/Ced/LayBuy/Block/Standard/Redirect.php +68 -0
  16. app/code/local/Ced/LayBuy/Helper/Config.php +103 -0
  17. app/code/local/Ced/LayBuy/Helper/Data.php +231 -0
  18. app/code/local/Ced/LayBuy/Model/Observer.php +120 -0
  19. app/code/local/Ced/LayBuy/Model/Report.php +429 -0
  20. app/code/local/Ced/LayBuy/Model/Resource/Report.php +60 -0
  21. app/code/local/Ced/LayBuy/Model/Resource/Report/Collection.php +37 -0
  22. app/code/local/Ced/LayBuy/Model/Resource/Revise.php +60 -0
  23. app/code/local/Ced/LayBuy/Model/Resource/Revise/Collection.php +37 -0
  24. app/code/local/Ced/LayBuy/Model/Resource/Setup.php +34 -0
  25. app/code/local/Ced/LayBuy/Model/Revise.php +41 -0
  26. app/code/local/Ced/LayBuy/Model/Standard.php +137 -0
  27. app/code/local/Ced/LayBuy/Model/System/Config/Backend/Cron.php +54 -0
  28. app/code/local/Ced/LayBuy/Model/System/Config/Source/Categories - bkp.php +124 -0
  29. app/code/local/Ced/LayBuy/Model/System/Config/Source/Categories.php +58 -0
  30. app/code/local/Ced/LayBuy/Model/System/Config/Source/FetchingSchedule.php +46 -0
  31. app/code/local/Ced/LayBuy/Model/System/Config/Source/Groups.php +48 -0
  32. app/code/local/Ced/LayBuy/README.txt +45 -0
  33. app/code/local/Ced/LayBuy/controllers/Adminhtml/ReportController.php +375 -0
  34. app/code/local/Ced/LayBuy/controllers/ReportController.php +53 -0
  35. app/code/local/Ced/LayBuy/controllers/ReviseController.php +162 -0
  36. app/code/local/Ced/LayBuy/controllers/StandardController.php +426 -0
  37. app/code/local/Ced/LayBuy/etc/adminhtml.xml +56 -0
  38. app/code/local/Ced/LayBuy/etc/config.xml +177 -0
  39. app/code/local/Ced/LayBuy/etc/system.xml +246 -0
  40. app/code/local/Ced/LayBuy/sql/laybuy_setup/mysql4-install-0.1.0.php +26 -0
  41. app/code/local/Ced/LayBuy/sql/laybuy_setup/mysql4-upgrade-0.1.0-0.2.0.php +7 -0
  42. app/code/local/Ced/LayBuy/sql/laybuy_setup/mysql4-upgrade-0.2.0-0.3.0.php +5 -0
  43. app/code/local/Ced/LayBuy/sql/laybuy_setup/mysql4-upgrade-0.3.0-0.4.0.php +1 -0
  44. app/code/local/Ced/LayBuy/sql/laybuy_setup/mysql4-upgrade-0.4.0-0.5.0.php +1 -0
  45. app/code/local/Ced/LayBuy/sql/laybuy_setup/mysql4-upgrade-0.5.0-0.6.0.php +1 -0
  46. app/code/local/Ced/LayBuy/sql/laybuy_setup/mysql4-upgrade-0.6.0-0.7.0.php +1 -0
  47. app/code/local/Ced/LayBuy/sql/laybuy_setup/mysql4-upgrade-0.7.0-0.8.0.php +1 -0
  48. app/code/local/Ced/LayBuy/sql/laybuy_setup/mysql4-upgrade-0.8.0-0.9.0.php +1 -0
  49. app/design/adminhtml/default/default/layout/laybuy.xml +8 -0
  50. app/design/adminhtml/default/default/template/laybuy/info/default.phtml +52 -0
  51. app/design/adminhtml/default/default/template/laybuy/notification.phtml +34 -0
  52. app/design/frontend/base/default/layout/laybuy.xml +57 -0
  53. app/design/frontend/base/default/template/laybuy/checkout/onepage/review/button.phtml +47 -0
  54. app/design/frontend/base/default/template/laybuy/customer/account/details.phtml +138 -0
  55. app/design/frontend/base/default/template/laybuy/customer/account/grid.phtml +95 -0
  56. app/design/frontend/base/default/template/laybuy/form/extra.phtml +73 -0
  57. app/design/frontend/base/default/template/laybuy/form/laybuy.phtml +63 -0
  58. app/design/frontend/base/default/template/laybuy/form/laybuy.phtml.original +63 -0
  59. app/design/frontend/base/default/template/laybuy/info/default.phtml +45 -0
  60. app/etc/modules/Ced_LayBuy.xml +13 -0
  61. app/locale/en_US/Ced_LayBuy.csv +30 -0
  62. js/laybuy/check_jquery.js +9 -0
  63. js/laybuy/jquery.atooltip.js +131 -0
  64. js/laybuy/jquery.min.js +17 -0
  65. package.xml +36 -0
  66. skin/frontend/base/default/css/laybuy/tooltip.css +51 -0
  67. skin/frontend/base/default/images/laybuy/closeBtn.png +0 -0
app/code/local/Ced/LayBuy/Block/Adminhtml/Report.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Lay-Buys
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * 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@magentocommerce.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.magentocommerce.com for more information.
20
+ *
21
+ * @category Ced
22
+ * @package Ced_LayBuy
23
+ * @author Asheesh Singh<asheeshsingh@cedcoss.com>
24
+ * @copyright Copyright LAY-BUYS (2011). (http://lay-buys.com/)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ /**
29
+ * Block for LayBuy report
30
+ */
31
+ class Ced_LayBuy_Block_Adminhtml_Report extends Mage_Adminhtml_Block_Widget_Grid_Container
32
+ {
33
+ public function __construct()
34
+ {
35
+ $this->_controller = 'adminhtml_report';
36
+ $this->_blockGroup = 'laybuy';
37
+ $this->_headerText = Mage::helper('laybuy')->__('Lay-Buy Instalment Reports');
38
+ parent::__construct();
39
+ $this->_removeButton('add');
40
+ $message = Mage::helper('laybuy')->__('Connecting to Lay-Buy server to fetch transaction updates. Are you sure you want to proceed?');
41
+ $this->_addButton('fetch', array(
42
+ 'label' => Mage::helper('laybuy')->__('Fetch Updates'),
43
+ 'onclick' => "confirmSetLocation('{$message}', '{$this->getUrl('*/*/fetch')}')",
44
+ 'class' => 'task'
45
+ ));
46
+ }
47
+ }
app/code/local/Ced/LayBuy/Block/Adminhtml/Report/Details.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Lay-Buys
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * 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@magentocommerce.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.magentocommerce.com for more information.
20
+ *
21
+ * @category Ced
22
+ * @package Ced_LayBuy
23
+ * @author Asheesh Singh<asheeshsingh@cedcoss.com>
24
+ * @copyright Copyright LAY-BUYS (2011). (http://lay-buys.com/)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ /**
29
+ * Settlement reports transaction details
30
+ *
31
+ * @category Ced
32
+ * @package Ced_LayBuy
33
+ * @author Asheesh Singh<asheeshsingh@cedcoss.com>
34
+ */
35
+ class Ced_LayBuy_Block_Adminhtml_Report_Details extends Mage_Adminhtml_Block_Widget_Form_Container
36
+ {
37
+ /**
38
+ * Block construction
39
+ * Initialize titles, buttons
40
+ */
41
+ public function __construct()
42
+ {
43
+ parent::__construct();
44
+ $this->_controller = '';
45
+ $this->_headerText = Mage::helper('laybuy')->__('View Transaction Details');
46
+ $this->_removeButton('reset')
47
+ ->_removeButton('delete')
48
+ ->_removeButton('save');
49
+ $message = Mage::helper('laybuy')->__("Are you sure to cancel this transaction? Because it will cancel the buyer order and recurring profile");
50
+ $model = Mage::registry('current_laybuy_transaction');
51
+ if($model->getStatus()!=-1 && $model->getStatus()!=-2 && $model->getStatus()!=2){
52
+ $this->_addButton('delete', array(
53
+
54
+ 'label' => Mage::helper('laybuy')->__('Cancel Transaction'),
55
+
56
+ 'onclick' => "confirmSetLocation('{$message}', '{$this->getUrl('*/*/cancel',array('id'=>$this->getRequest()->getParam('id')))}')",
57
+
58
+ 'class' => 'delete',
59
+ ));
60
+
61
+ $this->_addButton('edit', array(
62
+
63
+ 'label' => Mage::helper('laybuy')->__('Revise Instalment Plan'),
64
+
65
+ 'onclick' => "setLocation('{$this->getUrl('*/*/edit',array('id'=>$this->getRequest()->getParam('id')))}')",
66
+
67
+ 'class' => 'add',
68
+ ));
69
+ }
70
+ }
71
+
72
+ /**
73
+ * Initialize form
74
+ * @return Mage_LayBuy_Block_Adminhtml_Settlement_Details
75
+ */
76
+ protected function _prepareLayout()
77
+ {
78
+ parent::_prepareLayout();
79
+ $this->setChild('form', $this->getLayout()->createBlock('laybuy/adminhtml_report_details_form'));
80
+ return $this;
81
+ }
82
+ }
app/code/local/Ced/LayBuy/Block/Adminhtml/Report/Details/Form.php ADDED
@@ -0,0 +1,211 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Lay-Buys
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * 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@magentocommerce.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.magentocommerce.com for more information.
20
+ *
21
+ * @category Ced
22
+ * @package Ced_LayBuy
23
+ * @author Asheesh Singh<asheeshsingh@cedcoss.com>
24
+ * @copyright Copyright LAY-BUYS (2011). (http://lay-buys.com/)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ /**
29
+ * Settlement reports transaction details
30
+ *
31
+ * @category Ced
32
+ * @package Ced_LayBuy
33
+ * @author Asheesh Singh<asheeshsingh@cedcoss.com>
34
+ */
35
+ class Ced_LayBuy_Block_Adminhtml_Report_Details_Form extends Mage_Adminhtml_Block_Widget_Form
36
+ {
37
+ /**
38
+ * Prepare read-only data and group it by fieldsets
39
+ * @return Mage_Paypal_Block_Adminhtml_Settlement_Details_Form
40
+ */
41
+ protected function _prepareForm()
42
+ {
43
+ $model = Mage::registry('current_laybuy_transaction');
44
+ /* print_r($model->getData());die; */
45
+ /* @var $model Mage_Paypal_Model_Report_Settlement_Row */
46
+ $settlement = Mage::getSingleton('laybuy/report');
47
+ /* @var $settlement Mage_Paypal_Model_Report_Settlement */
48
+ $statuses = Mage::helper('laybuy')->getStatuses();
49
+ $status = $statuses[$model->getData('status')];
50
+ $fieldsets = array(
51
+ 'reference_fieldset' => array(
52
+ 'fields' => array(
53
+ 'paypal_profile_id' => array('label' => $settlement->getFieldLabel('paypal_profile_id'),'type' => 'label',),
54
+ 'laybuy_ref_no' => array('label' => $settlement->getFieldLabel('laybuy_ref_no'),'type' => 'label',),
55
+ 'order_id' => array('label' => $settlement->getFieldLabel('order_id'),'type' => 'label',),
56
+
57
+ ),
58
+ 'legend' => Mage::helper('laybuy')->__('Reference Information')
59
+ ),
60
+
61
+ 'transaction_fieldset' => array(
62
+ 'fields' => array(
63
+ 'status' => array(
64
+ 'label' => $settlement->getFieldLabel('status'),
65
+ 'value' => $status,
66
+ 'type' => 'label',
67
+ ),
68
+ 'amount' => array(
69
+ 'label' => $settlement->getFieldLabel('amount'),
70
+ 'value' => Mage::app()->getLocale()
71
+ ->currency($model->getData('currency'))
72
+ ->toCurrency($model->getData('amount')),
73
+ 'type' => 'label',
74
+ ),
75
+ 'downpayment' => array(
76
+ 'label' => $settlement->getFieldLabel('downpayment'),
77
+ 'value' =>$model->getData('downpayment'),
78
+ 'type' => 'label',
79
+ ),
80
+ 'months' => array(
81
+ 'label' => $settlement->getFieldLabel('months'),
82
+ 'value' => $model->getData('months'),
83
+ 'type' => 'label',
84
+ ),
85
+ 'downpayment_amount' => array(
86
+ 'label' => $settlement->getFieldLabel('downpayment_amount'),
87
+ 'value' => Mage::app()->getLocale()
88
+ ->currency($model->getData('currency'))
89
+ ->toCurrency($model->getData('downpayment_amount')),
90
+ 'type' => 'label',
91
+ ),
92
+ 'payment_amounts' => array(
93
+ 'label' => $settlement->getFieldLabel('payment_amounts'),
94
+ 'value' => Mage::app()->getLocale()
95
+ ->currency($model->getData('currency'))
96
+ ->toCurrency($model->getData('payment_amounts')),
97
+ 'type' => 'label',
98
+ ),
99
+ 'first_payment_due' => array(
100
+ 'label' => $settlement->getFieldLabel('first_payment_due'),
101
+ 'value' => $this->helper('core')->formatDate($model->getData('first_payment_due'), Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM, true),
102
+ 'type' => 'label',
103
+ ),
104
+ 'last_payment_due' => array(
105
+ 'label' => $settlement->getFieldLabel('last_payment_due'),
106
+ 'value' => $this->helper('core')->formatDate($model->getData('last_payment_due'), Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM, true),
107
+ 'type' => 'label',
108
+ ),
109
+ 'report' => array(
110
+ 'label' => $settlement->getFieldLabel('report'),
111
+ 'value' => '',
112
+ 'type' => 'label',
113
+ 'after_element_html' => $model->getData('report'),
114
+ ),
115
+
116
+
117
+ ),
118
+ 'legend' => Mage::helper('laybuy')->__('Payment Plan')
119
+ ),
120
+
121
+ 'customer_fieldset' => array(
122
+ 'fields' => array(
123
+ 'firstname' => array(
124
+ 'label' => $settlement->getFieldLabel('firstname'),
125
+ 'value' => $model->getData('firstname'),
126
+ 'type' => 'label',
127
+ ),
128
+ 'lastname' => array(
129
+ 'label' => $settlement->getFieldLabel('lastname'),
130
+ 'value' => $model->getData('lastname'),
131
+ 'type' => 'label',
132
+ ),
133
+ 'email' => array(
134
+ 'label' => $settlement->getFieldLabel('email'),
135
+ 'value' => $model->getData('email'),
136
+ 'type' => 'link',
137
+ 'href' => 'mailto:'.$model->getData('email'),
138
+ ),
139
+ 'address' => array(
140
+ 'label' => $settlement->getFieldLabel('address'),
141
+ 'value' => $model->getData('address'),
142
+ 'type' => 'label',
143
+ ),
144
+ 'suburb' => array(
145
+ 'label' => $settlement->getFieldLabel('suburb'),
146
+ 'value' => $model->getData('suburb'),
147
+ 'type' => 'label',
148
+ ),
149
+ 'state' => array(
150
+ 'label' => $settlement->getFieldLabel('state'),
151
+ 'value' => $model->getData('state'),
152
+ 'type' => 'label',
153
+ ),
154
+ 'country' => array(
155
+ 'label' => $settlement->getFieldLabel('country'),
156
+ 'value' => $model->getData('country'),
157
+ 'type' => 'label',
158
+ ),
159
+ 'postcode' => array(
160
+ 'label' => $settlement->getFieldLabel('postcode'),
161
+ 'value' => $model->getData('postcode'),
162
+ 'type' => 'label',
163
+ ),
164
+ ),
165
+ 'legend' => Mage::helper('laybuy')->__('Customer Information')
166
+ ),
167
+ /* 'fee_fieldset' => array(
168
+ 'fields' => array(
169
+ 'fee_debit_or_credit' => array(
170
+ 'label' => $settlement->getFieldLabel('fee_debit_or_credit'),
171
+ 'value' => $model->getDebitCreditText($model->getData('fee_debit_or_credit'))
172
+ ),
173
+ 'fee_amount' => array(
174
+ 'label' => $settlement->getFieldLabel('fee_amount'),
175
+ 'value' => Mage::app()->getLocale()
176
+ ->currency($model->getData('fee_currency'))
177
+ ->toCurrency($model->getData('fee_amount'))
178
+ ),
179
+ ),
180
+ 'legend' => Mage::helper('laybuy')->__('Lay-Buy Fee Information')
181
+ ), */
182
+ );
183
+
184
+ $form = new Varien_Data_Form();
185
+ foreach ($fieldsets as $key => $data) {
186
+ $fieldset = $form->addFieldset($key, array('legend' => $data['legend']));
187
+ foreach ($data['fields'] as $id => $info) {
188
+ if($info['type']=='link'){
189
+ $fieldset->addField($id, $info['type'], array(
190
+ 'name' => $id,
191
+ 'label' => $info['label'],
192
+ 'title' => $info['label'],
193
+ 'href' => $info['href'],
194
+ 'value' => isset($info['value']) ? $info['value'] : $model->getData($id),
195
+ 'after_element_html' => isset($info['after_element_html']) ? $info['after_element_html'] : '',
196
+ ));
197
+ }else{
198
+ $fieldset->addField($id, $info['type'], array(
199
+ 'name' => $id,
200
+ 'label' => $info['label'],
201
+ 'title' => $info['label'],
202
+ 'value' => isset($info['value']) ? $info['value'] : $model->getData($id),
203
+ 'after_element_html' => isset($info['after_element_html']) ? $info['after_element_html'] : '',
204
+ ));
205
+ }
206
+ }
207
+ }
208
+ $this->setForm($form);
209
+ return parent::_prepareForm();
210
+ }
211
+ }
app/code/local/Ced/LayBuy/Block/Adminhtml/Report/Edit.php ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Lay-Buys
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * 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@magentocommerce.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.magentocommerce.com for more information.
20
+ *
21
+ * @category Ced
22
+ * @package Ced_LayBuy
23
+ * @author Asheesh Singh<asheeshsingh@cedcoss.com>
24
+ * @copyright Copyright LAY-BUYS (2011). (http://lay-buys.com/)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ /**
29
+ * Revise Instalment Plan
30
+ *
31
+ * @category Ced
32
+ * @package Ced_LayBuy
33
+ * @author Asheesh Singh<asheeshsingh@cedcoss.com>
34
+ */
35
+ class Ced_LayBuy_Block_Adminhtml_Report_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
36
+ {
37
+ /**
38
+ * Block construction
39
+ * Initialize titles, buttons
40
+ */
41
+ public function __construct()
42
+ {
43
+ parent::__construct();
44
+ $this->_controller = '';
45
+ $this->_headerText = Mage::helper('laybuy')->__('Edit Transaction Details');
46
+ $this->_removeButton('delete')
47
+ ->_removeButton('back')
48
+ ->_removeButton('save');
49
+ $message = Mage::helper('laybuy')->__('Are you sure to cancel this transaction?');
50
+ $model = Mage::registry('current_laybuy_transaction_edit');
51
+ $this->_addButton('back', array(
52
+
53
+ 'label' => Mage::helper('laybuy')->__('Back'),
54
+
55
+ 'onclick' => "setLocation('{$this->getUrl('*/*/details',array('id'=>$this->getRequest()->getParam('id')))}')",
56
+
57
+ 'class' => 'back',
58
+ ));
59
+ $this->_addButton('save', array(
60
+
61
+ 'label' => Mage::helper('laybuy')->__('Save and Send Email to Buyer'),
62
+
63
+ 'onclick' => "editForm.submit()",
64
+
65
+ 'class' => 'save',
66
+ ));
67
+ }
68
+
69
+ /**
70
+ * Initialize form
71
+ * @return Mage_LayBuy_Block_Adminhtml_Settlement_Details
72
+ */
73
+ protected function _prepareLayout()
74
+ {
75
+ parent::_prepareLayout();
76
+ $this->setChild('form', $this->getLayout()->createBlock('laybuy/adminhtml_report_edit_form'));
77
+ return $this;
78
+ }
79
+ }
app/code/local/Ced/LayBuy/Block/Adminhtml/Report/Edit/Form.php ADDED
@@ -0,0 +1,348 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Lay-Buys
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * 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@magentocommerce.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.magentocommerce.com for more information.
20
+ *
21
+ * @category Ced
22
+ * @package Ced_LayBuy
23
+ * @author Asheesh Singh<asheeshsingh@cedcoss.com>
24
+ * @copyright Copyright LAY-BUYS (2011). (http://lay-buys.com/)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ /**
29
+ * Revise Instalment Plan Form
30
+ *
31
+ * @category Ced
32
+ * @package Ced_LayBuy
33
+ * @author Asheesh Singh<asheeshsingh@cedcoss.com>
34
+ */
35
+ class Ced_LayBuy_Block_Adminhtml_Report_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
36
+ {
37
+ /**
38
+ * Prepare read-only data and group it by fieldsets
39
+ * @return Mage_Paypal_Block_Adminhtml_Settlement_Details_Form
40
+ */
41
+ protected function _prepareForm()
42
+ {
43
+ $calcUrl = $this->getUrl('*/*/docalc');/*'http://lay-buys.com/gateway/docalc.php'*/;
44
+ $model = Mage::registry('current_laybuy_transaction_edit');
45
+ /* print_r($model->getData());die; */
46
+ /* @var $model Mage_Paypal_Model_Report_Settlement_Row */
47
+ $settlement = Mage::getSingleton('laybuy/report');
48
+ /* @var $settlement Mage_Paypal_Model_Report_Settlement */
49
+ $order_id = $model->getData('order_id');
50
+ $order = Mage::getModel('sales/order')->loadByIncrementId($order_id);
51
+ $storeId = $order->getStoreId();
52
+ $newAmount = $model->getData('amount') - ($model->getData('downpayment_amount') + (((int)$model->getTransaction() - 2) * $model->getData('payment_amounts')));
53
+ $fieldsets = array(
54
+ 'reference_fieldset' => array(
55
+ 'fields' => array(
56
+ 'mid' => array(
57
+ 'label' => $settlement->getFieldLabel('mid'),
58
+ 'type' => 'hidden',
59
+ 'value' => Mage::getStoreConfig('payment/laybuy/membership_number',$storeId),
60
+ ),
61
+ 'paypal_profile_id' => array(
62
+ 'label' => $settlement->getFieldLabel('paypal_profile_id'),
63
+ 'type' => 'text',
64
+ 'readonly' => true,
65
+ 'after_element_html' => '<p class="note"><span>Readonly attribute</span></p>',
66
+ ),
67
+ 'laybuy_ref_no' => array(
68
+ 'label' => $settlement->getFieldLabel('laybuy_ref_no'),
69
+ 'type' => 'text',
70
+ 'readonly' => true,
71
+ 'after_element_html' => '<p class="note"><span>Readonly attribute</span></p>',
72
+ ),
73
+ 'order_id' => array(
74
+ 'label' => $settlement->getFieldLabel('order_id'),
75
+ 'type' => 'text',
76
+ 'readonly' => true,
77
+ 'after_element_html' => '<p class="note"><span>Readonly attribute</span></p>',
78
+ ),
79
+
80
+ ),
81
+ 'legend' => Mage::helper('laybuy')->__('Reference Information')
82
+ ),
83
+
84
+ 'transaction_fieldset' => array(
85
+ 'fields' => array(
86
+ 'amount' => array(
87
+ 'label' => $settlement->getFieldLabel('total_amount'),
88
+ 'value' => number_format($newAmount,2,'.',','),
89
+ 'type' => 'hidden',
90
+ ),
91
+ 'pending_amount' => array(
92
+ 'label' => $settlement->getFieldLabel('total_amount'),
93
+ 'value' => Mage::app()->getLocale()
94
+ ->currency($model->getData('currency'))
95
+ ->toCurrency($newAmount),
96
+ 'type' => 'label',
97
+ ),
98
+ 'lay-buy' => array(
99
+ 'label' => $settlement->getFieldLabel('Payment Type:'),
100
+ 'value' => 1,
101
+ 'type' => 'radio',
102
+ 'onclick'=> 'methodChange(1)',
103
+ 'checked' => 'checked',
104
+ 'after_element_html' => '<label for="lay-buy" class="inline">Lay-Buy</label>',
105
+ ),
106
+ 'buy-now' => array(
107
+ 'label' => $settlement->getFieldLabel(''),
108
+ 'value' => 0,
109
+ 'type' => 'radio',
110
+ 'onclick'=> 'methodChange(0)',
111
+ 'after_element_html' => '<label for="buy-now" class="inline">Buy-Now</label>',
112
+ ),
113
+ /* 'pp1' => array(
114
+ 'label' => $settlement->getFieldLabel(''),
115
+ 'value' => 1,
116
+ 'type' => 'radios',
117
+ 'onchange'=> 'methodChange()',
118
+ 'values' => array(
119
+ array('value'=>0,'label'=>'Buy-Now'),
120
+ array('value'=>1,'label'=>'Lay-Buy'),
121
+ ),
122
+ ), */
123
+ 'pp' => array(
124
+ 'label' => $settlement->getFieldLabel(''),
125
+ 'value' => 1,
126
+ 'type' => 'hidden',
127
+ ),
128
+ 'pplan' => array(
129
+ 'label' => $settlement->getFieldLabel(''),
130
+ 'value' => 1,
131
+ 'type' => 'hidden',
132
+ ),
133
+ 'currency' => array(
134
+ 'label' => $settlement->getFieldLabel('currency'),
135
+ 'value' =>$model->getData('currency'),
136
+ 'type' => 'hidden',
137
+ ),
138
+ 'dp_amount' => array(
139
+ 'label' => $settlement->getFieldLabel('dp_amount'),
140
+ 'value' => $model->getData('downpayment'),
141
+ 'type' => 'select',
142
+ 'dy' => 1,
143
+ 'onchange' => 'rcalc()',
144
+ 'values' => $settlement->getArray('dp_amount',$newAmount,$storeId),
145
+ ),
146
+ 'months' => array(
147
+ 'label' => $settlement->getFieldLabel('months_to_pay'),
148
+ 'value' => $model->getData('months'),
149
+ 'type' => 'select',
150
+ 'onchange' => 'rcalc()',
151
+ 'values' => $settlement->getArray('months',$newAmount,$storeId),
152
+ ),
153
+ 'preview' => array(
154
+ 'label' => $settlement->getFieldLabel('preview'),
155
+ 'value' => '',
156
+ 'type' => 'label',
157
+ 'after_element_html' => '<iframe name="preview-tbl" id="preview-tbl" style="width:171%; height:157px; border:0; margin:0; overflow:hidden" marginheight="0" marginwidth="0" noscroll></iframe>',
158
+ ),
159
+
160
+ 'firstname' => array(
161
+ 'label' => $settlement->getFieldLabel('firstname'),
162
+ 'value' => $model->getData('firstname'),
163
+ 'type' => 'hidden',
164
+ ),
165
+ 'lastname' => array(
166
+ 'label' => $settlement->getFieldLabel('lastname'),
167
+ 'value' => $model->getData('lastname'),
168
+ 'type' => 'hidden',
169
+ ),
170
+ 'email' => array(
171
+ 'label' => $settlement->getFieldLabel('email'),
172
+ 'value' => $model->getData('email'),
173
+ 'type' => 'text',
174
+ 'readonly' => true,
175
+ 'after_element_html' => '<p class="note"><span>Readonly attribute.</span></p>',
176
+ ),
177
+ 'address' => array(
178
+ 'label' => $settlement->getFieldLabel('address'),
179
+ 'value' => $model->getData('address'),
180
+ 'type' => 'hidden',
181
+ ),
182
+ 'suburb' => array(
183
+ 'label' => $settlement->getFieldLabel('suburb'),
184
+ 'value' => $model->getData('suburb'),
185
+ 'type' => 'hidden',
186
+ ),
187
+ 'state' => array(
188
+ 'label' => $settlement->getFieldLabel('state'),
189
+ 'value' => $model->getData('state'),
190
+ 'type' => 'hidden',
191
+ ),
192
+ 'country' => array(
193
+ 'label' => $settlement->getFieldLabel('country'),
194
+ 'value' => $model->getData('country'),
195
+ 'type' => 'hidden',
196
+ ),
197
+ 'postcode' => array(
198
+ 'label' => $settlement->getFieldLabel('postcode'),
199
+ 'value' => $model->getData('postcode'),
200
+ 'type' => 'hidden',
201
+ ),
202
+ 'downpayment_amount' => array(
203
+ 'label' => $settlement->getFieldLabel('downpayment_amount'),
204
+ 'value' => Mage::app()->getLocale()
205
+ ->currency($model->getData('currency'))
206
+ ->toCurrency($model->getData('downpayment_amount')),
207
+ 'type' => 'hidden',
208
+ ),
209
+ 'payment_amounts' => array(
210
+ 'label' => $settlement->getFieldLabel('payment_amounts'),
211
+ 'value' => Mage::app()->getLocale()
212
+ ->currency($model->getData('currency'))
213
+ ->toCurrency($model->getData('payment_amounts')),
214
+ 'type' => 'hidden',
215
+ ),
216
+ 'first_payment_due' => array(
217
+ 'label' => $settlement->getFieldLabel('first_payment_due'),
218
+ 'value' => $this->helper('core')->formatDate($model->getData('first_payment_due'), Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM, true),
219
+ 'type' => 'hidden',
220
+ ),
221
+ 'last_payment_due' => array(
222
+ 'label' => $settlement->getFieldLabel('last_payment_due'),
223
+ 'value' => $this->helper('core')->formatDate($model->getData('last_payment_due'), Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM, true),
224
+ 'type' => 'hidden',
225
+ ),
226
+ 'report' => array(
227
+ 'label' => $settlement->getFieldLabel('report'),
228
+ 'value' => 'New Description',
229
+ 'type' => 'hidden',
230
+ ),
231
+
232
+ ),
233
+ 'legend' => Mage::helper('laybuy')->__("Please Choose Buyer's New Payment Plan"),
234
+ ),
235
+ );
236
+
237
+ $form = new Varien_Data_Form();
238
+ $submitUrl = $this->getUrl('*/*/save',array('id'=>$this->getRequest()->getParam('id')));
239
+ $form->setAction($submitUrl)
240
+ ->setId('edit_form')
241
+ ->setName('laybuy_revise_plan')
242
+ ->setMethod('POST')
243
+ ->setUseContainer(true);
244
+ foreach ($fieldsets as $key => $data) {
245
+ $fieldset = $form->addFieldset($key, array('legend' => $data['legend']));
246
+ foreach ($data['fields'] as $id => $info) {
247
+ if($info['type']=='link'){
248
+ $id = $fieldset->addField($id, $info['type'], array(
249
+ 'name' => $id,
250
+ 'label' => $info['label'],
251
+ 'title' => $info['label'],
252
+ 'href' => $info['href'],
253
+ 'value' => isset($info['value']) ? $info['value'] : $model->getData($id),
254
+ 'after_element_html' => isset($info['after_element_html']) ? $info['after_element_html'] : '',
255
+ 'readonly' => isset($info['readonly'])?$info['readonly']:false,
256
+ isset($info['values'])?'values':'' => isset($info['values'])?$info['values']:'',
257
+ isset($info['onchange'])?'onchange':'' => isset($info['onchange'])?$info['onchange']:'',
258
+ isset($info['onclick'])?'onclick':'' => isset($info['onclick'])?$info['onclick']:'',
259
+ isset($info['checked'])?'checked':'' => isset($info['checked'])?$info['checked']:'',
260
+
261
+ ));
262
+ }else{
263
+ $id = $fieldset->addField($id, $info['type'], array(
264
+ 'name' => $id,
265
+ 'label' => $info['label'],
266
+ 'title' => $info['label'],
267
+ 'value' => isset($info['value']) ? $info['value'] : $model->getData($id),
268
+ 'after_element_html' => isset($info['after_element_html']) ? $info['after_element_html'] : '',
269
+ isset($info['readonly'])?'readonly':'' => isset($info['readonly'])?$info['readonly']:false,
270
+ isset($info['values'])?'values':'' => isset($info['values'])?$info['values']:'',
271
+ isset($info['onchange'])?'onchange':'' => isset($info['onchange'])?$info['onchange']:'',
272
+ isset($info['onclick'])?'onclick':'' => isset($info['onclick'])?$info['onclick']:'',
273
+ isset($info['checked'])?'checked':'' => isset($info['checked'])?$info['checked']:'',
274
+ ));
275
+
276
+ }
277
+ if(isset($info['dy']) && isset($info['onchange']) && $function = $info['onchange']){
278
+ $id->setAfterElementHtml(
279
+ '<script type="text/javascript">
280
+ function '.$function.'{
281
+ document.getElementById("lay-buy").checked = true;
282
+ document.getElementById("loading-mask").show();
283
+ var f = document.getElementById("preview-tbl");
284
+ f.src = "'.$calcUrl.'?currency="+document.laybuy_revise_plan.currency.value+"&amt="+document.laybuy_revise_plan.amount.value+"&init="+document.laybuy_revise_plan.dp_amount.value+"&mnth="+document.laybuy_revise_plan.months.value+"&rnd="+Math.random()+"&html=1";
285
+
286
+ data = "'.$calcUrl.'?currency="+document.laybuy_revise_plan.currency.value+"&amt="+document.laybuy_revise_plan.amount.value+"&init="+document.laybuy_revise_plan.dp_amount.value+"&mnth="+document.laybuy_revise_plan.months.value+"&rnd="+Math.random();
287
+ loadXMLDoc(data);
288
+ }
289
+ setTimeout("'.$function.';",200);
290
+ function loadXMLDoc(url)
291
+ {
292
+ var xmlhttp;
293
+ if (window.XMLHttpRequest)
294
+ {// code for IE7+, Firefox, Chrome, Opera, Safari
295
+ xmlhttp=new XMLHttpRequest();
296
+ }
297
+ else
298
+ {// code for IE6, IE5
299
+ xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
300
+ }
301
+ xmlhttp.onreadystatechange=function()
302
+ {
303
+ if (xmlhttp.readyState==4 && xmlhttp.status==200)
304
+ {
305
+ data = xmlhttp.responseText;
306
+ data = data.split("~");
307
+ document.getElementById("downpayment_amount").value= data[0];
308
+ document.getElementById("payment_amounts").value = data[1];
309
+ document.getElementById("first_payment_due").value = data[2];
310
+ document.getElementById("last_payment_due").value = data[3];
311
+ document.getElementById("report").value= data[4];
312
+ document.getElementById("loading-mask").hide();
313
+ }
314
+ }
315
+ xmlhttp.open("GET",url,true);
316
+ xmlhttp.send();
317
+ }
318
+ function methodChange(value){
319
+ /* alert(value); */
320
+ document.getElementById("pp").value = value;
321
+ document.getElementById("pplan").value = value;
322
+ if(value){
323
+ document.getElementById("buy-now").checked = false;
324
+ document.getElementById("preview-tbl").parentNode.parentNode.show();
325
+ document.getElementById("dp_amount").parentNode.parentNode.show();
326
+ document.getElementById("months").parentNode.parentNode.show();
327
+ document.getElementById("preview-tbl").parentNode.show();
328
+ document.getElementById("dp_amount").parentNode.show();
329
+ document.getElementById("months").parentNode.show();
330
+ }else{
331
+ document.getElementById("lay-buy").checked = false;
332
+ document.getElementById("preview-tbl").parentNode.parentNode.hide();
333
+ document.getElementById("dp_amount").parentNode.parentNode.hide();
334
+ document.getElementById("months").parentNode.parentNode.hide();
335
+ document.getElementById("preview-tbl").parentNode.hide();
336
+ document.getElementById("dp_amount").parentNode.hide();
337
+ document.getElementById("months").parentNode.hide();
338
+ }
339
+ }
340
+ </script>'
341
+ );
342
+ }
343
+ }
344
+ }
345
+ $this->setForm($form);
346
+ return parent::_prepareForm();
347
+ }
348
+ }
app/code/local/Ced/LayBuy/Block/Adminhtml/Report/Grid.php ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Lay-Buys
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * 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@magentocommerce.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.magentocommerce.com for more information.
20
+ *
21
+ * @category Ced
22
+ * @package Ced_LayBuy
23
+ * @author Asheesh Singh<asheeshsingh@cedcoss.com>
24
+ * @copyright Copyright LAY-BUYS (2011). (http://lay-buys.com/)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ /**
29
+ * Block for LayBuy report grid
30
+ */
31
+ class Ced_LayBuy_Block_Adminhtml_Report_Grid extends Mage_Adminhtml_Block_Widget_Grid
32
+ {
33
+ public function __construct()
34
+ {
35
+
36
+ parent::__construct();
37
+ $this->setId('laybuyReportGrid');
38
+ $this->setDefaultSort('created_at');
39
+ $this->setDefaultDir('DESC');
40
+ $this->setSaveParametersInSession(true);
41
+ }
42
+
43
+ protected function _prepareCollection()
44
+ {
45
+ $collection = Mage::getModel('laybuy/report')->getCollection();
46
+
47
+ $this->setCollection($collection);
48
+ return parent::_prepareCollection();
49
+ }
50
+
51
+ protected function _getStore()
52
+ {
53
+ $storeId = (int) $this->getRequest()->getParam('store', 0);
54
+ return Mage::app()->getStore($storeId);
55
+ }
56
+
57
+ protected function _prepareColumns()
58
+ {
59
+ $this->addColumn('created_at', array(
60
+ 'header' => Mage::helper('laybuy')->__('Created At'),
61
+ 'align' => 'left',
62
+ 'filter_index' => 'created_at',
63
+ 'index' => 'created_at',
64
+ 'type' => 'datetime',
65
+ ));
66
+
67
+ $this->addColumn('order_id', array(
68
+ 'header' => Mage::helper('laybuy')->__('Order#'),
69
+ 'align' => 'right',
70
+ 'filter_index' => 'order_id',
71
+ 'index' => 'order_id',
72
+ 'type' => 'number',
73
+ 'renderer' => 'Ced_LayBuy_Block_Adminhtml_Report_Renderer_Order',
74
+ ));
75
+
76
+ $store = $this->_getStore();
77
+ $this->addColumn('amount', array(
78
+ 'header' => Mage::helper('laybuy')->__('Amount'),
79
+ 'align' => 'left',
80
+ 'filter_index' => 'amount',
81
+ 'index' => 'amount',
82
+ 'type' => 'price',
83
+ 'currency_code' => $store->getBaseCurrency()->getCode(),
84
+ ));
85
+
86
+ $this->addColumn('downpayment', array(
87
+ 'header' => Mage::helper('laybuy')->__('Down Payment %'),
88
+ 'align' => 'right',
89
+ 'filter_index' => 'downpayment',
90
+ 'index' => 'downpayment',
91
+ 'type' => 'range',
92
+ ));
93
+
94
+ $this->addColumn('months', array(
95
+ 'header' => Mage::helper('laybuy')->__('Months'),
96
+ 'align' => 'left',
97
+ 'filter_index' => 'months',
98
+ 'index' => 'months',
99
+ 'type' => 'range',
100
+ ));
101
+
102
+ $this->addColumn('downpayment_amount', array(
103
+ 'header' => Mage::helper('laybuy')->__('Down Payment Amount'),
104
+ 'align' => 'right',
105
+ 'filter_index' => 'downpayment_amount',
106
+ 'index' => 'downpayment_amount',
107
+ 'type' => 'price',
108
+ 'currency_code' => $store->getBaseCurrency()->getCode(),
109
+ ));
110
+
111
+ $this->addColumn('payment_amounts', array(
112
+ 'header' => Mage::helper('laybuy')->__('Payment Amounts'),
113
+ 'align' => 'left',
114
+ 'filter_index' => 'payment_amounts',
115
+ 'index' => 'payment_amounts',
116
+ 'type' => 'price',
117
+ 'currency_code' => $store->getBaseCurrency()->getCode(),
118
+ ));
119
+
120
+ $this->addColumn('first_payment_due', array(
121
+ 'header' => Mage::helper('laybuy')->__('First Payment Due'),
122
+ 'align' => 'right',
123
+ 'filter_index' => 'first_payment_due',
124
+ 'index' => 'first_payment_due',
125
+ 'type' => 'datetime',
126
+ ));
127
+
128
+ $this->addColumn('last_payment_due', array(
129
+ 'header' => Mage::helper('laybuy')->__('Last Payment Due'),
130
+ 'align' => 'left',
131
+ 'filter_index' => 'last_payment_due',
132
+ 'index' => 'last_payment_due',
133
+ 'type' => 'datetime',
134
+ ));
135
+
136
+ /* $this->addColumn('email', array(
137
+ 'header' => Mage::helper('laybuy')->__('Email'),
138
+ 'align' => 'right',
139
+ 'width' => '75',
140
+ 'filter_index' => 'email',
141
+ 'index' => 'email',
142
+ 'type' => 'text',
143
+ 'renderer' => 'Ced_LayBuy_Block_Adminhtml_Report_Renderer_Email',
144
+ )); */
145
+ /* $this->addColumn('report', array(
146
+ $this->addColumn('status', array(
147
+ 'header' => Mage::helper('laybuy')->__('Status'),
148
+ 'align' => 'right',
149
+ 'filter_index' => 'status',
150
+ 'index' => 'status',
151
+ 'type' => 'options',
152
+ 'options' => Mage::helper('laybuy')->getStatuses(),
153
+ ));
154
+
155
+ $this->addExportType('*/*/exportCsv', Mage::helper('laybuy')->__('CSV'));
156
+ $this->addExportType('*/*/exportXml', Mage::helper('laybuy')->__('XML'));
157
+
158
+ return parent::_prepareColumns();
159
+ }
160
+
161
+ public function getRowUrl($row)
162
+ {
163
+ return $this->getUrl('*/*/details', array('id' => $row->getId()));
164
+ }
165
+ }
app/code/local/Ced/LayBuy/Block/Adminhtml/Report/Renderer/Email.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Lay-Buys
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * 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@magentocommerce.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.magentocommerce.com for more information.
20
+ *
21
+ * @category Ced
22
+ * @package Ced_LayBuy
23
+ * @author Asheesh Singh<asheeshsingh@cedcoss.com>
24
+ * @copyright Copyright LAY-BUYS (2011). (http://lay-buys.com/)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ /**
29
+ * Block for LayBuy report grid renderer
30
+ */
31
+ class Ced_LayBuy_Block_Adminhtml_Report_Renderer_Email extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
32
+ {
33
+ public function render(Varien_Object $row)
34
+ {
35
+ $email=$row->getEmail();
36
+ return '<a title="'.$email.'" href="mailto:'.$email.'">'.$email.'</a>';
37
+
38
+ }
39
+ }
app/code/local/Ced/LayBuy/Block/Adminhtml/Report/Renderer/Order.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Lay-Buys
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * 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@magentocommerce.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.magentocommerce.com for more information.
20
+ *
21
+ * @category Ced
22
+ * @package Ced_LayBuy
23
+ * @author Asheesh Singh<asheeshsingh@cedcoss.com>
24
+ * @copyright Copyright LAY-BUYS (2011). (http://lay-buys.com/)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ /**
29
+ * Block for LayBuy report grid renderer
30
+ */
31
+ class Ced_LayBuy_Block_Adminhtml_Report_Renderer_Order extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
32
+ {
33
+ public function render(Varien_Object $row)
34
+ {
35
+ $orderId=$row->getOrderId();
36
+ $order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
37
+ if($order && $order->getId()){
38
+ $orderUrl = Mage::helper('adminhtml')->getUrl('adminhtml/sales_order/view',array('order_id'=>$order->getId()));
39
+ return '<a title="'.$orderUrl.'" href="'.$orderUrl.'">'.$orderId.'</a>';
40
+ }else{
41
+ return $orderId;
42
+ }
43
+
44
+ }
45
+ }
app/code/local/Ced/LayBuy/Block/Adminhtml/Report/Renderer/Record.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+
5
+ * Lay-Buys
6
+
7
+ *
8
+
9
+ * NOTICE OF LICENSE
10
+
11
+ *
12
+
13
+ * This source file is subject to the Open Software License (OSL 3.0)
14
+
15
+ * that is bundled with this package in the file LICENSE.txt.
16
+
17
+ * It is also available through the world-wide-web at this URL:
18
+
19
+ * http://opensource.org/licenses/osl-3.0.php
20
+
21
+ * If you did not receive a copy of the license and are unable to
22
+
23
+ * obtain it through the world-wide-web, please send an email
24
+
25
+ * to license@magentocommerce.com so we can send you a copy immediately.
26
+
27
+ *
28
+
29
+ * DISCLAIMER
30
+
31
+ *
32
+
33
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
34
+
35
+ * versions in the future. If you wish to customize Magento for your
36
+
37
+ * needs please refer to http://www.magentocommerce.com for more information.
38
+
39
+ *
40
+
41
+ * @category Ced
42
+
43
+ * @package Ced_LayBuy
44
+
45
+ * @author Asheesh Singh<asheeshsingh@cedcoss.com>
46
+
47
+ * @copyright Copyright LAY-BUYS (2011). (http://lay-buys.com/)
48
+
49
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
50
+
51
+ */
52
+
53
+
54
+
55
+ /**
56
+
57
+ * Block for LayBuy report grid renderer
58
+
59
+ */
60
+
61
+ class Ced_LayBuy_Block_Adminhtml_Report_Renderer_Record extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
62
+
63
+ {
64
+
65
+ public function render(Varien_Object $row)
66
+
67
+ {
68
+
69
+ return $row->getReport();
70
+
71
+ }
72
+
73
+ }
app/code/local/Ced/LayBuy/Block/Customer/Account/Details.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Lay-Buys
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * 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@magentocommerce.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.magentocommerce.com for more information.
20
+ *
21
+ * @category Ced
22
+ * @package Ced_LayBuy
23
+ * @author Asheesh Singh<asheeshsingh@cedcoss.com>
24
+ * @copyright Copyright LAY-BUYS (2011). (http://lay-buys.com/)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ class Ced_LayBuy_Block_Customer_Account_Details extends Mage_Core_Block_Template
29
+ {
30
+ protected $_links = array();
31
+ protected $_orderId = null;
32
+
33
+ protected function _construct()
34
+ {
35
+ parent::_construct();
36
+ $this->_orderId = $this->getRequest()->getParam('order_id');
37
+ $order = Mage::getModel('sales/order')->load($this->_orderId);
38
+ $orderIncrementId = $order->getIncrementId();
39
+ $this->setOrderIncrementId($orderIncrementId);
40
+ $this->setOrderStatusLabel($order->getStatusLabel());
41
+ $transaction = Mage::getModel('laybuy/report')->load($this->getRequest()->getParam('id'));
42
+
43
+ $this->setTransaction($transaction);
44
+
45
+ Mage::app()->getFrontController()->getAction()->getLayout()->getBlock('root')->setHeaderTitle(Mage::helper('laybuy')->__('View Transaction Details'));
46
+ }
47
+
48
+ public function getTransactionStatusLabel($statusId){
49
+ $statuses = Mage::helper('laybuy')->getStatuses();
50
+ return $statuses[$statusId];
51
+ }
52
+
53
+ public function getBackUrl()
54
+ {
55
+ return $this->getUrl('laybuy/report/grid/',array('order_id'=>$this->_orderId));
56
+ }
57
+
58
+ public function getBackTitle()
59
+ {
60
+ return Mage::helper('laybuy')->__('Back');
61
+ }
62
+
63
+ }
app/code/local/Ced/LayBuy/Block/Customer/Account/Grid.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Lay-Buys
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * 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@magentocommerce.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.magentocommerce.com for more information.
20
+ *
21
+ * @category Ced
22
+ * @package Ced_LayBuy
23
+ * @author Asheesh Singh<asheeshsingh@cedcoss.com>
24
+ * @copyright Copyright LAY-BUYS (2011). (http://lay-buys.com/)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ class Ced_LayBuy_Block_Customer_Account_Grid extends Mage_Core_Block_Template
29
+ {
30
+ protected $_orderId = null;
31
+
32
+ public function __construct()
33
+ {
34
+ parent::__construct();
35
+
36
+ $this->_orderId = $this->getRequest()->getParam('order_id');
37
+ $order = Mage::getModel('sales/order')->load($this->_orderId);
38
+ $orderIncrementId = $order->getIncrementId();
39
+ $this->setOrderIncrementId($orderIncrementId);
40
+ $this->setOrderStatusLabel($order->getStatusLabel());
41
+ $transactions = Mage::getModel('laybuy/report')->getCollection()->addFieldToFilter('order_id',array('eq'=>$orderIncrementId));
42
+
43
+ $this->setTransactions($transactions);
44
+
45
+ Mage::app()->getFrontController()->getAction()->getLayout()->getBlock('root')->setHeaderTitle(Mage::helper('laybuy')->__('My Instalment Plans'));
46
+ }
47
+
48
+ protected function _prepareLayout()
49
+ {
50
+ parent::_prepareLayout();
51
+
52
+ $pager = $this->getLayout()->createBlock('page/html_pager', 'sales.order.transaction.pager')
53
+ ->setCollection($this->getTransactions());
54
+ $this->setChild('pager', $pager);
55
+ $this->getTransactions()->load();
56
+ return $this;
57
+ }
58
+
59
+ public function getPagerHtml()
60
+ {
61
+ return $this->getChildHtml('pager');
62
+ }
63
+
64
+ public function getViewUrl($transaction)
65
+ {
66
+ return $this->getUrl('*/*/details', array('order_id'=>$this->_orderId,'id' => $transaction->getId()));
67
+ }
68
+
69
+ public function getBackUrl()
70
+ {
71
+ return $this->getUrl('sales/order/view/',array('order_id'=>$this->_orderId));
72
+ }
73
+
74
+ public function getBackTitle()
75
+ {
76
+ return Mage::helper('laybuy')->__('Back to Order View');
77
+ }
78
+ }
app/code/local/Ced/LayBuy/Block/Form/Laybuy.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Lay-Buys
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * 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@magentocommerce.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.magentocommerce.com for more information.
20
+ *
21
+ * @category Ced
22
+ * @package Ced_LayBuy
23
+ * @author Asheesh Singh<asheeshsingh@cedcoss.com>
24
+ * @copyright Copyright LAY-BUYS (2011). (http://lay-buys.com/)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ /**
29
+ * Block for LayBuy payment method form
30
+ */
31
+ class Ced_LayBuy_Block_Form_Laybuy extends Mage_Payment_Block_Form
32
+ {
33
+ protected $_storeId = null;
34
+
35
+ public function getStoreId(){
36
+ if(empty($this->_storeId)){
37
+ $this->_storeId = Mage::app()->getStore()->getId();
38
+ }
39
+ return $this->_storeId;
40
+ }
41
+
42
+ /**
43
+ * Block construction. Set block template.
44
+ */
45
+ protected function _construct()
46
+ {
47
+ parent::_construct();
48
+
49
+ $laybuyMark = Mage::getConfig()->getBlockClassName('core/template');
50
+ $laybuyMark = new $laybuyMark;
51
+ $laybuyMark->setTemplate('laybuy/form/laybuy.phtml')
52
+ ->setLayBuyTitle(Mage::helper('laybuy')->__('A recurring payment solution'))
53
+ ->setPaymentAcceptanceMarkSrc('http://lay-buys.com/gateway/LAY-BUY.png')
54
+ ->setPaymentAcceptanceMarkHref('http://lay-buys.com/');
55
+ $note = 'Please Choose Your Payment Plan';
56
+ $this->setTemplate('laybuy/form/extra.phtml')
57
+ ->setMethodTitle('')
58
+ ->setExtraMessage('<b>'.$this->__('%s',$note).'</b>')
59
+ ->setMethodLabelAfterHtml($laybuyMark->toHtml());
60
+ }
61
+
62
+ public function getArray($type){
63
+ $totals = Mage::getSingleton('checkout/session')->getQuote()->getTotals();
64
+ $grandtotal = round($totals["grand_total"]->getValue());
65
+ return Mage::getModel('laybuy/report')->getArray($type,$grandtotal,$this->getStoreId());
66
+ }
67
+
68
+ public function getConfigData($field){
69
+ return Mage::getStoreConfig('payment/laybuy/'.$field,$this->getStoreId());
70
+ }
71
+
72
+ }
app/code/local/Ced/LayBuy/Block/Info/Laybuy.php ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Lay-Buys
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * 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@magentocommerce.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.magentocommerce.com for more information.
20
+ *
21
+ * @category Ced
22
+ * @package Ced_LayBuy
23
+ * @author Asheesh Singh<asheeshsingh@cedcoss.com>
24
+ * @copyright Copyright LAY-BUYS (2011). (http://lay-buys.com/)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ /**
29
+ * Block for LayBuy payment method info
30
+ */
31
+ class Ced_LayBuy_Block_Info_Laybuy extends Mage_Payment_Block_Info
32
+ {
33
+ /**
34
+ * Payment rendered specific information
35
+ *
36
+ * @var Varien_Object
37
+ */
38
+ protected $_paymentSpecificInformation = null;
39
+
40
+ protected $_currentTransaction = null;
41
+
42
+ protected function _construct()
43
+ {
44
+ parent::_construct();
45
+ $this->setTemplate('laybuy/info/default.phtml');
46
+ }
47
+
48
+ /**
49
+ * Prepare information specific to current payment method
50
+ *
51
+ * @param Varien_Object|array $transport
52
+ * @return Varien_Object
53
+ */
54
+ protected function _prepareSpecificInformation($transport = null)
55
+ {
56
+ if (null === $this->_paymentSpecificInformation) {
57
+ if (null === $transport) {
58
+ $transport = new Varien_Object;
59
+ } elseif (is_array($transport)) {
60
+ $transport = new Varien_Object($transport);
61
+ }
62
+ Mage::dispatchEvent('payment_info_block_prepare_specific_information', array(
63
+ 'transport' => $transport,
64
+ 'payment' => $this->getInfo(),
65
+ 'transaction'=> $this->getTransaction(),
66
+ 'block' => $this,
67
+ ));
68
+ $this->_paymentSpecificInformation = $transport;
69
+ }
70
+ return $this->_paymentSpecificInformation;
71
+ }
72
+
73
+ /**
74
+ * Retrieve LayBuy transaction model
75
+ *
76
+ * @return Ced_LayBuy_Model_Report
77
+ */
78
+ public function getTransaction(){
79
+ if(null === $this->_currentTransaction){
80
+ $orderId = $this->getInfo()->getParentId();
81
+ $orderIncrementId = Mage::getModel('sales/order')->load($orderId)->getIncrementId();
82
+ $this->_currentTransaction = Mage::getModel('laybuy/report')->getCollection()->addFieldToFilter('order_id',array('eq'=>$orderIncrementId));
83
+ }
84
+ return $this->_currentTransaction;
85
+ }
86
+ }
app/code/local/Ced/LayBuy/Block/Revise/Redirect.php ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Lay-Buys
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * 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@magentocommerce.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.magentocommerce.com for more information.
20
+ *
21
+ * @category Ced
22
+ * @package Ced_LayBuy
23
+ * @author Asheesh Singh<asheeshsingh@cedcoss.com>
24
+ * @copyright Copyright LAY-BUYS (2011). (http://lay-buys.com/)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+ class Ced_LayBuy_Block_Revise_Redirect extends Mage_Core_Block_Abstract
28
+ {
29
+ protected $_orderId;
30
+
31
+ protected $_plan = null;
32
+
33
+ public $reviseFlag = true;
34
+
35
+ protected function _toHtml()
36
+ {
37
+ $dcount = 0;
38
+ $helper = Mage::helper('laybuy/config');
39
+ $submitUrl = $helper->getSubmitUrl();
40
+
41
+ $form = new Varien_Data_Form();
42
+ $form->setAction($submitUrl)
43
+ ->setId('laybuy_revise_checkout')
44
+ ->setName('laybuy_revise_checkout')
45
+ ->setMethod('POST')
46
+ ->setUseContainer(true);
47
+
48
+ $this->_orderId = $this->getRequest()->getParam('order');
49
+ $data = $helper->extractAndPrepareRequiredValueForFormFields($this);
50
+
51
+ foreach ($helper->getStandardCheckoutFormFields($data) as $field=>$value) {
52
+ if(is_array($value)){
53
+ foreach($value as $description){
54
+ $form->addField($field.$dcount, 'hidden', array('name'=>$field, 'value'=>$description));
55
+ $dcount++;
56
+ }
57
+ }else{
58
+ $form->addField($field, 'hidden', array('name'=>$field, 'value'=>$value));
59
+ }
60
+ }
61
+ $submitButton = new Varien_Data_Form_Element_Submit(array(
62
+ 'value' => $this->__('Click here if you are not redirected within 10 seconds...'),
63
+ ));
64
+ $submitButton->setId('laybuy_revise_payment');
65
+ $form->addElement($submitButton);
66
+ $html = '<html><body>';
67
+ $html.= $this->__('You will be redirected to the Lay-Buy website in a few seconds.');
68
+ $html.= $form->toHtml();
69
+ $html.= '<script type="text/javascript">document.getElementById("laybuy_revise_checkout").submit();</script>';
70
+ $html.= '</body></html>';
71
+
72
+ return $html;
73
+ }
74
+
75
+ public function getLastRealOrderId(){
76
+ return $this->_orderId;
77
+ }
78
+
79
+ public function getNewPlan(){
80
+ if(empty($this->_plan)){
81
+ $model = Mage::getModel('laybuy/revise')->load($this->getRequest()->getParam('revise_id'));
82
+ $this->_plan = $model;
83
+ }
84
+ return $this->_plan;
85
+ }
86
+ }
app/code/local/Ced/LayBuy/Block/Standard/Redirect.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Lay-Buys
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * 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@magentocommerce.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.magentocommerce.com for more information.
20
+ *
21
+ * @category Ced
22
+ * @package Ced_LayBuy
23
+ * @author Asheesh Singh<asheeshsingh@cedcoss.com>
24
+ * @copyright Copyright LAY-BUYS (2011). (http://lay-buys.com/)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+ class Ced_LayBuy_Block_Standard_Redirect extends Mage_Core_Block_Abstract
28
+ {
29
+ protected function _toHtml()
30
+ {
31
+ $dcount = 0;
32
+ $helper = Mage::helper('laybuy/config');
33
+ $submitUrl = $helper->getSubmitUrl();
34
+
35
+ $form = new Varien_Data_Form();
36
+ $form->setAction($submitUrl)
37
+ ->setId('laybuy_standard_checkout')
38
+ ->setName('laybuy_standard_checkout')
39
+ ->setMethod('POST')
40
+ ->setUseContainer(true);
41
+
42
+ $session = Mage::getSingleton('checkout/session');
43
+ $data = $helper->extractAndPrepareRequiredValueForFormFields($session);
44
+
45
+ foreach ($helper->getStandardCheckoutFormFields($data) as $field=>$value) {
46
+ if(is_array($value)){
47
+ foreach($value as $description){
48
+ $form->addField($field.$dcount, 'hidden', array('name'=>$field, 'value'=>$description));
49
+ $dcount++;
50
+ }
51
+ }else{
52
+ $form->addField($field, 'hidden', array('name'=>$field, 'value'=>$value));
53
+ }
54
+ }
55
+ $submitButton = new Varien_Data_Form_Element_Submit(array(
56
+ 'value' => $this->__('Click here if you are not redirected within 10 seconds...'),
57
+ ));
58
+ $submitButton->setId('laybuy_standard_payment');
59
+ $form->addElement($submitButton);
60
+ $html = '<html><body>';
61
+ $html.= $this->__('You will be redirected to the PayPal website in a few seconds.');
62
+ $html.= $form->toHtml();
63
+ $html.= '<script type="text/javascript">document.getElementById("laybuy_standard_checkout").submit();</script>';
64
+ $html.= '</body></html>';
65
+
66
+ return $html;
67
+ }
68
+ }
app/code/local/Ced/LayBuy/Helper/Config.php ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Lay-Buys
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * 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@magentocommerce.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.magentocommerce.com for more information.
20
+ *
21
+ * @category Ced
22
+ * @package Ced_LayBuy
23
+ * @author Asheesh Singh<asheeshsingh@cedcoss.com>
24
+ * @copyright Copyright LAY-BUYS (2011). (http://lay-buys.com/)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ /**
29
+ * LayBuy Config helper
30
+ */
31
+
32
+ class Ced_LayBuy_Helper_Config extends Mage_Core_Helper_Abstract
33
+ {
34
+ protected $_storeId = null;
35
+ public function getStoreId(){
36
+ if(empty($this->_storeId))
37
+ $this->_storeId = Mage::app()->getStore()->getId();
38
+ return $this->_storeId;
39
+ }
40
+ /*
41
+ * Get the gateway submit url
42
+ */
43
+ public function getSubmitUrl(){
44
+ return Mage::getStoreConfig('payment/laybuy/submit_url');
45
+ }
46
+ /*
47
+ * For form filed At LayBuy gateway
48
+ */
49
+ public function getStandardCheckoutFormFields($data){
50
+ return $data;
51
+ }
52
+ /*
53
+ * For form field At LayBuy gateway
54
+ */
55
+ public function extractAndPrepareRequiredValueForFormFields($chekoutSession){
56
+ $descKey = 'DESC';
57
+ $storeId = $this->getStoreId();
58
+ $orderId = $chekoutSession->getLastRealOrderId();
59
+ $order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
60
+ $amount = $order->getData('grand_total');
61
+ $currency_code = Mage::app()->getStore()->getCurrentCurrencyCode();
62
+ $email = $order->getData('customer_email');
63
+ /* for adding product's description */
64
+ if(Mage::getStoreConfig('payment/laybuy/multipledesc',$storeId)){
65
+ $_product = Mage::getModel('catalog/product')->load($_product->getProductId());
66
+ $description .= ' <br/> ';
67
+ }
68
+ }else{
69
+ $definedDescription = Mage::getStoreConfig('payment/laybuy/desc',$storeId);
70
+ }
71
+ $data = array(
72
+ 'AMOUNT' => number_format($amount, 2, '.', ''),
73
+ 'MEMBER' => Mage::getStoreConfig('payment/laybuy/membership_number',$storeId),
74
+ 'CURRENCY' => $currency_code,
75
+ 'RETURNURL' => Mage::getBaseUrl().'laybuy/standard/success',
76
+ 'CANCELURL' => Mage::getBaseUrl().'laybuy/standard/cancel',
77
+ $descKey => $description,
78
+ 'CUSTOM' => $orderId,
79
+ 'EMAIL' => $email,
80
+ );
81
+ $MAXD = Mage::getStoreConfig('payment/laybuy/maxd',$storeId);
82
+ $MIND = Mage::getStoreConfig('payment/laybuy/mind',$storeId);
83
+ $IMAGE = Mage::getStoreConfig('payment/laybuy/image',$storeId);
84
+ if(!$MIND || $MIND<20 || $MIND>50){
85
+ $MIND = 20;
86
+ }
87
+ if(!$MAXD || $MAXD<20 || $MAXD>50){
88
+ $MAXD = 50;
89
+ }
90
+ if($IMAGE){
91
+ $IMAGE = Mage::getBaseUrl('media')."laybuy/".$IMAGE;
92
+ }else{
93
+ $IMAGE = 'http://lay-buys.com/lb2.jpg';
94
+ }
95
+ if(!$MONTHS || $MONTHS<0){
96
+ $MONTHS = 3;
97
+ }
98
+ $data['MAXD'] = $MAXD;
99
+ $data['IMAGE'] = $IMAGE;
100
+ $data['MONTHS'] = $MONTHS;
101
+ return $data;
102
+ }
103
+ }
app/code/local/Ced/LayBuy/Helper/Data.php ADDED
@@ -0,0 +1,231 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Lay-Buys
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * 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@magentocommerce.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.magentocommerce.com for more information.
20
+ *
21
+ * @category Ced
22
+ * @package Ced_LayBuy
23
+ * @author Asheesh Singh<asheeshsingh@cedcoss.com>
24
+ * @copyright Copyright LAY-BUYS (2011). (http://lay-buys.com/)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ /**
29
+ * LayBuy Data helper
30
+ */
31
+
32
+ class Ced_LayBuy_Helper_Data extends Mage_Core_Helper_Abstract{
33
+
34
+ public function getStatuses(){
35
+ return array(
36
+ '0' => $this->__("Pending"),
37
+ '1' => $this->__("Completed"),
38
+ '-1'=> $this->__('Cancelled'),
39
+ '-2' => $this->__('Revise Requested'),
40
+ '2' => $this->__('Revised'),
41
+ );
42
+ }
43
+ public function fetchFromLaybuy($config){
44
+ $url = $config['hostname'];
45
+ $matchedData = $this->getMatchingData();
46
+ /*$orderIds = *//* $this->getMatchingOrderIds() *//*$matchedData['orderIds']; */
47
+ $profileIds = $matchedData['profileIds'];
48
+ $data ='';
49
+ $data .= "mid=".$config['username']."&";
50
+ /* $data .= "custom=".$orderIds."&"; */
51
+ $data .= "profileIds=".$profileIds;
52
+ /* echo $data;die; */
53
+ $ch = curl_init();
54
+ curl_setopt($ch, CURLOPT_URL,$url);
55
+ curl_setopt($ch, CURLOPT_POST, 1);
56
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
57
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); /* use this to suppress output */
58
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false); /* tell cURL to graciously accept an SSL certificate */
59
+ $result = curl_exec ($ch);
60
+ curl_close ($ch);
61
+ /* print_r($result); die; */
62
+ return json_decode($result);
63
+ }
64
+
65
+ public function getMatchingOrderIds(){
66
+ $result = '';
67
+ $collection = Mage::getModel('laybuy/report')->getCollection()
68
+ /* ->addFieldToFilter('last_payment_due',array('lt'=>date('Y-m-d h:i:s',time()))) */
69
+ ->addFieldToFilter('status',array('eq'=>0)) ;
70
+ foreach($collection as $report){
71
+ $result .= $report->getData('laybuy_ref_no').",";
72
+ /* $result .= $report->getData('order_id').","; */
73
+ }
74
+ return rtrim($result,',');
75
+ }
76
+
77
+ public function getMatchingData(){
78
+ $result = array();
79
+ $orderIds = '';
80
+ $profileIds = '';
81
+ $collection = Mage::getModel('laybuy/report')->getCollection()
82
+ /* ->addFieldToFilter('last_payment_due',array('lt'=>date('Y-m-d h:i:s',time()))) */
83
+ ->addFieldToFilter('status',array('eq'=>0));
84
+ foreach($collection as $report){
85
+ $orderIds .= $report->getData('laybuy_ref_no').",";
86
+ $profileIds .= $report->getData('paypal_profile_id').",";
87
+ /* $result .= $report->getData('order_id').","; */
88
+ }
89
+ $result['orderIds'] = rtrim($orderIds,',');
90
+ $result['profileIds'] = rtrim($profileIds,',');
91
+ return $result;
92
+ }
93
+
94
+ public function cancelTransaction($report){
95
+ $newStrReport = preg_replace('/Pending/i', 'Canceled', $report->getReport());
96
+ try{
97
+ Mage::log('cancel transaction called',null,'laybuy_success.log');
98
+ if($this->cancelPaypalProfile($report->getPaypalProfileId(),$report->getStoreId())){
99
+ if($this->processOrder($report->getOrderId(),0)){
100
+ $report->setReport($newStrReport);
101
+ $report->setStatus(-1);
102
+ $report->save();
103
+ return true;
104
+ }else{
105
+ return false;
106
+ }
107
+ }else{
108
+ return false;
109
+ }
110
+ }catch(Exception $e){
111
+ return false;
112
+ }
113
+ }
114
+
115
+ public function cancelPaypalProfile($paypalProfileId,$storeId){
116
+ if(!$paypalProfileId)
117
+ return true;
118
+ Mage::log('cancel paypal profile called',null,'laybuy_success.log');
119
+ $url = 'https://lay-buys.com/vtmob/deal5cancel.php';
120
+ $data ='';
121
+ $data .= "&mid=".Mage::getStoreConfig('payment/laybuy/membership_number',$storeId);
122
+ $data .= "&paypal_profile_id=".$paypalProfileId;
123
+ $ch = curl_init();
124
+ curl_setopt($ch, CURLOPT_URL,$url);
125
+ curl_setopt($ch, CURLOPT_POST, 1);
126
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
127
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); /* use this to suppress output */
128
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false); /* tell cURL to graciously accept an SSL certificate */
129
+ $result = curl_exec ($ch);
130
+ if($result == 'success'){
131
+ $result = print_r($result,true);
132
+ Mage::log('Cancel Request Array to LayBuy {{'.$data."}}", null, 'laybuy_success.log');
133
+ curl_close ($ch);
134
+ return true;
135
+ }else{
136
+ Mage::log('Cancel Response Array From LayBuy {{'.$result."}}", null, 'laybuy_failure.log');
137
+ curl_close ($ch);
138
+ return false;
139
+ }
140
+ }
141
+
142
+ public function processOrder($orderIncrementId,$flag,$transactions,$profileId){
143
+ $order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
144
+ if ($order->getId()) {
145
+ if(!$flag){
146
+ if($order->canCancel()){
147
+ $order->cancel()->save();
148
+ Mage::log('Revise Request process order error3 {{'.$order->getId()."-".$order->getStatus()."}}", null, 'laybuy_failure.log');
149
+ }
150
+ return true;
151
+ }
152
+ if($flag==2){
153
+ $payment_info = $order->getPayment()->getData('additional_information');
154
+ $payment_info['transactions'][$profileId] = json_decode(json_encode($transactions),true);
155
+ $order->getPayment()->setData('additional_information',$payment_info)->save();
156
+ $order->save();
157
+ /* $str = print_r($order->getPayment()->getData('additional_information'),true); */
158
+ Mage::log('Revise Request process order success4 {{'.$order->getId()."-".$order->getStatus()."}}", null, 'laybuy_success.log');
159
+ return true;
160
+ }
161
+ try {
162
+ if(!$order->canInvoice()){
163
+ Mage::log('Revise Request process order error1 {{'.$order->getId()."-".$order->getStatus()."}}", null, 'laybuy_failure.log');
164
+ return false;
165
+ }
166
+ $invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();
167
+ if (!$invoice->getTotalQty()) {
168
+ Mage::log('Revise Request process order error2 {{'.$order->getId()."-".$order->getStatus()."}}", null, 'laybuy_failure.log');
169
+ return false;
170
+ }
171
+ $invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE);
172
+ $invoice->register();
173
+ $invoice->getOrder()->setIsInProcess(true);
174
+ $transactionSave = Mage::getModel('core/resource_transaction')
175
+ ->addObject($invoice)
176
+ ->addObject($invoice->getOrder());
177
+ $transactionSave->save();
178
+ Mage::log('Revise Request process order success3 {{'.$order->getId()."-".$invoice->getOrder()->getStatus()."}}", null, 'laybuy_success.log');
179
+ return true;
180
+ }catch (Mage_Core_Exception $e) {
181
+ Mage::log('Revise Request process order error {{'.$e->getMessage()."}}", null, 'laybuy_failure.log');
182
+ return false;
183
+ }
184
+ }
185
+ return false;
186
+ }
187
+
188
+ public function revisePlan($revise){
189
+ /* $order = Mage::getModel('sales/order')->loadByIncrementId($revise->getOrderId()); */
190
+ $storeId = $revise->getStoreId();
191
+
192
+ $url = 'https://lay-buys.com/vtmob/deal5.php';
193
+ $data ='';
194
+ $data .= "eml=".$revise->getEmail();
195
+ $data .= "&prc=".$revise->getAmount();
196
+ $data .= "&curr=".$revise->getCurrency();
197
+ if($revise->getPaymentType()==1){
198
+ /* Lay-Buy Payment */
199
+ $data .= "&pp=1";
200
+ $data .= "&pplan=1";
201
+ }else{
202
+ /* Buy-Now Payment */
203
+ $data .= "&pp=0";
204
+ $data .= "&pplan=0";
205
+ }
206
+ $data .= "&init=".$revise->getDownpayment();
207
+ $data .= "&mnth=".$revise->getMonths();
208
+ $data .= "&mid=".Mage::getStoreConfig('payment/laybuy/membership_number',$storeId);
209
+ $data .= "&convrate=1";
210
+ $data .= "&id=".$revise->getId()."-".$revise->getOrderId();
211
+ $data .="&CANCELURL=".Mage::getBaseUrl().'laybuy/revise/cancel/';
212
+ $data .="&RETURNURL=".Mage::getBaseUrl().'laybuy/revise/success/';
213
+ $ch = curl_init();
214
+ curl_setopt($ch, CURLOPT_URL,$url);
215
+ curl_setopt($ch, CURLOPT_POST, 1);
216
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
217
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); /* use this to suppress output */
218
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false); /* tell cURL to graciously accept an SSL certificate */
219
+ $result = curl_exec ($ch);
220
+ if($result == 'success'){
221
+ $result = print_r($result,true);
222
+ Mage::log('Revise Request Array to LayBuy {{'.$data."}}", null, 'laybuy_success.log');
223
+ curl_close ($ch);
224
+ return true;
225
+ }else{
226
+ Mage::log('Revise Response Array From LayBuy {{'.$result."}}", null, 'laybuy_failure.log');
227
+ curl_close ($ch);
228
+ return false;
229
+ }
230
+ }
231
+ }
app/code/local/Ced/LayBuy/Model/Observer.php ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Lay-Buys
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * 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@magentocommerce.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.magentocommerce.com for more information.
20
+ *
21
+ * @category Ced
22
+ * @package Ced_LayBuy
23
+ * @author Asheesh Singh<asheeshsingh@cedcoss.com>
24
+ * @copyright Copyright LAY-BUYS (2011). (http://lay-buys.com/)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ /**
29
+ * LayBuy module observer
30
+ *
31
+ * @author Asheesh Singh<asheeshsingh@cedcoss.com>
32
+ */
33
+
34
+ class Ced_LayBuy_Model_Observer
35
+ {
36
+
37
+ /**
38
+ * Add transaction data to info block
39
+ *
40
+ * @param Varien_Object $observer
41
+ * @return Mage_Centinel_Model_Observer
42
+ */
43
+ public function paymentInfoBlockPrepareSpecificInformation($observer)
44
+ {
45
+ /* if ($observer->getEvent()->getBlock()->getIsSecureMode()) {
46
+ return;
47
+ } */
48
+
49
+ $transaction = $observer->getEvent()->getTransaction();
50
+ $transport = $observer->getEvent()->getTransport();
51
+
52
+ foreach($transaction as $txn){
53
+ $transport->setData($txn->getFieldLabel('Instalment Plan')."-".$txn->getId(),$txn->getReport());
54
+ }
55
+
56
+ return $this;
57
+ }
58
+
59
+ /**
60
+ * Cancel the asscociated
61
+ *
62
+ * @param Varien_Object $observer
63
+ * @return Mage_Centinel_Model_Observer
64
+ */
65
+ public function orderCancelAfter($observer){
66
+ $order = $observer->getEvent()->getOrder();
67
+ try{
68
+ $model = Mage::getModel('laybuy/report')->loadByOrderId($order->getIncrementId());
69
+ if($model && $model->getId() && Mage::app()->getFrontController()->getRequest()->getModuleName()!='laybuy'){
70
+ $newStrReport = preg_replace('/Pending/i', 'Canceled', $model->getReport());
71
+ /* Mage::helper('laybuy')->cancelTransaction($model); */
72
+ Mage::log('Cancel observer called',null,'laybuy_success.log');
73
+ if(Mage::helper('laybuy')->cancelPaypalProfile($model->getPaypalProfileId(),$model->getStoreId())){
74
+ $model->setReport($newStrReport);
75
+ $model->setStatus(-1);
76
+ $model->save();
77
+ }
78
+ Mage::log('Success on orderCancelAfter!!{{'.$model->getId().'Date:'.date('Y-m-d h:i:s',time()).' }}',null,'laybuy_success.log');
79
+ }
80
+ }catch(Exception $e){
81
+ Mage::log('Failure on orderCancelAfter!!{{Exception: '.$e->getMessage().'Date:'.date('Y-m-d h:i:s',time()).' }}',null,'laybuy_failure.log');
82
+ Mage::logException($e);
83
+ }
84
+ }
85
+
86
+ /**
87
+ * Goes to http://lay-buys.com/report/ and fetches Instalment reports.
88
+ * @return Mage_LayBuy_Model_Observer
89
+ */
90
+ public function fetchUpdates()
91
+ {
92
+ try {
93
+ $reports = Mage::getModel('laybuy/report');
94
+ /* @var $reports Mage_LayBuy_Model_Report */
95
+ $credentials = $reports->getApiCredentials(true);
96
+ foreach ($credentials as $config) {
97
+ try {
98
+ $fetched = $reports->fetchAndSave($config);
99
+ Mage::log('Success!! Cron response {{Total '.$fetched.' rows fetched at date:'.date('Y-m-d h:i:s',time()).' }}',null,'laybuy_cron.log');
100
+ } catch (Exception $e) {
101
+ Mage::log('Failure1!! Cron response {{Exception: '.$e->getMessage().'Date:'.date('Y-m-d h:i:s',time()).' }}',null,'laybuy_cron.log');
102
+ Mage::logException($e);
103
+ }
104
+ }
105
+ } catch (Exception $e) {
106
+ Mage::log('Failure2!! Cron response {{Exception: '.$e->getMessage().'Date:'.date('Y-m-d h:i:s',time()).' }}',null,'laybuy_cron.log');
107
+ Mage::logException($e);
108
+ }
109
+ }
110
+
111
+ /**
112
+ * Chcek cron setup is available at server or not.
113
+ */
114
+ public function checkCron(){
115
+ if(!Mage::getStoreConfig('paymnet/laybuy/cronenabled')){
116
+ $config = Mage::getConfig();
117
+ $config->setNode("paymnet/laybuy/cronenabled", 1);
118
+ }
119
+ }
120
+ }
app/code/local/Ced/LayBuy/Model/Report.php ADDED
@@ -0,0 +1,429 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Lay-Buys
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * 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@magentocommerce.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.magentocommerce.com for more information.
20
+ *
21
+ * @category Ced
22
+ * @package Ced_LayBuy
23
+ * @author Asheesh Singh<asheeshsingh@cedcoss.com>
24
+ * @copyright Copyright LAY-BUYS (2011). (http://lay-buys.com/)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ /**
29
+ * LayBuy Report model
30
+ */
31
+
32
+ class Ced_LayBuy_Model_Report extends Mage_Core_Model_Abstract
33
+ {
34
+
35
+ /**
36
+ * Default LayBuy Api host
37
+ * @var string
38
+ */
39
+ const REPORTS_HOSTNAME = "https://lay-buys.com/report/";
40
+
41
+ /**
42
+ * Assoc array event code => label
43
+ *
44
+ * @var array
45
+ */
46
+ protected static $_eventList = array();
47
+
48
+ /**
49
+ * Initialize resource model
50
+ */
51
+ protected function _construct()
52
+ {
53
+ $this->_init('laybuy/report');
54
+ }
55
+
56
+ /**
57
+ * Goes to specified host/path and fetches reports from there.
58
+ * Save reports to database.
59
+ *
60
+ * @param array $config Api credentials
61
+ * @return int Number of report rows that were fetched and saved successfully
62
+ */
63
+ public function fetchAndSave($config)
64
+ {
65
+ $fetched = 0;
66
+ $helper = Mage::helper('laybuy');
67
+
68
+ $listing = $helper->fetchFromLaybuy($config);
69
+ /* print_r($listing);die; */
70
+ foreach($listing as $orderId=>$reports){
71
+ $status = $reports->status;
72
+ $report = $reports->report;
73
+ /* print_r($status);
74
+ echo "<br/><br/><br/><br/>";
75
+ print_r($report);die; */
76
+ $model = array();
77
+ $model = Mage::getModel('laybuy/report')->loadByLayBuyRefId($orderId);
78
+ $orderId = $model->getOrderId();
79
+ $profileId = $model->getData('paypal_profile_id');
80
+ /* echo $orderId;die; */
81
+ $newStr = '<div class="grid"><div class="hor-scroll"><table cellspacing=0 class="data"><thead><tr class="headings"><th colspan=2 class=" no-link" style="text-align: center;"><span class="nobr">Instalment</span></th><th class=" no-link" style="text-align: center;"><span class="nobr">Date</span></th><th class=" no-link" style="text-align: center;"><span class="nobr">PayPal Transaction ID</span></th><th class=" no-link" style="text-align: center;"><span class="nobr">Status</span></th></tr></thead>';
82
+ $newStr .= '<colgroup>
83
+ <col width="100">
84
+ <col width="75">
85
+ <col width="183">
86
+ <col width="183">
87
+ <col width="98">
88
+ </colgroup>';
89
+ $months = (int)$model->getData('months');
90
+ $report_log = print_r($report,true);
91
+ $pending_flag = false;
92
+ Mage::log('Fetched Report{{'.$model->getId().'}}Report{{'.$report_log.'}}',null,'laybuy_success.log');
93
+ $nextPaymentStatus = 'Pending';
94
+ foreach($report as $month=>$transaction){
95
+ $transaction->paymentDate = date('Y-m-d h:i:s', strtotime(str_replace('/','-',$transaction->paymentDate)));
96
+ $date = Mage::helper('core')->formatDate($transaction->paymentDate, Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM, true);
97
+ $nextPaymentDate = $transaction->paymentDate;
98
+ if($transaction->type == 'd'){
99
+ $newStr .= '<tbody><tr class="even" ><td style="text-align: center;"> DP: </td><td style="text-align: center;"> '.Mage::app()->getLocale()
100
+ ->currency($model->getData('currency'))
101
+ ->toCurrency($transaction->amount).' </td>'.
102
+ '<td style="text-align: center;"> '.$date.' </td>'.
103
+ '<td style="text-align: center;"> '.$transaction->txnID.' </td>'.
104
+ '<td style="text-align: center;"> '.$transaction->paymentStatus.' </td></tr>';
105
+ continue;
106
+ }elseif($transaction->type == 'p'){
107
+ $pending_flag = true;
108
+ $newStr .= '<tr ';
109
+ if($month%2==0)
110
+ $newStr .= 'class="even"';
111
+ $newStr .= '>';
112
+ $newStr .= '<td style="text-align: center;"> Month '.$month.': </td><td style="text-align: center;"> '.Mage::app()->getLocale()
113
+ ->currency($model->getData('currency'))
114
+ ->toCurrency($transaction->amount).' </td>';
115
+
116
+
117
+ $newStr .= '<td style="text-align: center;"> '.$date.' </td>';
118
+
119
+ $txnID = $transaction->txnID;
120
+
121
+ $newStr .= '<td style="text-align: center;"> '.$txnID.' </td>';
122
+
123
+ $newStr .= '<td style="text-align: center;"> '.$transaction->paymentStatus.' </td></tr>';
124
+
125
+ $nextPaymentStatus = $transaction->paymentStatus;
126
+
127
+ }
128
+
129
+ }
130
+ if($pending_flag)
131
+ $startIndex = $month+1;
132
+ else
133
+ $startIndex = $month+2;
134
+ if($month<$months){
135
+ for($month=$startIndex;$month<=$months;$month++){
136
+ $newStr .= '<tr ';
137
+ if($month%2==0)
138
+ $newStr .= 'class="even"';
139
+ $newStr .= '>';
140
+ $newStr .= '<td style="text-align: center;"> Month '.$month.': </td><td style="text-align: center;"> '.Mage::app()->getLocale()
141
+ ->currency($model->getData('currency'))
142
+ ->toCurrency($model->getData('payment_amounts')).' </td>';
143
+
144
+ $nextPaymentDate = date("Y-m-d h:i:s", strtotime($nextPaymentDate . " +1 month"));
145
+ $date = Mage::helper('core')->formatDate($nextPaymentDate, Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM, true);
146
+ $newStr .= '<td style="text-align: center;"> '.$date.' </td>';
147
+ $newStr .= '<td style="text-align: center;">&nbsp;</td>';
148
+ $newStr .= '<td style="text-align: center;"> '.$nextPaymentStatus.' </td></tr>';
149
+ }
150
+ }
151
+ $newStr .= '</tbody></table></div></div>';
152
+
153
+ switch($status){
154
+ case -1: if($helper->processOrder($orderId,0)){
155
+ $model->setStatus(-1)->setReport($newStr)->setTransaction($startIndex)->save(); /* Cancel */
156
+ $fetched++;
157
+ }
158
+ break;
159
+ case 0: if($helper->processOrder($orderId,2,$report,$profileId)){
160
+ $model->setStatus(0)->setReport($newStr)->setTransaction($startIndex)->save(); /* Processing */
161
+ $fetched++;
162
+ }
163
+ break;
164
+ case 1: if($helper->processOrder($orderId,1)){
165
+ $model->setStatus(1)->setReport($newStr)->setTransaction($startIndex)->save(); /* Paid*/
166
+ $fetched++;
167
+ }
168
+ break;
169
+ }
170
+
171
+ }
172
+
173
+ return $fetched;
174
+ }
175
+
176
+ /**
177
+ * Return name for row column
178
+ *
179
+ * @param string $field Field name in row model
180
+ * @return string
181
+ */
182
+ public function getFieldLabel($field)
183
+ {
184
+ switch ($field) {
185
+ case 'report_date':
186
+ return Mage::helper('laybuy')->__('Report Date');
187
+ case 'account_id':
188
+ return Mage::helper('laybuy')->__('Merchant Account');
189
+ case 'transaction_id':
190
+ return Mage::helper('laybuy')->__('Transaction ID');
191
+ case 'order_id':
192
+ return Mage::helper('laybuy')->__('Order ID');
193
+ case 'mid':
194
+ return Mage::helper('laybuy')->__('Lay-Buy Member ID');
195
+ case 'paypal_profile_id':
196
+ return Mage::helper('laybuy')->__('PayPal Profile ID');
197
+ case 'laybuy_ref_no':
198
+ return Mage::helper('laybuy')->__('Lay-Buy Reference ID');
199
+ case 'status':
200
+ return Mage::helper('laybuy')->__('Status');
201
+ case 'amount':
202
+ return Mage::helper('laybuy')->__('Amount');
203
+ case 'total_amount':
204
+ return Mage::helper('laybuy')->__('Total Amount :');
205
+ case 'downpayment':
206
+ return Mage::helper('laybuy')->__('Down Payment %');
207
+ case 'months':
208
+ return Mage::helper('laybuy')->__('Months');
209
+ case 'months_to_pay':
210
+ return Mage::helper('laybuy')->__('Months to Pay : ');
211
+ case 'downpayment_amount':
212
+ return Mage::helper('laybuy')->__('Down Payment Amount');
213
+ case 'dp_amount':
214
+ return Mage::helper('laybuy')->__('Initial Payment : ');
215
+ case 'payment_amounts':
216
+ return Mage::helper('laybuy')->__('Payment Amounts');
217
+ case 'first_payment_due':
218
+ return Mage::helper('laybuy')->__('First Payment Due');
219
+ case 'last_payment_due':
220
+ return Mage::helper('laybuy')->__('Last Payment Due');
221
+ case 'report':
222
+ return Mage::helper('laybuy')->__('Payment Record');
223
+ case 'firstname':
224
+ return Mage::helper('laybuy')->__('First Name');
225
+ case 'lastname':
226
+ return Mage::helper('laybuy')->__('Last Name');
227
+ case 'email':
228
+ return Mage::helper('laybuy')->__('Email');
229
+ case 'address':
230
+ return Mage::helper('laybuy')->__('Address');
231
+ case 'suburb':
232
+ return Mage::helper('laybuy')->__('Suburb');
233
+ case 'state':
234
+ return Mage::helper('laybuy')->__('State');
235
+ case 'country':
236
+ return Mage::helper('laybuy')->__('Country');
237
+ case 'postcode':
238
+ return Mage::helper('laybuy')->__('Postcode');
239
+ case 'custom_field':
240
+ return Mage::helper('laybuy')->__('Custom');
241
+ case 'preview':
242
+ return Mage::helper('laybuy')->__('Preview');
243
+ default:
244
+ return Mage::helper('laybuy')->__('%s',$field);
245
+ }
246
+ }
247
+
248
+ /**
249
+ * Iterate through website configurations and collect all SFTP configurations
250
+ * Filter config values if necessary
251
+ *
252
+ * @param bool $automaticMode Whether to skip settings with disabled Automatic Fetching or not
253
+ * @return array
254
+ */
255
+ public function getApiCredentials($automaticMode = false)
256
+ {
257
+ $configs = array();
258
+ $uniques = array();
259
+ foreach(Mage::app()->getStores() as $store) {
260
+ /*@var $store Mage_Core_Model_Store */
261
+ $active = (bool)$store->getConfig('laybuy/fetch_reports/active');
262
+ if (!$active && $automaticMode) {
263
+ continue;
264
+ }
265
+ $cfg = array(
266
+ 'hostname' => $store->getConfig('laybuy/fetch_reports/ftp_ip'),
267
+ 'username' => $store->getConfig('payment/laybuy/membership_number'),
268
+ );
269
+ if (empty($cfg['username'])) {
270
+ continue;
271
+ }
272
+ if (empty($cfg['hostname'])) {
273
+ $cfg['hostname'] = self::REPORTS_HOSTNAME;
274
+ }
275
+ // avoid duplicates
276
+ if (in_array(serialize($cfg), $uniques)) {
277
+ continue;
278
+ }
279
+ $uniques[] = serialize($cfg);
280
+ $configs[] = $cfg;
281
+ }
282
+ return $configs;
283
+ }
284
+
285
+ /**
286
+ * Load report by Order Id
287
+ *
288
+ * @return Ced_LayBuy_Model_Report
289
+ */
290
+ public function loadByOrderId($orderId)
291
+ {
292
+ $this->getResource()->loadByOrderId($this, $orderId);
293
+ return $this;
294
+ }
295
+
296
+ /**
297
+ * Load report by Lay-Buy Reference Id
298
+ *
299
+ * @return Ced_LayBuy_Model_Report
300
+ */
301
+ public function loadByLayBuyRefId($laybuyId){
302
+ $this->getResource()->loadByLayBuyRefId($this, $laybuyId);
303
+ return $this;
304
+ }
305
+
306
+ /**
307
+ * Fill/translate and sort all event codes/labels
308
+ */
309
+ protected function _generateEventLabels()
310
+ {
311
+ if (!self::$_eventList) {
312
+ self::$_eventList = array(
313
+ 'T0000' => Mage::helper('laybuy')->__('General: received payment of a type not belonging to the other T00xx categories'),
314
+ 'T0001' => Mage::helper('laybuy')->__('Mass Pay Payment'),
315
+ 'T0002' => Mage::helper('laybuy')->__('Subscription Payment, either payment sent or payment received'),
316
+ 'T0003' => Mage::helper('laybuy')->__('Preapproved Payment (BillUser API), either sent or received'),
317
+ 'T0004' => Mage::helper('laybuy')->__('eBay Auction Payment'),
318
+ 'T0005' => Mage::helper('laybuy')->__('Direct Payment API'),
319
+ 'T0006' => Mage::helper('laybuy')->__('Express Checkout APIs'),
320
+ 'T0007' => Mage::helper('laybuy')->__('Website Payments Standard Payment'),
321
+ 'T0008' => Mage::helper('laybuy')->__('Postage Payment to either USPS or UPS'),
322
+ 'T0009' => Mage::helper('laybuy')->__('Gift Certificate Payment: purchase of Gift Certificate'),
323
+ 'T0010' => Mage::helper('laybuy')->__('Auction Payment other than through eBay'),
324
+ 'T0011' => Mage::helper('laybuy')->__('Mobile Payment (made via a mobile phone)'),
325
+ 'T0012' => Mage::helper('laybuy')->__('Virtual Terminal Payment'),
326
+ 'T0100' => Mage::helper('laybuy')->__('General: non-payment fee of a type not belonging to the other T01xx categories'),
327
+ 'T0101' => Mage::helper('laybuy')->__('Fee: Web Site Payments Pro Account Monthly'),
328
+ 'T0102' => Mage::helper('laybuy')->__('Fee: Foreign ACH Withdrawal'),
329
+ 'T0103' => Mage::helper('laybuy')->__('Fee: WorldLink Check Withdrawal'),
330
+ 'T0104' => Mage::helper('laybuy')->__('Fee: Mass Pay Request'),
331
+ 'T0200' => Mage::helper('laybuy')->__('General Currency Conversion'),
332
+ 'T0201' => Mage::helper('laybuy')->__('User-initiated Currency Conversion'),
333
+ 'T0202' => Mage::helper('laybuy')->__('Currency Conversion required to cover negative balance'),
334
+ 'T0300' => Mage::helper('laybuy')->__('General Funding of LayBuy Account '),
335
+ 'T0301' => Mage::helper('laybuy')->__('LayBuy Balance Manager function of LayBuy account'),
336
+ 'T0302' => Mage::helper('laybuy')->__('ACH Funding for Funds Recovery from Account Balance'),
337
+ 'T0303' => Mage::helper('laybuy')->__('EFT Funding (German banking)'),
338
+ 'T0400' => Mage::helper('laybuy')->__('General Withdrawal from LayBuy Account'),
339
+ 'T0401' => Mage::helper('laybuy')->__('AutoSweep'),
340
+ 'T0500' => Mage::helper('laybuy')->__('General: Use of LayBuy account for purchasing as well as receiving payments'),
341
+ 'T0501' => Mage::helper('laybuy')->__('Virtual LayBuy Debit Card Transaction'),
342
+ 'T0502' => Mage::helper('laybuy')->__('LayBuy Debit Card Withdrawal from ATM'),
343
+ 'T0503' => Mage::helper('laybuy')->__('Hidden Virtual LayBuy Debit Card Transaction'),
344
+ 'T0504' => Mage::helper('laybuy')->__('LayBuy Debit Card Cash Advance'),
345
+ 'T0600' => Mage::helper('laybuy')->__('General: Withdrawal from LayBuy Account'),
346
+ 'T0700' => Mage::helper('laybuy')->__('General (Purchase with a credit card)'),
347
+ 'T0701' => Mage::helper('laybuy')->__('Negative Balance'),
348
+ 'T0800' => Mage::helper('laybuy')->__('General: bonus of a type not belonging to the other T08xx categories'),
349
+ 'T0801' => Mage::helper('laybuy')->__('Debit Card Cash Back'),
350
+ 'T0802' => Mage::helper('laybuy')->__('Merchant Referral Bonus'),
351
+ 'T0803' => Mage::helper('laybuy')->__('Balance Manager Account Bonus'),
352
+ 'T0804' => Mage::helper('laybuy')->__('LayBuy Buyer Warranty Bonus'),
353
+ 'T0805' => Mage::helper('laybuy')->__('LayBuy Protection Bonus'),
354
+ 'T0806' => Mage::helper('laybuy')->__('Bonus for first ACH Use'),
355
+ 'T0900' => Mage::helper('laybuy')->__('General Redemption'),
356
+ 'T0901' => Mage::helper('laybuy')->__('Gift Certificate Redemption'),
357
+ 'T0902' => Mage::helper('laybuy')->__('Points Incentive Redemption'),
358
+ 'T0903' => Mage::helper('laybuy')->__('Coupon Redemption'),
359
+ 'T0904' => Mage::helper('laybuy')->__('Reward Voucher Redemption'),
360
+ 'T1000' => Mage::helper('laybuy')->__('General. Product no longer supported'),
361
+ 'T1100' => Mage::helper('laybuy')->__('General: reversal of a type not belonging to the other T11xx categories'),
362
+ 'T1101' => Mage::helper('laybuy')->__('ACH Withdrawal'),
363
+ 'T1102' => Mage::helper('laybuy')->__('Debit Card Transaction'),
364
+ 'T1103' => Mage::helper('laybuy')->__('Reversal of Points Usage'),
365
+ 'T1104' => Mage::helper('laybuy')->__('ACH Deposit (Reversal)'),
366
+ 'T1105' => Mage::helper('laybuy')->__('Reversal of General Account Hold'),
367
+ 'T1106' => Mage::helper('laybuy')->__('Account-to-Account Payment, initiated by LayBuy'),
368
+ 'T1107' => Mage::helper('laybuy')->__('Payment Refund initiated by merchant'),
369
+ 'T1108' => Mage::helper('laybuy')->__('Fee Reversal'),
370
+ 'T1110' => Mage::helper('laybuy')->__('Hold for Dispute Investigation'),
371
+ 'T1111' => Mage::helper('laybuy')->__('Reversal of hold for Dispute Investigation'),
372
+ 'T1200' => Mage::helper('laybuy')->__('General: adjustment of a type not belonging to the other T12xx categories'),
373
+ 'T1201' => Mage::helper('laybuy')->__('Chargeback'),
374
+ 'T1202' => Mage::helper('laybuy')->__('Reversal'),
375
+ 'T1203' => Mage::helper('laybuy')->__('Charge-off'),
376
+ 'T1204' => Mage::helper('laybuy')->__('Incentive'),
377
+ 'T1205' => Mage::helper('laybuy')->__('Reimbursement of Chargeback'),
378
+ 'T1300' => Mage::helper('laybuy')->__('General (Authorization)'),
379
+ 'T1301' => Mage::helper('laybuy')->__('Reauthorization'),
380
+ 'T1302' => Mage::helper('laybuy')->__('Void'),
381
+ 'T1400' => Mage::helper('laybuy')->__('General (Dividend)'),
382
+ 'T1500' => Mage::helper('laybuy')->__('General: temporary hold of a type not belonging to the other T15xx categories'),
383
+ 'T1501' => Mage::helper('laybuy')->__('Open Authorization'),
384
+ 'T1502' => Mage::helper('laybuy')->__('ACH Deposit (Hold for Dispute or Other Investigation)'),
385
+ 'T1503' => Mage::helper('laybuy')->__('Available Balance'),
386
+ 'T1600' => Mage::helper('laybuy')->__('Funding'),
387
+ 'T1700' => Mage::helper('laybuy')->__('General: Withdrawal to Non-Bank Entity'),
388
+ 'T1701' => Mage::helper('laybuy')->__('WorldLink Withdrawal'),
389
+ 'T1800' => Mage::helper('laybuy')->__('Buyer Credit Payment'),
390
+ 'T1900' => Mage::helper('laybuy')->__('General Adjustment without businessrelated event'),
391
+ 'T2000' => Mage::helper('laybuy')->__('General (Funds Transfer from LayBuy Account to Another)'),
392
+ 'T2001' => Mage::helper('laybuy')->__('Settlement Consolidation'),
393
+ 'T9900' => Mage::helper('laybuy')->__('General: event not yet categorized'),
394
+ );
395
+ asort(self::$_eventList);
396
+ }
397
+ }
398
+
399
+ public function getArray($type,$value,$storeId){
400
+ $options = array();
401
+ if($type=='dp_amount'){
402
+ $mind = Mage::getStoreConfig('payment/laybuy/mind',$storeId);
403
+ if(!$mind || $mind<20 || $mind>50){
404
+ $mind = 20;
405
+ }
406
+ $mind = floor($mind / 10) * 10;
407
+ $maxd = Mage::getStoreConfig('payment/laybuy/maxd',$storeId);
408
+ if(!$maxd || $maxd<20 || $maxd>50){
409
+ $maxd = 50;
410
+ }
411
+ $maxd = round($maxd / 10) * 10;
412
+ $vrg = 1;
413
+ for ($e=$mind; $e<=$maxd; $e+=10) {
414
+ $options[] = array('value'=>$e,'label'=>$e.'%');
415
+ $vrg=0;
416
+ }
417
+ }
418
+ if($type=='months'){
419
+ $mmm = Mage::getStoreConfig('payment/laybuy/months',$storeId);
420
+ if (!strlen($mmm)) $mmm = 3;
421
+ if ($mmm < 1) $mmm = 1;
422
+ if ($mmm > 6) $mmm = 6;
423
+ for ($e=1; $e<=$mmm; $e++) {
424
+ $options[] = array('value'=>$e,'label'=>$e .' month'.($e > 1 ? 's' :''));
425
+ }
426
+ }
427
+ return $options;
428
+ }
429
+ }
app/code/local/Ced/LayBuy/Model/Resource/Report.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
  {
1
  $adapter = $this->_getReadAdapter();
2
  $select = $adapter->select()
3
  ->from($this->getMainTable())
4
  ->where('laybuy_ref_no = :laybuy_ref_no');
5
  $data = $adapter->fetchRow($select, array(':laybuy_ref_no' => $laybuy_ref_no));
6
  if ($data) {
7
  $report->addData($data);
8
  }
9
  return $this;
10
  }
 
1
+ <?php
2
+ /**
3
+ * Lay-Buys
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * 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@magentocommerce.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.magentocommerce.com for more information.
20
+ *
21
+ * @category Ced
22
+ * @package Ced_LayBuy
23
+ * @author Asheesh Singh<asheeshsingh@cedcoss.com>
24
+ * @copyright Copyright LAY-BUYS (2011). (http://lay-buys.com/)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ /**
29
+ * LayBuy Resource Report model
30
+ */
31
+
32
+ class Ced_LayBuy_Model_Resource_Report extends Mage_Core_Model_Resource_Db_Abstract{
33
+ protected function _construct()
34
+ {
35
+ $this->_init('laybuy/report', 'id');
36
+ }
37
+
38
+ /**
39
+ * Check if report with same account and report date already fetched
40
+ *
41
+ * @param Ced_LayBuy_Model_Report $report
42
+ * @param string $orderId
43
+ * @param string $reportDate
44
+ * @return Mage_Paypal_Model_Resource_Report_Settlement
45
+ */
46
+ public function loadByOrderId(Ced_LayBuy_Model_Report $report, $order_id)
47
+ {
48
+ $adapter = $this->_getReadAdapter();
49
+ $select = $adapter->select()
50
+ ->from($this->getMainTable())
51
+ ->where("order_id = :order_id AND status!='-2' AND status!='2'");
52
+
53
+ $data = $adapter->fetchRow($select, array(':order_id' => $order_id));
54
+ if ($data) {
55
+ $report->addData($data);
56
+ }
57
+
58
+ return $this;
59
+ }
60
  {
61
  $adapter = $this->_getReadAdapter();
62
  $select = $adapter->select()
63
  ->from($this->getMainTable())
64
  ->where('laybuy_ref_no = :laybuy_ref_no');
65
  $data = $adapter->fetchRow($select, array(':laybuy_ref_no' => $laybuy_ref_no));
66
  if ($data) {
67
  $report->addData($data);
68
  }
69
  return $this;
70
  }
71
+ }
app/code/local/Ced/LayBuy/Model/Resource/Report/Collection.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Lay-Buys
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * 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@magentocommerce.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.magentocommerce.com for more information.
20
+ *
21
+ * @category Ced
22
+ * @package Ced_LayBuy
23
+ * @author Asheesh Singh<asheeshsingh@cedcoss.com>
24
+ * @copyright Copyright LAY-BUYS (2011). (http://lay-buys.com/)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ /**
29
+ * LayBuy Report Collection model
30
+ */
31
+
32
+ class Ced_LayBuy_Model_Resource_Report_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract {
33
+ protected function _construct()
34
+ {
35
+ $this->_init('laybuy/report');
36
+ }
37
+ }
app/code/local/Ced/LayBuy/Model/Resource/Revise.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Lay-Buys
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * 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@magentocommerce.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.magentocommerce.com for more information.
20
+ *
21
+ * @category Ced
22
+ * @package Ced_LayBuy
23
+ * @author Asheesh Singh<asheeshsingh@cedcoss.com>
24
+ * @copyright Copyright LAY-BUYS (2011). (http://lay-buys.com/)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ /**
29
+ * LayBuy Resource Revise model
30
+ */
31
+
32
+ class Ced_LayBuy_Model_Resource_Revise extends Mage_Core_Model_Resource_Db_Abstract{
33
+ protected function _construct()
34
+ {
35
+ $this->_init('laybuy/revise', 'id');
36
+ }
37
+
38
+ /**
39
+ * Check if report with same account and report date already fetched
40
+ *
41
+ * @param Ced_LayBuy_Model_Report $report
42
+ * @param string $orderId
43
+ * @param string $reportDate
44
+ * @return Mage_Paypal_Model_Resource_Report_Settlement
45
+ */
46
+ public function loadByOrderId(Ced_LayBuy_Model_Report $report, $order_id)
47
+ {
48
+ $adapter = $this->_getReadAdapter();
49
+ $select = $adapter->select()
50
+ ->from($this->getMainTable())
51
+ ->where('order_id = :order_id');
52
+
53
+ $data = $adapter->fetchRow($select, array(':order_id' => $order_id));
54
+ if ($data) {
55
+ $report->addData($data);
56
+ }
57
+
58
+ return $this;
59
+ }
60
+ }
app/code/local/Ced/LayBuy/Model/Resource/Revise/Collection.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Lay-Buys
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * 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@magentocommerce.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.magentocommerce.com for more information.
20
+ *
21
+ * @category Ced
22
+ * @package Ced_LayBuy
23
+ * @author Asheesh Singh<asheeshsingh@cedcoss.com>
24
+ * @copyright Copyright LAY-BUYS (2011). (http://lay-buys.com/)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ /**
29
+ * LayBuy Revise Collection model
30
+ */
31
+
32
+ class Ced_LayBuy_Model_Resource_Revise_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract {
33
+ protected function _construct()
34
+ {
35
+ $this->_init('laybuy/revise');
36
+ }
37
+ }
app/code/local/Ced/LayBuy/Model/Resource/Setup.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Lay-Buys
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * 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@magentocommerce.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.magentocommerce.com for more information.
20
+ *
21
+ * @category Ced
22
+ * @package Ced_LayBuy
23
+ * @author Asheesh Singh<asheeshsingh@cedcoss.com>
24
+ * @copyright Copyright LAY-BUYS (2011). (http://lay-buys.com/)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ /**
29
+ * LayBuy Resource Setup model
30
+ */
31
+
32
+ class Ced_LayBuy_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup
33
+ {
34
+ }
app/code/local/Ced/LayBuy/Model/Revise.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Lay-Buys
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * 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@magentocommerce.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.magentocommerce.com for more information.
20
+ *
21
+ * @category Ced
22
+ * @package Ced_LayBuy
23
+ * @author Asheesh Singh<asheeshsingh@cedcoss.com>
24
+ * @copyright Copyright LAY-BUYS (2011). (http://lay-buys.com/)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ /**
29
+ * LayBuy Revise model
30
+ */
31
+
32
+ class Ced_LayBuy_Model_Revise extends Mage_Core_Model_Abstract
33
+ {
34
+ /**
35
+ * Initialize resource model
36
+ */
37
+ protected function _construct()
38
+ {
39
+ $this->_init('laybuy/revise');
40
+ }
41
+ }
app/code/local/Ced/LayBuy/Model/Standard.php ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Lay-Buys
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * 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@magentocommerce.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.magentocommerce.com for more information.
20
+ *
21
+ * @category Ced
22
+ * @package Ced_LayBuy
23
+ * @author Asheesh Singh<asheeshsingh@cedcoss.com>
24
+ * @copyright Copyright LAY-BUYS (2011). (http://lay-buys.com/)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ /**
29
+ * LayBuy Standard Checkout Module
30
+ */
31
+
32
+ class Ced_LayBuy_Model_Standard extends Mage_Payment_Model_Method_Abstract
33
+ {
34
+ public $_code = 'laybuy';
35
+ protected $_formBlockType = 'laybuy/form_laybuy';
36
+ protected $_infoBlockType = 'laybuy/info_laybuy';
37
+ protected $_isInitializeNeeded = true;
38
+ protected $_canUseInternal = false;
39
+ protected $_canUseForMultishipping = false;
40
+
41
+ /**
42
+ * Return Order place redirect url
43
+ * @return string
44
+ */
45
+ public function getOrderPlaceRedirectUrl()
46
+ {
47
+ //when you click on place order you will be redirected on this url, if you don't want this action remove this method
48
+ return Mage::getUrl('laybuy/standard/redirect', array('_secure' => true));
49
+ }
50
+ /**
51
+ * Check whether payment method can be used
52
+ * @param Mage_Sales_Model_Quote
53
+ * @return bool
54
+ */
55
+ public function isAvailable($quote = null)
56
+ {
57
+ if ($status = parent::isAvailable($quote)) {
58
+
59
+ $storeId = $quote->getStoreId();
60
+
61
+ /* Condition for minimum checkout amount for method availability */
62
+ $configTotal = Mage::getStoreConfig('laybuy/conditional_criteria/total',$storeId);
63
+ $total = $quote->getData('grand_total');
64
+ if($status && $configTotal){
65
+ if($configTotal<$total){
66
+ $status = true;
67
+ }else{
68
+ $status = false;
69
+ }
70
+ }
71
+
72
+ /* Condition for customer groups for method availability */
73
+ if($status){
74
+ $configCustomerGroupId = explode(',',Mage::getStoreConfig('laybuy/conditional_criteria/customergroup',$storeId ));
75
+ $customerGroupId = $quote->getData('customer_group_id');
76
+ if($configCustomerGroupId && in_array($customerGroupId,$configCustomerGroupId)){
77
+ $status = true;
78
+ }else{
79
+ $status = false;
80
+ }
81
+ }
82
+
83
+ return $status;
84
+ }
85
+ }
86
+
87
+ /**
88
+ * Validate payment method information object
89
+ *
90
+ * @return Mage_Payment_Model_Abstract
91
+ */
92
+ public function validate()
93
+ {
94
+ /**
95
+ * to validate payment method is allowed for billing country or not
96
+ */
97
+ parent::validate();
98
+
99
+ $paymentInfo = $this->getInfoInstance();
100
+ if ($paymentInfo instanceof Mage_Sales_Model_Order_Payment) {
101
+ $cartItems = $paymentInfo->getOrder()->getAllItems();
102
+ } else {
103
+ $cartItems = $paymentInfo->getQuote()->getAllItems();
104
+ }
105
+ $flagArr = $this->canUseForCategories($cartItems);
106
+ if (!$flagArr[0]) {
107
+ Mage::throwException(Mage::helper('laybuy')->__('Selected payment type is not allowed for '.$flagArr[1].' products.'));
108
+ }
109
+ return $this;
110
+ }
111
+
112
+ /**
113
+ * To check billing country is allowed for the payment method
114
+ *
115
+ * @return bool
116
+ */
117
+ public function canUseForCategories($cartItems = array())
118
+ {
119
+ /*
120
+ for specific categories, the flag will set up as 1
121
+ */
122
+ $status = true;
123
+ $productName = '';
124
+ $configCategories = explode(',',Mage::getStoreConfig('laybuy/conditional_criteria/categories',$storeId ));
125
+ if($configCategories){
126
+ foreach($cartItems as $_product){
127
+ $_product = Mage::getModel('catalog/product')->load($_product->getProductId());
128
+ if(count(array_intersect($_product->getCategoryIds(),$configCategories))==0){
129
+ $status = false;
130
+ $productName .= $_product->getName().',';
131
+ }
132
+ }
133
+ $productName = rtrim($productName,',');
134
+ }
135
+ return array($status,$productName);
136
+ }
137
+ }
app/code/local/Ced/LayBuy/Model/System/Config/Backend/Cron.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Lay-Buys
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * 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@magentocommerce.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.magentocommerce.com for more information.
20
+ *
21
+ * @category Ced
22
+ * @package Ced_LayBuy
23
+ * @author Asheesh Singh<asheeshsingh@cedcoss.com>
24
+ * @copyright Copyright LAY-BUYS (2011). (http://lay-buys.com/)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ class Ced_LayBuy_Model_System_Config_Backend_Cron extends Mage_Core_Model_Config_Data
29
+ {
30
+ const CRON_STRING_PATH = 'crontab/jobs/LayBuy_Automated_Fetch_Updates/schedule/cron_expr';
31
+ const CRON_MODEL_PATH_INTERVAL = 'laybuy/fetch_reports/schedule';
32
+
33
+ /**
34
+ * Cron settings after save
35
+ * @return void
36
+ */
37
+ protected function _afterSave()
38
+ {
39
+ $cronExprString = '';
40
+ $time = explode(',', Mage::getModel('core/config_data')->load('laybuy/fetch_reports/time', 'path')->getValue());
41
+ if (Mage::getModel('core/config_data')->load('laybuy/fetch_reports/active', 'path')->getValue()) {
42
+ $interval = Mage::getModel('core/config_data')->load(self::CRON_MODEL_PATH_INTERVAL, 'path')->getValue();
43
+ $cronExprString = "{$time[1]} {$time[0]} */{$interval} * *";
44
+ }
45
+
46
+ Mage::getModel('core/config_data')
47
+ ->load(self::CRON_STRING_PATH, 'path')
48
+ ->setValue($cronExprString)
49
+ ->setPath(self::CRON_STRING_PATH)
50
+ ->save();
51
+
52
+ return parent::_afterSave();
53
+ }
54
+ }
app/code/local/Ced/LayBuy/Model/System/Config/Source/Categories - bkp.php ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * 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@magentocommerce.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.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Adminhtml
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Config category source
29
+ *
30
+ * @category Mage
31
+ * @package Mage_Adminhtml
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Ced_LayBuy_Model_System_Config_Source_Categories
35
+ {
36
+ // public function toOptionArray($addEmpty = true)
37
+ // {
38
+ // $tree = Mage::getResourceModel('catalog/category_tree');
39
+
40
+ // $collection = Mage::getResourceModel('catalog/category_collection');
41
+
42
+ // $collection->addAttributeToSelect('name')
43
+ // /* ->addRootLevelFilter() */
44
+ // ->load();
45
+
46
+ // $options = array();
47
+
48
+ // /* if ($addEmpty) {
49
+ // $options[] = array(
50
+ // 'label' => Mage::helper('adminhtml')->__('-- Please Select a Category --'),
51
+ // 'value' => ''
52
+ // );
53
+ // } */
54
+ // foreach ($collection as $category) {
55
+ // $options []= array(
56
+ // 'label' => $category->getName(),
57
+ // 'value' => $category->getId()
58
+ // );
59
+ // }
60
+
61
+ // return $options;
62
+ // }
63
+
64
+ public function toOptionArray($addEmpty = true)
65
+ {
66
+ $options = array();
67
+ foreach ($this->load_tree() as $category) {
68
+ /* $options[$category['value']] = $category['label']; */
69
+ $options[] = array(
70
+ 'label' => $category['label'],
71
+ 'value' => $category['value']
72
+ );
73
+ }
74
+
75
+ return $options;
76
+ }
77
+
78
+
79
+
80
+ public function buildCategoriesMultiselectValues(Varien_Data_Tree_Node $node, $values, $level = 0)
81
+ {
82
+ $level++;
83
+ if($node->getId() != '1')
84
+ {
85
+ $values[$node->getId()]['value'] = $node->getId();
86
+ if($node->getLevel() < '2'){
87
+ $values[$node->getId()]['label'] = $node->getName();
88
+ }else{
89
+ $values[$node->getId()]['label'] = str_repeat(" - ", (($node->getLevel())-1)) . $node->getName();
90
+ }
91
+ }
92
+
93
+ foreach ($node->getChildren() as $child)
94
+ {
95
+ $values = $this->buildCategoriesMultiselectValues($child, $values, $level);
96
+ }
97
+
98
+ return $values;
99
+ }
100
+
101
+ public function load_tree()
102
+ {
103
+ $store = Mage::app()->getFrontController()->getRequest()->getParam('store', 0);
104
+ $parentId = $store ? Mage::app()->getStore($store)->getRootCategoryId() : 1; // Current store root category
105
+
106
+ $tree = Mage::getResourceSingleton('catalog/category_tree')->load();
107
+
108
+ $root = $tree->getNodeById($parentId);
109
+
110
+ if($root && $root->getId() == 1)
111
+ {
112
+ $root->setName(Mage::helper('catalog')->__('Root'));
113
+ }
114
+
115
+ $collection = Mage::getModel('catalog/category')->getCollection()
116
+ ->setStoreId($store)
117
+ ->addAttributeToSelect('name')
118
+ ->addAttributeToSelect('is_active');
119
+
120
+ $tree->addCollectionData($collection, true);
121
+
122
+ return $this->buildCategoriesMultiselectValues($root, array());
123
+ }
124
+ }
app/code/local/Ced/LayBuy/Model/System/Config/Source/Categories.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * 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@magentocommerce.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.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Adminhtml
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Config category source
29
+ *
30
+ * @category Mage
31
+ * @package Mage_Adminhtml
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Ced_LayBuy_Model_System_Config_Source_Categories
35
+ {
36
+ public function toOptionArray($addEmpty = true)
37
+ {
38
+ $tree = Mage::getResourceModel('catalog/category_tree');
39
+
40
+ $collection = Mage::getResourceModel('catalog/category_collection');
41
+
42
+ $collection->addAttributeToSelect(array('name'))
43
+ /* ->addRootLevelFilter() */
44
+ ->addFieldToFilter('entity_id',array('neq'=>'1'))
45
+ ->load();
46
+
47
+ $options = array();
48
+
49
+ foreach ($collection as $category) {
50
+ $options []= array(
51
+ 'label' => $category->getName(),
52
+ 'value' => $category->getId()
53
+ );
54
+ }
55
+
56
+ return $options;
57
+ }
58
+ }
app/code/local/Ced/LayBuy/Model/System/Config/Source/FetchingSchedule.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Lay-Buys
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * 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@magentocommerce.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.magentocommerce.com for more information.
20
+ *
21
+ * @category Ced
22
+ * @package Ced_LayBuy
23
+ * @author Asheesh Singh<asheeshsingh@cedcoss.com>
24
+ * @copyright Copyright LAY-BUYS (2011). (http://lay-buys.com/)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+
29
+ /**
30
+ * Source model for available instalment report fetching intervals
31
+ */
32
+ class Ced_LayBuy_Model_System_Config_Source_FetchingSchedule
33
+ {
34
+ public function toOptionArray()
35
+ {
36
+ return array (
37
+ 1 => Mage::helper('laybuy')->__("Daily"),
38
+ 3 => Mage::helper('laybuy')->__("Every 3 days"),
39
+ 7 => Mage::helper('laybuy')->__("Every 7 days"),
40
+ 10 => Mage::helper('laybuy')->__("Every 10 days"),
41
+ 14 => Mage::helper('laybuy')->__("Every 14 days"),
42
+ 30 => Mage::helper('laybuy')->__("Every 30 days"),
43
+ 40 => Mage::helper('laybuy')->__("Every 40 days"),
44
+ );
45
+ }
46
+ }
app/code/local/Ced/LayBuy/Model/System/Config/Source/Groups.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Lay-Buys
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * 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@magentocommerce.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.magentocommerce.com for more information.
20
+ *
21
+ * @category Ced
22
+ * @package Ced_LayBuy
23
+ * @author Asheesh Singh<asheeshsingh@cedcoss.com>
24
+ * @copyright Copyright LAY-BUYS (2011). (http://lay-buys.com/)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+
29
+ /**
30
+ * Source model for available customer groups
31
+ */
32
+ class Ced_LayBuy_Model_System_Config_Source_Groups
33
+ {
34
+ public function toOptionArray($addEmpty = false)
35
+ {
36
+ $options = array();
37
+
38
+ if ($addEmpty) {
39
+ $options[] = array(
40
+ 'label' => Mage::helper('laybuy')->__('-- Please Select a Customer Group --'),
41
+ 'value' => ''
42
+ );
43
+ }
44
+ $options = Mage::getResourceModel('customer/group_collection')->toOptionArray();
45
+
46
+ return $options;
47
+ }
48
+ }
app/code/local/Ced/LayBuy/README.txt ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Integration Process
2
+
3
+ The Lay-Buys gateway has a simple and flexible design. With minimal technical knowledge, your shopping cart can be integrated into the Lay-Buys gateway fairly easily.
4
+
5
+ Just 5 easy steps and you too can be offering a flexible, affordable payment plan in LAY-BUY to all online shoppers and where all payments are processed by PayPal. The following 5 steps show how the Lay-Buys gateway works:
6
+
7
+ Register an account in our Lay-Buys Virtual Terminal (VT)
8
+
9
+ You can register an account HERE.
10
+
11
+ Enter your PayPal API signature
12
+
13
+ Simply copy and paste your PayPal API signature into your VT account.
14
+
15
+ Submit a form with five mandatory fields
16
+
17
+ On the checkout page of your shopping cart, five mandatory input fields is required. When the LAY-BUY checkout button is clicked, the information is submitted to our gateway.
18
+
19
+ The five mandatory fields are:
20
+ MEMBER - a unique ID is allocated once you register an account in VT
21
+ RETURNURL - the URL of your shopping cart after a successful transaction
22
+ CANCELURL - the URL of your shopping cart after a cancelled or failed transaction
23
+ AMOUNT - the total sale amount of the transaction checked out
24
+ CURRENCY - the currency of the sale, in format of the 3-digit International currency symbol (AUD, USD, GBP, etc.)
25
+
26
+ The complete set of input fields can be found HERE
27
+
28
+ When choosing, the checkout button, it is strongly recommended that our PUT IT ON LAY-BUY button (Figure 1) should be used. Although it is optional, our button provides the similar look and feel to other PayPal checkout buttons, that may increase the customer's confidence in purchasing products on your site. The image can be downloaded HERE.
29
+
30
+ Lay-Buy image
31
+ Figure 1: PUT IT ON LAY-BUY button
32
+
33
+ (Optional) Update your shopping cart database using the returned information from the Lay-Buys gateway
34
+
35
+ Once transaction is completed, the Lay-Buys gateway returns information about the payer personal details as well as the payment plan. This information can then be stored in your shopping cart database if required.
36
+
37
+ Seek an approval from Lay-Buys when your cart is ready to be in production
38
+
39
+ Before a real transaction is processed, you must seek an approval from Lay-Buys.
40
+
41
+ Check progressive payments
42
+ Once a transaction is complete, merchants can check the payment progress in their Lay-Buys VT account, while your buyer can check the payment progress in the Lay-Buys member's control panel.
43
+
44
+
45
+ For more information please visit http://lay-buys.com/developer.php
app/code/local/Ced/LayBuy/controllers/Adminhtml/ReportController.php ADDED
@@ -0,0 +1,375 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Lay-Buys
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * 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@magentocommerce.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.magentocommerce.com for more information.
20
+ *
21
+ * @category Ced
22
+ * @package Ced_LayBuy
23
+ * @author Asheesh Singh<asheeshsingh@cedcoss.com>
24
+ * @copyright Copyright LAY-BUYS (2011). (http://lay-buys.com/)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ /**
29
+ * LayBuy Instalment Reports Controller
30
+ *
31
+ * @category Ced
32
+ * @package Ced_LayBuy
33
+ * @author Asheesh Singh<asheeshsingh@cedcoss.com>
34
+ */
35
+ class Ced_LayBuy_Adminhtml_ReportController extends Mage_Adminhtml_Controller_Action
36
+ {
37
+
38
+ /**
39
+ * Grid action
40
+ */
41
+ public function indexAction()
42
+ {
43
+ $this->_initAction()
44
+ ->_addContent($this->getLayout()->createBlock('laybuy/adminhtml_report'))
45
+ ->renderLayout();
46
+ }
47
+
48
+ /**
49
+ * Ajax callback for grid actions
50
+ */
51
+ public function gridAction()
52
+ {
53
+ $this->loadLayout();
54
+ $this->getResponse()->setBody(
55
+ $this->getLayout()->createBlock('laybuy/adminhtml_report_grid')->toHtml()
56
+ );
57
+ }
58
+
59
+ /**
60
+ * View transaction details action
61
+ */
62
+ public function detailsAction()
63
+ {
64
+ $rowId = $this->getRequest()->getParam('id');
65
+ $row = Mage::getModel('laybuy/report')->load($rowId);
66
+ if (!$row->getId()) {
67
+ $this->_redirect('*/*/');
68
+ return;
69
+ }
70
+ Mage::register('current_laybuy_transaction', $row);
71
+ $this->_initAction()
72
+ ->_title($this->__('View Transaction'))
73
+ ->_addContent($this->getLayout()->createBlock('laybuy/adminhtml_report_details', 'laybuyInstalmentDetails'))
74
+ ->renderLayout();
75
+ }
76
+
77
+ /**
78
+ * Forced fetch reports action
79
+ */
80
+ public function fetchAction()
81
+ {
82
+ try {
83
+ $reports = Mage::getModel('laybuy/report');
84
+ /* @var $reports Mage_laybuy_Model_Report_Instalment */
85
+ $credentials = $reports->getApiCredentials();
86
+ if (empty($credentials)) {
87
+ Mage::throwException(Mage::helper('laybuy')->__('Nothing to fetch because of an empty configuration.'));
88
+ }
89
+ foreach ($credentials as $config) {
90
+ try {
91
+ $fetched = $reports->fetchAndSave($config);
92
+ if($fetched){
93
+ $this->_getSession()->addSuccess(
94
+ Mage::helper('laybuy')->__("Fetched %s report rows from '%s'.", $fetched, $config['hostname'])
95
+ );
96
+ }else{
97
+ $this->_getSession()->addSuccess(
98
+ Mage::helper('laybuy')->__("There is no new Transaction.")
99
+ );
100
+ }
101
+ } catch (Exception $e) {
102
+ $this->_getSession()->addError(
103
+ Mage::helper('laybuy')->__("Failed to fetch reports from '%s'.%s", $config['hostname'],$e->getMessage())
104
+ );
105
+ Mage::logException($e);
106
+ }
107
+ }
108
+ } catch (Mage_Core_Exception $e) {
109
+ $this->_getSession()->addError($e->getMessage());
110
+ } catch (Exception $e) {
111
+ Mage::logException($e);
112
+ }
113
+ $this->_redirect('*/*/index');
114
+ }
115
+
116
+ /**
117
+ * Edit transaction details action
118
+ */
119
+ public function editAction()
120
+ {
121
+ $rowId = $this->getRequest()->getParam('id');
122
+ $row = Mage::getModel('laybuy/report')->load($rowId);
123
+ if (!$row->getId()) {
124
+ $this->_redirect('*/*/');
125
+ return;
126
+ }
127
+ Mage::register('current_laybuy_transaction_edit', $row);
128
+ $this->_initAction()
129
+ ->_title($this->__('Edit Transaction'))
130
+ ->_addContent($this->getLayout()->createBlock('laybuy/adminhtml_report_edit', 'laybuyInstalmentEdit'))
131
+ ->renderLayout();
132
+ }
133
+
134
+ /**
135
+ * Save transaction details action
136
+ */
137
+ public function saveAction()
138
+ {
139
+ $rowId = $this->getRequest()->getParam('id');
140
+ $data = $this->getRequest()->getParams();
141
+ print_r($data);die;
142
+ $reportModel = Mage::getModel('laybuy/report')->load($rowId);
143
+
144
+ $temp = array();
145
+ $temp['original']= $temp['new']= $reportModel->getData();
146
+ $temp['original']['transaction_id'] = $temp['new']['transaction_id'] = $reportModel->getId();
147
+ $temp['original']['type'] = 'original';
148
+ $temp['new']['type'] = 'new';
149
+ $temp['new']['amount'] = $data['amount'];
150
+ $temp['new']['months'] = $data['months'];
151
+ $temp['new']['first_payment_due'] = $data['first_payment_due'];
152
+ $temp['new']['last_payment_due'] = $data['last_payment_due'];
153
+ $temp['new']['months'] = $data['months'];
154
+ $temp['new']['email'] = $data['email'];
155
+ $temp['new']['downpayment'] = $data['dp_amount'];
156
+ $temp['new']['downpayment_amount'] = $data['downpayment_amount'];
157
+ $temp['new']['payment_amounts'] = $data['payment_amounts'];
158
+ $temp['new']['created_at'] = date('Y-m-d h:i:s',time());
159
+ $temp['new']['report'] = $data['report'];
160
+ $temp['new']['payment_type'] = $data['pp'];/* if($data['pp']){ Lay-Buy Payment }else{ Buy-Now Payment } */
161
+ $temp['new']['status'] = '-2';
162
+ try{
163
+ /* print_r($temp['new']);die; */
164
+ $collection = Mage::getModel('laybuy/revise')->getCollection()->addFieldToFilter('transaction_id',array('eq'=>$temp['new']['id']));
165
+ unset($temp['original']['id']);
166
+ unset($temp['new']['id']);
167
+ if(count($collection)==2){
168
+ foreach($collection as $request){
169
+ if($request->getType()=='original'){
170
+ $request->addData($temp['original'])->setId($request->getId())->save();
171
+ }
172
+ if($request->getType()=='new'){
173
+ $revise = $request->addData($temp['new'])->setId($request->getId())->save();
174
+ }
175
+ }
176
+ }else{
177
+ $reviseModelbkp = Mage::getModel('laybuy/revise')->setData($temp['original'])->save();
178
+ $revise = $reviseModel = Mage::getModel('laybuy/revise')->setData($temp['new'])->save();
179
+ }
180
+
181
+ if(Mage::helper('laybuy')->revisePlan($revise)){
182
+
183
+ $reportModel->setStatus(-2)->save();
184
+ $this->_getSession()->addSuccess(
185
+ Mage::helper('laybuy')->__("Request was saved and email sent to %s for order#%s",$revise->getEmail(),$revise->getOrderId())
186
+ );
187
+ }else{
188
+ $this->_getSession()->addError(
189
+ Mage::helper('laybuy')->__("Failed to modify Plan")
190
+ );
191
+ }
192
+ }catch(Exception $e){
193
+ $this->_getSession()->addError(
194
+ Mage::helper('laybuy')->__("Failed to modify Plan")
195
+ );
196
+ Mage::logException($e);
197
+ }
198
+
199
+ $this->_redirect('*/*/details',array('id'=>$rowId));
200
+
201
+ }
202
+
203
+ /**
204
+ * Forced to cancel transaction action
205
+ */
206
+ public function cancelAction(){
207
+ $id = $this->getRequest()->getParam('id');
208
+ $model = Mage::getModel('laybuy/report')->load($id);
209
+ Mage::log('Action cancel transaction called',null,'laybuy_success.log');
210
+ try{
211
+ /* $model->setReport($newStr)->setStatus(-1)->save(); */
212
+ if(Mage::helper('laybuy')->cancelTransaction($model)){
213
+ $this->_getSession()->addSuccess(
214
+ Mage::helper('laybuy')->__("Transaction was cancelled successfully.")
215
+ );
216
+ }else{
217
+ $this->_getSession()->addError(
218
+ 'Cancel request was unsuccessful.Please try again!!'
219
+ );
220
+ }
221
+ }catch (Exception $e) {
222
+ $this->_getSession()->addError(
223
+ $e->getMessage()
224
+ );
225
+ Mage::logException($e);
226
+ }
227
+ $this->_redirect('*/*/details',array('id'=>$id));
228
+ }
229
+
230
+ /**
231
+ * Initialize titles, navigation
232
+ * @return Mage_laybuy_Adminhtml_laybuy_ReportsController
233
+ */
234
+ protected function _initAction()
235
+ {
236
+ $this->_title($this->__('Reports'))->_title($this->__('Sales'))->_title(Mage::helper('laybuy')->__('Lay-Buy Instalment Reports'));
237
+ $this->loadLayout()
238
+ ->_setActiveMenu('report/sales')
239
+ ->_addBreadcrumb($this->__('Reports'), Mage::helper('laybuy')->__('Reports'))
240
+ ->_addBreadcrumb($this->__('Sales'), Mage::helper('laybuy')->__('Sales'))
241
+ ->_addBreadcrumb(Mage::helper('laybuy')->__('Lay-Buy Instalment Reports'), Mage::helper('laybuy')->__('Lay-Buy Instalment Reports'));
242
+ return $this;
243
+ }
244
+
245
+ /**
246
+ * ACL check
247
+ * @return bool
248
+ */
249
+ protected function _isAllowed()
250
+ {
251
+ switch ($this->getRequest()->getActionName()) {
252
+ case 'index':
253
+ case 'details':
254
+ return Mage::getSingleton('admin/session')->isAllowed('report/salesroot/laybuyreport/view');
255
+ break;
256
+ case 'fetch':
257
+ return Mage::getSingleton('admin/session')->isAllowed('report/salesroot/laybuyreport/fetch');
258
+ break;
259
+ case 'edit':
260
+ case 'save':
261
+ return Mage::getSingleton('admin/session')->isAllowed('report/salesroot/laybuyreport/update');
262
+ break;
263
+ case 'cancel':
264
+ return Mage::getSingleton('admin/session')->isAllowed('report/salesroot/laybuyreport/cancel');
265
+ break;
266
+ default:
267
+ return Mage::getSingleton('admin/session')->isAllowed('report/salesroot/laybuyreport');
268
+ break;
269
+ }
270
+ }
271
+
272
+ public function exportCsvAction()
273
+ {
274
+ $fileName = 'Lay-BuyTransaction'.time().'.csv';
275
+ $content = $this->getLayout()->createBlock('laybuy/adminhtml_report_grid')
276
+ ->getCsv();
277
+
278
+ $this->_sendUploadResponse($fileName, $content);
279
+ }
280
+
281
+ public function exportXmlAction()
282
+ {
283
+ $fileName = 'Lay-BuyTransaction'.time().'.xml';
284
+ $content = $this->getLayout()->createBlock('laybuy/adminhtml_report_grid')
285
+ ->getXml();
286
+
287
+ $this->_sendUploadResponse($fileName, $content);
288
+ }
289
+
290
+ protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
291
+ {
292
+ $response = $this->getResponse();
293
+ $response->setHeader('HTTP/1.1 200 OK','');
294
+ $response->setHeader('Pragma', 'public', true);
295
+ $response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
296
+ $response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
297
+ $response->setHeader('Last-Modified', date('r'));
298
+ $response->setHeader('Accept-Ranges', 'bytes');
299
+ $response->setHeader('Content-Length', strlen($content));
300
+ $response->setHeader('Content-type', $contentType);
301
+ $response->setBody($content);
302
+ $response->sendResponse();
303
+ die;
304
+ }
305
+
306
+ public function docalcAction(){
307
+ $header = '<html>';
308
+ $header .= '<head>';
309
+ $header .= '<link media="all" href="'.Mage::getBaseUrl('skin').'adminhtml/default/default/reset.css" type="text/css" rel="stylesheet">';
310
+ $header .= '<link media="all" href="'.Mage::getBaseUrl('skin').'adminhtml/default/default/boxes.css" type="text/css" rel="stylesheet">';
311
+ $header .= '</head>';
312
+ $header .= '<body style="font: 12px/1.5em; background: none repeat scroll 0 0 rgba(0, 0, 0, 0);">';
313
+ $header .= '<div class="grid">';
314
+ $header .= '<div class="hor-scroll">';
315
+ $html = '<table cellspacing="0" class="data">';
316
+ $html .= '<colgroup>
317
+ <col width="175">
318
+ <col width="183">
319
+ <col width="98">
320
+ </colgroup>';
321
+
322
+ $tod=time();
323
+
324
+ $isLeap = 0;
325
+ $isLeap = Date('L',$tod);
326
+ if($isLeap)
327
+ $dim=array(31,31,29,31,30,31,30,31,31,30,31,30,31);
328
+ else
329
+ $dim=array(31,31,28,31,30,31,30,31,31,30,31,30,31);
330
+
331
+ $day=Date('d',$tod);
332
+ $mth=Date('m',$tod);
333
+ $yr=Date('Y',$tod);
334
+ $mnth=$this->getRequest()->getParam('mnth');
335
+ $hght=150 / (2 + $mnth);
336
+ $html .= '<thead><tr class="headings"><th class=" no-link" style="text-align: center; font-size: 0.7em; padding-bottom: 4px; padding-top: 4px;"><span class="nobr">Payment</span></th><th class=" no-link" style="text-align: center; font-size: 0.7em; padding-bottom: 4px; padding-top: 4px;"><span class="nobr">Due Date</span></th><th class=" no-link" style="text-align: center; font-size: 0.7em; padding-bottom: 4px; padding-top: 4px;"><span class="nobr">Amount</span></th></tr></thead>';
337
+ $init=$this->getRequest()->getParam('init');
338
+ $amt=$this->getRequest()->getParam('amt');
339
+ $currency = $this->getRequest()->getParam('currency');
340
+ $dep=$amt*$init/100;
341
+ $rest=number_format(($amt-$dep)/$mnth,2,'.','');
342
+ $dep=number_format($amt - $rest * $mnth,2,'.','');
343
+ $html .= '<tbody><tr class="even" ><td style="text-align: center;">DownPayment</td><td style="text-align: center;">Today</td><td style="text-align:right">'.Mage::app()->getLocale()->currency($currency)->toCurrency($dep).'</td></tr>';
344
+ for ($e=1; $e<=$mnth; $e++) {
345
+ if (++$mth>12) {
346
+ $mth='01';
347
+ $yr++;
348
+ }
349
+ $m=1+$mth-1;
350
+ $d=min($day,$dim[$m]);
351
+ $even = '';
352
+ if($e%2==0)
353
+ $even = ' class="even"';
354
+ $date = '';
355
+ $date = $d.'-'.$mth.'-'.$yr;
356
+ $date = Mage::helper('core')->formatDate($date, Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM, true);
357
+ if($e==1){
358
+ $first_payment_due = $date;
359
+ }
360
+ $html .= '<tr'.$even.' ><td style="text-align: center;">'.$e.'</td><td style="text-align: center;">'.$date.'</td><td style="text-align:right">'.Mage::app()->getLocale()->currency($currency)->toCurrency($rest).'</td></tr>';
361
+ }
362
+ $html .= '</tbody>';
363
+ $html .= '</table>';
364
+ $footer = '</div>';
365
+ $footer .= '</div>';
366
+ $footer .= '</body>';
367
+ $footer .= '</html>';
368
+ if($this->getRequest()->getParam('html')){
369
+ echo $header.$html.$footer;
370
+ }else{
371
+ echo $dep.'~'.$rest.'~'.$first_payment_due.'~'.$date.'~'.$html;
372
+ }
373
+ }
374
+
375
+ }
app/code/local/Ced/LayBuy/controllers/ReportController.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Lay-Buys
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * 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@magentocommerce.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.magentocommerce.com for more information.
20
+ *
21
+ * @category Ced
22
+ * @package Ced_LayBuy
23
+ * @author Asheesh Singh<asheeshsingh@cedcoss.com>
24
+ * @copyright Copyright LAY-BUYS (2011). (http://lay-buys.com/)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ /**
29
+ * LayBuy Standard Checkout Controller
30
+ *
31
+ * @category Ced
32
+ * @package Ced_LayBuy
33
+ * @author Asheesh Singh<asheeshsingh@cedcoss.com>
34
+ */
35
+ class Ced_LayBuy_ReportController extends Mage_Core_Controller_Front_Action
36
+ {
37
+ public function preDispatch() {
38
+ parent::preDispatch();
39
+ /* if (!Mage::getStoreConfig('payment/laybuy/active')) {
40
+ $this->norouteAction();
41
+ } */
42
+ }
43
+
44
+ public function detailsAction(){
45
+ $this->loadLayout();
46
+ $this->renderLayout();
47
+ }
48
+
49
+ public function gridAction(){
50
+ $this->loadLayout();
51
+ $this->renderLayout();
52
+ }
53
+ }
app/code/local/Ced/LayBuy/controllers/ReviseController.php ADDED
@@ -0,0 +1,162 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Lay-Buys
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * 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@magentocommerce.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.magentocommerce.com for more information.
20
+ *
21
+ * @category Ced
22
+ * @package Ced_LayBuy
23
+ * @author Asheesh Singh<asheeshsingh@cedcoss.com>
24
+ * @copyright Copyright LAY-BUYS (2011). (http://lay-buys.com/)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ /**
29
+ * LayBuy Standard Checkout Controller
30
+ *
31
+ * @category Ced
32
+ * @package Ced_LayBuy
33
+ * @author Asheesh Singh<asheeshsingh@cedcoss.com>
34
+ */
35
+ class Ced_LayBuy_ReviseController extends Mage_Core_Controller_Front_Action
36
+ {
37
+ /**
38
+ * When a customer cancel payment from laybuy.
39
+ */
40
+ public function cancelAction()
41
+ {
42
+ $session = Mage::getSingleton('checkout/session');
43
+ Mage::log('Revise Order of LayBuy {{'."Order_id=".$order->getId()."|".$this->getRequest()->getParam('ErrorMessage')."}}", null, 'laybuy_failure.log');
44
+ $session->addError($this->getRequest()->getParam('ErrorMessage'));
45
+ $this->_redirect('checkout/onepage/failure');
46
+ }
47
+
48
+ /**
49
+ * when laybuy returns
50
+ * The order information at this point is in POST
51
+ */
52
+ public function successAction()
53
+ {
54
+ $format = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM);
55
+ $status = array_change_key_case($this->getRequest()->getParams(),CASE_LOWER);
56
+
57
+ if(isset($status['result']) && $status['result']=='FAILURE'){
58
+ $this->_forward('cancel');
59
+ }
60
+ $session = Mage::getSingleton('checkout/session');
61
+ try{
62
+ $currentDate = date('d-m-Y h:i:s',time());
63
+ $status['_secure'] = true;
64
+ $str = print_r($status, true);
65
+ $revise = Mage::getModel('laybuy/revise')->load($status['merchants_ref_no']);
66
+ $state = 0;
67
+ if(!isset($status['downpayment']) && !$revise->getPaymentType()){
68
+ $status['downpayment'] = 100;
69
+ $status['months'] = 0;
70
+ $status['downpayment_amount'] = $status['amount'];
71
+ $status['payment_amounts'] = 0;
72
+ $status['first_payment_due'] = $currentDate;
73
+ $status['last_payment_due'] = $currentDate;
74
+ $status['paypal_profile_id'] = '';
75
+ if(Mage::helper('laybuy')->processOrder($status['custom'],1))
76
+ $state = 1;
77
+ }
78
+ Mage::log('Revise Response Array From LayBuy {{'.$str."}} and order status is {{".$state."}}", null, 'laybuy_success.log');
79
+ $status['first_payment_due'] = date('Y-m-d h:i:s', strtotime(str_replace('/','-',$status['first_payment_due'])));
80
+ $status['last_payment_due'] = date('Y-m-d h:i:s', strtotime(str_replace('/','-',$status['last_payment_due'])));
81
+
82
+ $session->setQuoteId($session->getLayBuyStandardQuoteId(true));
83
+ Mage::getSingleton('checkout/session')->getQuote()->setIsActive(false)->save();
84
+ $order = Mage::getModel('sales/order');
85
+ $order->loadByIncrementId($status['custom']);
86
+
87
+ if($order && $order->getId()){
88
+ $createdAt = Mage::helper('core')->formatDate($currentDate, Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM, true);
89
+ $payment_info = $order->getPayment()->getData('additional_information');
90
+
91
+
92
+ $payment_info['transactions'][$status['paypal_profile_id']][] = array(
93
+ 'txnID' => $status['dp_paypal_txn_id'],
94
+ 'type' => 'd',
95
+ 'paymentStatus' => 'Completed',
96
+ 'paymentDate' => $createdAt,
97
+ 'amount' => $status['downpayment_amount']
98
+ );
99
+
100
+ $order->getPayment()->setData('additional_information',$payment_info);
101
+
102
+ $order->save();
103
+
104
+
105
+ /* $createdAt = Mage::helper('core')->formatDate($order->getCreatedAt(), Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM, true); */
106
+ $newStr = '<div class="grid"><div class="hor-scroll"><table cellspacing=0 class="data"><thead><tr class="headings"><th colspan=2 class=" no-link" style="text-align: center;"><span class="nobr">Instalment</span></th><th class=" no-link" style="text-align: center;"><span class="nobr">Date</span></th><th class=" no-link" style="text-align: center;"><span class="nobr">PayPal Transaction ID</span></th><th class=" no-link" style="text-align: center;"><span class="nobr">Status</span></th></tr></thead>';
107
+ $newStr .= '<colgroup>
108
+ <col width="100">
109
+ <col width="75">
110
+ <col width="183">
111
+ <col width="183">
112
+ <col width="98">
113
+ </colgroup>';
114
+ $months = (int)$status['months'];
115
+ $newStr .= '<tbody><tr class="even" ><td style="text-align: center;"> DP: </td><td style="text-align: center;"> '.Mage::app()->getLocale()->currency($status['currency'])->toCurrency($status['downpayment_amount']).' </td>'.
116
+ '<td style="text-align: center;"> '.$createdAt.' </td>'.
117
+ '<td style="text-align: center;">'.$status['dp_paypal_txn_id'].'</td>'.
118
+ '<td style="text-align: center;"> Completed </td></tr>';
119
+
120
+ for($month=1;$month<=$months;$month++){
121
+ $newStr .= '<tr ';
122
+ if($month%2==0)
123
+ $newStr .= 'class="even"';
124
+ $newStr .= '>';
125
+ $newStr .= '<td style="text-align: center;"> Month '.$month.': </td><td style="text-align: center;"> '.Mage::app()->getLocale()->currency($status['currency'])->toCurrency($status['payment_amounts']).' </td>';
126
+ $date = date("Y-m-d h:i:s", strtotime($status['first_payment_due'] . " +".($month-1)." month"));
127
+ $date = Mage::helper('core')->formatDate($date, Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM, true);
128
+ $newStr .= '<td style="text-align: center;"> '.$date.' </td>';
129
+ $newStr .= '<td style="text-align: center;">&nbsp;</td>';
130
+ $newStr .= '<td style="text-align: center;"> Pending </td></tr>';
131
+ }
132
+
133
+ $newStr .= '</tbody></table></div></div>';
134
+ $model = Mage::getModel('laybuy/report')->setData($status)
135
+ ->setOrderId($status['custom'])
136
+ ->setStoreId($order->getStoreId())
137
+ ->setCreatedAt($createdAt)
138
+ ->setStatus($state)
139
+ ->setReport($newStr)
140
+ /* ->setTransaction(0) */
141
+ ->save();
142
+ $oldTransaction = Mage::getModel('laybuy/report')->load($revise->getTransactionId());
143
+ $newStrReport = preg_replace('/Pending/i', 'Canceled', $oldTransaction->getReport());
144
+ if(Mage::helper('laybuy')->cancelPaypalProfile($oldTransaction->getPaypalProfileId(),$oldTransaction->getStoreId())){
145
+ $oldTransaction->setStatus(2)->setReport($newStrReport)->save();
146
+ $revise->delete();
147
+ }
148
+ }
149
+ $session->addSuccess($this->__('Payment was revised successfully.'));
150
+ }catch(Exception $e){
151
+ $status = array_change_key_case($this->getRequest()->getParams(),CASE_LOWER);
152
+ if($status){
153
+ $str = print_r($status, true);
154
+ $session->addError($this->__('Payment Recieved.But transaction not saved please contact with us.'));
155
+ Mage::log('Revise Exception Order of LayBuy {{'."Order_id=".$status['custom']."|".$status['errormessage']."|".'Response Array From LayBuy {{'.$status."}} and exception is {{".$e->getMessage()."}}", null, 'laybuy_failure.log');
156
+ }else{
157
+ $session->addError($this->__('Try Again Later.'));
158
+ }
159
+ }
160
+ $this->_redirect('checkout/onepage/success');
161
+ }
162
+ }
app/code/local/Ced/LayBuy/controllers/StandardController.php ADDED
@@ -0,0 +1,426 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+
5
+ * Lay-Buys
6
+
7
+ *
8
+
9
+ * NOTICE OF LICENSE
10
+
11
+ *
12
+
13
+ * This source file is subject to the Open Software License (OSL 3.0)
14
+
15
+ * that is bundled with this package in the file LICENSE.txt.
16
+
17
+ * It is also available through the world-wide-web at this URL:
18
+
19
+ * http://opensource.org/licenses/osl-3.0.php
20
+
21
+ * If you did not receive a copy of the license and are unable to
22
+
23
+ * obtain it through the world-wide-web, please send an email
24
+
25
+ * to license@magentocommerce.com so we can send you a copy immediately.
26
+
27
+ *
28
+
29
+ * DISCLAIMER
30
+
31
+ *
32
+
33
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
34
+
35
+ * versions in the future. If you wish to customize Magento for your
36
+
37
+ * needs please refer to http://www.magentocommerce.com for more information.
38
+
39
+ *
40
+
41
+ * @category Ced
42
+
43
+ * @package Ced_LayBuy
44
+
45
+ * @author Asheesh Singh<asheeshsingh@cedcoss.com>
46
+
47
+ * @copyright Copyright LAY-BUYS (2011). (http://lay-buys.com/)
48
+
49
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
50
+
51
+ */
52
+
53
+
54
+
55
+ /**
56
+
57
+ * LayBuy Standard Checkout Controller
58
+
59
+ *
60
+
61
+ * @category Ced
62
+
63
+ * @package Ced_LayBuy
64
+
65
+ * @author Asheesh Singh<asheeshsingh@cedcoss.com>
66
+
67
+ */
68
+
69
+ class Ced_LayBuy_StandardController extends Mage_Core_Controller_Front_Action
70
+
71
+ {
72
+
73
+ /**
74
+
75
+ * Order instance
76
+
77
+ */
78
+
79
+ protected $_order;
80
+
81
+
82
+
83
+ /**
84
+
85
+ * Get order
86
+
87
+ *
88
+
89
+ * @return Mage_Sales_Model_Order
90
+
91
+ */
92
+
93
+ public function getOrder()
94
+
95
+ {
96
+
97
+ if ($this->_order == null) {
98
+
99
+ }
100
+
101
+ return $this->_order;
102
+
103
+ }
104
+
105
+ /**
106
+
107
+ * Send expire header to ajax response
108
+
109
+ *
110
+
111
+ */
112
+
113
+ protected function _expireAjax()
114
+
115
+ {
116
+
117
+ if (!Mage::getSingleton('checkout/session')->getQuote()->hasItems()) {
118
+
119
+ $this->getResponse()->setHeader('HTTP/1.1','403 Session Expired');
120
+
121
+ exit;
122
+
123
+ }
124
+
125
+ }
126
+
127
+
128
+
129
+ /**
130
+
131
+ * Get singleton with laybuy strandard order transaction information
132
+
133
+ *
134
+
135
+ * @return Mage_LayBuy_Model_Standard
136
+
137
+ */
138
+
139
+ public function getStandard()
140
+
141
+ {
142
+
143
+ return Mage::getSingleton('laybuy/standard');
144
+
145
+ }
146
+
147
+
148
+
149
+ /**
150
+
151
+ * When a customer chooses LayBuy on Checkout/Payment page
152
+
153
+ *
154
+
155
+ */
156
+
157
+ public function redirectAction()
158
+
159
+ {
160
+
161
+ $session = Mage::getSingleton('checkout/session');
162
+
163
+ $session->setLayBuyStandardQuoteId($session->getQuoteId());
164
+
165
+ $this->getResponse()->setBody($this->getLayout()->createBlock('Ced_LayBuy_Block_Standard_Redirect')->toHtml());
166
+
167
+ $session->unsQuoteId();
168
+
169
+ $session->unsRedirectUrl();
170
+
171
+ }
172
+
173
+
174
+
175
+ /**
176
+
177
+ * When a customer cancel payment from laybuy.
178
+
179
+ */
180
+
181
+ public function cancelAction()
182
+
183
+ {
184
+
185
+ $session = Mage::getSingleton('checkout/session');
186
+
187
+ $session->setQuoteId($session->getLayBuyStandardQuoteId(true));
188
+
189
+ if ($session->getLastRealOrderId()) {
190
+
191
+ $order = Mage::getModel('sales/order')->loadByIncrementId($session->getLastRealOrderId());
192
+
193
+ if ($order->getId()) {
194
+
195
+ $order->cancel()->save();
196
+
197
+ Mage::log('Canceled Order of LayBuy {{'."Order_id=".$order->getId()."|".$this->getRequest()->getParam('ErrorMessage')."}}", null, 'laybuy_failure.log');
198
+
199
+ }
200
+
201
+ }
202
+
203
+ $session->addError($this->getRequest()->getParam('ErrorMessage','Try Again Later.'));
204
+
205
+ $this->_redirect('checkout/onepage/failure');
206
+
207
+ }
208
+
209
+
210
+
211
+ /**
212
+
213
+ * when laybuy returns
214
+
215
+ * The order information at this point is in POST
216
+
217
+ */
218
+
219
+ public function successAction()
220
+
221
+ {
222
+
223
+ $format = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM);
224
+
225
+ $status = array_change_key_case($this->getRequest()->getParams(),CASE_LOWER);
226
+
227
+
228
+
229
+ if(isset($status['result']) && $status['result']=='FAILURE'){
230
+
231
+ $this->_forward('cancel');
232
+
233
+ }
234
+
235
+ $session = Mage::getSingleton('checkout/session');
236
+
237
+ try{
238
+
239
+ $status['_secure'] = true;
240
+
241
+ $str = print_r($status, true);
242
+
243
+ /* $status['first_payment_due'] = '13/12/13';
244
+
245
+ $status['last_payment_due'] = '13/01/14'; */
246
+
247
+ $status['first_payment_due'] = date('Y-m-d h:i:s', strtotime(str_replace('/','-',$status['first_payment_due'])));
248
+
249
+ $status['last_payment_due'] = date('Y-m-d h:i:s', strtotime(str_replace('/','-',$status['last_payment_due'])));
250
+
251
+ $session->setQuoteId($session->getLayBuyStandardQuoteId(true));
252
+
253
+ Mage::getSingleton('checkout/session')->getQuote()->setIsActive(false)->save();
254
+
255
+ $order = Mage::getModel('sales/order');
256
+
257
+ $order->loadByIncrementId($status['custom']);
258
+
259
+ $payment_info = array();
260
+
261
+ if($order && $order->getId()){
262
+
263
+ $order->sendNewOrderEmail();
264
+
265
+ $order->setEmailSent(true);
266
+
267
+ $payment_info = $order->getPayment()->getData('additional_information');
268
+
269
+ $payment_info['transactions'][$status['paypal_profile_id']][] = array(
270
+ 'txnID' => $status['dp_paypal_txn_id'],
271
+ 'type' => 'd',
272
+ 'paymentStatus' => 'Completed',
273
+ 'paymentDate' => $order->getCreatedAt(),
274
+ 'amount' => $status['downpayment_amount']
275
+ );
276
+
277
+ $order->getPayment()->setData('additional_information',$payment_info);
278
+
279
+ $order->save();
280
+
281
+ $createdAt = Mage::helper('core')->formatDate($order->getCreatedAt(), Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM, true);
282
+
283
+ $newStr = '<div class="grid"><div class="hor-scroll"><table cellspacing=0 class="data"><thead><tr class="headings"><th colspan=2 class=" no-link" style="text-align: center;"><span class="nobr">Installment</span></th><th class=" no-link" style="text-align: center;"><span class="nobr">Date</span></th><th class=" no-link" style="text-align: center;"><span class="nobr">PayPal Transaction ID</span></th><th class=" no-link" style="text-align: center;"><span class="nobr">Status</span></th></tr></thead>';
284
+ $newStr .= '<colgroup>
285
+ <col width="100">
286
+ <col width="75">
287
+ <col width="183">
288
+ <col width="183">
289
+ <col width="98">
290
+ </colgroup>';
291
+ $months = (int)$status['months'];
292
+ $newStr .= '<tbody><tr class="even" ><td style="text-align: center;"> DP: </td><td style="text-align: center;"> '.Mage::app()->getLocale()
293
+ ->currency($status['currency'])
294
+ ->toCurrency($status['downpayment_amount']).' </td>'.
295
+ '<td style="text-align: center;"> '.$createdAt.' </td>'.
296
+ '<td style="text-align: center;">'.$status['dp_paypal_txn_id'].'</td>'.
297
+ '<td style="text-align: center;"> Completed </td></tr>';
298
+
299
+ for($month=1;$month<=$months;$month++){
300
+ $newStr .= '<tr ';
301
+ if($month%2==0)
302
+ $newStr .= 'class="even"';
303
+ $newStr .= '>';
304
+ $newStr .= '<td style="text-align: center;"> Month '.$month.': </td><td style="text-align: center;"> '.Mage::app()->getLocale()
305
+ ->currency($status['currency'])
306
+ ->toCurrency($status['payment_amounts']).' </td>';
307
+
308
+ $date = date("Y-m-d h:i:s", strtotime($status['first_payment_due'] . " +".($month-1)." month"));
309
+ $date = Mage::helper('core')->formatDate($date, Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM, true);
310
+ $newStr .= '<td style="text-align: center;"> '.$date.' </td>';
311
+ $newStr .= '<td style="text-align: center;">&nbsp;</td>';
312
+ $newStr .= '<td style="text-align: center;"> Pending </td></tr>';
313
+
314
+ }
315
+ $newStr .= '</tbody></table></div></div>';
316
+
317
+ $model = Mage::getModel('laybuy/report')->setData($status)
318
+ ->setOrderId($status['custom'])
319
+ ->setStoreId($order->getStoreId())
320
+ ->setCreatedAt($order->getCreatedAt())
321
+ ->setStatus(0)
322
+ ->setReport($newStr)
323
+ /* ->setTransaction(0) */
324
+ ->save();
325
+
326
+
327
+
328
+ Mage::log('Response Array From LayBuy {{'.$str."}}", null, 'laybuy_success.log');
329
+
330
+ }
331
+
332
+ $session->addSuccess($this->__('Payment was recieved successfully.'));
333
+
334
+ }catch(Exception $e){
335
+
336
+
337
+ $status = array_change_key_case($this->getRequest()->getParams(),CASE_LOWER);
338
+
339
+ if($status){
340
+ $str = print_r($status, true);
341
+
342
+ $session->addError($this->__('Payment Recieved.But transaction not saved please contact us.'));
343
+
344
+ Mage::log('Exception Order of LayBuy {{'."Order_id=".$status['custom']."|".$status['errormessage']."|".'Response Array From LayBuy {{'.$status."}}"."}}", null, 'laybuy_failure.log');
345
+
346
+ }else{
347
+ $session->addError($this->__('Try Again Later.'));
348
+ }
349
+
350
+
351
+ }
352
+
353
+ $this->_redirect('checkout/onepage/success');
354
+
355
+ }
356
+
357
+ public function docalcAction(){
358
+ $header = '<html>';
359
+ $header .= '<head>';
360
+ $header .= '<link media="all" href="'.Mage::getBaseUrl('skin').'adminhtml/default/default/reset.css" type="text/css" rel="stylesheet">';
361
+ $header .= '<link media="all" href="'.Mage::getBaseUrl('skin').'adminhtml/default/default/boxes.css" type="text/css" rel="stylesheet">';
362
+ $header .= '</head>';
363
+ $header .= '<body style="font: 12px/1.5em; background: none repeat scroll 0 0 rgba(0, 0, 0, 0);">';
364
+ $header .= '<div class="grid">';
365
+ $header .= '<div class="hor-scroll">';
366
+ $html = '<table cellspacing="0" class="data">';
367
+ $html .= '<colgroup>
368
+ <col width="175">
369
+ <col width="183">
370
+ <col width="98">
371
+ </colgroup>';
372
+
373
+ $tod=time();
374
+ $isLeap = 0;
375
+ $isLeap = Date('L',$tod);
376
+ if($isLeap)
377
+ $dim=array(31,31,29,31,30,31,30,31,31,30,31,30,31);
378
+ else
379
+ $dim=array(31,31,28,31,30,31,30,31,31,30,31,30,31);
380
+ /* print_r($dim);die; */
381
+ $day=Date('d',$tod);
382
+ $mth=Date('m',$tod);
383
+ $yr=Date('Y',$tod);
384
+ $mnth=$this->getRequest()->getParam('mnth');
385
+ $hght=150 / (2 + $mnth);
386
+ $html .= '<thead><tr class="headings"><th class=" no-link" style="text-align: center; font-size: 0.7em; padding-bottom: 4px; padding-top: 4px;"><span class="nobr">Payment</span></th><th class=" no-link" style="text-align: center; font-size: 0.7em; padding-bottom: 4px; padding-top: 4px;"><span class="nobr">Due Date</span></th><th class=" no-link" style="text-align: center; font-size: 0.7em; padding-bottom: 4px; padding-top: 4px;"><span class="nobr">Amount</span></th></tr></thead>';
387
+ $init=$this->getRequest()->getParam('init');
388
+ $amt=$this->getRequest()->getParam('amt');
389
+ $currency = $this->getRequest()->getParam('currency');
390
+ $dep=$amt*$init/100;
391
+ $rest=number_format(($amt-$dep)/$mnth,2,'.','');
392
+ $dep=number_format($amt - $rest * $mnth,2,'.','');
393
+ $html .= '<tbody><tr class="even" ><td style="text-align: center;">DownPayment</td><td style="text-align: center;">Today</td><td style="text-align:right">'.Mage::app()->getLocale()->currency($currency)->toCurrency($dep).'</td></tr>';
394
+ for ($e=1; $e<=$mnth; $e++) {
395
+ if (++$mth>12) {
396
+ $mth='01';
397
+ $yr++;
398
+ }
399
+ $m=1+$mth-1;
400
+ $d=min($day,$dim[$m]);
401
+
402
+ $even = '';
403
+ if($e%2==0)
404
+ $even = ' class="even"';
405
+ $date = '';
406
+ $date = $d.'-'.$mth.'-'.$yr;
407
+ $date = Mage::helper('core')->formatDate($date, Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM, true);
408
+ if($e==1){
409
+ $first_payment_due = $date;
410
+ }
411
+ $html .= '<tr'.$even.' ><td style="text-align: center;">'.$e.'</td><td style="text-align: center;">'.$date.'</td><td style="text-align:right">'.Mage::app()->getLocale()->currency($currency)->toCurrency($rest).'</td></tr>';
412
+ }
413
+ $html .= '</tbody>';
414
+ $html .= '</table>';
415
+ $footer = '</div>';
416
+ $footer .= '</div>';
417
+ $footer .= '</body>';
418
+ $footer .= '</html>';
419
+ if($this->getRequest()->getParam('html')){
420
+ echo $header.$html.$footer;
421
+ }else{
422
+ echo $dep.'~'.$rest.'~'.$first_payment_due.'~'.$date.'~'.$html;
423
+ }
424
+ }
425
+
426
+ }
app/code/local/Ced/LayBuy/etc/adminhtml.xml ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
  <title>Fetch Updates</title>
1
  </fetch>
 
 
 
2
  <title>Cancel Transaction</title>
3
  </cancel>
4
  <title>Revise Instalment Plan</title>
5
  </update>
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <config>
3
+ <menu>
4
+ <report>
5
+ <children>
6
+ <salesroot>
7
+ <children>
8
+ <laybuyreport module="laybuy" translate="title">
9
+ <title>Lay-Buy Instalment Reports</title>
10
+ <action>laybuy/adminhtml_report</action>
11
+ <sort_order>110</sort_order>
12
+ </laybuyreport>
13
+ </children>
14
+ </salesroot>
15
+ </children>
16
+ </report>
17
+ </menu>
18
+ <acl>
19
+ <resources>
20
+ <all>
21
+ <title>Allow Everything</title>
22
+ </all>
23
+ <admin>
24
+ <children>
25
+ <system>
26
+ <children>
27
+ <config>
28
+ <children>
29
+ <laybuy translate="title">
30
+ <title>Lay-Buy Section</title>
31
+ </laybuy>
32
+ </children>
33
+ </config>
34
+ </children>
35
+ </system>
36
+ <report>
37
+ <children>
38
+ <salesroot>
39
+ <children>
40
+ <laybuyreport module="laybuy" translate="title">
41
+ <title>Lay-Buy Instalment Reports</title>
42
+ <children>
43
  <title>Fetch Updates</title>
44
  </fetch>
45
+ <view translate="title">
46
+ <title>View</title>
47
+ </view>
48
  <title>Cancel Transaction</title>
49
  </cancel>
50
  <title>Revise Instalment Plan</title>
51
  </update>
52
+ </children>
53
+ </laybuyreport>
54
+ </children>
55
+ </salesroot>
56
+ </children>
57
+ </report>
58
+ </children>
59
+ </admin>
60
+ </resources>
61
+ </acl>
62
+ </config>
app/code/local/Ced/LayBuy/etc/config.xml ADDED
@@ -0,0 +1,177 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <modules>
4
+ <Ced_LayBuy>
5
+ <version>0.9.0</version>
6
+ <author>ASHEESH SINGH (asheeshsingh@cedcoss.com)</author>
7
+ </Ced_LayBuy>
8
+ </modules>
9
+ <admin>
10
+ <routers>
11
+ <laybuy>
12
+ <use>admin</use>
13
+ <args>
14
+ <module>Ced_LayBuy</module>
15
+ <frontName>laybuy</frontName>
16
+ </args>
17
+ </laybuy>
18
+ </routers>
19
+ </admin>
20
+ <adminhtml>
21
+ <translate>
22
+ <modules>
23
+ <Ced_LayBuy>
24
+ <files>
25
+ <default>Ced_LayBuy.csv</default>
26
+ </files>
27
+ </Ced_LayBuy>
28
+ </modules>
29
+ </translate>
30
+ <layout>
31
+ <updates>
32
+ <laybuy>
33
+ <file>laybuy.xml</file>
34
+ </laybuy>
35
+ </updates>
36
+ </layout>
37
+ </adminhtml>
38
+ <frontend>
39
+ <routers>
40
+ <laybuy>
41
+ <use>standard</use>
42
+ <args>
43
+ <module>Ced_LayBuy</module>
44
+ <frontName>laybuy</frontName>
45
+ </args>
46
+ </laybuy>
47
+ </routers>
48
+ <layout>
49
+ <updates>
50
+ <laybuy>
51
+ <file>laybuy.xml</file>
52
+ </laybuy>
53
+ </updates>
54
+ </layout>
55
+ <translate>
56
+ <modules>
57
+ <Ced_LayBuy>
58
+ <files>
59
+ <default>Ced_LayBuy.csv</default>
60
+ </files>
61
+ </Ced_LayBuy>
62
+ </modules>
63
+ </translate>
64
+ </frontend>
65
+ <global>
66
+ <models>
67
+ <laybuy>
68
+ <class>Ced_LayBuy_Model</class>
69
+ <resourceModel>laybuy_resource</resourceModel>
70
+ </laybuy>
71
+ <laybuy_resource>
72
+ <class>Ced_LayBuy_Model_Resource</class>
73
+ <entities>
74
+ <report>
75
+ <table>laybuy_transaction_report</table>
76
+ </report>
77
+ <revise>
78
+ <table>laybuy_revise_request_report</table>
79
+ </revise>
80
+ </entities>
81
+ </laybuy_resource>
82
+ </models>
83
+ <resources>
84
+ <laybuy_setup>
85
+ <setup>
86
+ <module>Ced_LayBuy</module>
87
+ <class>Ced_LayBuy_Model_Resource_Setup</class>
88
+ </setup>
89
+ </laybuy_setup>
90
+ </resources>
91
+ <helpers>
92
+ <laybuy>
93
+ <class>Ced_LayBuy_Helper</class>
94
+ </laybuy>
95
+ </helpers>
96
+ <blocks>
97
+ <laybuy>
98
+ <class>Ced_LayBuy_Block</class>
99
+ </laybuy>
100
+ </blocks>
101
+ <template>
102
+ <email>
103
+ <revise_plan_email_template module="Ced_LayBuy">
104
+ <label>Message from Lay-Buy Financial Solutions Pty Ltd</label>
105
+ <file>revise_plan_email_template.html</file>
106
+ <type>html</type>
107
+ </revise_plan_email_template>
108
+ </email>
109
+ </template>
110
+ <events>
111
+ <payment_info_block_prepare_specific_information>
112
+ <observers>
113
+ <laybuy_payment_info>
114
+ <type>model</type>
115
+ <class>laybuy/observer</class>
116
+ <method>paymentInfoBlockPrepareSpecificInformation</method>
117
+ </laybuy_payment_info>
118
+ </observers>
119
+ </payment_info_block_prepare_specific_information>
120
+ <order_cancel_after>
121
+ <observers>
122
+ <laybuy_order_cancel>
123
+ <type>model</type>
124
+ <class>laybuy/observer</class>
125
+ <method>orderCancelAfter</method>
126
+ </laybuy_order_cancel>
127
+ </observers>
128
+ </order_cancel_after>
129
+ </events>
130
+ </global>
131
+ <default>
132
+ <payment>
133
+ <laybuy>
134
+ <model>laybuy/standard</model><!-- very important thing, here you select the model for your payment method -->
135
+ <active>1</active>
136
+ <order_status>pending</order_status>
137
+ <title>Lay-Buy</title>
138
+ <payment_action>sale</payment_action>
139
+ <submit_url>http://lay-buys.com/gateway/</submit_url>
140
+ <membership_number>00000</membership_number>
141
+ <multipledesc>1</multipledesc>
142
+ <desc>Description of products / services</desc>
143
+ <mind>20%</mind>
144
+ <maxd>50%</maxd>
145
+ <months>3</months>
146
+ <ftp_ip>https://lay-buys.com/report/</ftp_ip>
147
+ <allowspecific>0</allowspecific>
148
+ <sort_order>1</sort_order>
149
+ <bypasslaybuy>1</bypasslaybuy>
150
+ <cronenabled>0</cronenabled>
151
+ </laybuy>
152
+ </payment>
153
+ <laybuy>
154
+ <fetch_reports>
155
+ <schedule>1</schedule>
156
+ <time>00,00,00</time>
157
+ </fetch_reports>
158
+ </laybuy>
159
+ </default>
160
+ <crontab>
161
+ <jobs>
162
+ <LayBuy_Cron_Check>
163
+ <schedule>
164
+ <cron_expr>* * * * *</cron_expr>
165
+ </schedule>
166
+ <run>
167
+ <model>laybuy/Observer::checkCron</model>
168
+ </run>
169
+ </LayBuy_Cron_Check>
170
+ <LayBuy_Automated_Fetch_Updates>
171
+ <run>
172
+ <model>laybuy/Observer::fetchUpdates</model>
173
+ </run>
174
+ </LayBuy_Automated_Fetch_Updates>
175
+ </jobs>
176
+ </crontab>
177
+ </config>
app/code/local/Ced/LayBuy/etc/system.xml ADDED
@@ -0,0 +1,246 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <payment>
5
+ <groups>
6
+ <laybuy translate="label comment" module="laybuy">
7
+ <label>PUT IT ON LAY-BUY (powered by PayPal)</label>
8
+ <frontend_type>text</frontend_type>
9
+ <sort_order>999</sort_order>
10
+ <show_in_default>1</show_in_default>
11
+ <show_in_website>1</show_in_website>
12
+ <show_in_store>1</show_in_store>
13
+ <fields>
14
+ <active translate="label comment">
15
+ <label>Enabled</label>
16
+ <frontend_type>select</frontend_type>
17
+ <source_model>adminhtml/system_config_source_yesno</source_model>
18
+ <sort_order>10</sort_order>
19
+ <show_in_default>1</show_in_default>
20
+ <show_in_website>1</show_in_website>
21
+ <show_in_store>0</show_in_store>
22
+ </active>
23
+ <title translate="label comment">
24
+ <label>Title</label>
25
+ <frontend_type>text</frontend_type>
26
+ <sort_order>20</sort_order>
27
+ <show_in_default>1</show_in_default>
28
+ <show_in_website>1</show_in_website>
29
+ <show_in_store>1</show_in_store>
30
+ </title>
31
+ <order_status translate="label comment">
32
+ <label>New Order Status</label>
33
+ <frontend_type>select</frontend_type>
34
+ <source_model>adminhtml/system_config_source_order_status</source_model>
35
+ <sort_order>51</sort_order>
36
+ <show_in_default>1</show_in_default>
37
+ <show_in_website>1</show_in_website>
38
+ <show_in_store>0</show_in_store>
39
+ </order_status>
40
+ <submit_url translate="label comment">
41
+ <label>Gateway URL</label>
42
+ <frontend_type>text</frontend_type>
43
+ <sort_order>58</sort_order>
44
+ <show_in_default>1</show_in_default>
45
+ <show_in_website>0</show_in_website>
46
+ <show_in_store>0</show_in_store>
47
+ </submit_url>
48
+ <membership_number translate="label comment">
49
+ <label>Lay-Buys Membership Number</label>
50
+ <frontend_type>password</frontend_type>
51
+ <sort_order>59</sort_order>
52
+ <show_in_default>1</show_in_default>
53
+ <show_in_website>1</show_in_website>
54
+ <show_in_store>0</show_in_store>
55
+ </membership_number>
56
+ <multipledesc translate="label comment">
57
+ <label>Line Items Description</label>
58
+ <frontend_type>select</frontend_type>
59
+ <source_model>adminhtml/system_config_source_yesno</source_model>
60
+ <sort_order>60</sort_order>
61
+ <show_in_default>1</show_in_default>
62
+ <show_in_website>1</show_in_website>
63
+ <show_in_store>1</show_in_store>
64
+ </multipledesc>
65
+ <desc translate="label comment">
66
+ <label>Description</label>
67
+ <frontend_type>textarea</frontend_type>
68
+ <sort_order>61</sort_order>
69
+ <show_in_default>1</show_in_default>
70
+ <show_in_website>1</show_in_website>
71
+ <show_in_store>1</show_in_store>
72
+ <depends><multipledesc>0</multipledesc></depends>
73
+ <comment>Description of products / services</comment>
74
+ </desc>
75
+ <mind translate="label comment">
76
+ <label>Minimum</label>
77
+ <frontend_type>text</frontend_type>
78
+ <sort_order>62</sort_order>
79
+ <show_in_default>1</show_in_default>
80
+ <show_in_website>1</show_in_website>
81
+ <show_in_store>1</show_in_store>
82
+ <comment>Minimum Deposit Amount (defaults to 20%)</comment>
83
+ </mind>
84
+ <maxd translate="label comment">
85
+ <label>Maximum</label>
86
+ <frontend_type>text</frontend_type>
87
+ <sort_order>63</sort_order>
88
+ <show_in_default>1</show_in_default>
89
+ <show_in_website>1</show_in_website>
90
+ <show_in_store>1</show_in_store>
91
+ <comment>Maximum Deposit Amount (defaults to 50%)</comment>
92
+ </maxd>
93
+ <months translate="label comment">
94
+ <label>Months</label>
95
+ <frontend_type>text</frontend_type>
96
+ <sort_order>64</sort_order>
97
+ <show_in_default>1</show_in_default>
98
+ <show_in_website>1</show_in_website>
99
+ <show_in_store>1</show_in_store>
100
+ <comment>Maximum Number of Months to pay Balance (defaults to 3)</comment>
101
+ </months>
102
+ <conditional_criteria_total translate="label comment">
103
+ <label>Minimum Cart Total</label>
104
+ <config_path>laybuy/conditional_criteria/total</config_path>
105
+ <frontend_type>text</frontend_type>
106
+ <comment>The checkout total the order must reach before this payment method becomes active.</comment>
107
+ <sort_order>65</sort_order>
108
+ <show_in_default>1</show_in_default>
109
+ <show_in_website>1</show_in_website>
110
+ <show_in_store>1</show_in_store>
111
+ <shared>1</shared>
112
+ </conditional_criteria_total>
113
+ <conditional_criteria_category translate="label comment">
114
+ <label>Allowed Categories</label>
115
+ <config_path>laybuy/conditional_criteria/categories</config_path>
116
+ <frontend_type>multiselect</frontend_type>
117
+ <source_model>laybuy/system_config_source_categories</source_model>
118
+ <can_be_empty>1</can_be_empty>
119
+ <comment>The checkout products of the orders must be in these categories before this payment method becomes active.</comment>
120
+ <sort_order>66</sort_order>
121
+ <show_in_default>1</show_in_default>
122
+ <show_in_website>1</show_in_website>
123
+ <show_in_store>1</show_in_store>
124
+ <shared>1</shared>
125
+ </conditional_criteria_category>
126
+ <conditional_criteria_customergroup translate="label comment">
127
+ <label>Allowed Customer Groups</label>
128
+ <config_path>laybuy/conditional_criteria/customergroup</config_path>
129
+ <frontend_type>multiselect</frontend_type>
130
+ <source_model>laybuy/system_config_source_groups</source_model>
131
+ <comment>The checkout customer must be in these customer groups before this payment method becomes active.</comment>
132
+ <sort_order>67</sort_order>
133
+ <show_in_default>1</show_in_default>
134
+ <show_in_website>1</show_in_website>
135
+ <show_in_store>1</show_in_store>
136
+ <shared>1</shared>
137
+ </conditional_criteria_customergroup>
138
+ <image translate="label comment">
139
+ <label>Image/Logo</label>
140
+ <frontend_type>image</frontend_type>
141
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
142
+ <upload_dir config="system/filesystem/media" scope_info="1">laybuy</upload_dir>
143
+ <base_url type="media" scope_info="1">laybuy</base_url>
144
+ <sort_order>68</sort_order>
145
+ <show_in_default>1</show_in_default>
146
+ <show_in_website>1</show_in_website>
147
+ <show_in_store>1</show_in_store>
148
+ <comment>logo or image to appear on Lay-Buys page for your branding or white-labeling</comment>
149
+ </image>
150
+ <allowspecific translate="label comment">
151
+ <label>Payment Applicable From</label>
152
+ <frontend_type>select</frontend_type>
153
+ <sort_order>70</sort_order>
154
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
155
+ <show_in_default>1</show_in_default>
156
+ <show_in_website>1</show_in_website>
157
+ </allowspecific>
158
+ <specificcountry translate="label comment">
159
+ <label>Countries Payment Applicable From</label>
160
+ <frontend_type>multiselect</frontend_type>
161
+ <sort_order>75</sort_order>
162
+ <source_model>adminhtml/system_config_source_country</source_model>
163
+ <show_in_default>1</show_in_default>
164
+ <show_in_website>1</show_in_website>
165
+ <depends><allowspecific>1</allowspecific></depends>
166
+ </specificcountry>
167
+ <sort_order translate="label comment">
168
+ <label>Sort Order</label>
169
+ <frontend_type>text</frontend_type>
170
+ <sort_order>76</sort_order>
171
+ <show_in_default>1</show_in_default>
172
+ <show_in_website>1</show_in_website>
173
+ <show_in_store>1</show_in_store>
174
+ </sort_order>
175
+ <settlement_reports type="group" translate="label">
176
+ <label>Instalment Report Settings</label>
177
+ <frontend_type>text</frontend_type>
178
+ <show_in_default>1</show_in_default>
179
+ <show_in_website>1</show_in_website>
180
+ <sort_order>90</sort_order>
181
+ <fields>
182
+ <heading_sftp translate="label">
183
+ <label>Api Credentials</label>
184
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
185
+ <sort_order>10</sort_order>
186
+ <show_in_default>1</show_in_default>
187
+ <show_in_website>1</show_in_website>
188
+ </heading_sftp>
189
+ <settlement_reports_ftp_ip translate="label comment">
190
+ <label>Api IP-Address</label>
191
+ <comment>By default it is "https://lay-buys.com/report/".</comment>
192
+ <config_path>laybuy/fetch_reports/ftp_ip</config_path>
193
+ <frontend_type>text</frontend_type>
194
+ <sort_order>20</sort_order>
195
+ <show_in_default>1</show_in_default>
196
+ <show_in_website>1</show_in_website>
197
+ <shared>1</shared>
198
+ </settlement_reports_ftp_ip>
199
+ <heading_schedule translate="label">
200
+ <label>Scheduled Fetching</label>
201
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
202
+ <sort_order>70</sort_order>
203
+ <show_in_default>1</show_in_default>
204
+ <show_in_website>1</show_in_website>
205
+ <shared>1</shared>
206
+ </heading_schedule>
207
+ <settlement_reports_active translate="label">
208
+ <label>Enable Automatic Fetching</label>
209
+ <config_path>laybuy/fetch_reports/active</config_path>
210
+ <frontend_type>select</frontend_type>
211
+ <source_model>adminhtml/system_config_source_yesno</source_model>
212
+ <sort_order>80</sort_order>
213
+ <show_in_default>1</show_in_default>
214
+ <show_in_website>1</show_in_website>
215
+ <shared>1</shared>
216
+ </settlement_reports_active>
217
+ <settlement_reports_schedule translate="label comment">
218
+ <label>Schedule</label>
219
+ <config_path>laybuy/fetch_reports/schedule</config_path>
220
+ <frontend_type>select</frontend_type>
221
+ <source_model>laybuy/system_config_source_fetchingSchedule</source_model>
222
+ <backend_model>laybuy/system_config_backend_cron</backend_model>
223
+ <sort_order>90</sort_order>
224
+ <show_in_default>1</show_in_default>
225
+ <shared>1</shared>
226
+ </settlement_reports_schedule>
227
+ <settlement_reports_time translate="label">
228
+ <label>Time of Day</label>
229
+ <config_path>laybuy/fetch_reports/time</config_path>
230
+ <frontend_type>time</frontend_type>
231
+ <sort_order>100</sort_order>
232
+ <show_in_default>1</show_in_default>
233
+ <shared>1</shared>
234
+ </settlement_reports_time>
235
+ </fields>
236
+ </settlement_reports>
237
+ <sort_order>100</sort_order>
238
+ <show_in_default>1</show_in_default>
239
+ <show_in_website>1</show_in_website>
240
+ <show_in_store>0</show_in_store>
241
+ </fields>
242
+ </laybuy>
243
+ </groups>
244
+ </payment>
245
+ </sections>
246
+ </config>
app/code/local/Ced/LayBuy/sql/laybuy_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+ $installer->run("
5
+ CREATE TABLE IF NOT EXISTS `".$this->getTable('laybuy/report')."` (
6
+ `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
7
+ `order_id` text NOT NULL COMMENT 'ORDER ID',
8
+ `firstname` varchar(100) NOT NULL COMMENT 'FIRST NAME',
9
+ `lastname` varchar(100) DEFAULT NULL COMMENT 'LAST NAME',
10
+ `address` text COMMENT 'ADDRESS',
11
+ `suburb` text COMMENT 'SUBURB',
12
+ `state` text COMMENT 'STATE',
13
+ `country` text COMMENT 'COUNTRY',
14
+ `email` text COMMENT 'EMAIL',
15
+ `amount` double NOT NULL COMMENT 'AMOUNT',
16
+ `currency` varchar(5) NOT NULL COMMENT 'CURRENCY',
17
+ `downpayment` double NOT NULL COMMENT 'DOWNPAYMENT',
18
+ `months` int(11) NOT NULL COMMENT 'MONTHS',
19
+ `downpayment_amount` double NOT NULL COMMENT 'DOWNPAYMENT_AMOUNT',
20
+ `payment_amounts` double NOT NULL COMMENT 'PAYMENT_AMOUNTS',
21
+ `first_payment_due` datetime NOT NULL COMMENT 'FIRST_PAYMENT_DUE',
22
+ `last_payment_due` datetime NOT NULL COMMENT 'LAST_PAYMENT_DUE',
23
+ PRIMARY KEY (`id`)
24
+ ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
25
+ ");
26
+ $installer->endSetup();
app/code/local/Ced/LayBuy/sql/laybuy_setup/mysql4-upgrade-0.1.0-0.2.0.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+ $installer->getConnection()->addColumn($this->getTable('laybuy/report'),'store_id','int');
5
+ $installer->getConnection()->addColumn($this->getTable('laybuy/report'),'created_at','datetime');
6
+ $installer->getConnection()->addColumn($this->getTable('laybuy/report'),'status','tinyint');
7
+ $installer->endSetup();
app/code/local/Ced/LayBuy/sql/laybuy_setup/mysql4-upgrade-0.2.0-0.3.0.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+ $installer->getConnection()->addColumn($this->getTable('laybuy/report'),'report','text');
5
+ $installer->endSetup();
app/code/local/Ced/LayBuy/sql/laybuy_setup/mysql4-upgrade-0.3.0-0.4.0.php ADDED
@@ -0,0 +1 @@
 
0
 
1
+ <?php
2
 
app/code/local/Ced/LayBuy/sql/laybuy_setup/mysql4-upgrade-0.4.0-0.5.0.php ADDED
@@ -0,0 +1 @@
 
0
 
1
+ <?php
2
 
app/code/local/Ced/LayBuy/sql/laybuy_setup/mysql4-upgrade-0.5.0-0.6.0.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php
app/code/local/Ced/LayBuy/sql/laybuy_setup/mysql4-upgrade-0.6.0-0.7.0.php ADDED
@@ -0,0 +1 @@
 
0
 
1
+ <?php
2
 
app/code/local/Ced/LayBuy/sql/laybuy_setup/mysql4-upgrade-0.7.0-0.8.0.php ADDED
@@ -0,0 +1 @@
 
0
 
1
+ <?php
2
 
app/code/local/Ced/LayBuy/sql/laybuy_setup/mysql4-upgrade-0.8.0-0.9.0.php ADDED
@@ -0,0 +1 @@
 
0
 
1
+ <?php
2
 
app/design/adminhtml/default/default/layout/laybuy.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ <reference name="notifications">
5
+ <block type="adminhtml/notification_window" name="notification_laybuy" as="notification_laybuy" acl="system/adminnotification/show_toolbar" template="laybuy/notification.phtml" />
6
+ </reference>
7
+ </default>
8
+ </layout>
app/design/adminhtml/default/default/template/laybuy/info/default.phtml ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Lay-Buys
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * 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@magentocommerce.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.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package default_default
23
+ * @author Asheesh Singh<asheeshsingh@cedcoss.com>
24
+ * @copyright Copyright LAY-BUYS (2011). (http://lay-buys.com/)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+ ?>
28
+ <?php
29
+ /**
30
+ * @see Ced_LayBuy_Block_Info_Laybuy
31
+ */
32
+ ?>
33
+ <p><strong><?php echo $this->htmlEscape($this->getMethod()->getTitle()) ?></strong></p>
34
+
35
+ <?php if ($_specificInfo = $this->getSpecificInformation()):?>
36
+ <table>
37
+ <tbody>
38
+ <?php $cnt = 1; ?>
39
+ <?php foreach ($_specificInfo as $_label => $_value):?>
40
+ <?php $_label = explode('-',$_label); ?>
41
+ <tr>
42
+ <th><strong><a target="_blank" href="<?php echo $this->getUrl('laybuy/adminhtml_report/details',array('id'=>$_label[1])); ?>" ><?php if($cnt!=1){ echo Mage::helper('laybuy')->__('Revised Instalment Plan').($cnt-1); }else{ echo $this->escapeHtml($_label[0]); } $cnt++; ?></a>:</strong></th>
43
+ </tr>
44
+ <tr>
45
+ <td><?php echo $_value; ?></td>
46
+ </tr>
47
+ <?php endforeach; ?>
48
+ </tbody>
49
+ </table>
50
+ <?php endif;?>
51
+
52
+ <?php echo $this->getChildHtml()?>
app/design/adminhtml/default/default/template/laybuy/notification.phtml ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Lay-Buys
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @category design
23
+ * @package default_default
24
+ * @author Asheesh Singh<asheeshsingh@cedcoss.com>
25
+ * @copyright Copyright LAY-BUYS (2011). (http://lay-buys.com/)
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+ ?>
29
+ <div class="notification-global">
30
+ <?php if(!Mage::getStoreConfig('paymnet/laybuy/cronenabled')){ ?>
31
+ <strong class="label">Cron must be enabled for "Automated Fetch Updates".</strong>
32
+ <?php } ?>
33
+ Click here to go to <a href="<?php echo Mage::helper("adminhtml")->getUrl("laybuy/adminhtml_report/"); ?>">Lay-Buys Instalment Reports</a>.
34
+ </div>
app/design/frontend/base/default/layout/laybuy.xml ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ <reference name="head">
5
+ <action method="addJs"><script>laybuy/jquery.min.js</script></action>
6
+ <action method="addJs"><script>laybuy/jquery.atooltip.js</script></action>
7
+ </reference>
8
+ </default>
9
+ <checkout_onepage_review>
10
+ <reference name="checkout.onepage.review.button">
11
+ <action method="setTemplate">
12
+ <template>laybuy/checkout/onepage/review/button.phtml</template>
13
+ </action>
14
+ <!-- <block type="core/template" name="checkout.onepage.review.button1" as="button1" before="checkout.onepage.review.button" template="checkout/onepage/review/button1.phtml"/> -->
15
+ </reference>
16
+ </checkout_onepage_review>
17
+ <laybuy_onepage_success translate="label">
18
+ <!--<update handle="checkout_onepage_success"/>-->
19
+ <label>One Page Checkout Success</label>
20
+ <reference name="root">
21
+ <action method="setTemplate"><template>page/2columns-right.phtml</template></action>
22
+ </reference>
23
+ <reference name="content">
24
+ <block type="checkout/onepage_success" name="laybuy_success" before="checkout.success" template="laybuy/status.phtml"></block>
25
+ </reference>
26
+ </laybuy_onepage_success>
27
+
28
+ <laybuy_report_details>
29
+ <update handle="customer_account"/>
30
+ <reference name="head">
31
+ <action method="setTitle" translate="title" module="customer"><title>View Transaction Details</title></action>
32
+ </reference>
33
+ <reference name="customer_account_navigation">
34
+ <action method="setActive" module="laybuy">
35
+ <path>sales/order/history</path>
36
+ </action>
37
+ </reference>
38
+ <reference name="my.account.wrapper">
39
+ <block type="laybuy/customer_account_details" name="transaction_details" template="laybuy/customer/account/details.phtml"/>
40
+ </reference>
41
+ </laybuy_report_details>
42
+
43
+ <laybuy_report_grid>
44
+ <update handle="customer_account"/>
45
+ <reference name="head">
46
+ <action method="setTitle" translate="title" module="customer"><title>My Instalment Plans</title></action>
47
+ </reference>
48
+ <reference name="customer_account_navigation">
49
+ <action method="setActive" module="laybuy">
50
+ <path>sales/order/history</path>
51
+ </action>
52
+ </reference>
53
+ <reference name="my.account.wrapper">
54
+ <block type="laybuy/customer_account_grid" name="transaction_grid" template="laybuy/customer/account/grid.phtml"/>
55
+ </reference>
56
+ </laybuy_report_grid>
57
+ </layout>
app/design/frontend/base/default/template/laybuy/checkout/onepage/review/button.phtml ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Lay-Buys
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@magentocommerce.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.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+ $this->setLayBuyTitle(Mage::helper('laybuy')->__('A recurring payment solution'))
29
+ ->setPaymentAcceptanceMarkSrc('http://lay-buys.com/gateway/LAY-BUY.png')
30
+ ->setPaymentAcceptanceMarkHref('http://lay-buys.com/');
31
+ $sessionPayment = Mage::getSingleton('checkout/session')->getQuote()->getPayment();
32
+ $method = $sessionPayment->getData('method');
33
+ $customerOptions = $sessionPayment->getData('additional_information');
34
+
35
+ $totals = Mage::getSingleton('checkout/session')->getQuote()->getTotals();
36
+ $grandtotal = round($totals["grand_total"]->getValue());
37
+ ?>
38
+ <?php if($method == 'laybuy'){ ?>
39
+ <div class="input-box" id="laybuy-preview-wrapper">
40
+ <strong><?php echo $this->__('Plan Preview'); ?></strong>
41
+ <iframe src="<?php echo $this->getUrl('laybuy/standard/docalc'); ?>?currency=<?php echo Mage::app()->getStore()->getCurrentCurrencyCode(); ?>&amt=<?php echo $grandtotal; ?>&init=<?php echo $customerOptions['INIT']; ?>&mnth=<?php echo $customerOptions['MONTHS']; ?>&html=1" name="preview-tbl" id="preview-tbl" style="width:100%; height:157px; border:0; margin:0; overflow:hidden" marginheight="0" marginwidth="0" noscroll></iframe>
42
+ </div>
43
+ <button type="submit" style="float: none !important;" class="button btn-checkout" onclick="review.save();"><img src="<?php echo $this->escapeHtml($this->getPaymentAcceptanceMarkSrc())?>" alt="<?php echo Mage::helper('laybuy')->__('LAY-BUY') ?>" title="<?php echo $this->escapeHtml($this->getLayBuyTitle()) ?>" class="v-middle" />&nbsp;</button><span class="btn-checkout">&nbsp;-OR-&nbsp;</span>
44
+ <?php } ?>
45
+ <?php echo $this->getLayout()->createBlock("core/template")->setTemplate("checkout/onepage/review/button.phtml")->toHtml();
46
+
47
+
app/design/frontend/base/default/template/laybuy/customer/account/details.phtml ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Lay-Buys
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@magentocommerce.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.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package default_default
23
+ * @author Asheesh Singh<asheeshsingh@cedcoss.com>
24
+ * @copyright Copyright LAY-BUYS (2011). (http://lay-buys.com/)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+ ?>
28
+ <?php
29
+ /**
30
+ * @see Ced_LayBuy_Block_Customer_Account_Details
31
+ */
32
+ ?>
33
+ <style type="text/css">
34
+ .grid table {
35
+ border-color: #CBD3D4 #CBD3D4 -moz-use-text-color;
36
+ border-image: none;
37
+ border-style: solid solid none;
38
+ border-width: 1px 1px medium;
39
+ width: 100%;
40
+ }
41
+ .grid tbody {
42
+ background: none repeat scroll 0 0 #FFFFFF;
43
+ }
44
+ .grid tr.headings {
45
+ background: url("<?php echo Mage::getBaseUrl('skin'); ?>adminhtml/default/default/images/sort_row_bg.gif") repeat-x scroll 0 50% rgba(0, 0, 0, 0);
46
+ }
47
+ .grid tr.headings th.no-link {
48
+ color: #67767E;
49
+ padding-bottom: 1px;
50
+ padding-top: 2px;
51
+ }
52
+ .grid tr.headings th {
53
+ border-color: #F9F9F9 #D1CFCF #F9F9F9 #F9F9F9;
54
+ border-style: solid;
55
+ border-width: 1px;
56
+ font-size: 0.9em;
57
+ font-weight: bold;
58
+ padding-bottom: 0;
59
+ padding-top: 1px;
60
+ }
61
+ .grid th {
62
+ white-space: nowrap;
63
+ }
64
+ .grid tr.even, .grid tr.even tr {
65
+ background: none repeat scroll 0 0 #F6F6F6;
66
+ }
67
+ .grid table td {
68
+ border-color: #DADFE0;
69
+ border-style: solid;
70
+ border-width: 0 1px 1px 0;
71
+ }
72
+ .grid th, .grid td {
73
+ padding: 2px 4px;
74
+ }
75
+ </style>
76
+ <?php $_transaction = $this->getTransaction() ?>
77
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
78
+ <div class="page-title title-buttons">
79
+ <h1><?php echo $this->__('View Transaction Details') ?></h1>
80
+ </div>
81
+ <div class="col2-set order-info-box">
82
+ <div class="col-11">
83
+ <div class="box">
84
+ <div class="box-title">
85
+ <h2><?php echo $this->__('Reference Information') ?></h2>
86
+ </div>
87
+ <div class="box-content">
88
+ <address>
89
+ <span class="label" style="float: left; width: 150px;"><b><?php echo $_transaction->getFieldLabel('paypal_profile_id'); ?></b></span>:&nbsp;<span><?php echo $_transaction->getData('paypal_profile_id'); ?></span><br style="clear: both;" />
90
+ <span class="label" style="float: left; width: 150px;"><b><?php echo $_transaction->getFieldLabel('laybuy_ref_no'); ?></b></span>:&nbsp;<span><?php echo $_transaction->getData('laybuy_ref_no'); ?></span><br style="clear: both;" />
91
+ <span class="label" style="float: left; width: 150px;"><b><?php echo $_transaction->getFieldLabel('order_id'); ?></b></span>:&nbsp;<span><?php echo $_transaction->getData('order_id'); ?></span><br style="clear: both;" />
92
+ </address>
93
+ </div>
94
+ </div>
95
+ </div>
96
+ </div>
97
+ <div class="col2-set order-info-box">
98
+ <div class="col-11">
99
+ <div class="box">
100
+ <div class="box-title">
101
+ <h2><?php echo $this->__('Payment Plan') ?></h2>
102
+ </div>
103
+ <div class="box-content">
104
+ <span class="label" style="float: left; width: 150px;"><b><?php echo $_transaction->getFieldLabel('status'); ?></b></span>:&nbsp;<span><?php echo $this->getTransactionStatusLabel($_transaction->getData('status')); ?></span><br style="clear: both;" />
105
+ <span class="label" style="float: left; width: 150px;"><b><?php echo $_transaction->getFieldLabel('amount'); ?></b></span>:&nbsp;<span><?php echo Mage::app()->getLocale()->currency($_transaction->getData('currency'))->toCurrency($_transaction->getData('amount')); ?></span><br style="clear: both;" />
106
+ <span class="label" style="float: left; width: 150px;"><b><?php echo $_transaction->getFieldLabel('downpayment'); ?></b></span>:&nbsp;<span><?php echo $_transaction->getData('downpayment'); ?></span><br style="clear: both;" />
107
+ <span class="label" style="float: left; width: 150px;"><b><?php echo $_transaction->getFieldLabel('months'); ?></b></span>:&nbsp;<span><?php echo $_transaction->getData('months'); ?></span><br style="clear: both;" />
108
+ <span class="label" style="float: left; width: 150px;"><b><?php echo $_transaction->getFieldLabel('downpayment_amount'); ?></b></span>:&nbsp;<span><?php echo Mage::app()->getLocale()->currency($_transaction->getData('currency'))->toCurrency($_transaction->getData('downpayment_amount')); ?></span><br style="clear: both;" />
109
+ <span class="label" style="float: left; width: 150px;"><b><?php echo $_transaction->getFieldLabel('payment_amounts'); ?></b></span>:&nbsp;<span><?php echo Mage::app()->getLocale()->currency($_transaction->getData('currency'))->toCurrency($_transaction->getData('payment_amounts')); ?></span><br style="clear: both;" />
110
+ <span class="label" style="float: left; width: 150px;"><b><?php echo $_transaction->getFieldLabel('first_payment_due'); ?></b></span>:&nbsp;<span><?php echo $this->helper('core')->formatDate($_transaction->getData('first_payment_due'), Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM, true); ?></span><br style="clear: both;" />
111
+ <span class="label" style="float: left; width: 150px;"><b><?php echo $_transaction->getFieldLabel('last_payment_due'); ?></b></span>:&nbsp;<span><?php echo $this->helper('core')->formatDate($_transaction->getData('last_payment_due'), Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM, true); ?></span><br style="clear: both;" />
112
+ <span class="label" style="float: left; width: 150px;"><b><?php echo $_transaction->getFieldLabel('report'); ?></b></span>:<br style="clear: both;" /><span><?php echo $_transaction->getData('report'); ?></span>
113
+ </div>
114
+ </div>
115
+ </div>
116
+ </div>
117
+ <div class="col3-set order-info-box">
118
+ <div class="col-11">
119
+ <div class="box">
120
+ <div class="box-title">
121
+ <h2><?php echo $this->__('Customer Information') ?></h2>
122
+ </div>
123
+ <div class="box-content">
124
+ <span class="label" style="float: left; width: 150px;"><b><?php echo $_transaction->getFieldLabel('firstname'); ?></b></span>:&nbsp;<span><?php echo $_transaction->getData('firstname'); ?></span><br style="clear: both;" />
125
+ <span class="label" style="float: left; width: 150px;"><b><?php echo $_transaction->getFieldLabel('lastname'); ?></b></span>:&nbsp;<span><?php echo $_transaction->getData('lastname'); ?></span><br style="clear: both;" />
126
+ <span class="label" style="float: left; width: 150px;"><b><?php echo $_transaction->getFieldLabel('email'); ?></b></span>:&nbsp;<span><?php echo $_transaction->getData('email'); ?></span><br style="clear: both;" />
127
+ <span class="label" style="float: left; width: 150px;"><b><?php echo $_transaction->getFieldLabel('address'); ?></b></span>:&nbsp;<span><?php echo $_transaction->getData('address'); ?></span><br style="clear: both;" />
128
+ <span class="label" style="float: left; width: 150px;"><b><?php echo $_transaction->getFieldLabel('suburb'); ?></b></span>:&nbsp;<span><?php echo $_transaction->getData('suburb'); ?></span><br style="clear: both;" />
129
+ <span class="label" style="float: left; width: 150px;"><b><?php echo $_transaction->getFieldLabel('state'); ?></b></span>:&nbsp;<span><?php echo $_transaction->getData('state'); ?></span><br style="clear: both;" />
130
+ <span class="label" style="float: left; width: 150px;"><b><?php echo $_transaction->getFieldLabel('country'); ?></b></span>:&nbsp;<span><?php echo $_transaction->getData('country'); ?></span><br style="clear: both;" />
131
+ <span class="label" style="float: left; width: 150px;"><b><?php echo $_transaction->getFieldLabel('postcode'); ?></b></span>:&nbsp;<span><?php echo $_transaction->getData('postcode'); ?></span><br style="clear: both;" />
132
+ </div>
133
+ </div>
134
+ </div>
135
+ </div>
136
+ <div class="buttons-set">
137
+ <p class="back-link"><a href="<?php echo $this->getBackUrl() ?>"><small>&laquo; </small><?php echo $this->getBackTitle() ?></a></p>
138
+ </div>
app/design/frontend/base/default/template/laybuy/customer/account/grid.phtml ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Lay-Buys
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@magentocommerce.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.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package default_default
23
+ * @author Asheesh Singh<asheeshsingh@cedcoss.com>
24
+ * @copyright Copyright LAY-BUYS (2011). (http://lay-buys.com/)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+ ?>
28
+ <?php
29
+ /**
30
+ * @see Ced_LayBuy_Block_Customer_Account_Grid
31
+ */
32
+ ?>
33
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
34
+ <?php $_transactions = $this->getTransactions(); ?>
35
+ <div class="page-title">
36
+ <h1><?php echo $this->__('My Instalment Plans') ?></h1>
37
+ </div>
38
+ <dl class="order-info">
39
+ <dt><?php echo $this->__('Order #%s - %s', $this->getOrderIncrementId(), $this->getOrderStatusLabel()) ?></dt>
40
+ <dd>
41
+ </dd>
42
+ </dl>
43
+ <?php echo $this->getPagerHtml(); ?>
44
+ <?php if($_transactions->getSize()): ?>
45
+ <table class="data-table" id="my-transactions-table">
46
+ <col width="1" />
47
+ <col width="1" />
48
+ <col width="1" />
49
+ <col width="1" />
50
+ <col width="1" />
51
+ <col width="1" />
52
+ <thead>
53
+ <tr>
54
+ <th><?php echo $this->__('Created At') ?></th>
55
+ <th><?php echo $this->__('Amount') ?></th>
56
+ <th><?php echo $this->__('Down Payment %') ?></th>
57
+ <th style="padding: 0px;"><?php echo $this->__('Months') ?></th>
58
+ <th><span class="nobr"><?php echo $this->__('First Payment Due') ?></span></th>
59
+ <th><span class="nobr"><?php echo $this->__('Last Payment Due') ?></span></th>
60
+ <th><span class="nobr"><?php echo $this->__('Status') ?></span></th>
61
+ <th><span class="nobr"><?php echo $this->__('Action') ?></span></th>
62
+ </tr>
63
+ </thead>
64
+ <tbody>
65
+ <?php $_odd = ''; ?>
66
+ <?php $statuses = Mage::helper('laybuy')->getStatuses(); ?>
67
+ <?php foreach ($_transactions as $_transaction): ?>
68
+ <?php
69
+ $currency = '';
70
+ $currency = $_transaction->getCurrency();
71
+ ?>
72
+ <tr>
73
+ <td><span class="nobr"><?php echo $this->helper('core')->formatDate($_transaction->getCreatedAt(), Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM, false) ?></span></td>
74
+ <td><?php echo Mage::app()->getLocale()->currency($currency)->toCurrency($_transaction->getAmount()) ?></td>
75
+ <td class="a-center"><?php echo $_transaction->getDownpayment() ?></td>
76
+ <td class="a-center"><?php echo $_transaction->getMonths() ?></td>
77
+ <td class="a-center"><span class="nobr"><?php echo $this->helper('core')->formatDate($_transaction->getFirstPaymentDue(), Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM, false) ?></span></td>
78
+ <td class="a-center"><span class="nobr"><?php echo $this->helper('core')->formatDate($_transaction->getLastPaymentDue(), Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM, false) ?></span></td>
79
+ <td class="a-center"><em><?php echo $statuses[$_transaction->getStatus()] ?></em></td>
80
+ <td class="a-center">
81
+ <span class="nobr"><a href="<?php echo $this->getViewUrl($_transaction) ?>"><?php echo $this->__('View') ?></a>
82
+ </span>
83
+ </td>
84
+ </tr>
85
+ <?php endforeach; ?>
86
+ </tbody>
87
+ </table>
88
+ <script type="text/javascript">decorateTable('my-transactions-table');</script>
89
+ <?php echo $this->getPagerHtml(); ?>
90
+ <?php else: ?>
91
+ <p><?php echo $this->__('You have not perform any transaction.'); ?></p>
92
+ <?php endif ?>
93
+ <div class="buttons-set">
94
+ <p class="back-link"><a href="<?php echo $this->getBackUrl() ?>"><small>&laquo; </small><?php echo $this->getBackTitle() ?></a></p>
95
+ </div>
app/design/frontend/base/default/template/laybuy/form/extra.phtml ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Lay-Buys
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * 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@magentocommerce.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.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @author Asheesh Singh<asheeshsingh@cedcoss.com>
24
+ * @copyright Copyright LAY-BUYS (2011). (http://lay-buys.com/)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+ ?>
28
+ <?php
29
+ /**
30
+ * @see Ced_LayBuy_Block_Form_Laybuy
31
+ */
32
+ ?>
33
+ <?php $_code=$this->getMethodCode() ?>
34
+ <?php
35
+ $sessionPayment = Mage::getSingleton('checkout/session')->getQuote()->getPayment();
36
+ $customerOptions = $sessionPayment->getData('additional_information');
37
+
38
+ $totals = Mage::getSingleton('checkout/session')->getQuote()->getTotals();
39
+ $grandtotal = round($totals["grand_total"]->getValue());
40
+ ?>
41
+ <ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
42
+ <li class="form-alt"><?php echo $this->getExtraMessage() ?></li>
43
+ <li>
44
+ <label for="<?php echo $_code ?>_init" class="required"><em>*</em><?php echo $this->__('Initial Payment') ?> : </label>
45
+ <div class="input-box">
46
+ <select onChange="document.getElementById('preview-tbl1').src = '<?php echo $this->getUrl('laybuy/standard/docalc'); ?>?currency=<?php echo Mage::app()->getStore()->getCurrentCurrencyCode(); ?>&amt=<?php echo $grandtotal; ?>&init='+document.getElementById('<?php echo $_code ?>_init').value+'&mnth='+document.getElementById('<?php echo $_code ?>_months').value+'&rnd='+Math.random()+'&html=1';" id="<?php echo $_code ?>_init" name="payment[additional_information][INIT]" title="<?php echo $this->__('Initial Payment') ?>" class="required-entry">
47
+ <?php foreach ($this->getArray('dp_amount') as $_data): ?>
48
+ <option value="<?php echo $_data['value'] ?>" <?php if(isset($customerOptions['INIT']) && $customerOptions['INIT'] && $customerOptions['INIT']==$_data['value']){ ?> selected="selected" <?php } ?>><?php echo $_data['label'] ?></option>
49
+ <?php endforeach ?>
50
+ </select>
51
+ </div>
52
+ </li>
53
+ <li>
54
+ <label for="<?php echo $_code ?>_months" class="required"><em>*</em><?php echo $this->__('Months to Pay') ?> : </label>
55
+ <div class="input-box">
56
+ <select onChange="document.getElementById('preview-tbl1').src = '<?php echo $this->getUrl('laybuy/standard/docalc'); ?>?currency=<?php echo Mage::app()->getStore()->getCurrentCurrencyCode(); ?>&amt=<?php echo $grandtotal; ?>&init='+document.getElementById('<?php echo $_code ?>_init').value+'&mnth='+document.getElementById('<?php echo $_code ?>_months').value+'&rnd='+Math.random()+'&html=1';" id="<?php echo $_code ?>_months" name="payment[additional_information][MONTHS]" title="<?php echo $this->__('Months to Pay') ?>" class="required-entry">
57
+ <?php $_recommendedMonth = isset($customerOptions['MONTHS'])?$customerOptions['MONTHS']:$this->getConfigData('months'); ?>
58
+ <?php foreach ($this->getArray('months') as $_data): ?>
59
+ <option value="<?php echo $_data['value'] ?>"<?php if($_data['value']==$_recommendedMonth): ?> selected="selected"<?php endif ?>><?php echo $_data['label'] ?></option>
60
+ <?php endforeach ?>
61
+ </select>
62
+ </div>
63
+ </li>
64
+ <li>
65
+ <label for="preview-tbl1"><?php echo $this->__('Plan Preview') ?></label>
66
+ <div class="input-box">
67
+ <iframe src="<?php echo $this->getUrl('laybuy/standard/docalc'); ?>?currency=<?php echo Mage::app()->getStore()->getCurrentCurrencyCode(); ?>&amt=<?php echo $grandtotal; ?>&init=<?php echo $this->getConfigData('mind'); ?>&mnth=<?php echo $this->getConfigData('months'); ?>&html=1" name="preview-tbl1" id="preview-tbl1" style="width:225%; height:157px; border:0; margin:0; overflow:hidden" marginheight="0" marginwidth="0" noscroll></iframe>
68
+ </div>
69
+ </li>
70
+ <li>
71
+ <label for="preview-tbl12"><?php echo $this->__('Your goods/services will be delivered once your final payment has been received.') ?></label>
72
+ </li>
73
+ </ul>
app/design/frontend/base/default/template/laybuy/form/laybuy.phtml ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Lay-Buys
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * 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@magentocommerce.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.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @author Asheesh Singh<asheeshsingh@cedcoss.com>
24
+ * @copyright Copyright LAY-BUYS (2011). (http://lay-buys.com/)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+ ?>
28
+ <?php
29
+ /**
30
+ * @see Ced_LayBuy_Block_Form_Laybuy
31
+ * @see Mage_Core_Block_Template
32
+ */
33
+ ?>
34
+ <!-- Include the needed css/js files-->
35
+ <link media="screen" rel="stylesheet" href="<?php echo Mage::getBaseUrl('skin'); ?>frontend/base/default/css/laybuy/tooltip.css" type="text/css">
36
+ <!--<script type="text/javascript" src="<?php //echo Mage::getBaseUrl('js'); ?>laybuy/jquery.min.js"></script>
37
+ <script type="text/javascript" src="<?php //echo Mage::getBaseUrl('js'); ?>laybuy/jquery.atooltip.js"></script>-->
38
+ <img src="<?php echo $this->escapeHtml($this->getPaymentAcceptanceMarkSrc())?>" alt="<?php echo Mage::helper('laybuy')->__('LAY-BUY') ?>" title="<?php echo $this->escapeHtml($this->getLayBuyTitle()) ?>" class="v-middle" />&nbsp;
39
+ <!--<a href="<?php echo $this->getPaymentAcceptanceMarkHref()?>" onclick="javascript:window.open('<?php echo $this->getPaymentAcceptanceMarkHref()?>','olcwhatispaypal','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, ,left=0, top=0, width=400, height=350'); return false;"><?php echo Mage::helper('laybuy')->__('What is LAY-BUY?') ?></a>-->
40
+ <a href="#<?php /*echo $this->getPaymentAcceptanceMarkHref()*/ ?>" class="callBackTip" title="<?php echo Mage::helper('laybuy')->__('Lay-Buy is an affordable payment plan option that allows you to pay-off a product or service via one down payment, with the balance paid over 1, 2 or 3 monthly instalments. Your purchase is delivered to you after the final instalment payment is completed.') ?>"><?php echo Mage::helper('laybuy')->__('What is LAY-BUY?') ?></a>
41
+ <script type="text/javscript">
42
+ // initiate the plugin after DOM has loaded
43
+ jQuery(function(){
44
+ // List of all parameters and their default values:
45
+ jQuery('a.callBackTip').aToolTip({
46
+ // no need to change/override
47
+ closeTipBtn: 'aToolTipCloseBtn',
48
+ toolTipId: 'aToolTip',
49
+ // ok to override
50
+ fixed: false, // Set true to activate fixed position
51
+ clickIt: true, // set to true for click activated tooltip
52
+ inSpeed: 200, // Speed tooltip fades in
53
+ outSpeed: 100, // Speed tooltip fades out
54
+ tipContent: '<?php echo Mage::helper('laybuy')->__('Lay-Buy is an affordable payment plan option that allows you to pay-off a product or service via one down payment, with the balance paid over 1, 2 or 3 monthly instalments. Your purchase is delivered to you after the final instalment payment is completed.') ?>', // Pass in content or it will use objects 'title' attribute
55
+ toolTipClass: 'defaultTheme', // Set class name for custom theme/styles
56
+ xOffset: 5, // x position
57
+ yOffset: 5, // y position
58
+ onShow: function(){}, // callback function that fires after atooltip has shown
59
+ onHide: function(){} // callback function that fires after atooltip has faded out
60
+ });
61
+
62
+ });
63
+ </script>
app/design/frontend/base/default/template/laybuy/form/laybuy.phtml.original ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Lay-Buys
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * 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@magentocommerce.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.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @author Asheesh Singh<asheeshsingh@cedcoss.com>
24
+ * @copyright Copyright LAY-BUYS (2011). (http://lay-buys.com/)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+ ?>
28
+ <?php
29
+ /**
30
+ * @see Ced_LayBuy_Block_Form_Laybuy
31
+ * @see Mage_Core_Block_Template
32
+ */
33
+ ?>
34
+ <!-- Include the needed css/js files-->
35
+ <link media="screen" rel="stylesheet" href="<?php echo Mage::getBaseUrl('skin'); ?>frontend/base/default/css/laybuy/tooltip.css" type="text/css">
36
+ <!--<script type="text/javascript" src="<?php //echo Mage::getBaseUrl('js'); ?>laybuy/jquery.min.js"></script>
37
+ <script type="text/javascript" src="<?php //echo Mage::getBaseUrl('js'); ?>laybuy/jquery.atooltip.js"></script>-->
38
+ <img src="<?php echo $this->escapeHtml($this->getPaymentAcceptanceMarkSrc())?>" alt="<?php echo Mage::helper('laybuy')->__('LAY-BUY') ?>" title="<?php echo $this->escapeHtml($this->getLayBuyTitle()) ?>" class="v-middle" />&nbsp;
39
+ <!--<a href="<?php echo $this->getPaymentAcceptanceMarkHref()?>" onclick="javascript:window.open('<?php echo $this->getPaymentAcceptanceMarkHref()?>','olcwhatispaypal','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, ,left=0, top=0, width=400, height=350'); return false;"><?php echo Mage::helper('laybuy')->__('What is LAY-BUY?') ?></a>-->
40
+ <a href="#<?php /*echo $this->getPaymentAcceptanceMarkHref()*/ ?>" class="callBackTip" title="<?php echo Mage::helper('laybuy')->__('Lay-Buy is the affordable payment plan option where the buyer gets to pay-off a product or service via 1 downpayment and the balance over 1, 2 or 3 monthly installments and then take delivery after the final installment payment') ?>"><?php echo Mage::helper('laybuy')->__('What is LAY-BUY?') ?></a>
41
+ <script type="text/javscript">
42
+ // initiate the plugin after DOM has loaded
43
+ jQuery(function(){
44
+ // List of all parameters and their default values:
45
+ jQuery('a.callBackTip').aToolTip({
46
+ // no need to change/override
47
+ closeTipBtn: 'aToolTipCloseBtn',
48
+ toolTipId: 'aToolTip',
49
+ // ok to override
50
+ fixed: false, // Set true to activate fixed position
51
+ clickIt: true, // set to true for click activated tooltip
52
+ inSpeed: 200, // Speed tooltip fades in
53
+ outSpeed: 100, // Speed tooltip fades out
54
+ tipContent: '<?php echo Mage::helper('laybuy')->__('Lay-Buy is the affordable payment plan option where the buyer gets to pay-off a product or service via 1 downpayment and the balance over 1, 2 or 3 monthly installments and then take delivery after the final installment payment') ?>', // Pass in content or it will use objects 'title' attribute
55
+ toolTipClass: 'defaultTheme', // Set class name for custom theme/styles
56
+ xOffset: 5, // x position
57
+ yOffset: 5, // y position
58
+ onShow: function(){}, // callback function that fires after atooltip has shown
59
+ onHide: function(){} // callback function that fires after atooltip has faded out
60
+ });
61
+
62
+ });
63
+ </script>
app/design/frontend/base/default/template/laybuy/info/default.phtml ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Lay-Buys
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * 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@magentocommerce.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.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package default_default
23
+ * @author Asheesh Singh<asheeshsingh@cedcoss.com>
24
+ * @copyright Copyright LAY-BUYS (2011). (http://lay-buys.com/)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+ ?>
28
+ <?php
29
+ /**
30
+ * @see Ced_LayBuy_Block_Info_Laybuy
31
+ */
32
+ ?>
33
+ <p><strong><?php echo $this->htmlEscape($this->getMethod()->getTitle()) ?></strong></p>
34
+ <?php if ($_specificInfo = $this->getSpecificInformation()):?>
35
+ <table>
36
+ <tbody>
37
+ <tr>
38
+ <th><strong><a href="<?php echo $this->getUrl('laybuy/report/grid',array('order_id'=>$this->getRequest()->getParam('order_id'))); ?>" ><?php echo Mage::helper('laybuy')->__('View Instalment Plan'); ?></a></strong></th>
39
+ </tr>
40
+ </tbody>
41
+ </table>
42
+ <?php else:?>
43
+ <p><?php echo $this->__('Payment Information not available.'); ?></p>
44
+ <?php endif;?>
45
+ <?php echo $this->getChildHtml()?>
app/etc/modules/Ced_LayBuy.xml ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <config>
2
+ <modules>
3
+ <Ced_LayBuy>
4
+ <active>true</active>
5
+ <codePool>local</codePool>
6
+ <!-- <depends>
7
+ <Mage_Paygate/>
8
+ <Mage_Checkout/>
9
+ <Mage_Sales/>
10
+ </depends> -->
11
+ </Ced_LayBuy>
12
+ </modules>
13
+ </config>
app/locale/en_US/Ced_LayBuy.csv ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ LayBuy Settlement Reports,LayBuy Settlement Reports
2
+ Connecting to LayBuy SFTP server to fetch new reports. Are you sure you want to proceed?,Connecting to LayBuy SFTP server to fetch new reports. Are you sure you want to proceed?
3
+ Fetch Updates,Fetch Updates
4
+ ID,ID
5
+ Created At,Created At
6
+ Order#,Order#
7
+ Amount,Amount
8
+ Down Payment %,Down Payment %
9
+ Months,Months
10
+ Downpayment Amount,Downpayment Amount
11
+ Payment Amounts,Payment Amounts
12
+ First Payment Due,First Payment Due
13
+ Last Payment Due,Last Payment Due
14
+ First Name,First Name
15
+ Last Name,Last Name
16
+ Email,Email
17
+ Address,Address
18
+ Suburb,Suburb
19
+ State,State
20
+ Country,Country
21
+ Postcode,Postcode
22
+ Action,Action
23
+ VIEW,VIEW
24
+ CSV,CSV
25
+ XML,XML
26
+ A recurring payment solution,A recurring payment solution
27
+ Click here if you are not redirected within 10 seconds�,Click here if you are not redirected within 10 seconds�
28
+ You will be redirected to the Lay-Buy website in a few seconds.,You will be redirected to the Lay-Buy website in a few seconds.
29
+ Payment Recieved.,Payment Recieved.
30
+ View Transaction,View Transaction
js/laybuy/check_jquery.js ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ if ( (typeof jQuery === 'undefined') && !window.jQuery ) {
2
+ document.write(unescape("%3Cscript type='text/javascript' src='//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js'%3E%3C/script%3E"));
3
+ } else {
4
+ if((typeof jQuery === 'undefined') && window.jQuery) {
5
+ jQuery = window.jQuery;
6
+ } else if((typeof jQuery !== 'undefined') && !window.jQuery) {
7
+ window.jQuery = jQuery;
8
+ }
9
+ }
js/laybuy/jquery.atooltip.js ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ jQuery Version: jQuery 1.3.2+
3
+ Plugin Name: aToolTip V 1.5
4
+ Plugin by: Ara Abcarians: http://ara-abcarians.com
5
+ License: aToolTip is licensed under a Creative Commons Attribution 3.0 Unported License
6
+ Read more about this license at --> http://creativecommons.org/licenses/by/3.0/
7
+ */
8
+ (function($) {
9
+ $.fn.aToolTip = function(options) {
10
+ /**
11
+ setup default settings
12
+ */
13
+ var defaults = {
14
+ // no need to change/override
15
+ closeTipBtn: 'aToolTipCloseBtn',
16
+ toolTipId: 'aToolTip',
17
+ // ok to override
18
+ fixed: false,
19
+ clickIt: false,
20
+ inSpeed: 200,
21
+ outSpeed: 100,
22
+ tipContent: '',
23
+ toolTipClass: 'defaultTheme',
24
+ xOffset: 5,
25
+ yOffset: 5,
26
+ onShow: null,
27
+ onHide: null
28
+ },
29
+ // This makes it so the users custom options overrides the default ones
30
+ settings = $.extend({}, defaults, options);
31
+
32
+ return this.each(function() {
33
+ var obj = $(this);
34
+ /**
35
+ Decide weather to use a title attr as the tooltip content
36
+ */
37
+ if(obj.attr('title')){
38
+ // set the tooltip content/text to be the obj title attribute
39
+ var tipContent = obj.attr('title');
40
+ } else {
41
+ // if no title attribute set it to the tipContent option in settings
42
+ var tipContent = settings.tipContent;
43
+ }
44
+
45
+ /**
46
+ Build the markup for aToolTip
47
+ */
48
+ var buildaToolTip = function(){
49
+ $('body').append("<div id='"+settings.toolTipId+"' class='"+settings.toolTipClass+"'><p class='aToolTipContent'>"+tipContent+"</p></div>");
50
+
51
+ if(tipContent && settings.clickIt){
52
+ $('#'+settings.toolTipId+' p.aToolTipContent')
53
+ .append("<a id='"+settings.closeTipBtn+"' href='#' alt='close'>close</a>");
54
+ }
55
+ },
56
+ /**
57
+ Position aToolTip
58
+ */
59
+ positionaToolTip = function(){
60
+ $('#'+settings.toolTipId).css({
61
+ top: (obj.offset().top - $('#'+settings.toolTipId).outerHeight() - settings.yOffset) + 'px',
62
+ left: (obj.offset().left + obj.outerWidth() + settings.xOffset) + 'px'
63
+ })
64
+ .stop().fadeIn(settings.inSpeed, function(){
65
+ if ($.isFunction(settings.onShow)){
66
+ settings.onShow(obj);
67
+ }
68
+ });
69
+ },
70
+ /**
71
+ Remove aToolTip
72
+ */
73
+ removeaToolTip = function(){
74
+ // Fade out
75
+ $('#'+settings.toolTipId).stop().fadeOut(settings.outSpeed, function(){
76
+ $(this).remove();
77
+ if($.isFunction(settings.onHide)){
78
+ settings.onHide(obj);
79
+ }
80
+ });
81
+ };
82
+
83
+ /**
84
+ Decide what kind of tooltips to display
85
+ */
86
+ // Regular aToolTip
87
+ if(tipContent && !settings.clickIt){
88
+ // Activate on hover
89
+ obj.hover(function(){
90
+ // remove already existing tooltip
91
+ $('#'+settings.toolTipId).remove();
92
+ obj.attr({title: ''});
93
+ buildaToolTip();
94
+ positionaToolTip();
95
+ }, function(){
96
+ removeaToolTip();
97
+ });
98
+ }
99
+
100
+ // Click activated aToolTip
101
+ if(tipContent && settings.clickIt){
102
+ // Activate on click
103
+ obj.click(function(el){
104
+ // remove already existing tooltip
105
+ $('#'+settings.toolTipId).remove();
106
+ obj.attr({title: ''});
107
+ buildaToolTip();
108
+ positionaToolTip();
109
+ // Click to close tooltip
110
+ $('#'+settings.closeTipBtn).click(function(){
111
+ removeaToolTip();
112
+ return false;
113
+ });
114
+ return false;
115
+ });
116
+ }
117
+
118
+ // Follow mouse if enabled
119
+ if(!settings.fixed && !settings.clickIt){
120
+ obj.mousemove(function(el){
121
+ $('#'+settings.toolTipId).css({
122
+ top: (el.pageY - $('#'+settings.toolTipId).outerHeight() - settings.yOffset),
123
+ left: (el.pageX + settings.xOffset)
124
+ });
125
+ });
126
+ }
127
+
128
+ }); // END: return this
129
+ };
130
+ })(jQuery);
131
+ jQuery.noConflict();
js/laybuy/jquery.min.js ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * jQuery JavaScript Library v1.5.2
3
+ * http://jquery.com/
4
+ *
5
+ * Copyright 2011, John Resig
6
+ * Dual licensed under the MIT or GPL Version 2 licenses.
7
+ * http://jquery.org/license
8
+ *
9
+ * Includes Sizzle.js
10
+ * http://sizzlejs.com/
11
+ * Copyright 2011, The Dojo Foundation
12
+ * Released under the MIT, BSD, and GPL Licenses.
13
+ *
14
+ * Date: Thu Mar 31 15:28:23 2011 -0400
15
+ */
16
+ (function(a,b){function ci(a){return d.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cf(a){if(!b_[a]){var b=d("<"+a+">").appendTo("body"),c=b.css("display");b.remove();if(c==="none"||c==="")c="block";b_[a]=c}return b_[a]}function ce(a,b){var c={};d.each(cd.concat.apply([],cd.slice(0,b)),function(){c[this]=a});return c}function b$(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function bZ(){try{return new a.XMLHttpRequest}catch(b){}}function bY(){d(a).unload(function(){for(var a in bW)bW[a](0,1)})}function bS(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var e=a.dataTypes,f={},g,h,i=e.length,j,k=e[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h==="string"&&(f[h.toLowerCase()]=a.converters[h]);l=k,k=e[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=f[m]||f["* "+k];if(!n){p=b;for(o in f){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=f[j[1]+" "+k];if(p){o=f[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&d.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function bR(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function bQ(a,b,c,e){if(d.isArray(b)&&b.length)d.each(b,function(b,f){c||bs.test(a)?e(a,f):bQ(a+"["+(typeof f==="object"||d.isArray(f)?b:"")+"]",f,c,e)});else if(c||b==null||typeof b!=="object")e(a,b);else if(d.isArray(b)||d.isEmptyObject(b))e(a,"");else for(var f in b)bQ(a+"["+f+"]",b[f],c,e)}function bP(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bJ,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l==="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=bP(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=bP(a,c,d,e,"*",g));return l}function bO(a){return function(b,c){typeof b!=="string"&&(c=b,b="*");if(d.isFunction(c)){var e=b.toLowerCase().split(bD),f=0,g=e.length,h,i,j;for(;f<g;f++)h=e[f],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function bq(a,b,c){var e=b==="width"?bk:bl,f=b==="width"?a.offsetWidth:a.offsetHeight;if(c==="border")return f;d.each(e,function(){c||(f-=parseFloat(d.css(a,"padding"+this))||0),c==="margin"?f+=parseFloat(d.css(a,"margin"+this))||0:f-=parseFloat(d.css(a,"border"+this+"Width"))||0});return f}function bc(a,b){b.src?d.ajax({url:b.src,async:!1,dataType:"script"}):d.globalEval(b.text||b.textContent||b.innerHTML||""),b.parentNode&&b.parentNode.removeChild(b)}function bb(a){return"getElementsByTagName"in a?a.getElementsByTagName("*"):"querySelectorAll"in a?a.querySelectorAll("*"):[]}function ba(a,b){if(b.nodeType===1){var c=b.nodeName.toLowerCase();b.clearAttributes(),b.mergeAttributes(a);if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(d.expando)}}function _(a,b){if(b.nodeType===1&&d.hasData(a)){var c=d.expando,e=d.data(a),f=d.data(b,e);if(e=e[c]){var g=e.events;f=f[c]=d.extend({},e);if(g){delete f.handle,f.events={};for(var h in g)for(var i=0,j=g[h].length;i<j;i++)d.event.add(b,h+(g[h][i].namespace?".":"")+g[h][i].namespace,g[h][i],g[h][i].data)}}}}function $(a,b){return d.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function Q(a,b,c){if(d.isFunction(b))return d.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return d.grep(a,function(a,d){return a===b===c});if(typeof b==="string"){var e=d.grep(a,function(a){return a.nodeType===1});if(L.test(b))return d.filter(b,e,!c);b=d.filter(b,e)}return d.grep(a,function(a,e){return d.inArray(a,b)>=0===c})}function P(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function H(a,b){return(a&&a!=="*"?a+".":"")+b.replace(t,"`").replace(u,"&")}function G(a){var b,c,e,f,g,h,i,j,k,l,m,n,o,p=[],q=[],s=d._data(this,"events");if(a.liveFired!==this&&s&&s.live&&!a.target.disabled&&(!a.button||a.type!=="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var t=s.live.slice(0);for(i=0;i<t.length;i++)g=t[i],g.origType.replace(r,"")===a.type?q.push(g.selector):t.splice(i--,1);f=d(a.target).closest(q,a.currentTarget);for(j=0,k=f.length;j<k;j++){m=f[j];for(i=0;i<t.length;i++){g=t[i];if(m.selector===g.selector&&(!n||n.test(g.namespace))&&!m.elem.disabled){h=m.elem,e=null;if(g.preType==="mouseenter"||g.preType==="mouseleave")a.type=g.preType,e=d(a.relatedTarget).closest(g.selector)[0];(!e||e!==h)&&p.push({elem:h,handleObj:g,level:m.level})}}}for(j=0,k=p.length;j<k;j++){f=p[j];if(c&&f.level>c)break;a.currentTarget=f.elem,a.data=f.handleObj.data,a.handleObj=f.handleObj,o=f.handleObj.origHandler.apply(f.elem,arguments);if(o===!1||a.isPropagationStopped()){c=f.level,o===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function E(a,c,e){var f=d.extend({},e[0]);f.type=a,f.originalEvent={},f.liveFired=b,d.event.handle.call(c,f),f.isDefaultPrevented()&&e[0].preventDefault()}function y(){return!0}function x(){return!1}function i(a){for(var b in a)if(b!=="toJSON")return!1;return!0}function h(a,c,e){if(e===b&&a.nodeType===1){e=a.getAttribute("data-"+c);if(typeof e==="string"){try{e=e==="true"?!0:e==="false"?!1:e==="null"?null:d.isNaN(e)?g.test(e)?d.parseJSON(e):e:parseFloat(e)}catch(f){}d.data(a,c,e)}else e=b}return e}var c=a.document,d=function(){function G(){if(!d.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(G,1);return}d.ready()}}var d=function(a,b){return new d.fn.init(a,b,g)},e=a.jQuery,f=a.$,g,h=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,i=/\S/,j=/^\s+/,k=/\s+$/,l=/\d/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=navigator.userAgent,w,x,y,z=Object.prototype.toString,A=Object.prototype.hasOwnProperty,B=Array.prototype.push,C=Array.prototype.slice,D=String.prototype.trim,E=Array.prototype.indexOf,F={};d.fn=d.prototype={constructor:d,init:function(a,e,f){var g,i,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!e&&c.body){this.context=c,this[0]=c.body,this.selector="body",this.length=1;return this}if(typeof a==="string"){g=h.exec(a);if(!g||!g[1]&&e)return!e||e.jquery?(e||f).find(a):this.constructor(e).find(a);if(g[1]){e=e instanceof d?e[0]:e,k=e?e.ownerDocument||e:c,j=m.exec(a),j?d.isPlainObject(e)?(a=[c.createElement(j[1])],d.fn.attr.call(a,e,!0)):a=[k.createElement(j[1])]:(j=d.buildFragment([g[1]],[k]),a=(j.cacheable?d.clone(j.fragment):j.fragment).childNodes);return d.merge(this,a)}i=c.getElementById(g[2]);if(i&&i.parentNode){if(i.id!==g[2])return f.find(a);this.length=1,this[0]=i}this.context=c,this.selector=a;return this}if(d.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return d.makeArray(a,this)},selector:"",jquery:"1.5.2",length:0,size:function(){return this.length},toArray:function(){return C.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var e=this.constructor();d.isArray(a)?B.apply(e,a):d.merge(e,a),e.prevObject=this,e.context=this.context,b==="find"?e.selector=this.selector+(this.selector?" ":"")+c:b&&(e.selector=this.selector+"."+b+"("+c+")");return e},each:function(a,b){return d.each(this,a,b)},ready:function(a){d.bindReady(),x.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(C.apply(this,arguments),"slice",C.call(arguments).join(","))},map:function(a){return this.pushStack(d.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:B,sort:[].sort,splice:[].splice},d.fn.init.prototype=d.fn,d.extend=d.fn.extend=function(){var a,c,e,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i==="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!=="object"&&!d.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){e=i[c],f=a[c];if(i===f)continue;l&&f&&(d.isPlainObject(f)||(g=d.isArray(f)))?(g?(g=!1,h=e&&d.isArray(e)?e:[]):h=e&&d.isPlainObject(e)?e:{},i[c]=d.extend(l,h,f)):f!==b&&(i[c]=f)}return i},d.extend({noConflict:function(b){a.$=f,b&&(a.jQuery=e);return d},isReady:!1,readyWait:1,ready:function(a){a===!0&&d.readyWait--;if(!d.readyWait||a!==!0&&!d.isReady){if(!c.body)return setTimeout(d.ready,1);d.isReady=!0;if(a!==!0&&--d.readyWait>0)return;x.resolveWith(c,[d]),d.fn.trigger&&d(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!x){x=d._Deferred();if(c.readyState==="complete")return setTimeout(d.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",y,!1),a.addEventListener("load",d.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",y),a.attachEvent("onload",d.ready);var b=!1;try{b=a.frameElement==null}catch(e){}c.documentElement.doScroll&&b&&G()}}},isFunction:function(a){return d.type(a)==="function"},isArray:Array.isArray||function(a){return d.type(a)==="array"},isWindow:function(a){return a&&typeof a==="object"&&"setInterval"in a},isNaN:function(a){return a==null||!l.test(a)||isNaN(a)},type:function(a){return a==null?String(a):F[z.call(a)]||"object"},isPlainObject:function(a){if(!a||d.type(a)!=="object"||a.nodeType||d.isWindow(a))return!1;if(a.constructor&&!A.call(a,"constructor")&&!A.call(a.constructor.prototype,"isPrototypeOf"))return!1;var c;for(c in a){}return c===b||A.call(a,c)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!=="string"||!b)return null;b=d.trim(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return a.JSON&&a.JSON.parse?a.JSON.parse(b):(new Function("return "+b))();d.error("Invalid JSON: "+b)},parseXML:function(b,c,e){a.DOMParser?(e=new DOMParser,c=e.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b)),e=c.documentElement,(!e||!e.nodeName||e.nodeName==="parsererror")&&d.error("Invalid XML: "+b);return c},noop:function(){},globalEval:function(a){if(a&&i.test(a)){var b=c.head||c.getElementsByTagName("head")[0]||c.documentElement,e=c.createElement("script");d.support.scriptEval()?e.appendChild(c.createTextNode(a)):e.text=a,b.insertBefore(e,b.firstChild),b.removeChild(e)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,e){var f,g=0,h=a.length,i=h===b||d.isFunction(a);if(e){if(i){for(f in a)if(c.apply(a[f],e)===!1)break}else for(;g<h;)if(c.apply(a[g++],e)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(var j=a[0];g<h&&c.call(j,g,j)!==!1;j=a[++g]){}return a},trim:D?function(a){return a==null?"":D.call(a)}:function(a){return a==null?"":(a+"").replace(j,"").replace(k,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var e=d.type(a);a.length==null||e==="string"||e==="function"||e==="regexp"||d.isWindow(a)?B.call(c,a):d.merge(c,a)}return c},inArray:function(a,b){if(b.indexOf)return b.indexOf(a);for(var c=0,d=b.length;c<d;c++)if(b[c]===a)return c;return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length==="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,b,c){var d=[],e;for(var f=0,g=a.length;f<g;f++)e=b(a[f],f,c),e!=null&&(d[d.length]=e);return d.concat.apply([],d)},guid:1,proxy:function(a,c,e){arguments.length===2&&(typeof c==="string"?(e=a,a=e[c],c=b):c&&!d.isFunction(c)&&(e=c,c=b)),!c&&a&&(c=function(){return a.apply(e||this,arguments)}),a&&(c.guid=a.guid=a.guid||c.guid||d.guid++);return c},access:function(a,c,e,f,g,h){var i=a.length;if(typeof c==="object"){for(var j in c)d.access(a,j,c[j],f,g,e);return a}if(e!==b){f=!h&&f&&d.isFunction(e);for(var k=0;k<i;k++)g(a[k],c,f?e.call(a[k],k,g(a[k],c)):e,h);return a}return i?g(a[0],c):b},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=r.exec(a)||s.exec(a)||t.exec(a)||a.indexOf("compatible")<0&&u.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}d.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.subclass=this.subclass,a.fn.init=function b(b,c){c&&c instanceof d&&!(c instanceof a)&&(c=a(c));return d.fn.init.call(this,b,c,e)},a.fn.init.prototype=a.fn;var e=a(c);return a},browser:{}}),d.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){F["[object "+b+"]"]=b.toLowerCase()}),w=d.uaMatch(v),w.browser&&(d.browser[w.browser]=!0,d.browser.version=w.version),d.browser.webkit&&(d.browser.safari=!0),E&&(d.inArray=function(a,b){return E.call(b,a)}),i.test(" ")&&(j=/^[\s\xA0]+/,k=/[\s\xA0]+$/),g=d(c),c.addEventListener?y=function(){c.removeEventListener("DOMContentLoaded",y,!1),d.ready()}:c.attachEvent&&(y=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",y),d.ready())});return d}(),e="then done fail isResolved isRejected promise".split(" "),f=[].slice;d.extend({_Deferred:function(){var a=[],b,c,e,f={done:function(){if(!e){var c=arguments,g,h,i,j,k;b&&(k=b,b=0);for(g=0,h=c.length;g<h;g++)i=c[g],j=d.type(i),j==="array"?f.done.apply(f,i):j==="function"&&a.push(i);k&&f.resolveWith(k[0],k[1])}return this},resolveWith:function(d,f){if(!e&&!b&&!c){f=f||[],c=1;try{while(a[0])a.shift().apply(d,f)}finally{b=[d,f],c=0}}return this},resolve:function(){f.resolveWith(this,arguments);return this},isResolved:function(){return c||b},cancel:function(){e=1,a=[];return this}};return f},Deferred:function(a){var b=d._Deferred(),c=d._Deferred(),f;d.extend(b,{then:function(a,c){b.done(a).fail(c);return this},fail:c.done,rejectWith:c.resolveWith,reject:c.resolve,isRejected:c.isResolved,promise:function(a){if(a==null){if(f)return f;f=a={}}var c=e.length;while(c--)a[e[c]]=b[e[c]];return a}}),b.done(c.cancel).fail(b.cancel),delete b.cancel,a&&a.call(b,b);return b},when:function(a){function i(a){return function(c){b[a]=arguments.length>1?f.call(arguments,0):c,--g||h.resolveWith(h,f.call(b,0))}}var b=arguments,c=0,e=b.length,g=e,h=e<=1&&a&&d.isFunction(a.promise)?a:d.Deferred();if(e>1){for(;c<e;c++)b[c]&&d.isFunction(b[c].promise)?b[c].promise().then(i(c),h.reject):--g;g||h.resolveWith(h,b)}else h!==a&&h.resolveWith(h,e?[a]:[]);return h.promise()}}),function(){d.support={};var b=c.createElement("div");b.style.display="none",b.innerHTML=" <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";var e=b.getElementsByTagName("*"),f=b.getElementsByTagName("a")[0],g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=b.getElementsByTagName("input")[0];if(e&&e.length&&f){d.support={leadingWhitespace:b.firstChild.nodeType===3,tbody:!b.getElementsByTagName("tbody").length,htmlSerialize:!!b.getElementsByTagName("link").length,style:/red/.test(f.getAttribute("style")),hrefNormalized:f.getAttribute("href")==="/a",opacity:/^0.55$/.test(f.style.opacity),cssFloat:!!f.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,deleteExpando:!0,optDisabled:!1,checkClone:!1,noCloneEvent:!0,noCloneChecked:!0,boxModel:null,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableHiddenOffsets:!0,reliableMarginRight:!0},i.checked=!0,d.support.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,d.support.optDisabled=!h.disabled;var j=null;d.support.scriptEval=function(){if(j===null){var b=c.documentElement,e=c.createElement("script"),f="script"+d.now();try{e.appendChild(c.createTextNode("window."+f+"=1;"))}catch(g){}b.insertBefore(e,b.firstChild),a[f]?(j=!0,delete a[f]):j=!1,b.removeChild(e)}return j};try{delete b.test}catch(k){d.support.deleteExpando=!1}!b.addEventListener&&b.attachEvent&&b.fireEvent&&(b.attachEvent("onclick",function l(){d.support.noCloneEvent=!1,b.detachEvent("onclick",l)}),b.cloneNode(!0).fireEvent("onclick")),b=c.createElement("div"),b.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";var m=c.createDocumentFragment();m.appendChild(b.firstChild),d.support.checkClone=m.cloneNode(!0).cloneNode(!0).lastChild.checked,d(function(){var a=c.createElement("div"),b=c.getElementsByTagName("body")[0];if(b){a.style.width=a.style.paddingLeft="1px",b.appendChild(a),d.boxModel=d.support.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,d.support.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="<div style='width:4px;'></div>",d.support.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";var e=a.getElementsByTagName("td");d.support.reliableHiddenOffsets=e[0].offsetHeight===0,e[0].style.display="",e[1].style.display="none",d.support.reliableHiddenOffsets=d.support.reliableHiddenOffsets&&e[0].offsetHeight===0,a.innerHTML="",c.defaultView&&c.defaultView.getComputedStyle&&(a.style.width="1px",a.style.marginRight="0",d.support.reliableMarginRight=(parseInt(c.defaultView.getComputedStyle(a,null).marginRight,10)||0)===0),b.removeChild(a).style.display="none",a=e=null}});var n=function(a){var b=c.createElement("div");a="on"+a;if(!b.attachEvent)return!0;var d=a in b;d||(b.setAttribute(a,"return;"),d=typeof b[a]==="function");return d};d.support.submitBubbles=n("submit"),d.support.changeBubbles=n("change"),b=e=f=null}}();var g=/^(?:\{.*\}|\[.*\])$/;d.extend({cache:{},uuid:0,expando:"jQuery"+(d.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?d.cache[a[d.expando]]:a[d.expando];return!!a&&!i(a)},data:function(a,c,e,f){if(d.acceptData(a)){var g=d.expando,h=typeof c==="string",i,j=a.nodeType,k=j?d.cache:a,l=j?a[d.expando]:a[d.expando]&&d.expando;if((!l||f&&l&&!k[l][g])&&h&&e===b)return;l||(j?a[d.expando]=l=++d.uuid:l=d.expando),k[l]||(k[l]={},j||(k[l].toJSON=d.noop));if(typeof c==="object"||typeof c==="function")f?k[l][g]=d.extend(k[l][g],c):k[l]=d.extend(k[l],c);i=k[l],f&&(i[g]||(i[g]={}),i=i[g]),e!==b&&(i[c]=e);if(c==="events"&&!i[c])return i[g]&&i[g].events;return h?i[c]:i}},removeData:function(b,c,e){if(d.acceptData(b)){var f=d.expando,g=b.nodeType,h=g?d.cache:b,j=g?b[d.expando]:d.expando;if(!h[j])return;if(c){var k=e?h[j][f]:h[j];if(k){delete k[c];if(!i(k))return}}if(e){delete h[j][f];if(!i(h[j]))return}var l=h[j][f];d.support.deleteExpando||h!=a?delete h[j]:h[j]=null,l?(h[j]={},g||(h[j].toJSON=d.noop),h[j][f]=l):g&&(d.support.deleteExpando?delete b[d.expando]:b.removeAttribute?b.removeAttribute(d.expando):b[d.expando]=null)}},_data:function(a,b,c){return d.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=d.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),d.fn.extend({data:function(a,c){var e=null;if(typeof a==="undefined"){if(this.length){e=d.data(this[0]);if(this[0].nodeType===1){var f=this[0].attributes,g;for(var i=0,j=f.length;i<j;i++)g=f[i].name,g.indexOf("data-")===0&&(g=g.substr(5),h(this[0],g,e[g]))}}return e}if(typeof a==="object")return this.each(function(){d.data(this,a)});var k=a.split(".");k[1]=k[1]?"."+k[1]:"";if(c===b){e=this.triggerHandler("getData"+k[1]+"!",[k[0]]),e===b&&this.length&&(e=d.data(this[0],a),e=h(this[0],a,e));return e===b&&k[1]?this.data(k[0]):e}return this.each(function(){var b=d(this),e=[k[0],c];b.triggerHandler("setData"+k[1]+"!",e),d.data(this,a,c),b.triggerHandler("changeData"+k[1]+"!",e)})},removeData:function(a){return this.each(function(){d.removeData(this,a)})}}),d.extend({queue:function(a,b,c){if(a){b=(b||"fx")+"queue";var e=d._data(a,b);if(!c)return e||[];!e||d.isArray(c)?e=d._data(a,b,d.makeArray(c)):e.push(c);return e}},dequeue:function(a,b){b=b||"fx";var c=d.queue(a,b),e=c.shift();e==="inprogress"&&(e=c.shift()),e&&(b==="fx"&&c.unshift("inprogress"),e.call(a,function(){d.dequeue(a,b)})),c.length||d.removeData(a,b+"queue",!0)}}),d.fn.extend({queue:function(a,c){typeof a!=="string"&&(c=a,a="fx");if(c===b)return d.queue(this[0],a);return this.each(function(b){var e=d.queue(this,a,c);a==="fx"&&e[0]!=="inprogress"&&d.dequeue(this,a)})},dequeue:function(a){return this.each(function(){d.dequeue(this,a)})},delay:function(a,b){a=d.fx?d.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(){var c=this;setTimeout(function(){d.dequeue(c,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var j=/[\n\t\r]/g,k=/\s+/,l=/\r/g,m=/^(?:href|src|style)$/,n=/^(?:button|input)$/i,o=/^(?:button|input|object|select|textarea)$/i,p=/^a(?:rea)?$/i,q=/^(?:radio|checkbox)$/i;d.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"},d.fn.extend({attr:function(a,b){return d.access(this,a,b,!0,d.attr)},removeAttr:function(a,b){return this.each(function(){d.attr(this,a,""),this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(d.isFunction(a))return this.each(function(b){var c=d(this);c.addClass(a.call(this,b,c.attr("class")))});if(a&&typeof a==="string"){var b=(a||"").split(k);for(var c=0,e=this.length;c<e;c++){var f=this[c];if(f.nodeType===1)if(f.className){var g=" "+f.className+" ",h=f.className;for(var i=0,j=b.length;i<j;i++)g.indexOf(" "+b[i]+" ")<0&&(h+=" "+b[i]);f.className=d.trim(h)}else f.className=a}}return this},removeClass:function(a){if(d.isFunction(a))return this.each(function(b){var c=d(this);c.removeClass(a.call(this,b,c.attr("class")))});if(a&&typeof a==="string"||a===b){var c=(a||"").split(k);for(var e=0,f=this.length;e<f;e++){var g=this[e];if(g.nodeType===1&&g.className)if(a){var h=(" "+g.className+" ").replace(j," ");for(var i=0,l=c.length;i<l;i++)h=h.replace(" "+c[i]+" "," ");g.className=d.trim(h)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,e=typeof b==="boolean";if(d.isFunction(a))return this.each(function(c){var e=d(this);e.toggleClass(a.call(this,c,e.attr("class"),b),b)});return this.each(function(){if(c==="string"){var f,g=0,h=d(this),i=b,j=a.split(k);while(f=j[g++])i=e?i:!h.hasClass(f),h[i?"addClass":"removeClass"](f)}else if(c==="undefined"||c==="boolean")this.className&&d._data(this,"__className__",this.className),this.className=this.className||a===!1?"":d._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ";for(var c=0,d=this.length;c<d;c++)if((" "+this[c].className+" ").replace(j," ").indexOf(b)>-1)return!0;return!1},val:function(a){if(!arguments.length){var c=this[0];if(c){if(d.nodeName(c,"option")){var e=c.attributes.value;return!e||e.specified?c.value:c.text}if(d.nodeName(c,"select")){var f=c.selectedIndex,g=[],h=c.options,i=c.type==="select-one";if(f<0)return null;for(var j=i?f:0,k=i?f+1:h.length;j<k;j++){var m=h[j];if(m.selected&&(d.support.optDisabled?!m.disabled:m.getAttribute("disabled")===null)&&(!m.parentNode.disabled||!d.nodeName(m.parentNode,"optgroup"))){a=d(m).val();if(i)return a;g.push(a)}}if(i&&!g.length&&h.length)return d(h[f]).val();return g}if(q.test(c.type)&&!d.support.checkOn)return c.getAttribute("value")===null?"on":c.value;return(c.value||"").replace(l,"")}return b}var n=d.isFunction(a);return this.each(function(b){var c=d(this),e=a;if(this.nodeType===1){n&&(e=a.call(this,b,c.val())),e==null?e="":typeof e==="number"?e+="":d.isArray(e)&&(e=d.map(e,function(a){return a==null?"":a+""}));if(d.isArray(e)&&q.test(this.type))this.checked=d.inArray(c.val(),e)>=0;else if(d.nodeName(this,"select")){var f=d.makeArray(e);d("option",this).each(function(){this.selected=d.inArray(d(this).val(),f)>=0}),f.length||(this.selectedIndex=-1)}else this.value=e}})}}),d.extend({attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,e,f){if(!a||a.nodeType===3||a.nodeType===8||a.nodeType===2)return b;if(f&&c in d.attrFn)return d(a)[c](e);var g=a.nodeType!==1||!d.isXMLDoc(a),h=e!==b;c=g&&d.props[c]||c;if(a.nodeType===1){var i=m.test(c);if(c==="selected"&&!d.support.optSelected){var j=a.parentNode;j&&(j.selectedIndex,j.parentNode&&j.parentNode.selectedIndex)}if((c in a||a[c]!==b)&&g&&!i){h&&(c==="type"&&n.test(a.nodeName)&&a.parentNode&&d.error("type property can't be changed"),e===null?a.nodeType===1&&a.removeAttribute(c):a[c]=e);if(d.nodeName(a,"form")&&a.getAttributeNode(c))return a.getAttributeNode(c).nodeValue;if(c==="tabIndex"){var k=a.getAttributeNode("tabIndex");return k&&k.specified?k.value:o.test(a.nodeName)||p.test(a.nodeName)&&a.href?0:b}return a[c]}if(!d.support.style&&g&&c==="style"){h&&(a.style.cssText=""+e);return a.style.cssText}h&&a.setAttribute(c,""+e);if(!a.attributes[c]&&(a.hasAttribute&&!a.hasAttribute(c)))return b;var l=!d.support.hrefNormalized&&g&&i?a.getAttribute(c,2):a.getAttribute(c);return l===null?b:l}h&&(a[c]=e);return a[c]}});var r=/\.(.*)$/,s=/^(?:textarea|input|select)$/i,t=/\./g,u=/ /g,v=/[^\w\s.|`]/g,w=function(a){return a.replace(v,"\\$&")};d.event={add:function(c,e,f,g){if(c.nodeType!==3&&c.nodeType!==8){try{d.isWindow(c)&&(c!==a&&!c.frameElement)&&(c=a)}catch(h){}if(f===!1)f=x;else if(!f)return;var i,j;f.handler&&(i=f,f=i.handler),f.guid||(f.guid=d.guid++);var k=d._data(c);if(!k)return;var l=k.events,m=k.handle;l||(k.events=l={}),m||(k.handle=m=function(a){return typeof d!=="undefined"&&d.event.triggered!==a.type?d.event.handle.apply(m.elem,arguments):b}),m.elem=c,e=e.split(" ");var n,o=0,p;while(n=e[o++]){j=i?d.extend({},i):{handler:f,data:g},n.indexOf(".")>-1?(p=n.split("."),n=p.shift(),j.namespace=p.slice(0).sort().join(".")):(p=[],j.namespace=""),j.type=n,j.guid||(j.guid=f.guid);var q=l[n],r=d.event.special[n]||{};if(!q){q=l[n]=[];if(!r.setup||r.setup.call(c,g,p,m)===!1)c.addEventListener?c.addEventListener(n,m,!1):c.attachEvent&&c.attachEvent("on"+n,m)}r.add&&(r.add.call(c,j),j.handler.guid||(j.handler.guid=f.guid)),q.push(j),d.event.global[n]=!0}c=null}},global:{},remove:function(a,c,e,f){if(a.nodeType!==3&&a.nodeType!==8){e===!1&&(e=x);var g,h,i,j,k=0,l,m,n,o,p,q,r,s=d.hasData(a)&&d._data(a),t=s&&s.events;if(!s||!t)return;c&&c.type&&(e=c.handler,c=c.type);if(!c||typeof c==="string"&&c.charAt(0)==="."){c=c||"";for(h in t)d.event.remove(a,h+c);return}c=c.split(" ");while(h=c[k++]){r=h,q=null,l=h.indexOf(".")<0,m=[],l||(m=h.split("."),h=m.shift(),n=new RegExp("(^|\\.)"+d.map(m.slice(0).sort(),w).join("\\.(?:.*\\.)?")+"(\\.|$)")),p=t[h];if(!p)continue;if(!e){for(j=0;j<p.length;j++){q=p[j];if(l||n.test(q.namespace))d.event.remove(a,r,q.handler,j),p.splice(j--,1)}continue}o=d.event.special[h]||{};for(j=f||0;j<p.length;j++){q=p[j];if(e.guid===q.guid){if(l||n.test(q.namespace))f==null&&p.splice(j--,1),o.remove&&o.remove.call(a,q);if(f!=null)break}}if(p.length===0||f!=null&&p.length===1)(!o.teardown||o.teardown.call(a,m)===!1)&&d.removeEvent(a,h,s.handle),g=null,delete t[h]}if(d.isEmptyObject(t)){var u=s.handle;u&&(u.elem=null),delete s.events,delete s.handle,d.isEmptyObject(s)&&d.removeData(a,b,!0)}}},trigger:function(a,c,e){var f=a.type||a,g=arguments[3];if(!g){a=typeof a==="object"?a[d.expando]?a:d.extend(d.Event(f),a):d.Event(f),f.indexOf("!")>=0&&(a.type=f=f.slice(0,-1),a.exclusive=!0),e||(a.stopPropagation(),d.event.global[f]&&d.each(d.cache,function(){var b=d.expando,e=this[b];e&&e.events&&e.events[f]&&d.event.trigger(a,c,e.handle.elem)}));if(!e||e.nodeType===3||e.nodeType===8)return b;a.result=b,a.target=e,c=d.makeArray(c),c.unshift(a)}a.currentTarget=e;var h=d._data(e,"handle");h&&h.apply(e,c);var i=e.parentNode||e.ownerDocument;try{e&&e.nodeName&&d.noData[e.nodeName.toLowerCase()]||e["on"+f]&&e["on"+f].apply(e,c)===!1&&(a.result=!1,a.preventDefault())}catch(j){}if(!a.isPropagationStopped()&&i)d.event.trigger(a,c,i,!0);else if(!a.isDefaultPrevented()){var k,l=a.target,m=f.replace(r,""),n=d.nodeName(l,"a")&&m==="click",o=d.event.special[m]||{};if((!o._default||o._default.call(e,a)===!1)&&!n&&!(l&&l.nodeName&&d.noData[l.nodeName.toLowerCase()])){try{l[m]&&(k=l["on"+m],k&&(l["on"+m]=null),d.event.triggered=a.type,l[m]())}catch(p){}k&&(l["on"+m]=k),d.event.triggered=b}}},handle:function(c){var e,f,g,h,i,j=[],k=d.makeArray(arguments);c=k[0]=d.event.fix(c||a.event),c.currentTarget=this,e=c.type.indexOf(".")<0&&!c.exclusive,e||(g=c.type.split("."),c.type=g.shift(),j=g.slice(0).sort(),h=new RegExp("(^|\\.)"+j.join("\\.(?:.*\\.)?")+"(\\.|$)")),c.namespace=c.namespace||j.join("."),i=d._data(this,"events"),f=(i||{})[c.type];if(i&&f){f=f.slice(0);for(var l=0,m=f.length;l<m;l++){var n=f[l];if(e||h.test(n.namespace)){c.handler=n.handler,c.data=n.data,c.handleObj=n;var o=n.handler.apply(this,k);o!==b&&(c.result=o,o===!1&&(c.preventDefault(),c.stopPropagation()));if(c.isImmediatePropagationStopped())break}}}return c.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(a){if(a[d.expando])return a;var e=a;a=d.Event(e);for(var f=this.props.length,g;f;)g=this.props[--f],a[g]=e[g];a.target||(a.target=a.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),!a.relatedTarget&&a.fromElement&&(a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement);if(a.pageX==null&&a.clientX!=null){var h=c.documentElement,i=c.body;a.pageX=a.clientX+(h&&h.scrollLeft||i&&i.scrollLeft||0)-(h&&h.clientLeft||i&&i.clientLeft||0),a.pageY=a.clientY+(h&&h.scrollTop||i&&i.scrollTop||0)-(h&&h.clientTop||i&&i.clientTop||0)}a.which==null&&(a.charCode!=null||a.keyCode!=null)&&(a.which=a.charCode!=null?a.charCode:a.keyCode),!a.metaKey&&a.ctrlKey&&(a.metaKey=a.ctrlKey),!a.which&&a.button!==b&&(a.which=a.button&1?1:a.button&2?3:a.button&4?2:0);return a},guid:1e8,proxy:d.proxy,special:{ready:{setup:d.bindReady,teardown:d.noop},live:{add:function(a){d.event.add(this,H(a.origType,a.selector),d.extend({},a,{handler:G,guid:a.handler.guid}))},remove:function(a){d.event.remove(this,H(a.origType,a.selector),a)}},beforeunload:{setup:function(a,b,c){d.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}}},d.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},d.Event=function(a){if(!this.preventDefault)return new d.Event(a);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?y:x):this.type=a,this.timeStamp=d.now(),this[d.expando]=!0},d.Event.prototype={preventDefault:function(){this.isDefaultPrevented=y;var a=this.originalEvent;a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=y;var a=this.originalEvent;a&&(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=y,this.stopPropagation()},isDefaultPrevented:x,isPropagationStopped:x,isImmediatePropagationStopped:x};var z=function(a){var b=a.relatedTarget;try{if(b&&b!==c&&!b.parentNode)return;while(b&&b!==this)b=b.parentNode;b!==this&&(a.type=a.data,d.event.handle.apply(this,arguments))}catch(e){}},A=function(a){a.type=a.data,d.event.handle.apply(this,arguments)};d.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){d.event.special[a]={setup:function(c){d.event.add(this,b,c&&c.selector?A:z,a)},teardown:function(a){d.event.remove(this,b,a&&a.selector?A:z)}}}),d.support.submitBubbles||(d.event.special.submit={setup:function(a,b){if(this.nodeName&&this.nodeName.toLowerCase()!=="form")d.event.add(this,"click.specialSubmit",function(a){var b=a.target,c=b.type;(c==="submit"||c==="image")&&d(b).closest("form").length&&E("submit",this,arguments)}),d.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,c=b.type;(c==="text"||c==="password")&&d(b).closest("form").length&&a.keyCode===13&&E("submit",this,arguments)});else return!1},teardown:function(a){d.event.remove(this,".specialSubmit")}});if(!d.support.changeBubbles){var B,C=function(a){var b=a.type,c=a.value;b==="radio"||b==="checkbox"?c=a.checked:b==="select-multiple"?c=a.selectedIndex>-1?d.map(a.options,function(a){return a.selected}).join("-"):"":a.nodeName.toLowerCase()==="select"&&(c=a.selectedIndex);return c},D=function D(a){var c=a.target,e,f;if(s.test(c.nodeName)&&!c.readOnly){e=d._data(c,"_change_data"),f=C(c),(a.type!=="focusout"||c.type!=="radio")&&d._data(c,"_change_data",f);if(e===b||f===e)return;if(e!=null||f)a.type="change",a.liveFired=b,d.event.trigger(a,arguments[1],c)}};d.event.special.change={filters:{focusout:D,beforedeactivate:D,click:function(a){var b=a.target,c=b.type;(c==="radio"||c==="checkbox"||b.nodeName.toLowerCase()==="select")&&D.call(this,a)},keydown:function(a){var b=a.target,c=b.type;(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(c==="checkbox"||c==="radio")||c==="select-multiple")&&D.call(this,a)},beforeactivate:function(a){var b=a.target;d._data(b,"_change_data",C(b))}},setup:function(a,b){if(this.type==="file")return!1;for(var c in B)d.event.add(this,c+".specialChange",B[c]);return s.test(this.nodeName)},teardown:function(a){d.event.remove(this,".specialChange");return s.test(this.nodeName)}},B=d.event.special.change.filters,B.focus=B.beforeactivate}c.addEventListener&&d.each({focus:"focusin",blur:"focusout"},function(a,b){function f(a){var c=d.event.fix(a);c.type=b,c.originalEvent={},d.event.trigger(c,null,c.target),c.isDefaultPrevented()&&a.preventDefault()}var e=0;d.event.special[b]={setup:function(){e++===0&&c.addEventListener(a,f,!0)},teardown:function(){--e===0&&c.removeEventListener(a,f,!0)}}}),d.each(["bind","one"],function(a,c){d.fn[c]=function(a,e,f){if(typeof a==="object"){for(var g in a)this[c](g,e,a[g],f);return this}if(d.isFunction(e)||e===!1)f=e,e=b;var h=c==="one"?d.proxy(f,function(a){d(this).unbind(a,h);return f.apply(this,arguments)}):f;if(a==="unload"&&c!=="one")this.one(a,e,f);else for(var i=0,j=this.length;i<j;i++)d.event.add(this[i],a,h,e);return this}}),d.fn.extend({unbind:function(a,b){if(typeof a!=="object"||a.preventDefault)for(var e=0,f=this.length;e<f;e++)d.event.remove(this[e],a,b);else for(var c in a)this.unbind(c,a[c]);return this},delegate:function(a,b,c,d){return this.live(b,c,d,a)},undelegate:function(a,b,c){return arguments.length===0?this.unbind("live"):this.die(b,null,c,a)},trigger:function(a,b){return this.each(function(){d.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){var c=d.Event(a);c.preventDefault(),c.stopPropagation(),d.event.trigger(c,b,this[0]);return c.result}},toggle:function(a){var b=arguments,c=1;while(c<b.length)d.proxy(a,b[c++]);return this.click(d.proxy(a,function(e){var f=(d._data(this,"lastToggle"+a.guid)||0)%c;d._data(this,"lastToggle"+a.guid,f+1),e.preventDefault();return b[f].apply(this,arguments)||!1}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var F={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};d.each(["live","die"],function(a,c){d.fn[c]=function(a,e,f,g){var h,i=0,j,k,l,m=g||this.selector,n=g?this:d(this.context);if(typeof a==="object"&&!a.preventDefault){for(var o in a)n[c](o,e,a[o],m);return this}d.isFunction(e)&&(f=e,e=b),a=(a||"").split(" ");while((h=a[i++])!=null){j=r.exec(h),k="",j&&(k=j[0],h=h.replace(r,""));if(h==="hover"){a.push("mouseenter"+k,"mouseleave"+k);continue}l=h,h==="focus"||h==="blur"?(a.push(F[h]+k),h=h+k):h=(F[h]||h)+k;if(c==="live")for(var p=0,q=n.length;p<q;p++)d.event.add(n[p],"live."+H(h,m),{data:e,selector:m,handler:f,origType:h,origHandler:f,preType:l});else n.unbind("live."+H(h,m),f)}return this}}),d.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(a,b){d.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.bind(b,a,c):this.trigger(b)},d.attrFn&&(d.attrFn[b]=!0)}),function(){function u(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}if(i.nodeType===1){f||(i.sizcache=c,i.sizset=g);if(typeof b!=="string"){if(i===b){j=!0;break}}else if(k.filter(b,[i]).length>0){j=i;break}}i=i[a]}d[g]=j}}}function t(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}i.nodeType===1&&!f&&(i.sizcache=c,i.sizset=g);if(i.nodeName.toLowerCase()===b){j=i;break}i=i[a]}d[g]=j}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e=0,f=Object.prototype.toString,g=!1,h=!0,i=/\\/g,j=/\W/;[0,0].sort(function(){h=!1;return 0});var k=function(b,d,e,g){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!=="string")return e;var i,j,n,o,q,r,s,t,u=!0,w=k.isXML(d),x=[],y=b;do{a.exec(""),i=a.exec(y);if(i){y=i[3],x.push(i[1]);if(i[2]){o=i[3];break}}}while(i);if(x.length>1&&m.exec(b))if(x.length===2&&l.relative[x[0]])j=v(x[0]+x[1],d);else{j=l.relative[x[0]]?[d]:k(x.shift(),d);while(x.length)b=x.shift(),l.relative[b]&&(b+=x.shift()),j=v(b,j)}else{!g&&x.length>1&&d.nodeType===9&&!w&&l.match.ID.test(x[0])&&!l.match.ID.test(x[x.length-1])&&(q=k.find(x.shift(),d,w),d=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]);if(d){q=g?{expr:x.pop(),set:p(g)}:k.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&d.parentNode?d.parentNode:d,w),j=q.expr?k.filter(q.expr,q.set):q.set,x.length>0?n=p(j):u=!1;while(x.length)r=x.pop(),s=r,l.relative[r]?s=x.pop():r="",s==null&&(s=d),l.relative[r](n,s,w)}else n=x=[]}n||(n=j),n||k.error(r||b);if(f.call(n)==="[object Array]")if(u)if(d&&d.nodeType===1)for(t=0;n[t]!=null;t++)n[t]&&(n[t]===!0||n[t].nodeType===1&&k.contains(d,n[t]))&&e.push(j[t]);else for(t=0;n[t]!=null;t++)n[t]&&n[t].nodeType===1&&e.push(j[t]);else e.push.apply(e,n);else p(n,e);o&&(k(o,h,e,g),k.uniqueSort(e));return e};k.uniqueSort=function(a){if(r){g=h,a.sort(r);if(g)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},k.matches=function(a,b){return k(a,null,null,b)},k.matchesSelector=function(a,b){return k(b,null,null,[a]).length>0},k.find=function(a,b,c){var d;if(!a)return[];for(var e=0,f=l.order.length;e<f;e++){var g,h=l.order[e];if(g=l.leftMatch[h].exec(a)){var j=g[1];g.splice(1,1);if(j.substr(j.length-1)!=="\\"){g[1]=(g[1]||"").replace(i,""),d=l.find[h](g,b,c);if(d!=null){a=a.replace(l.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!=="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},k.filter=function(a,c,d,e){var f,g,h=a,i=[],j=c,m=c&&c[0]&&k.isXML(c[0]);while(a&&c.length){for(var n in l.filter)if((f=l.leftMatch[n].exec(a))!=null&&f[2]){var o,p,q=l.filter[n],r=f[1];g=!1,f.splice(1,1);if(r.substr(r.length-1)==="\\")continue;j===i&&(i=[]);if(l.preFilter[n]){f=l.preFilter[n](f,j,d,i,e,m);if(f){if(f===!0)continue}else g=o=!0}if(f)for(var s=0;(p=j[s])!=null;s++)if(p){o=q(p,f,s,j);var t=e^!!o;d&&o!=null?t?g=!0:j[s]=!1:t&&(i.push(p),g=!0)}if(o!==b){d||(j=i),a=a.replace(l.match[n],"");if(!g)return[];break}}if(a===h)if(g==null)k.error(a);else break;h=a}return j},k.error=function(a){throw"Syntax error, unrecognized expression: "+a};var l=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b==="string",d=c&&!j.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1){}a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&k.filter(b,a,!0)},">":function(a,b){var c,d=typeof b==="string",e=0,f=a.length;if(d&&!j.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&k.filter(b,a,!0)}},"":function(a,b,c){var d,f=e++,g=u;typeof b==="string"&&!j.test(b)&&(b=b.toLowerCase(),d=b,g=t),g("parentNode",b,f,a,d,c)},"~":function(a,b,c){var d,f=e++,g=u;typeof b==="string"&&!j.test(b)&&(b=b.toLowerCase(),d=b,g=t),g("previousSibling",b,f,a,d,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!=="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!=="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!=="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(i,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(i,"")},TAG:function(a,b){return a[1].replace(i,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||k.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&k.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(i,"");!f&&l.attrMap[g]&&(a[1]=l.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(i,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=k(b[3],null,null,c);else{var g=k.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(l.match.POS.test(b[0])||l.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!k(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return"text"===c&&(b===c||b===null)},radio:function(a){return"radio"===a.type},checkbox:function(a){return"checkbox"===a.type},file:function(a){return"file"===a.type},password:function(a){return"password"===a.type},submit:function(a){return"submit"===a.type},image:function(a){return"image"===a.type},reset:function(a){return"reset"===a.type},button:function(a){return"button"===a.type||a.nodeName.toLowerCase()==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=l.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||k.getText([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}k.error(e)},CHILD:function(a,b){var c=b[1],d=a;switch(c){case"only":case"first":while(d=d.previousSibling)if(d.nodeType===1)return!1;if(c==="first")return!0;d=a;case"last":while(d=d.nextSibling)if(d.nodeType===1)return!1;return!0;case"nth":var e=b[2],f=b[3];if(e===1&&f===0)return!0;var g=b[0],h=a.parentNode;if(h&&(h.sizcache!==g||!a.nodeIndex)){var i=0;for(d=h.firstChild;d;d=d.nextSibling)d.nodeType===1&&(d.nodeIndex=++i);h.sizcache=g}var j=a.nodeIndex-f;return e===0?j===0:j%e===0&&j/e>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=l.attrHandle[c]?l.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=l.setFilters[e];if(f)return f(a,c,b,d)}}},m=l.match.POS,n=function(a,b){return"\\"+(b-0+1)};for(var o in l.match)l.match[o]=new RegExp(l.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source),l.leftMatch[o]=new RegExp(/(^(?:.|\r|\n)*?)/.source+l.match[o].source.replace(/\\(\d+)/g,n));var p=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(q){p=function(a,b){var c=0,d=b||[];if(f.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length==="number")for(var e=a.length;c<e;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var r,s;c.documentElement.compareDocumentPosition?r=function(a,b){if(a===b){g=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(r=function(a,b){var c,d,e=[],f=[],h=a.parentNode,i=b.parentNode,j=h;if(a===b){g=!0;return 0}if(h===i)return s(a,b);if(!h)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return s(e[k],f[k]);return k===c?s(a,f[k],-1):s(e[k],b,1)},s=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),k.getText=function(a){var b="",c;for(var d=0;a[d];d++)c=a[d],c.nodeType===3||c.nodeType===4?b+=c.nodeValue:c.nodeType!==8&&(b+=k.getText(c.childNodes));return b},function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(l.find.ID=function(a,c,d){if(typeof c.getElementById!=="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!=="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},l.filter.ID=function(a,b){var c=typeof a.getAttributeNode!=="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(l.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!=="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(l.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=k,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){k=function(b,e,f,g){e=e||c;if(!g&&!k.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return p(e.getElementsByTagName(b),f);if(h[2]&&l.find.CLASS&&e.getElementsByClassName)return p(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return p([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return p([],f);if(i.id===h[3])return p([i],f)}try{return p(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var m=e,n=e.getAttribute("id"),o=n||d,q=e.parentNode,r=/^\s*[+~]/.test(b);n?o=o.replace(/'/g,"\\$&"):e.setAttribute("id",o),r&&q&&(e=e.parentNode);try{if(!r||q)return p(e.querySelectorAll("[id='"+o+"'] "+b),f)}catch(s){}finally{n||m.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)k[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}k.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(a))try{if(e||!l.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return k(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;l.order.splice(1,0,"CLASS"),l.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!=="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?k.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?k.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:k.contains=function(){return!1},k.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var v=function(a,b){var c,d=[],e="",f=b.nodeType?[b]:b;while(c=l.match.PSEUDO.exec(a))e+=c[0],a=a.replace(l.match.PSEUDO,"");a=l.relative[a]?a+"*":a;for(var g=0,h=f.length;g<h;g++)k(a,f[g],d);return k.filter(e,d)};d.find=k,d.expr=k.selectors,d.expr[":"]=d.expr.filters,d.unique=k.uniqueSort,d.text=k.getText,d.isXMLDoc=k.isXML,d.contains=k.contains}();var I=/Until$/,J=/^(?:parents|prevUntil|prevAll)/,K=/,/,L=/^.[^:#\[\.,]*$/,M=Array.prototype.slice,N=d.expr.match.POS,O={children:!0,contents:!0,next:!0,prev:!0};d.fn.extend({find:function(a){var b=this.pushStack("","find",a),c=0;for(var e=0,f=this.length;e<f;e++){c=b.length,d.find(a,this[e],b);if(e>0)for(var g=c;g<b.length;g++)for(var h=0;h<c;h++)if(b[h]===b[g]){b.splice(g--,1);break}}return b},has:function(a){var b=d(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(d.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(Q(this,a,!1),"not",a)},filter:function(a){return this.pushStack(Q(this,a,!0),"filter",a)},is:function(a){return!!a&&d.filter(a,this).length>0},closest:function(a,b){var c=[],e,f,g=this[0];if(d.isArray(a)){var h,i,j={},k=1;if(g&&a.length){for(e=0,f=a.length;e<f;e++)i=a[e],j[i]||(j[i]=d.expr.match.POS.test(i)?d(i,b||this.context):i);while(g&&g.ownerDocument&&g!==b){for(i in j)h=j[i],(h.jquery?h.index(g)>-1:d(g).is(h))&&c.push({selector:i,elem:g,level:k});g=g.parentNode,k++}}return c}var l=N.test(a)?d(a,b||this.context):null;for(e=0,f=this.length;e<f;e++){g=this[e];while(g){if(l?l.index(g)>-1:d.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b)break}}c=c.length>1?d.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a||typeof a==="string")return d.inArray(this[0],a?d(a):this.parent().children());return d.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a==="string"?d(a,b):d.makeArray(a),e=d.merge(this.get(),c);return this.pushStack(P(c[0])||P(e[0])?e:d.unique(e))},andSelf:function(){return this.add(this.prevObject)}}),d.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return d.dir(a,"parentNode")},parentsUntil:function(a,b,c){return d.dir(a,"parentNode",c)},next:function(a){return d.nth(a,2,"nextSibling")},prev:function(a){return d.nth(a,2,"previousSibling")},nextAll:function(a){return d.dir(a,"nextSibling")},prevAll:function(a){return d.dir(a,"previousSibling")},nextUntil:function(a,b,c){return d.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return d.dir(a,"previousSibling",c)},siblings:function(a){return d.sibling(a.parentNode.firstChild,a)},children:function(a){return d.sibling(a.firstChild)},contents:function(a){return d.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:d.makeArray(a.childNodes)}},function(a,b){d.fn[a]=function(c,e){var f=d.map(this,b,c),g=M.call(arguments);I.test(a)||(e=c),e&&typeof e==="string"&&(f=d.filter(e,f)),f=this.length>1&&!O[a]?d.unique(f):f,(this.length>1||K.test(e))&&J.test(a)&&(f=f.reverse());return this.pushStack(f,a,g.join(","))}}),d.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?d.find.matchesSelector(b[0],a)?[b[0]]:[]:d.find.matches(a,b)},dir:function(a,c,e){var f=[],g=a[c];while(g&&g.nodeType!==9&&(e===b||g.nodeType!==1||!d(g).is(e)))g.nodeType===1&&f.push(g),g=g[c];return f},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var R=/ jQuery\d+="(?:\d+|null)"/g,S=/^\s+/,T=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,U=/<([\w:]+)/,V=/<tbody/i,W=/<|&#?\w+;/,X=/<(?:script|object|embed|option|style)/i,Y=/checked\s*(?:[^=]|=\s*.checked.)/i,Z={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};Z.optgroup=Z.option,Z.tbody=Z.tfoot=Z.colgroup=Z.caption=Z.thead,Z.th=Z.td,d.support.htmlSerialize||(Z._default=[1,"div<div>","</div>"]),d.fn.extend({text:function(a){if(d.isFunction(a))return this.each(function(b){var c=d(this);c.text(a.call(this,b,c.text()))});if(typeof a!=="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return d.text(this)},wrapAll:function(a){if(d.isFunction(a))return this.each(function(b){d(this).wrapAll(a.call(this,b))});if(this[0]){var b=d(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(d.isFunction(a))return this.each(function(b){d(this).wrapInner(a.call(this,b))});return this.each(function(){var b=d(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){d(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){d.nodeName(this,"body")||d(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=d(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,d(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,e;(e=this[c])!=null;c++)if(!a||d.filter(a,[e]).length)!b&&e.nodeType===1&&(d.cleanData(e.getElementsByTagName("*")),d.cleanData([e])),e.parentNode&&e.parentNode.removeChild(e);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&d.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return d.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(R,""):null;if(typeof a!=="string"||X.test(a)||!d.support.leadingWhitespace&&S.test(a)||Z[(U.exec(a)||["",""])[1].toLowerCase()])d.isFunction(a)?this.each(function(b){var c=d(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);else{a=a.replace(T,"<$1></$2>");try{for(var c=0,e=this.length;c<e;c++)this[c].nodeType===1&&(d.cleanData(this[c].getElementsByTagName("*")),this[c].innerHTML=a)}catch(f){this.empty().append(a)}}return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(d.isFunction(a))return this.each(function(b){var c=d(this),e=c.html();c.replaceWith(a.call(this,b,e))});typeof a!=="string"&&(a=d(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;d(this).remove(),b?d(b).before(a):d(c).append(a)})}return this.length?this.pushStack(d(d.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,e){var f,g,h,i,j=a[0],k=[];if(!d.support.checkClone&&arguments.length===3&&typeof j==="string"&&Y.test(j))return this.each(function(){d(this).domManip(a,c,e,!0)});if(d.isFunction(j))return this.each(function(f){var g=d(this);a[0]=j.call(this,f,c?g.html():b),g.domManip(a,c,e)});if(this[0]){i=j&&j.parentNode,d.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?f={fragment:i}:f=d.buildFragment(a,this,k),h=f.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&d.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)e.call(c?$(this[l],g):this[l],f.cacheable||m>1&&l<n?d.clone(h,!0,!0):h)}k.length&&d.each(k,bc)}return this}}),d.buildFragment=function(a,b,e){var f,g,h,i=b&&b[0]?b[0].ownerDocument||b[0]:c;a.length===1&&typeof a[0]==="string"&&a[0].length<512&&i===c&&a[0].charAt(0)==="<"&&!X.test(a[0])&&(d.support.checkClone||!Y.test(a[0]))&&(g=!0,h=d.fragments[a[0]],h&&(h!==1&&(f=h))),f||(f=i.createDocumentFragment(),d.clean(a,i,f,e)),g&&(d.fragments[a[0]]=h?f:1);return{fragment:f,cacheable:g}},d.fragments={},d.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){d.fn[a]=function(c){var e=[],f=d(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&f.length===1){f[b](this[0]);return this}for(var h=0,i=f.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();d(f[h])[b](j),e=e.concat(j)}return this.pushStack(e,a,f.selector)}}),d.extend({clone:function(a,b,c){var e=a.cloneNode(!0),f,g,h;if((!d.support.noCloneEvent||!d.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!d.isXMLDoc(a)){ba(a,e),f=bb(a),g=bb(e);for(h=0;f[h];++h)ba(f[h],g[h])}if(b){_(a,e);if(c){f=bb(a),g=bb(e);for(h=0;f[h];++h)_(f[h],g[h])}}return e},clean:function(a,b,e,f){b=b||c,typeof b.createElement==="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var g=[];for(var h=0,i;(i=a[h])!=null;h++){typeof i==="number"&&(i+="");if(!i)continue;if(typeof i!=="string"||W.test(i)){if(typeof i==="string"){i=i.replace(T,"<$1></$2>");var j=(U.exec(i)||["",""])[1].toLowerCase(),k=Z[j]||Z._default,l=k[0],m=b.createElement("div");m.innerHTML=k[1]+i+k[2];while(l--)m=m.lastChild;if(!d.support.tbody){var n=V.test(i),o=j==="table"&&!n?m.firstChild&&m.firstChild.childNodes:k[1]==="<table>"&&!n?m.childNodes:[];for(var p=o.length-1;p>=0;--p)d.nodeName(o[p],"tbody")&&!o[p].childNodes.length&&o[p].parentNode.removeChild(o[p])}!d.support.leadingWhitespace&&S.test(i)&&m.insertBefore(b.createTextNode(S.exec(i)[0]),m.firstChild),i=m.childNodes}}else i=b.createTextNode(i);i.nodeType?g.push(i):g=d.merge(g,i)}if(e)for(h=0;g[h];h++)!f||!d.nodeName(g[h],"script")||g[h].type&&g[h].type.toLowerCase()!=="text/javascript"?(g[h].nodeType===1&&g.splice.apply(g,[h+1,0].concat(d.makeArray(g[h].getElementsByTagName("script")))),e.appendChild(g[h])):f.push(g[h].parentNode?g[h].parentNode.removeChild(g[h]):g[h]);return g},cleanData:function(a){var b,c,e=d.cache,f=d.expando,g=d.event.special,h=d.support.deleteExpando;for(var i=0,j;(j=a[i])!=null;i++){if(j.nodeName&&d.noData[j.nodeName.toLowerCase()])continue;c=j[d.expando];if(c){b=e[c]&&e[c][f];if(b&&b.events){for(var k in b.events)g[k]?d.event.remove(j,k):d.removeEvent(j,k,b.handle);b.handle&&(b.handle.elem=null)}h?delete j[d.expando]:j.removeAttribute&&j.removeAttribute(d.expando),delete e[c]}}}});var bd=/alpha\([^)]*\)/i,be=/opacity=([^)]*)/,bf=/-([a-z])/ig,bg=/([A-Z]|^ms)/g,bh=/^-?\d+(?:px)?$/i,bi=/^-?\d/,bj={position:"absolute",visibility:"hidden",display:"block"},bk=["Left","Right"],bl=["Top","Bottom"],bm,bn,bo,bp=function(a,b){return b.toUpperCase()};d.fn.css=function(a,c){if(arguments.length===2&&c===b)return this;return d.access(this,a,c,!0,function(a,c,e){return e!==b?d.style(a,c,e):d.css(a,c)})},d.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bm(a,"opacity","opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{zIndex:!0,fontWeight:!0,opacity:!0,zoom:!0,lineHeight:!0},cssProps:{"float":d.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,e,f){if(a&&a.nodeType!==3&&a.nodeType!==8&&a.style){var g,h=d.camelCase(c),i=a.style,j=d.cssHooks[h];c=d.cssProps[h]||h;if(e===b){if(j&&"get"in j&&(g=j.get(a,!1,f))!==b)return g;return i[c]}if(typeof e==="number"&&isNaN(e)||e==null)return;typeof e==="number"&&!d.cssNumber[h]&&(e+="px");if(!j||!("set"in j)||(e=j.set(a,e))!==b)try{i[c]=e}catch(k){}}},css:function(a,c,e){var f,g=d.camelCase(c),h=d.cssHooks[g];c=d.cssProps[g]||g;if(h&&"get"in h&&(f=h.get(a,!0,e))!==b)return f;if(bm)return bm(a,c,g)},swap:function(a,b,c){var d={};for(var e in b)d[e]=a.style[e],a.style[e]=b[e];c.call(a);for(e in b)a.style[e]=d[e]},camelCase:function(a){return a.replace(bf,bp)}}),d.curCSS=d.css,d.each(["height","width"],function(a,b){d.cssHooks[b]={get:function(a,c,e){var f;if(c){a.offsetWidth!==0?f=bq(a,b,e):d.swap(a,bj,function(){f=bq(a,b,e)});if(f<=0){f=bm(a,b,b),f==="0px"&&bo&&(f=bo(a,b,b));if(f!=null)return f===""||f==="auto"?"0px":f}if(f<0||f==null){f=a.style[b];return f===""||f==="auto"?"0px":f}return typeof f==="string"?f:f+"px"}},set:function(a,b){if(!bh.test(b))return b;b=parseFloat(b);if(b>=0)return b+"px"}}}),d.support.opacity||(d.cssHooks.opacity={get:function(a,b){return be.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style;c.zoom=1;var e=d.isNaN(b)?"":"alpha(opacity="+b*100+")",f=c.filter||"";c.filter=bd.test(f)?f.replace(bd,e):c.filter+" "+e}}),d(function(){d.support.reliableMarginRight||(d.cssHooks.marginRight={get:function(a,b){var c;d.swap(a,{display:"inline-block"},function(){b?c=bm(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bn=function(a,c,e){var f,g,h;e=e.replace(bg,"-$1").toLowerCase();if(!(g=a.ownerDocument.defaultView))return b;if(h=g.getComputedStyle(a,null))f=h.getPropertyValue(e),f===""&&!d.contains(a.ownerDocument.documentElement,a)&&(f=d.style(a,e));return f}),c.documentElement.currentStyle&&(bo=function(a,b){var c,d=a.currentStyle&&a.currentStyle[b],e=a.runtimeStyle&&a.runtimeStyle[b],f=a.style;!bh.test(d)&&bi.test(d)&&(c=f.left,e&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":d||0,d=f.pixelLeft+"px",f.left=c,e&&(a.runtimeStyle.left=e));return d===""?"auto":d}),bm=bn||bo,d.expr&&d.expr.filters&&(d.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!d.support.reliableHiddenOffsets&&(a.style.display||d.css(a,"display"))==="none"},d.expr.filters.visible=function(a){return!d.expr.filters.hidden(a)});var br=/%20/g,bs=/\[\]$/,bt=/\r?\n/g,bu=/#.*$/,bv=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bw=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bx=/^(?:about|app|app\-storage|.+\-extension|file|widget):$/,by=/^(?:GET|HEAD)$/,bz=/^\/\//,bA=/\?/,bB=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bC=/^(?:select|textarea)/i,bD=/\s+/,bE=/([?&])_=[^&]*/,bF=/(^|\-)([a-z])/g,bG=function(a,b,c){return b+c.toUpperCase()},bH=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bI=d.fn.load,bJ={},bK={},bL,bM;try{bL=c.location.href}catch(bN){bL=c.createElement("a"),bL.href="",bL=bL.href}bM=bH.exec(bL.toLowerCase())||[],d.fn.extend({load:function(a,c,e){if(typeof a!=="string"&&bI)return bI.apply(this,arguments);if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var g=a.slice(f,a.length);a=a.slice(0,f)}var h="GET";c&&(d.isFunction(c)?(e=c,c=b):typeof c==="object"&&(c=d.param(c,d.ajaxSettings.traditional),h="POST"));var i=this;d.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?d("<div>").append(c.replace(bB,"")).find(g):c)),e&&i.each(e,[c,b,a])}});return this},serialize:function(){return d.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?d.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bC.test(this.nodeName)||bw.test(this.type))}).map(function(a,b){var c=d(this).val();return c==null?null:d.isArray(c)?d.map(c,function(a,c){return{name:b.name,value:a.replace(bt,"\r\n")}}):{name:b.name,value:c.replace(bt,"\r\n")}}).get()}}),d.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){d.fn[b]=function(a){return this.bind(b,a)}}),d.each(["get","post"],function(a,c){d[c]=function(a,e,f,g){d.isFunction(e)&&(g=g||f,f=e,e=b);return d.ajax({type:c,url:a,data:e,success:f,dataType:g})}}),d.extend({getScript:function(a,c){return d.get(a,b,c,"script")},getJSON:function(a,b,c){return d.get(a,b,c,"json")},ajaxSetup:function(a,b){b?d.extend(!0,a,d.ajaxSettings,b):(b=a,a=d.extend(!0,d.ajaxSettings,b));for(var c in {context:1,url:1})c in b?a[c]=b[c]:c in d.ajaxSettings&&(a[c]=d.ajaxSettings[c]);return a},ajaxSettings:{url:bL,isLocal:bx.test(bM[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":"*/*"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":d.parseJSON,"text xml":d.parseXML}},ajaxPrefilter:bO(bJ),ajaxTransport:bO(bK),ajax:function(a,c){function v(a,c,l,n){if(r!==2){r=2,p&&clearTimeout(p),o=b,m=n||"",u.readyState=a?4:0;var q,t,v,w=l?bR(e,u,l):b,x,y;if(a>=200&&a<300||a===304){if(e.ifModified){if(x=u.getResponseHeader("Last-Modified"))d.lastModified[k]=x;if(y=u.getResponseHeader("Etag"))d.etag[k]=y}if(a===304)c="notmodified",q=!0;else try{t=bS(e,w),c="success",q=!0}catch(z){c="parsererror",v=z}}else{v=c;if(!c||a)c="error",a<0&&(a=0)}u.status=a,u.statusText=c,q?h.resolveWith(f,[t,c,u]):h.rejectWith(f,[u,c,v]),u.statusCode(j),j=b,s&&g.trigger("ajax"+(q?"Success":"Error"),[u,e,q?t:v]),i.resolveWith(f,[u,c]),s&&(g.trigger("ajaxComplete",[u,e]),--d.active||d.event.trigger("ajaxStop"))}}typeof a==="object"&&(c=a,a=b),c=c||{};var e=d.ajaxSetup({},c),f=e.context||e,g=f!==e&&(f.nodeType||f instanceof d)?d(f):d.event,h=d.Deferred(),i=d._Deferred(),j=e.statusCode||{},k,l={},m,n,o,p,q,r=0,s,t,u={readyState:0,setRequestHeader:function(a,b){r||(l[a.toLowerCase().replace(bF,bG)]=b);return this},getAllResponseHeaders:function(){return r===2?m:null},getResponseHeader:function(a){var c;if(r===2){if(!n){n={};while(c=bv.exec(m))n[c[1].toLowerCase()]=c[2]}c=n[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){r||(e.mimeType=a);return this},abort:function(a){a=a||"abort",o&&o.abort(a),v(0,a);return this}};h.promise(u),u.success=u.done,u.error=u.fail,u.complete=i.done,u.statusCode=function(a){if(a){var b;if(r<2)for(b in a)j[b]=[j[b],a[b]];else b=a[u.status],u.then(b,b)}return this},e.url=((a||e.url)+"").replace(bu,"").replace(bz,bM[1]+"//"),e.dataTypes=d.trim(e.dataType||"*").toLowerCase().split(bD),e.crossDomain==null&&(q=bH.exec(e.url.toLowerCase()),e.crossDomain=q&&(q[1]!=bM[1]||q[2]!=bM[2]||(q[3]||(q[1]==="http:"?80:443))!=(bM[3]||(bM[1]==="http:"?80:443)))),e.data&&e.processData&&typeof e.data!=="string"&&(e.data=d.param(e.data,e.traditional)),bP(bJ,e,c,u);if(r===2)return!1;s=e.global,e.type=e.type.toUpperCase(),e.hasContent=!by.test(e.type),s&&d.active++===0&&d.event.trigger("ajaxStart");if(!e.hasContent){e.data&&(e.url+=(bA.test(e.url)?"&":"?")+e.data),k=e.url;if(e.cache===!1){var w=d.now(),x=e.url.replace(bE,"$1_="+w);e.url=x+(x===e.url?(bA.test(e.url)?"&":"?")+"_="+w:"")}}if(e.data&&e.hasContent&&e.contentType!==!1||c.contentType)l["Content-Type"]=e.contentType;e.ifModified&&(k=k||e.url,d.lastModified[k]&&(l["If-Modified-Since"]=d.lastModified[k]),d.etag[k]&&(l["If-None-Match"]=d.etag[k])),l.Accept=e.dataTypes[0]&&e.accepts[e.dataTypes[0]]?e.accepts[e.dataTypes[0]]+(e.dataTypes[0]!=="*"?", */*; q=0.01":""):e.accepts["*"];for(t in e.headers)u.setRequestHeader(t,e.headers[t]);if(e.beforeSend&&(e.beforeSend.call(f,u,e)===!1||r===2)){u.abort();return!1}for(t in {success:1,error:1,complete:1})u[t](e[t]);o=bP(bK,e,c,u);if(o){u.readyState=1,s&&g.trigger("ajaxSend",[u,e]),e.async&&e.timeout>0&&(p=setTimeout(function(){u.abort("timeout")},e.timeout));try{r=1,o.send(l,v)}catch(y){status<2?v(-1,y):d.error(y)}}else v(-1,"No Transport");return u},param:function(a,c){var e=[],f=function(a,b){b=d.isFunction(b)?b():b,e[e.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=d.ajaxSettings.traditional);if(d.isArray(a)||a.jquery&&!d.isPlainObject(a))d.each(a,function(){f(this.name,this.value)});else for(var g in a)bQ(g,a[g],c,f);return e.join("&").replace(br,"+")}}),d.extend({active:0,lastModified:{},etag:{}});var bT=d.now(),bU=/(\=)\?(&|$)|\?\?/i;d.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return d.expando+"_"+bT++}}),d.ajaxPrefilter("json jsonp",function(b,c,e){var f=typeof b.data==="string";if(b.dataTypes[0]==="jsonp"||c.jsonpCallback||c.jsonp!=null||b.jsonp!==!1&&(bU.test(b.url)||f&&bU.test(b.data))){var g,h=b.jsonpCallback=d.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2",m=function(){a[h]=i,g&&d.isFunction(i)&&a[h](g[0])};b.jsonp!==!1&&(j=j.replace(bU,l),b.url===j&&(f&&(k=k.replace(bU,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},e.then(m,m),b.converters["script json"]=function(){g||d.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),d.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){d.globalEval(a);return a}}}),d.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),d.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var bV=d.now(),bW,bX;d.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&bZ()||b$()}:bZ,bX=d.ajaxSettings.xhr(),d.support.ajax=!!bX,d.support.cors=bX&&"withCredentials"in bX,bX=b,d.support.ajax&&d.ajaxTransport(function(a){if(!a.crossDomain||d.support.cors){var c;return{send:function(e,f){var g=a.xhr(),h,i;a.username?g.open(a.type,a.url,a.async,a.username,a.password):g.open(a.type,a.url,a.async);if(a.xhrFields)for(i in a.xhrFields)g[i]=a.xhrFields[i];a.mimeType&&g.overrideMimeType&&g.overrideMimeType(a.mimeType),!a.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(i in e)g.setRequestHeader(i,e[i])}catch(j){}g.send(a.hasContent&&a.data||null),c=function(e,i){var j,k,l,m,n;try{if(c&&(i||g.readyState===4)){c=b,h&&(g.onreadystatechange=d.noop,delete bW[h]);if(i)g.readyState!==4&&g.abort();else{j=g.status,l=g.getAllResponseHeaders(),m={},n=g.responseXML,n&&n.documentElement&&(m.xml=n),m.text=g.responseText;try{k=g.statusText}catch(o){k=""}j||!a.isLocal||a.crossDomain?j===1223&&(j=204):j=m.text?200:404}}}catch(p){i||f(-1,p)}m&&f(j,k,m,l)},a.async&&g.readyState!==4?(bW||(bW={},bY()),h=bV++,g.onreadystatechange=bW[h]=c):c()},abort:function(){c&&c(0,1)}}}});var b_={},ca=/^(?:toggle|show|hide)$/,cb=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cc,cd=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];d.fn.extend({show:function(a,b,c){var e,f;if(a||a===0)return this.animate(ce("show",3),a,b,c);for(var g=0,h=this.length;g<h;g++)e=this[g],f=e.style.display,!d._data(e,"olddisplay")&&f==="none"&&(f=e.style.display=""),f===""&&d.css(e,"display")==="none"&&d._data(e,"olddisplay",cf(e.nodeName));for(g=0;g<h;g++){e=this[g],f=e.style.display;if(f===""||f==="none")e.style.display=d._data(e,"olddisplay")||""}return this},hide:function(a,b,c){if(a||a===0)return this.animate(ce("hide",3),a,b,c);for(var e=0,f=this.length;e<f;e++){var g=d.css(this[e],"display");g!=="none"&&!d._data(this[e],"olddisplay")&&d._data(this[e],"olddisplay",g)}for(e=0;e<f;e++)this[e].style.display="none";return this},_toggle:d.fn.toggle,toggle:function(a,b,c){var e=typeof a==="boolean";d.isFunction(a)&&d.isFunction(b)?this._toggle.apply(this,arguments):a==null||e?this.each(function(){var b=e?a:d(this).is(":hidden");d(this)[b?"show":"hide"]()}):this.animate(ce("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,e){var f=d.speed(b,c,e);if(d.isEmptyObject(a))return this.each(f.complete);return this[f.queue===!1?"each":"queue"](function(){var b=d.extend({},f),c,e=this.nodeType===1,g=e&&d(this).is(":hidden"),h=this;for(c in a){var i=d.camelCase(c);c!==i&&(a[i]=a[c],delete a[c],c=i);if(a[c]==="hide"&&g||a[c]==="show"&&!g)return b.complete.call(this);if(e&&(c==="height"||c==="width")){b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY];if(d.css(this,"display")==="inline"&&d.css(this,"float")==="none")if(d.support.inlineBlockNeedsLayout){var j=cf(this.nodeName);j==="inline"?this.style.display="inline-block":(this.style.display="inline",this.style.zoom=1)}else this.style.display="inline-block"}d.isArray(a[c])&&((b.specialEasing=b.specialEasing||{})[c]=a[c][1],a[c]=a[c][0])}b.overflow!=null&&(this.style.overflow="hidden"),b.curAnim=d.extend({},a),d.each(a,function(c,e){var f=new d.fx(h,b,c);if(ca.test(e))f[e==="toggle"?g?"show":"hide":e](a);else{var i=cb.exec(e),j=f.cur();if(i){var k=parseFloat(i[2]),l=i[3]||(d.cssNumber[c]?"":"px");l!=="px"&&(d.style(h,c,(k||1)+l),j=(k||1)/f.cur()*j,d.style(h,c,j+l)),i[1]&&(k=(i[1]==="-="?-1:1)*k+j),f.custom(j,k,l)}else f.custom(j,e,"")}});return!0})},stop:function(a,b){var c=d.timers;a&&this.queue([]),this.each(function(){for(var a=c.length-1;a>=0;a--)c[a].elem===this&&(b&&c[a](!0),c.splice(a,1))}),b||this.dequeue();return this}}),d.each({slideDown:ce("show",1),slideUp:ce("hide",1),slideToggle:ce("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){d.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),d.extend({speed:function(a,b,c){var e=a&&typeof a==="object"?d.extend({},a):{complete:c||!c&&b||d.isFunction(a)&&a,duration:a,easing:c&&b||b&&!d.isFunction(b)&&b};e.duration=d.fx.off?0:typeof e.duration==="number"?e.duration:e.duration in d.fx.speeds?d.fx.speeds[e.duration]:d.fx.speeds._default,e.old=e.complete,e.complete=function(){e.queue!==!1&&d(this).dequeue(),d.isFunction(e.old)&&e.old.call(this)};return e},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig||(b.orig={})}}),d.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(d.fx.step[this.prop]||d.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=d.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,b,c){function g(a){return e.step(a)}var e=this,f=d.fx;this.startTime=d.now(),this.start=a,this.end=b,this.unit=c||this.unit||(d.cssNumber[this.prop]?"":"px"),this.now=this.start,this.pos=this.state=0,g.elem=this.elem,g()&&d.timers.push(g)&&!cc&&(cc=setInterval(f.tick,f.interval))},show:function(){this.options.orig[this.prop]=d.style(this.elem,this.prop),this.options.show=!0,this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),d(this.elem).show()},hide:function(){this.options.orig[this.prop]=d.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b=d.now(),c=!0;if(a||b>=this.options.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),this.options.curAnim[this.prop]=!0;for(var e in this.options.curAnim)this.options.curAnim[e]!==!0&&(c=!1);if(c){if(this.options.overflow!=null&&!d.support.shrinkWrapBlocks){var f=this.elem,g=this.options;d.each(["","X","Y"],function(a,b){f.style["overflow"+b]=g.overflow[a]})}this.options.hide&&d(this.elem).hide();if(this.options.hide||this.options.show)for(var h in this.options.curAnim)d.style(this.elem,h,this.options.orig[h]);this.options.complete.call(this.elem)}return!1}var i=b-this.startTime;this.state=i/this.options.duration;var j=this.options.specialEasing&&this.options.specialEasing[this.prop],k=this.options.easing||(d.easing.swing?"swing":"linear");this.pos=d.easing[j||k](this.state,i,0,1,this.options.duration),this.now=this.start+(this.end-this.start)*this.pos,this.update();return!0}},d.extend(d.fx,{tick:function(){var a=d.timers;for(var b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length||d.fx.stop()},interval:13,stop:function(){clearInterval(cc),cc=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){d.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit:a.elem[a.prop]=a.now}}}),d.expr&&d.expr.filters&&(d.expr.filters.animated=function(a){return d.grep(d.timers,function(b){return a===b.elem}).length});var cg=/^t(?:able|d|h)$/i,ch=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?d.fn.offset=function(a){var b=this[0],c;if(a)return this.each(function(b){d.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return d.offset.bodyOffset(b);try{c=b.getBoundingClientRect()}catch(e){}var f=b.ownerDocument,g=f.documentElement;if(!c||!d.contains(g,b))return c?{top:c.top,left:c.left}:{top:0,left:0};var h=f.body,i=ci(f),j=g.clientTop||h.clientTop||0,k=g.clientLeft||h.clientLeft||0,l=i.pageYOffset||d.support.boxModel&&g.scrollTop||h.scrollTop,m=i.pageXOffset||d.support.boxModel&&g.scrollLeft||h.scrollLeft,n=c.top+l-j,o=c.left+m-k;return{top:n,left:o}}:d.fn.offset=function(a){var b=this[0];if(a)return this.each(function(b){d.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return d.offset.bodyOffset(b);d.offset.initialize();var c,e=b.offsetParent,f=b,g=b.ownerDocument,h=g.documentElement,i=g.body,j=g.defaultView,k=j?j.getComputedStyle(b,null):b.currentStyle,l=b.offsetTop,m=b.offsetLeft;while((b=b.parentNode)&&b!==i&&b!==h){if(d.offset.supportsFixedPosition&&k.position==="fixed")break;c=j?j.getComputedStyle(b,null):b.currentStyle,l-=b.scrollTop,m-=b.scrollLeft,b===e&&(l+=b.offsetTop,m+=b.offsetLeft,d.offset.doesNotAddBorder&&(!d.offset.doesAddBorderForTableAndCells||!cg.test(b.nodeName))&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),f=e,e=b.offsetParent),d.offset.subtractsBorderForOverflowNotVisible&&c.overflow!=="visible"&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),k=c}if(k.position==="relative"||k.position==="static")l+=i.offsetTop,m+=i.offsetLeft;d.offset.supportsFixedPosition&&k.position==="fixed"&&(l+=Math.max(h.scrollTop,i.scrollTop),m+=Math.max(h.scrollLeft,i.scrollLeft));return{top:l,left:m}},d.offset={initialize:function(){var a=c.body,b=c.createElement("div"),e,f,g,h,i=parseFloat(d.css(a,"marginTop"))||0,j="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";d.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"}),b.innerHTML=j,a.insertBefore(b,a.firstChild),e=b.firstChild,f=e.firstChild,h=e.nextSibling.firstChild.firstChild,this.doesNotAddBorder=f.offsetTop!==5,this.doesAddBorderForTableAndCells=h.offsetTop===5,f.style.position="fixed",f.style.top="20px",this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15,f.style.position=f.style.top="",e.style.overflow="hidden",e.style.position="relative",this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5,this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i,a.removeChild(b),d.offset.initialize=d.noop},bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;d.offset.initialize(),d.offset.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(d.css(a,"marginTop"))||0,c+=parseFloat(d.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var e=d.css(a,"position");e==="static"&&(a.style.position="relative");var f=d(a),g=f.offset(),h=d.css(a,"top"),i=d.css(a,"left"),j=(e==="absolute"||e==="fixed")&&d.inArray("auto",[h,i])>-1,k={},l={},m,n;j&&(l=f.position()),m=j?l.top:parseInt(h,10)||0,n=j?l.left:parseInt(i,10)||0,d.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):f.css(k)}},d.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),e=ch.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(d.css(a,"marginTop"))||0,c.left-=parseFloat(d.css(a,"marginLeft"))||0,e.top+=parseFloat(d.css(b[0],"borderTopWidth"))||0,e.left+=parseFloat(d.css(b[0],"borderLeftWidth"))||0;return{top:c.top-e.top,left:c.left-e.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&(!ch.test(a.nodeName)&&d.css(a,"position")==="static"))a=a.offsetParent;return a})}}),d.each(["Left","Top"],function(a,c){var e="scroll"+c;d.fn[e]=function(c){var f=this[0],g;if(!f)return null;if(c!==b)return this.each(function(){g=ci(this),g?g.scrollTo(a?d(g).scrollLeft():c,a?c:d(g).scrollTop()):this[e]=c});g=ci(f);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:d.support.boxModel&&g.document.documentElement[e]||g.document.body[e]:f[e]}}),d.each(["Height","Width"],function(a,c){var e=c.toLowerCase();d.fn["inner"+c]=function(){return this[0]?parseFloat(d.css(this[0],e,"padding")):null},d.fn["outer"+c]=function(a){return this[0]?parseFloat(d.css(this[0],e,a?"margin":"border")):null},d.fn[e]=function(a){var f=this[0];if(!f)return a==null?null:this;if(d.isFunction(a))return this.each(function(b){var c=d(this);c[e](a.call(this,b,c[e]()))});if(d.isWindow(f)){var g=f.document.documentElement["client"+c];return f.document.compatMode==="CSS1Compat"&&g||f.document.body["client"+c]||g}if(f.nodeType===9)return Math.max(f.documentElement["client"+c],f.body["scroll"+c],f.documentElement["scroll"+c],f.body["offset"+c],f.documentElement["offset"+c]);if(a===b){var h=d.css(f,e),i=parseFloat(h);return d.isNaN(i)?h:i}return this.css(e,typeof a==="string"?a:a+"px")}}),a.jQuery=a.$=d})(window);
17
+ jQuery.noConflict();
package.xml ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Ced_LayBuy</name>
4
+ <version>2.0.2</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Magento LayBuy Payment Gateway Module Developed By Lay-Buy Financial Solutions Pty Ltd (warrin@lay-buys.com)</summary>
10
+ <description>Welcome to Lay-Buys, the leading provider of deferred payment plan solutions for online PayPal merchants globally&#xD;
11
+ &#xD;
12
+ We integrate affordable, flexible, secure, and scalable deferred payment plan solutions into your website shopping cart check-out zone&#xD;
13
+ &#xD;
14
+ Our sophisticated flagship SDK is PUT IT ON LAY-BUY and is powered by PayPal&#xD;
15
+ &#xD;
16
+ PUT IT ON LAY-BUY enables online shoppers to pay-off a product or service via a down payment and up to 3 monthly instalment payments&#xD;
17
+ &#xD;
18
+ Merchants however only deliver the product or service after receipt of the final instalment payment&#xD;
19
+ &#xD;
20
+ This effectively increases sales and radically improves cash flow where all the customer monies are paid directly into your PayPal account</description>
21
+ <notes>1. Order page modified with installment plans details in payment information section.&#xD;
22
+ 2. Customer can view there installment plans of a order from account panel for detail read the user guide&#xD;
23
+ 3. Enhance the payment association with order&#xD;
24
+ 4. Installment plan can be canceled on order cancellation&#xD;
25
+ 5. admin Interfaces are modified.&#xD;
26
+ 6. payment method only active at checkout per:&#xD;
27
+ - min. checkout cart total&#xD;
28
+ - allowed categories&#xD;
29
+ - allowed customer groups</notes>
30
+ <authors><author><name>Warrin</name><user>Warrin</user><email>warrin@lay-buys.com</email></author><author><name>Asheesh Singh</name><user>asheeshsingh</user><email>asheeshsingh@cedcoss.com</email></author></authors>
31
+ <date>2014-01-25</date>
32
+ <time>06:42:43</time>
33
+ <contents><target name="magelocal"><dir name="Ced"><dir name="LayBuy"><dir name="Block"><dir name="Adminhtml"><dir name="Report"><dir name="Details"><file name="Form.php" hash="80d28e9b0e19ccab233ea9f18041e364"/></dir><file name="Details.php" hash="f701acdd96fc4f02e8eb878a283449b1"/><dir name="Edit"><file name="Form.php" hash="a2611910f2363eec55531dbf552ed37c"/></dir><file name="Edit.php" hash="04d67bf341a8b7619a79605654b7713f"/><file name="Grid.php" hash="6038eda0c8c2bd17a8da71208011e8e0"/><dir name="Renderer"><file name="Email.php" hash="8e6c0938d80f629cd285303018945ea1"/><file name="Order.php" hash="d89e20aa07fd18a39a1cd881ec9f4995"/><file name="Record.php" hash="95eb9f836a50f3f80d254a7cdd8e1d6e"/></dir></dir><file name="Report.php" hash="9275aca45974105321eed5e06de54e88"/></dir><dir name="Customer"><dir name="Account"><file name="Details.php" hash="64434830be63218157c53a860ab7f48e"/><file name="Grid.php" hash="41d9e28477936ca27f5031e920ee7cfb"/></dir></dir><dir name="Form"><file name="Laybuy.php" hash="f48e5db65ff1b62730e642eada837ec7"/></dir><dir name="Info"><file name="Laybuy.php" hash="00dca1578594e6ec2d5f3ee9004d12fe"/></dir><dir name="Revise"><file name="Redirect.php" hash="6f63613d0fe5540a296804c14263a614"/></dir><dir name="Standard"><file name="Redirect.php" hash="306a88ff75d35c18157dc5dceb02c06f"/></dir></dir><dir name="Helper"><file name="Config.php" hash="f0e99e4baff0db77a27938c071dd26fa"/><file name="Data.php" hash="7aa0f518b49ed5cbb64db57f984494a9"/></dir><dir name="Model"><file name="Observer.php" hash="6a077f545a9f16f5702d783205da1935"/><file name="Report.php" hash="d910a81e6b242cba1d4b58c72929f25e"/><dir name="Resource"><dir name="Report"><file name="Collection.php" hash="5b9e116a63230865d17e13c5d26a95c3"/></dir><file name="Report.php" hash="52986dcbc47da5c268440f5c5283c46c"/><dir name="Revise"><file name="Collection.php" hash="50586282559c46d238cca78bcebbc7a9"/></dir><file name="Revise.php" hash="aeecb9f7bef38fe89769379829d570ea"/><file name="Setup.php" hash="4917b74ef754c4e3d5e0326b2f47af62"/></dir><file name="Revise.php" hash="225c67ee5ff3e9646785ee4342822c82"/><file name="Standard.php" hash="f3cd5f0886a86819e009ac85aefdd4fc"/><dir name="System"><dir name="Config"><dir name="Backend"><file name="Cron.php" hash="8d6e6dc1c3265307eed7a829031dd5f3"/></dir><dir name="Source"><file name="Categories - bkp.php" hash="3f2bdf2c43568883f536654edf85a3da"/><file name="Categories.php" hash="5bea8c2ea19a3dc311aa7b95c4f4d313"/><file name="FetchingSchedule.php" hash="4f3e5aec5a17991d1625d6f17c0f7d32"/><file name="Groups.php" hash="87a205676d93d59a26d1d7bb69266991"/></dir></dir></dir></dir><file name="README.txt" hash="7930d4ac1e8f9957bb2052983eab4340"/><dir name="controllers"><dir name="Adminhtml"><file name="ReportController.php" hash="97dd32cbdb7f34149624e3a154837438"/></dir><file name="ReportController.php" hash="0ae0fee6659f30a811f151c5007abaf8"/><file name="ReviseController.php" hash="e1abafbdeaa5cb13315a3e679487df06"/><file name="StandardController.php" hash="bbcb30a1ed084e31aed1f4c3fabb30e7"/></dir><dir name="etc"><file name="adminhtml.xml" hash="d6be666f723ef84014bdcc0501bf09fb"/><file name="config.xml" hash="382e0f5cea4ed4f0a60adecbb46025ab"/><file name="system.xml" hash="56d1f7fab410f106c926bf9a387b5c64"/></dir><dir name="sql"><dir name="laybuy_setup"><file name="mysql4-install-0.1.0.php" hash="68e359cd24b6051d0c2a91daad899d71"/><file name="mysql4-upgrade-0.1.0-0.2.0.php" hash="bec5e37090cb5a6da6c8ba3652a8bd32"/><file name="mysql4-upgrade-0.2.0-0.3.0.php" hash="97aa7a2a8c91e46c896a6d04d9554aeb"/><file name="mysql4-upgrade-0.3.0-0.4.0.php" hash="9b147158166b94d52e0cfff369ce965c"/><file name="mysql4-upgrade-0.4.0-0.5.0.php" hash="7626925b0cac03d0918eb6b1d51e6d19"/><file name="mysql4-upgrade-0.5.0-0.6.0.php" hash="bc96daed76ca1f04b1eb422508bc3a4b"/><file name="mysql4-upgrade-0.6.0-0.7.0.php" hash="6aa013f47e3b78e4d78e2cba9b471cd4"/><file name="mysql4-upgrade-0.7.0-0.8.0.php" hash="c2ea0f16c8f1e0dc7412a6a0fda1c622"/><file name="mysql4-upgrade-0.8.0-0.9.0.php" hash="d98ba6bef5f4f46ca741d5db014686f1"/></dir></dir><file name="README.txt" hash="7930d4ac1e8f9957bb2052983eab4340"/></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="laybuy.xml" hash="06a129b1976e1bffe665b6857a7692f1"/></dir><dir name="template"><dir name="laybuy"><dir name="checkout"><dir name="onepage"><dir name="review"><file name="button.phtml" hash="df735c2e0c07a664717dc4cd3ea62c99"/></dir></dir></dir><dir name="customer"><dir name="account"><file name="details.phtml" hash="b2014625326522e477ffc2e5163bf9d9"/><file name="grid.phtml" hash="a4997c40900f4a927b9bfb564938e202"/></dir></dir><dir name="form"><file name="extra.phtml" hash="457bbd674b69b4866bf834cb67d79dcd"/><file name="laybuy.phtml" hash="250a2e47b647830dde0a1c511cc2d959"/><file name="laybuy.phtml.original" hash="39aacfc3f3f6ada9e20bbaefef843bab"/></dir><dir name="info"><file name="default.phtml" hash="a0b7e9996902ca0bcf0e424366e40c98"/></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="laybuy.xml" hash="daf3f1e61e17f4d16c64e34c0b6a0e7b"/></dir><dir name="template"><dir name="laybuy"><dir name="info"><file name="default.phtml" hash="0c8d53885be3931bb9af881a8b4f9906"/></dir><file name="notification.phtml" hash="37f0ece7fa9ee89f2d0bcbe3a836c019"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Ced_LayBuy.xml" hash="0299a80e1539c73b4edd1fb0df41c28d"/></dir></target><target name="magelocale"><dir name="en_US"><file name="Ced_LayBuy.csv" hash="f79a1a6ca61c5e7a7463c380eb00896d"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="laybuy"><file name="tooltip.css" hash="ece078bf3d8bb27db4a616fdad505671"/></dir></dir><dir name="images"><dir name="laybuy"><file name="closeBtn.png" hash="b0be9d9ef1053c79b0ebdcef83b53f44"/></dir></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="laybuy"><file name="check_jquery.js" hash="3f463b1398dd1d46ed3b25726dada9b9"/><file name="jquery.atooltip.js" hash="7ef69b27dfeaff3038e5a3fb1f1ed1ea"/><file name="jquery.min.js" hash="d2f9865f4b390d655e9a7d67aa34c477"/></dir></dir></target></contents>
34
+ <compatible/>
35
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
36
+ </package>
skin/frontend/base/default/css/laybuy/tooltip.css ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Required Styles
3
+ */
4
+ #aToolTip {
5
+ position: absolute;
6
+ display: none;
7
+ z-index: 50000;
8
+ }
9
+
10
+ #aToolTip .aToolTipContent {
11
+ position:relative;
12
+ margin:0;
13
+ padding:0;
14
+ }
15
+ /*
16
+ END: Required Styles
17
+ */
18
+ /**
19
+ Default Theme
20
+ */
21
+ .defaultTheme {
22
+ border:2px solid #444;
23
+ background:#555;
24
+ color:#fff;
25
+ margin:0;
26
+ padding:6px 12px;
27
+
28
+ -moz-border-radius: 12px 12px 12px 0;
29
+ -webkit-border-radius: 12px 12px 12px 0;
30
+ -khtml-border-radius: 12px 12px 12px 0;
31
+ border-radius: 12px 12px 12px 0;
32
+
33
+ -moz-box-shadow: 2px 2px 5px #111; /* for Firefox 3.5+ */
34
+ -webkit-box-shadow: 2px 2px 5px #111; /* for Safari and Chrome */
35
+ box-shadow: 2px 2px 5px #111; /* for Safari and Chrome */
36
+ width : 347px;
37
+ }
38
+
39
+ .defaultTheme #aToolTipCloseBtn {
40
+ display:block;
41
+ height:18px;
42
+ width:18px;
43
+ background:url(../../images/laybuy/closeBtn.png) no-repeat;
44
+ text-indent:-9999px;
45
+ outline:none;
46
+ position:absolute;
47
+ top:-20px;
48
+ right:-30px;
49
+ margin:2px;
50
+ padding:4px;
51
+ }
skin/frontend/base/default/images/laybuy/closeBtn.png ADDED
Binary file