| Line 87... |
Line 87... |
| 87 |
$this->loadModel('User');
|
87 |
$this->loadModel('User');
|
| 88 |
$dbuser = $this->User->findById($userId);
|
88 |
$dbuser = $this->User->findById($userId);
|
| 89 |
$this->Auth->login($dbuser['User']);
|
89 |
$this->Auth->login($dbuser['User']);
|
| 90 |
}
|
90 |
}
|
| 91 |
$this->layout = "innerpages";
|
91 |
$this->layout = "innerpages";
|
| 92 |
$url = $this->apihost."storeorder/user/".$this->Auth->User('id')."?page=1&window=50&searchMap={%22subOrders.cashBackStatus%22:{%22\$in%22:[%22Approved%22,%22Pending%22]}}";
|
92 |
$url = $this->apihost."storeorder/user/".$userId."?page=1&window=50&searchMap=%7B\"subOrders.cashBackStatus\"%3A%20%7B\"%24in\"%3A%20%5B\"Approved\"%2C%20\"Pending\"%5D%7D%7D";
|
| 93 |
$response = $this->make_request($url,null);
|
93 |
$response = $this->make_request($url,null);
|
| 94 |
// debug($response);
|
94 |
// debug($response);
|
| 95 |
$creditedOrders = $pendingOrders = $approvedOrders = array();
|
95 |
$creditedOrders = $pendingOrders = $approvedOrders = array();
|
| 96 |
$creditedAmount = $pendingAmount = $approvedAmount = 0;
|
96 |
$creditedAmount = $pendingAmount = $approvedAmount = 0;
|
| 97 |
if(!empty($response['data'])){
|
97 |
if(!empty($response['data'])){
|
| Line 254... |
Line 254... |
| 254 |
}
|
254 |
}
|
| 255 |
|
255 |
|
| 256 |
public function usercashbacks($userId) {
|
256 |
public function usercashbacks($userId) {
|
| 257 |
$this->set('byUser',$userId);
|
257 |
$this->set('byUser',$userId);
|
| 258 |
$this->layout = "innerpages";
|
258 |
$this->layout = "innerpages";
|
| 259 |
$url = $this->apihost."storeorder/user/".$userId."?page=1&window=50&searchMap={%22subOrders.cashBackStatus%22:{%22\$in%22:[%22Approved%22,%22Pending%22]}}";
|
259 |
$url = $this->apihost."storeorder/user/".$userId."?page=1&window=50&searchMap=%7B\"subOrders.cashBackStatus\"%3A%20%7B\"%24in\"%3A%20%5B\"Approved\"%2C%20\"Pending\"%5D%7D%7D";
|
| 260 |
$response = $this->make_request($url,null);
|
260 |
$response = $this->make_request($url,null);
|
| 261 |
// debug($response);
|
261 |
// debug($response);
|
| 262 |
$creditedOrders = $pendingOrders = $approvedOrders = array();
|
262 |
$creditedOrders = $pendingOrders = $approvedOrders = array();
|
| 263 |
$creditedAmount = $pendingAmount = $approvedAmount = 0;
|
263 |
$creditedAmount = $pendingAmount = $approvedAmount = 0;
|
| - |
|
264 |
echo $response['data'];
|
| 264 |
if(!empty($response['data'])){
|
265 |
if(!empty($response['data'])){
|
| 265 |
foreach ($response['data'] as $key => $order) {
|
266 |
foreach ($response['data'] as $key => $order) {
|
| 266 |
if(!empty($order['subOrders'])){
|
267 |
if(!empty($order['subOrders'])){
|
| 267 |
foreach ($order['subOrders'] as $key => $suborder) {
|
268 |
foreach ($order['subOrders'] as $key => $suborder) {
|
| 268 |
$suborder['storeId'] = $order['storeId'];
|
269 |
$suborder['storeId'] = $order['storeId'];
|
| Line 272... |
Line 273... |
| 272 |
$suborder['merchantOrderId'] = $suborder['merchantSubOrderId'];
|
273 |
$suborder['merchantOrderId'] = $suborder['merchantSubOrderId'];
|
| 273 |
}
|
274 |
}
|
| 274 |
if(!empty($order['orderTrackingUrl'])){
|
275 |
if(!empty($order['orderTrackingUrl'])){
|
| 275 |
$suborder['orderSuccessUrl'] = $order['orderTrackingUrl'];
|
276 |
$suborder['orderSuccessUrl'] = $order['orderTrackingUrl'];
|
| 276 |
}
|
277 |
}
|
| - |
|
278 |
$suborder['cashBackStatus'];
|
| 277 |
switch($suborder['cashBackStatus']){
|
279 |
switch($suborder['cashBackStatus']){
|
| 278 |
// case 'Credited to wallet'://Credited
|
280 |
// case 'Credited to wallet'://Credited
|
| 279 |
// $creditedOrders[] = $suborder;
|
281 |
// $creditedOrders[] = $suborder;
|
| 280 |
// break;
|
282 |
// break;
|
| 281 |
case 'Approved':
|
283 |
case 'Approved':
|