overleaf/services/web/scripts/recurly
Antoine Clausse 78a0bc2b05 [web] Convert RecurlyWrapper functions to async (#18384)
* Rename `RecurlyWrapper` to `promises`, as it will only contain the promises soon

* Update `apiRequest`

* Update `_parseXml`

* Update `_parseXmlAndGetAttribute`

* Update `_parse*Xml`

* Update `updateAccountEmailAddress`

* Update `checkAccountExists`

* Update `createAccount`

* Update `createBillingInfo`

* Update `setAddressAndCompanyBillingInfo`

* Update `createSubscription`

* Update `_createPaypalSubscription`

* Update `_handle422Response`

* Update `_createCreditCardSubscription`

* Update `createSubscription`

* Update `getSubscriptions`

* Update `getSubscription`

* Update `getPaginatedEndpoint`

* Update `getAccount`

* Update `getAccountActiveCoupons`

* Update `getCoupon`

* Update `getBillingInfo`

* Update `getAccountPastDueInvoices`

* Update `attemptInvoiceCollection`

* Update `updateSubscription`

* Update `createFixedAmmountCoupon`

* Update `lookupCoupon`

* Update `redeemCoupon`

* Update `extendTrial`

* Update `listAccountActiveSubscriptions`

* To find which functions to add as callbackified, I used this Regex:
`RecurlyWrapper\.(?!promises)[^.\s]*`

And after adding callbackified functions, we're left with no results with the Regex:
`RecurlyWrapper\.(?!promises|apiUrl|_buildXml|_parseXml|attemptInvoiceCollection|createFixedAmmountCoupon|getAccountActiveCoupons|getBillingInfo|getPaginatedEndpoint|getSubscription|updateAccountEmailAddress)[^.\s]*`

* Update unit tests

* Test `getSubscription` both as "promise" and as "callback"

I'm not sure if we want to generalize this.

* Fix: add missing `await`s (!!)

* Change `apiRequest` to reject errors instead of resolving it in an object

* Fixup for CollectPayPalPastDueInvoice test

* Fix: callbackify `getSubscriptions` (!!)

* Replace `.then(...)` chain by multiple `await`

* Fixup `attemptInvoicesCollection`: prevent reading length of undefined

* Use `return await` when returning promises

Per https://github.com/overleaf/internal/pull/18384#pullrequestreview-2065738771

GitOrigin-RevId: ceda755b24fd29f97a27e60ac5db9bc7e369f932
2024-05-27 10:21:26 +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] Convert RecurlyWrapper functions to async (#18384) 2024-05-27 10:21:26 +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