This commit is contained in:
2025-07-18 12:10:29 +00:00
parent 4ec2e46c4b
commit be09571604
14 changed files with 2628 additions and 281 deletions

View File

@@ -7,22 +7,6 @@ A full-featured TypeScript/JavaScript client for the bunq API
* [github.com (source mirror)](https://github.com/mojoio/bunq)
* [docs (typedoc)](https://mojoio.gitlab.io/bunq/)
## Status for master
Status Category | Status Badge
-- | --
GitLab Pipelines | [![pipeline status](https://gitlab.com/mojoio/bunq/badges/master/pipeline.svg)](https://lossless.cloud)
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/mojoio/bunq/badges/master/coverage.svg)](https://lossless.cloud)
npm | [![npm downloads per month](https://badgen.net/npm/dy/@apiclient.xyz/bunq)](https://lossless.cloud)
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/mojoio/bunq)](https://lossless.cloud)
TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud)
node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud)
PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@apiclient.xyz/bunq)](https://lossless.cloud)
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@apiclient.xyz/bunq)](https://lossless.cloud)
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@apiclient.xyz/bunq)](https://lossless.cloud)
Platform support | [![Supports Windows 10](https://badgen.net/badge/supports%20Windows%2010/yes/green?icon=windows)](https://lossless.cloud) [![Supports Mac OS X](https://badgen.net/badge/supports%20Mac%20OS%20X/yes/green?icon=apple)](https://lossless.cloud)
## Features
- Complete bunq API implementation
@@ -86,19 +70,19 @@ const payment = BunqPayment.builder(bunq, monetaryAccount)
.create();
// Batch payment
const batch = new BunqBatchPayment(bunq, monetaryAccount);
batch
.addPayment({
const batch = new BunqPaymentBatch(bunq);
const batchId = await batch.create(monetaryAccount, [
{
amount: { value: '5.00', currency: 'EUR' },
counterparty_alias: { type: 'IBAN', value: 'NL91ABNA0417164300' },
counterparty_alias: { type: 'IBAN', value: 'NL91ABNA0417164300', name: 'Recipient 1' },
description: 'Payment 1'
})
.addPayment({
},
{
amount: { value: '15.00', currency: 'EUR' },
counterparty_alias: { type: 'EMAIL', value: 'friend@example.com' },
counterparty_alias: { type: 'EMAIL', value: 'friend@example.com', name: 'Friend' },
description: 'Payment 2'
});
await batch.create();
}
]);
```
### Managing Cards
@@ -129,10 +113,10 @@ const newCard = await BunqCard.order(bunq, {
### Scheduled Payments
```typescript
import { BunqScheduledPayment } from '@apiclient.xyz/bunq';
import { BunqSchedulePayment } from '@apiclient.xyz/bunq';
// Create a recurring payment
const scheduled = BunqScheduledPayment.builder(bunq, monetaryAccount)
const scheduled = await BunqSchedulePayment.builder(bunq, monetaryAccount)
.amount('50.00', 'EUR')
.toIban('NL91ABNA0417164300', 'Landlord')
.description('Monthly rent')
@@ -140,7 +124,8 @@ const scheduled = BunqScheduledPayment.builder(bunq, monetaryAccount)
.create();
// List scheduled payments
const schedules = await BunqScheduledPayment.list(bunq, monetaryAccount.id);
const scheduler = new BunqSchedulePayment(bunq);
const schedules = await scheduler.list(monetaryAccount);
```
### Request Money
@@ -292,6 +277,33 @@ try {
}
```
## Testing
Run the test suite:
```bash
npm test # Run all tests
npm run test:basic # Run basic functionality tests
npm run test:payments # Run payment-related tests
npm run test:webhooks # Run webhook tests
npm run test:session # Run session management tests
npm run test:errors # Run error handling tests
npm run test:advanced # Run advanced feature tests
```
### Test Coverage
The test suite includes comprehensive coverage for:
- **Basic functionality**: Account creation, initialization, transactions
- **Payments**: Payment builders, draft payments, payment requests
- **Webhooks**: Creation, management, signature verification
- **Session management**: Persistence, expiry, concurrent usage
- **Error handling**: Network errors, invalid inputs, rate limiting
- **Advanced features**: Joint accounts, cards, notifications, exports
All tests use the bunq sandbox environment and create fresh API keys for each test run.
## Requirements
- Node.js 10.x or higher