mirror of
				https://github.com/node-ebics/node-ebics-client.git
				synced 2025-10-28 10:07:06 +00:00 
			
		
		
		
	initialize.js
This commit is contained in:
		
							
								
								
									
										32
									
								
								examples/initialize.js
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										32
									
								
								examples/initialize.js
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,32 @@ | |||||||
|  | #! /usr/bin/env node | ||||||
|  |  | ||||||
|  | 'use strict'; | ||||||
|  |  | ||||||
|  | const ebics = require('../index'); | ||||||
|  |  | ||||||
|  | const client = new ebics.Client({ | ||||||
|  | 	url: 'https://ebics.server', | ||||||
|  | 	partnerId: 'PARTNER', | ||||||
|  | 	userId: 'USER', | ||||||
|  | 	hostId: 'HOST', | ||||||
|  | 	passphrase: 'test', // keys-test will be encrypted with this keys | ||||||
|  | 	keyStorage: ebics.fsKeysStorage('./keys-test'), | ||||||
|  | }); | ||||||
|  |  | ||||||
|  | // New keys will be generated and saved in ./keys-test | ||||||
|  | client.send(ebics.Orders.INI) | ||||||
|  | 	.then((resp) => { | ||||||
|  | 		console.log('Respose for INI order %j', resp); | ||||||
|  | 		return client.send(ebics.Orders.HIA); | ||||||
|  | 	}) | ||||||
|  | 	.then((resp) => { | ||||||
|  | 		console.log('Reponse for HIA order %j', resp); | ||||||
|  | 		if (resp.technicalCode !== '000000') | ||||||
|  | 			throw new Error('Something might went wrong'); | ||||||
|  |  | ||||||
|  | 		console.log('Public keys should be sent to bank now. See examples/bankLetter.js'); | ||||||
|  | 	}) | ||||||
|  | 	.catch((err) => { | ||||||
|  | 		console.error(err); | ||||||
|  | 		process.exit(1); | ||||||
|  | 	}); | ||||||
		Reference in New Issue
	
	Block a user