biz9-logic 4.9.20 → 4.9.25
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 +23 -13
- package/package.json +1 -1
- package/test.js +14 -14
package/biz9_config
CHANGED
package/index.js
CHANGED
|
@@ -86,11 +86,11 @@ class Title {
|
|
|
86
86
|
static ORDER_TRANSACTION_ID="TR-";
|
|
87
87
|
static ORDER_PAYMENT_STATUS_OPEN="Open";
|
|
88
88
|
static ORDER_PAYMENT_STATUS_COMPLETE="Complete";
|
|
89
|
+
static ORDER_PAYMENT_PLAN_PENDING="Pending";
|
|
89
90
|
static ORDER_PAYMENT_PLAN_1="1 Payment";
|
|
90
91
|
static ORDER_PAYMENT_PLAN_2="2 Payments";
|
|
91
92
|
static ORDER_PAYMENT_PLAN_3="3 Payments";
|
|
92
93
|
static ORDER_PAYMENT_PLAN_4="4 Payments";
|
|
93
|
-
static ORDER_PAYMENT_PLAN_5="5 Payments";
|
|
94
94
|
static ORDER_PAYMENT_METHOD_STRIPE="Stripe";
|
|
95
95
|
static ORDER_PAYMENT_METHOD_CASH="Cash";
|
|
96
96
|
static ORDER_PAYMENT_METHOD_OTHER="Other";
|
|
@@ -168,6 +168,20 @@ class Demo_Logic {
|
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
class Type {
|
|
171
|
+
|
|
172
|
+
static get_stat_list = () =>{
|
|
173
|
+
return [
|
|
174
|
+
{title:Type.get_title(Type.STAT_VIEW),type:Type.STAT_VIEW,label:Type.get_title(Type.STAT_VIEW),value:Type.STAT_VIEW},
|
|
175
|
+
{title:Type.get_title(Type.STAT_LOGIN),type:Type.STAT_LOGIN,label:Type.get_title(Type.STAT_LOGIN),value:Type.STAT_LOGIN},
|
|
176
|
+
{title:Type.get_title(Type.STAT_REGISTER),type:Type.STAT_REGISTER,label:Type.get_title(Type.STAT_REGISTER),value:Type.STAT_REGISTER},
|
|
177
|
+
{title:Type.get_title(Type.STAT_LIKE),type:Type.STAT_LIKE,label:Type.get_title(Type.STAT_LIKE),value:Type.STAT_LIKE},
|
|
178
|
+
{title:Type.get_title(Type.STAT_FAVORITE),type:Type.STAT_FAVORITE,label:Type.get_title(Type.STAT_FAVORITE),value:Type.STAT_FAVORITE},
|
|
179
|
+
{title:Type.get_title(Type.STAT_CART),type:Type.STAT_CART,label:Type.get_title(Type.STAT_CART),value:Type.STAT_CART},
|
|
180
|
+
{title:Type.get_title(Type.STAT_ORDER),type:Type.STAT_ORDER,label:Type.get_title(Type.STAT_ORDER),value:Type.STAT_ORDER},
|
|
181
|
+
{title:Type.get_title(Type.STAT_REVIEW),type:Type.STAT_REVIEW,label:Type.get_title(Type.STAT_REVIEW),value:Type.STAT_REVIEW},
|
|
182
|
+
]
|
|
183
|
+
};
|
|
184
|
+
|
|
171
185
|
//page
|
|
172
186
|
static PAGE_ABOUT='about';
|
|
173
187
|
static PAGE_CONTACT='contact';
|
|
@@ -450,7 +464,8 @@ class Page_Logic {
|
|
|
450
464
|
};
|
|
451
465
|
}
|
|
452
466
|
class Order_Logic {
|
|
453
|
-
static get_new = (cart) => {
|
|
467
|
+
static get_new = (cart,option) => {
|
|
468
|
+
option = option?option:{get_payment_plan:false,payment_plan:Title.ORDER_PAYMENT_PLAN_1,payment_plan_status:Title.ORDER_PAYMENT_STATUS_OPEN};
|
|
454
469
|
let order = DataItem.get_new(DataType.ORDER,0,{
|
|
455
470
|
order_number:Title.ORDER_NUMBER + Num.get_id(99999),
|
|
456
471
|
parent_data_type:cart.parent_data_type,
|
|
@@ -459,6 +474,10 @@ class Order_Logic {
|
|
|
459
474
|
grand_total:0,
|
|
460
475
|
order_item_list:[]
|
|
461
476
|
});
|
|
477
|
+
if(option.get_payment_plan){
|
|
478
|
+
order.payment_plan = option.payment_plan;
|
|
479
|
+
order.payment_status = option.payment_plan_status;
|
|
480
|
+
}
|
|
462
481
|
cart.cart_item_list.forEach(cart_item => {
|
|
463
482
|
let order_item = DataItem.get_new(DataType.ORDER_ITEM,0,{
|
|
464
483
|
order_number:order.order_number,
|
|
@@ -482,7 +501,6 @@ class Order_Logic {
|
|
|
482
501
|
});
|
|
483
502
|
order.order_item_list.push(order_item);
|
|
484
503
|
});
|
|
485
|
-
order = Order_Logic.get_total(order);
|
|
486
504
|
return order;
|
|
487
505
|
};
|
|
488
506
|
static get_new_order_payment = (order_number,payment_method_type,payment_amount) => {
|
|
@@ -491,7 +509,6 @@ class Order_Logic {
|
|
|
491
509
|
order_number:order_number,
|
|
492
510
|
payment_method_type:payment_method_type,
|
|
493
511
|
payment_amount:payment_amount,
|
|
494
|
-
payment_amount:payment_amount,
|
|
495
512
|
transaction_id:Title.ORDER_TRANSACTION_ID + Num.get_id(99999)
|
|
496
513
|
});
|
|
497
514
|
};
|
|
@@ -516,15 +533,8 @@ class Order_Logic {
|
|
|
516
533
|
};
|
|
517
534
|
}
|
|
518
535
|
class Cart_Logic {
|
|
519
|
-
static get_new = (parent_data_type,user_id
|
|
520
|
-
|
|
521
|
-
Log.w('rrrrr',option);
|
|
522
|
-
let order = DataItem.get_new(DataType.CART,0,{user_id:user_id,cart_number:Title.CART_NUMBER + Num.get_id(99999),parent_data_type:parent_data_type,grand_total:0,cart_item_list:[]});
|
|
523
|
-
if(option.get_payment_plan){
|
|
524
|
-
order.payment_plan = option.payment_plan;
|
|
525
|
-
order.payment_status = option.payment_plan_status;
|
|
526
|
-
}
|
|
527
|
-
return order;
|
|
536
|
+
static get_new = (parent_data_type,user_id) => {
|
|
537
|
+
return DataItem.get_new(DataType.CART,0,{user_id:user_id,cart_number:Title.CART_NUMBER + Num.get_id(99999),parent_data_type:parent_data_type,grand_total:0,cart_item_list:[]});
|
|
528
538
|
};
|
|
529
539
|
static get_new_cart_item = (parent_data_type,parent_id,cart_number,quanity,cost) =>{
|
|
530
540
|
return DataItem.get_new(DataType.CART_ITEM,0,{parent_data_type:parent_data_type,parent_id:parent_id,cart_number:cart_number,quanity:quanity?quanity:0,cost:cost?cost:0,cart_sub_item_list:[]});
|
package/package.json
CHANGED
package/test.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const series = require('async-series');
|
|
2
|
-
const {DataItem,DataType,Page_Logic,Product_Logic,Type,Title,Stat_Logic,Service_Logic,Blog_Post_Logic,Event_Logic,Demo_Logic,Cart_Logic} = require('./index');
|
|
2
|
+
const {DataItem,DataType,Page_Logic,Product_Logic,Type,Title,Stat_Logic,Service_Logic,Blog_Post_Logic,Event_Logic,Demo_Logic,Cart_Logic,Order_Logic} = require('./index');
|
|
3
3
|
const {Log,Num,Str} = require('biz9-utility');
|
|
4
4
|
const {Scriptz}= require('biz9-scriptz');
|
|
5
5
|
|
|
@@ -32,21 +32,21 @@ describe("connect", () => {
|
|
|
32
32
|
function(call) {
|
|
33
33
|
console.log('CONNECT-START');
|
|
34
34
|
|
|
35
|
-
let post_cart =
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
let
|
|
39
|
-
let
|
|
40
|
-
let
|
|
41
|
-
|
|
42
|
-
post_cart_item.cart_sub_item_list.push(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
Log.w('post_cart',post_cart);
|
|
35
|
+
let post_cart = {};
|
|
36
|
+
//let post_cart = Cart_Logic.get_new(DataType.PRODUCT,0,);
|
|
37
|
+
Log.w('11_type',Type.get_stat_list());
|
|
38
|
+
//let post_cart_list = [];
|
|
39
|
+
//let post_cart_item = Cart_Logic.get_new_cart_item(DataType.PRODUCT,123,post_cart.cart_number,1,30);
|
|
40
|
+
//let post_cart_sub_item = Cart_Logic.get_new_cart_sub_item(DataType.PRODUCT,1234,post_cart.cart_number,1,10);
|
|
41
|
+
//let post_cart_sub_item_2 = Cart_Logic.get_new_cart_sub_item(DataType.PRODUCT,1234,post_cart.cart_number,1,30);
|
|
42
|
+
//post_cart_item.cart_sub_item_list.push(post_cart_sub_item);
|
|
43
|
+
//post_cart_item.cart_sub_item_list.push(post_cart_sub_item_2);
|
|
44
|
+
//post_cart.cart_item_list.push(post_cart_item);
|
|
45
|
+
|
|
46
|
+
//Log.w('post_cart',post_cart);
|
|
47
|
+
//Log.w('post_order',Order_Logic.get_new(post_cart,{get_payment_plan:true,payment_plan:Title.ORDER_PAYMENT_PLAN_1,payment_plan_status:Title.ORDER_PAYMENT_STATUS_OPEN}));
|
|
47
48
|
//Log.w('post_cart_2',Cart_Logic.get_total(post_cart));
|
|
48
49
|
|
|
49
|
-
|
|
50
50
|
console.log('CONNECT-END');
|
|
51
51
|
//call();
|
|
52
52
|
},
|