From 6c9727eb759aa115bf1883715df09b43a1673729 Mon Sep 17 00:00:00 2001 From: Adam Moussa <166072409+amoussa1229@users.noreply.github.com> Date: Thu, 7 May 2026 19:02:58 -0400 Subject: [PATCH] Fix BoA CashPro API rejection when CSV has >100 checks BoA check-issues endpoint has a 100-item limit per call. Large Stampli exports were failing with error 10102. Batch submissions into chunks of 100 for both add_Issue and cancel_Issue actions. --- src/processPaymentCsv.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/processPaymentCsv.js b/src/processPaymentCsv.js index fc080ea..a79461d 100644 --- a/src/processPaymentCsv.js +++ b/src/processPaymentCsv.js @@ -275,12 +275,22 @@ export const handler = async (event) => { return data; }; + const BOA_BATCH_SIZE = 100; + + const submitInBatches = async (items, action) => { + for (let i = 0; i < items.length; i += BOA_BATCH_SIZE) { + const batch = items.slice(i, i + BOA_BATCH_SIZE); + console.log(`BoA ${action} batch ${Math.floor(i / BOA_BATCH_SIZE) + 1}: ${batch.length} items`); + await submitToBoA(batch, action); + } + }; + if (newChecks.length) { - await submitToBoA(newChecks, "add_Issue"); + await submitInBatches(newChecks, "add_Issue"); } if (cancelChecks.length) { - await submitToBoA(cancelChecks, "cancel_Issue"); + await submitInBatches(cancelChecks, "cancel_Issue"); } }