diff --git a/CHANGELOG.md b/CHANGELOG.md index ce68529..f6c5279 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [4.9.0] 2026-11-05 + +### Added + +- Add `organizations.downloadManifiestoZipUrl()` to obtain a temporary URL for downloading the signed Carta Manifiesto ZIP associated with the organization's certificate RFC. + ## [4.8.0] 2026-09-04 ### Added diff --git a/VERSION.md b/VERSION.md index a20ae58..26d8d18 100644 --- a/VERSION.md +++ b/VERSION.md @@ -1,3 +1,8 @@ +4.9.0 + +## Added +- Add `organizations.downloadManifiestoZipUrl()` to obtain a temporary URL for downloading the signed Carta Manifiesto ZIP associated with the organization's certificate RFC. + 4.8.1 ## Fixed diff --git a/src/Resources/Organizations.php b/src/Resources/Organizations.php index f2d2307..9d4f9a3 100644 --- a/src/Resources/Organizations.php +++ b/src/Resources/Organizations.php @@ -223,6 +223,27 @@ public function uploadCertificate($id, $params): mixed } } + /** + * Get a temporary URL to download the signed Carta Manifiesto ZIP. + * + * @param string $id Organization ID. Use `me` with an organization API key. + * @return mixed JSON-decoded signed download URL metadata. + * + * @throws FacturapiException + */ + public function downloadManifiestoZipUrl($id): mixed + { + try { + return json_decode( + $this->executeGetRequest( + $this->getRequestUrl($id) . "/manifiesto/download-url" + ) + ); + } catch (FacturapiException $e) { + throw $e; + } + } + /** * Get the test API key for an organization. * diff --git a/tests/Resources/OrganizationsDomainTest.php b/tests/Resources/OrganizationsDomainTest.php index e6b757e..8a0ce0e 100644 --- a/tests/Resources/OrganizationsDomainTest.php +++ b/tests/Resources/OrganizationsDomainTest.php @@ -58,4 +58,25 @@ public function testCheckDomainAvailabilityThrowsWhenParamsAreNotArray(): void $organizations->checkDomainAvailability('invalid'); } + + public function testDownloadManifiestoZipUrlUsesExpectedEndpoint(): void + { + $httpClient = new FakeHttpClient(new Response( + 200, + [], + '{"url":"https://storage.googleapis.com/signed-download","expires_at":"2030-01-01T00:00:00.000Z","content_type":"application/zip","filename":"manifiesto_AAA010101AAA.zip"}' + )); + $organizations = new Organizations('sk_test_abc123', ['httpClient' => $httpClient]); + + $result = $organizations->downloadManifiestoZipUrl('org_123'); + + self::assertSame('application/zip', $result->content_type); + self::assertSame('manifiesto_AAA010101AAA.zip', $result->filename); + $request = $httpClient->requests()[0]; + self::assertSame('GET', $request->getMethod()); + self::assertSame( + 'https://www.facturapi.io/v2/organizations/org_123/manifiesto/download-url', + (string) $request->getUri() + ); + } }