|
|
@@ -223,28 +223,24 @@ class DolibarrApiService extends ApiRequestService
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * @param $type
|
|
|
- * @param $docRef
|
|
|
- * @return array<mixed>|null The resulting document. Ex :
|
|
|
- * {
|
|
|
- * "filename": "CO2502-0380.pdf",
|
|
|
- * "content-type": "application/pdf",
|
|
|
- * "filesize": 10660,
|
|
|
- * "content": "JVBERi0xLjcKJeLjz9MKNyAwIG9iago8PCAvV...",
|
|
|
- * "encoding": "base64"
|
|
|
- * }
|
|
|
+ * @return array<string, string|number> The resulting document. Ex :
|
|
|
+ * {
|
|
|
+ * "filename": "CO2502-0380.pdf",
|
|
|
+ * "content-type": "application/pdf",
|
|
|
+ * "filesize": 10660,
|
|
|
+ * "content": "JVBERi0xLjcKJeLjz9MKNyAwIG9iago8PCAvV...",
|
|
|
+ * "encoding": "base64"
|
|
|
+ * }
|
|
|
+ *
|
|
|
+ * @throws \JsonException
|
|
|
*/
|
|
|
public function downloadBillingDocPdf(string $type, string $docRef): array
|
|
|
{
|
|
|
if (!DolibarrDocTypeEnum::tryFrom($type)) {
|
|
|
- throw new \InvalidArgumentException(sprintf(
|
|
|
- 'Invalid type "%s" provided. Allowed values are: %s',
|
|
|
- $type,
|
|
|
- implode(', ', array_map(fn($t) => $t->value, DolibarrDocTypeEnum::cases()))
|
|
|
- ));
|
|
|
+ throw new \InvalidArgumentException(sprintf('Invalid type "%s" provided. Allowed values are: %s', $type, implode(', ', array_map(fn ($t) => $t->value, DolibarrDocTypeEnum::cases()))));
|
|
|
}
|
|
|
|
|
|
- $route = "documents/download?modulepart=".$type."&original_file=".urlencode("$docRef/$docRef.pdf");
|
|
|
+ $route = 'documents/download?modulepart='.$type.'&original_file='.urlencode("$docRef/$docRef.pdf");
|
|
|
|
|
|
return $this->getJsonContent($route);
|
|
|
}
|