@itutoring/itutoring_application_js_api 1.10.3 → 1.11.0

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 CHANGED
@@ -31,6 +31,8 @@ import CustomerLessonManager from "./modules/CustomerLessonManager";
31
31
  import WebController from "./modules/WebController";
32
32
  import MarketplaceController from "./modules/MarketplaceController";
33
33
  import LessonInventory from "./modules/LessonInventory";
34
+ import Cart from "./modules/Cart";
35
+ import Checkout from "./modules/Checkout";
34
36
 
35
37
  import Course from "./objects/Course";
36
38
  import CourseReservation from "./objects/CourseReservation";
@@ -89,6 +91,8 @@ export
89
91
  WebController,
90
92
  MarketplaceController,
91
93
  LessonInventory,
94
+ Cart,
95
+ Checkout,
92
96
 
93
97
  Course,
94
98
  CourseReservation,
package/index.js CHANGED
@@ -28,6 +28,8 @@ import CustomerLessonManager from "./modules/CustomerLessonManager";
28
28
  import WebController from "./modules/WebController";
29
29
  import MarketplaceController from "./modules/MarketplaceController";
30
30
  import LessonInventory from "./modules/LessonInventory";
31
+ import Cart from "./modules/Cart";
32
+ import Checkout from "./modules/Checkout";
31
33
 
32
34
  import Course from "./objects/Course";
33
35
  import CourseReservation from "./objects/CourseReservation";
@@ -87,6 +89,8 @@ export
87
89
  WebController,
88
90
  MarketplaceController,
89
91
  LessonInventory,
92
+ Cart,
93
+ Checkout,
90
94
 
91
95
  Course,
92
96
  CourseReservation,
@@ -0,0 +1,82 @@
1
+ import APIController from "../apiController";
2
+
3
+ class Cart
4
+ {
5
+ static #MODULE = "Cart";
6
+
7
+ static #ADD_ITEM = "AddItem";
8
+ static #GET_ITEMS = "GetItems";
9
+ static #GET_TOTAL_PRICE = "GetTotalPrice";
10
+ static #CLEAR = "Clear";
11
+ static #APPLY_SALE_COUPON = "ApplySaleCoupon";
12
+ static #GET_APPLIED_SALE_COUPONS = "GetAppliedSaleCoupons";
13
+ static #REMOVE_SALE_COUPON = "RemoveSaleCoupon";
14
+ static #GET_SALE_AMMOUNTS = "GetSaleAmounts";
15
+ static #GET_ITEMS_COUNT = "GetItemsCount";
16
+ static #REMOVE_ITEM = "RemoveItem";
17
+
18
+ static async addItem(itemInstanceId)
19
+ {
20
+ await APIController.Post(this.#MODULE, this.#ADD_ITEM, {
21
+ "itemInstanceId": itemInstanceId
22
+ });
23
+ }
24
+
25
+ static async getItems()
26
+ {
27
+ var res = await APIController.Get(this.#MODULE, this.#GET_ITEMS);
28
+ return res;
29
+ }
30
+
31
+ static async getTotalPrice()
32
+ {
33
+ var res = await APIController.Get(this.#MODULE, this.#GET_TOTAL_PRICE);
34
+ return res;
35
+ }
36
+
37
+ static async clear()
38
+ {
39
+ await APIController.Post(this.#MODULE, this.#CLEAR);
40
+ }
41
+
42
+ static async applySaleCoupon(code)
43
+ {
44
+ await APIController.Post(this.#MODULE, this.#APPLY_SALE_COUPON, {
45
+ "code": code
46
+ });
47
+ }
48
+
49
+ static async getAppliedSaleCoupons()
50
+ {
51
+ var res = await APIController.Get(this.#MODULE, this.#GET_APPLIED_SALE_COUPONS);
52
+ return res;
53
+ }
54
+
55
+ static async removeSaleCoupon(code)
56
+ {
57
+ await APIController.Post(this.#MODULE, this.#REMOVE_SALE_COUPON, {
58
+ "code": code
59
+ });
60
+ }
61
+
62
+ static async getSaleAmounts()
63
+ {
64
+ var res = await APIController.Get(this.#MODULE, this.#GET_SALE_AMMOUNTS);
65
+ return res;
66
+ }
67
+
68
+ static async getItemsCount()
69
+ {
70
+ var res = await APIController.Get(this.#MODULE, this.#GET_ITEMS_COUNT);
71
+ return res;
72
+ }
73
+
74
+ static async removeItem(itemInstanceId)
75
+ {
76
+ await APIController.Post(this.#MODULE, this.#REMOVE_ITEM, {
77
+ "itemInstanceId": itemInstanceId
78
+ });
79
+ }
80
+ }
81
+
82
+ export default Cart;
@@ -0,0 +1,51 @@
1
+ class Checkout
2
+ {
3
+ static #MODULE = "Checkout";
4
+
5
+ static #GET_AVAILABLE_STATES = "GetAvailableStates";
6
+ static #PLACE_ORDER = "PlaceOrder";
7
+ static #INITIATE_PURCHASE = "InitiatePurchase";
8
+ static #GET_TRANSACTION_STATUS = "GetTransactionStatus";
9
+ static #UPDATE_PAYMENT_STATUS_EXTERNAL = "UpdatePaymentStatusExternal";
10
+
11
+ static async getAvailableStates()
12
+ {
13
+ var res = await APIController.Get(this.#MODULE, this.#GET_AVAILABLE_STATES);
14
+ return res;
15
+ }
16
+
17
+ static async placeOrder(billingInfo, customerId = null)
18
+ {
19
+ var res = await APIController.Post(this.#MODULE, this.#PLACE_ORDER, {
20
+ "billingInfo": JSON.stringify(billingInfo),
21
+ "customerId": customerId
22
+ });
23
+ return res;
24
+ }
25
+
26
+ static async initiatePurchase(orderId)
27
+ {
28
+ var res = await APIController.Post(this.#MODULE, this.#INITIATE_PURCHASE, {
29
+ "orderId": orderId
30
+ });
31
+ return res;
32
+ }
33
+
34
+ static async getTransactionStatus(comgateId)
35
+ {
36
+ var res = await APIController.Get(this.#MODULE, this.#GET_TRANSACTION_STATUS, {
37
+ "comgateId": comgateId
38
+ });
39
+ return res;
40
+ }
41
+
42
+ static async updatePaymentStatusExternal(status, paymentId)
43
+ {
44
+ await APIController.Post(this.#MODULE, this.#UPDATE_PAYMENT_STATUS_EXTERNAL, {
45
+ "status": status,
46
+ "paymentId": paymentId
47
+ });
48
+ }
49
+ }
50
+
51
+ export default Checkout;
@@ -42,18 +42,13 @@ class CustomerAuth
42
42
  *
