Skip to content

Instantly share code, notes, and snippets.

@brunoluiz
Created January 5, 2022 10:54
Show Gist options
  • Save brunoluiz/f35c2bc1f9a38ac1b99a47a30cd08239 to your computer and use it in GitHub Desktop.
Save brunoluiz/f35c2bc1f9a38ac1b99a47a30cd08239 to your computer and use it in GitHub Desktop.
amex-check-statement-values
let paymentReceivedRowId = 0;
document.querySelectorAll('div.col-md-5.col-sm-8.pad-responsive-lr.pad-1-t-sm-down').forEach((n, idx) =>
n.textContent.includes('PAYMENT RECEIVED') ? paymentReceivedRowId = idx : null
);
// navigate to the statement view
let items = [];
document.querySelectorAll('div.col-md-3.col-sm-4.pad-responsive-r.flex.flex-column-md.flex-justify-end').forEach((n, idx) => {
if (idx === paymentReceivedRowId) return;
items.push(n.textContent.replaceAll('£',''));
});
items.reduce((acc, item) => item !== '-1,899.31' ? acc + Number(item) : acc, 0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment