Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
fb30c6f4e3 | |||
0e403e1584 | |||
16135cae02 |
14
changelog.md
14
changelog.md
@@ -1,5 +1,19 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2025-07-26 - 4.1.3 - fix(export)
|
||||||
|
Fix PDF statement download to use direct content endpoint
|
||||||
|
|
||||||
|
- Changed `downloadContent()` method to use the `/content` endpoint directly for PDF statements
|
||||||
|
- Removed unnecessary attachment lookup step that was causing issues
|
||||||
|
- Simplified the download process for customer statement exports
|
||||||
|
|
||||||
|
## 2025-07-25 - 4.1.1 - fix(httpclient)
|
||||||
|
Fix query parameter handling for smartrequest compatibility
|
||||||
|
|
||||||
|
- Changed query parameter handling to pass objects directly instead of URLSearchParams
|
||||||
|
- Removed URLSearchParams usage and string conversion
|
||||||
|
- Now passes queryParams as an object to smartrequest which handles URL encoding internally
|
||||||
|
|
||||||
## 2025-07-25 - 4.1.0 - feat(transactions)
|
## 2025-07-25 - 4.1.0 - feat(transactions)
|
||||||
Enhanced transaction pagination support with full control over historical data retrieval
|
Enhanced transaction pagination support with full control over historical data retrieval
|
||||||
|
|
||||||
|
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@apiclient.xyz/bunq",
|
"name": "@apiclient.xyz/bunq",
|
||||||
"version": "4.0.1",
|
"version": "4.1.2",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@apiclient.xyz/bunq",
|
"name": "@apiclient.xyz/bunq",
|
||||||
"version": "4.0.1",
|
"version": "4.1.2",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@bunq-community/bunq-js-client": "^1.1.2",
|
"@bunq-community/bunq-js-client": "^1.1.2",
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@apiclient.xyz/bunq",
|
"name": "@apiclient.xyz/bunq",
|
||||||
"version": "4.1.0",
|
"version": "4.1.3",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "A full-featured TypeScript/JavaScript client for the bunq API",
|
"description": "A full-featured TypeScript/JavaScript client for the bunq API",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
@@ -111,25 +111,15 @@ export class BunqExport {
|
|||||||
throw new Error('Export ID not set');
|
throw new Error('Export ID not set');
|
||||||
}
|
}
|
||||||
|
|
||||||
// First get the export details to find the attachment
|
// For PDF statements, use the /content endpoint directly
|
||||||
const exportDetails = await this.get();
|
const downloadUrl = `${this.bunqAccount.apiContext.getBaseUrl()}/v1/user/${this.bunqAccount.userId}/monetary-account/${this.monetaryAccount.id}/customer-statement/${this.id}/content`;
|
||||||
|
|
||||||
if (!exportDetails.attachment || exportDetails.attachment.length === 0) {
|
|
||||||
throw new Error('Export has no attachment');
|
|
||||||
}
|
|
||||||
|
|
||||||
const attachmentUuid = exportDetails.attachment[0].attachment_public_uuid;
|
const response = await plugins.smartrequest.request(downloadUrl, {
|
||||||
|
method: 'GET',
|
||||||
// Download the attachment content
|
headers: {
|
||||||
const response = await plugins.smartrequest.request(
|
'X-Bunq-Client-Authentication': this.bunqAccount.apiContext.getSession().getContext().sessionToken
|
||||||
`${this.bunqAccount.apiContext.getBaseUrl()}/v1/attachment-public/${attachmentUuid}/content`,
|
|
||||||
{
|
|
||||||
method: 'GET',
|
|
||||||
headers: {
|
|
||||||
'X-Bunq-Client-Authentication': this.bunqAccount.apiContext.getSession().getContext().sessionToken
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
);
|
});
|
||||||
|
|
||||||
return Buffer.from(response.body);
|
return Buffer.from(response.body);
|
||||||
}
|
}
|
||||||
|
@@ -53,13 +53,13 @@ export class BunqHttpClient {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (options.params) {
|
if (options.params) {
|
||||||
const params = new URLSearchParams();
|
const queryParams: { [key: string]: string } = {};
|
||||||
Object.entries(options.params).forEach(([key, value]) => {
|
Object.entries(options.params).forEach(([key, value]) => {
|
||||||
if (value !== undefined && value !== null) {
|
if (value !== undefined && value !== null) {
|
||||||
params.append(key, String(value));
|
queryParams[key] = String(value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
requestOptions.queryParams = params.toString();
|
requestOptions.queryParams = queryParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
Reference in New Issue
Block a user