43
43
  * @param {*} email
44
44
  * @param {*} pass
45
- * @param {*} fname
46
- * @param {*} lname
47
45
  * @returns Int (AuthResult)
48
46
  */
49
- static async SignIn(email, pass, fname, lname, phone)
47
+ static async SignIn(email, pass)
50
48
  {
51
49
  var result = await APIController.Post(this.#MODULE, this.#SIGN_IN, {
52
50
  'email': email,
53
51
  'pass': pass,
54
- 'fname': fname,
55
- 'lname': lname,
56
- 'phone': phone,
57
52
  });
58
53
 
59
54
  return result;
@@ -10,6 +10,9 @@
10
10
  import BillingInfo from "../objects/billingInfo";
11
11
  import APIController from "./../apiController";
12
12
 
13
+ /**
14
+ * @deprecated
15
+ */
13
16
  class ReservationSystem
14
17
  {
15
18
  /**
@@ -18,122 +21,8 @@ class ReservationSystem
18
21
  static #MODULE = "ReservationSystem";
19
22
 
20
23
  static #SEND_REQUEST = "SendRequest";
21
- static #ADD_ITEM_TO_CART = "AddItemToCart";
22
- static #GET_CART_ITEMS = "GetCartItems";
23
- static #GET_TOTAL_PRICE = "GetTotalPrice";
24
- static #PLACE_ORDER = "PlaceOrder";
25
- static #SEND_ORDER_CONFIRMATION_EMAIL = "SendOrderConfirmationEmail";
26
- static #CLEAR_CART = "ClearCart";
27
- static #APPLY_SALE_COUPON = "ApplySaleCoupon";
28
- static #GET_APPLIED_SALE_COUPONS = "GetAppliedSaleCoupons";
29
- static #REMOVE_SALE_COUPON = "RemoveSaleCoupon";
30
- static #GET_SALE_AMOUNTS = "GetSaleAmounts";
31
- static #GET_CART_ITEMS_COUNT = "GetCartItemsCount";
32
- static #REMOVE_ITEM_FROM_CART = "RemoveItemFromCart";
33
- static #GET_AVAILABLE_STATES = "GetAvailableStates";
34
- static #ORDER_IS_PLACED = "OrderIsPlaced";
35
-
36
- static async orderIsPlaced()
37
- {
38
- var res = await APIController.Get(this.#MODULE, this.#ORDER_IS_PLACED);
39
-
40
- return res;
41
- }
42
-
43
- static async getAvailableStates()
44
- {
45
- var states = await APIController.Get(this.#MODULE, this.#GET_AVAILABLE_STATES, {}, true);
46
- return states;
47
- }
48
-
49
- static async removeItemFromCart(itemSku)
50
- {
51
- await APIController.Post(this.#MODULE, this.#REMOVE_ITEM_FROM_CART, { 'sku': itemSku });
52
- }
53
-
54
- static async getCartItemsCount()
55
- {
56
- var count = await APIController.Get(this.#MODULE, this.#GET_CART_ITEMS_COUNT);
57
- return count;
58
- }
59
-
60
-
61
- static async addItemToCart(itemSku)
62
- {
63
- await APIController.Post(this.#MODULE, this.#ADD_ITEM_TO_CART, { 'itemSku': itemSku });
64
- }
65
-
66
- static async getCartItems()
67
- {
68
- var items = await APIController.Get(this.#MODULE, this.#GET_CART_ITEMS);
69
-
70
- return items;
71
- }
72
-
73
- static async getTotalPrice()
74
- {
75
- var price = await APIController.Get(this.#MODULE, this.#GET_TOTAL_PRICE);
76
-
77
- return price;
78
- }
79
24
 
80
- /**
81
- *
82
- * @param {BillingInfo} billingInfo - BillingInfo model expected. You can use prepared js object or create just array.
83
- * @param {*} proforma
84
- * @param {*} vopAgree
85
- * @param {*} gdprAgree
86
- * @returns order id
87
- */
88
- static async placeOrder(billingInfo, proforma = 1, vopAgree = 0, gdprAgree = 0)
89
- {
90
- var orderId = await APIController.Post(this.#MODULE, this.#PLACE_ORDER, {
91
- 'billingInfo': JSON.stringify(billingInfo),
92
- 'proforma': proforma,
93
- 'vopAgree': vopAgree,
94
- 'gdprAgree': gdprAgree
95
- });
96
-
97
- return orderId;
98
- }
99
-
100
- static async sendOrderConfirmationEmail()
101
- {
102
- await APIController.Get(this.#MODULE, this.#SEND_ORDER_CONFIRMATION_EMAIL);
103
- }
104
-
105
- static async clearCart()
106
- {
107
- await APIController.Post(this.#MODULE, this.#CLEAR_CART);
108
- }
109
-
110
- static async applySaleCoupon(code)
111
- {
112
- await APIController.Post(this.#MODULE, this.#APPLY_SALE_COUPON, { 'code': code });
113
- }
114
-
115
- static async getAppliedSaleCoupons()
116
- {
117
- var coupons = await APIController.Get(this.#MODULE, this.#GET_APPLIED_SALE_COUPONS);
118
25
 
119
- return coupons;
120
- }
121
-
122
- static async removeSaleCoupon(code)
123
- {
124
- await APIController.Post(this.#MODULE, this.#REMOVE_SALE_COUPON, { 'code': code });
125
- }
126
-
127
- /**
128
- *
129
- * @returns {Promise<array>} - array - sale amounts as sku=>amount
130
- */
131
- static async getSaleAmounts()
132
- {
133
- var amounts = await APIController.Get(this.#MODULE, this.#GET_SALE_AMOUNTS);
134
-
135
- return amounts;
136
- }
137
26
 
138
27
  /**
139
28
  * Send request for tutoring. Will register as inquiry and it's id will be returned.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itutoring/itutoring_application_js_api",
3
- "version": "1.10.3",
3
+ "version": "1.11.0",
4
4
  "description": "Javascript API for iTutoring Application",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",