orderiom-api-package 0.4.72 → 0.4.74

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orderiom-api-package",
3
- "version": "0.4.72",
3
+ "version": "0.4.74",
4
4
  "description": "This package will install all necessary API calls for every orderiom restaurant",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -1114,36 +1114,20 @@ const actions = {
1114
1114
  })
1115
1115
  .catch(commonErrorCallback());
1116
1116
  },
1117
- payTableExternalOrder(
1118
- { rootState },
1119
- { tablePaymentId, paymentType, qrcode = null, pin = null }
1120
- ) {
1121
- return $http
1122
- .post("/api/table-payments/pay", {
1123
- tablePaymentId,
1124
- paymentType,
1125
- ...(paymentType === "payFix" && {
1126
- qrCode: qrcode,
1127
- pin: pin,
1128
- }),
1129
- })
1130
- .then((res) => {
1131
- window.location = res.data.data.paymentLink;
1132
- return res;
1133
- })
1134
- .catch(commonErrorCallback());
1135
- },
1136
- updateTablePaymentStatus({ commit }, { tablePaymentId, status , orderId }) {
1137
- return $http
1138
- .get(`/api/table-payments/update`, {
1139
- params: { tablePaymentId, status, orderId },
1140
- })
1141
- .then((res) => {
1142
- const status = res.data.data.status;
1143
- commit("setTablePaymentStatus", status);
1144
- return res;
1145
- })
1146
- .catch(commonErrorCallback());
1117
+ broadcastTablePaymentEvent({ commit }, { tablePaymentId, basketItems, action, socketId}) {
1118
+ $http.interceptors.request.use((config) => {
1119
+ // we need to send this header so we don't receive events
1120
+ // dispatched by the same client
1121
+ if (socketId) {
1122
+ config.headers['X-Socket-Id'] = socketId;
1123
+ }
1124
+ return config;
1125
+ });
1126
+ return $http.post('/api/table-payments/events', {
1127
+ tablePaymentId,
1128
+ basketItems,
1129
+ action
1130
+ }).catch(commonErrorCallback());
1147
1131
  },
1148
1132
  getExternalTableOrdersFromPayment({ commit }, { tablePaymentId }) {
1149
1133
  return $http
@@ -82,7 +82,7 @@ const actions = {
82
82
  const params = type === 'slug' ? {slug: restaurantId} : {restaurantId};
83
83
  commit('startFetchingRestaurantInfo');
84
84
  return $http.get('api/restaurant/restaurant-by-' + type, { params }).then(result => {
85
- commit('setRestaurantInfo', result.data.data[0]);
85
+ result.data.data[0] && commit('setRestaurantInfo', result.data.data[0]);
86
86
  }).catch(
87
87
  commonErrorCallback()
88
88
  ).finally(() => {