From 496a677b7707454df0a4aa56df9ea9fe61eeb60d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Salgado?= Date: Wed, 28 Jul 2021 20:06:53 +0100 Subject: [PATCH] fix: infinite loop on rejected id photo and front camera photo --- lib/customers.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/customers.js b/lib/customers.js index f6a76337..f6f5d499 100644 --- a/lib/customers.js +++ b/lib/customers.js @@ -263,16 +263,20 @@ function getComplianceTypes () { function updateOverride (fields) { const updateableFields = [ 'id_card_data', - 'id_card_photo', - 'front_camera', + 'id_card_photo_path', + 'front_camera_path', 'authorized', 'us_ssn' ] const updatedFields = _.intersection(updateableFields, _.keys(fields)) - const atFields = _.fromPairs(_.map(f => [`${f}_override`, 'automatic'], updatedFields)) + const overrideFields = _.fromPairs(_.map(f => + _.endsWith('_path', f) + ? [`${_.replace('_path', '', f)}_override`, 'automatic'] + : [`${f}_override`, 'automatic'] + , updatedFields)) - return _.merge(fields, atFields) + return _.merge(fields, overrideFields) } function enhanceAtFields (fields) {