forked from konnectors/cozy-konnector-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
maifuser.js
executable file
·206 lines (189 loc) · 5.26 KB
/
maifuser.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
const {models} = require('cozy-konnector-libs');
//const MaifUser = module.exports = models.baseModel.createNew({'displayName':'fr.maif.maifuser'});
const doctypeContrat = models.baseModel.createNew({
"displayName":"contrat",
"docType":"fr.maif.maifuser.contrat",
"docTypeVersion": "MaifKonnector-0.0.0-draft",
"societaire": "1234567N",
"name": "VAM",
"vendor": "Maif",
"formuleBase": "VAM Assistance panne 0km",
"startDate": "1989-04-29",
"montantTarifTtc": 312,
"objects": [
{
"startDate": "2013-04-12T00:00:00",
"lieu": [
{
"address": {
"street": "2 BOULEVARD DES BELGES",
"postCode": "69006",
"city": "LYON",
"country": "FRANCE",
"numeroPays":"000"
}
}
]
}
]
});
const doctypeHome = models.baseModel.createNew({
"displayName":"home",
"docType": "fr.maif.maifuser.home",
"address": {
"street": "2 BOULEVARD DES BELGES",
"postCode": "69006",
"city": "LYON",
"country": "FRANCE",
"numeroPays":"000"
},
"codeNatureLieuRisque":"2",
"natureLieu":"Appartement",
"codeJuridique":"1",
"situationJuridiqueLieu":"Locataire ou occupant à titre gratuit",
"codePieceLieuRisque":"2",
"nombrePieces":"1 à 2 Pièces (ou 2 Pièces)",
"codeTrancheMobilier":"3",
"patrimoineMobilier":"3 501 à 6 800 ",
"societaire":"1234567"
});
const doctypeFoyer = models.baseModel.createNew({
"displayName":"foyer",
"docType": "fr.maif.maifuser.foyer",
"name":"1-A3ZICCA",
"address":{
"street": "2 BOULEVARD DES BELGES",
"postCode": "69006",
"city": "LYON 06",
"country": "FRANCE",
"numeroPays":"000",
"deliveryOffice":"LYON",
"inseeCode":"69386",
"residence":""
},
"membres":[
{
"name": {
"codeTitrePersonne":"2",
"prefix":"MME.",
"family":"DUPOND",
"given":"GERMAINE"
},
"email":"[email protected]",
"telMobile":"+33012345678",
"birthdate":"1972-03-18",
"birthplace":{},
"codeProfessionSocietaire":"13",
"profession":"13 Agent, employé",
"codeQualitePersonne":"08","quality": "Membre principal"
}
]
});
const doctypeModalitesPaiement = models.baseModel.createNew({
"displayName":"paymentterms",
"docType": "fr.maif.maifuser.paymentterms",
"rib": {
"bic":"SOGEFRPP",
"iban": "FR76300039876087612"
},
"modePaiement":"Prélèvement (1 fois)",
"societaire":"1234567",
"vendor": "maif"
});
const doctypeSinistreHabitation = models.baseModel.createNew({
"displayName":"sinistrehabitation",
"docType": "fr.maif.maifuser.sinistrehabitation",
"docTypeVersion": "MaifKonnector-0.0.0-draft",
"type": "Habitation",
"societaire": "1234567N",
"timestamp": "2015-07-20T19:00",
"lieuSurvenance": "LYON 06",
"ref": "F150181177B",
"typeLieuSurvenance": "Agglomération",
"natureLieu": "Appartement",
"address": {
"street": "2, Boulevard des Belges",
"postCode": "6900",
"city": "LYON 06",
"country": "FRANCE"
}
});
const doctypeSinistreVehicule = models.baseModel.createNew({
"displayName":"sinistrevehicule",
"docType": "fr.maif.maifuser.sinistrevehicule",
"docTypeVersion": "MaifKonnector-0.0.0-draft",
"type": "Vehicule",
"societaire": "1234567N",
"timestamp": "2015-07-20T19:00",
"lieuSurvenance": "LYON 06",
"ref": "F150181177B",
"typeLieuSurvenance": "Agglomération",
"immatriculationVehicule": "AA-123-XD",
"driver": {
"prefix": "Mme",
"family": "Dupond",
"given": "Germaine"
}
});
const doctypeSocietaire = models.baseModel.createNew({
"displayName":"societaire",
"docType": "fr.maif.maifuser.societaire",
"vendor": "maif",
"name": {
"codeTitrePersonne":"2",
"prefix":"MME.",
"family":"DUPOND",
"given":"GERMAINE",
"maiden":""
},
"email":"[email protected]",
"telMobile":"+33012345678",
"birthdate":"1972-03-18",
"birthplace":{},
"codeProfessionSocietaire":"13",
"profession":"13 Agent, employé",
"codeSituationFamiliale":"U",
"familySituation":"union libre",
"codeActif":"A Actif",
"referenceClient":"1234567"
});
const doctypeTest = models.baseModel.createNew({
docType: "fr.maif.maifuser.societaire",
displayName:'maifuser',
maifuser:{}
});
doctypeTest.getOne = callback =>
doctypeTest.all(function(err, maifusers) {
let error = err || maifusers.error;
return callback(error, maifusers[0]);
})
module.exports = {doctypeContrat, doctypeHome, doctypeFoyer, doctypeModalitesPaiement, doctypeSinistreHabitation, doctypeSinistreVehicule, doctypeSocietaire, doctypeTest}
/*const cozy_konnector_libs = require('cozy-konnector-libs');
const instance = cozy_konnector_libs.cozyclient;
let MaifUser = cozydb.getModel('MaifUser', {
password: {
type: String
},
profile: {
type: Object
},
date: {
type: String
}
}
);
let MaifUser = {};
module.exports = MaifUser;
MaifUser.all = callback =>
MaifUser.request("all", {}, function(err, tasks) {
let error = err || tasks.error;
return callback(error, tasks);
})
;
MaifUser.getOne = callback =>
MaifUser.request("all", {}, function(err, maifusers) {
let error = err || maifusers.error;
console.log(err);
return callback(error, maifusers[0]);
})
;*/