Compare commits

...

12 Commits

Author SHA1 Message Date
5abc4e7976 1.0.22 2020-08-25 12:57:15 +00:00
58f4855cb6 fix(core): update 2020-08-25 12:57:14 +00:00
c34846c82f 1.0.21 2020-08-21 01:37:32 +00:00
2656f1a9a9 fix(core): update 2020-08-21 01:37:31 +00:00
e63d24eb13 1.0.20 2020-08-21 01:33:31 +00:00
f0e27bf7c8 fix(core): update 2020-08-21 01:33:30 +00:00
282d2bdf24 1.0.19 2020-08-21 01:31:49 +00:00
04cb6f042f fix(core): update 2020-08-21 01:31:49 +00:00
423bd22903 1.0.18 2020-08-20 01:20:16 +00:00
5295bf272e fix(core): update 2020-08-20 01:20:15 +00:00
752c585e26 1.0.17 2020-08-20 01:08:06 +00:00
a3bfd49d6e fix(core): update 2020-08-20 01:08:05 +00:00
10 changed files with 7491 additions and 1130 deletions

View File

@ -19,23 +19,35 @@ mirror:
stage: security
script:
- npmci git mirror
only:
- tags
tags:
- lossless
- docker
- notpriv
audit:
auditProductionDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci npm prepare
- npmci command npm install --production --ignore-scripts
- npmci command npm config set registry https://registry.npmjs.org
- npmci command npm audit --audit-level=high --only=prod --production
tags:
- docker
auditDevDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci npm prepare
- npmci command npm install --ignore-scripts
- npmci command npm config set registry https://registry.npmjs.org
- npmci command npm audit --audit-level=high
- npmci command npm audit --audit-level=high --only=dev
tags:
- lossless
- docker
- notpriv
allow_failure: true
# ====================
# test stage
@ -50,9 +62,7 @@ testStable:
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- lossless
- docker
- priv
testBuild:
stage: test
@ -63,9 +73,7 @@ testBuild:
- npmci command npm run build
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- lossless
- docker
- notpriv
release:
stage: release
@ -85,6 +93,8 @@ release:
codequality:
stage: metadata
allow_failure: true
only:
- tags
script:
- npmci command npm install -g tslint typescript
- npmci npm prepare

View File

@ -15,7 +15,7 @@
"properties": {
"projectType": {
"type": "string",
"enum": ["website", "element", "service", "npm"]
"enum": ["website", "element", "service", "npm", "wcc"]
}
}
}

8511
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "@mojoio/bunq",
"version": "1.0.16",
"version": "1.0.22",
"private": false,
"description": "a bunq api abstraction package",
"main": "dist_ts/index.js",
@ -13,18 +13,18 @@
"format": "(gitzone format)"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.1.24",
"@gitzone/tstest": "^1.0.33",
"@gitzone/tsbuild": "^2.1.25",
"@gitzone/tstest": "^1.0.44",
"@pushrocks/qenv": "^4.0.10",
"@pushrocks/tapbundle": "^3.2.1",
"@types/node": "^14.0.13",
"tslint": "^6.1.2",
"@pushrocks/tapbundle": "^3.2.9",
"@types/node": "^14.6.0",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.15.0"
},
"dependencies": {
"@bunq-community/bunq-js-client": "^1.1.2",
"@pushrocks/smartcrypto": "^1.0.9",
"@pushrocks/smartfile": "^7.0.12",
"@pushrocks/smartfile": "^8.0.0",
"@pushrocks/smartpromise": "^3.0.6",
"json-store": "^1.0.0"
},
@ -39,5 +39,8 @@
"cli.js",
"npmextra.json",
"readme.md"
],
"browserslist": [
"last 1 chrome versions"
]
}

View File

