addio-admin-sdk 1.7.157 → 1.7.159
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/dist/Interfaces/Cart/IMarketPayload.d.ts +12 -0
- package/dist/Interfaces/Cart/IMarketPayload.js +3 -0
- package/dist/Interfaces/Cart/IMarketPayload.js.map +1 -0
- package/dist/Interfaces/Cart/index.d.ts +7 -3
- package/dist/Interfaces/Cart/index.js +1 -0
- package/dist/Interfaces/Cart/index.js.map +1 -1
- package/dist/Interfaces/CashDrawers/index.d.ts +1 -0
- package/dist/Interfaces/CashDrawers/index.js.map +1 -1
- package/dist/lib/Cart/index.js +9 -9
- package/dist/lib/Cart/index.js.map +1 -1
- package/dist/lib/Space/index.d.ts +10 -1
- package/dist/lib/Space/index.js +22 -1
- package/dist/lib/Space/index.js.map +1 -1
- package/dist/utils/locale.js +2 -0
- package/dist/utils/locale.js.map +1 -1
- package/package.json +1 -1
|
@@ -64,7 +64,7 @@ import { MenuPositionEnum } from '../../Interfaces/Menu';
|
|
|
64
64
|
import Menu from '../../lib/Menu';
|
|
65
65
|
import Note from '../Note';
|
|
66
66
|
import { NoteTypeEnum } from '../../Interfaces/Note';
|
|
67
|
-
import { CashDrawerActionEnum, ICashDrawer, ICashDrawerInteraction } from '../../Interfaces/CashDrawers';
|
|
67
|
+
import { CashDrawerOnlyUpdateActions, CashDrawerActionEnum, ICashDrawer, ICashDrawerInteraction } from '../../Interfaces/CashDrawers';
|
|
68
68
|
import CashDrawerShift from '../CashDrawerShift';
|
|
69
69
|
/**
|
|
70
70
|
* Class Space
|
|
@@ -669,6 +669,14 @@ export default class Space {
|
|
|
669
669
|
* @param note Optionnal. The custom note added by user on close
|
|
670
670
|
*/
|
|
671
671
|
private _closeCashDrawer;
|
|
672
|
+
/**
|
|
673
|
+
* Generate and save new update to amount for a cash drawer's open shift.
|
|
674
|
+
* @param drawerId The current drawer
|
|
675
|
+
* @param cashAmount The amount of the manual update (can be negative)
|
|
676
|
+
* @param reason The reason for the update.
|
|
677
|
+
* @param note The note added by user on update (only passed if generated manually and nor from order)
|
|
678
|
+
*/
|
|
679
|
+
private _saveNewCashUpdateInteraction;
|
|
672
680
|
attributes: {
|
|
673
681
|
get: (options?: IQueryOptions) => Promise<Attribute[]>;
|
|
674
682
|
add: (attribute: IAttribute) => Promise<void>;
|
|
@@ -1140,6 +1148,7 @@ export default class Space {
|
|
|
1140
1148
|
}) => Promise<ICashDrawerInteraction[]>;
|
|
1141
1149
|
open: (drawerId: string, cashDownAmount: number) => Promise<boolean>;
|
|
1142
1150
|
close: (drawerId: string, cashAmount: number, note?: string) => Promise<boolean>;
|
|
1151
|
+
addManualUpdate: (drawerId: string, cashAmount: number, reason: CashDrawerOnlyUpdateActions, note?: string) => Promise<boolean>;
|
|
1143
1152
|
};
|
|
1144
1153
|
/**
|
|
1145
1154
|
* Get all space properties
|
package/dist/lib/Space/index.js
CHANGED
|
@@ -5286,6 +5286,26 @@ class Space {
|
|
|
5286
5286
|
const closed = await sameShift.closeShift(cashAmount, note);
|
|
5287
5287
|
return closed;
|
|
5288
5288
|
};
|
|
5289
|
+
/**
|
|
5290
|
+
* Generate and save new update to amount for a cash drawer's open shift.
|
|
5291
|
+
* @param drawerId The current drawer
|
|
5292
|
+
* @param cashAmount The amount of the manual update (can be negative)
|
|
5293
|
+
* @param reason The reason for the update.
|
|
5294
|
+
* @param note The note added by user on update (only passed if generated manually and nor from order)
|
|
5295
|
+
*/
|
|
5296
|
+
this._saveNewCashUpdateInteraction = async (drawerId, cashAmount, reason, note) => {
|
|
5297
|
+
const sameShift = await this.cashDrawers.getOpenShift(drawerId);
|
|
5298
|
+
if (!sameShift)
|
|
5299
|
+
throw new Error('Could not find corresponding shift!');
|
|
5300
|
+
const type = [CashDrawers_1.CashDrawerActionEnum.MANUAL_CASH_OUT, CashDrawers_1.CashDrawerActionEnum.MANUAL_CASH_IN].includes(reason)
|
|
5301
|
+
? 'manual'
|
|
5302
|
+
: 'from_order';
|
|
5303
|
+
const fncToCall = [CashDrawers_1.CashDrawerActionEnum.MANUAL_CASH_OUT, CashDrawers_1.CashDrawerActionEnum.ORDER_CASH_OUT].includes(reason)
|
|
5304
|
+
? sameShift.newCashOut
|
|
5305
|
+
: sameShift.newCashIn;
|
|
5306
|
+
const addedManualUpdate = await fncToCall(cashAmount, type, { reason: note || '' });
|
|
5307
|
+
return addedManualUpdate;
|
|
5308
|
+
};
|
|
5289
5309
|
// #endregion
|
|
5290
5310
|
// -------------------------------------------------------------------------------
|
|
5291
5311
|
// #region PUBLIC GETTER FUNCTIONS
|
|
@@ -5683,7 +5703,8 @@ class Space {
|
|
|
5683
5703
|
getOpenShift: this._getOpenShiftForDrawer,
|
|
5684
5704
|
getInteractionHistory: this._getInteractionHistoryForDrawer,
|
|
5685
5705
|
open: this._openCashDrawer,
|
|
5686
|
-
close: this._closeCashDrawer
|
|
5706
|
+
close: this._closeCashDrawer,
|
|
5707
|
+
addManualUpdate: this._saveNewCashUpdateInteraction
|
|
5687
5708
|
};
|
|
5688
5709
|
// #endregion
|
|
5689
5710
|
/**
|