Skip to content

Commit aaa51f3

Browse files
committed
Verificaçao se assinatura foi feita com sucesso.
1 parent 4c037a1 commit aaa51f3

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
"minimum-stability": "dev",
2121
"require": {
2222
"php": "^7.1",
23-
"ext-openssl": "*"
23+
"ext-openssl": "*",
24+
"ext-json": "*"
2425
},
2526
"require-dev": {
2627
"phpunit/phpunit": "^9.0"

src/Sign/JSignService.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ public function sign(JSignParam $params)
2525
$this->validation($params);
2626

2727
$commandSign = $this->commandSign($params);
28-
$out = exec($commandSign, $output);
29-
if (is_array($output))
30-
$output = $output[count($output) -1];
28+
exec($commandSign, $output);
3129

30+
$out = json_encode($output);
3231
$messageSuccess = "INFO Finished: Signature succesfully created.";
33-
$isSigned = ($output == $messageSuccess || $out == $messageSuccess);
34-
$this->throwIf(!$isSigned, "Error to sign PDF. $output");
32+
$isSigned = strpos($out, $messageSuccess) !== false;
33+
34+
$this->throwIf(!$isSigned, "Error to sign PDF. $out");
3535

3636
$fileSigned = $this->fileService->contentFile(
3737
$params->getTempPdfSignedPath(),

0 commit comments

Comments
 (0)