Skip to content

armgit / ECC

Public Imported from GitHub
0

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

484 B
Raw Blame
import { refund } from './charge.js';

// Remember which refunds we already sent so we don't send them twice.
const seenRefunds = new Set();

export async function processRefund(req) {
  const key = req.idempotencyKey || `${req.orderId}:${req.amount}`;
  if (seenRefunds.has(key)) {
    return { id: `dup_${key}`, type: 'refund', orderId: req.orderId, amount: req.amount, duplicate: true };
  }
  seenRefunds.add(key);
  return refund({ orderId: req.orderId, amount: req.amount });
}