if (pi.latest_charge == null) {
throw new Error('latest_charge is null or string. should have been expanded');
}
const x = pi.latest_charge.id;
const hasDispute = disputes.findIndex((d) => {
return d.charge == pi.latest_charge.id && d.status == 'lost';
}) != -1;