Merge pull request #2409 from overleaf/ta-recurly-collection-script-fix

Recurly Collection Script Fix

GitOrigin-RevId: 3012d06a9122636ca1997e2e66899a36b386e5be
This commit is contained in:
Timothée Alby 2019-11-27 18:19:28 +05:30 committed by sharelatex
parent 304a30887f
commit 508556c835
2 changed files with 14 additions and 3 deletions

View file

@ -555,7 +555,7 @@ module.exports = RecurlyWrapper = {
)
cursor = __guard__(
response.headers.link != null
? response.headers.link.match(/cursor=([0-9]+%3A[0-9]+)&/)
? response.headers.link.match(/cursor=([0-9.]+%3A[0-9.]+)&/)
: undefined,
x1 => x1[1]
)

View file

@ -39,6 +39,7 @@ const attemptInvoiceCollection = (invoice, callback) => {
callback
)
}
INVOICES_COLLECTED_SUCCESS.push(invoice.invoice_number)
slowCallback(callback, null)
}
)
@ -75,6 +76,7 @@ const attemptInvoicesCollection = callback => {
const argv = minimist(process.argv.slice(2))
const DRY_RUN = argv.n !== undefined
const INVOICES_COLLECTED = []
const INVOICES_COLLECTED_SUCCESS = []
const USERS_COLLECTED = []
attemptInvoicesCollection(error => {
if (error) {
@ -83,8 +85,17 @@ attemptInvoicesCollection(error => {
console.log(
`DONE (DRY_RUN=${DRY_RUN}). ${
INVOICES_COLLECTED.length
} invoices collected for ${USERS_COLLECTED.length} users.`
} invoices collection attempts for ${USERS_COLLECTED.length} users. ${
INVOICES_COLLECTED_SUCCESS.length
} successful collections`
)
console.dir(
{
INVOICES_COLLECTED,
INVOICES_COLLECTED_SUCCESS,
USERS_COLLECTED
},
{ maxArrayLength: null }
)
console.log({ INVOICES_COLLECTED, USERS_COLLECTED })
process.exit()
})