orderiom-api-package 0.3.43 → 0.3.45
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 +17 -18
package/package.json
CHANGED
package/src/modules/order.js
CHANGED
|
@@ -19,6 +19,7 @@ const state = () => ({
|
|
|
19
19
|
tableOrder: {},
|
|
20
20
|
externalTableOrders: [],
|
|
21
21
|
tablePaymentStatus: null,
|
|
22
|
+
externalTableOrdersFromPayment:{}
|
|
22
23
|
});
|
|
23
24
|
const mutations = {
|
|
24
25
|
setproductOrder(state, productOrder) {
|
|
@@ -57,6 +58,9 @@ const mutations = {
|
|
|
57
58
|
setTablePaymentStatus(state, paymentStatus) {
|
|
58
59
|
state.tablePaymentStatus = paymentStatus;
|
|
59
60
|
},
|
|
61
|
+
setExternalTableOrdersFromPayment(state, ordersInfo){
|
|
62
|
+
state.externalTableOrdersFromPayment = ordersInfo
|
|
63
|
+
}
|
|
60
64
|
};
|
|
61
65
|
const actions = {
|
|
62
66
|
async shoppingCartUpdateCallback({ dispatch, rootState }, data) {
|
|
@@ -165,11 +169,9 @@ const actions = {
|
|
|
165
169
|
.catch(commonErrorCallback());
|
|
166
170
|
},
|
|
167
171
|
addToBasket({ dispatch, rootState }, data) {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
(f) => f.basketProductId === Number(data.productId)
|
|
172
|
-
);
|
|
172
|
+
const basketProduct = !data.basketProductId
|
|
173
|
+
? null
|
|
174
|
+
: rootState.orderiomApiPackage.product.ShoppingCart.find(f => f.basketProductId === data.basketProductId);
|
|
173
175
|
|
|
174
176
|
const basket = JSON.parse(localStorage.getItem("basket"));
|
|
175
177
|
const basketId = !rootState.orderiomApiPackage.auth.privateToken
|
|
@@ -187,7 +189,7 @@ const actions = {
|
|
|
187
189
|
$http
|
|
188
190
|
.post("api/basket/add", {
|
|
189
191
|
...basketId,
|
|
190
|
-
productId:
|
|
192
|
+
productId: data.productId,
|
|
191
193
|
quantity: !data.quantity || data.quantity < 1 ? 1 : data.quantity,
|
|
192
194
|
attributeItems: data.attributeItems.length
|
|
193
195
|
? data.attributeItems
|
|
@@ -372,10 +374,9 @@ const actions = {
|
|
|
372
374
|
});
|
|
373
375
|
},
|
|
374
376
|
addProductPackageItem({ dispatch, rootState }, data) {
|
|
375
|
-
const basketProduct =
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
);
|
|
377
|
+
const basketProduct = !data.basketProductId
|
|
378
|
+
? null
|
|
379
|
+
: rootState.orderiomApiPackage.product.ShoppingCart.find(f => f.basketProductId === Number(data.basketProductId));
|
|
379
380
|
|
|
380
381
|
const basket = JSON.parse(localStorage.getItem("basket"));
|
|
381
382
|
const basketId = !rootState.orderiomApiPackage.auth.privateToken
|
|
@@ -393,7 +394,6 @@ const actions = {
|
|
|
393
394
|
.post("api/basket/add-product-package-items", {
|
|
394
395
|
...basketId,
|
|
395
396
|
...data,
|
|
396
|
-
productId: basketProduct.RestaurantProductId,
|
|
397
397
|
quantity: !data.quantity || data.quantity < 1 ? 1 : data.quantity,
|
|
398
398
|
})
|
|
399
399
|
.then(async () => {
|
|
@@ -888,8 +888,8 @@ const actions = {
|
|
|
888
888
|
});
|
|
889
889
|
},
|
|
890
890
|
getTableExternalOrder({ commit }, { restaurantId, tableName }) {
|
|
891
|
-
|
|
892
|
-
$http
|
|
891
|
+
commit("setExternalTableOrders", {});
|
|
892
|
+
return $http
|
|
893
893
|
.post("api/table-payments/create", {
|
|
894
894
|
restaurantId,
|
|
895
895
|
tableName,
|
|
@@ -903,7 +903,7 @@ const actions = {
|
|
|
903
903
|
{ rootState },
|
|
904
904
|
{ tablePaymentId, paymentType, qrcode = null, pin = null }
|
|
905
905
|
) {
|
|
906
|
-
$http
|
|
906
|
+
return $http
|
|
907
907
|
.post("/api/table-payments/pay", {
|
|
908
908
|
tablePaymentId,
|
|
909
909
|
paymentType,
|
|
@@ -913,7 +913,6 @@ const actions = {
|
|
|
913
913
|
}),
|
|
914
914
|
})
|
|
915
915
|
.then((res) => {
|
|
916
|
-
console.log(res);
|
|
917
916
|
window.location = res.data.data.paymentLink;
|
|
918
917
|
return {
|
|
919
918
|
type: "success",
|
|
@@ -922,10 +921,10 @@ const actions = {
|
|
|
922
921
|
})
|
|
923
922
|
.catch(commonErrorCallback());
|
|
924
923
|
},
|
|
925
|
-
updateTablePaymentStatus({ commit },
|
|
924
|
+
updateTablePaymentStatus({ commit }, { tablePaymentId, status }) {
|
|
926
925
|
return $http
|
|
927
926
|
.get(`/api/table-payments/update`, {
|
|
928
|
-
params: {
|
|
927
|
+
params: { tablePaymentId, status },
|
|
929
928
|
})
|
|
930
929
|
.then((res) => {
|
|
931
930
|
const status = res.data.data.status;
|
|
@@ -941,7 +940,7 @@ const actions = {
|
|
|
941
940
|
return $http
|
|
942
941
|
.get(`/api/table-payments`, { params: { tablePaymentId } })
|
|
943
942
|
.then((res) => {
|
|
944
|
-
commit("
|
|
943
|
+
commit("setExternalTableOrdersFromPayment", res.data.data);
|
|
945
944
|
return {
|
|
946
945
|
type: "success",
|
|
947
946
|
msg: "ok",
|