@itutoring/itutoring_application_js_api 1.5.13 → 1.5.15
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/index.d.ts +4 -0
- package/index.js +4 -0
- package/modules/Inventory.js +22 -0
- package/modules/ReservationSystem.js +106 -2
- package/objects/billingInfo.js +21 -0
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -42,6 +42,8 @@ import Toolkit from "./toolkit/Toolkit";
|
|
|
42
42
|
import Pricing from "./modules/Pricing";
|
|
43
43
|
import Reviews from "./modules/Reviews";
|
|
44
44
|
import FAQ from "./modules/FAQ";
|
|
45
|
+
import Inventory from "./modules/Inventory";
|
|
46
|
+
import BillingInfo from "./objects/billingInfo";
|
|
45
47
|
|
|
46
48
|
import
|
|
47
49
|
{
|
|
@@ -85,6 +87,7 @@ export
|
|
|
85
87
|
Pricing,
|
|
86
88
|
Reviews,
|
|
87
89
|
FAQ,
|
|
90
|
+
Inventory,
|
|
88
91
|
|
|
89
92
|
Course,
|
|
90
93
|
CourseReservation,
|
|
@@ -96,6 +99,7 @@ export
|
|
|
96
99
|
iEvent,
|
|
97
100
|
AuthUser,
|
|
98
101
|
AttendanceEvent,
|
|
102
|
+
BillingInfo,
|
|
99
103
|
|
|
100
104
|
BookReturn,
|
|
101
105
|
AuthResult,
|
package/index.js
CHANGED
|
@@ -40,6 +40,8 @@ import TeacherProfileModule from "./modules/TeacherProfileModule";
|
|
|
40
40
|
import Pricing from "./modules/Pricing";
|
|
41
41
|
import Reviews from "./modules/Reviews";
|
|
42
42
|
import FAQ from "./modules/FAQ";
|
|
43
|
+
import Inventory from "./modules/Inventory";
|
|
44
|
+
import BillingInfo from "./objects/billingInfo";
|
|
43
45
|
|
|
44
46
|
import
|
|
45
47
|
{
|
|
@@ -83,6 +85,7 @@ export
|
|
|
83
85
|
Pricing,
|
|
84
86
|
Reviews,
|
|
85
87
|
FAQ,
|
|
88
|
+
Inventory,
|
|
86
89
|
|
|
87
90
|
Course,
|
|
88
91
|
CourseReservation,
|
|
@@ -94,6 +97,7 @@ export
|
|
|
94
97
|
iEvent,
|
|
95
98
|
AuthUser,
|
|
96
99
|
AttendanceEvent,
|
|
100
|
+
BillingInfo,
|
|
97
101
|
|
|
98
102
|
BookReturn,
|
|
99
103
|
AuthResult,
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import APIController from "../apiController";
|
|
2
|
+
|
|
3
|
+
class Inventory
|
|
4
|
+
{
|
|
5
|
+
static #MODULE = "Inventory";
|
|
6
|
+
|
|
7
|
+
static #GET_AVAILABLE_ITEMS = "GetAvailableItems";
|
|
8
|
+
|
|
9
|
+
static async getAvailableItems(category = "ANY", max = -1, offset = 0, filter = {})
|
|
10
|
+
{
|
|
11
|
+
var items = await APIController.Get(this.#MODULE, this.#GET_AVAILABLE_ITEMS, {
|
|
12
|
+
'category': category,
|
|
13
|
+
'max': max,
|
|
14
|
+
'offset': offset,
|
|
15
|
+
'filter': JSON.stringify(filter),
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
return items;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default Inventory;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import BillingInfo from "../objects/billingInfo";
|
|
1
2
|
import APIController from "./../apiController";
|
|
2
3
|
import Reservation from "./../objects/Reservation";
|
|
3
4
|
|
|
@@ -23,11 +24,102 @@ class ReservationSystem
|
|
|
23
24
|
static #RETRIVE_ORDER_ID = "RetriveOrderID";
|
|
24
25
|
static #SEND_REQUEST = "SendRequest";
|
|
25
26
|
|
|
27
|
+
static #ADD_ITEM_TO_CART = "AddItemToCart";
|
|
28
|
+
static #GET_CART_ITEMS = "GetCartItems";
|
|
29
|
+
static #GET_TOTAL_PRICE = "GetTotalPrice";
|
|
30
|
+
static #PLACE_ORDER = "PlaceOrder";
|
|
31
|
+
static #SEND_ORDER_CONFIRMATION_EMAIL = "SendOrderConfirmationEmail";
|
|
32
|
+
static #CLEAR_CART = "ClearCart";
|
|
33
|
+
static #APPLY_SALE_COUPON = "ApplySaleCoupon";
|
|
34
|
+
static #GET_APPLIED_SALE_COUPONS = "GetAppliedSaleCoupons";
|
|
35
|
+
static #REMOVE_SALE_COUPON = "RemoveSaleCoupon";
|
|
36
|
+
static #GET_SALE_AMOUNTS = "GetSaleAmounts";
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
static async addItemToCart(itemSku)
|
|
40
|
+
{
|
|
41
|
+
await APIController.Post(this.#MODULE, this.#ADD_ITEM_TO_CART, { 'itemSku': itemSku });
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
static async getCartItems()
|
|
45
|
+
{
|
|
46
|
+
var items = await APIController.Get(this.#MODULE, this.#GET_CART_ITEMS);
|
|
47
|
+
|
|
48
|
+
return items;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
static async getTotalPrice()
|
|
52
|
+
{
|
|
53
|
+
var price = await APIController.Get(this.#MODULE, this.#GET_TOTAL_PRICE);
|
|
54
|
+
|
|
55
|
+
return price;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
*
|
|
60
|
+
* @param {BillingInfo} billingInfo - BillingInfo model expected. You can use prepared js object or create just array.
|
|
61
|
+
* @param {*} proforma
|
|
62
|
+
* @param {*} vopAgree
|
|
63
|
+
* @param {*} gdprAgree
|
|
64
|
+
* @returns order id
|
|
65
|
+
*/
|
|
66
|
+
static async placeOrder(billingInfo, proforma = 1, vopAgree = 0, gdprAgree = 0)
|
|
67
|
+
{
|
|
68
|
+
var orderId = await APIController.Post(this.#MODULE, this.#PLACE_ORDER, {
|
|
69
|
+
'billingInfo': JSON.stringify(billingInfo),
|
|
70
|
+
'proforma': proforma,
|
|
71
|
+
'vopAgree': vopAgree,
|
|
72
|
+
'gdprAgree': gdprAgree
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
return orderId;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
static async sendOrderConfirmationEmail(orderId)
|
|
79
|
+
{
|
|
80
|
+
await APIController.Get(this.#MODULE, this.#SEND_ORDER_CONFIRMATION_EMAIL, { 'orderId': orderId });
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
static async clearCart()
|
|
84
|
+
{
|
|
85
|
+
await APIController.Get(this.#MODULE, this.#CLEAR_CART);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
static async applySaleCoupon(code)
|
|
89
|
+
{
|
|
90
|
+
await APIController.Post(this.#MODULE, this.#APPLY_SALE_COUPON, { 'code': code });
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
static async getAppliedSaleCoupons()
|
|
94
|
+
{
|
|
95
|
+
var coupons = await APIController.Get(this.#MODULE, this.#GET_APPLIED_SALE_COUPONS);
|
|
96
|
+
|
|
97
|
+
return coupons;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
static async removeSaleCoupon(code)
|
|
101
|
+
{
|
|
102
|
+
await APIController.Post(this.#MODULE, this.#REMOVE_SALE_COUPON, { 'code': code });
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
*
|
|
107
|
+
* @returns {Promise<array>} - array - sale amounts as sku=>amount
|
|
108
|
+
*/
|
|
109
|
+
static async getSaleAmounts()
|
|
110
|
+
{
|
|
111
|
+
var amounts = await APIController.Get(this.#MODULE, this.#GET_SALE_AMOUNTS);
|
|
112
|
+
|
|
113
|
+
return amounts;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
|
|
26
117
|
/**
|
|
27
118
|
* Returns availability for specific day and subject
|
|
28
119
|
* @param {*} date
|
|
29
120
|
* @param {*} subject
|
|
30
121
|
* @returns float in range 0...1
|
|
122
|
+
* @deprecated
|
|
31
123
|
*/
|
|
32
124
|
static async GetAvailabilityForDay(date, subject)
|
|
33
125
|
{
|
|
@@ -43,6 +135,7 @@ class ReservationSystem
|
|
|
43
135
|
* @param {*} year
|
|
44
136
|
* @param {*} subject subject id
|
|
45
137
|
* @returns all values (in percent 0...1) by day ascending (1st .... 31st/30rd) as JSON string.
|
|
138
|
+
* @deprecated
|
|
46
139
|
*/
|
|
47
140
|
static async GetAvailabilityForMonth(month, year, subject)
|
|
48
141
|
{
|
|
@@ -63,6 +156,7 @@ class ReservationSystem
|
|
|
63
156
|
* @param {*} startTime
|
|
64
157
|
* @param {*} lessons number of lessons (1 = 60 mins, 2 = 2x60 mins)
|
|
65
158
|
* @returns bool
|
|
159
|
+
* @deprecated
|
|
66
160
|
*/
|
|
67
161
|
static async IsTimeAvailable(date, subject, startTime, lessons = 1)
|
|
68
162
|
{
|
|
@@ -77,6 +171,7 @@ class ReservationSystem
|
|
|
77
171
|
* @param {*} subject
|
|
78
172
|
* @param {*} lessons number of lessons (1 = 60 mins, 2 = 2x60 mins)
|
|
79
173
|
* @returns float array of available times
|
|
174
|
+
* @deprecated
|
|
80
175
|
*/
|
|
81
176
|
static async IsDayAvailable(date, subject, lessons = 1)
|
|
82
177
|
{
|
|
@@ -96,6 +191,7 @@ class ReservationSystem
|
|
|
96
191
|
* @param {*} subject
|
|
97
192
|
* @param {*} lessons
|
|
98
193
|
* @param {*} teacherId
|
|
194
|
+
* @deprecated
|
|
99
195
|
*/
|
|
100
196
|
static async ReserveTime(date, startTime, subject, lessons, teacherId = "session")
|
|
101
197
|
{
|
|
@@ -115,6 +211,7 @@ class ReservationSystem
|
|
|
115
211
|
* @param {*} reservation
|
|
116
212
|
* @param {*} lessons
|
|
117
213
|
* @returns int (BookReturn)
|
|
214
|
+
* @deprecated
|
|
118
215
|
*/
|
|
119
216
|
static async Book(reservation, lessons)
|
|
120
217
|
{
|
|
@@ -140,6 +237,7 @@ class ReservationSystem
|
|
|
140
237
|
*
|
|
141
238
|
* Should be called before book to check that time.
|
|
142
239
|
* @returns true if is timeouted(time is deleted) , false if time is still there
|
|
240
|
+
* @deprecated
|
|
143
241
|
*/
|
|
144
242
|
static async OrderTimeout()
|
|
145
243
|
{
|
|
@@ -152,6 +250,7 @@ class ReservationSystem
|
|
|
152
250
|
* Send confirmation email to teacher and customer.
|
|
153
251
|
* @param {*} resend If true, the last send confirmation email will be resend. (just for the same session)
|
|
154
252
|
* @returns True if succeded
|
|
253
|
+
* @deprecated
|
|
155
254
|
*/
|
|
156
255
|
static async ConfirmReservation(resend = false)
|
|
157
256
|
{
|
|
@@ -164,6 +263,7 @@ class ReservationSystem
|
|
|
164
263
|
* Get reservation by id
|
|
165
264
|
* @param {*} id reservation id
|
|
166
265
|
* @returns Reservation object
|
|
266
|
+
* @deprecated
|
|
167
267
|
*/
|
|
168
268
|
static async GetReservation(id)
|
|
169
269
|
{
|
|
@@ -197,7 +297,8 @@ class ReservationSystem
|
|
|
197
297
|
* Check if reservation has been paid
|
|
198
298
|
* @param {*} id reservation id
|
|
199
299
|
* @returns
|
|
200
|
-
|
|
300
|
+
* @deprecated
|
|
301
|
+
*/
|
|
201
302
|
static async IsReservationPaid(id)
|
|
202
303
|
{
|
|
203
304
|
var res = await APIController.Get(this.#MODULE, this.#IS_RESERVATION_PAID, { 'id': id })
|
|
@@ -210,6 +311,7 @@ class ReservationSystem
|
|
|
210
311
|
* @param {*} reservationId
|
|
211
312
|
* @param {*} transactionId
|
|
212
313
|
* @returns bool
|
|
314
|
+
* @deprecated
|
|
213
315
|
*/
|
|
214
316
|
static async MarkReservationPaid(reservationId, transactionId)
|
|
215
317
|
{
|
|
@@ -227,6 +329,8 @@ class ReservationSystem
|
|
|
227
329
|
* Book function must be called before. ID is stored in session.
|
|
228
330
|
*
|
|
229
331
|
* @returns orderId
|
|
332
|
+
*
|
|
333
|
+
* @deprecated
|
|
230
334
|
*/
|
|
231
335
|
static async RetriveOrderID()
|
|
232
336
|
{
|
|
@@ -251,7 +355,7 @@ class ReservationSystem
|
|
|
251
355
|
"tel": tel,
|
|
252
356
|
"msg": msg,
|
|
253
357
|
"place": place
|
|
254
|
-
})
|
|
358
|
+
})
|
|
255
359
|
}
|
|
256
360
|
}
|
|
257
361
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BillingInfo API model representation.
|
|
3
|
+
* See documentation: https://zabesstudio.atlassian.net/wiki/spaces/ITUTAPP/pages/70549505/BillingInfo
|
|
4
|
+
*/
|
|
5
|
+
class BillingInfo
|
|
6
|
+
{
|
|
7
|
+
FirstName = "";
|
|
8
|
+
LastName = "";
|
|
9
|
+
StudentName = "";
|
|
10
|
+
Email = "";
|
|
11
|
+
Phone = "";
|
|
12
|
+
Address = "";
|
|
13
|
+
City = "";
|
|
14
|
+
Zip = "";
|
|
15
|
+
/**
|
|
16
|
+
* @var {int} Country
|
|
17
|
+
*/
|
|
18
|
+
Country = 2;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export default BillingInfo;
|