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
delete-duplicate-splittest-versions
delete-orphaned-docs
example
helpers
history
learn/checkSanitize
lezer-latex
oauth
plan-prices
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
translations
ukamf
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
add_user_count_to_csv.js
back_fill_deleted_files.js
back_fill_doc_name_for_deleted_docs.js
back_fill_doc_rev.js
back_fill_dummy_doc_meta.js
back_fill_staff_access.js
back_fill_warning_user_personal_and_group_subscription.js
backfill_mixpanel_user_properties.js
backfill_project_image_name.js
backfill_user_properties.js
backfill_users_sso_attribute.js
bench_bcrypt.js
check_institution_users.js
check_saml_emails.js
clear_feedback_collection.js
clear_institution_notifications.js
clear_project_tokens.js
clear_sessions_2fa.js
clear_sessions_set_must_reconfirm.js
confirmed_at_to_dates.js
convert_archived_state.js
convert_doc_to_file.js
count_encrypted_access_tokens.js
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
count_project_size.js
create_oauth_personal_access_token.js
create_project.js
delete_dangling_file_refs.js
delete_orphaned_chat_threads.js
delete_orphaned_data_helper.js
delete_orphaned_doc_comment_ranges.js
delete_orphaned_docs_online_check.js
delete_subscriptions.js
disconnect_all_users.js
ensure_affiliations.js
extract_onboardingdatacollection_csv.js
find_malformed_filetrees.js
fix_group_invite_emails_to_lowercase.js
fix_malformed_filetree.js
fix_oversized_docs.js
force_doc_flush.js
inst_table.js
invalidate_tokens.js
mark_migration.js
merge_group_subscription_members.js
migrate_audit_logs.js
process_lapsed_reconfirmations.js
purge_non_logged_in_sessions.js
recover_docs_from_redis.js
refresh_features.js
refresh_institution_users.js
regenerate_duplicate_referral_ids.js
remove_deleted_users_from_token_access_refs.js
remove_email.js
remove_oauth_application.js
remove_unwanted_ieee_collabratec_users.js
restore_orphaned_docs.js
restore_soft_deleted_docs.js
set_tex_live_image.js
soft_delete_project.js
split_tests_assigned_at_to_dates.js
sso_id_migration_check.js
sso_id_remove_not_migrated.js
stress_test.js
tsconfig.json
undelete_project_to_user.js
unlink_third_party_id.js
validate-data-of-model.js