overleaf/services/web/scripts
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
..
analytics Merge pull request #17525 from overleaf/ae-upgrade-prettier 2024-03-26 09:04:05 +00:00
delete-duplicate-splittest-versions Merge pull request #13349 from overleaf/jdt-delete-splittest-version-dupes 2023-07-17 10:38:31 +00:00
delete-orphaned-docs Merge pull request #16186 from overleaf/mj-mongo-object-id 2023-12-19 09:04:02 +00:00
example Merge pull request #1440 from overleaf/as-amd-webpack 2019-10-16 10:36:21 +00:00
helpers Merge pull request #17926 from overleaf/jpa-batched-update-sorting 2024-04-17 08:04:09 +00:00
history Merge pull request #14198 from overleaf/jpa-history-migration 2023-08-11 08:04:01 +00:00
learn/checkSanitize Merge pull request #13760 from overleaf/em-fetch-utils-web 2023-07-17 11:02:40 +00:00
lezer-latex Merge pull request #14991 from overleaf/jpa-log-tree 2023-09-28 08:04:17 +00:00
oauth Merge pull request #17457 from overleaf/dp-local-collabratec-helpers 2024-03-26 09:04:00 +00:00
plan-prices [web] Use localized number formatting for currencies (#17622) 2024-04-19 08:03:54 +00:00
recurly [web] Add tests to collect_paypal_past_due_invoice.js + update logging (#18310) 2024-05-15 08:04:46 +00:00
sync-user-entitlements [web] Upgrade Prettier to match version in monorepo root (#6231) 2022-01-11 09:03:23 +00:00
translations Merge pull request #17870 from overleaf/bg-node-upgrade-18-20-2 2024-04-24 08:05:16 +00:00
ukamf Merge pull request #16948 from overleaf/jpa-rails-sharelatex-rebranding-step-2 2024-02-13 09:03:35 +00:00
add_feature_override.js Merge pull request #16186 from overleaf/mj-mongo-object-id 2023-12-19 09:04:02 +00:00
add_notification_ieee_collabratec_users.js Merge pull request #17586 from overleaf/dp-fix-IEEE-script 2024-03-20 09:03:06 +00:00
add_user_count_to_csv.js Merge pull request #14610 from overleaf/bg-filter-csv-by-registered-user-domains 2023-09-04 08:05:03 +00:00
back_fill_deleted_files.js Merge pull request #15172 from overleaf/em-promise-utils 2023-10-20 08:04:05 +00:00
back_fill_doc_name_for_deleted_docs.js Merge pull request #15172 from overleaf/em-promise-utils 2023-10-20 08:04:05 +00:00
back_fill_doc_rev.js Merge pull request #12277 from overleaf/jpa-cleanup-batched-update-interface 2023-03-23 09:04:29 +00:00
back_fill_dummy_doc_meta.js Merge pull request #16186 from overleaf/mj-mongo-object-id 2023-12-19 09:04:02 +00:00
back_fill_staff_access.js Merge pull request #12575 from overleaf/em-fix-chunk-replace-transaction 2023-04-19 08:03:10 +00:00
back_fill_warning_user_personal_and_group_subscription.js Merge pull request #15044 from overleaf/mf-send-warning-to-users-with-personal-and-group-subscriptions 2023-10-18 08:05:04 +00:00
backfill_mixpanel_user_properties.js Merge pull request #15172 from overleaf/em-promise-utils 2023-10-20 08:04:05 +00:00
backfill_project_image_name.js Merge pull request #3093 from overleaf/jpa-offline-migration-image-name 2020-08-18 02:06:28 +00:00
backfill_user_properties.js Merge pull request #15172 from overleaf/em-promise-utils 2023-10-20 08:04:05 +00:00
backfill_users_sso_attribute.js Merge pull request #8360 from overleaf/jel-remove-not-needed-script 2022-06-15 08:04:05 +00:00
bench_bcrypt.js Merge pull request #15172 from overleaf/em-promise-utils 2023-10-20 08:04:05 +00:00
check_institution_users.js Merge pull request #9967 from overleaf/jpa-web-scripts-increase-timeouts 2022-10-18 08:03:06 +00:00
check_saml_emails.js Merge pull request #9967 from overleaf/jpa-web-scripts-increase-timeouts 2022-10-18 08:03:06 +00:00
clear_feedback_collection.js Merge pull request #10290 from overleaf/bg-clear-feedbacks-collection 2022-11-07 09:03:25 +00:00
clear_institution_notifications.js [web] Upgrade Prettier to match version in monorepo root (#6231) 2022-01-11 09:03:23 +00:00
clear_project_tokens.js Merge pull request #3255 from overleaf/jpa-fix-scripts 2020-10-06 02:04:28 +00:00
clear_sessions_2fa.js Merge pull request #15172 from overleaf/em-promise-utils 2023-10-20 08:04:05 +00:00
clear_sessions_set_must_reconfirm.js Merge pull request #4146 from overleaf/jel-em-script-must-reconfirm 2021-06-04 02:08:40 +00:00
confirmed_at_to_dates.js Merge pull request #4330 from overleaf/ns-update-confirmedAt_strings 2021-07-28 02:07:11 +00:00
convert_archived_state.js Merge pull request #15172 from overleaf/em-promise-utils 2023-10-20 08:04:05 +00:00
convert_doc_to_file.js Merge pull request #9383 from overleaf/em-file-tree-histories 2022-08-26 08:03:30 +00:00
count_encrypted_access_tokens.js Merge pull request #12575 from overleaf/em-fix-chunk-replace-transaction 2023-04-19 08:03:10 +00:00
count_files_in_projects.js [web] Upgrade Prettier to match version in monorepo root (#6231) 2022-01-11 09:03:23 +00:00
count_image_files.js Merge pull request #12575 from overleaf/em-fix-chunk-replace-transaction 2023-04-19 08:03:10 +00:00
count_project_size.js Merge pull request #16186 from overleaf/mj-mongo-object-id 2023-12-19 09:04:02 +00:00
create_oauth_personal_access_token.js [web] Issue Oauth2 access tokens (#12788) 2023-04-28 08:04:10 +00:00
create_project.js Merge pull request #11593 from overleaf/bg-create-project-with-random-history 2023-02-02 18:22:09 +00:00
delete_dangling_file_refs.js Merge pull request #16186 from overleaf/mj-mongo-object-id 2023-12-19 09:04:02 +00:00
delete_orphaned_chat_threads.js Merge pull request #16186 from overleaf/mj-mongo-object-id 2023-12-19 09:04:02 +00:00
delete_orphaned_data_helper.js Merge pull request #15172 from overleaf/em-promise-utils 2023-10-20 08:04:05 +00:00
delete_orphaned_doc_comment_ranges.js Merge pull request #15172 from overleaf/em-promise-utils 2023-10-20 08:04:05 +00:00
delete_orphaned_docs_online_check.js Merge pull request #17525 from overleaf/ae-upgrade-prettier 2024-03-26 09:04:05 +00:00
delete_subscriptions.js Merge pull request #16186 from overleaf/mj-mongo-object-id 2023-12-19 09:04:02 +00:00
disconnect_all_users.js Merge pull request #15923 from overleaf/jpa-tweak-delay-in-seconds 2023-11-27 09:04:02 +00:00
ensure_affiliations.js Merge pull request #5740 from overleaf/em-gcp-logging-web 2021-11-11 09:03:09 +00:00
extract_onboardingdatacollection_csv.js Create a script to extract OnboardingDataCollection (#17657) 2024-03-28 09:04:33 +00:00
find_malformed_filetrees.js Merge pull request #12575 from overleaf/em-fix-chunk-replace-transaction 2023-04-19 08:03:10 +00:00
fix_group_invite_emails_to_lowercase.js Merge pull request #12277 from overleaf/jpa-cleanup-batched-update-interface 2023-03-23 09:04:29 +00:00
fix_malformed_filetree.js Merge pull request #16186 from overleaf/mj-mongo-object-id 2023-12-19 09:04:02 +00:00
fix_oversized_docs.js Merge pull request #16186 from overleaf/mj-mongo-object-id 2023-12-19 09:04:02 +00:00
force_doc_flush.js Merge pull request #16186 from overleaf/mj-mongo-object-id 2023-12-19 09:04:02 +00:00
inst_table.js Merge pull request #2592 from overleaf/jel-html-inst-table-script 2020-02-19 04:20:51 +00:00
invalidate_tokens.js Merge pull request #16186 from overleaf/mj-mongo-object-id 2023-12-19 09:04:02 +00:00
mark_migration.js Merge pull request #4352 from overleaf/sk-add-ce-sp-migration-deleted-files 2021-08-04 11:13:55 +00:00
merge_group_subscription_members.js Merge pull request #16186 from overleaf/mj-mongo-object-id 2023-12-19 09:04:02 +00:00
migrate_audit_logs.js Merge pull request #16186 from overleaf/mj-mongo-object-id 2023-12-19 09:04:02 +00:00
process_lapsed_reconfirmations.js Merge pull request #4035 from overleaf/jel-reconfirmation-dropbox-notification 2021-05-19 02:06:06 +00:00
purge_non_logged_in_sessions.js Merge pull request #17291 from overleaf/bg-purge-non-logged-in-sessions 2024-02-27 17:02:10 +00:00
recover_docs_from_redis.js Merge pull request #16186 from overleaf/mj-mongo-object-id 2023-12-19 09:04:02 +00:00
refresh_features.js Merge pull request #7829 from overleaf/ab-refresh-features-script-update 2022-05-27 08:03:58 +00:00
refresh_institution_users.js Merge pull request #10260 from overleaf/jel-script-messages 2022-11-15 09:06:40 +00:00
regenerate_duplicate_referral_ids.js Merge pull request #15172 from overleaf/em-promise-utils 2023-10-20 08:04:05 +00:00
remove_deleted_users_from_token_access_refs.js add missing token access fields to projects (#17372) 2024-03-06 17:27:26 +00:00
remove_email.js [web] Add auditing of email removals (#8904) 2022-07-27 12:17:31 +00:00
remove_oauth_application.js Merge pull request #11960 from overleaf/jk-script-to-remove-oauth-application 2023-03-01 09:02:59 +00:00
remove_unwanted_ieee_collabratec_users.js Merge pull request #17645 from overleaf/dp-ac-ieee-deprecation-script-remove-users 2024-03-29 09:04:17 +00:00
restore_orphaned_docs.js Merge pull request #12409 from overleaf/bg-restore-orphaned-docs 2023-03-30 08:03:59 +00:00
restore_soft_deleted_docs.js Merge pull request #17525 from overleaf/ae-upgrade-prettier 2024-03-26 09:04:05 +00:00
set_tex_live_image.js Merge pull request #16186 from overleaf/mj-mongo-object-id 2023-12-19 09:04:02 +00:00
soft_delete_project.js Add script to delete projects from the command line for cleanup of ownerless projects (#9106) 2022-08-09 08:02:49 +00:00
split_tests_assigned_at_to_dates.js Merge pull request #5364 from overleaf/ta-split-test-assignment-date-backfill 2021-10-22 08:04:49 +00:00
sso_id_migration_check.js Merge pull request #17525 from overleaf/ae-upgrade-prettier 2024-03-26 09:04:05 +00:00
sso_id_remove_not_migrated.js Merge pull request #17525 from overleaf/ae-upgrade-prettier 2024-03-26 09:04:05 +00:00
stress_test.js Merge pull request #16186 from overleaf/mj-mongo-object-id 2023-12-19 09:04:02 +00:00
tsconfig.json Merge pull request #16353 from overleaf/em-typescript-in-web-backend 2024-01-04 09:03:43 +00:00
undelete_project_to_user.js Merge pull request #7220 from overleaf/jpa-wait-for-db 2022-03-25 09:03:59 +00:00
unlink_third_party_id.js Merge pull request #17611 from overleaf/dp-unlink-sso-script 2024-03-26 09:04:40 +00:00
validate-data-of-model.js Merge pull request #12276 from overleaf/jpa-batched-update-window 2023-03-22 09:04:09 +00:00