@live-change/balance-service 0.8.110 → 0.8.111

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.
Files changed (2) hide show
  1. package/operation.js +5 -2
  2. package/package.json +6 -6
package/operation.js CHANGED
@@ -354,13 +354,16 @@ definition.trigger({
354
354
  change: {
355
355
  ...config.currencyType,
356
356
  validation: ['nonEmpty']
357
+ },
358
+ force: {
359
+ type: Balance
357
360
  }
358
361
  },
359
362
  queuedBy: 'balance',
360
- async execute({ balance, causeType, cause, change }, { client, service, triggerService }) {
363
+ async execute({ balance, causeType, cause, change, force }, { client, service, triggerService }) {
361
364
  const operation = app.generateUid()
362
365
  const balanceData = await getBalance(balance, triggerService)
363
- if(!config.changePossible(balanceData.available, change)) throw "insufficientFunds"
366
+ if(!force && !config.changePossible(balanceData.available, change)) throw "insufficientFunds"
364
367
  const newAmount = config.currencyAdd(balanceData.amount, change)
365
368
  const newAvailable = config.currencyAdd(balanceData.available, change)
366
369
  await triggerService({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/balance-service",
3
- "version": "0.8.110",
3
+ "version": "0.8.111",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -21,11 +21,11 @@
21
21
  "url": "https://www.viamage.com/"
22
22
  },
23
23
  "dependencies": {
24
- "@live-change/access-control-service": "^0.8.110",
25
- "@live-change/framework": "^0.8.110",
26
- "@live-change/relations-plugin": "^0.8.110",
27
- "@live-change/user-service": "^0.8.110"
24
+ "@live-change/access-control-service": "^0.8.111",
25
+ "@live-change/framework": "^0.8.111",
26
+ "@live-change/relations-plugin": "^0.8.111",
27
+ "@live-change/user-service": "^0.8.111"
28
28
  },
29
- "gitHead": "8af31d640f43b00b2874f2c70fa4d4486541adfe",
29
+ "gitHead": "9b96afb2fc61ab3d2a5d143924e2c56d411280b4",
30
30
  "type": "module"
31
31
  }