biz9-logic 4.9.20 → 4.9.21
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 +9 -12
- package/package.json +1 -1
- package/test.js +13 -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";
|
|
@@ -450,7 +450,8 @@ class Page_Logic {
|
|
|
450
450
|
};
|
|
451
451
|
}
|
|
452
452
|
class Order_Logic {
|
|
453
|
-
static get_new = (cart) => {
|
|
453
|
+
static get_new = (cart,option) => {
|
|
454
|
+
option = option?option:{get_payment_plan:false,payment_plan:Title.ORDER_PAYMENT_PLAN_1,payment_plan_status:Title.ORDER_PAYMENT_STATUS_OPEN};
|
|
454
455
|
let order = DataItem.get_new(DataType.ORDER,0,{
|
|
455
456
|
order_number:Title.ORDER_NUMBER + Num.get_id(99999),
|
|
456
457
|
parent_data_type:cart.parent_data_type,
|
|
@@ -459,6 +460,10 @@ class Order_Logic {
|
|
|
459
460
|
grand_total:0,
|
|
460
461
|
order_item_list:[]
|
|
461
462
|
});
|
|
463
|
+
if(option.get_payment_plan){
|
|
464
|
+
order.payment_plan = option.payment_plan;
|
|
465
|
+
order.payment_status = option.payment_plan_status;
|
|
466
|
+
}
|
|
462
467
|
cart.cart_item_list.forEach(cart_item => {
|
|
463
468
|
let order_item = DataItem.get_new(DataType.ORDER_ITEM,0,{
|
|
464
469
|
order_number:order.order_number,
|
|
@@ -491,7 +496,6 @@ class Order_Logic {
|
|
|
491
496
|
order_number:order_number,
|
|
492
497
|
payment_method_type:payment_method_type,
|
|
493
498
|
payment_amount:payment_amount,
|
|
494
|
-
payment_amount:payment_amount,
|
|
495
499
|
transaction_id:Title.ORDER_TRANSACTION_ID + Num.get_id(99999)
|
|
496
500
|
});
|
|
497
501
|
};
|
|
@@ -516,15 +520,8 @@ class Order_Logic {
|
|
|
516
520
|
};
|
|
517
521
|
}
|
|
518
522
|
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;
|
|
523
|
+
static get_new = (parent_data_type,user_id) => {
|
|
524
|
+
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
525
|
};
|
|
529
526
|
static get_new_cart_item = (parent_data_type,parent_id,cart_number,quanity,cost) =>{
|
|
530
527
|
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,20 @@ describe("connect", () => {
|
|
|
32
32
|
function(call) {
|
|
33
33
|
console.log('CONNECT-START');
|
|
34
34
|
|
|
35
|
-
let post_cart = Cart_Logic.get_new(DataType.PRODUCT,0,
|
|
36
|
-
|
|
37
|
-
let post_cart_list = [];
|
|
38
|
-
let post_cart_item = Cart_Logic.get_new_cart_item(DataType.PRODUCT,123,post_cart.cart_number,1,30);
|
|
39
|
-
let post_cart_sub_item = Cart_Logic.get_new_cart_sub_item(DataType.PRODUCT,1234,post_cart.cart_number,1,10);
|
|
40
|
-
let post_cart_sub_item_2 = Cart_Logic.get_new_cart_sub_item(DataType.PRODUCT,1234,post_cart.cart_number,1,30);
|
|
41
|
-
post_cart_item.cart_sub_item_list.push(post_cart_sub_item);
|
|
42
|
-
post_cart_item.cart_sub_item_list.push(post_cart_sub_item_2);
|
|
43
|
-
post_cart.cart_item_list.push(post_cart_item);
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
Log.w('
|
|
35
|
+
//let post_cart = Cart_Logic.get_new(DataType.PRODUCT,0,);
|
|
36
|
+
let post_cart = Cart_Logic.get_new(DataType.PRODUCT,0);
|
|
37
|
+
//let post_cart_list = [];
|
|
38
|
+
//let post_cart_item = Cart_Logic.get_new_cart_item(DataType.PRODUCT,123,post_cart.cart_number,1,30);
|
|
39
|
+
//let post_cart_sub_item = Cart_Logic.get_new_cart_sub_item(DataType.PRODUCT,1234,post_cart.cart_number,1,10);
|
|
40
|
+
//let post_cart_sub_item_2 = Cart_Logic.get_new_cart_sub_item(DataType.PRODUCT,1234,post_cart.cart_number,1,30);
|
|
41
|
+
//post_cart_item.cart_sub_item_list.push(post_cart_sub_item);
|
|
42
|
+
//post_cart_item.cart_sub_item_list.push(post_cart_sub_item_2);
|
|
43
|
+
//post_cart.cart_item_list.push(post_cart_item);
|
|
44
|
+
|
|
45
|
+
//Log.w('post_cart',post_cart);
|
|
46
|
+
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
47
|
//Log.w('post_cart_2',Cart_Logic.get_total(post_cart));
|
|
48
48
|
|
|
49
|
-
|
|
50
49
|
console.log('CONNECT-END');
|
|
51
50
|
//call();
|
|
52
51
|
},
|