@itutoring/itutoring_application_js_api 1.16.1 → 1.17.1

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.
@@ -20,6 +20,29 @@ class Authentication
20
20
  static #GET_USER_INFO = "GetUserInfo";
21
21
  static #SIGN_OUT = "SignOut";
22
22
  static #SUPER_LOGIN = "SuperLogin";
23
+ static #OTP_LOGIN = "OTPLogin";
24
+ static #VALIDATE_OTP = "ValidateOTP";
25
+
26
+ static async OTPLogin(email, type)
27
+ {
28
+ var res = await APIController.Post(this.#MODULE, this.#OTP_LOGIN, {
29
+ "email": email,
30
+ "type": type,
31
+ });
32
+
33
+ return res;
34
+ }
35
+
36
+ static async ValidateOTP(email, code, type)
37
+ {
38
+ var res = await APIController.Post(this.#MODULE, this.#VALIDATE_OTP, {
39
+ "email": email,
40
+ "code": code,
41
+ "type": type,
42
+ });
43
+
44
+ return res;
45
+ }
23
46
 
24
47
  static async SuperLogin(email, type)
25
48
  {
package/modules/Models.js CHANGED
@@ -107,7 +107,7 @@ class Models
107
107
  static async setLector(lector)
108
108
  {
109
109
  return await APIController.Post(this.#MODULE, this.#SET_LECTOR, {
110
- 'model': JSON.stringify(lector),
110
+ 'model': encodeURIComponent(JSON.stringify(lector)),
111
111
  });
112
112
  }
113
113
 
@@ -184,7 +184,7 @@ class Models
184
184
  static async setEvent(event)
185
185
  {
186
186
  return await APIController.Post(this.#MODULE, this.#SET_EVENT, {
187
- 'model': JSON.stringify(event),
187
+ 'model': encodeURIComponent(JSON.stringify(event)),
188
188
  });
189
189
  }
190
190
 
@@ -208,7 +208,7 @@ class Models
208
208
  static async setInquiry(inquiry)
209
209
  {
210
210
  return await APIController.Post(this.#MODULE, this.#SET_INQUIRY, {
211
- 'model': JSON.stringify(inquiry),
211
+ 'model': encodeURIComponent(JSON.stringify(inquiry)),
212
212
  });
213
213
  }
214
214
 
@@ -232,7 +232,7 @@ class Models
232
232
  static async setOffer(offer)
233
233
  {
234
234
  return await APIController.Post(this.#MODULE, this.#SET_OFFER, {
235
- 'model': JSON.stringify(offer),
235
+ 'model': encodeURIComponent(JSON.stringify(offer)),
236
236
  });
237
237
  }
238
238
 
@@ -256,7 +256,7 @@ class Models
256
256
  static async setCustomer(customer)
257
257
  {
258
258
  return await APIController.Post(this.#MODULE, this.#SET_CUSTOMER, {
259
- 'model': JSON.stringify(customer),
259
+ 'model': encodeURIComponent(JSON.stringify(customer)),
260
260
  });
261
261
  }
262
262
 
@@ -280,7 +280,7 @@ class Models
280
280
  static async setStudent(student)
281
281
  {
282
282
  return await APIController.Post(this.#MODULE, this.#SET_STUDENT, {
283
- 'model': JSON.stringify(student),
283
+ 'model': encodeURIComponent(JSON.stringify(student)),
284
284
  });
285
285
  }
286
286
 
@@ -304,7 +304,7 @@ class Models
304
304
  static async setLecture(lecture, draft = false)
305
305
  {
306
306
  return await APIController.Post(this.#MODULE, this.#SET_LECTURE, {
307
- 'model': JSON.stringify(lecture),
307
+ 'model': encodeURIComponent(JSON.stringify(lecture)),
308
308
  'draft': draft,
309
309
  });
310
310
  }
@@ -330,7 +330,7 @@ class Models
330
330
  static async setLectureAttendance(attendance)
331
331
  {
332
332
  return await APIController.Post(this.#MODULE, this.#SET_LECTURE_ATTENDANCE, {
333
- 'model': JSON.stringify(attendance),
333
+ 'model': encodeURIComponent(JSON.stringify(attendance)),
334
334
  });
