@pinelab/vendure-plugin-e-boekhouden 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +50 -0
- package/dist/api/e-boekhouden-config.entity.d.ts +11 -0
- package/dist/api/e-boekhouden-config.entity.js +52 -0
- package/dist/api/e-boekhouden.adapter.d.ts +25 -0
- package/dist/api/e-boekhouden.adapter.js +76 -0
- package/dist/api/e-boekhouden.resolver.d.ts +11 -0
- package/dist/api/e-boekhouden.resolver.js +56 -0
- package/dist/api/e-boekhouden.service.d.ts +29 -0
- package/dist/api/e-boekhouden.service.js +147 -0
- package/dist/api/schema.graphql.d.ts +1 -0
- package/dist/api/schema.graphql.js +34 -0
- package/dist/client/eboekhoudenwsdl/client.d.ts +287 -0
- package/dist/client/eboekhoudenwsdl/client.js +9 -0
- package/dist/client/eboekhoudenwsdl/definitions/AddFactuur.d.ts +10 -0
- package/dist/client/eboekhoudenwsdl/definitions/AddFactuur.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/AddFactuurResponse.d.ts +6 -0
- package/dist/client/eboekhoudenwsdl/definitions/AddFactuurResponse.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/AddFactuurResult.d.ts +12 -0
- package/dist/client/eboekhoudenwsdl/definitions/AddFactuurResult.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/AddGrootboekrekening.d.ts +10 -0
- package/dist/client/eboekhoudenwsdl/definitions/AddGrootboekrekening.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/AddGrootboekrekeningResponse.d.ts +6 -0
- package/dist/client/eboekhoudenwsdl/definitions/AddGrootboekrekeningResponse.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/AddGrootboekrekeningResult.d.ts +12 -0
- package/dist/client/eboekhoudenwsdl/definitions/AddGrootboekrekeningResult.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/AddMutatie.d.ts +10 -0
- package/dist/client/eboekhoudenwsdl/definitions/AddMutatie.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/AddMutatieResponse.d.ts +6 -0
- package/dist/client/eboekhoudenwsdl/definitions/AddMutatieResponse.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/AddMutatieResult.d.ts +12 -0
- package/dist/client/eboekhoudenwsdl/definitions/AddMutatieResult.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/AddRelatie.d.ts +10 -0
- package/dist/client/eboekhoudenwsdl/definitions/AddRelatie.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/AddRelatieResponse.d.ts +6 -0
- package/dist/client/eboekhoudenwsdl/definitions/AddRelatieResponse.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/AddRelatieResult.d.ts +12 -0
- package/dist/client/eboekhoudenwsdl/definitions/AddRelatieResult.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/Administraties.d.ts +10 -0
- package/dist/client/eboekhoudenwsdl/definitions/Administraties.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/Artikelen.d.ts +10 -0
- package/dist/client/eboekhoudenwsdl/definitions/Artikelen.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/AutoLogin.d.ts +9 -0
- package/dist/client/eboekhoudenwsdl/definitions/AutoLogin.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/AutoLoginResponse.d.ts +6 -0
- package/dist/client/eboekhoudenwsdl/definitions/AutoLoginResponse.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/AutoLoginResult.d.ts +12 -0
- package/dist/client/eboekhoudenwsdl/definitions/AutoLoginResult.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/CAdministratie.d.ts +15 -0
- package/dist/client/eboekhoudenwsdl/definitions/CAdministratie.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/CArtikel.d.ts +35 -0
- package/dist/client/eboekhoudenwsdl/definitions/CArtikel.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/CFactuurList.d.ts +29 -0
- package/dist/client/eboekhoudenwsdl/definitions/CFactuurList.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/CFactuurRegel.d.ts +23 -0
- package/dist/client/eboekhoudenwsdl/definitions/CFactuurRegel.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/CFilter.d.ts +15 -0
- package/dist/client/eboekhoudenwsdl/definitions/CFilter.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/CFilter1.d.ts +15 -0
- package/dist/client/eboekhoudenwsdl/definitions/CFilter1.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/CFilter2.d.ts +15 -0
- package/dist/client/eboekhoudenwsdl/definitions/CFilter2.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/CFilter3.d.ts +19 -0
- package/dist/client/eboekhoudenwsdl/definitions/CFilter3.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/CFilter4.d.ts +13 -0
- package/dist/client/eboekhoudenwsdl/definitions/CFilter4.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/CFilter5.d.ts +13 -0
- package/dist/client/eboekhoudenwsdl/definitions/CFilter5.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/CFilter6.d.ts +13 -0
- package/dist/client/eboekhoudenwsdl/definitions/CFilter6.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/CFilter7.d.ts +17 -0
- package/dist/client/eboekhoudenwsdl/definitions/CFilter7.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/CKostenplaats.d.ts +13 -0
- package/dist/client/eboekhoudenwsdl/definitions/CKostenplaats.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/CMutatieList.d.ts +30 -0
- package/dist/client/eboekhoudenwsdl/definitions/CMutatieList.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/CMutatieListRegel.d.ts +25 -0
- package/dist/client/eboekhoudenwsdl/definitions/CMutatieListRegel.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/CMutatieRegel.d.ts +23 -0
- package/dist/client/eboekhoudenwsdl/definitions/CMutatieRegel.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/COpenPost.d.ts +21 -0
- package/dist/client/eboekhoudenwsdl/definitions/COpenPost.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/CSaldo.d.ts +15 -0
- package/dist/client/eboekhoudenwsdl/definitions/CSaldo.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/CloseSession.d.ts +5 -0
- package/dist/client/eboekhoudenwsdl/definitions/CloseSession.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/CloseSessionResponse.d.ts +3 -0
- package/dist/client/eboekhoudenwsdl/definitions/CloseSessionResponse.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/ErrorMsg.d.ts +11 -0
- package/dist/client/eboekhoudenwsdl/definitions/ErrorMsg.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/Facturen.d.ts +10 -0
- package/dist/client/eboekhoudenwsdl/definitions/Facturen.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetAdministraties.d.ts +7 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetAdministraties.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetAdministratiesResponse.d.ts +6 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetAdministratiesResponse.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetAdministratiesResult.d.ts +13 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetAdministratiesResult.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetArtikelen.d.ts +10 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetArtikelen.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetArtikelenResponse.d.ts +6 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetArtikelenResponse.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetArtikelenResult.d.ts +13 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetArtikelenResult.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetFacturen.d.ts +10 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetFacturen.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetFacturenResponse.d.ts +6 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetFacturenResponse.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetFacturenResult.d.ts +13 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetFacturenResult.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetGrootboekrekeningen.d.ts +10 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetGrootboekrekeningen.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetGrootboekrekeningenResponse.d.ts +6 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetGrootboekrekeningenResponse.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetGrootboekrekeningenResult.d.ts +13 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetGrootboekrekeningenResult.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetKostenplaatsen.d.ts +10 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetKostenplaatsen.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetKostenplaatsenResponse.d.ts +6 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetKostenplaatsenResponse.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetKostenplaatsenResult.d.ts +13 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetKostenplaatsenResult.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetMutaties.d.ts +10 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetMutaties.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetMutatiesResponse.d.ts +6 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetMutatiesResponse.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetMutatiesResult.d.ts +13 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetMutatiesResult.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetOpenPosten.d.ts +9 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetOpenPosten.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetOpenPostenResponse.d.ts +6 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetOpenPostenResponse.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetOpenPostenResult.d.ts +13 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetOpenPostenResult.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetRelaties.d.ts +10 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetRelaties.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetRelatiesResponse.d.ts +6 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetRelatiesResponse.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetRelatiesResult.d.ts +13 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetRelatiesResult.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetSaldi.d.ts +10 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetSaldi.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetSaldiResponse.d.ts +6 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetSaldiResponse.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetSaldiResult.d.ts +13 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetSaldiResult.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetSaldo.d.ts +10 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetSaldo.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetSaldoResponse.d.ts +6 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetSaldoResponse.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetSaldoResult.d.ts +12 -0
- package/dist/client/eboekhoudenwsdl/definitions/GetSaldoResult.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/Kostenplaatsen.d.ts +10 -0
- package/dist/client/eboekhoudenwsdl/definitions/Kostenplaatsen.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/MutatieRegels.d.ts +10 -0
- package/dist/client/eboekhoudenwsdl/definitions/MutatieRegels.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/MutatieRegels1.d.ts +10 -0
- package/dist/client/eboekhoudenwsdl/definitions/MutatieRegels1.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/Mutaties.d.ts +10 -0
- package/dist/client/eboekhoudenwsdl/definitions/Mutaties.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/OFact.d.ts +58 -0
- package/dist/client/eboekhoudenwsdl/definitions/OFact.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/OGb.d.ts +17 -0
- package/dist/client/eboekhoudenwsdl/definitions/OGb.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/OMut.d.ts +32 -0
- package/dist/client/eboekhoudenwsdl/definitions/OMut.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/ORel.d.ts +91 -0
- package/dist/client/eboekhoudenwsdl/definitions/ORel.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/OpenSession.d.ts +11 -0
- package/dist/client/eboekhoudenwsdl/definitions/OpenSession.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/OpenSessionResponse.d.ts +6 -0
- package/dist/client/eboekhoudenwsdl/definitions/OpenSessionResponse.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/OpenSessionResult.d.ts +12 -0
- package/dist/client/eboekhoudenwsdl/definitions/OpenSessionResult.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/OpenSessionSub.d.ts +13 -0
- package/dist/client/eboekhoudenwsdl/definitions/OpenSessionSub.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/OpenSessionSubResponse.d.ts +6 -0
- package/dist/client/eboekhoudenwsdl/definitions/OpenSessionSubResponse.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/Openposten.d.ts +10 -0
- package/dist/client/eboekhoudenwsdl/definitions/Openposten.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/Regels.d.ts +10 -0
- package/dist/client/eboekhoudenwsdl/definitions/Regels.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/Rekeningen.d.ts +10 -0
- package/dist/client/eboekhoudenwsdl/definitions/Rekeningen.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/Relatiecode.d.ts +3 -0
- package/dist/client/eboekhoudenwsdl/definitions/Relatiecode.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/Relaties.d.ts +10 -0
- package/dist/client/eboekhoudenwsdl/definitions/Relaties.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/Saldi.d.ts +10 -0
- package/dist/client/eboekhoudenwsdl/definitions/Saldi.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/UpdateGrootboekrekening.d.ts +10 -0
- package/dist/client/eboekhoudenwsdl/definitions/UpdateGrootboekrekening.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/UpdateGrootboekrekeningResponse.d.ts +6 -0
- package/dist/client/eboekhoudenwsdl/definitions/UpdateGrootboekrekeningResponse.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/UpdateRelatie.d.ts +10 -0
- package/dist/client/eboekhoudenwsdl/definitions/UpdateRelatie.js +2 -0
- package/dist/client/eboekhoudenwsdl/definitions/UpdateRelatieResponse.d.ts +6 -0
- package/dist/client/eboekhoudenwsdl/definitions/UpdateRelatieResponse.js +2 -0
- package/dist/client/eboekhoudenwsdl/index.d.ts +96 -0
- package/dist/client/eboekhoudenwsdl/index.js +5 -0
- package/dist/client/eboekhoudenwsdl/ports/SoapAppSoap.d.ts +62 -0
- package/dist/client/eboekhoudenwsdl/ports/SoapAppSoap.js +2 -0
- package/dist/client/eboekhoudenwsdl/ports/SoapAppSoap12.d.ts +62 -0
- package/dist/client/eboekhoudenwsdl/ports/SoapAppSoap12.js +2 -0
- package/dist/client/eboekhoudenwsdl/services/SoapApp.d.ts +6 -0
- package/dist/client/eboekhoudenwsdl/services/SoapApp.js +2 -0
- package/dist/client/index.d.ts +1 -0
- package/dist/client/index.js +17 -0
- package/dist/constants.d.ts +2 -0
- package/dist/constants.js +5 -0
- package/dist/e-boekhouden.plugin.d.ts +4 -0
- package/dist/e-boekhouden.plugin.js +53 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +21 -0
- package/dist/ui/e-boekhouden-nav.module.ts +19 -0
- package/dist/ui/e-boekhouden.component.ts +121 -0
- package/dist/ui/e-boekhouden.module.ts +21 -0
- package/dist/ui/generated/graphql.d.ts +79 -0
- package/dist/ui/generated/graphql.js +2 -0
- package/dist/ui/generated/graphql.ts +59 -0
- package/dist/ui/queries.graphql.ts +27 -0
- package/package.json +47 -0
package/README.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Vendure E-boekhouden plugin
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
### [Official documentation here](https://pinelab-plugins.com/plugin/vendure-plugin-e-boekhouden)
|
|
6
|
+
|
|
7
|
+
Plugin for syncing orders to the Dutch accounting platform E-boekhouden.nl.
|
|
8
|
+
|
|
9
|
+
## Getting started
|
|
10
|
+
|
|
11
|
+
Send orders to e-Boekhouden as `GeldOntvangen` mutation and configured `account` and `contraAccount` numbers. Creates a
|
|
12
|
+
mutation line for each taxrate of the order's tax summary.
|
|
13
|
+
|
|
14
|
+
1. Add this to your plugin in `vendure-config.ts`:
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
import { EboekhoudenPlugin } from 'vendure-plugin-e-boekhouden'
|
|
18
|
+
|
|
19
|
+
plugins: [
|
|
20
|
+
EboekhoudenPlugin,
|
|
21
|
+
...
|
|
22
|
+
]
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
2. Run a database migration to add the config entity to your database.
|
|
26
|
+
3. Add this plugin to the Vendure admin ui plugin to add the configuration screen to Vendure.
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
plugins: [
|
|
30
|
+
AdminUiPlugin.init({
|
|
31
|
+
port: 3002,
|
|
32
|
+
route: 'admin',
|
|
33
|
+
app: compileUiExtensions({
|
|
34
|
+
outputPath: path.join(__dirname, '__admin-ui'),
|
|
35
|
+
extensions: [EboekhoudenPlugin.ui],
|
|
36
|
+
}),
|
|
37
|
+
}),
|
|
38
|
+
];
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
You can read more about Admin UI compilation in the Vendure
|
|
42
|
+
[docs](https://www.vendure.io/docs/plugins/extending-the-admin-ui/#compiling-as-a-deployment-step)
|
|
43
|
+
|
|
44
|
+
4. Start the server and set your credentials via `Settings > E-boekhouden`
|
|
45
|
+
|
|
46
|
+
### Development - generate new client
|
|
47
|
+
|
|
48
|
+
1. Go to https://soap.e-boekhouden.nl/soap.asmx?wsdl and save the wsdl file in `src/client/e-boekhouden-wsdl.xml`.
|
|
49
|
+
2. Run `yarn generate-soap-client`.
|
|
50
|
+
3. `src/client` will now have an updated and typed soap client for e-Boekhouden.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DeepPartial, VendureEntity } from '@vendure/core';
|
|
2
|
+
export declare class EBoekhoudenConfigEntity extends VendureEntity {
|
|
3
|
+
constructor(input?: DeepPartial<EBoekhoudenConfigEntity>);
|
|
4
|
+
channelToken: string;
|
|
5
|
+
enabled: boolean;
|
|
6
|
+
username: string;
|
|
7
|
+
secret1: string;
|
|
8
|
+
secret2: string;
|
|
9
|
+
account: string;
|
|
10
|
+
contraAccount: string;
|
|
11
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.EBoekhoudenConfigEntity = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const core_1 = require("@vendure/core");
|
|
15
|
+
let EBoekhoudenConfigEntity = class EBoekhoudenConfigEntity extends core_1.VendureEntity {
|
|
16
|
+
constructor(input) {
|
|
17
|
+
super(input);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
__decorate([
|
|
21
|
+
(0, typeorm_1.Column)({ unique: true }),
|
|
22
|
+
__metadata("design:type", String)
|
|
23
|
+
], EBoekhoudenConfigEntity.prototype, "channelToken", void 0);
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, typeorm_1.Column)({ nullable: false }),
|
|
26
|
+
__metadata("design:type", Boolean)
|
|
27
|
+
], EBoekhoudenConfigEntity.prototype, "enabled", void 0);
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, typeorm_1.Column)({ nullable: false }),
|
|
30
|
+
__metadata("design:type", String)
|
|
31
|
+
], EBoekhoudenConfigEntity.prototype, "username", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
(0, typeorm_1.Column)({ nullable: false }),
|
|
34
|
+
__metadata("design:type", String)
|
|
35
|
+
], EBoekhoudenConfigEntity.prototype, "secret1", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
(0, typeorm_1.Column)({ nullable: false }),
|
|
38
|
+
__metadata("design:type", String)
|
|
39
|
+
], EBoekhoudenConfigEntity.prototype, "secret2", void 0);
|
|
40
|
+
__decorate([
|
|
41
|
+
(0, typeorm_1.Column)({ nullable: false }),
|
|
42
|
+
__metadata("design:type", String)
|
|
43
|
+
], EBoekhoudenConfigEntity.prototype, "account", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
(0, typeorm_1.Column)({ nullable: false }),
|
|
46
|
+
__metadata("design:type", String)
|
|
47
|
+
], EBoekhoudenConfigEntity.prototype, "contraAccount", void 0);
|
|
48
|
+
EBoekhoudenConfigEntity = __decorate([
|
|
49
|
+
(0, typeorm_1.Entity)('e_boekhouden_config'),
|
|
50
|
+
__metadata("design:paramtypes", [Object])
|
|
51
|
+
], EBoekhoudenConfigEntity);
|
|
52
|
+
exports.EBoekhoudenConfigEntity = EBoekhoudenConfigEntity;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { CMutatieRegel, OMut } from '../client';
|
|
2
|
+
import { Order } from '@vendure/core';
|
|
3
|
+
import { EBoekhoudenConfigEntity } from './e-boekhouden-config.entity';
|
|
4
|
+
import { OrderTaxSummary } from '@vendure/common/lib/generated-types';
|
|
5
|
+
/**
|
|
6
|
+
* Recalculate taxes based on the taxBase+taxTotal (the totalIncVAT), because Vendure calculates taxes per orderline and
|
|
7
|
+
* EBoekhouden calculates taxes based on the total per taxRate.
|
|
8
|
+
* This can result in small rounding differences
|
|
9
|
+
* @param summary
|
|
10
|
+
*/
|
|
11
|
+
export declare const recalculateTaxFromTotalIncVAT: (summary: OrderTaxSummary) => {
|
|
12
|
+
totalIncVAT: number;
|
|
13
|
+
totalExVAT: number;
|
|
14
|
+
totalTax: number;
|
|
15
|
+
};
|
|
16
|
+
export declare class EBoekhoudenAdapter {
|
|
17
|
+
/**
|
|
18
|
+
* Transforms an order, together with config, to a e-Boekhouden mutation format
|
|
19
|
+
* using the order.taxSummary
|
|
20
|
+
*/
|
|
21
|
+
static toMutation(order: Order, config: EBoekhoudenConfigEntity): OMut;
|
|
22
|
+
static toMutationLine(tax: OrderTaxSummary, config: EBoekhoudenConfigEntity): CMutatieRegel;
|
|
23
|
+
static getTax(value: number, reference: string): 'LAAG_VERK_9' | 'HOOG_VERK_21' | 'AFW' | 'GEEN';
|
|
24
|
+
static toDateString(date: Date): string;
|
|
25
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EBoekhoudenAdapter = exports.recalculateTaxFromTotalIncVAT = void 0;
|
|
4
|
+
const core_1 = require("@vendure/core");
|
|
5
|
+
const constants_1 = require("../constants");
|
|
6
|
+
const toPrice = (price) => (Math.round(price) / 100).toFixed(2);
|
|
7
|
+
/**
|
|
8
|
+
* Recalculate taxes based on the taxBase+taxTotal (the totalIncVAT), because Vendure calculates taxes per orderline and
|
|
9
|
+
* EBoekhouden calculates taxes based on the total per taxRate.
|
|
10
|
+
* This can result in small rounding differences
|
|
11
|
+
* @param summary
|
|
12
|
+
*/
|
|
13
|
+
const recalculateTaxFromTotalIncVAT = (summary) => {
|
|
14
|
+
const taxMultiplier = summary.taxRate / 100 + 1;
|
|
15
|
+
const totalIncVAT = summary.taxBase + summary.taxTotal;
|
|
16
|
+
const totalExVAT = totalIncVAT / taxMultiplier;
|
|
17
|
+
const totalTax = totalIncVAT - totalExVAT;
|
|
18
|
+
return {
|
|
19
|
+
totalIncVAT,
|
|
20
|
+
totalExVAT,
|
|
21
|
+
totalTax,
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
exports.recalculateTaxFromTotalIncVAT = recalculateTaxFromTotalIncVAT;
|
|
25
|
+
class EBoekhoudenAdapter {
|
|
26
|
+
/**
|
|
27
|
+
* Transforms an order, together with config, to a e-Boekhouden mutation format
|
|
28
|
+
* using the order.taxSummary
|
|
29
|
+
*/
|
|
30
|
+
static toMutation(order, config) {
|
|
31
|
+
const description = `Order ${order.code} - ${order.customer?.firstName} ${order.customer?.lastName} (${order.customer?.emailAddress})`;
|
|
32
|
+
const cMutatieRegel = order.taxSummary.map((summary) => this.toMutationLine(summary, config));
|
|
33
|
+
return {
|
|
34
|
+
Soort: 'GeldOntvangen',
|
|
35
|
+
Datum: this.toDateString(order.orderPlacedAt || order.updatedAt),
|
|
36
|
+
Rekening: config.account,
|
|
37
|
+
Omschrijving: description,
|
|
38
|
+
InExBTW: 'IN',
|
|
39
|
+
MutatieRegels: {
|
|
40
|
+
cMutatieRegel,
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
static toMutationLine(tax, config) {
|
|
45
|
+
const recalculatedTax = (0, exports.recalculateTaxFromTotalIncVAT)(tax);
|
|
46
|
+
return {
|
|
47
|
+
BedragExclBTW: toPrice(recalculatedTax.totalExVAT),
|
|
48
|
+
BedragInclBTW: toPrice(recalculatedTax.totalIncVAT),
|
|
49
|
+
BedragBTW: toPrice(recalculatedTax.totalTax),
|
|
50
|
+
BTWPercentage: String(tax.taxRate),
|
|
51
|
+
TegenrekeningCode: config.contraAccount,
|
|
52
|
+
BTWCode: this.getTax(tax.taxRate, tax.description),
|
|
53
|
+
BedragInvoer: toPrice(recalculatedTax.totalIncVAT),
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
static getTax(value, reference) {
|
|
57
|
+
if (value === 9) {
|
|
58
|
+
return 'LAAG_VERK_9';
|
|
59
|
+
}
|
|
60
|
+
else if (value === 21) {
|
|
61
|
+
return 'HOOG_VERK_21';
|
|
62
|
+
}
|
|
63
|
+
else if (value === 0) {
|
|
64
|
+
return 'GEEN';
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
core_1.Logger.error(`Unknown taxValue ${value} for ${reference}. Used 21 as default`, constants_1.loggerCtx);
|
|
68
|
+
return 'HOOG_VERK_21';
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
static toDateString(date) {
|
|
72
|
+
const dateString = date.toISOString();
|
|
73
|
+
return dateString.substr(0, 10);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
exports.EBoekhoudenAdapter = EBoekhoudenAdapter;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { RequestContext } from '@vendure/core';
|
|
2
|
+
import { EBoekhoudenService } from './e-boekhouden.service';
|
|
3
|
+
import { PermissionDefinition } from '@vendure/core';
|
|
4
|
+
import { EBoekhoudenConfig, EBoekhoudenConfigInput } from '../ui/generated/graphql';
|
|
5
|
+
export declare const eBoekhoudenPermission: PermissionDefinition;
|
|
6
|
+
export declare class EBoekhoudenResolver {
|
|
7
|
+
private service;
|
|
8
|
+
constructor(service: EBoekhoudenService);
|
|
9
|
+
eBoekhoudenConfig(ctx: RequestContext): Promise<EBoekhoudenConfig | null>;
|
|
10
|
+
updateEBoekhoudenConfig(ctx: RequestContext, input: EBoekhoudenConfigInput): Promise<EBoekhoudenConfig | null>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.EBoekhoudenResolver = exports.eBoekhoudenPermission = void 0;
|
|
16
|
+
const graphql_1 = require("@nestjs/graphql");
|
|
17
|
+
const core_1 = require("@vendure/core");
|
|
18
|
+
const e_boekhouden_service_1 = require("./e-boekhouden.service");
|
|
19
|
+
const core_2 = require("@vendure/core");
|
|
20
|
+
exports.eBoekhoudenPermission = new core_2.PermissionDefinition({
|
|
21
|
+
name: 'eBoekhouden',
|
|
22
|
+
description: 'Allows enabling e-Boekhouden plugin',
|
|
23
|
+
});
|
|
24
|
+
let EBoekhoudenResolver = class EBoekhoudenResolver {
|
|
25
|
+
constructor(service) {
|
|
26
|
+
this.service = service;
|
|
27
|
+
}
|
|
28
|
+
async eBoekhoudenConfig(ctx) {
|
|
29
|
+
return this.service.getConfig(ctx.channel.token);
|
|
30
|
+
}
|
|
31
|
+
async updateEBoekhoudenConfig(ctx, input) {
|
|
32
|
+
return this.service.upsertConfig(ctx.channel.token, input);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, graphql_1.Query)(),
|
|
37
|
+
(0, core_1.Allow)(exports.eBoekhoudenPermission.Permission),
|
|
38
|
+
__param(0, (0, core_1.Ctx)()),
|
|
39
|
+
__metadata("design:type", Function),
|
|
40
|
+
__metadata("design:paramtypes", [core_1.RequestContext]),
|
|
41
|
+
__metadata("design:returntype", Promise)
|
|
42
|
+
], EBoekhoudenResolver.prototype, "eBoekhoudenConfig", null);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, graphql_1.Mutation)(),
|
|
45
|
+
(0, core_1.Allow)(exports.eBoekhoudenPermission.Permission),
|
|
46
|
+
__param(0, (0, core_1.Ctx)()),
|
|
47
|
+
__param(1, (0, graphql_1.Args)('input')),
|
|
48
|
+
__metadata("design:type", Function),
|
|
49
|
+
__metadata("design:paramtypes", [core_1.RequestContext, Object]),
|
|
50
|
+
__metadata("design:returntype", Promise)
|
|
51
|
+
], EBoekhoudenResolver.prototype, "updateEBoekhoudenConfig", null);
|
|
52
|
+
EBoekhoudenResolver = __decorate([
|
|
53
|
+
(0, graphql_1.Resolver)(),
|
|
54
|
+
__metadata("design:paramtypes", [e_boekhouden_service_1.EBoekhoudenService])
|
|
55
|
+
], EBoekhoudenResolver);
|
|
56
|
+
exports.EBoekhoudenResolver = EBoekhoudenResolver;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ChannelService, EventBus, JobQueue, JobQueueService, OrderService, TransactionalConnection } from '@vendure/core';
|
|
2
|
+
import { OnApplicationBootstrap, OnModuleInit } from '@nestjs/common';
|
|
3
|
+
import { EBoekhoudenConfigEntity } from './e-boekhouden-config.entity';
|
|
4
|
+
import { EBoekhoudenConfigInput } from '../ui/generated/graphql';
|
|
5
|
+
import { EBoekhoudenWsdlClient } from '../client';
|
|
6
|
+
interface JobData {
|
|
7
|
+
channelToken: string;
|
|
8
|
+
orderCode: string;
|
|
9
|
+
}
|
|
10
|
+
export declare class EBoekhoudenService implements OnApplicationBootstrap, OnModuleInit {
|
|
11
|
+
private connection;
|
|
12
|
+
private orderService;
|
|
13
|
+
private channelService;
|
|
14
|
+
private eventBus;
|
|
15
|
+
private jobQueueService;
|
|
16
|
+
client: EBoekhoudenWsdlClient;
|
|
17
|
+
jobQueue: JobQueue<JobData>;
|
|
18
|
+
constructor(connection: TransactionalConnection, orderService: OrderService, channelService: ChannelService, eventBus: EventBus, jobQueueService: JobQueueService);
|
|
19
|
+
onModuleInit(): Promise<void>;
|
|
20
|
+
onApplicationBootstrap(): Promise<void>;
|
|
21
|
+
upsertConfig(channelToken: string, input: EBoekhoudenConfigInput): Promise<EBoekhoudenConfigEntity>;
|
|
22
|
+
getConfig(channelToken: string): Promise<EBoekhoudenConfigEntity | null>;
|
|
23
|
+
getConfigs(): Promise<EBoekhoudenConfigEntity[]>;
|
|
24
|
+
pushOrder({ orderCode, channelToken }: JobData): Promise<void>;
|
|
25
|
+
private openSession;
|
|
26
|
+
closeSession(sessionId: string): Promise<void>;
|
|
27
|
+
private validate;
|
|
28
|
+
}
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.EBoekhoudenService = void 0;
|
|
13
|
+
const core_1 = require("@vendure/core");
|
|
14
|
+
const common_1 = require("@nestjs/common");
|
|
15
|
+
const e_boekhouden_config_entity_1 = require("./e-boekhouden-config.entity");
|
|
16
|
+
const client_1 = require("../client");
|
|
17
|
+
const constants_1 = require("../constants");
|
|
18
|
+
const e_boekhouden_adapter_1 = require("./e-boekhouden.adapter");
|
|
19
|
+
let EBoekhoudenService = class EBoekhoudenService {
|
|
20
|
+
constructor(connection, orderService, channelService, eventBus, jobQueueService) {
|
|
21
|
+
this.connection = connection;
|
|
22
|
+
this.orderService = orderService;
|
|
23
|
+
this.channelService = channelService;
|
|
24
|
+
this.eventBus = eventBus;
|
|
25
|
+
this.jobQueueService = jobQueueService;
|
|
26
|
+
}
|
|
27
|
+
async onModuleInit() {
|
|
28
|
+
const url = 'https://soap.e-boekhouden.nl/soap.asmx?wsdl';
|
|
29
|
+
const options = {
|
|
30
|
+
envelopeKey: 'soap',
|
|
31
|
+
wsdl_options: {
|
|
32
|
+
xmlKey: '$xml',
|
|
33
|
+
overrideRootElement: {
|
|
34
|
+
namespace: 'xmlns:soap',
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
this.client = await (0, client_1.createClientAsync)(url, options);
|
|
39
|
+
this.jobQueue = await this.jobQueueService.createQueue({
|
|
40
|
+
name: 'push-orders-to-e-boekhouden',
|
|
41
|
+
process: async (job) => await this.pushOrder(job.data),
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
async onApplicationBootstrap() {
|
|
45
|
+
this.eventBus.ofType(core_1.OrderPlacedEvent).subscribe(async (event) => await this.jobQueue.add({
|
|
46
|
+
channelToken: event.ctx.channel.token,
|
|
47
|
+
orderCode: event.order.code,
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
50
|
+
async upsertConfig(channelToken, input) {
|
|
51
|
+
const existing = await this.connection
|
|
52
|
+
.getRepository(e_boekhouden_config_entity_1.EBoekhoudenConfigEntity)
|
|
53
|
+
.findOne({ where: { channelToken } });
|
|
54
|
+
if (existing) {
|
|
55
|
+
await this.connection
|
|
56
|
+
.getRepository(e_boekhouden_config_entity_1.EBoekhoudenConfigEntity)
|
|
57
|
+
.update(existing.id, input);
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
await this.connection
|
|
61
|
+
.getRepository(e_boekhouden_config_entity_1.EBoekhoudenConfigEntity)
|
|
62
|
+
.insert({ ...input, channelToken });
|
|
63
|
+
}
|
|
64
|
+
return this.connection
|
|
65
|
+
.getRepository(e_boekhouden_config_entity_1.EBoekhoudenConfigEntity)
|
|
66
|
+
.findOneOrFail({ where: { channelToken } });
|
|
67
|
+
}
|
|
68
|
+
async getConfig(channelToken) {
|
|
69
|
+
return this.connection
|
|
70
|
+
.getRepository(e_boekhouden_config_entity_1.EBoekhoudenConfigEntity)
|
|
71
|
+
.findOne({ where: { channelToken }, cache: 60000 });
|
|
72
|
+
}
|
|
73
|
+
async getConfigs() {
|
|
74
|
+
return this.connection
|
|
75
|
+
.getRepository(e_boekhouden_config_entity_1.EBoekhoudenConfigEntity)
|
|
76
|
+
.find({ cache: 60000 });
|
|
77
|
+
}
|
|
78
|
+
async pushOrder({ orderCode, channelToken }) {
|
|
79
|
+
const config = await this.getConfig(channelToken);
|
|
80
|
+
if (!config?.enabled) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
const channel = await this.channelService.getChannelFromToken(channelToken);
|
|
84
|
+
const ctx = new core_1.RequestContext({
|
|
85
|
+
apiType: 'admin',
|
|
86
|
+
isAuthorized: true,
|
|
87
|
+
channel,
|
|
88
|
+
authorizedAsOwnerOnly: false,
|
|
89
|
+
});
|
|
90
|
+
const order = await this.orderService.findOneByCode(ctx, orderCode);
|
|
91
|
+
if (!order) {
|
|
92
|
+
core_1.Logger.error(`No order with code ${orderCode} found. Not retrying this job`, constants_1.loggerCtx);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
let sessionId;
|
|
96
|
+
try {
|
|
97
|
+
sessionId = await this.openSession(config);
|
|
98
|
+
const mutation = e_boekhouden_adapter_1.EBoekhoudenAdapter.toMutation(order, config);
|
|
99
|
+
const result = await this.client.AddMutatieAsync({
|
|
100
|
+
SessionID: sessionId,
|
|
101
|
+
SecurityCode2: config.secret2,
|
|
102
|
+
oMut: mutation,
|
|
103
|
+
});
|
|
104
|
+
this.validate(result[0].AddMutatieResult);
|
|
105
|
+
core_1.Logger.info(`Successfully send order ${orderCode} to e-boekhouden with mutationNr ${result?.[0]?.AddMutatieResult?.Mutatienummer}`, constants_1.loggerCtx);
|
|
106
|
+
}
|
|
107
|
+
catch (e) {
|
|
108
|
+
core_1.Logger.error(`Failed to push order ${order.code} for channel ${config.channelToken} to account ${config.username}: ${e?.message}`, constants_1.loggerCtx, e);
|
|
109
|
+
throw e;
|
|
110
|
+
}
|
|
111
|
+
finally {
|
|
112
|
+
if (sessionId) {
|
|
113
|
+
await this.closeSession(sessionId);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
async openSession(config) {
|
|
118
|
+
const openSession = await this.client.OpenSessionAsync({
|
|
119
|
+
SecurityCode1: config.secret1,
|
|
120
|
+
SecurityCode2: config.secret2,
|
|
121
|
+
Username: config.username,
|
|
122
|
+
});
|
|
123
|
+
this.validate(openSession[0].OpenSessionResult);
|
|
124
|
+
const sessionId = openSession[0].OpenSessionResult?.SessionID;
|
|
125
|
+
if (!sessionId) {
|
|
126
|
+
throw Error(`No SessionID from OpenSession for account ${config.username}`);
|
|
127
|
+
}
|
|
128
|
+
return sessionId;
|
|
129
|
+
}
|
|
130
|
+
async closeSession(sessionId) {
|
|
131
|
+
await this.client.CloseSessionAsync({ SessionID: sessionId });
|
|
132
|
+
}
|
|
133
|
+
validate(res) {
|
|
134
|
+
if (res?.ErrorMsg?.LastErrorDescription || res?.ErrorMsg?.LastErrorCode) {
|
|
135
|
+
throw Error(`${res.ErrorMsg?.LastErrorCode} - ${res.ErrorMsg?.LastErrorDescription}`);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
EBoekhoudenService = __decorate([
|
|
140
|
+
(0, common_1.Injectable)(),
|
|
141
|
+
__metadata("design:paramtypes", [core_1.TransactionalConnection,
|
|
142
|
+
core_1.OrderService,
|
|
143
|
+
core_1.ChannelService,
|
|
144
|
+
core_1.EventBus,
|
|
145
|
+
core_1.JobQueueService])
|
|
146
|
+
], EBoekhoudenService);
|
|
147
|
+
exports.EBoekhoudenService = EBoekhoudenService;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const schema: import("graphql").DocumentNode;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.schema = void 0;
|
|
7
|
+
const graphql_tag_1 = __importDefault(require("graphql-tag"));
|
|
8
|
+
exports.schema = (0, graphql_tag_1.default) `
|
|
9
|
+
input EBoekhoudenConfigInput {
|
|
10
|
+
enabled: Boolean!
|
|
11
|
+
username: String!
|
|
12
|
+
secret1: String!
|
|
13
|
+
secret2: String!
|
|
14
|
+
account: String!
|
|
15
|
+
contraAccount: String!
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
type EBoekhoudenConfig {
|
|
19
|
+
enabled: Boolean!
|
|
20
|
+
username: String!
|
|
21
|
+
secret1: String!
|
|
22
|
+
secret2: String!
|
|
23
|
+
account: String!
|
|
24
|
+
contraAccount: String!
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
extend type Mutation {
|
|
28
|
+
updateEBoekhoudenConfig(input: EBoekhoudenConfigInput!): EBoekhoudenConfig
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
extend type Query {
|
|
32
|
+
eBoekhoudenConfig: EBoekhoudenConfig
|
|
33
|
+
}
|
|
34
|
+
`;
|