isite 2022.3.5 → 2022.3.6

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.
@@ -192,10 +192,33 @@ module.exports = function (site) {
192
192
  res.download(site.dir + '/../../uploads/' + req.params.category + '/files/' + req.params.name);
193
193
  });
194
194
 
195
- site.onPOST('/x-api/convert', (req, res) => {
195
+ site.getTLV = function (name, value) {
196
+ return Buffer.concat([Buffer.from([name], 'utf8'), Buffer.from([value.length], 'utf8'), Buffer.from(value, 'utf8')]);
197
+ };
198
+ site.onPOST('/x-api/zakat', (req, res) => {
199
+ let obj = req.data || {};
200
+ let value = [];
201
+ if (obj.name) {
202
+ value.push(site.getTLV('1', obj.name));
203
+ }
204
+ if (obj.vat_number) {
205
+ value.push(site.getTLV('2', obj.vat_number));
206
+ }
207
+ if (obj.time) {
208
+ value.push(site.getTLV('3', obj.time));
209
+ }
210
+ if (obj.total) {
211
+ value.push(site.getTLV('4', obj.total));
212
+ }
213
+ if (obj.vat_total) {
214
+ value.push(site.getTLV('5', obj.vat_total));
215
+ }
216
+ console.log(obj);
217
+ console.log(value);
218
+ value = Buffer.concat([...value]).toString('base64');
196
219
  res.json({
197
220
  done: true,
198
- value: Buffer.from(req.data.text, 'utf8').toString('hex'),
221
+ value: value,
199
222
  });
200
223
  });
201
224
  };
@@ -1137,6 +1137,14 @@
1137
1137
  return site.toBase64(value);
1138
1138
  };
1139
1139
 
1140
+ site.zakat2 = function (obj, callback) {
1141
+ fetch('/x-api/zakat', { method: 'POST', body: JSON.stringify(obj) })
1142
+ .then((res) => res.json())
1143
+ .then((data) => {
1144
+ callback(data);
1145
+ });
1146
+ };
1147
+
1140
1148
  site.barcode = function (options) {
1141
1149
  if (!options || !options.selector || !options.text) {
1142
1150
  console.error('qrcode need {selector , text}');
@@ -1163,7 +1171,7 @@
1163
1171
  height: options.height || 256,
1164
1172
  colorDark: options.colorDark || '#000000',
1165
1173
  colorLight: options.colorLight || '#ffffff',
1166
- correctLevel: options.correctLevel || QRCode.CorrectLevel.L,
1174
+ correctLevel: options.correctLevel || QRCode.CorrectLevel.H,
1167
1175
  });
1168
1176
  }
1169
1177
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isite",
3
- "version": "2022.03.05",
3
+ "version": "2022.03.06",
4
4
  "description": "Create Enterprise Multi-Language Web Site [Fast and Easy] ",
5
5
  "main": "index.js",
6
6
  "repository": {