Description
executeBulkPayroll in apps/backend/src/services/payment.ts iterates all APPROVED payrolls and attempts to transfer tokens without first verifying that the admin wallet has sufficient balance. If the wallet is underfunded, every payment in the batch fails with a Stellar error, incrementing retryCount for all entries unnecessarily.
Expected Outcome
A pre-flight balance check before bulk execution that aborts early and returns a descriptive error if the admin wallet cannot cover the total amount for any given token.
Acceptance Criteria
Technical Notes
apps/backend/src/services/payment.ts — executeBulkPayroll function
apps/backend/src/services/stellar.ts — getAccountBalance already exists
apps/backend/src/routes/payroll.ts — POST /bulk-execute handler
Difficulty
Intermediate
Estimated Time
4 hours
Labels
backend stellar payroll feature
Description
executeBulkPayrollinapps/backend/src/services/payment.tsiterates allAPPROVEDpayrolls and attempts to transfer tokens without first verifying that the admin wallet has sufficient balance. If the wallet is underfunded, every payment in the batch fails with a Stellar error, incrementingretryCountfor all entries unnecessarily.Expected Outcome
A pre-flight balance check before bulk execution that aborts early and returns a descriptive error if the admin wallet cannot cover the total amount for any given token.
Acceptance Criteria
executeBulkPayroll, calculate the total amount required per tokengetAccountBalancefromapps/backend/src/services/stellar.ts"Insufficient XLM balance: need 500, have 200"executePayrollcall — no payrolls are updated if the check failsPOST /api/payroll/bulk-executegetAccountBalance)Technical Notes
apps/backend/src/services/payment.ts—executeBulkPayrollfunctionapps/backend/src/services/stellar.ts—getAccountBalancealready existsapps/backend/src/routes/payroll.ts—POST /bulk-executehandlerDifficulty
Intermediate
Estimated Time
4 hours
Labels
backendstellarpayrollfeature