orderiom-api-package 0.4.19 → 0.4.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/package.json +1 -1
- package/src/common.js +1 -1
- package/src/modules/order.js +13 -17
- package/src/modules/product.js +9 -4
package/package.json
CHANGED
package/src/common.js
CHANGED
|
@@ -39,7 +39,7 @@ export function calculateBasketIdParameter(isLogin, restaurantId) {
|
|
|
39
39
|
console.error(e);
|
|
40
40
|
throw new Error('Basket not found');
|
|
41
41
|
}
|
|
42
|
-
const foundBasket = baskets.
|
|
42
|
+
const foundBasket = baskets.reverse().find(basket => Number(basket.restaurantId) === (Number(restaurantId) || restaurantIdEnv));
|
|
43
43
|
if(!foundBasket){
|
|
44
44
|
throw new Error('Basket not found');
|
|
45
45
|
}
|
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) {
|
|
@@ -99,7 +99,7 @@ const actions = {
|
|
|
99
99
|
return $http
|
|
100
100
|
.post("api/basket/create", {
|
|
101
101
|
...delivery_time,
|
|
102
|
-
restaurantId: data.restaurantId,
|
|
102
|
+
restaurantId: data ? data.restaurantId : undefined,
|
|
103
103
|
})
|
|
104
104
|
.then((res) => {
|
|
105
105
|
basketData.push({
|
|
@@ -397,7 +397,7 @@ const actions = {
|
|
|
397
397
|
try {
|
|
398
398
|
basketId = calculateBasketIdParameter(
|
|
399
399
|
!!rootState.orderiomApiPackage.auth.privateToken,
|
|
400
|
-
data.restaurantId
|
|
400
|
+
data ? data.restaurantId : undefined
|
|
401
401
|
);
|
|
402
402
|
} catch (e) {
|
|
403
403
|
console.error(e);
|
|
@@ -415,7 +415,7 @@ const actions = {
|
|
|
415
415
|
})
|
|
416
416
|
.then(async () => {
|
|
417
417
|
return await dispatch("shoppingCartUpdateCallback", {
|
|
418
|
-
restaurantId: data.restaurantId,
|
|
418
|
+
restaurantId: data ? data.restaurantId : undefined,
|
|
419
419
|
});
|
|
420
420
|
})
|
|
421
421
|
.catch(commonErrorCallback())
|
|
@@ -580,7 +580,7 @@ const actions = {
|
|
|
580
580
|
|
|
581
581
|
return $http.post("api/order/create-order", {
|
|
582
582
|
basketId,
|
|
583
|
-
restaurantId: data.restaurantId
|
|
583
|
+
restaurantId: data.restaurantId,
|
|
584
584
|
paymentType: data.paymentType,
|
|
585
585
|
...(data.paymentType === "payFix" && {
|
|
586
586
|
qrCode: data.payfix_qrcode,
|
|
@@ -687,22 +687,18 @@ const actions = {
|
|
|
687
687
|
try {
|
|
688
688
|
basketId = calculateBasketIdParameter(
|
|
689
689
|
!!rootState.orderiomApiPackage.auth.privateToken,
|
|
690
|
-
data.restaurantId
|
|
690
|
+
data ? data.restaurantId : undefined
|
|
691
691
|
);
|
|
692
692
|
} catch (e) {
|
|
693
693
|
console.error(e);
|
|
694
694
|
return { type: "error", msg: "Basket not found" };
|
|
695
695
|
}
|
|
696
696
|
|
|
697
|
-
const restaurantID = data.restaurantId
|
|
698
|
-
? { restaurantId: data.restaurantId }
|
|
699
|
-
: {};
|
|
700
|
-
|
|
701
697
|
$http
|
|
702
698
|
.get("api/payment/prepare", {
|
|
703
699
|
params: {
|
|
704
700
|
basketId,
|
|
705
|
-
|
|
701
|
+
restaurantId: data ? data.restaurantId : undefined,
|
|
706
702
|
},
|
|
707
703
|
})
|
|
708
704
|
.then((result) => {
|
|
@@ -981,7 +977,7 @@ const actions = {
|
|
|
981
977
|
try {
|
|
982
978
|
basketId = calculateBasketIdParameter(
|
|
983
979
|
!!rootState.orderiomApiPackage.auth.privateToken,
|
|
984
|
-
data.restaurantId
|
|
980
|
+
data ? data.restaurantId : undefined
|
|
985
981
|
);
|
|
986
982
|
} catch (e) {
|
|
987
983
|
console.error(e);
|
|
@@ -991,7 +987,7 @@ const actions = {
|
|
|
991
987
|
return $http
|
|
992
988
|
.post("api/order/is-valid", null, {
|
|
993
989
|
params: {
|
|
994
|
-
restaurantId: data.restaurantId,
|
|
990
|
+
restaurantId: data ? data.restaurantId : undefined,
|
|
995
991
|
basketId,
|
|
996
992
|
},
|
|
997
993
|
})
|
|
@@ -1018,7 +1014,7 @@ const actions = {
|
|
|
1018
1014
|
return $http
|
|
1019
1015
|
.post("api/basket/update-extraInfo", {
|
|
1020
1016
|
basketId,
|
|
1021
|
-
restaurantId: data.restaurantId
|
|
1017
|
+
restaurantId: data ? data.restaurantId : undefined,
|
|
1022
1018
|
...data,
|
|
1023
1019
|
})
|
|
1024
1020
|
.then((res) =>
|
|
@@ -1039,7 +1035,7 @@ const actions = {
|
|
|
1039
1035
|
try {
|
|
1040
1036
|
basketId = calculateBasketIdParameter(
|
|
1041
1037
|
!!rootState.orderiomApiPackage.auth.privateToken,
|
|
1042
|
-
data.restaurantId
|
|
1038
|
+
data ? data.restaurantId : undefined
|
|
1043
1039
|
);
|
|
1044
1040
|
} catch (e) {
|
|
1045
1041
|
console.error(e);
|
|
@@ -1048,14 +1044,14 @@ const actions = {
|
|
|
1048
1044
|
|
|
1049
1045
|
return $http.post("api/basket/update-basket-extraInfo", {
|
|
1050
1046
|
basketId,
|
|
1051
|
-
restaurantId: data.restaurantId
|
|
1047
|
+
restaurantId: data ? data.restaurantId : undefined,
|
|
1052
1048
|
...data,
|
|
1053
1049
|
}).then((res) =>
|
|
1054
1050
|
updateBasket({
|
|
1055
1051
|
commit,
|
|
1056
1052
|
basketId,
|
|
1057
1053
|
res,
|
|
1058
|
-
restaurantId: data.restaurantId
|
|
1054
|
+
restaurantId: data ? data.restaurantId : undefined,
|
|
1059
1055
|
})
|
|
1060
1056
|
).catch(err => {
|
|
1061
1057
|
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 => {
|
|
@@ -363,7 +363,10 @@ const actions = {
|
|
|
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)
|