| Line 58... |
Line 58... |
| 58 |
$creditedAmount = $pendingAmount = $approvedAmount = 0;
|
58 |
$creditedAmount = $pendingAmount = $approvedAmount = 0;
|
| 59 |
if(!empty($response['data'])){
|
59 |
if(!empty($response['data'])){
|
| 60 |
foreach ($response['data'] as $key => $order) {
|
60 |
foreach ($response['data'] as $key => $order) {
|
| 61 |
foreach ($order['subOrders'] as $key => $suborder) {
|
61 |
foreach ($order['subOrders'] as $key => $suborder) {
|
| 62 |
$suborder['storeId'] = $order['storeId'];
|
62 |
$suborder['storeId'] = $order['storeId'];
|
| - |
|
63 |
$suborder['merchantOrderId'] = $order['merchantOrderId'];
|
| 63 |
switch($suborder['cashBackStatus']){
|
64 |
switch($suborder['cashBackStatus']){
|
| 64 |
case 'Credited to wallet'://Credited
|
65 |
// case 'Credited to wallet'://Credited
|
| 65 |
$creditedOrders[] = $suborder;
|
66 |
// $creditedOrders[] = $suborder;
|
| 66 |
break;
|
67 |
// break;
|
| 67 |
case 'Approved':
|
68 |
case 'Approved':
|
| 68 |
$approvedOrders[] = $suborder;
|
69 |
$approvedOrders[] = $suborder;
|
| 69 |
$approvedAmount += $suborder['cashBackAmount'];
|
70 |
$approvedAmount += $suborder['cashBackAmount'];
|
| 70 |
break;
|
71 |
break;
|
| 71 |
case 'Pending':
|
72 |
case 'Pending':
|
| Line 78... |
Line 79... |
| 78 |
//Get pending cashbacks
|
79 |
//Get pending cashbacks
|
| 79 |
$url = $this->apihost.'pending-refunds/user/'.$userId;
|
80 |
$url = $this->apihost.'pending-refunds/user/'.$userId;
|
| 80 |
$pendingCashbacks = $this->make_request($url,null);
|
81 |
$pendingCashbacks = $this->make_request($url,null);
|
| 81 |
//Get credited cashbacks
|
82 |
//Get credited cashbacks
|
| 82 |
$url = $this->apihost.'refund/user/'.$userId;
|
83 |
$url = $this->apihost.'refund/user/'.$userId;
|
| 83 |
$activestores = $this->make_request($url,null);
|
84 |
$creditedCashbacks = $this->make_request($url,null);
|
| - |
|
85 |
|
| 84 |
if(!empty($creditedCashbacks)){
|
86 |
if(!empty($creditedCashbacks)){
|
| 85 |
foreach ($creditedCashbacks['data'] as $key => $value) {
|
87 |
foreach ($creditedCashbacks['data'] as $key => $value) {
|
| 86 |
$creditedAmount += $value['userAmount'];
|
88 |
$creditedAmount += $value['userAmount'];
|
| - |
|
89 |
$data = array('subOrders.batchId'=>$value['batch']);
|
| - |
|
90 |
$jsonVar = json_encode($data);
|
| - |
|
91 |
$url = $this->apihost."storeorder/user/".$this->Auth->User('id')."?page=1&window=50&searchMap=$jsonVar";
|
| - |
|
92 |
$creditedOrders[$value['batch']] = $this->make_request($url,null);
|
| - |
|
93 |
// debug($creditedOrders);
|
| 87 |
}
|
94 |
}
|
| 88 |
}
|
95 |
}
|
| 89 |
$storemapping = Configure::read('storemapping');
|
96 |
$storemapping = Configure::read('storemapping');
|
| 90 |
$activestores = Configure::read('activestores');
|
97 |
$activestores = Configure::read('activestores');
|
| 91 |
if(!empty($response['data'])){
|
98 |
if(!empty($response['data'])){
|