biz9-logic 4.9.11 → 4.9.13

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.
Files changed (3) hide show
  1. package/biz9_config +1 -1
  2. package/index.js +9 -8
  3. package/package.json +1 -1
package/biz9_config CHANGED
@@ -1,4 +1,4 @@
1
- VERSION='8.8.1'
1
+ VERSION='8.8.3'
2
2
  TITLE='BiZ9-Logic';
3
3
  REPO='git@github.com:biz9framework/biz9-logic.git';
4
4
  BRANCH='main';
package/index.js CHANGED
@@ -456,7 +456,7 @@ class Order_Logic {
456
456
  parent_data_type:cart.parent_data_type,
457
457
  user_id:cart.user_id,
458
458
  cart_number:cart.cart_number,
459
- grand_total:cart.grand_total,
459
+ grand_total:0,
460
460
  order_item_list:[]
461
461
  });
462
462
  cart.cart_item_list.forEach(cart_item => {
@@ -481,9 +481,8 @@ class Order_Logic {
481
481
  order_item.order_sub_item_list.push(order_sub_item);
482
482
  });
483
483
  order.order_item_list.push(order_item);
484
-
485
484
  });
486
- order = Order_Logic.caculate_total(order);
485
+ order = Order_Logic.get_total(order);
487
486
  return order;
488
487
  };
489
488
  static get_new_order_payment = (order_number,payment_method_type,payment_amount) => {
@@ -495,22 +494,23 @@ class Order_Logic {
495
494
  transaction_id:Order_Logic.TRANSACTION_ID + Num.get_id(99999)
496
495
  });
497
496
  };
498
- static caculate_total = (order) => {
497
+ static get_total = (order) => {
499
498
  let grand_total = 0;
500
499
  order.order_item_list.forEach(order_item => {
501
500
  order_item.sub_total = 0;
502
501
  if(!isNaN(order_item.cost)){
503
502
  order_item.sub_total = (order_item.sub_total + order_item.cost) * order_item.quanity;
504
- order.grand_total = order.grand_total + order_item.sub_total;
503
+ grand_total = grand_total + order_item.sub_total;
505
504
  }
506
505
  order_item.order_sub_item_list.forEach(order_sub_item => {
507
506
  order_sub_item.sub_total = 0;
508
507
  if(!isNaN(order_sub_item.cost)){
509
508
  order_sub_item.sub_total = (order_sub_item.sub_total + order_sub_item.cost) * order_sub_item.quanity;
510
- order.grand_total = order.grand_total + order_sub_item.sub_total;
509
+ grand_total = grand_total + order_sub_item.sub_total;
511
510
  }
512
511
  });
513
512
  });
513
+ order.grand_total = grand_total;
514
514
  return order;
515
515
  };
516
516
  }
@@ -524,7 +524,7 @@ class Cart_Logic {
524
524
  static get_new_cart_sub_item = (parent_data_type,parent_id,cart_number,quanity,cost) =>{
525
525
  return DataItem.get_new(DataType.CART_SUB_ITEM,0,{parent_data_type:parent_data_type,parent_id:parent_id,cart_number:cart_number,quanity:quanity,cost:cost?cost:0});
526
526
  };
527
- static get_grand_total = (cart) => {
527
+ static get_total = (cart) => {
528
528
  let grand_total = 0;
529
529
  cart.cart_item_list.forEach(cart_item => {
530
530
  cart_item.sub_total = 0;
@@ -540,7 +540,8 @@ class Cart_Logic {
540
540
  }
541
541
  });
542
542
  });
543
- return grand_total;
543
+ cart.grand_total = grand_total;
544
+ return cart;
544
545
  };
545
546
  }
546
547
  class Product_Logic {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "biz9-logic",
3
- "version": "4.9.11",
3
+ "version": "4.9.13",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"