@go-mailer/jarvis 10.10.4 → 10.10.6

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/lib/query.js CHANGED
@@ -130,7 +130,7 @@ const buildOrQuery = (value) => {
130
130
 
131
131
  const buildRangeQuery = (value) => {
132
132
  const [min, max] = value.split('~')
133
- const is_not_number = !isNaN(min) || !isNaN(max)
133
+ const is_not_number = isNaN(min) || isNaN(max)
134
134
  const query = {
135
135
  $gte: 0,
136
136
  $lte: Number.MAX_SAFE_INTEGER
@@ -115,6 +115,11 @@ const WalletThrottler = async ({
115
115
  }
116
116
  }
117
117
 
118
+ const refreshCache = async ({ tenant_id, wallet_type, balance }) => {
119
+ const balance_key = `wallet:tenant:${tenant_id}:wallet:${wallet_type}`
120
+ await redisClient.set(balance_key, balance * 100) // Store as integer (cents)
121
+ }
122
+
118
123
  const refundCredits = async ({
119
124
  tenant_id,
120
125
  wallet_type,
@@ -168,6 +173,7 @@ const WalletThrottler = async ({
168
173
  getWalletRate,
169
174
  loadCache,
170
175
  refundCredits,
176
+ refreshCache,
171
177
  topUpCredits
172
178
  }
173
179
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@go-mailer/jarvis",
3
- "version": "10.10.4",
3
+ "version": "10.10.6",
4
4
  "main": "index.js",
5
5
  "repository": "git@github.com:go-mailer-ltd/jarvis-node.git",
6
6
  "author": "Nathan Oguntuberu <nateoguns.work@gmail.com>",