From cf38f09b6299382f4b0fbe794b842a6259636cad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Salgado?= Date: Thu, 1 Jun 2023 10:41:54 +0100 Subject: [PATCH 1/2] fix: response tx for machine update requests fix: CT error handling --- lib/cash-out/cash-out-low.js | 2 +- lib/routes/txRoutes.js | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/cash-out/cash-out-low.js b/lib/cash-out/cash-out-low.js index 91130119..7ac5421c 100644 --- a/lib/cash-out/cash-out-low.js +++ b/lib/cash-out/cash-out-low.js @@ -51,7 +51,7 @@ function diff (oldTx, newTx) { if (oldTx && _.isEqualWith(nilEqual, oldTx[fieldKey], newTx[fieldKey])) return // We never null out an existing field - if (oldTx && _.isNil(newTx[fieldKey])) return + if (oldTx && _.isNil(newTx[fieldKey])) return updatedTx[fieldKey] = oldTx[fieldKey] switch (fieldKey) { case 'customerId': diff --git a/lib/routes/txRoutes.js b/lib/routes/txRoutes.js index 0bfbfd07..8bda42d6 100644 --- a/lib/routes/txRoutes.js +++ b/lib/routes/txRoutes.js @@ -20,6 +20,10 @@ function postTx (req, res, next) { switch (tx.errorCode) { case 'InsufficientFundsError': throw httpError(tx.error, 570) + case 'scoreThresholdReached': + throw httpError(tx.error, 570) + case 'ciphertraceError': + throw httpError(tx.error, 572) default: throw httpError(tx.error, 500) } From a037ecdbece4249cc1e8b68a1d61f18f123229e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Salgado?= Date: Thu, 1 Jun 2023 14:08:02 +0100 Subject: [PATCH 2/2] fix: wrong error code --- lib/routes/txRoutes.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/routes/txRoutes.js b/lib/routes/txRoutes.js index 8bda42d6..cfda6428 100644 --- a/lib/routes/txRoutes.js +++ b/lib/routes/txRoutes.js @@ -21,7 +21,7 @@ function postTx (req, res, next) { case 'InsufficientFundsError': throw httpError(tx.error, 570) case 'scoreThresholdReached': - throw httpError(tx.error, 570) + throw httpError(tx.error, 571) case 'ciphertraceError': throw httpError(tx.error, 572) default: