overleaf/services
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
..
chat Merge pull request #18167 from overleaf/em-simpler-typescript-backend 2024-05-07 08:04:00 +00:00
clsi Merge pull request #18397 from overleaf/em-revert-download-all-link 2024-05-17 08:05:10 +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 #18342 from overleaf/em-tracking-props-none 2024-05-17 08:04:46 +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 #18312 from overleaf/gs-git-bridge-bash 2024-05-17 08:05:19 +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 Merge pull request #18342 from overleaf/em-tracking-props-none 2024-05-17 08:04:46 +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] Convert RecurlyWrapper functions to async (#18384) 2024-05-27 10:21:26 +00:00