diff --git a/CHANGELOG.md b/CHANGELOG.md index 0da1d89..74a7eb8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,10 @@ adding additional type guards. ## Unreleased +### Changed + +- Updated transaction revision error contract coverage to reflect that server guidance lists `past_due` as a revisable status. The SDK continues to pass server error codes and details through unchanged. + --- ## 3.8.0 - 2026-04-20 diff --git a/package.json b/package.json index ce057b0..207790d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@paddle/paddle-node-sdk", - "version": "3.8.0", + "version": "3.8.1", "description": "A Node.js SDK that you can use to integrate Paddle Billing with applications written in server-side JavaScript.", "main": "dist/cjs/index.cjs.node.js", "module": "dist/esm/index.esm.node.js", diff --git a/src/__tests__/internal/base-resource.test.ts b/src/__tests__/internal/base-resource.test.ts index 77c30cd..c4f88b1 100644 --- a/src/__tests__/internal/base-resource.test.ts +++ b/src/__tests__/internal/base-resource.test.ts @@ -92,6 +92,30 @@ describe('BaseResource', () => { } }); + test('passes through transaction revision error details unchanged', async () => { + const detail = "You can't revise a transaction that's not in the status of `billed`, `past_due` or `completed`"; + const mockResponse = { + status: 400, + headers: new Map(), + json: jest.fn().mockResolvedValue({ + error: { + type: 'request_error', + code: 'transaction_invalid_status_to_revise', + detail, + documentation_url: 'https://developer.paddle.com/errors/transactions/transaction_invalid_status_to_revise', + }, + meta: { request_id: 'req_3' }, + }), + }; + + mockFetch.mockResolvedValue(mockResponse); + + await expect(resource.trigger('/transactions/txn_1/revise')).rejects.toMatchObject({ + code: 'transaction_invalid_status_to_revise', + detail, + }); + }); + test('successful responses pass through handleResponse', async () => { const mockResponse = { status: 200,