Merge branch 'dev' into feat/lam-1291/stress-testing

* dev: (41 commits)
  build: use bullseye as target build
  chore: remove whitespace
  refactor: simplify denominations list construction
  fix: sort coins by descending denomination
  feat: address prompt feature toggle on ui
  feat: reuse last address option
  fix: performance issues on SystemPerformance
  chore: clarify requirements on comment
  feat: allow address reuse if same customer
  feat: address reuse is now per customer
  fix: hide anon and show phone on customers
  fix: dev environment restarts
  feat: batch diagnostics script
  fix: custom info request returns array
  fix: name on customer if custom data is filled
  build: testing cache hit
  build: server cache improvements
  build: node_modules was ignored on .dockerignored
  build: leftovers from npm
  chore: commented by mistake
  ...
This commit is contained in:
siiky 2025-06-02 13:31:02 +01:00
commit 5feee6d5df
105 changed files with 17323 additions and 31348 deletions

View file

@ -311,7 +311,13 @@ function getExternalComplianceLink(req, res, next) {
.then(url => respond(req, res, { url }))
}
function addOrUpdateCustomer(customerData, deviceId, config, isEmailAuth) {
function addOrUpdateCustomer(
customerData,
deviceId,
config,
isEmailAuth,
cryptoCode,
) {
const triggers = configManager.getTriggers(config)
const maxDaysThreshold = complianceTriggers.maxDaysThreshold(triggers)
@ -346,6 +352,18 @@ function addOrUpdateCustomer(customerData, deviceId, config, isEmailAuth) {
.getCustomerActiveIndividualDiscount(customer.id)
.then(discount => ({ ...customer, discount }))
})
.then(customer => {
const enableLastUsedAddress = !!configManager.getWalletSettings(
cryptoCode,
config,
).enableLastUsedAddress
if (!cryptoCode || !enableLastUsedAddress) return customer
return customers
.getLastUsedAddress(customer.id, cryptoCode)
.then(lastUsedAddress => {
return { ...customer, lastUsedAddress }
})
})
}
function getOrAddCustomerPhone(req, res, next) {
@ -354,6 +372,7 @@ function getOrAddCustomerPhone(req, res, next) {
const pi = plugins(req.settings, deviceId)
const phone = req.body.phone
const cryptoCode = req.query.cryptoCode
return pi
.getPhoneCode(phone)
@ -363,6 +382,7 @@ function getOrAddCustomerPhone(req, res, next) {
deviceId,
req.settings.config,
false,
cryptoCode,
).then(customer => respond(req, res, { code, customer }))
})
.catch(err => {
@ -375,6 +395,7 @@ function getOrAddCustomerPhone(req, res, next) {
function getOrAddCustomerEmail(req, res, next) {
const deviceId = req.deviceId
const customerData = req.body
const cryptoCode = req.query.cryptoCode
const pi = plugins(req.settings, req.deviceId)
const email = req.body.email
@ -387,6 +408,7 @@ function getOrAddCustomerEmail(req, res, next) {
deviceId,
req.settings.config,
true,
cryptoCode,
).then(customer => respond(req, res, { code, customer }))
})
.catch(err => {

View file

@ -53,7 +53,12 @@ function getTx(req, res, next) {
return helpers
.fetchStatusTx(req.params.id, req.query.status)
.then(r => res.json(r))
.catch(next)
.catch(err => {
if (err.name === 'HTTPError') {
return res.status(err.code).send(err.message)
}
next(err)
})
}
return next(httpError('Not Found', 404))