biz9-store 1.0.71 → 1.0.76

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 CHANGED
@@ -1,4 +1,4 @@
1
- VERSION='1.0.71'
1
+ VERSION='1.0.76'
2
2
  TITLE='BiZ9-Store'
3
3
  REPO='git@github.com:biz9framework/biz9-store.git'
4
4
  BRANCH='main'
package/constant.js ADDED
@@ -0,0 +1,19 @@
1
+ const Config = {
2
+ TITLE:'BiZ9-Store',
3
+ APP_ID:"test-stage-may",
4
+ PORT_ID: "1904",
5
+ HOST:"http://localhost:1904",
6
+ }
7
+ class Url {
8
+ static PING="ping";
9
+ }
10
+ class Table {
11
+ static BLANK = 'blank_biz';
12
+ static PRODUCT = 'product_biz';
13
+ static USER = 'user_biz';
14
+ };
15
+ module.exports = {
16
+ Config,
17
+ Table,
18
+ Url
19
+ }
package/index.js CHANGED
@@ -5,8 +5,41 @@ License GNU General Public License v3.0
5
5
  Description: BiZ9 Framework: Store
6
6
  */
7
7
  const {Log,Str,Num,Obj}=require("biz9-utility");
8
- const {Data_Logic,Data_Field} = require("biz9-data-logic");
8
+ const {Data_Logic,Data_Field} = require("biz9-data-app");
9
+ const {Config,Data_Config,Url,Table} = require("./constant");
10
+ //const {Service} = require("./service");
11
+ class Store_Service {
12
+ static ping = async (url) => {
13
+ const [biz_response,biz_data] = await Service.ping(url);
14
+ return [biz_response,biz_data];
15
+ }
16
+ static delete_cart = async (url,cart_number) => {
17
+ const [biz_response,biz_data] = await Service.delete_cart(url,cart_number);
18
+ return [biz_response,biz_data];
19
+ }
20
+ static get_cart = async (url,cart_number) => {
21
+ const [biz_response,biz_data] = await Service.get_cart(url,cart_number);
22
+ return [biz_response,biz_data];
23
+ }
24
+ static post_cart = async (url,cart) => {
25
+ const [biz_response,biz_data] = await Service.post_cart(url,cart);
26
+ return [biz_response,biz_data];
27
+ }
28
+ static delete_order = async (url,cart_number) => {
29
+ const [biz_response,biz_data] = await Service.delete_order(url,cart_number);
30
+ return [biz_response,biz_data];
31
+ }
32
+ static get_order = async (url,cart_number) => {
33
+ const [biz_response,biz_data] = await Service.get_order(url,cart_number);
34
+ return [biz_response,biz_data];
35
+ }
36
+ static post_order = async (url,cart) => {
37
+ const [biz_response,biz_data] = await Service.post_order(url,cart);
38
+ return [biz_response,biz_data];
39
+ }
40
+ }
9
41
  class Store_Url {
42
+ static PING="biz9/store/ping";
10
43
  // -- cart --
11
44
  static CART_DELETE="biz9/store/cart_delete";
12
45
  static CART="biz9/store/cart";
@@ -61,17 +94,20 @@ class Store_Response_Field {
61
94
  static RESPONSE_ORDER_SUB_ITEMS = 'response_order_sub_items';
62
95
  }
63
96
  class Store_Table {
64
- //cart
97
+ // -- cart --
65
98
  static CART="cart_biz";
66
99
  static CART_ITEM="cart_item_biz";
67
100
  static CART_SUB_ITEM="cart_sub_item_biz";
68
- //order
101
+ // -- order --
69
102
  static ORDER_PAYMENT='order_payment_biz';
70
103
  static ORDER="order_biz";
71
104
  static ORDER_ITEM="order_item_biz";
72
105
  static ORDER_SUB_ITEM="order_sub_item_biz";
73
- //product
106
+ // -- product --
74
107
  static PRODUCT='product_biz';
108
+ // -- other --
109
+ static USER='user_biz';
110
+
75
111
  }
76
112
  class Store_Stat {
77
113
  static POST_VIEW="post_view";
@@ -94,6 +130,7 @@ class Store_Field {
94
130
  static ORDER_PAYMENTS = 'order_payments';
95
131
  //other
96
132
  static COST = 'cost';
133
+ static USER_ID = 'user_id';
97
134
  static GRAND_TOTAL = 'grand_total';
98
135
  static OLD_COST = 'old_cost';
99
136
  static STOCK = 'stock';
@@ -156,11 +193,28 @@ class Cart_Logic {
156
193
  let cart_code = option.cart_code ? option.cart_code+"-" : "CA-";
157
194
  return Data_Logic.get(Store_Table.CART,0,{data:{user_id:user_id,cart_number:cart_code + Num.get_id(99999),grand_total:0,cart_items:[]}});
158
195
  };
159
- static get_cart_item = (parent_table,parent_id,quanity,title,cost) =>{
160
- return Data_Logic.get(Store_Table.CART_ITEM,0,{data:{parent_table:parent_table,parent_id:parent_id,quanity:quanity?quanity:0,cost:cost?cost:0,title:title,cart_sub_items:[]}});
196
+ static get_cart_item = (item,quanity) =>{
197
+ return Data_Logic.get(Store_Table.CART_ITEM,0,{data:{
198
+ parent_table:item.table,
199
+ parent_id:item.id,
200
+ quanity:quanity?quanity:0,
201
+ cost:item.cost?item.cost:0,
202
+ title:item.title,
203
+ cart_sub_items:[]
204
+ }});
161
205
  };
162
- static get_cart_sub_item = (cart_item_id,type,parent_table,parent_id,quanity,title,cost) =>{
163
- return Data_Logic.get(Store_Table.CART_SUB_ITEM,0,{data:{type:type,cart_item_id:cart_item_id,quanity:quanity,cost:cost,parent_table:parent_table,parent_id:parent_id,title:title}});
206
+ static get_cart_sub_item = (cart_item_id,sub_item_type,item,quanity) =>{
207
+ return Data_Logic.get(Store_Table.CART_SUB_ITEM,0,{data:
208
+ {
209
+ type:sub_item_type,
210
+ cart_item_id:cart_item_id,
211
+ quanity:quanity,
212
+ cost:item.cost?item.cost:0,
213
+ parent_table:item.table,
214
+ parent_id:item.id,
215
+ title:item.title
216
+ }
217
+ });
164
218
  };
165
219
  static get_cart_sub_items = () =>{
166
220
  return [
@@ -339,8 +393,22 @@ class Store_Logic {
339
393
  static get_test_cost = () =>{
340
394
  return String(Num.get_id(999)) + "." + String(Num.get_id(99));
341
395
  }
396
+ static get_test_user = (option) =>{
397
+ option = !Obj.check_is_empty(option) ? option : {};
398
+ let data = Data_Logic.get(Table.USER,0,option);
399
+ data.username="username_"+ Str.get_id();
400
+ data.first_name="First Name "+ Str.get_id();
401
+ data.last_name="Last Name "+ Str.get_id();
402
+ data.email="email"+ Str.get_id() + "@email.com";
403
+ data.city="City "+ Str.get_id();
404
+ data.state= 'New York';
405
+ data.country= 'USA'
406
+ data.password="123456789Ab!";
407
+ return data;
408
+ };
409
+
342
410
  static get_test_product = (option) =>{
343
- option = !Obj.check_is_empty(option) ? option : {title:'Product'};
411
+ option = !Obj.check_is_empty(option) ? option : {title:'Product '+Str.get_id(999)};
344
412
  let data = Data_Logic.get(Store_Table.PRODUCT,0,option);
345
413
  data.cost = Store_Logic.get_test_cost();
346
414
  data.old_cost = Store_Logic.get_test_cost();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "biz9-store",
3
- "version": "1.0.71",
3
+ "version": "1.0.76",
4
4
  "description": "** Description",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -10,10 +10,12 @@
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "async": "^3.2.6",
13
- "biz9-data": "^7.7.18",
14
- "biz9-data-logic": "^11.7.64",
13
+ "better-assert": "^1.0.2",
14
+ "biz9-data-app": "^1.0.9",
15
+ "biz9-remote": "^1.0.12",
15
16
  "biz9-scriptz": "^5.8.30",
16
- "biz9-utility": "^4.7.63"
17
+ "biz9-utility": "^4.7.67",
18
+ "mocha": "^11.7.5"
17
19
  },
18
20
  "repository": {
19
21
  "type": "git",
package/service.js ADDED
@@ -0,0 +1,240 @@
1
+ // -- biz9 --
2
+ const {Log,Str,Obj,Status_Type,Response_Logic} = require("/home/think1/www/doqbox/biz9-framework/biz9-utility/source");
3
+ const {Data_Response_Field} = require("/home/think1/www/doqbox/biz9-framework/biz9-data-app/source");
4
+ const {Review_Response_Field} = require("./");
5
+ const {Remote} = require("/home/think1/www/doqbox/biz9-framework/biz9-remote/source");
6
+ // -- other --
7
+ const {Config} = require("./constant");
8
+ const async = require('async');
9
+ class Service {
10
+ /* - DEFINE -
11
+ * ping
12
+ * -- CART_DATA --
13
+ * delete_cart / (url,cart_number)
14
+ * get_cart / (url,cart_number)
15
+ * post_cart / (url,cart)
16
+ * -- ORDER_DATA --
17
+ * delete_order / (url,user,order_number)
18
+ * get_order / (url,order_number)
19
+ * post_order / (url,order,[order_payments])
20
+ * -- CART HELPERZ --
21
+ * get / (user_id)
22
+ * get_cart_item / (item,quanity)
23
+ * get_cart_sub_item / (item,type,quanity)
24
+ * get_cart_sub_items /
25
+ * -- ORDER HELPERZ --
26
+ * get / (cart_obj)
27
+ * get_order_payment / (order_number,payment_method_type,payment_amount)
28
+ */
29
+ // -- 9_ping
30
+ static ping = (url) => {
31
+ return new Promise((callback) => {
32
+ let response = Response_Logic.get();
33
+ let data = {};
34
+ async.series([
35
+ async function(call){
36
+ const [biz_response,biz_data] = await Remote.post(url);
37
+ response = biz_response;
38
+ call();
39
+ },
40
+ async function(call){
41
+ response.messages.push(Response_Logic.get_message(Data_Response_Field.PARAM_URL,Status_Type.OK,url,{title:Config.TITLE}));
42
+ call();
43
+ },
44
+ ],
45
+ function(error, result){
46
+ callback(response);
47
+ });
48
+ });
49
+ };
50
+ // - 9_post_cart 9_cart_post
51
+ static post_cart = (url,cart,option) => {
52
+ return new Promise((callback) => {
53
+ let response = Response_Logic.get();
54
+ let data = {};
55
+ option = !Obj.check_is_empty(option) ? option : {};
56
+ async.series([
57
+ async function(call){
58
+ const form_data = {cart:cart,option:option};
59
+ const [biz_response,biz_data] = await Remote.post(url,form_data);
60
+ response = biz_response;
61
+ data = biz_data;
62
+ call();
63
+ },
64
+ async function(call) {
65
+ // -- response-param --
66
+ response.messages.push(Response_Logic.get_message(Data_Response_Field.PARAM_URL,Status_Type.OK,url,{title:Config.TITLE}));
67
+ response.messages.push(Response_Logic.get_message(Store_Response_Field.PARAM_CART,Status_Type.OK,cart,{title:Config.TITLE}));
68
+ response.messages.push(Response_Logic.get_message(Data_Response_Field.PARAM_OPTION,Status_Type.OK,option,{title:Config.TITLE}));
69
+ call();
70
+ },
71
+ ],
72
+ function(error, result){
73
+ callback([response,data]);
74
+ });
75
+ });
76
+ };
77
+ // - 9_get_cart 9_cart_get
78
+ static get_cart = (url,cart_number,option) => {
79
+ return new Promise((callback) => {
80
+ let response = Response_Logic.get();
81
+ let data = {};
82
+ option = !Obj.check_is_empty(option) ? option : {};
83
+ async.series([
84
+ async function(call){
85
+ const form_data = {cart_number:cart_number,option:option};
86
+ const [biz_response,biz_data] = await Remote.post(url,form_data);
87
+ response = biz_response;
88
+ data = biz_data;
89
+ call();
90
+ },
91
+ async function(call) {
92
+ // -- response-param --
93
+ response.messages.push(Response_Logic.get_message(Data_Response_Field.PARAM_URL,Status_Type.OK,url,{title:Config.TITLE}));
94
+ response.messages.push(Response_Logic.get_message(Store_Response_Field.PARAM_CART_NUMBER,Status_Type.OK,cart_number,{title:Config.TITLE}));
95
+ response.messages.push(Response_Logic.get_message(Data_Response_Field.PARAM_OPTION,Status_Type.OK,option,{title:Config.TITLE}));
96
+ call();
97
+ },
98
+ ],
99
+ function(error, result){
100
+ callback([response,data]);
101
+ });
102
+ });
103
+ };
104
+ // - 9_delete_cart 9_cart_delete
105
+ static delete_cart = (url,cart_number,option) => {
106
+ return new Promise((callback) => {
107
+ let response = Response_Logic.get();
108
+ let data = {};
109
+ option = !Obj.check_is_empty(option) ? option : {};
110
+ async.series([
111
+ async function(call){
112
+ const form_data = {cart_number:cart_number,option:option};
113
+ const [biz_response,biz_data] = await Remote.post(url,form_data);
114
+ response = biz_response;
115
+ data = biz_data;
116
+ call();
117
+ },
118
+ async function(call) {
119
+ // -- response-param --
120
+ response.messages.push(Response_Logic.get_message(Data_Response_Field.PARAM_URL,Status_Type.OK,url,{title:Config.TITLE}));
121
+ response.messages.push(Response_Logic.get_message(Store_Response_Field.PARAM_CART_NUMBER,Status_Type.OK,cart_number,{title:Config.TITLE}));
122
+ response.messages.push(Response_Logic.get_message(Data_Response_Field.PARAM_OPTION,Status_Type.OK,option,{title:Config.TITLE}));
123
+ call();
124
+ },
125
+ ],
126
+ function(error, result){
127
+ callback([response,data]);
128
+ });
129
+ });
130
+ };
131
+
132
+ // - 9_post_order 9_order_post
133
+ static post_order = (url,order,order_payments,option) => {
134
+ return new Promise((callback) => {
135
+ let response = Response_Logic.get();
136
+ let data = {};
137
+ option = !Obj.check_is_empty(option) ? option : {};
138
+ async.series([
139
+ async function(call){
140
+ const form_data = {order:order,order,order_payments:order_payments,option:option};
141
+ const [biz_response,biz_data] = await Remote.post(url,form_data);
142
+ response = biz_response;
143
+ data = biz_data;
144
+ call();
145
+ },
146
+ async function(call) {
147
+ // -- response-param --
148
+ response.messages.push(Response_Logic.get_message(Data_Response_Field.PARAM_URL,Status_Type.OK,url,{title:Config.TITLE}));
149
+ response.messages.push(Response_Logic.get_message(Store_Response_Field.PARAM_ORDER,Status_Type.OK,order,{title:Config.TITLE}));
150
+ response.messages.push(Response_Logic.get_message(Data_Response_Field.PARAM_OPTION,Status_Type.OK,option,{title:Config.TITLE}));
151
+ call();
152
+ },
153
+ ],
154
+ function(error, result){
155
+ callback([response,data]);
156
+ });
157
+ });
158
+ };
159
+ // - 9_get_order 9_order_get
160
+ static get_order = (url,order_number,option) => {
161
+ return new Promise((callback) => {
162
+ let response = Response_Logic.get();
163
+ let data = {};
164
+ option = !Obj.check_is_empty(option) ? option : {};
165
+ async.series([
166
+ async function(call){
167
+ const form_data = {order_number:order_number,option:option};
168
+ const [biz_response,biz_data] = await Remote.post(url,form_data);
169
+ response = biz_response;
170
+ data = biz_data;
171
+ call();
172
+ },
173
+ async function(call) {
174
+ // -- response-param --
175
+ response.messages.push(Response_Logic.get_message(Data_Response_Field.PARAM_URL,Status_Type.OK,url,{title:Config.TITLE}));
176
+ response.messages.push(Response_Logic.get_message(Store_Response_Field.PARAM_ORDER_NUMBER,Status_Type.OK,order_number,{title:Config.TITLE}));
177
+ response.messages.push(Response_Logic.get_message(Data_Response_Field.PARAM_OPTION,Status_Type.OK,option,{title:Config.TITLE}));
178
+ call();
179
+ },
180
+ ],
181
+ function(error, result){
182
+ callback([response,data]);
183
+ });
184
+ });
185
+ };
186
+ // - 9_delete_order 9_order_delete
187
+ static delete_order = (url,order_number,option) => {
188
+ return new Promise((callback) => {
189
+ let response = Response_Logic.get();
190
+ let data = {};
191
+ option = !Obj.check_is_empty(option) ? option : {};
192
+ async.series([
193
+ async function(call){
194
+ const form_data = {order_number:order_number,option:option};
195
+ const [biz_response,biz_data] = await Remote.post(url,form_data);
196
+ response = biz_response;
197
+ data = biz_data;
198
+ call();
199
+ },
200
+ async function(call) {
201
+ // -- response-param --
202
+ response.messages.push(Response_Logic.get_message(Data_Response_Field.PARAM_URL,Status_Type.OK,url,{title:Config.TITLE}));
203
+ response.messages.push(Response_Logic.get_message(Store_Response_Field.PARAM_ORDER_NUMBER,Status_Type.OK,order_number,{title:Config.TITLE}));
204
+ response.messages.push(Response_Logic.get_message(Data_Response_Field.PARAM_OPTION,Status_Type.OK,option,{title:Config.TITLE}));
205
+ call();
206
+ },
207
+ ],
208
+ function(error, result){
209
+ callback([response,data]);
210
+ });
211
+ });
212
+ };
213
+ // - 9_blank
214
+ static blank = (url,table,id,option) => {
215
+ return new Promise((callback) => {
216
+ let response = Response_Logic.get();
217
+ let data = {};
218
+ option = !Obj.check_is_empty(option) ? option : {};
219
+ async.series([
220
+ async function(call){
221
+ const form_data = {table:table,id:id,option:option};
222
+ const [biz_response,biz_data] = await Remote.post(url,form_data);
223
+ response = biz_response;
224
+ data = biz_data;
225
+ call();
226
+ },
227
+ async function(call){
228
+ response.messages.push(Response_Logic.get_message(Data_Response_Field.PARAM_URL,Status_Type.OK,url,{title:Config.TITLE}));
229
+ response.messages.push(Response_Logic.get_message(Data_Response_Field.PARAM_TABLE,Status_Type.OK,table,{title:Config.TITLE}));
230
+ response.messages.push(Response_Logic.get_message(Data_Response_Field.PARAM_ID,Status_Type.OK,id,{title:Config.TITLE}));
231
+ call();
232
+ },
233
+ ],
234
+ function(error, result){
235
+ callback([response,data]);
236
+ });
237
+ });
238
+ };
239
+ }
240
+ module.exports = {Service};
package/test.js CHANGED
@@ -4,22 +4,267 @@ Author: Brandon Poole Sr. (biz9framework@gmail.com)
4
4
  License GNU General Public License v3.0
5
5
  Description: BiZ9 Framework: Store - Test
6
6
  */
7
+ // -- biz9
8
+ const {Data_Logic} = require("biz9-data-app");
9
+ const {Log,Num,Str,Obj} = require("biz9-utility");
10
+ const {Config,Data_Config,Url,Table} = require("./constant");
11
+ const {Remote} = require("biz9-remote");
12
+ const {Cart_Logic,Store_Type,Store_Table,Order_Logic,Store_Logic} = require("./index");
13
+ // -- other
7
14
  const async = require('async');
8
- const assert = require('node:assert');
9
- const {Log,Str} = require("biz9-utility");
10
- const {Data_Logic} = require("/home/think1/www/doqbox/biz9-framework/biz9-data-logic/source");
11
- const {User_Logic} = require("/home/think1/www/doqbox/biz9-framework/biz9-user/source");
12
- const {Store_Logic,Store_Title,Order_Logic} = require("./index");
13
-
14
- /*
15
- * availble tests
16
- - connect
15
+ /* - DEFINE -
16
+ * -- CART --
17
+ * get_cart /
18
+ * post_cart /
19
+ * delete_cart /
20
+ * -- ORDER --
21
+ * get_order /
22
+ * post_order /
23
+ * delete_order /
17
24
  */
18
- /* --- TEST CONFIG START --- */
19
- const APP_ID = 'test-stage-feb17';
20
- /* --- TEST CONFIG END --- */
25
+ // -- GLOBALZ --
26
+ const CART_NUMBER = 'CA-83355';
27
+ const ORDER_NUMBER = 'OR-67849';
28
+
29
+ // -- 9_store_data_post_cart - 9_test_store_data_post_cart 9_post_cart
30
+ describe('post_cart', function(){ this.timeout(25000);
31
+ it("_post_cart", function(done){
32
+ console.log('STORE-POST-CART-START');
33
+ let data = {};
34
+ let cart = {};
35
+ let post_cart = {};
36
+ let order = {};
37
+ let post_order = {};
38
+ let option = {};
39
+ // -- new-product --
40
+ // -- update-product --
41
+ let user = Data_Logic.get(Table.USER,'69fce35b153cbea9f894f98c');
42
+ let product_1 = Data_Logic.get(Store_Table.PRODUCT,'69fb40ebeb547dbd2b56a6f6');
43
+ let sub_product_1 = Data_Logic.get(Store_Table.PRODUCT,'69fb40ebeb547dbd2b56a6f8');
44
+ let sub_product_2 = Data_Logic.get(Store_Table.PRODUCT,'69fb40ebeb547dbd2b56a6f1');
45
+ async.series([
46
+ async function(call){
47
+ // -- get-products --
48
+ let query = { $or: [{id:product_1.id},{id:sub_product_1.id},{id:sub_product_2.id}]};
49
+ let search = Data_Logic.get_search(Store_Table.PRODUCT,query,{},1,0);
50
+ const [biz_response,biz_data] = await Data.search(database,search);
51
+ if(biz_data.items.length>0){
52
+ product_1 = Obj.find('id',product_1.id,biz_data.items);
53
+ sub_product_1 = Obj.find('id',sub_product_1.id,biz_data.items);
54
+ sub_product_2 = Obj.find('id',sub_product_2.id,biz_data.items);
55
+ console.log('product_1'+"--id= "+product_1.id + "--title="+product_1.title);
56
+ console.log('sub_product_1'+"--id= "+sub_product_1.id + "--title="+sub_product_1.title);
57
+ console.log('sub_product_2'+"--id= "+sub_product_2.id + "--title="+sub_product_2.title);
58
+ }else{
59
+ console.log('Products Not Found');
60
+ }
61
+ },
62
+ /*
63
+ async function(call){
64
+ // -- new-cart-product-post --
65
+ cart = Cart_Logic.get(user.id,{cart_code:'CA'});
66
+ let cart_item_1 = Cart_Logic.get_cart_item(product_1.table,product_1.id,1,product_1.title,product_1.cost);
67
+ let cart_sub_1 = Cart_Logic.get_cart_sub_item(0,Store_Type.CART_SUB_TYPE_STANDARD,sub_product_1.table,sub_product_1.id,1,sub_product_1.title,sub_product_1.cost);
68
+ let cart_sub_2 = Cart_Logic.get_cart_sub_item(0,Store_Type.CART_SUB_TYPE_STANDARD,sub_product_2.table,sub_product_2.id,1,sub_product_2.title,sub_product_2.cost);
69
+ cart_item_1.cart_sub_items.push(cart_sub_1);
70
+ cart_item_1.cart_sub_items.push(cart_sub_2);
71
+ cart.cart_items.push(cart_item_1);
72
+ Log.w('33_biz_data_cart',cart);
21
73
 
22
- /* --- DATA CONFIG END --- */
74
+ const [biz_response,biz_data] = await Cart_Data.post_cart(database,cart);
75
+ post_cart = biz_data;
76
+ Log.w('99_biz_response',biz_response);
77
+ Log.w('99_biz_data',biz_data);
78
+ },
79
+ async function(call){
80
+ // -- get-cart --
81
+ const [biz_response,biz_data] = await Cart_Data.get_cart(database,post_cart.cart.cart_number);
82
+ Log.w('99_biz_response',biz_response);
83
+ Log.w('99_biz_data_cart',biz_data);
84
+ },
85
+ */
86
+ ],
87
+ function(error, result){
88
+ console.log('STORE-POST-CART-DONE');
89
+ done();
90
+ });
91
+ });
92
+ });
93
+ //9_get_cart - 9_test_get_cart 9_store_data_get_cart
94
+ describe('get_cart', function(){ this.timeout(25000);
95
+ it("_get_cart", function(done){
96
+ console.log('STORE-GET-CART-START');
97
+ let response={};
98
+ let database = {};
99
+ let data = {};
100
+ let option = {};
101
+ async.series([
102
+ async function(call){
103
+ const [biz_response,biz_data] = await Cart_Data.get_cart(database,CART_NUMBER);
104
+ Log.w('99_biz_response',biz_response);
105
+ Log.w('99_biz_data_cart',biz_data);
106
+ },
107
+ async function(call){
108
+ console.log('STORE-GET-CART-SUCCESS');
109
+ },
110
+ ],
111
+ function(error, result){
112
+ console.log('STORE-GET-CART-DONE');
113
+ done();
114
+ });
115
+ });
116
+ });
117
+ //9_delete_cart - 9_test_delete_cart 9_store_data_delete_cart
118
+ describe('delete_cart', function(){ this.timeout(25000);
119
+ it("_delete_cart", function(done){
120
+ console.log('STORE-DELETE-CART-START');
121
+ let response={};
122
+ let database = {};
123
+ let data = {};
124
+ let option = {};
125
+ async.series([
126
+ async function(call){
127
+ const [biz_response,biz_data] = await Cart_Data.delete_cart(database,CART_NUMBER);
128
+ Log.w('biz_response',biz_response);
129
+ Log.w('biz_data_delete_cart',biz_data);
130
+ },
131
+ async function(call){
132
+ console.log('STORE-DELETE-CART-SUCCESS');
133
+ },
134
+ ],
135
+ function(error, result){
136
+ console.log('STORE-DELETE-CART-DONE');
137
+ done();
138
+ });
139
+ });
140
+ });
141
+ //9_delete_order - 9_test_delete_order 9_store_data_delete_order
142
+ describe('delete_order', function(){ this.timeout(25000);
143
+ it("_delete_order", function(done){
144
+ console.log('STORE-DELETE-ORDER-START');
145
+ let response={};
146
+ let data = {};
147
+ let option = {};
148
+ async.series([
149
+ async function(call){
150
+ const [biz_response,biz_data] = await Order_Data.delete_order(database,order_number);
151
+ Log.w('biz_response',biz_response);
152
+ Log.w('biz_data_delete_order',biz_data);
153
+ },
154
+ async function(call){
155
+ console.log('STORE-DELETE-ORDER-SUCCESS');
156
+ },
157
+ ],
158
+ function(error, result){
159
+ console.log('STORE-DELETE-ORDER-DONE');
160
+ done();
161
+ });
162
+ });
163
+ });
164
+ //9_post_order - 9_test_post_order 9_order_post
165
+ describe('post_order', function(){ this.timeout(25000);
166
+ it("_post_order", function(done){
167
+ console.log('STORE-POST-ORDER-START');
168
+ let data = {};
169
+ let cart = {};
170
+ let order = {};
171
+ let order_payment = {};
172
+ let option = {};
173
+ async.series([
174
+ async function(call){
175
+ // -- GET-CART-START --
176
+ const [biz_response,biz_data] = await Cart_Data.get_cart(database,CART_NUMBER);
177
+ cart = biz_data;
178
+ //Log.w('33_biz_response',biz_response);
179
+ Log.w('33_biz_data',cart);
180
+ // -- GET-CART-END --
181
+ },
182
+ async function(call){
183
+ order = Order_Logic.get(cart,{cart_code:'OR'});
184
+ Log.w('44_order',order);
185
+ },
186
+ async function(call){
187
+ order_payment = Order_Logic.get_order_payment(order.order_number,Store_Type.ORDER_PAYMENT_METHOD_TEST,Num.get_id());
188
+ Log.w('order_payments',order_payment);
189
+ },
190
+ async function(call){
191
+ const [biz_response,biz_data] = await Order_Data.post_order(database,order,[order_payment]);
192
+ post_order = biz_data;
193
+ Log.w('biz_response',biz_response);
194
+ Log.w('biz_data_post_order',biz_data);
195
+ },
196
+ ],
197
+ function(error, result){
198
+ console.log('STORE-POST-ORDER-DONE');
199
+ done();
200
+ });
201
+ });
202
+ });
203
+ //9_get_order - 9_test_get_order 9_store_data_get_order 9_order_get
204
+ describe('get_order', function(){ this.timeout(25000);
205
+ it("_get_order", function(done){
206
+ console.log('STORE-GET-ORDER-START');
207
+ let data = {};
208
+ let option = {};
209
+ async.series([
210
+ async function(call){
211
+ const [biz_response,biz_data] = await Order_Data.get_order(database,ORDER_NUMBER);
212
+ Log.w('99_biz_response',biz_response);
213
+ Log.w('99_biz_data_order',biz_data);
214
+
215
+ },
216
+ async function(call){
217
+ console.log('STORE-GET-CART-SUCCESS');
218
+ },
219
+ ],
220
+ function(error, result){
221
+ console.log('STORE-GET-CART-DONE');
222
+ done();
223
+ });
224
+ });
225
+ });
226
+ //9_ping - 9_test_ping
227
+ describe('ping', function(){ this.timeout(25000);
228
+ it("_ping", function(done){
229
+ console.log('STORE-PING-START');
230
+ async.series([
231
+ async function(call){
232
+ const url = Remote.get_url(Config.APP_ID,Config.HOST,Url.PING);
233
+ const [biz_response,biz_data] = await Favorite_Service.ping(url);
234
+ Log.w('biz_response',biz_response);
235
+ Log.w('biz_data',biz_data);
236
+ },
237
+ async function(call){
238
+ console.log('STORE-PING-SUCCESS');
239
+ },
240
+ ],
241
+ function(error, result){
242
+ console.log('STORE-PING-DONE');
243
+ done();
244
+ });
245
+ });
246
+ });
247
+ //9_post - 9_test_post
248
+ describe('post', function(){ this.timeout(25000);
249
+ it("_post", function(done){
250
+ console.log('POST-START');
251
+ async.series([
252
+ async function(call){
253
+ const url = Remote.get_url(Config.APP_ID,Config.HOST,Favorite_Url.POST);
254
+ const [biz_response,biz_data] = await Favorite_Service.post(url,FAVORITE);
255
+ Log.w('biz_response',biz_response);
256
+ Log.w('biz_data',biz_data);
257
+ },
258
+ async function(call){
259
+ console.log('POST-SUCCESS');
260
+ },
261
+ ],
262
+ function(error, result){
263
+ console.log('POST-DONE');
264
+ done();
265
+ });
266
+ });
267
+ });
23
268
  //9_connect - 9_test_connect
24
269
  describe('connect', function(){ this.timeout(25000);
25
270
  it("_connect", function(done){
@@ -70,4 +315,3 @@ describe('connect', function(){ this.timeout(25000);
70
315
  });
71
316
  });
72
317
  });
73
-
@@ -0,0 +1,398 @@
1
+ /*
2
+ Copyright 2016 Certified CoderZ
3
+ Author: Brandon Poole Sr. (biz9framework@gmail.com)
4
+ License GNU General Public License v3.0
5
+ Description: BiZ9 Framework: Store-Data - Test
6
+ */
7
+ // -- biz9 --
8
+ const {Data_Logic,Data_Url} = require("biz9-data-app");
9
+ const {Cart_Logic,Store_Type,Store_Table,Order_Logic,Store_Logic,Store_Response_Field,Store_Url} = require("./");
10
+ const {Num,Log,Str,Obj,Response_Logic,Response_Field,Status_Type}=require("/home/think1/www/doqbox/biz9-framework/biz9-utility/source");
11
+ const {Remote} = require("/home/think1/www/doqbox/biz9-framework/biz9-remote/source");
12
+ const {Service}=require("./service");
13
+ const {Config,Table,Data_Config}=require("./constant");
14
+ // -- other --
15
+ const async = require('async');
16
+ var assert = require('better-assert');
17
+
18
+ /* -- DEFINE --
19
+ * -- CART --
20
+ * post_cart_order
21
+ * delete_cart_order
22
+ */
23
+ // -- GLOBALZ --
24
+ let USER = Store_Logic.get_test_user();
25
+ let CART = {};
26
+ let ORDER = {};
27
+ let PRODUCTS = [];
28
+ let SUB_PRODUCTS = [];
29
+ let CART_ITEMS = [];
30
+
31
+ //9_ping - 9_test_ping
32
+ describe.skip('ping', function(){ this.timeout(25000);
33
+ it("_ping", function(done){
34
+ console.log('PING-START');
35
+ async.series([
36
+ async function(call){
37
+ const url = Remote.get_url(Config.APP_ID,Config.HOST,Store_Url.PING);
38
+ const [biz_response,biz_data] = await Service.ping(url);
39
+ Log.w('99_biz_response',biz_response);
40
+ Log.w('99_biz_data',biz_data);
41
+ },
42
+ async function(call){
43
+ console.log('PING-SUCCESS');
44
+ },
45
+ ],
46
+ function(error, result){
47
+ console.log('PING-DONE');
48
+ done();
49
+ });
50
+ });
51
+ });
52
+ //9_post_cart_order - 9_test_post_cart_order
53
+ describe('post_cart_order', function() {
54
+ let database = {};
55
+ let response=Response_Logic.get();
56
+ let data = {};
57
+ let option = {};
58
+ before(function(done) {
59
+ console.log('POSTS-CART-START');
60
+ async.series([
61
+ async function(call){
62
+ // -- post-user --
63
+ const url = Remote.get_url(Config.APP_ID,Config.HOST,Data_Url.POST);
64
+ const form_data = {table:USER.table,data:USER};
65
+ const [biz_response,biz_data] = await Remote.post(url,form_data);
66
+ response = biz_response;
67
+ USER = biz_data;
68
+ //Log.w('BIZ-RESPONSE-USER',response);
69
+ Log.w('BIZ-DATA-USER',USER);
70
+ },
71
+ async function(call){
72
+ // -- post-products --
73
+ let test_products = Store_Logic.get_test_products(20);
74
+ const url = Remote.get_url(Config.APP_ID,Config.HOST,Data_Url.POST_ITEMS);
75
+ const form_data = {data:test_products};
76
+ const [biz_response,biz_data] = await Remote.post(url,form_data);
77
+ response = biz_response;
78
+ PRODUCTS = biz_data;
79
+ //Log.w('BIZ-RESPONSE-POST-PRODUCTS',response);
80
+ Log.w('BIZ-DATA-POST-PRODUCTS',PRODUCTS);
81
+ },
82
+ async function(call){
83
+ // -- post-sub-products --
84
+ let test_products = Store_Logic.get_test_products(20);
85
+ const url = Remote.get_url(Config.APP_ID,Config.HOST,Data_Url.POST_ITEMS);
86
+ const form_data = {data:test_products};
87
+ const [biz_response,biz_data] = await Remote.post(url,form_data);
88
+ response = biz_response;
89
+ SUB_PRODUCTS = biz_data;
90
+ //Log.w('BIZ-RESPONSE-POST-SUB-PRODUCTS',response);
91
+ Log.w('BIZ-DATA-POST-SUB-PRODUCTS',SUB_PRODUCTS);
92
+ },
93
+ ],
94
+ function(error, result){
95
+ done();
96
+ });
97
+ });
98
+ it("post_cart_order", function(done){
99
+ async.series([
100
+ async function(call){
101
+ // -- post-cart-items --
102
+ let cart_item_count = Num.get_id(9);
103
+ let cart_items = [];
104
+ for(let a = 0; a < cart_item_count; a++){
105
+ let quantity = Num.get_id(5);
106
+ cart_items.push(Cart_Logic.get_cart_item(PRODUCTS[Num.get_id(PRODUCTS.length)],quantity?quantity:1));
107
+ }
108
+ //const [biz_response,biz_data] = await Data.post_items(database,cart_items);
109
+
110
+ const url = Remote.get_url(Config.APP_ID,Config.HOST,Data_Url.POST_ITEMS);
111
+ const form_data = {data:cart_items};
112
+ const [biz_response,biz_data] = await Remote.post(url,form_data);
113
+
114
+ CART_ITEMS = biz_data;
115
+ Log.w('BIZ-RESPONSE-POST-CART-ITEMS',biz_response);
116
+ Log.w('BIZ-DATA-POST-CART-ITEMS',biz_data);
117
+ },
118
+ async function(call){
119
+ // -- post-cart-sub-items --
120
+ for(const cart_item of CART_ITEMS){
121
+ let cart_sub_item_count = Num.get_id(9);
122
+ let cart_item_sub_items = [];
123
+ for(let a = 0; a < cart_sub_item_count; a++){
124
+ let quantity = Num.get_id(5);
125
+ cart_sub_item = Cart_Logic.get_cart_sub_item(cart_item.id,Store_Type.CART_SUB_TYPE_STANDARD,SUB_PRODUCTS[Num.get_id(SUB_PRODUCTS.length)],quantity?quantity:1);
126
+ cart_item_sub_items.push(cart_sub_item);
127
+ }
128
+ const url = Remote.get_url(Config.APP_ID,Config.HOST,Data_Url.POST_ITEMS);
129
+ const form_data = {data:cart_item_sub_items};
130
+ const [biz_response,biz_data] = await Remote.post(url,form_data);
131
+ cart_item.cart_sub_items.push(...biz_data);
132
+ Log.w('BIZ-RESPONSE-POST-CART-SUB-ITEMS',biz_response);
133
+ Log.w('BIZ-DATA-POST-CART-SUB-ITEMS',biz_data);
134
+ }
135
+ },
136
+ async function(call){
137
+ // -- get-cart-post-cart --
138
+ CART = Cart_Logic.get(USER.id);
139
+ CART.cart_items.push(...CART_ITEMS);
140
+ const url = Remote.get_url(Config.APP_ID,Config.HOST,Store_Url.CART_POST);
141
+ const [biz_response,biz_data] = await Service.post_cart(url,CART);
142
+ CART = biz_data;
143
+ for(const cart_item of CART.cart_items){
144
+ //Log.w(cart_item.title,cart_item.cost);
145
+ console.log('-- '+cart_item.title + ' / ' +Str.get_money(cart_item.sub_total)+' / SUB-CART-ITEMS ('+cart_item.cart_sub_items.length+ ') --');
146
+ for(const cart_sub_item of cart_item.cart_sub_items){
147
+ Log.w(cart_sub_item.title,cart_sub_item.cost);
148
+ }
149
+ }
150
+ Log.w('GET-CART-GRAND-TOTAL',Str.get_money(CART.grand_total));
151
+ },
152
+ async function(call){
153
+ // -- get-order --
154
+ ORDER = Order_Logic.get(CART);
155
+ for(const order_item of ORDER.order_items){
156
+ console.log('-- '+order_item.title + ' / ' +Str.get_money(order_item.sub_total)+' / SUB-ORDER-ITEMS ('+order_item.order_sub_items.length+ ') --');
157
+ for(const order_sub_item of order_item.order_sub_items){
158
+ console.log(order_sub_item.title);
159
+ }
160
+ }
161
+ Log.w('get-order-grand-total',Str.get_money(ORDER.grand_total));
162
+ },
163
+ async function(call){
164
+ // -- post-order --
165
+ order_payment = Order_Logic.get_order_payment(ORDER.order_number,Store_Type.ORDER_PAYMENT_METHOD_TEST,Num.get_id());
166
+ const url = Remote.get_url(Config.APP_ID,Config.HOST,Store_Url.ORDER_POST);
167
+ const [biz_response,biz_data] = await Service.post_order(url,ORDER,[order_payment]);
168
+ response = biz_response;
169
+ ORDER = biz_data;
170
+ Log.w('BIZ-RESPONSE-POST-ORDER',biz_response);
171
+ Log.w('BIZ-DATA-POST-ORDER',ORDER);
172
+ },
173
+ function(call){
174
+ // -- assert --
175
+ // -- cart --
176
+ assert(Str.check_is_null(CART.cart_number) === false);
177
+ assert(Str.check_is_null(CART.cart_number) === false);
178
+ assert(Str.check_is_null(CART.user_id) === false);
179
+ assert(Str.check_is_null(CART.user_id) === false);
180
+ let cart_grand_total = 0;
181
+ console.log('-- CART-ITEMS ('+CART.cart_items.length+') --');
182
+ for(const cart_item of CART.cart_items){
183
+ Log.w(cart_item.title,'cost: '+Str.get_money(cart_item.cost) + " quantity: " + cart_item.quanity + " sub_total: " + Str.get_money(cart_item.sub_total) );
184
+ cart_grand_total = cart_grand_total + cart_item.sub_total;
185
+ console.log('-- '+cart_item.title+' CART-SUB-ITEMS ('+cart_item.cart_sub_items.length+') --');
186
+ for(const cart_sub_item of cart_item.cart_sub_items){
187
+ Log.w(cart_sub_item.title,'cost: '+Str.get_money(cart_sub_item.cost) + " quanity: " + cart_sub_item.quanity + " sub_total: " + Str.get_money(cart_sub_item.sub_total) );
188
+ cart_grand_total = cart_grand_total + cart_sub_item.sub_total;
189
+ }
190
+ }
191
+ // -- order --
192
+ let order_grand_total = 0;
193
+ console.log('-- ORDER-ITEMS ('+ORDER.order_items.length+') --');
194
+ for(const order_item of ORDER.order_items){
195
+ Log.w(order_item.title,'cost: '+Str.get_money(order_item.cost) + " quantity: " + order_item.quanity + " sub_total: " + Str.get_money(order_item.sub_total) );
196
+ order_grand_total = order_grand_total + order_item.sub_total;
197
+ console.log('-- '+order_item.title+ ' ORDER-SUB-ITEMS ('+order_item.order_sub_items.length+') --');
198
+ for(const order_sub_item of order_item.order_sub_items){
199
+ Log.w(order_sub_item.title,'cost: '+Str.get_money(order_sub_item.cost) + " quanity: " + order_sub_item.quanity + " sub_total: " + Str.get_money(order_sub_item.sub_total) );
200
+ order_grand_total = order_grand_total + order_sub_item.sub_total;
201
+ }
202
+ }
203
+
204
+ assert(Str.get_money(cart_grand_total) === Str.get_money(CART.grand_total));
205
+
206
+ // -- order --
207
+ assert(Str.check_is_null(ORDER.cart_number) === false);
208
+ assert(Str.check_is_null(ORDER.order_number) === false);
209
+ assert(Str.check_is_null(ORDER.user_id) === false);
210
+ assert(CART.cart_items.length === ORDER.order_items.length);
211
+ assert(Str.check_is_null(ORDER.id) === false);
212
+ assert(response.message === Store_Logic.get_message_by_response_field(Store_Response_Field.POST_ORDER_CONFIRM));
213
+ assert(response.status === Status_Type.SUCCESS);
214
+ call();
215
+ },
216
+ ],
217
+ function(error, result){
218
+ done();
219
+ });
220
+ });
221
+ after(function() {
222
+ // -- response --
223
+ console.log('ORDER-POST-DONE');
224
+ console.log('- CART-ITEMS -');
225
+ Log.w('CART-GRAND-TOTAL',Str.get_money(CART.grand_total));
226
+ Log.w('ORDER-GRAND-TOTAL',Str.get_money(ORDER.grand_total));
227
+ Log.w('ORDER-POST-RESPONSE-STATUS',response.status);
228
+ Log.w('ORDER-POST-RESPONSE-MESSAGE',response.message);
229
+ Log.w('ORDER-POST-DATA',ORDER);
230
+ });
231
+ });
232
+
233
+ //9_delete_cart_order - 9_test_delete_cart_order
234
+ describe('delete_cart_order', function() {
235
+ let database = {};
236
+ let response=Response_Logic.get();
237
+ let data = {};
238
+ let data_delete_cart = {};
239
+ let data_delete_cart_items = [];
240
+ let data_delete_cart_sub_items = [];
241
+ let data_delete_order = {};
242
+ let data_delete_order_items = {};
243
+ let data_delete_order_sub_items = {};
244
+ let option = {};
245
+ before(function() {
246
+ console.log('DELETE-CART-ORDER-START');
247
+ });
248
+ it("delete_cart_order", function(done){
249
+ async.series([
250
+ async function(call){
251
+ // -- delete-cart --
252
+ const url = Remote.get_url(Config.APP_ID,Config.HOST,Store_Url.CART_DELETE);
253
+ const [biz_response,biz_data] = await Service.delete_cart(url,CART.cart_number);
254
+ response = biz_response;
255
+ data = biz_data;
256
+ Log.w('BIZ-RESPONSE-DELETE-CART',response);
257
+ Log.w('BIZ-DATA-DELETE-CART',data);
258
+ },
259
+ async function(call){
260
+ // -- get-delete-cart --
261
+ const url = Remote.get_url(Config.APP_ID,Config.HOST,Store_Url.CART);
262
+ const [biz_response,biz_data] = await Service.get_cart(url,CART.cart_number);
263
+ data_delete_cart = biz_data;
264
+ Log.w('BIZ-RESPONSE-DELETE-CART',biz_response);
265
+ Log.w('BIZ-DATA-DELETE-CART',data_delete_cart);
266
+ },
267
+ async function(call){
268
+ // -- get-delete-cart-items --
269
+ let search = Data_Logic.get_search(Store_Table.CART_ITEM,{cart_number:CART.cart_number});
270
+ const url = Remote.get_url(Config.APP_ID,Config.HOST,Data_Url.SEARCH);
271
+ const form_data = {search:search};
272
+ const [biz_response,biz_data] = await Remote.post(url,form_data);
273
+ data_delete_cart_items = biz_data;
274
+ Log.w('BIZ-RESPONSE-DELETE-CART-ITEMS',response);
275
+ Log.w('BIZ-DATA-DELETE-CART-ITEMS',data_delete_cart_items);
276
+ },
277
+ async function(call){
278
+ // -- get-delete-cart-sub-items --
279
+ let search = Data_Logic.get_search(Store_Table.CART_SUB_ITEM,{cart_number:CART.cart_number});
280
+ const url = Remote.get_url(Config.APP_ID,Config.HOST,Data_Url.SEARCH);
281
+ const form_data = {search:search};
282
+ const [biz_response,biz_data] = await Remote.post(url,form_data);
283
+ data_delete_cart_sub_items = biz_data;
284
+ Log.w('BIZ-RESPONSE-DELETE-CART-SUB-ITEMS',biz_response);
285
+ Log.w('BIZ-DATA-DELETE-CART-SUB-ITEMS',data_delete_cart_sub_items);
286
+ },
287
+ async function(call){
288
+ // -- delete-order --
289
+ const url = Remote.get_url(Config.APP_ID,Config.HOST,Store_Url.ORDER_DELETE);
290
+ const [biz_response,biz_data] = await Service.delete_order(url,ORDER.order_number);
291
+ response = biz_response;
292
+ data = biz_data;
293
+ Log.w('BIZ-RESPONSE-DELETE-ORDER',response);
294
+ Log.w('BIZ-DATA-DELETE-ORDER',data);
295
+ },
296
+ async function(call){
297
+ // -- get-delete-order --
298
+ const url = Remote.get_url(Config.APP_ID,Config.HOST,Store_Url.ORDER);
299
+ const [biz_response,biz_data] = await Service.get_order(url,ORDER.order_number);
300
+ data_delete_order = biz_data;
301
+ Log.w('BIZ-RESPONSE-DELETE-ORDER',biz_response);
302
+ Log.w('BIZ-DATA-DELETE-ORDER',data_delete_order);
303
+ },
304
+ async function(call){
305
+ // -- get-delete-order-items --
306
+ let search = Data_Logic.get_search(Store_Table.ORDER_ITEM,{order_number:ORDER.order_number});
307
+ const url = Remote.get_url(Config.APP_ID,Config.HOST,Data_Url.SEARCH);
308
+ const form_data = {search:search};
309
+ const [biz_response,biz_data] = await Remote.post(url,form_data);
310
+ data_delete_order_items = biz_data;
311
+ Log.w('BIZ-RESPONSE-DELETE-ORDER-ITEMS',response);
312
+ Log.w('BIZ-DATA-DELETE-ORDER-ITEMS',data_delete_order_items);
313
+ },
314
+ async function(call){
315
+ // -- get-delete-order-sub-items --
316
+ let search = Data_Logic.get_search(Store_Table.ORDER_SUB_ITEM,{order_number:ORDER.order_number});
317
+ const url = Remote.get_url(Config.APP_ID,Config.HOST,Data_Url.SEARCH);
318
+ const form_data = {search:search};
319
+ const [biz_response,biz_data] = await Remote.post(url,form_data);
320
+ data_delete_order_sub_items = biz_data;
321
+ Log.w('BIZ-RESPONSE-DELETE-ORDER-SUB-ITEMS',biz_response);
322
+ Log.w('BIZ-DATA-DELETE-ORDER-SUB-ITEMS',data_delete_order_sub_items);
323
+ },
324
+ function(call){
325
+ // -- assert --
326
+ assert(Str.check_is_null(data.id) === true);
327
+ assert(response.status === Status_Type.SUCCESS);
328
+ // -- assert-delete-cart --
329
+ assert(Str.check_is_null(data_delete_cart.id) === true);
330
+ assert(data_delete_cart_items.items.length === 0);
331
+ assert(data_delete_cart_sub_items.items.length === 0);
332
+ // -- assert-delete-order --
333
+ assert(Str.check_is_null(data_delete_order.id) === true);
334
+ assert(data_delete_order_items.items.length === 0);
335
+ assert(data_delete_order_sub_items.items.length === 0);
336
+ call();
337
+ },
338
+ ],
339
+ function(error, result){
340
+ done();
341
+ });
342
+ });
343
+ after(function() {
344
+ // -- response --
345
+ console.log('DELETE-CART-ORDER-DONE');
346
+ Log.w('DELETE-CART-ORDER-RESPONSE-STATUS',response.status);
347
+ Log.w('DELETE-CART-ORDER-RESPONSE-MESSAGE',response.message);
348
+ Log.w('DELETE-CART-ORDER-DATA',data);
349
+ });
350
+ });
351
+
352
+ /*
353
+ //9_blank - 9_test_blank
354
+ describe('blank', function() {
355
+ let database = {};
356
+ let response=Response_Logic.get();
357
+ let data = {};
358
+ let option = {};
359
+ before(function() {
360
+ console.log('BLANK-START');
361
+ });
362
+ it("blank", function(done){
363
+ async.series([
364
+ async function(call){
365
+ // -- get-database --
366
+ const [biz_response,biz_data] = await Database.get(Data_Config);
367
+ database = biz_data;
368
+ },
369
+ async function(call){
370
+ // -- blank-data --
371
+ const [biz_response,biz_data] = await Data.post(database,PARENT.table,PARENT,option);
372
+ response = biz_response;
373
+ data = biz_data;
374
+ Log.w('BIZ-RESPONSE',response);
375
+ Log.w('BIZ-DATA',data);
376
+ },
377
+ function(call){
378
+ // -- assert --
379
+ assert(Str.check_is_null(data.id) === false);
380
+ assert(response.message === Data_Logic.get_message_by_response_field(Response_Field.POST_CONFIRM));
381
+ assert(response.status === Status_Type.SUCCESS);
382
+ call();
383
+ },
384
+ ],
385
+ function(error, result){
386
+ done();
387
+ });
388
+ });
389
+ after(function() {
390
+ // -- response --
391
+ console.log('BLANK-DONE');
392
+ Log.w('BLANK-RESPONSE-STATUS',response.status);
393
+ Log.w('BLANK-RESPONSE-MESSAGE',response.message);
394
+ Log.w('BLANK-DATA',data);
395
+ });
396
+ });
397
+ */
398
+