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
- excluded by product ids
7. SSL compatible
8. Round off problem removed
9. Date problem resolved
Download this release
Release Info
Developer | Warrin |
Extension | Ced_LayBuy |
Version | 2.1.4 |
Comparing to | |
See all releases |
Code changes from version 2.1.3 to 2.1.4
- app/code/local/Ced/LayBuy/Block/Adminhtml/Docalc.php +98 -0
- app/code/local/Ced/LayBuy/Block/Adminhtml/Report/Details.php +1 -1
- app/code/local/Ced/LayBuy/Block/Standard/Docalc.php +102 -0
- app/code/local/Ced/LayBuy/Helper/Data.php +1 -1
- app/code/local/Ced/LayBuy/controllers/Adminhtml/ReportController.php +2 -66
- app/code/local/Ced/LayBuy/controllers/StandardController.php +2 -239
- app/design/adminhtml/default/default/layout/laybuy.xml +6 -1
- app/design/frontend/base/default/layout/laybuy.xml +5 -0
- package.xml +4 -4
app/code/local/Ced/LayBuy/Block/Adminhtml/Docalc.php
ADDED
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_Adminhtml_Docalc extends Mage_Adminhtml_Block_Abstract
|
28 |
+
{
|
29 |
+
protected function _toHtml()
|
30 |
+
{
|
31 |
+
$header = '<html>';
|
32 |
+
$header .= '<head>';
|
33 |
+
$header .= '<link media="all" href="'.Mage::getBaseUrl('skin').'adminhtml/default/default/reset.css" type="text/css" rel="stylesheet">';
|
34 |
+
$header .= '<link media="all" href="'.Mage::getBaseUrl('skin').'adminhtml/default/default/boxes.css" type="text/css" rel="stylesheet">';
|
35 |
+
$header .= '</head>';
|
36 |
+
$header .= '<body style="font: 12px/1.5em; background: none repeat scroll 0 0 rgba(0, 0, 0, 0);">';
|
37 |
+
$header .= '<div class="grid">';
|
38 |
+
$header .= '<div class="hor-scroll">';
|
39 |
+
$html = '<table cellspacing="0" class="data">';
|
40 |
+
$html .= '<colgroup>
|
41 |
+
<col width="175">
|
42 |
+
<col width="183">
|
43 |
+
<col width="98">
|
44 |
+
</colgroup>';
|
45 |
+
|
46 |
+
$tod=time();
|
47 |
+
|
48 |
+
$isLeap = 0;
|
49 |
+
$isLeap = Date('L',$tod);
|
50 |
+
if($isLeap)
|
51 |
+
$dim=array(31,31,29,31,30,31,30,31,31,30,31,30,31);
|
52 |
+
else
|
53 |
+
$dim=array(31,31,28,31,30,31,30,31,31,30,31,30,31);
|
54 |
+
|
55 |
+
$day=Date('d',$tod);
|
56 |
+
$mth=Date('m',$tod);
|
57 |
+
$yr=Date('Y',$tod);
|
58 |
+
$mnth=$this->getRequest()->getParam('mnth');
|
59 |
+
$hght=150 / (2 + $mnth);
|
60 |
+
$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>';
|
61 |
+
$init=$this->getRequest()->getParam('init');
|
62 |
+
$amt=$this->getRequest()->getParam('amt');
|
63 |
+
$currency = $this->getRequest()->getParam('currency');
|
64 |
+
$dep=$amt*$init/100;
|
65 |
+
$rest=number_format(($amt-$dep)/$mnth,2,'.','');
|
66 |
+
$dep=number_format($amt - $rest * $mnth,2,'.','');
|
67 |
+
$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>';
|
68 |
+
for ($e=1; $e<=$mnth; $e++) {
|
69 |
+
if (++$mth>12) {
|
70 |
+
$mth='01';
|
71 |
+
$yr++;
|
72 |
+
}
|
73 |
+
$m=1+$mth-1;
|
74 |
+
$d=min($day,$dim[$m]);
|
75 |
+
$even = '';
|
76 |
+
if($e%2==0)
|
77 |
+
$even = ' class="even"';
|
78 |
+
$date = '';
|
79 |
+
$date = $d.'-'.$mth.'-'.$yr;
|
80 |
+
$date = Mage::helper('core')->formatDate($date, Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM, true);
|
81 |
+
if($e==1){
|
82 |
+
$first_payment_due = $date;
|
83 |
+
}
|
84 |
+
$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>';
|
85 |
+
}
|
86 |
+
$html .= '</tbody>';
|
87 |
+
$html .= '</table>';
|
88 |
+
$footer = '</div>';
|
89 |
+
$footer .= '</div>';
|
90 |
+
$footer .= '</body>';
|
91 |
+
$footer .= '</html>';
|
92 |
+
if($this->getRequest()->getParam('html')){
|
93 |
+
return $header.$html.$footer;
|
94 |
+
}else{
|
95 |
+
return $dep.'~'.$rest.'~'.$first_payment_due.'~'.$date.'~'.$html;
|
96 |
+
}
|
97 |
+
}
|
98 |
+
}
|
app/code/local/Ced/LayBuy/Block/Adminhtml/Report/Details.php
CHANGED
@@ -48,7 +48,7 @@ class Ced_LayBuy_Block_Adminhtml_Report_Details extends Mage_Adminhtml_Block_Wid
|
|
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()
|
52 |
$this->_addButton('delete', array(
|
53 |
|
54 |
'label' => Mage::helper('laybuy')->__('Cancel Transaction'),
|
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() == 0){
|
52 |
$this->_addButton('delete', array(
|
53 |
|
54 |
'label' => Mage::helper('laybuy')->__('Cancel Transaction'),
|
app/code/local/Ced/LayBuy/Block/Standard/Docalc.php
ADDED
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_Docalc extends Mage_Core_Block_Abstract
|
28 |
+
{
|
29 |
+
protected function _toHtml()
|
30 |
+
{
|
31 |
+
$header = '<html>';
|
32 |
+
$header .= '<head>';
|
33 |
+
$header .= '<link media="all" href="'.Mage::getBaseUrl('skin').'adminhtml/default/default/reset.css" type="text/css" rel="stylesheet">';
|
34 |
+
$header .= '<link media="all" href="'.Mage::getBaseUrl('skin').'adminhtml/default/default/boxes.css" type="text/css" rel="stylesheet">';
|
35 |
+
$header .= '<style type="text/css">.grid table td{ font-size: 12px !important; }</style>';
|
36 |
+
$header .= '</head>';
|
37 |
+
$header .= '<body style="font: 12px/1.5em; background: none repeat scroll 0 0 rgba(0, 0, 0, 0);">';
|
38 |
+
$header .= '<div class="grid">';
|
39 |
+
$header .= '<div class="hor-scroll">';
|
40 |
+
$html = '<table cellspacing="0" class="data">';
|
41 |
+
$html .= '<colgroup>
|
42 |
+
<col width="175">
|
43 |
+
<col width="183">
|
44 |
+
<col width="98">
|
45 |
+
</colgroup>';
|
46 |
+
$tod=time();
|
47 |
+
$isLeap = 0;
|
48 |
+
$isLeap = Date('L',$tod);
|
49 |
+
if($isLeap)
|
50 |
+
$dim=array(31,31,29,31,30,31,30,31,31,30,31,30,31);
|
51 |
+
else
|
52 |
+
$dim=array(31,31,28,31,30,31,30,31,31,30,31,30,31);
|
53 |
+
/* print_r($dim);die; */
|
54 |
+
$day=Date('d',$tod);
|
55 |
+
$mth=Date('m',$tod);
|
56 |
+
$yr=Date('Y',$tod);
|
57 |
+
$mnth=$this->getRequest()->getParam('mnth');
|
58 |
+
$hght=150 / (2 + $mnth);
|
59 |
+
$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>';
|
60 |
+
$init=$this->getRequest()->getParam('init');
|
61 |
+
if($checkout = Mage::getSingleton('checkout/session')){
|
62 |
+
$totals = $checkout->getQuote()->getTotals();
|
63 |
+
$amt = $totals["grand_total"]->getValue();
|
64 |
+
}else{
|
65 |
+
$amt=$this->getRequest()->getParam('amt');
|
66 |
+
}
|
67 |
+
$currency = $this->getRequest()->getParam('currency');
|
68 |
+
$dep=$amt*$init/100;
|
69 |
+
$rest=number_format(($amt-$dep)/$mnth,2,'.','');
|
70 |
+
$dep=number_format($amt - $rest * $mnth,2,'.','');
|
71 |
+
$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>';
|
72 |
+
for ($e=1; $e<=$mnth; $e++) {
|
73 |
+
if (++$mth>12) {
|
74 |
+
$mth='01';
|
75 |
+
$yr++;
|
76 |
+
}
|
77 |
+
$m=1+$mth-1;
|
78 |
+
$d=min($day,$dim[$m]);
|
79 |
+
$even = '';
|
80 |
+
if($e%2==0)
|
81 |
+
$even = ' class="even"';
|
82 |
+
$date = '';
|
83 |
+
$date = $d.'-'.$mth.'-'.$yr;
|
84 |
+
$date = Mage::helper('core')->formatDate($date, Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM, true);
|
85 |
+
if($e==1){
|
86 |
+
$first_payment_due = $date;
|
87 |
+
}
|
88 |
+
$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>';
|
89 |
+
}
|
90 |
+
$html .= '</tbody>';
|
91 |
+
$html .= '</table>';
|
92 |
+
$footer = '</div>';
|
93 |
+
$footer .= '</div>';
|
94 |
+
$footer .= '</body>';
|
95 |
+
$footer .= '</html>';
|
96 |
+
if($this->getRequest()->getParam('html')){
|
97 |
+
return $header.$html.$footer;
|
98 |
+
}else{
|
99 |
+
return $dep.'~'.$rest.'~'.$first_payment_due.'~'.$date.'~'.$html;
|
100 |
+
}
|
101 |
+
}
|
102 |
+
}
|
app/code/local/Ced/LayBuy/Helper/Data.php
CHANGED
@@ -140,7 +140,7 @@ class Ced_LayBuy_Helper_Data extends Mage_Core_Helper_Abstract{
|
|
140 |
}
|
141 |
}
|
142 |
|
143 |
-
public function processOrder($orderIncrementId,$flag,$transactions,$profileId){
|
144 |
$order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
|
145 |
if ($order->getId()) {
|
146 |
if(!$flag){
|
140 |
}
|
141 |
}
|
142 |
|
143 |
+
public function processOrder($orderIncrementId,$flag,$transactions = array() ,$profileId = ''){
|
144 |
$order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
|
145 |
if ($order->getId()) {
|
146 |
if(!$flag){
|
app/code/local/Ced/LayBuy/controllers/Adminhtml/ReportController.php
CHANGED
@@ -304,72 +304,8 @@ class Ced_LayBuy_Adminhtml_ReportController extends Mage_Adminhtml_Controller_Ac
|
|
304 |
}
|
305 |
|
306 |
public function docalcAction(){
|
307 |
-
$
|
308 |
-
$
|
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 |
}
|
304 |
}
|
305 |
|
306 |
public function docalcAction(){
|
307 |
+
$this->loadLayout();
|
308 |
+
$this->renderLayout();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
309 |
}
|
310 |
|
311 |
}
|
app/code/local/Ced/LayBuy/controllers/StandardController.php
CHANGED
@@ -1,271 +1,130 @@
|
|
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',array('_secure' => true));
|
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',
|
@@ -273,13 +132,9 @@ class Ced_LayBuy_StandardController extends Mage_Core_Controller_Front_Action
|
|
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">
|
@@ -295,7 +150,6 @@ class Ced_LayBuy_StandardController extends Mage_Core_Controller_Front_Action
|
|
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)
|
@@ -304,16 +158,13 @@ class Ced_LayBuy_StandardController extends Mage_Core_Controller_Front_Action
|
|
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;"> </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())
|
@@ -322,111 +173,23 @@ class Ced_LayBuy_StandardController extends Mage_Core_Controller_Front_Action
|
|
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',array('_secure' => true));
|
354 |
-
|
355 |
}
|
356 |
-
|
357 |
public function docalcAction(){
|
358 |
-
$
|
359 |
-
$
|
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 .= '<style type="text/css">.grid table td{ font-size: 12px !important; }</style>';
|
363 |
-
$header .= '</head>';
|
364 |
-
$header .= '<body style="font: 12px/1.5em; background: none repeat scroll 0 0 rgba(0, 0, 0, 0);">';
|
365 |
-
$header .= '<div class="grid">';
|
366 |
-
$header .= '<div class="hor-scroll">';
|
367 |
-
$html = '<table cellspacing="0" class="data">';
|
368 |
-
$html .= '<colgroup>
|
369 |
-
<col width="175">
|
370 |
-
<col width="183">
|
371 |
-
<col width="98">
|
372 |
-
</colgroup>';
|
373 |
-
|
374 |
-
$tod=time();
|
375 |
-
$isLeap = 0;
|
376 |
-
$isLeap = Date('L',$tod);
|
377 |
-
if($isLeap)
|
378 |
-
$dim=array(31,31,29,31,30,31,30,31,31,30,31,30,31);
|
379 |
-
else
|
380 |
-
$dim=array(31,31,28,31,30,31,30,31,31,30,31,30,31);
|
381 |
-
/* print_r($dim);die; */
|
382 |
-
$day=Date('d',$tod);
|
383 |
-
$mth=Date('m',$tod);
|
384 |
-
$yr=Date('Y',$tod);
|
385 |
-
$mnth=$this->getRequest()->getParam('mnth');
|
386 |
-
$hght=150 / (2 + $mnth);
|
387 |
-
$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>';
|
388 |
-
$init=$this->getRequest()->getParam('init');
|
389 |
-
if($checkout = Mage::getSingleton('checkout/session')){
|
390 |
-
$totals = $checkout->getQuote()->getTotals();
|
391 |
-
$amt = $totals["grand_total"]->getValue();
|
392 |
-
}else{
|
393 |
-
$amt=$this->getRequest()->getParam('amt');
|
394 |
-
}
|
395 |
-
$currency = $this->getRequest()->getParam('currency');
|
396 |
-
$dep=$amt*$init/100;
|
397 |
-
$rest=number_format(($amt-$dep)/$mnth,2,'.','');
|
398 |
-
$dep=number_format($amt - $rest * $mnth,2,'.','');
|
399 |
-
$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>';
|
400 |
-
for ($e=1; $e<=$mnth; $e++) {
|
401 |
-
if (++$mth>12) {
|
402 |
-
$mth='01';
|
403 |
-
$yr++;
|
404 |
-
}
|
405 |
-
$m=1+$mth-1;
|
406 |
-
$d=min($day,$dim[$m]);
|
407 |
-
|
408 |
-
$even = '';
|
409 |
-
if($e%2==0)
|
410 |
-
$even = ' class="even"';
|
411 |
-
$date = '';
|
412 |
-
$date = $d.'-'.$mth.'-'.$yr;
|
413 |
-
$date = Mage::helper('core')->formatDate($date, Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM, true);
|
414 |
-
if($e==1){
|
415 |
-
$first_payment_due = $date;
|
416 |
-
}
|
417 |
-
$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>';
|
418 |
-
}
|
419 |
-
$html .= '</tbody>';
|
420 |
-
$html .= '</table>';
|
421 |
-
$footer = '</div>';
|
422 |
-
$footer .= '</div>';
|
423 |
-
$footer .= '</body>';
|
424 |
-
$footer .= '</html>';
|
425 |
-
if($this->getRequest()->getParam('html')){
|
426 |
-
echo $header.$html.$footer;
|
427 |
-
}else{
|
428 |
-
echo $dep.'~'.$rest.'~'.$first_payment_due.'~'.$date.'~'.$html;
|
429 |
-
}
|
430 |
}
|
431 |
-
|
432 |
}
|
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 |
* LayBuy Standard Checkout Controller
|
|
|
29 |
*
|
|
|
30 |
* @category Ced
|
|
|
31 |
* @package Ced_LayBuy
|
|
|
32 |
* @author Asheesh Singh<asheeshsingh@cedcoss.com>
|
|
|
33 |
*/
|
|
|
34 |
class Ced_LayBuy_StandardController extends Mage_Core_Controller_Front_Action
|
|
|
35 |
{
|
|
|
36 |
/**
|
|
|
37 |
* Order instance
|
|
|
38 |
*/
|
|
|
39 |
protected $_order;
|
|
|
|
|
|
|
40 |
/**
|
|
|
41 |
* Get order
|
|
|
42 |
*
|
|
|
43 |
* @return Mage_Sales_Model_Order
|
|
|
44 |
*/
|
|
|
45 |
public function getOrder()
|
|
|
46 |
{
|
|
|
47 |
if ($this->_order == null) {
|
|
|
48 |
}
|
|
|
49 |
return $this->_order;
|
|
|
50 |
}
|
|
|
51 |
/**
|
|
|
52 |
* Send expire header to ajax response
|
|
|
53 |
*
|
|
|
54 |
*/
|
|
|
55 |
protected function _expireAjax()
|
|
|
56 |
{
|
|
|
57 |
if (!Mage::getSingleton('checkout/session')->getQuote()->hasItems()) {
|
|
|
58 |
$this->getResponse()->setHeader('HTTP/1.1','403 Session Expired');
|
|
|
59 |
exit;
|
|
|
60 |
}
|
|
|
61 |
}
|
|
|
|
|
|
|
62 |
/**
|
|
|
63 |
* Get singleton with laybuy strandard order transaction information
|
|
|
64 |
*
|
|
|
65 |
* @return Mage_LayBuy_Model_Standard
|
|
|
66 |
*/
|
|
|
67 |
public function getStandard()
|
|
|
68 |
{
|
|
|
69 |
return Mage::getSingleton('laybuy/standard');
|
|
|
70 |
}
|
|
|
|
|
|
|
71 |
/**
|
|
|
72 |
* When a customer chooses LayBuy on Checkout/Payment page
|
|
|
73 |
*
|
|
|
74 |
*/
|
|
|
75 |
public function redirectAction()
|
|
|
76 |
{
|
|
|
77 |
$session = Mage::getSingleton('checkout/session');
|
|
|
78 |
$session->setLayBuyStandardQuoteId($session->getQuoteId());
|
|
|
79 |
$this->getResponse()->setBody($this->getLayout()->createBlock('Ced_LayBuy_Block_Standard_Redirect')->toHtml());
|
|
|
80 |
$session->unsQuoteId();
|
|
|
81 |
$session->unsRedirectUrl();
|
|
|
82 |
}
|
|
|
|
|
|
|
83 |
/**
|
|
|
84 |
* When a customer cancel payment from laybuy.
|
|
|
85 |
*/
|
|
|
86 |
public function cancelAction()
|
|
|
87 |
{
|
|
|
88 |
$session = Mage::getSingleton('checkout/session');
|
|
|
89 |
$session->setQuoteId($session->getLayBuyStandardQuoteId(true));
|
|
|
90 |
if ($session->getLastRealOrderId()) {
|
|
|
91 |
$order = Mage::getModel('sales/order')->loadByIncrementId($session->getLastRealOrderId());
|
|
|
92 |
if ($order->getId()) {
|
|
|
93 |
$order->cancel()->save();
|
|
|
94 |
Mage::log('Canceled Order of LayBuy {{'."Order_id=".$order->getId()."|".$this->getRequest()->getParam('ErrorMessage')."}}", null, 'laybuy_failure.log');
|
|
|
95 |
}
|
|
|
96 |
}
|
|
|
97 |
$session->addError($this->getRequest()->getParam('ErrorMessage','Try Again Later.'));
|
|
|
98 |
$this->_redirect('checkout/onepage/failure',array('_secure' => true));
|
|
|
99 |
}
|
|
|
|
|
|
|
100 |
/**
|
|
|
101 |
* when laybuy returns
|
|
|
102 |
* The order information at this point is in POST
|
|
|
103 |
*/
|
|
|
104 |
public function successAction()
|
|
|
105 |
{
|
|
|
106 |
$format = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM);
|
|
|
107 |
$status = array_change_key_case($this->getRequest()->getParams(),CASE_LOWER);
|
|
|
|
|
|
|
108 |
if(isset($status['result']) && $status['result']=='FAILURE'){
|
|
|
109 |
$this->_forward('cancel');
|
|
|
110 |
}
|
|
|
111 |
$session = Mage::getSingleton('checkout/session');
|
|
|
112 |
try{
|
|
|
113 |
$status['_secure'] = true;
|
|
|
114 |
$str = print_r($status, true);
|
|
|
115 |
/* $status['first_payment_due'] = '13/12/13';
|
|
|
116 |
$status['last_payment_due'] = '13/01/14'; */
|
|
|
117 |
$status['first_payment_due'] = date('Y-m-d h:i:s', strtotime(str_replace('/','-',$status['first_payment_due'])));
|
|
|
118 |
$status['last_payment_due'] = date('Y-m-d h:i:s', strtotime(str_replace('/','-',$status['last_payment_due'])));
|
|
|
119 |
$session->setQuoteId($session->getLayBuyStandardQuoteId(true));
|
|
|
120 |
Mage::getSingleton('checkout/session')->getQuote()->setIsActive(false)->save();
|
|
|
121 |
$order = Mage::getModel('sales/order');
|
|
|
122 |
$order->loadByIncrementId($status['custom']);
|
|
|
123 |
$payment_info = array();
|
|
|
124 |
if($order && $order->getId()){
|
|
|
125 |
$order->sendNewOrderEmail();
|
|
|
126 |
$order->setEmailSent(true);
|
|
|
127 |
$payment_info = $order->getPayment()->getData('additional_information');
|
|
|
128 |
$payment_info['transactions'][$status['paypal_profile_id']][] = array(
|
129 |
'txnID' => $status['dp_paypal_txn_id'],
|
130 |
'type' => 'd',
|
132 |
'paymentDate' => $order->getCreatedAt(),
|
133 |
'amount' => $status['downpayment_amount']
|
134 |
);
|
|
|
135 |
$order->getPayment()->setData('additional_information',$payment_info);
|
|
|
136 |
$order->save();
|
|
|
137 |
$createdAt = Mage::helper('core')->formatDate($order->getCreatedAt(), Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM, true);
|
|
|
138 |
$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>';
|
139 |
$newStr .= '<colgroup>
|
140 |
<col width="100">
|
150 |
'<td style="text-align: center;"> '.$createdAt.' </td>'.
|
151 |
'<td style="text-align: center;">'.$status['dp_paypal_txn_id'].'</td>'.
|
152 |
'<td style="text-align: center;"> Completed </td></tr>';
|
|
|
153 |
for($month=1;$month<=$months;$month++){
|
154 |
$newStr .= '<tr ';
|
155 |
if($month%2==0)
|
158 |
$newStr .= '<td style="text-align: center;"> Month '.$month.': </td><td style="text-align: center;"> '.Mage::app()->getLocale()
|
159 |
->currency($status['currency'])
|
160 |
->toCurrency($status['payment_amounts']).' </td>';
|
|
|
161 |
$date = date("Y-m-d h:i:s", strtotime($status['first_payment_due'] . " +".($month-1)." month"));
|
162 |
$date = Mage::helper('core')->formatDate($date, Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM, true);
|
163 |
$newStr .= '<td style="text-align: center;"> '.$date.' </td>';
|
164 |
$newStr .= '<td style="text-align: center;"> </td>';
|
165 |
$newStr .= '<td style="text-align: center;"> Pending </td></tr>';
|
|
|
166 |
}
|
167 |
$newStr .= '</tbody></table></div></div>';
|
|
|
168 |
$model = Mage::getModel('laybuy/report')->setData($status)
|
169 |
->setOrderId($status['custom'])
|
170 |
->setStoreId($order->getStoreId())
|
173 |
->setReport($newStr)
|
174 |
/* ->setTransaction(0) */
|
175 |
->save();
|
|
|
|
|
|
|
176 |
Mage::log('Response Array From LayBuy {{'.$str."}}", null, 'laybuy_success.log');
|
|
|
177 |
}
|
|
|
178 |
$session->addSuccess($this->__('Payment was recieved successfully.'));
|
|
|
179 |
}catch(Exception $e){
|
|
|
|
|
180 |
$status = array_change_key_case($this->getRequest()->getParams(),CASE_LOWER);
|
|
|
181 |
if($status){
|
182 |
$str = print_r($status, true);
|
|
|
183 |
$session->addError($this->__('Payment Recieved.But transaction not saved please contact us.'));
|
|
|
184 |
Mage::log('Exception Order of LayBuy {{'."Order_id=".$status['custom']."|".$status['errormessage']."|".'Response Array From LayBuy {{'.$status."}}"."}}", null, 'laybuy_failure.log');
|
|
|
185 |
}else{
|
186 |
$session->addError($this->__('Try Again Later.'));
|
187 |
}
|
|
|
|
|
188 |
}
|
|
|
189 |
$this->_redirect('checkout/onepage/success',array('_secure' => true));
|
|
|
190 |
}
|
|
|
191 |
public function docalcAction(){
|
192 |
+
$this->loadLayout();
|
193 |
+
$this->renderLayout();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
194 |
}
|
|
|
195 |
}
|
app/design/adminhtml/default/default/layout/laybuy.xml
CHANGED
@@ -4,5 +4,10 @@
|
|
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>
|
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 |
+
<laybuy_adminhtml_report_docalc>
|
9 |
+
<block type="core/text_list" name="root" output="toHtml">
|
10 |
+
<block type="laybuy/adminhtml_docalc" name="laybuy.adminhtml.docalc"/>
|
11 |
+
</block>
|
12 |
+
</laybuy_adminhtml_report_docalc>
|
13 |
</layout>
|
app/design/frontend/base/default/layout/laybuy.xml
CHANGED
@@ -13,6 +13,11 @@
|
|
13 |
</action>
|
14 |
</reference>
|
15 |
</checkout_onepage_review>
|
|
|
|
|
|
|
|
|
|
|
16 |
<laybuy_report_details>
|
17 |
<update handle="customer_account"/>
|
18 |
<reference name="head">
|
13 |
</action>
|
14 |
</reference>
|
15 |
</checkout_onepage_review>
|
16 |
+
<laybuy_standard_docalc>
|
17 |
+
<block type="core/text_list" name="root" output="toHtml">
|
18 |
+
<block type="laybuy/standard_docalc" name="laybuy.standard.docalc"/>
|
19 |
+
</block>
|
20 |
+
</laybuy_standard_docalc>
|
21 |
<laybuy_report_details>
|
22 |
<update handle="customer_account"/>
|
23 |
<reference name="head">
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Ced_LayBuy</name>
|
4 |
-
<version>2.1.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
|
7 |
<channel>community</channel>
|
@@ -32,9 +32,9 @@ This effectively increases sales and radically improves cash flow where all the
|
|
32 |
8. Round off problem removed
|
33 |
9. Date problem resolved</notes>
|
34 |
<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>
|
35 |
-
<date>2014-03-
|
36 |
-
<time>
|
37 |
-
<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="e0ce57d85efc14656d4294021e5f5257"/></dir><file name="Details.php" hash="
|
38 |
<compatible/>
|
39 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
40 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Ced_LayBuy</name>
|
4 |
+
<version>2.1.4</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>
|
32 |
8. Round off problem removed
|
33 |
9. Date problem resolved</notes>
|
34 |
<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>
|
35 |
+
<date>2014-03-22</date>
|
36 |
+
<time>07:44:19</time>
|
37 |
+
<contents><target name="magelocal"><dir name="Ced"><dir name="LayBuy"><dir name="Block"><dir name="Adminhtml"><file name="Docalc.php" hash="c12af05bee0d480ac49835b46ca8011e"/><dir name="Report"><dir name="Details"><file name="Form.php" hash="e0ce57d85efc14656d4294021e5f5257"/></dir><file name="Details.php" hash="8e333a635b831b6335f7b959a06eef9a"/><dir name="Edit"><file name="Form.php" hash="34ca36479122455bb9b0b1ccaf5d175b"/></dir><file name="Edit.php" hash="9f7eecb6e5c7ae03378b49089ea9a6c0"/><file name="Grid.php" hash="5492ab7536a608362860bc7c1bd1ac36"/><dir name="Renderer"><file name="Email.php" hash="8e6c0938d80f629cd285303018945ea1"/><file name="Order.php" hash="04257868d84c6eaccd79414ba09dcef6"/><file name="Record.php" hash="95eb9f836a50f3f80d254a7cdd8e1d6e"/></dir></dir><file name="Report.php" hash="addd972a4a28d141268f7cb3ad4a4ea6"/></dir><dir name="Customer"><dir name="Account"><file name="Details.php" hash="5bb9caf5b0a6e9584046f6af9ee4ae5f"/><file name="Grid.php" hash="3b170ed3f70422b3a64263535d3543e3"/></dir></dir><dir name="Form"><file name="Laybuy.php" hash="cbf8b96d0fa26d4b772bafd021e3fc83"/></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="Docalc.php" hash="42b2b63a23577c888cccc5f6c20b8867"/><file name="Redirect.php" hash="306a88ff75d35c18157dc5dceb02c06f"/></dir></dir><dir name="Helper"><file name="Config.php" hash="53fbdb4b5b16b587716c8073616b9cd2"/><file name="Data.php" hash="d8a8c87303f9cabc2760674b5431ab7a"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Report"><file name="Collection.php" hash="a3e133f1128200662330a5e21a94c809"/></dir><file name="Report.php" hash="25568238c401ab5e5768596fb76f7ef8"/><dir name="Revise"><file name="Collection.php" hash="2a502f75e4634e4f231f93226ef49b8a"/></dir><file name="Revise.php" hash="cd1a424882417e0ec94561a8cca378e8"/><file name="Setup.php" hash="261838defadf805c7ee29768f6ea8cec"/></dir><file name="Observer.php" hash="3c656455c97e1560a20dd0dc96cbea52"/><file name="Report.php" hash="d910a81e6b242cba1d4b58c72929f25e"/><file name="Revise.php" hash="225c67ee5ff3e9646785ee4342822c82"/><file name="Standard.php" hash="9001ad7fe1724ba74731e1332e900bb5"/><dir name="System"><dir name="Config"><dir name="Backend"><file name="Cron.php" hash="8d6e6dc1c3265307eed7a829031dd5f3"/></dir><dir name="Source"><file name="Categories.php" hash="92c61dba3c23e7838cddbaaee8f21d05"/><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="9f6ad0f5236c656a02ed8bdc0508712f"/></dir><file name="ReportController.php" hash="0ae0fee6659f30a811f151c5007abaf8"/><file name="ReviseController.php" hash="17fdf479c5ca52306e3fb27bc832d37b"/><file name="StandardController.php" hash="954de8828f3adc8e6c2b9a14fb2e4be3"/></dir><dir name="etc"><file name="adminhtml.xml" hash="5bf10fdf706702d95790a1f72d94c27f"/><file name="config.xml" hash="8be86c9f4964a1908753425867e6eef0"/><file name="system.xml" hash="5dbf398d7c13be1f181a0214c45cb43d"/></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="e84c7d0c08f1aa7505da3d1c812e5757"/></dir><dir name="template"><dir name="laybuy"><dir name="checkout"><dir name="onepage"><dir name="review"><file name="button.phtml" hash="097a1d7d5e5f7e3da67f2a7179d8c5bd"/></dir></dir></dir><dir name="customer"><dir name="account"><file name="details.phtml" hash="965a58454b4b3cdcc115d78e595f7c33"/><file name="grid.phtml" hash="2dc802991a69b459f263f4e78c657549"/></dir></dir><dir name="form"><file name="extra.phtml" hash="9765d41880b42cb54aaf8ff6e2e4ce65"/><file name="laybuy.phtml" hash="ac40ad307ae675ecff1ed9dff8fdb171"/></dir><dir name="info"><file name="default.phtml" hash="3efc2eb9f35b47e6e888a726236bf273"/></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="laybuy.xml" hash="6b0e4b3c2d316ab76f1bd9b95732e84e"/></dir><dir name="template"><dir name="laybuy"><dir name="info"><file name="default.phtml" hash="a9dfb322a83df7bc53bb2a64c6f192e3"/></dir><file name="notification.phtml" hash="3b1d4be6c68480b0637e805214725372"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Ced_LayBuy.xml" hash="394d4e115e1955ba12681f6a81cb118d"/></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="jquery.atooltip.js" hash="5ad78b7e8ac539053ff56a2ea25e4d4c"/><file name="jquery.min.js" hash="41ab3fafa358a66f764b91d072f16615"/></dir></dir></target></contents>
|
38 |
<compatible/>
|
39 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
40 |
</package>
|