- Send purchase and sale invoices and logistic documents to go2UBL for conversion to UBL format
- Track a sent document's status during its conversion lifecycle
- Retrieve all document metadata created during the conversion lifecycle
- Add companies to your account
- Enable companies in your account
- Disable companies in your account
- Get a company's whitelist with accepted email addresses
- Add an email address to a company's whitelist
- Remove an email address from a company's whitelist
This library is not in any way associated with go2UBL. Use at your own risk. Please see the license at the bottom of this README.
npm install node-go2ubl --save
You will need to aquire your API credentials from go2UBL. You can do so by contacting them using the following URL:
After this you can initialize the library as follows:
const go2UBL = require('node-go2ubl');
go2UBL.initialize({
identifier: 'Get these from go2UBL...',
code: 'Get these from go2UBL...',
token: 'Get these from go2UBL...',
});
// ... after initializing your library (see above) ...
await go2UBL.uploadDocument({
type: 'purchase', // purchase, sale or logistic
includeLines: true, // This is only valid for purchase documents
externalId, // Your own tracking identity
filename: 'document.pdf',
chamberOfCommerceId: KVK,
document: fs.readFileSync('document.pdf').toJSON().data
});
const update = async () => {
const documentResponse = await go2UBL.getDocumentsWithChangedStatus();
if (documentResponse.Success) {
for (let document of documentResponse.Results) {
const response = await go2UBL.getDocument(document.DocumentGuid);
console.log(response.Result);
}
}
const documentsStillToBeProcessed = await go2UBL.getDocumentsStillToBeProcessed();
console.log(`${documentsStillToBeProcessed.Results.length} are waiting to be processed.`);
const documentsStillToBeDelivered = await go2UBL.getDocumentsStillToBeDelivered();
console.log(`${documentsStillToBeDelivered.Results.length} are being delivered.`);
const processedDocuments = await go2UBL.getReadyDocuments();
console.log(`${processedDocuments.Results.length} are ready.`);
const declinedDocuments = await go2UBL.getFailedDocuments();
console.log(`${declinedDocuments.Results.length} have failed.`);
setTimeout(update, 5000);
}
setTimeout(update, 5000);
const chamberOfCommerce = '12345678';
console.log(await go2UBL.addCompany(chamberOfCommerce, [], '[email protected]'));
console.log(await go2UBL.disableCompany(chamberOfCommerce));
console.log(await go2UBL.enableCompany(chamberOfCommerce));
console.log(await go2UBL.addEmailToCompanyWhitelist(chamberOfCommerce, '[email protected]'));
console.log(await go2UBL.getCompany(chamberOfCommerce));
console.log(await go2UBL.deleteEmailFromCompanyWhitelist(chamberOfCommerce, '[email protected]'));
MIT License
Copyright (c) 2023 Jaapjan Tinbergen
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.