overleaf/services
Antoine Clausse 9419cc3b37 [web] Add tests to collect_paypal_past_due_invoice.js + update logging (#18310)
* Fix: Invoices collected array length comparison

Update the code with the correct condition to respect the intent of the previous implementation ("exit with non zero code when no invoicess were processed").
See 5476f39984

However, I'm not sure if erroring when no invoices are collected is actually what we want to do.

* Wrap `collect_paypal_past_due_invoice` script and export the function

* Fixup typo `accoutns`

* Log invoices collection data before throwing

* Add note: `handleAPIError` is silencing the errors

* Create a test on `collect_paypal_past_due_invoice`

* Replace `console.log` by `@overleaf/logger` (bunyan)

Our `console.warn` show up as Errors (in red) in GCP. For example the following is an error in GCP:
```
Errors in attemptInvoiceCollection with id=2693634 OError: Recurly API returned with status code: 400
```
https://github.com/overleaf/internal/blob/5476f39/services/web/scripts/recurly/collect_paypal_past_due_invoice.js#L9

---

Does it correctly set the levels as warnings if we use `@overleaf/logger`

GitOrigin-RevId: 37c8bdf4afd8cef4706700aafb44480ec8966a74
2024-05-15 08:04:46 +00:00
..
chat Merge pull request #18167 from overleaf/em-simpler-typescript-backend 2024-05-07 08:04:00 +00:00
clsi Merge pull request #18167 from overleaf/em-simpler-typescript-backend 2024-05-07 08:04:00 +00:00
contacts Merge pull request #18167 from overleaf/em-simpler-typescript-backend 2024-05-07 08:04:00 +00:00
docstore Merge pull request #18167 from overleaf/em-simpler-typescript-backend 2024-05-07 08:04:00 +00:00
document-updater Merge pull request #18167 from overleaf/em-simpler-typescript-backend 2024-05-07 08:04:00 +00:00
filestore Merge pull request #18167 from overleaf/em-simpler-typescript-backend 2024-05-07 08:04:00 +00:00
git-bridge Merge pull request #18028 from overleaf/csh-issue-18027-git-bridge-image 2024-04-23 08:04:24 +00:00
history-v1 Merge pull request #18167 from overleaf/em-simpler-typescript-backend 2024-05-07 08:04:00 +00:00
notifications Merge pull request #18167 from overleaf/em-simpler-typescript-backend 2024-05-07 08:04:00 +00:00
project-history Remove @ts-check from SyncManagerTests.js (#18291) 2024-05-13 08:03:47 +00:00
real-time Merge pull request #18167 from overleaf/em-simpler-typescript-backend 2024-05-07 08:04:00 +00:00
spelling Merge pull request #18167 from overleaf/em-simpler-typescript-backend 2024-05-07 08:04:00 +00:00
web [web] Add tests to collect_paypal_past_due_invoice.js + update logging (#18310) 2024-05-15 08:04:46 +00:00