m3 Security Fixes
This commit is contained in:
@@ -14,6 +14,9 @@ use Str;
|
||||
|
||||
class ReplenAPI extends Controller
|
||||
{
|
||||
private const ZERO_PAD = '000000';
|
||||
private const JSON_CONTENT_TYPE = 'application/json';
|
||||
|
||||
// M3Replenishement with URL Params
|
||||
public function M3InventoryReportReplen(Request $request)
|
||||
{
|
||||
@@ -25,7 +28,7 @@ class ReplenAPI extends Controller
|
||||
// Log::info( $request->all() );
|
||||
// Get The Calling User
|
||||
$SHUSER = m3_user() !== '' ? Str::upper(m3_user()) : 'WebUser';
|
||||
$MACPKR = isset($MACPKR) ? $MACPKR : '000000';
|
||||
$MACPKR = isset($MACPKR) ? $MACPKR : self::ZERO_PAD;
|
||||
$SHSOURCE = 'M3InventoryReportReplen';
|
||||
$M3Errors = '';
|
||||
|
||||
@@ -83,11 +86,11 @@ class ReplenAPI extends Controller
|
||||
$token = $IonToken;
|
||||
|
||||
$response = Http::withHeaders([
|
||||
'accept' => 'application/json',
|
||||
'Content-Type' => 'application/json',
|
||||
])
|
||||
'accept' => self::JSON_CONTENT_TYPE,
|
||||
'Content-Type' => self::JSON_CONTENT_TYPE,
|
||||
])
|
||||
->withToken($token)
|
||||
->withBody($JSON, 'application/json')
|
||||
->withBody($JSON, self::JSON_CONTENT_TYPE)
|
||||
->timeout(Config::get('arrays.curlTimeOut'))
|
||||
->retry(3, 100)
|
||||
->post($endPointURL);
|
||||
@@ -226,7 +229,7 @@ class ReplenAPI extends Controller
|
||||
]);
|
||||
} else {
|
||||
// Write to Logs Out : Error
|
||||
$MACPKR = isset($MACPKR) ? $MACPKR : '000000';
|
||||
$MACPKR = isset($MACPKR) ? $MACPKR : self::ZERO_PAD;
|
||||
$data = ['SHMACPKR' => $MACPKR, 'SHDT' => date('Y-m-d'), 'SHTIME' => date('H:i:s'), 'SHERROR' => 'X', 'SHINTBOX' => '', 'SHTYPE' => 'M3-Res-out',
|
||||
'SHDATA' => 'No URL Parameters Sent', 'SHUSER' => $SHUSER, 'SHSOURCE' => $SHSOURCE, 'SHCO' => $CO, 'SHWHS' => $WHS];
|
||||
Helper::logToICM699M($data);
|
||||
@@ -240,7 +243,7 @@ class ReplenAPI extends Controller
|
||||
}
|
||||
} catch (\Throwable $th) {
|
||||
// Write to Logs Out : Error
|
||||
$MACPKR = isset($MACPKR) ? $MACPKR : '000000';
|
||||
$MACPKR = isset($MACPKR) ? $MACPKR : self::ZERO_PAD;
|
||||
|
||||
$getCurlErrors = str_contains($th->getMessage(), 'cURL error');
|
||||
if ($getCurlErrors) {
|
||||
|
||||
Reference in New Issue
Block a user