M3 Integration fixes

This commit is contained in:
Mark Gregory
2026-09-21 13:33:05 +01:00
parent 3521e47ef0
commit 66aeefbba5
23 changed files with 674 additions and 691 deletions
+23 -24
View File
@@ -28,33 +28,32 @@ class TwoShipAPIs extends Controller
if ($params === []) {
$this->log($macpkr ?: '000000', $co, $whs, $user, 'X', 'No URL Parameters Sent');
$result = response()->json(['code' => '405', 'status' => 'Error', 'message' => 'No URL Parameters Sent']);
} else {
try {
$this->logRequest($macpkr, $co, $whs, $user);
$orders = $this->aggregationOrders($macpkr, $co, $whs);
$response = $this->callTwoShip($orders);
$error = $this->responseError($response);
return response()->json(['code' => '405', 'status' => 'Error', 'message' => 'No URL Parameters Sent']);
}
try {
$this->logRequest($macpkr, $co, $whs, $user);
$orders = $this->aggregationOrders($macpkr, $co, $whs);
$response = $this->callTwoShip($orders);
$error = $this->responseError($response);
if ($error !== '') {
$this->log($macpkr, $co, $whs, $user, 'X', $response->status() . '-' . $error);
return response()->json(['code' => '405', 'status' => 'error', 'message' => 'Status: ' . $response->status() . '-' . $error]);
if ($error !== '') {
$this->log($macpkr, $co, $whs, $user, 'X', $response->status() . '-' . $error);
$result = response()->json(['code' => '405', 'status' => 'error', 'message' => 'Status: ' . $response->status() . '-' . $error]);
} else {
$this->log($macpkr, $co, $whs, $user, '', $response->body());
$this->markAggregationComplete($orders, $co, $whs);
$result = response()->json(['code' => '200', 'status' => 'Success']);
}
} catch (\Throwable $th) {
$message = str_contains($th->getMessage(), 'cURL error')
? 'Curl Error: Communication with 2Ship Timed Out.'
: '2Ship communication failed.';
$this->log($macpkr, $co, $whs, $user, 'X', $message);
$result = response()->json(['code' => '405', 'status' => 'error', 'message' => $message]);
}
$this->log($macpkr, $co, $whs, $user, '', $response->body());
$this->markAggregationComplete($orders, $co, $whs);
return response()->json(['code' => '200', 'status' => 'Success']);
} catch (\Throwable $th) {
$message = str_contains($th->getMessage(), 'cURL error')
? 'Curl Error: Communication with 2Ship Timed Out.'
: '2Ship communication failed.';
$this->log($macpkr, $co, $whs, $user, 'X', $message);
return response()->json(['code' => '405', 'status' => 'error', 'message' => $message]);
}
return $result;
}
private function configureTimeouts(): void