orderiom-api-package 0.4.73 → 0.4.75

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.73",
3
+ "version": "0.4.75",
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",
@@ -1102,11 +1102,12 @@ const actions = {
1102
1102
  return false;
1103
1103
  });
1104
1104
  },
1105
- getTableExternalOrder({ commit }, { restaurantId, tableName }) {
1105
+ getTableExternalOrder({ commit }, { restaurantId, tablePaymentId, tableName }) {
1106
1106
  commit("setExternalTableOrders", {});
1107
1107
  return $http
1108
1108
  .post("api/table-payments/create", {
1109
1109
  restaurantId,
1110
+ tablePaymentId,
1110
1111
  tableName,
1111
1112
  })
1112
1113
  .then((res) => {
@@ -1114,36 +1115,20 @@ const actions = {
1114
1115
  })
1115
1116
  .catch(commonErrorCallback());
1116
1117
  },
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());
1118
+ broadcastTablePaymentEvent({ commit }, { tablePaymentId, basketItems, action, socketId}) {
1119
+ $http.interceptors.request.use((config) => {
1120
+ // we need to send this header so we don't receive events
1121
+ // dispatched by the same client
1122
+ if (socketId) {
1123
+ config.headers['X-Socket-Id'] = socketId;
1124
+ }
1125
+ return config;
1126
+ });
1127
+ return $http.post('/api/table-payments/events', {
1128
+ tablePaymentId,
1129
+ basketItems,
1130
+ action
1131
+ }).catch(commonErrorCallback());
1147
1132
  },
1148
1133
  getExternalTableOrdersFromPayment({ commit }, { tablePaymentId }) {
1149
1134
  return $http