orderiom-api-package 0.4.20 → 0.4.22
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/package.json +1 -1
- package/src/modules/order.js +14 -29
- package/src/modules/product.js +10 -5
package/package.json
CHANGED
package/src/modules/order.js
CHANGED
|
@@ -68,7 +68,7 @@ const actions = {
|
|
|
68
68
|
async shoppingCartUpdateCallback({ dispatch, rootState }, data) {
|
|
69
69
|
const getBasketSuccess = await dispatch(
|
|
70
70
|
"product/getBasket",
|
|
71
|
-
data.restaurantId,
|
|
71
|
+
data ? data.restaurantId : undefined,
|
|
72
72
|
{ root: true }
|
|
73
73
|
);
|
|
74
74
|
if (!getBasketSuccess) {
|
|
@@ -85,21 +85,10 @@ const actions = {
|
|
|
85
85
|
},
|
|
86
86
|
createBasket({}, data) {
|
|
87
87
|
var basketData = JSON.parse(localStorage.getItem("basket") || "[]");
|
|
88
|
-
let delivery_time = data.delivery_time
|
|
89
|
-
? { delivery_time: data.delivery_time }
|
|
90
|
-
: null;
|
|
91
|
-
// Date.prototype.addHours = function (h) {
|
|
92
|
-
// this.setTime(this.getTime() + (h * 60 * 60 * 1000));
|
|
93
|
-
// return this;
|
|
94
|
-
// }
|
|
95
|
-
// var date = new Date().addHours(1);
|
|
96
|
-
// let delivery_time =
|
|
97
|
-
// `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()
|
|
98
|
-
// } ${(date.getHours()).toString().padStart(2, '0')}:${(date.getMinutes()).toString().padStart(2, '0')}`
|
|
99
88
|
return $http
|
|
100
89
|
.post("api/basket/create", {
|
|
101
|
-
|
|
102
|
-
restaurantId: data.restaurantId,
|
|
90
|
+
delivery_time: data && data.delivery_time ? data.delivery_time : null,
|
|
91
|
+
restaurantId: data ? data.restaurantId : undefined,
|
|
103
92
|
})
|
|
104
93
|
.then((res) => {
|
|
105
94
|
basketData.push({
|
|
@@ -397,7 +386,7 @@ const actions = {
|
|
|
397
386
|
try {
|
|
398
387
|
basketId = calculateBasketIdParameter(
|
|
399
388
|
!!rootState.orderiomApiPackage.auth.privateToken,
|
|
400
|
-
data.restaurantId
|
|
389
|
+
data ? data.restaurantId : undefined
|
|
401
390
|
);
|
|
402
391
|
} catch (e) {
|
|
403
392
|
console.error(e);
|
|
@@ -415,7 +404,7 @@ const actions = {
|
|
|
415
404
|
})
|
|
416
405
|
.then(async () => {
|
|
417
406
|
return await dispatch("shoppingCartUpdateCallback", {
|
|
418
|
-
restaurantId: data.restaurantId,
|
|
407
|
+
restaurantId: data ? data.restaurantId : undefined,
|
|
419
408
|
});
|
|
420
409
|
})
|
|
421
410
|
.catch(commonErrorCallback())
|
|
@@ -580,7 +569,7 @@ const actions = {
|
|
|
580
569
|
|
|
581
570
|
return $http.post("api/order/create-order", {
|
|
582
571
|
basketId,
|
|
583
|
-
restaurantId: data.restaurantId
|
|
572
|
+
restaurantId: data.restaurantId,
|
|
584
573
|
paymentType: data.paymentType,
|
|
585
574
|
...(data.paymentType === "payFix" && {
|
|
586
575
|
qrCode: data.payfix_qrcode,
|
|
@@ -687,22 +676,18 @@ const actions = {
|
|
|
687
676
|
try {
|
|
688
677
|
basketId = calculateBasketIdParameter(
|
|
689
678
|
!!rootState.orderiomApiPackage.auth.privateToken,
|
|
690
|
-
data.restaurantId
|
|
679
|
+
data ? data.restaurantId : undefined
|
|
691
680
|
);
|
|
692
681
|
} catch (e) {
|
|
693
682
|
console.error(e);
|
|
694
683
|
return { type: "error", msg: "Basket not found" };
|
|
695
684
|
}
|
|
696
685
|
|
|
697
|
-
const restaurantID = data.restaurantId
|
|
698
|
-
? { restaurantId: data.restaurantId }
|
|
699
|
-
: {};
|
|
700
|
-
|
|
701
686
|
$http
|
|
702
687
|
.get("api/payment/prepare", {
|
|
703
688
|
params: {
|
|
704
689
|
basketId,
|
|
705
|
-
|
|
690
|
+
restaurantId: data ? data.restaurantId : undefined,
|
|
706
691
|
},
|
|
707
692
|
})
|
|
708
693
|
.then((result) => {
|
|
@@ -981,7 +966,7 @@ const actions = {
|
|
|
981
966
|
try {
|
|
982
967
|
basketId = calculateBasketIdParameter(
|
|
983
968
|
!!rootState.orderiomApiPackage.auth.privateToken,
|
|
984
|
-
data.restaurantId
|
|
969
|
+
data ? data.restaurantId : undefined
|
|
985
970
|
);
|
|
986
971
|
} catch (e) {
|
|
987
972
|
console.error(e);
|
|
@@ -991,7 +976,7 @@ const actions = {
|
|
|
991
976
|
return $http
|
|
992
977
|
.post("api/order/is-valid", null, {
|
|
993
978
|
params: {
|
|
994
|
-
restaurantId: data.restaurantId,
|
|
979
|
+
restaurantId: data ? data.restaurantId : undefined,
|
|
995
980
|
basketId,
|
|
996
981
|
},
|
|
997
982
|
})
|
|
@@ -1018,7 +1003,7 @@ const actions = {
|
|
|
1018
1003
|
return $http
|
|
1019
1004
|
.post("api/basket/update-extraInfo", {
|
|
1020
1005
|
basketId,
|
|
1021
|
-
restaurantId: data.restaurantId
|
|
1006
|
+
restaurantId: data ? data.restaurantId : undefined,
|
|
1022
1007
|
...data,
|
|
1023
1008
|
})
|
|
1024
1009
|
.then((res) =>
|
|
@@ -1039,7 +1024,7 @@ const actions = {
|
|
|
1039
1024
|
try {
|
|
1040
1025
|
basketId = calculateBasketIdParameter(
|
|
1041
1026
|
!!rootState.orderiomApiPackage.auth.privateToken,
|
|
1042
|
-
data.restaurantId
|
|
1027
|
+
data ? data.restaurantId : undefined
|
|
1043
1028
|
);
|
|
1044
1029
|
} catch (e) {
|
|
1045
1030
|
console.error(e);
|
|
@@ -1048,14 +1033,14 @@ const actions = {
|
|
|
1048
1033
|
|
|
1049
1034
|
return $http.post("api/basket/update-basket-extraInfo", {
|
|
1050
1035
|
basketId,
|
|
1051
|
-
restaurantId: data.restaurantId
|
|
1036
|
+
restaurantId: data ? data.restaurantId : undefined,
|
|
1052
1037
|
...data,
|
|
1053
1038
|
}).then((res) =>
|
|
1054
1039
|
updateBasket({
|
|
1055
1040
|
commit,
|
|
1056
1041
|
basketId,
|
|
1057
1042
|
res,
|
|
1058
|
-
restaurantId: data.restaurantId
|
|
1043
|
+
restaurantId: data ? data.restaurantId : undefined,
|
|
1059
1044
|
})
|
|
1060
1045
|
).catch(err => {
|
|
1061
1046
|
console.error(err);
|
package/src/modules/product.js
CHANGED
|
@@ -330,7 +330,7 @@ const actions = {
|
|
|
330
330
|
}
|
|
331
331
|
return $http.get("api/restaurant/pinned-products", {
|
|
332
332
|
params: {
|
|
333
|
-
restaurantId: data.restaurantId,
|
|
333
|
+
restaurantId: data ? data.restaurantId : undefined,
|
|
334
334
|
basketId: basketId
|
|
335
335
|
}
|
|
336
336
|
}).then(res => {
|
|
@@ -359,11 +359,14 @@ const actions = {
|
|
|
359
359
|
);
|
|
360
360
|
},
|
|
361
361
|
getBasket({ commit, rootState }, data) {
|
|
362
|
-
if(
|
|
362
|
+
if(['string', 'number', 'undefined'].includes(typeof data)) data = {restaurantId: data};
|
|
363
363
|
|
|
364
364
|
let basketId = undefined;
|
|
365
365
|
try{
|
|
366
|
-
basketId = calculateBasketIdParameter(
|
|
366
|
+
basketId = calculateBasketIdParameter(
|
|
367
|
+
!!rootState.orderiomApiPackage.auth.privateToken,
|
|
368
|
+
data ? data.restaurantId : undefined
|
|
369
|
+
);
|
|
367
370
|
} catch(e) {
|
|
368
371
|
console.error(e);
|
|
369
372
|
return false;
|
|
@@ -373,7 +376,7 @@ const actions = {
|
|
|
373
376
|
return $http.get('api/basket', {
|
|
374
377
|
params: {
|
|
375
378
|
basketId,
|
|
376
|
-
restaurantId: data.restaurantId
|
|
379
|
+
restaurantId: data ? data.restaurantId : undefined,
|
|
377
380
|
}
|
|
378
381
|
}).then(res =>
|
|
379
382
|
updateBasket({commit, basketId, res, restaurantId: data ? data.restaurantId : undefined})
|
|
@@ -396,7 +399,9 @@ const actions = {
|
|
|
396
399
|
}
|
|
397
400
|
return $http.get('api/restaurant/category-attributes-items', {
|
|
398
401
|
params: {
|
|
399
|
-
restaurantId: data.restaurantId,
|
|
402
|
+
restaurantId: data.restaurantId,
|
|
403
|
+
categoryId: data.category.id,
|
|
404
|
+
basketId
|
|
400
405
|
}
|
|
401
406
|
}).then((result) => {
|
|
402
407
|
commit('setAttributeItems', result.data.data)
|