biz9-logic 4.8.259 → 4.8.263
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/biz9_config +1 -1
- package/index.js +61 -74
- package/package.json +1 -1
package/biz9_config
CHANGED
package/index.js
CHANGED
|
@@ -187,12 +187,11 @@ class Stat_Logic {
|
|
|
187
187
|
static STAT_ORDER_ADD_ID='5';
|
|
188
188
|
static STAT_REVIEW_ADD_ID='6';
|
|
189
189
|
*/
|
|
190
|
-
static get_new = (
|
|
190
|
+
static get_new = (user_id,stat_type_id,parent_item_list)=>{
|
|
191
191
|
return {
|
|
192
|
-
item_data_type:item_data_type,
|
|
193
192
|
user_id:user_id,
|
|
194
193
|
stat_type_id:stat_type_id,
|
|
195
|
-
|
|
194
|
+
parent_item_list:parent_item_list,
|
|
196
195
|
}
|
|
197
196
|
}
|
|
198
197
|
}
|
|
@@ -223,69 +222,60 @@ class Order_Logic {
|
|
|
223
222
|
static get_transaction_id = () => {
|
|
224
223
|
return FieldType.TRANSACTION_ID + Num.get_id(99999);
|
|
225
224
|
};
|
|
225
|
+
static get_order = (cart) => {
|
|
226
|
+
let order = DataItem.get_new(DataType.ORDER,0,{
|
|
227
|
+
order_number:Order_Logic.get_order_number(),
|
|
228
|
+
parent_data_type:cart.parent_data_type,
|
|
229
|
+
user_id:cart.user_id,
|
|
230
|
+
cart_number:cart.cart_number,
|
|
231
|
+
grand_total:cart.grand_total,
|
|
232
|
+
order_item_list:[]
|
|
233
|
+
});
|
|
234
|
+
cart.cart_item_list.forEach(cart_item => {
|
|
235
|
+
let order_item = DataItem.get_new(DataType.ORDER_ITEM,0,{
|
|
236
|
+
order_number:order.order_number,
|
|
237
|
+
parent_data_type:cart_item.parent_data_type,
|
|
238
|
+
parent_id:cart_item.parent_id,
|
|
239
|
+
user_id:order.user_id,
|
|
240
|
+
quanity:cart_item.quanity,
|
|
241
|
+
order_sub_item_list:[]
|
|
242
|
+
});
|
|
243
|
+
cart_item.cart_sub_item_list.forEach(cart_sub_item => {
|
|
244
|
+
let order_sub_item = DataItem.get_new(DataType.ORDER_SUB_ITEM,0,{
|
|
245
|
+
order_number:order.order_number,
|
|
246
|
+
parent_data_type:cart_sub_item.parent_data_type,
|
|
247
|
+
parent_id:cart_sub_item.parent_id,
|
|
248
|
+
user_id:order.user_id,
|
|
249
|
+
quanity:cart_sub_item.quanity
|
|
250
|
+
})
|
|
251
|
+
order_item.order_sub_item_list.push(order_sub_item);
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
order.order_item_list.push(order_item);
|
|
255
|
+
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
return order;
|
|
259
|
+
};
|
|
260
|
+
static get_order_item_old = (cart_item,order_number) =>{
|
|
261
|
+
return DataItem.get_new(DataType.ORDER_ITEM,0,{order_number:order_number,parent_data_type:cart_item.parent_data_type,parent_id:cart_item.parent_id,user_id:cart_item.user_id,quanity:cart_item.quanity,order_sub_item_list:[]});
|
|
262
|
+
};
|
|
263
|
+
static get_order_sub_item_old = (cart_sub_item,order_number) =>{
|
|
264
|
+
return DataItem.get_new(DataType.ORDER_SUB_ITEM,0,{order_number:order_number,parent_data_type:cart_sub_item.parent_data_type,parent_id:cart_sub_item.parent_id,user_id:cart_sub_item.user_id,quanity:cart_sub_item.quanity,});
|
|
265
|
+
};
|
|
226
266
|
}
|
|
227
267
|
class Cart_Logic {
|
|
228
268
|
static get_cart_number = () => {
|
|
229
269
|
return FieldType.CART_NUMBER + Num.get_id(99999);
|
|
230
270
|
};
|
|
231
|
-
static get_cart = (user_id) => {
|
|
232
|
-
return DataItem.get_new(DataType.CART,0,{
|
|
233
|
-
};
|
|
234
|
-
static get_cart_item = (item_data_type,item_id,cart_number,user_id,quanity) =>{
|
|
235
|
-
return DataItem.get_new(DataType.CART_ITEM,0,{item_data_type:item_data_type,item_id:item_id,cart_number:cart_number,user_id:user_id,quanity:quanity,sub_total:0,cart_sub_item_list:[]});
|
|
236
|
-
};
|
|
237
|
-
static get_test_item = (cart_item_id,cart_number,user_id,item_data_type,item_id,option) =>{
|
|
238
|
-
option = Field_Logic.get_option(DataType.CART_ITEM,option?option:{generate_id:Str.check_is_null(cart_item_id)? true : false });
|
|
239
|
-
let cart_item = DataItem.get_new(DataType.CART_ITEM,Num.get_guid(),Field_Logic.get_test("Cart Item "+Num.get_id(),option));
|
|
240
|
-
cart_item.cart_item_id = cart_item_id;
|
|
241
|
-
cart_item.cart_number = cart_number;
|
|
242
|
-
cart_item.user_id = user_id;
|
|
243
|
-
cart_item.item_data_type = item_data_type;
|
|
244
|
-
cart_item.item_id = item_id;
|
|
245
|
-
if(option.get_cart_sub_item){
|
|
246
|
-
cart_item.cart_sub_item_list = [];
|
|
247
|
-
for(let a = 0;a<option.cart_sub_item_count;a++){
|
|
248
|
-
let cart_sub_item = Cart_Logic.get_test_sub_item(cart_number,user_id,cart_item.id,item_data_type,item_id,{get_value:true,get_cart_sub_item:option.get_cart_sub_item,cart_sub_item_count:option.cart_sub_item_count});
|
|
249
|
-
cart_item.cart_sub_item_list.push(cart_sub_item);
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
return cart_item;
|
|
253
|
-
};
|
|
254
|
-
static get_test_sub_item = (cart_number,user_id,cart_item_id,parent_data_type,parent_id,option) =>{
|
|
255
|
-
option = Field_Logic.get_option(DataType.CART_SUB_ITEM,option?option:{});
|
|
256
|
-
let item_blank = Item_Logic.get_test('Sub Item '+Num.get_id(),DataType.ITEM,0,{generate_id:true});
|
|
257
|
-
let cart_sub_item = DataItem.get_new(DataType.CART_SUB_ITEM,Num.get_guid(),Field_Logic.get_test("Cart Sub Item "+Num.get_id(),option));
|
|
258
|
-
cart_sub_item.cart_number = cart_number;
|
|
259
|
-
cart_sub_item.user_id = user_id;
|
|
260
|
-
cart_sub_item.cart_item_id = cart_item_id;
|
|
261
|
-
cart_sub_item.parent_data_type = item_blank.data_type;
|
|
262
|
-
cart_sub_item.parent_id = item_blank.id;
|
|
263
|
-
cart_sub_item.cost = Field_Logic.get_test_cost();
|
|
264
|
-
cart_sub_item.parent_item = item_blank;
|
|
265
|
-
return cart_sub_item;
|
|
271
|
+
static get_cart = (parent_data_type,user_id) => {
|
|
272
|
+
return DataItem.get_new(DataType.CART,0,{cart_number:Cart_Logic.get_cart_number(),parent_data_type:parent_data_type,user_id:user_id,grand_total:0,cart_item_list:[]});
|
|
266
273
|
};
|
|
267
|
-
static
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
}
|
|
273
|
-
return item_list;
|
|
274
|
-
}
|
|
275
|
-
static get_test_list_by_category = (option) =>{
|
|
276
|
-
option = Field_Logic.get_option(DataType.PRODUCT,option?option:{});
|
|
277
|
-
let product_list = [];
|
|
278
|
-
let category_list = Category_Logic.get_type_category_list(DataType.PRODUCT,option.category_count);
|
|
279
|
-
let item_count = 0;
|
|
280
|
-
for(let a=0;a<category_list.length;a++){
|
|
281
|
-
for(let b=0;b<option.product_count;b++){
|
|
282
|
-
item_count++;
|
|
283
|
-
let product = Product_Logic.get_test("Product "+String(parseInt(b+1)),option);
|
|
284
|
-
product.category = category_list[Num.get_id(category_list.length+1)].title;
|
|
285
|
-
product_list.push(product);
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
return [category_list,product_list]
|
|
274
|
+
static get_cart_item = (parent_data_type,parent_id,cart_number,user_id,quanity) =>{
|
|
275
|
+
return DataItem.get_new(DataType.CART_ITEM,0,{parent_data_type:parent_data_type,parent_id:parent_id,cart_number:cart_number,user_id:user_id,quanity:quanity,cart_sub_item_list:[]});
|
|
276
|
+
};
|
|
277
|
+
static get_cart_sub_item = (parent_data_type,parent_id,cart_number,user_id,quanity) =>{
|
|
278
|
+
return DataItem.get_new(DataType.CART_ITEM,0,{parent_data_type:parent_data_type,parent_id:parent_id,cart_number:cart_number,user_id:user_id,quanity:quanity});
|
|
289
279
|
};
|
|
290
280
|
}
|
|
291
281
|
class Product_Logic {
|
|
@@ -821,22 +811,19 @@ class FieldType {
|
|
|
821
811
|
static CART_NUMBER="CA-";
|
|
822
812
|
static TRANSACTION_ID="TR-";
|
|
823
813
|
|
|
824
|
-
static
|
|
825
|
-
static
|
|
826
|
-
static PAYMENT_PLAN_3="3 Payments";
|
|
827
|
-
static PAYMENT_PLAN_4="4 Payments";
|
|
828
|
-
|
|
829
|
-
static ORDER_STATUS_NEW="New";
|
|
830
|
-
static ORDER_STATUS_OPEN="Open";
|
|
831
|
-
static ORDER_STATUS_PAYMENT="Payment Plan";
|
|
832
|
-
static ORDER_STATUS_COMPLETE="Complete";
|
|
814
|
+
static ORDER_PAYMENT_STATUS_OPEN="Open";
|
|
815
|
+
static ORDER_PAYMENT_STATUS_COMPLETE="Complete";
|
|
833
816
|
|
|
834
|
-
static
|
|
817
|
+
static PAYMENT_PLAN_TYPE_PENDING="Pending";
|
|
818
|
+
static PAYMENT_PLAN_TYPE_1="1 Payment";
|
|
819
|
+
static PAYMENT_PLAN_TYPE_2="2 Payments";
|
|
820
|
+
static PAYMENT_PLAN_TYPE_3="3 Payments";
|
|
821
|
+
static PAYMENT_PLAN_TYPE_4="4 Payments";
|
|
835
822
|
|
|
836
|
-
static
|
|
837
|
-
static
|
|
838
|
-
static
|
|
839
|
-
static
|
|
823
|
+
static PAYMENT_TYPE_STRIPE="Stripe";
|
|
824
|
+
static PAYMENT_TYPE_CASH="Cash";
|
|
825
|
+
static PAYMENT_TYPE_OTHER="Other";
|
|
826
|
+
static PAYMENT_TYPE_TEST="Test";
|
|
840
827
|
|
|
841
828
|
static APP_TYPE_MOBILE="Mobile";
|
|
842
829
|
static APP_TYPE_WEBSITE="Website";
|