27 Commits
push ... v0.1.6

Author SHA1 Message Date
nanov
acd5a1897c v0.1.6 2020-05-09 13:20:30 +03:00
nanov
bd11a410f1 chore: update deps 2020-05-09 13:19:56 +03:00
Dimitar Nanov
4e5d8c2ea5 Merge pull request #34 from node-ebics/dependabot/npm_and_yarn/acorn-7.1.1
chore(deps): bump acorn from 7.1.0 to 7.1.1
2020-05-09 13:12:43 +03:00
dependabot[bot]
f913f95b64 chore(deps): bump acorn from 7.1.0 to 7.1.1
Bumps [acorn](https://github.com/acornjs/acorn) from 7.1.0 to 7.1.1.
- [Release notes](https://github.com/acornjs/acorn/releases)
- [Commits](https://github.com/acornjs/acorn/compare/7.1.0...7.1.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-03-14 11:26:46 +00:00
nanov
f232b81fc3 README.md adjust build status 2020-03-06 06:57:27 +02:00
nanov
3a18b213d5 v0.1.5 2020-03-06 06:51:37 +02:00
nanov
7053a03286 chore: update deps 2020-03-06 06:47:56 +02:00
nanov
be76a52ae5 chore: adjust samples 2020-03-06 06:43:17 +02:00
Dimitar Nanov
99f0bd9622 Merge pull request #33 from chrwoizi/master
feat: Wait until the keys are generated
2020-03-06 05:44:59 +02:00
chrwoizi
e57316c6cb Wait until the keys are generated
The initialization method should wait until the key file is written because other methods could use the keys-method after initialization.
2020-02-14 11:46:15 +01:00
nanov
4b0bf0eba6 fix(examples): orders ref 2019-12-30 11:36:11 +02:00
nanov
e060863356 fix keyStoragePath 2019-12-30 11:28:33 +02:00
nanov
fb464078dc fix(examples): bankLetter setup 2019-12-30 11:10:48 +02:00
nanov
3d4c94dff8 fix(examples): serverAddress -> url 2019-12-30 11:07:24 +02:00
nanov
e98a1f8cc3 fix: loadConfig in exmaples 2019-12-30 09:37:19 +02:00
nanov
c5e59414f3 changelog 2019-12-18 16:54:58 +02:00
nanov
5e73d3ce5e bump 2019-12-18 16:53:18 +02:00
nanov
c7e739f767 lock 2019-12-18 16:49:26 +02:00
nanov
478571e447 chore: update deps 2019-12-18 16:49:20 +02:00
nanov
f6dfdf4c40 feat: generalize examples 2019-12-18 16:48:05 +02:00
Dimitar Nanov
fcbf4ca165 Merge pull request #28 from Herrie82/herrie/config
examples: Externalize configuration values and allow for multiple env…
2019-12-18 10:37:02 +02:00
nanov
6187902ae5 chore: transfer to new repository 2019-12-16 14:28:35 +02:00
Dimitar Nanov
65658ab131 Merge pull request #29 from Herrie82/herrie/send-XG1
Add XG1 order type and example
2019-12-13 10:36:30 +02:00
Herrie
d38460011c Add XG1 order type and example
XG1 order type is used for ISO XML 20022 CGI (Common Global Implementation) which should be a unified format that works within a country (irrespective of bank).

Signed-off-by: Herman van Hazendonk <github.com@herrie.org>
2019-11-29 14:38:46 +01:00
Dimitar Nanov
b9058fac93 Merge pull request #27 from Herrie82/herrie/SupportedBank
README.md: Add Bank GPB International S.A. to supported bank list
2019-11-29 14:14:10 +02:00
Herrie
c3d3decd6a examples: Externalize configuration values and allow for multiple environments
In order to more easily manage testing of various order types as well as production, development etc. environments, externalize this config values.

Signed-off-by: Herman van Hazendonk <github.com@herrie.org>
2019-11-29 13:12:15 +01:00
Herrie
a5b65f815e README.md: Add Bank GPB International S.A. to supported bank list
I was able to test DKI, INI, HAA, HAC, HEV, HVD, STA, VMK, XG1 with Bank GPB International S.A., so I think we're good to add it to the supported bank list.

Signed-off-by: Herman van Hazendonk <github.com@herrie.org>
2019-11-29 11:46:53 +01:00
23 changed files with 1703 additions and 975 deletions

View File

@@ -1,108 +1,135 @@
### Changelog ### Changelog
#### [v0.1.3](https://github.com/eCollect/node-ebics-client/compare/v0.1.2...v0.1.3) #### [v0.1.5](https://github.com/node-ebics/node-ebics-client/compare/v0.1.4...v0.1.5)
> 6 March 2020
- feat: Wait until the keys are generated [`#33`](https://github.com/node-ebics/node-ebics-client/pull/33)
- chore: update deps [`7053a03`](https://github.com/node-ebics/node-ebics-client/commit/7053a03286c700106bb1988fce72338f51ca9a96)
- changelog [`c5e5941`](https://github.com/node-ebics/node-ebics-client/commit/c5e59414f35a9634e12a6b74163f1b7fa6403de5)
- fix(examples): orders ref [`4b0bf0e`](https://github.com/node-ebics/node-ebics-client/commit/4b0bf0eba63f3eaa8986d8974ca4c0e647b9029f)
#### [v0.1.4](https://github.com/node-ebics/node-ebics-client/compare/v0.1.3...v0.1.4)
> 18 December 2019
- examples: Externalize configuration values and allow for multiple env… [`#28`](https://github.com/node-ebics/node-ebics-client/pull/28)
- Add XG1 order type and example [`#29`](https://github.com/node-ebics/node-ebics-client/pull/29)
- README.md: Add Bank GPB International S.A. to supported bank list [`#27`](https://github.com/node-ebics/node-ebics-client/pull/27)
- feat: generalize examples [`f6dfdf4`](https://github.com/node-ebics/node-ebics-client/commit/f6dfdf4c40621d9d6d9bcd64b8698d614307ea61)
- examples: Externalize configuration values and allow for multiple environments [`c3d3dec`](https://github.com/node-ebics/node-ebics-client/commit/c3d3decd6a17f733b41ea9f24ed5df8b0b7364f6)
- lock [`c7e739f`](https://github.com/node-ebics/node-ebics-client/commit/c7e739f7670856cff5af8fc93a341baf98e01546)
#### [v0.1.3](https://github.com/node-ebics/node-ebics-client/compare/v0.1.2...v0.1.3)
> 26 November 2019 > 26 November 2019
- * Add DKI, C52, C53 order types. [`#26`](https://github.com/eCollect/node-ebics-client/pull/26) - * Add DKI, C52, C53 order types. [`#26`](https://github.com/node-ebics/node-ebics-client/pull/26)
- Bank Letter: Add English template & flexible generation [`95403cb`](https://github.com/eCollect/node-ebics-client/commit/95403cbe6f90c81a696bb589533d713a4ba04873) - feat: Add English template & flexible generation [`#24`](https://github.com/node-ebics/node-ebics-client/pull/24)
- chore: Various fixes for spelling [`#23`](https://github.com/node-ebics/node-ebics-client/pull/23)
#### [v0.1.2](https://github.com/eCollect/node-ebics-client/compare/v0.1.1...v0.1.2) - test: add additional tests [`6d73ef7`](https://github.com/node-ebics/node-ebics-client/commit/6d73ef77d4454ff966b733f995b64d6dfd7c18b2)
- test: add more tests [`67d74cf`](https://github.com/node-ebics/node-ebics-client/commit/67d74cfa0060d97c948bb747885eaba26294663b)
- Bank Letter: Add English template & flexible generation [`95403cb`](https://github.com/node-ebics/node-ebics-client/commit/95403cbe6f90c81a696bb589533d713a4ba04873)
#### [v0.1.2](https://github.com/node-ebics/node-ebics-client/compare/v0.1.1...v0.1.2)
> 7 November 2019 > 7 November 2019
- chore: add changelog configoration [`#22`](https://github.com/eCollect/node-ebics-client/pull/22) - chore: add changelog configoration [`#22`](https://github.com/node-ebics/node-ebics-client/pull/22)
- Closes #17 and #13 [`#21`](https://github.com/eCollect/node-ebics-client/pull/21) - Closes #17 and #13 [`#21`](https://github.com/node-ebics/node-ebics-client/pull/21)
- Drop moment dependency [`#20`](https://github.com/eCollect/node-ebics-client/pull/20) - Drop moment dependency [`#20`](https://github.com/node-ebics/node-ebics-client/pull/20)
- feat: add nyc and cleanup .gitignore [`3e95478`](https://github.com/eCollect/node-ebics-client/commit/3e95478b3be719c86f32c7df10c42e46b7518669) - feat: add nyc and cleanup .gitignore [`3e95478`](https://github.com/node-ebics/node-ebics-client/commit/3e95478b3be719c86f32c7df10c42e46b7518669)
- feat: drop bn.js [`eea0a49`](https://github.com/eCollect/node-ebics-client/commit/eea0a49130e30c123b110120c69d7b7c19fd12ba) - feat: drop bn.js [`eea0a49`](https://github.com/node-ebics/node-ebics-client/commit/eea0a49130e30c123b110120c69d7b7c19fd12ba)
- add changelog configoration [`1f34dcb`](https://github.com/eCollect/node-ebics-client/commit/1f34dcbfb6e0febbb93d5356fa36ac57d697a990) - add changelog configoration [`1f34dcb`](https://github.com/node-ebics/node-ebics-client/commit/1f34dcbfb6e0febbb93d5356fa36ac57d697a990)
#### [v0.1.1](https://github.com/eCollect/node-ebics-client/compare/v0.1.0...v0.1.1) #### [v0.1.1](https://github.com/node-ebics/node-ebics-client/compare/v0.1.0...v0.1.1)
> 5 November 2019 > 5 November 2019
- chore: update license [`9aabe93`](https://github.com/eCollect/node-ebics-client/commit/9aabe933e91b506ea38820b952ce8e5e58b4c2ff) - chore: update license [`9aabe93`](https://github.com/node-ebics/node-ebics-client/commit/9aabe933e91b506ea38820b952ce8e5e58b4c2ff)
#### [v0.1.0](https://github.com/eCollect/node-ebics-client/compare/v0.0.8...v0.1.0) #### [v0.1.0](https://github.com/node-ebics/node-ebics-client/compare/v0.0.8...v0.1.0)
> 5 November 2019 > 5 November 2019
- Feat: handle unsual exponent migrate to node-forge [`#16`](https://github.com/eCollect/node-ebics-client/pull/16) - Feat: handle unsual exponent migrate to node-forge [`#16`](https://github.com/node-ebics/node-ebics-client/pull/16)
- Add order generation tests and fix linting [`#15`](https://github.com/eCollect/node-ebics-client/pull/15) - Add order generation tests and fix linting [`#15`](https://github.com/node-ebics/node-ebics-client/pull/15)
- test script run mocha [`#14`](https://github.com/eCollect/node-ebics-client/pull/14) - test script run mocha [`#14`](https://github.com/node-ebics/node-ebics-client/pull/14)
- feat: prepare order generation tests [`e40f79c`](https://github.com/eCollect/node-ebics-client/commit/e40f79cee68a194272c93f07e763175b213a77a1) - feat: prepare order generation tests [`e40f79c`](https://github.com/node-ebics/node-ebics-client/commit/e40f79cee68a194272c93f07e763175b213a77a1)
- chore: cleanup [`0c01420`](https://github.com/eCollect/node-ebics-client/commit/0c01420c1e14992a4169098ccd47cd196b899f06) - chore: cleanup [`0c01420`](https://github.com/node-ebics/node-ebics-client/commit/0c01420c1e14992a4169098ccd47cd196b899f06)
#### [v0.0.36](https://github.com/eCollect/node-ebics-client/compare/v0.0.35...v0.0.36) #### [v0.0.36](https://github.com/node-ebics/node-ebics-client/compare/v0.0.35...v0.0.36)
> 1 June 2018 > 1 June 2018
- various modular fixes [`8492d94`](https://github.com/eCollect/node-ebics-client/commit/8492d940542f61b17aa3a2da7de23f6539ffaad5) - various modular fixes [`8492d94`](https://github.com/node-ebics/node-ebics-client/commit/8492d940542f61b17aa3a2da7de23f6539ffaad5)
#### [v0.0.35](https://github.com/eCollect/node-ebics-client/compare/v0.0.3...v0.0.35) #### [v0.0.35](https://github.com/node-ebics/node-ebics-client/compare/v0.0.3...v0.0.35)
> 31 May 2018 > 31 May 2018
- update License to GPL v3 [`babcf76`](https://github.com/eCollect/node-ebics-client/commit/babcf76b61af6eb737ab291a301e71bb84621820) - update License to GPL v3 [`babcf76`](https://github.com/node-ebics/node-ebics-client/commit/babcf76b61af6eb737ab291a301e71bb84621820)
- Add MGF1.js file - mask generation utility class [`7e6e2ff`](https://github.com/eCollect/node-ebics-client/commit/7e6e2ff142688b0c453369fa7137b49e8b89cd81) - Add MGF1.js file - mask generation utility class [`7e6e2ff`](https://github.com/node-ebics/node-ebics-client/commit/7e6e2ff142688b0c453369fa7137b49e8b89cd81)
- Add sign, _emsaPSS and _modPowe methods in Key.js file [`5ace213`](https://github.com/eCollect/node-ebics-client/commit/5ace2137231af9a3563ab31fa0f70fbdf4b148cb) - Add sign, _emsaPSS and _modPowe methods in Key.js file [`5ace213`](https://github.com/node-ebics/node-ebics-client/commit/5ace2137231af9a3563ab31fa0f70fbdf4b148cb)
#### [v0.0.8](https://github.com/eCollect/node-ebics-client/compare/v0.0.7...v0.0.8) #### [v0.0.8](https://github.com/node-ebics/node-ebics-client/compare/v0.0.7...v0.0.8)
> 8 October 2019 > 8 October 2019
- chore: readme maintenance [`#11`](https://github.com/eCollect/node-ebics-client/pull/11) - chore: readme maintenance [`#11`](https://github.com/node-ebics/node-ebics-client/pull/11)
- Provide examples [`#10`](https://github.com/eCollect/node-ebics-client/pull/10) - Provide examples [`#10`](https://github.com/node-ebics/node-ebics-client/pull/10)
- initialize.js [`7dad7c8`](https://github.com/eCollect/node-ebics-client/commit/7dad7c878722be94e03808cef3af38d34019c623) - initialize.js [`7dad7c8`](https://github.com/node-ebics/node-ebics-client/commit/7dad7c878722be94e03808cef3af38d34019c623)
- examples/bankLetter.js [`ce6e58b`](https://github.com/eCollect/node-ebics-client/commit/ce6e58b3f33017967e5b26fe15a2c435012b8af6) - examples/bankLetter.js [`ce6e58b`](https://github.com/node-ebics/node-ebics-client/commit/ce6e58b3f33017967e5b26fe15a2c435012b8af6)
- examples/send-hbt-order.js [`166c61a`](https://github.com/eCollect/node-ebics-client/commit/166c61aec4a247d923de82278271ec02cbef815f) - examples/send-hbt-order.js [`166c61a`](https://github.com/node-ebics/node-ebics-client/commit/166c61aec4a247d923de82278271ec02cbef815f)
#### [v0.0.7](https://github.com/eCollect/node-ebics-client/compare/v0.0.6...v0.0.7) #### [v0.0.7](https://github.com/node-ebics/node-ebics-client/compare/v0.0.6...v0.0.7)
> 2 August 2019 > 2 August 2019
- * Add Z53 order type [`#7`](https://github.com/eCollect/node-ebics-client/pull/7) - * Add Z53 order type [`#7`](https://github.com/node-ebics/node-ebics-client/pull/7)
- remove eCollect from constant and minor verbose error handeling [`#2`](https://github.com/eCollect/node-ebics-client/pull/2) - remove eCollect from constant and minor verbose error handeling [`#2`](https://github.com/node-ebics/node-ebics-client/pull/2)
- add iso pain format XCT order type [`#1`](https://github.com/eCollect/node-ebics-client/pull/1) - add iso pain format XCT order type [`#1`](https://github.com/node-ebics/node-ebics-client/pull/1)
- add new order type XZ53 and removed repeated dateRange to consts [`5ff3147`](https://github.com/eCollect/node-ebics-client/commit/5ff314712443c4c8465f46292b010cfedfed8c2e) - add new order type XZ53 and removed repeated dateRange to consts [`5ff3147`](https://github.com/node-ebics/node-ebics-client/commit/5ff314712443c4c8465f46292b010cfedfed8c2e)
- move dateRange from constants to utils [`aa761cf`](https://github.com/eCollect/node-ebics-client/commit/aa761cf7ad87a271d6e6d9eed40e04eb4376f6c5) - move dateRange from constants to utils [`aa761cf`](https://github.com/node-ebics/node-ebics-client/commit/aa761cf7ad87a271d6e6d9eed40e04eb4376f6c5)
- bump version [`79f17e1`](https://github.com/eCollect/node-ebics-client/commit/79f17e14045d121c9505eb3118967f5f88ae79e2) - bump version [`79f17e1`](https://github.com/node-ebics/node-ebics-client/commit/79f17e14045d121c9505eb3118967f5f88ae79e2)
#### [v0.0.6](https://github.com/eCollect/node-ebics-client/compare/v0.0.5...v0.0.6) #### [v0.0.6](https://github.com/node-ebics/node-ebics-client/compare/v0.0.5...v0.0.6)
> 24 July 2019 > 24 July 2019
- remove eCollect from constant and minor verbose error handaling [`#4`](https://github.com/eCollect/node-ebics-client/pull/4) - remove eCollect from constant and minor verbose error handaling [`#4`](https://github.com/node-ebics/node-ebics-client/pull/4)
- add iso pain format XCT order type [`#5`](https://github.com/eCollect/node-ebics-client/pull/5) - add iso pain format XCT order type [`#5`](https://github.com/node-ebics/node-ebics-client/pull/5)
- remove eCollect from constant and minor verbose error handeling [`cb2062a`](https://github.com/eCollect/node-ebics-client/commit/cb2062ae2fbd8e8881de26561efddad1f272e065) - remove eCollect from constant and minor verbose error handeling [`cb2062a`](https://github.com/node-ebics/node-ebics-client/commit/cb2062ae2fbd8e8881de26561efddad1f272e065)
- bump [`c9f52d3`](https://github.com/eCollect/node-ebics-client/commit/c9f52d3bd99b9f8761652365b217d9580fa34632) - bump [`c9f52d3`](https://github.com/node-ebics/node-ebics-client/commit/c9f52d3bd99b9f8761652365b217d9580fa34632)
#### [v0.0.5](https://github.com/eCollect/node-ebics-client/compare/v0.0.4...v0.0.5) #### [v0.0.5](https://github.com/node-ebics/node-ebics-client/compare/v0.0.4...v0.0.5)
> 28 June 2019 > 28 June 2019
- Fix parsing of the bank keys in the HPB response [`#3`](https://github.com/eCollect/node-ebics-client/pull/3) - Fix parsing of the bank keys in the HPB response [`#3`](https://github.com/node-ebics/node-ebics-client/pull/3)
- tc for bank keys parsing error [`c571ef1`](https://github.com/eCollect/node-ebics-client/commit/c571ef181bca2e0cbec70bc6df53c706acd6c829) - tc for bank keys parsing error [`c571ef1`](https://github.com/node-ebics/node-ebics-client/commit/c571ef181bca2e0cbec70bc6df53c706acd6c829)
- #2 corrected bank keys parsing [`5f0b6cd`](https://github.com/eCollect/node-ebics-client/commit/5f0b6cd3747c4613920d2f71f3c04ce13225d397) - #2 corrected bank keys parsing [`5f0b6cd`](https://github.com/node-ebics/node-ebics-client/commit/5f0b6cd3747c4613920d2f71f3c04ce13225d397)
#### [v0.0.4](https://github.com/eCollect/node-ebics-client/compare/v0.0.36...v0.0.4) #### [v0.0.4](https://github.com/node-ebics/node-ebics-client/compare/v0.0.36...v0.0.4)
> 3 September 2018 > 3 September 2018
- Major changes. Separating responsibilities. Orders builder, serializer. [`ff9a3a1`](https://github.com/eCollect/node-ebics-client/commit/ff9a3a16b47d0a25674134c875bfd651995837e4) - Major changes. Separating responsibilities. Orders builder, serializer. [`ff9a3a1`](https://github.com/node-ebics/node-ebics-client/commit/ff9a3a16b47d0a25674134c875bfd651995837e4)
- code optimization [`1876360`](https://github.com/eCollect/node-ebics-client/commit/187636019c290d757aca77d4c14fb4f2519acd38) - code optimization [`1876360`](https://github.com/node-ebics/node-ebics-client/commit/187636019c290d757aca77d4c14fb4f2519acd38)
- client and order optimization [`9454992`](https://github.com/eCollect/node-ebics-client/commit/945499290a8698aed504b573019de2c23148006a) - client and order optimization [`9454992`](https://github.com/node-ebics/node-ebics-client/commit/945499290a8698aed504b573019de2c23148006a)
#### v0.0.3 #### v0.0.3
> 17 May 2018 > 17 May 2018
- initial commit [`1f947ff`](https://github.com/eCollect/node-ebics-client/commit/1f947ff1480c522f89fa1f547581b55e2378d920) - initial commit [`1f947ff`](https://github.com/node-ebics/node-ebics-client/commit/1f947ff1480c522f89fa1f547581b55e2378d920)
- Initial commit [`cd37de3`](https://github.com/eCollect/node-ebics-client/commit/cd37de3895e32a61798c79ce3a6447e2f269019d) - Initial commit [`cd37de3`](https://github.com/node-ebics/node-ebics-client/commit/cd37de3895e32a61798c79ce3a6447e2f269019d)

View File

@@ -4,7 +4,7 @@
<h1 align="center">node-ebics-client</h1> <h1 align="center">node-ebics-client</h1>
<p align="center"> <p align="center">
<a href="https://travis-ci.org/eCollect/node-ebics-client" title="Build Status"><img src="https://travis-ci.org/eCollect/node-ebics-client.svg?branch=master" alt="Build Status" /></a> <a href="https://travis-ci.org/node-ebics/node-ebics-client" title="Build Status"><img src="https://travis-ci.org/node-ebics/node-ebics-client.svg?branch=master" alt="Build Status" /></a>
<a href="https://www.npmjs.com/package/ebics-client" title="Build Status"> <a href="https://www.npmjs.com/package/ebics-client" title="Build Status">
<img alt="ebics-client" src="https://img.shields.io/npm/v/ebics-client"> <img alt="ebics-client" src="https://img.shields.io/npm/v/ebics-client">
</a> </a>
@@ -27,6 +27,7 @@ The client is currently tested and verified to work with the following banks:
* [Zürcher Kantonalbank](https://www.zkb.ch/en/lg/ew.html) * [Zürcher Kantonalbank](https://www.zkb.ch/en/lg/ew.html)
* [Raiffeisen Schweiz](https://www.raiffeisen.ch/rch/de.html) * [Raiffeisen Schweiz](https://www.raiffeisen.ch/rch/de.html)
* [BW Bank](https://www.bw-bank.de/de/home.html) * [BW Bank](https://www.bw-bank.de/de/home.html)
* [Bank GPB International S.A.](https://gazprombank.lu/e-banking)
## Inspiration ## Inspiration

View File

@@ -7,21 +7,15 @@ const path = require('path');
const fs = require('fs'); const fs = require('fs');
const os = require('os'); const os = require('os');
const client = new ebics.Client({ const config = require('./loadConfig')();
url: 'https://ebics.server', const client = require('./getClient')(config);
partnerId: '', const bankName = config.bankName;
userId: '', const languageCode = config.languageCode;
hostId: '', const template = fs.readFileSync('../templates/ini_'+config.languageCode+'.hbs', { encoding: 'utf8 '});
passphrase: 'test', // keys-test will be decrypted with this passphrase
keyStorage: ebics.fsKeysStorage('./keys-test'),
});
const bankName = 'Bank name'; // Change this to the bank name you're going to send the letter to.
const languageCode = 'en'; // Currently 'de' and 'en' are valid values.
const template = fs.readFileSync('../templates/ini_'+languageCode+'.hbs').toString();
const letter = new ebics.BankLetter({ client, bankName, template });
const bankLetterFile = path.join(os.homedir(), 'bankLetter_'+languageCode+'.html'); const bankLetterFile = path.join(os.homedir(), 'bankLetter_'+languageCode+'.html');
const letter = new ebics.BankLetter({ client, bankName, template });
letter.serialize(bankLetterFile) letter.serialize(bankLetterFile)
.then(() => { .then(() => {
console.log('Send your bank the letter (%s)', bankLetterFile); console.log('Send your bank the letter (%s)', bankLetterFile);

View File

@@ -0,0 +1,10 @@
{
"url": "https://ebics-test.server",
"partnerId": "EBICS ParnerID Test",
"userId": "MyUserIdTest",
"hostId": "MyHostIdTest",
"passphrase": "MyPasswordTest",
"keyStoragePath": "./keys-test",
"bankName":"Test Bank",
"languageCode":"en"
}

View File

@@ -0,0 +1,10 @@
{
"url": "https://ebics.server",
"partnerId": "EBICS ParnerID Production",
"userId": "MyUserIdProduction",
"hostId": "MyHostIdProduction",
"passphrase": "MyPasswordProduction",
"keyStoragePath": "./keys-prod",
"bankName":"Production Bank",
"languageCode":"en"
}

21
examples/getClient.js Normal file
View File

@@ -0,0 +1,21 @@
'use strict';
const { Client, fsKeysStorage } = require('../index');
const loadConfig = require('./loadConfig');
module.exports = ({
url,
partnerId,
userId,
hostId,
passphrase,
keyStoragePath,
} = loadConfig()) => new Client({
url,
partnerId,
userId,
hostId,
passphrase,
keyStorage: fsKeysStorage(keyStoragePath),
});

View File

@@ -2,19 +2,14 @@
'use strict'; 'use strict';
const ebics = require('../index'); const ebics = require('../index');
const client = new ebics.Client({ const client = require('./getClient')();
url: 'https://ebics.server', const { Orders } = require('../index');
partnerId: 'PARTNER',
userId: 'USER',
hostId: 'HOST',
passphrase: 'test', // keys-test will be encrypted with this passphrase
keyStorage: ebics.fsKeysStorage('./keys-test'),
});
// New keys will be generated and saved in ./keys-test // New keys will be generated and saved in ./keys-test
client.send(ebics.Orders.INI) client.send(Orders.INI)
.then((resp) => { .then((resp) => {
console.log('Response for INI order %j', resp); console.log('Response for INI order %j', resp);
return client.send(ebics.Orders.HIA); return client.send(ebics.Orders.HIA);

35
examples/loadConfig.js Normal file
View File

@@ -0,0 +1,35 @@
'use strict';
const fs = require('fs');
const path = require('path');
const safeLoadJson = (file) => {
if (!file)
return {};
try {
return JSON.parse(fs.readFileSync(file));
} catch (e) {
console.warn(`Couldn't load ${file} config file.`);
return {};
}
}
const getDefaultEnv = () => {
const [,,parArg] = process.argv;
return parArg || process.env.NODE_ENV;
}
const loadConfig = (configDirectory = path.join(__dirname, './config'), env = getDefaultEnv()) => {
console.log(`Loading config form ${configDirectory} with env set to ${env}.`);
const baseConfigFile = path.join(configDirectory, 'config.json');
const envConfigFile = env ? path.join(configDirectory, `config.${env}.json`) : null;
return {
...safeLoadJson(baseConfigFile),
...safeLoadJson(envConfigFile),
}
}
module.exports = loadConfig;

View File

@@ -2,20 +2,12 @@
'use strict'; 'use strict';
const ebics = require('../index'); const client = require('./getClient')();
const { Orders } = require('../index');
const client = new ebics.Client({
url: 'https://ebics.server',
partnerId: '',
userId: '',
hostId: '',
passphrase: 'test', // keys-test will be decrypted with this passphrase
keyStorage: ebics.fsKeysStorage('./keys-test'),
});
// Client keys must be already generated and send by letter. // Client keys must be already generated and send by letter.
// The bank should have enabled the user // The bank should have enabled the user
client.send(ebics.Orders.HPB) client.send(Orders.HPB)
.then((resp) => { .then((resp) => {
console.log('Response for HPB order %j', resp); console.log('Response for HPB order %j', resp);
if (resp.technicalCode !== '000000') if (resp.technicalCode !== '000000')

View File

@@ -2,19 +2,11 @@
'use strict'; 'use strict';
const ebics = require('../index'); const client = require('./getClient')();
const { Orders } = require('../index');
const client = new ebics.Client({
url: 'https://ebics.server',
partnerId: '',
userId: '',
hostId: '',
passphrase: 'test', // keys-test will be decrypted with this passphrase
keyStorage: ebics.fsKeysStorage('./keys-test'),
});
// The bank keys must have been already saved // The bank keys must have been already saved
client.send(ebics.Orders.C52(null, null)) // startDate 'YYYY-MM-DD', endDate 'YYYY-MM-DD' client.send(Orders.C52(null, null)) // startDate 'YYYY-MM-DD', endDate 'YYYY-MM-DD'
.then((resp) => { .then((resp) => {
console.log('Response for C52 order %j', resp); console.log('Response for C52 order %j', resp);
if (resp.technicalCode !== '000000') if (resp.technicalCode !== '000000')

View File

@@ -2,19 +2,11 @@
'use strict'; 'use strict';
const ebics = require('../index'); const client = require('./getClient')();
const { Orders } = require('../index');
const client = new ebics.Client({
url: 'https://ebics.server',
partnerId: '',
userId: '',
hostId: '',
passphrase: 'test', // keys-test will be decrypted with this passphrase
keyStorage: ebics.fsKeysStorage('./keys-test'),
});
// The bank keys must have been already saved // The bank keys must have been already saved
client.send(ebics.Orders.C53(null, null)) // startDate 'YYYY-MM-DD', endDate 'YYYY-MM-DD' client.send(Orders.C53(null, null)) // startDate 'YYYY-MM-DD', endDate 'YYYY-MM-DD'
.then((resp) => { .then((resp) => {
console.log('Response for C53 order %j', resp); console.log('Response for C53 order %j', resp);
if (resp.technicalCode !== '000000') if (resp.technicalCode !== '000000')

View File

@@ -2,19 +2,11 @@
'use strict'; 'use strict';
const ebics = require('../index'); const client = require('./getClient')();
const { Orders } = require('../index');
const client = new ebics.Client({
url: 'https://ebics.server',
partnerId: '',
userId: '',
hostId: '',
passphrase: 'test', // keys-test will be decrypted with this passphrase
keyStorage: ebics.fsKeysStorage('./keys-test'),
});
// The bank keys must have been already saved // The bank keys must have been already saved
client.send(ebics.Orders.DKI(null, null)) // startDate 'YYYY-MM-DD', endDate 'YYYY-MM-DD' client.send(Orders.DKI(null, null)) // startDate 'YYYY-MM-DD', endDate 'YYYY-MM-DD'
.then((resp) => { .then((resp) => {
console.log('Response for DKI order %j', resp); console.log('Response for DKI order %j', resp);
if (resp.technicalCode !== '000000') if (resp.technicalCode !== '000000')

View File

@@ -2,19 +2,11 @@
'use strict'; 'use strict';
const ebics = require('../index'); const client = require('./getClient')();
const { Orders } = require('../index');
const client = new ebics.Client({
url: 'https://ebics.server',
partnerId: '',
userId: '',
hostId: '',
passphrase: 'test', // keys-test will be decrypted with this passphrase
keyStorage: ebics.fsKeysStorage('./keys-test'),
});
// The bank keys must have been already saved // The bank keys must have been already saved
client.send(ebics.Orders.HKD) client.send(Orders.HKD)
.then((resp) => { .then((resp) => {
console.log('Response for HKD order %j', resp); console.log('Response for HKD order %j', resp);
if (resp.technicalCode !== '000000') if (resp.technicalCode !== '000000')

View File

@@ -2,19 +2,11 @@
'use strict'; 'use strict';
const ebics = require('../index'); const client = require('./getClient')();
const { Orders } = require('../index');
const client = new ebics.Client({
url: 'https://ebics.server',
partnerId: '',
userId: '',
hostId: '',
passphrase: 'test', // keys-test will be decrypted with this passphrase
keyStorage: ebics.fsKeysStorage('./keys-test'),
});
// The bank keys must have been already saved // The bank keys must have been already saved
client.send(ebics.Orders.HTD) client.send(Orders.HTD)
.then((resp) => { .then((resp) => {
console.log('Response for HTD order %j', resp); console.log('Response for HTD order %j', resp);
if (resp.technicalCode !== '000000') if (resp.technicalCode !== '000000')

View File

@@ -2,19 +2,11 @@
'use strict'; 'use strict';
const ebics = require('../index'); const client = require('./getClient')();
const { Orders } = require('../index');
const client = new ebics.Client({
url: 'https://ebics.server',
partnerId: '',
userId: '',
hostId: '',
passphrase: 'test', // keys-test will be decrypted with this passphrase
keyStorage: ebics.fsKeysStorage('./keys-test'),
});
// The bank keys must have been already saved // The bank keys must have been already saved
client.send(ebics.Orders.STA(null, null)) // startDate 'YYYY-MM-DD', endDate 'YYYY-MM-DD' client.send(Orders.STA(null, null)) // startDate 'YYYY-MM-DD', endDate 'YYYY-MM-DD'
.then((resp) => { .then((resp) => {
console.log('Response for STA order %j', resp); console.log('Response for STA order %j', resp);
if (resp.technicalCode !== '000000') if (resp.technicalCode !== '000000')

View File

@@ -2,19 +2,12 @@
'use strict'; 'use strict';
const ebics = require('../index'); const client = require('./getClient')();
const { Orders } = require('../index');
const client = new ebics.Client({
url: 'https://ebics.server',
partnerId: '',
userId: '',
hostId: '',
passphrase: 'test', // keys-test will be decrypted with this passphrase
keyStorage: ebics.fsKeysStorage('./keys-test'),
});
// The bank keys must have been already saved // The bank keys must have been already saved
client.send(ebics.Orders.VMK(null, null)) // startDate 'YYYY-MM-DD', endDate 'YYYY-MM-DD' client.send(Orders.VMK(null, null)) // startDate 'YYYY-MM-DD', endDate 'YYYY-MM-DD'
.then((resp) => { .then((resp) => {
console.log('Response for VMK order %j', resp); console.log('Response for VMK order %j', resp);
if (resp.technicalCode !== '000000') if (resp.technicalCode !== '000000')

View File

@@ -0,0 +1,21 @@
#! /usr/bin/env node
'use strict';
const ebics = require('../index');
const fs = require('fs');
const client = require('./getClient')();
const { Orders } = require('../index');
// The bank keys must have been already saved
const paymentFile = fs.readFileSync('mytestfile.xml').toString();
client.send(Orders.XG1(paymentFile))
.then((resp) => {
console.log('Response for XG1 order %j', resp);
})
.catch((err) => {
console.error(err);
process.exit(1);
});

View File

@@ -104,7 +104,7 @@ module.exports = class Client {
async initialization(order) { async initialization(order) {
const keys = await this.keys(); const keys = await this.keys();
if (keys === null) this._generateKeys(); if (keys === null) await this._generateKeys();
if (this.tracesStorage) if (this.tracesStorage)
this.tracesStorage.new().ofType('ORDER.INI'); this.tracesStorage.new().ofType('ORDER.INI');
@@ -223,10 +223,10 @@ module.exports = class Client {
} }
} }
_generateKeys() { async _generateKeys() {
const keysObject = Keys.generate(); const keysObject = Keys.generate();
this._writeKeys(keysObject); await this._writeKeys(keysObject);
} }
async setBankKeys(bankKeys) { async setBankKeys(bankKeys) {

View File

@@ -0,0 +1,8 @@
'use strict';
module.exports = document => ({
version: 'h004',
orderDetails: { OrderType: 'XG1', OrderAttribute: 'OZHNN', StandardOrderParams: {} },
operation: 'upload',
document,
});

View File

@@ -13,6 +13,7 @@ const CCT = require('./CCT');
const CCS = require('./CCS'); const CCS = require('./CCS');
const XE3 = require('./XE3'); const XE3 = require('./XE3');
const XCT = require('./XCT'); const XCT = require('./XCT');
const XG1 = require('./XG1');
const STA = require('./STA'); const STA = require('./STA');
const VMK = require('./VMK'); const VMK = require('./VMK');
@@ -42,6 +43,7 @@ module.exports = {
CCS, CCS,
XE3, XE3,
XCT, XCT,
XG1,
STA, STA,
VMK, VMK,

View File

@@ -2,7 +2,7 @@
const fs = require('fs'); const fs = require('fs');
const uuidv1 = require('uuid/v1'); const { v1: uuidv1 } = require('uuid');
const traceName = (uuid, label, type, ext = 'xml') => `${uuid}_${label}_${type}.${ext}`; const traceName = (uuid, label, type, ext = 'xml') => `${uuid}_${label}_${type}.${ext}`;

2255
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{ {
"name": "ebics-client", "name": "ebics-client",
"version": "0.1.3", "version": "0.1.6",
"description": "Node.js ISO 20022 Compliant EBICS Client", "description": "Node.js ISO 20022 Compliant EBICS Client",
"main": "index.js", "main": "index.js",
"files": [ "files": [
@@ -15,7 +15,7 @@
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/eCollect/node-ebics-client" "url": "https://github.com/node-ebics/node-ebics-client"
}, },
"keywords": [ "keywords": [
"EBICS", "EBICS",
@@ -47,28 +47,32 @@
{ {
"name": "Herman van Hazendonk", "name": "Herman van Hazendonk",
"email": "github.com@herrie.org" "email": "github.com@herrie.org"
},
{
"name": "chrwoizi",
"url": "https://github.com/chrwoizi"
} }
], ],
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
"dependencies": { "dependencies": {
"auto-changelog": "^1.16.2", "handlebars": "^4.7.6",
"handlebars": "^4.5.3", "js2xmlparser": "^4.0.1",
"js2xmlparser": "^4.0.0",
"node-forge": "^0.9.1", "node-forge": "^0.9.1",
"request": "^2.88.0", "request": "^2.88.2",
"uuid": "^3.3.3", "uuid": "^8.0.0",
"xml-crypto": "^1.4.0", "xml-crypto": "^1.5.3",
"xmldom": "^0.1.27", "xmldom": "^0.3.0",
"xpath": "0.0.27" "xpath": "0.0.27"
}, },
"devDependencies": { "devDependencies": {
"auto-changelog": "^1.16.2",
"chai": "^4.2.0", "chai": "^4.2.0",
"coveralls": "^3.0.7", "coveralls": "^3.1.0",
"eslint": "^6.6.0", "eslint": "^6.7.2",
"eslint-config-ecollect-base": "^0.1.2", "eslint-config-ecollect-base": "^0.1.2",
"eslint-plugin-import": "^2.18.2", "eslint-plugin-import": "^2.18.2",
"libxmljs": "^0.19.7", "libxmljs": "^0.19.7",
"mocha": "^6.2.2", "mocha": "^7.1.2",
"nyc": "^14.1.1" "nyc": "^15.0.1"
} }
} }