From 761c47524fbe551955e953478e69a932cc8d1864 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 20 Jul 2026 15:20:23 +0000 Subject: [PATCH 1/2] test: cover transaction revision error details Co-authored-by: Jed Patterson --- CHANGELOG.md | 4 +++ package.json | 2 +- src/__tests__/internal/base-resource.test.ts | 26 ++++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) 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..cdaf8bd 100644 --- a/src/__tests__/internal/base-resource.test.ts +++ b/src/__tests__/internal/base-resource.test.ts @@ -92,6 +92,32 @@ 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, From 741f36aba8100c7db7a83b1abc9368bdf071e3a1 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 20 Jul 2026 15:21:42 +0000 Subject: [PATCH 2/2] style: format transaction error contract test Co-authored-by: Jed Patterson --- src/__tests__/internal/base-resource.test.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/__tests__/internal/base-resource.test.ts b/src/__tests__/internal/base-resource.test.ts index cdaf8bd..c4f88b1 100644 --- a/src/__tests__/internal/base-resource.test.ts +++ b/src/__tests__/internal/base-resource.test.ts @@ -93,8 +93,7 @@ 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 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(), @@ -103,8 +102,7 @@ describe('BaseResource', () => { type: 'request_error', code: 'transaction_invalid_status_to_revise', detail, - documentation_url: - 'https://developer.paddle.com/errors/transactions/transaction_invalid_status_to_revise', + documentation_url: 'https://developer.paddle.com/errors/transactions/transaction_invalid_status_to_revise', }, meta: { request_id: 'req_3' }, }),