json() ?? []; // ACS's own JSON key is misspelled ("Responce") — preserved here verbatim. $output = $body['ACSOutputResponce'] ?? []; return new self( hasError: (bool) ($body['ACSExecution_HasError'] ?? ! $response->successful()), errorMessage: $body['ACSExecutionErrorMessage'] ?? null, valueOutput: $output['ACSValueOutput'][0] ?? [], tableOutput: $output['ACSTableOutput'] ?? [], ); } public function throwIfError(): self { if ($this->hasError) { throw new AcsApiException( $this->errorMessage ?? ($this->valueOutput['Error_Message'] ?? 'Unknown ACS API error'), $this->tableOutput, ); } return $this; } }