diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ab3077..5728abe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [4.14.1] 2026-03-31 +### Fixed +- Fix `organizations.checkDomainIsAvailable` to call `GET /organizations/domain-check` with query params (instead of an unsupported `PUT` payload flow). +- Align method input naming to query semantics for clearer usage (`query`). + ## [4.14.0] 2026-03-04 ### Added - Add `facturapi.comercioExteriorCatalogs.searchTariffFractions` method for Fracción Arancelaria SAT catalog diff --git a/package-lock.json b/package-lock.json index 4904040..06ac67c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "facturapi", - "version": "4.14.0", + "version": "4.14.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "facturapi", - "version": "4.14.0", + "version": "4.14.1", "license": "MIT", "devDependencies": { "@eslint/js": "^10.0.1", diff --git a/package.json b/package.json index 42a4a54..d17ea29 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "facturapi", - "version": "4.14.0", + "version": "4.14.1", "description": "Librería oficial de Facturapi. Crea CFDIs timbrados y enviados al SAT, XML y PDF", "main": "dist/index.cjs.js", "module": "dist/index.es.js", diff --git a/src/resources/organizations.ts b/src/resources/organizations.ts index a4aab1a..264fde2 100644 --- a/src/resources/organizations.ts +++ b/src/resources/organizations.ts @@ -168,7 +168,7 @@ export default class Organizations { checkDomainIsAvailable( data: Record, ): Promise<{ available: boolean }> { - return this.client.put('/organizations/domain-check', { body: data }); + return this.client.get('/organizations/domain-check', { params: data }); } /** diff --git a/test/node/runtime-compat.node.test.ts b/test/node/runtime-compat.node.test.ts index d321dc7..515a5f2 100644 --- a/test/node/runtime-compat.node.test.ts +++ b/test/node/runtime-compat.node.test.ts @@ -78,6 +78,31 @@ describe('runtime compatibility (node)', () => { expect(invoice.id).toBe('inv_123'); }); + it('checks domain availability via GET query params', async () => { + const client = createClient(); + + globalThis.fetch = vi.fn(async (url, options) => { + expect(url).toBe( + 'https://api.test.local/v2/organizations/domain-check?domain=empresa-demo', + ); + expect(options?.method).toBe('GET'); + expect(getHeader(options?.headers, 'Authorization')).toBe( + 'Bearer sk_test_123', + ); + + return new Response(JSON.stringify({ available: true }), { + status: 200, + headers: { 'content-type': 'application/json' }, + }); + }) as typeof fetch; + + const result = await client.organizations.checkDomainIsAvailable({ + domain: 'empresa-demo', + }); + + expect(result.available).toBe(true); + }); + it('surfaces API message from non-OK JSON responses', async () => { const client = createClient();