From becaf9424aff62066c2d7790bb0053cd4f32e920 Mon Sep 17 00:00:00 2001 From: Alexander Blair Date: Wed, 15 Feb 2017 18:55:06 -0800 Subject: [PATCH] Fix to make it so payment ID's won't auto-queue, but will error "safely" --- lib/payments.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/payments.js b/lib/payments.js index 71617fd..392c7bb 100644 --- a/lib/payments.js +++ b/lib/payments.js @@ -298,9 +298,11 @@ let paymentQueue = async.queue(function (paymentDetails, callback) { if (body.hasOwnProperty('error')) { if (body.error.message === "not enough money"){ console.error("Issue making payments, not enough money, will try later"); - setTimeout(function(){ - paymentQueue.push(paymentDetails, callback); - }, 1800000); + if (!paymentDetails.hasOwnProperty('payment_id')) { + setTimeout(function(){ + paymentQueue.push(paymentDetails, callback); + }, 1800000); + } return callback(false); } else { console.error("Issue making payments" + JSON.stringify(body.error));