Skip to content

Commit 26fa7d6

Browse files
abidlovskyiTaras Kubiv
authored andcommitted
Merged in APITOCART-14258 (pull request #31)
fix check new orders Approved-by: Mykola Zaburko Approved-by: Serhii Oioiko
2 parents 7bab75f + 0f22715 commit 26fa7d6

File tree

4 files changed

+529
-453
lines changed

4 files changed

+529
-453
lines changed

src/app/Http/Controllers/OrdersController.php

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use App\Http\Requests\OrderRequest;
66
use App\Services\Api2Cart;
7+
use Carbon\Carbon;
78
use Illuminate\Http\Request;
89
use Illuminate\Support\Facades\Log;
910

@@ -26,7 +27,7 @@ public function index()
2627
public function orderList($store_id=null,Request $request)
2728
{
2829
\Debugbar::disable();
29-
30+
// Log::debug($request->all());
3031

3132
/**
3233
* get account carts & extract exact store info
@@ -36,17 +37,23 @@ public function orderList($store_id=null,Request $request)
3637

3738
$sort_by = ($request->get('sort_by')) ? $request->get('sort_by') : null;
3839
$sort_direct = ($request->get('sort_direct')) ? true : false;
39-
$created_from = ($request->get('created_from')) ? $request->get('created_from') : null;
40+
$created_from = ($request->get('created_from')) ? Carbon::parse($request->get('created_from'))->format("Y-m-d\TH:i:sO") : null;
4041
$limit = ($request->get('limit')) ? $request->get('limit') : null;
4142

4243
$totalOrders = $this->api2cart->getOrderCount( $store_id );
4344

4445
$orders = collect([]);
4546

46-
47+
//Log::debug( $created_from );
4748
if ( $totalOrders ){
4849

49-
$result = $this->api2cart->getOrderList( $store_id, null, null, null, $created_from );
50+
$result = $this->api2cart->getOrderList(
51+
$store_id,
52+
null,
53+
null,
54+
null,
55+
$created_from,
56+
);
5057

5158
$newOrders = (isset($result['result']['orders_count'])) ? collect( $result['result']['order'] ) : collect([]);
5259
// put additional information
@@ -81,7 +88,7 @@ public function orderList($store_id=null,Request $request)
8188

8289
// $result = $this->api2cart->getOrderList( $store_id , 'create_at.value', null,$limit);
8390
// Log::debug('raw api result');
84-
// Log::debug( print_r($result,1) );
91+
// if ( $store_id == '4730d110180d4b67449f00b44608cb9d' ) Log::debug( print_r($result,1) );
8592

8693
if ( $sort_by ){
8794
switch ($sort_by){

src/app/Services/Api2Cart.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
use GuzzleHttp\HandlerStack;
1212
use GuzzleHttp\Handler\CurlHandler;
1313

14-
1514
use App\Models\User;
1615
use App\Models\Log as Logger;
1716

@@ -669,6 +668,9 @@ public function getOrderList( $store_id=null , $sort_by=null, $sort_direct=null,
669668
null
670669
);
671670

671+
672+
//if ( $store_id == '4730d110180d4b67449f00b44608cb9d' ) Log::debug(print_r($result,1));
673+
672674
$this->logApiCall( 'order.list.json', $result->getReturnCode(), $this->order->getConfig(), null, null, null, $result->getReturnMessage(), [ 'sort_by' => $sort_by, 'sort_direct' => $sort_direct, 'limit' => $limit, 'created_from' => $created_from] );
673675

674676
if ( $result->getReturnCode() == 0 ){

0 commit comments

Comments
 (0)