overleaf/services/web/scripts/recurly
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
..
change_prices_at_renewal.js Merge pull request #11435 from overleaf/em-price-increase-script 2023-01-26 09:04:21 +00:00
collect_paypal_past_due_invoice.js [web] Add tests to collect_paypal_past_due_invoice.js + update logging (#18310) 2024-05-15 08:04:46 +00:00
Gemfile Merge pull request #1107 from sharelatex/ja-purchase-groups 2018-11-13 13:50:46 +00:00
generate_recurly_prices.js Merge pull request #12816 from overleaf/bg-recurly-scripts-cleanup 2023-04-27 08:05:52 +00:00
get_paypal_accounts_csv.js Merge pull request #3942 from overleaf/prettier-trailing-comma 2021-04-28 02:10:01 +00:00
get_recurly_group_prices.js convert price_in_unit to price_in_cents 2022-01-21 09:03:29 +00:00
recurly_prices.js Merge pull request #12816 from overleaf/bg-recurly-scripts-cleanup 2023-04-27 08:05:52 +00:00
resync_subscriptions.js Merge pull request #14048 from overleaf/mj-recurly-script-update 2023-07-28 08:04:14 +00:00
sync_recurly.rb Set tax type to digital in Recurly plans script 2018-11-13 15:02:30 +00:00