335
335
  }
336
336
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itutoring/itutoring_application_js_api",
3
- "version": "1.16.1",
3
+ "version": "1.17.1",
4
4
  "description": "Javascript API for iTutoring Application",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -1,76 +0,0 @@
1
- /*
2
- * Copyright (C) 2024 iTutoring s.r.o.
3
- * All rights reserved.
4
- *
5
-
6
- *
7
- */
8
-
9
-
10
- import APIController from "./../apiController";
11
-
12
- class Payments
13
- {
14
- /**
15
- * Respective module name for this class
16
- */
17
- static #MODULE = "Payments";
18
-
19
- // All method names
20
- static #PURCHASE = "Purchase";
21
- static #VALIDATE_PURCHASE = "ValidatePurchase";
22
- static #GET_AVAILABLE_ITEMS = "GetAvailableItems";
23
-
24
- /**
25
- * @deprecated
26
- * Purchase specific product. After calling you'll be redirected depending on the result to success or cancel (failed) url
27
- * @param {*} product product name as defined in php such as HOUR_LESSON
28
- * @param {*} type payment type (credits, card), use PaymentType enum
29
- * @param {*} successUrl
30
- * @param {*} cancelUrl
31
- * @param {*} successUrlParams additional query string to success url - optional
32
- * @returns if stripe payment; returns stripe page url
33
- */
34
- static async Purchase(product, isSaled, type, successUrl, cancelUrl, successUrlParams = "")
35
- {
36
- var url = await APIController.Post(this.#MODULE, this.#PURCHASE, {
37
- 'product': product,
38
- 'saled': APIController.BoolToInt(isSaled),
39
- 'type': type,
40
- 'successUrl': successUrl,
41
- 'cancelUrl': cancelUrl,
42
- 'successUrlParams': successUrlParams,
43
- });
44
-
45
- return url;
46
- }
47
-
48
- /**
49
- * @deprecated
50
- * Call on success page after purchase to mark the payment as successful.
51
- *
52
- * Will return false if is already marked.
53
- * @param {*} id
54
- * @returns bool
55
- */
56
- static async ValidatePurchase(transactionId)
57
- {
58
- var res = await APIController.Get(this.#MODULE, this.#VALIDATE_PURCHASE, { 'id': transactionId });
59
-
60
- return APIController.IntToBool(res);
61
- }
62
-
63
- // Array of avaialable item names. returned as parsed json.
64
- /**
65
- * @deprecated
66
- * @returns
67
- */
68
- static async GetAvailableItems()
69
- {
70
- var res = await APIController.Get(this.#MODULE, this.#GET_AVAILABLE_ITEMS);
71
-
72
- return JSON.parse(res);
73
- }
74
- }
75
-
76
- export default Payments;
@@ -1,49 +0,0 @@
1
- /*
2
- * Copyright (C) 2024 iTutoring s.r.o.
3
- * All rights reserved.
4
- *
5
-
6
- *
7
- */
8
-
9
-
10
- import BillingInfo from "../objects/billingInfo";
11
- import APIController from "./../apiController";
12
-
13
- /**
14
- * @deprecated
15
- */
16
- class ReservationSystem
17
- {
18
- /**
19
- * Respective module name for this class
20
- */
21
- static #MODULE = "ReservationSystem";
22
-
23
- static #SEND_REQUEST = "SendRequest";
24
-
25
-
26
-
27
- /**
28
- * Send request for tutoring. Will register as inquiry and it's id will be returned.
29
- * @param {*} name
30
- * @param {*} email
31
- * @param {*} tel
32
- * @param {*} msg
33
- * @param {*} place must be PlaceID !
34
- */
35
- static async SendRequest(fname, lname, email, tel, msg, place)
36
- {
37
- var id = await APIController.Post(this.#MODULE, this.#SEND_REQUEST, {
38
- "fname": fname,
39
- "lname": lname,
40
- "email": email,
41
- "tel": tel,
42
- "msg": msg,
43
- "place": place
44
- })
45
- return id;
46
- }
47
- }
48
-
49
- export default ReservationSystem;