@ -27,7 +27,6 @@ Platform support | [![Supports Windows 10](https://badgen.net/badge/supports%20W
Use Typescript for best in class intellisense.
## Contribution
We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :)

View File

@ -9,7 +9,7 @@ let testBunqAccount: bunq.BunqAccount;
const testBunqOptions: bunq.IBunqConstructorOptions = {
apiKey: testQenv.getEnvVarOnDemand('BUNQ_APIKEY'),
deviceName: 'mojoiobunqpackage',
environment: 'SANDBOX'
environment: 'SANDBOX',
};
tap.test('should create a valid bunq account', async () => {

View File

@ -1,6 +1,6 @@
import * as plugins from './bunq.plugins';
import * as paths from './bunq.paths';
import { MonetaryAccount } from './bunq.classes.monetaryaccount';
import { BunqMonetaryAccount } from './bunq.classes.monetaryaccount';
export interface IBunqConstructorOptions {
deviceName: string;
@ -77,6 +77,8 @@ export class BunqAccount {
const users = await this.bunqJSClient.api.user.list();
if (users.UserPerson) {
this.userId = users.UserPerson.id;
} else if (users.UserApiKey) {
this.userId = users.UserApiKey.id;
} else if (users.UserCompany) {
this.userId = users.UserCompany.id;
} else {
@ -85,10 +87,14 @@ export class BunqAccount {
}
public async getAccounts() {
const apiMonetaryAccounts = await this.bunqJSClient.api.monetaryAccount.list(this.userId);
const accountsArray: MonetaryAccount[] = [];
const apiMonetaryAccounts = await this.bunqJSClient.api.monetaryAccount
.list(this.userId, {})
.catch((e) => {
console.log(e);
});
const accountsArray: BunqMonetaryAccount[] = [];
for (const apiAccount of apiMonetaryAccounts) {
accountsArray.push(MonetaryAccount.fromAPIObject(this, apiAccount));
accountsArray.push(BunqMonetaryAccount.fromAPIObject(this, apiAccount));
}
return accountsArray;
}

View File

@ -1,13 +1,13 @@
import * as plugins from './bunq.plugins';
import { BunqAccount } from './bunq.classes.account';
import { Transaction } from './bunq.classes.transaction';
import { BunqTransaction } from './bunq.classes.transaction';
export type TAccountType = 'joint' | 'savings' | 'bank';
/**
* a monetary account
*/
export class MonetaryAccount {
export class BunqMonetaryAccount {
public static fromAPIObject(bunqAccountRef: BunqAccount, apiObject: any) {
const newMonetaryAccount = new this(bunqAccountRef);
@ -97,7 +97,7 @@ export class MonetaryAccount {
older_id?: number | false;
} = {
count: 200,
newer_id: startingIdArg
newer_id: startingIdArg,
};
const apiTransactions = await this.bunqAccountRef.bunqJSClient.api.payment.list(
@ -105,9 +105,9 @@ export class MonetaryAccount {
this.id,
paginationOptions
);
const transactionsArray: Transaction[] = [];
const transactionsArray: BunqTransaction[] = [];
for (const apiTransaction of apiTransactions) {
transactionsArray.push(Transaction.fromApiObject(this, apiTransaction));
transactionsArray.push(BunqTransaction.fromApiObject(this, apiTransaction));
}
return transactionsArray;
}

View File

@ -1,8 +1,8 @@
import * as plugins from './bunq.plugins';
import { MonetaryAccount } from './bunq.classes.monetaryaccount';
import { BunqMonetaryAccount } from './bunq.classes.monetaryaccount';
export class Transaction {
public static fromApiObject(monetaryAccountRefArg: MonetaryAccount, apiObjectArg: any) {
export class BunqTransaction {
public static fromApiObject(monetaryAccountRefArg: BunqMonetaryAccount, apiObjectArg: any) {
const newTransaction = new this(monetaryAccountRefArg);
Object.assign(newTransaction, apiObjectArg.Payment);
return newTransaction;
@ -20,7 +20,31 @@ export class Transaction {
public type: 'MASTERCARD' | 'BUNQ';
public merchant_reference: null;
public alias: [Object];
public counterparty_alias: [Object];
public counterparty_alias: {
iban: string,
is_light: any,
display_name: string,
avatar: {
uuid: string,
image: [
{
attachment_public_uuid: string,
height: number,
width: number,
content_type: string,
},
],
anchor_uuid: null,
},
label_user: {
uuid: null,
display_name: string,
country: string,
avatar: null,
public_nick_name: string,
},
country: string,
};
public attachment: [];
public geolocation: null;
public batch_id: null;
@ -35,9 +59,9 @@ export class Transaction {
value: string;
};
public monetaryAccountRef: MonetaryAccount;
public monetaryAccountRef: BunqMonetaryAccount;
constructor(monetaryAccountRefArg: MonetaryAccount) {
constructor(monetaryAccountRefArg: BunqMonetaryAccount) {
this.monetaryAccountRef = monetaryAccountRefArg;
}
}

View File

@ -1 +1,3 @@
export * from './bunq.classes.account';
export * from './bunq.classes.monetaryaccount';
export * from './bunq.classes.transaction';