Commit Graph

642 Commits

Author SHA1 Message Date
Rishabh Garg
ca18f140c4 Handled new type column for tiers (#356)
refs https://github.com/TryGhost/Team/issues/1037

Tiers have a new `type` column to differentiate between `free` and `paid` tiers. This change -

- sets type as paid for all new tiers created, as `free` tier is created by default
- excludes any price/stripe data change for free tier
- updates all usages of default product to fetch the first paid product from the products list in DB instead of just the first product it finds.
2022-01-17 23:02:02 +05:30
Fabien "egg" O'Carroll
fb3010384b Published new versions
- @tryghost/members-api@3.0.1
2022-01-14 12:25:34 +02:00
Fabien "egg" O'Carroll
cacc74f3b4 Added "api" source to MemberSubscribedEvents
refs https://github.com/TryGhost/Team/issues/1275

We want to be able to track where member subscriptions came from, so
that we can use the information to reduce spam imports of members.

We were missing information when members were uploaded via the Admin
API, and setting the source to 'member' be default - this fixes that
both when creating members and when updating their subscription status.
2022-01-14 12:19:43 +02:00
Fabien "egg" O'Carroll
379fbc7f13 Published new versions
- @tryghost/domain-events@0.1.4
 - @tryghost/express-dynamic-redirects@0.2.3
 - @tryghost/magic-link@1.0.15
 - @tryghost/member-analytics-service@0.1.5
 - @tryghost/member-events@0.3.2
 - @tryghost/members-analytics-ingress@0.1.6
 - @tryghost/members-api@3.0.0
 - @tryghost/members-csv@1.2.1
 - @tryghost/members-importer@0.3.6
 - @tryghost/members-ssr@1.0.17
 - @tryghost/members-stripe-service@0.5.2
 - @tryghost/members-offers@0.10.4
 - @tryghost/members-payments@0.1.6
2022-01-10 17:56:12 +02:00
Fabien "egg" O'Carroll
a7588e3c6b Fixed transactions for linkSubscription
no-issue

This was missed when transactions were implemented for this method.
2022-01-10 17:53:30 +02:00
Fabien "egg" O'Carroll
1c108bce95 Updated migrations to run in transactions
no-issue

Running these in a transaction ensures that they do not partially execute or run
into race conditions with simultaneous operations via the API.
2022-01-10 17:53:30 +02:00
Fabien "egg" O'Carroll
69df4b7c05 Added support for dynamic allowSelfSignup config
refs https://github.com/TryGhost/Team/issues/1257

This gets us closer to not having to reload the MembersAPI when config
is changed which will help stop bugs arising from multiple instances of
the MembersAPI being created.
2022-01-10 17:53:30 +02:00
Kevin Ansfield
2c447b483b Published new versions
- @tryghost/members-api@2.8.8
2022-01-04 14:51:03 +00:00
Kevin Ansfield
381e0c1f2a Removed membersAutoLogin labs flag
refs https://github.com/TryGhost/Team/issues/1258

- feature is GA so conditionals are no longer needed
2022-01-04 14:50:24 +00:00
Fabien egg O'Carroll
e37caa3f65 Published new versions
- @tryghost/members-api@2.8.7
2021-12-16 09:27:45 +02:00
Fabien egg O'Carroll
2e7bb3e67e Handled EENVELOPE errors when generating magic link
refs https://github.com/TryGhost/Team/issues/1259

These errors are thrown by nodemailer and can occur when an invalid
email address is used. Without special handling these cause a 500 error.
2021-12-16 09:25:32 +02:00
Sam Lord
d6d4920fee Published new versions
- @tryghost/members-api@2.8.6
2021-12-06 16:57:51 +00:00
Sam Lord
7f6d3a3178 members-api: Switch from GhostError to ConflictError
no issue
2021-12-06 16:57:19 +00:00
Sam Lord
313dc933c7 Published new versions
- @tryghost/members-api@2.8.5
2021-12-06 12:47:10 +00:00
Sam Lord
859a2c4bd1 Updated @tryghost/logging to v2
refs: https://github.com/TryGhost/Toolbox/issues/146
Allows members API to log to parent process when running in a worker
2021-12-06 12:46:49 +00:00
Sam Lord
f0c1107de4 Published new versions
- @tryghost/members-api@2.8.4
 - @tryghost/members-ssr@1.0.16
 - @tryghost/members-stripe-service@0.5.1
2021-12-02 14:52:59 +00:00
Sam Lord
ba2c0818e0 Use @tryghost/logging instead of injected argument 2021-12-02 14:46:58 +00:00
Fabien egg O'Carroll
9f7a1fa50d Published new versions
- @tryghost/members-api@2.8.3
2021-12-01 20:47:09 +02:00
Fabien egg O'Carroll
c99ebe589d Responded with 409 when we have DB conflicts
refs https://github.com/TryGhost/Team/issues/789

We are still having issues with duplicate subscriptions being inserted,
despite running our code in transactions. For now we will catch these
errors and response ot Stripe with a 409 so that it'll retry later - and
it stops us from throwing 500's
2021-12-01 20:44:21 +02:00
Rishabh
1bb5fdcb0b Published new versions
- @tryghost/members-api@2.8.2
2021-12-01 20:27:19 +05:30
Rishabh
43642216c8 Cleaned up fix for 500 errors on invalid Stripe subscription webhooks
no refs

- moves up check for invalid subscription before making any DB requests to fail fast
2021-12-01 20:26:33 +05:30
Rishabh
e83c9e38a7 Published new versions
- @tryghost/members-api@2.8.1
2021-12-01 20:21:46 +05:30
Rishabh Garg
dec16bd27c 🐛 Fixed 500 webhook errors for subscription with multiple prices (#350)
closes https://github.com/TryGhost/Team/issues/1238

- previously returned 500 errors when a subscription had multiple prices due to external tampering on Stripe directly
- instead now returns 400 Bad Request error when subscriptions don't have right number of prices
2021-12-01 20:09:55 +05:30
Fabien egg O'Carroll
cf73ce7fc3 Published new versions
- @tryghost/members-api@2.8.0
2021-12-01 13:18:14 +02:00
Fabien egg O'Carroll
cef8cadd21 Used the paid signup email when auto login is enabled
refs https://github.com/TryGhost/Team/issues/1067
refs https://github.com/TryGhost/Ghost/commit/579b3443

This will eventually be the only type of email sent from this function,
but for now is behind a feature flag for testing.
2021-12-01 13:17:23 +02:00
Fabien egg O'Carroll
985fd5bb5e Simplified interface for sending paid signup emails
refs https://github.com/TryGhost/Team/issues/1067

This decouples the contents/type of email from the webhooks service,
allowing us to easily make changes to the type of email sent, without
having to make changes to the webhooks service.
2021-12-01 13:17:23 +02:00
Fabien egg O'Carroll
b14403325c Published new versions
- @tryghost/members-api@2.7.6
2021-12-01 10:55:47 +02:00
Fabien egg O'Carroll
188423b1ed Removed Subscriptions without Prices from BREAD API
refs https://github.com/TryGhost/Team/issues/1243

It's possible to get into strange states where a subscription in Ghost
doesn't have an associated Price. This then has knock on effects because
we're dealing with data in an undefined state. Rather than add guards
against this throughout the entire stack, we stop returning it from the
BREAD API. It might be worth considering removing these subscriptions
from the response of the repository, but for now this is the most
minimal change that fixes the problem.
2021-12-01 10:45:50 +02:00
Fabien O'Carroll
2dc4f3209f Published new versions
- @tryghost/members-api@2.7.5
 - @tryghost/members-offers@0.10.3
 - @tryghost/members-payments@0.1.5
2021-11-25 12:39:34 +02:00
Fabien O'Carroll
3478aa3a92 Published new versions
- @tryghost/members-api@2.7.4
 - @tryghost/members-stripe-service@0.5.0
2021-11-09 11:20:40 +02:00
Fabien O'Carroll
b20f5a8b1f Updated linkSubscription to call method in transaction
no-issue

This was missing the options object which would force the DB call to be
run inside the same transaction as the rest
2021-11-09 11:19:05 +02:00
Fabien O'Carroll
2fcafcc8dc Removed coupons from subscriptions when the price changes
refs https://github.com/TryGhost/Team/issues/1092
refs https://github.com/TryGhost/Team/issues/1135

This was missed in the initial due to the issue tracking the task being
superceded, and the task not being copied across to the superceding
issue.

A new method to remove coupons has been added, as opposed to updating
the existing change subscription price method, because the removal of a
coupon is not the concern of an auxillary stripe service, but a busines
concern that should be explicit in the members-api codebase.
2021-11-09 11:12:13 +02:00
Fabien O'Carroll
4b005da248 Published new versions
- @tryghost/members-api@2.7.3
 - @tryghost/members-offers@0.10.2
 - @tryghost/members-payments@0.1.4
2021-11-07 23:14:00 +02:00
Fabien O'Carroll
155d9b4f7d Published new versions
- @tryghost/members-api@2.7.2
2021-11-05 10:22:48 +02:00
Fabien O'Carroll
47a7bd8555 Disabled auto-login when a success url is provided
refs https://github.com/TryGhost/Team/issues/1067

The auto-login behaviour obliterates the concept of a success URL,
because the Member is redirected in a logged in state, to the welcome
URL - rather than a logged out state to the success URL.

In order to not disrupt existing flows, we disable auto login if a
success URL is provided.
2021-11-05 10:18:43 +02:00
Fabien O'Carroll
844fa0cdb6 Published new versions
- @tryghost/members-api@2.7.1
2021-11-03 16:15:19 +02:00
Fabien O'Carroll
a9871f1ab9 Removed references to Offers labs flag
refs https://github.com/TryGhost/Team/issues/1115

This flag is now enabled by default - so we can clean up all uses of it.
2021-11-03 16:13:11 +02:00
Fabien O'Carroll
39c31b1824 Published new versions
- @tryghost/members-api@2.7.0
2021-11-03 11:00:56 +02:00
Fabien O'Carroll
81868c1850 Added alpha version of auto-login for Members
refs https://github.com/TryGhost/Team/issues/1067

This is the MVP for auto-login of Members, it does not support custom
redirects, and will always just redirect to the same place that the
signin & signup links do. Behind a feature flag whilst we iron out the
functionality.
2021-11-03 10:57:28 +02:00
Fabien O'Carroll
2c294be428 Published new versions
- @tryghost/members-api@2.6.2
2021-11-02 15:37:38 +02:00
Fabien O'Carroll
635c2614a3 Fixed errors for non-subscription invoices
refs https://github.com/TryGhost/Team/issues/887

Our invoice webhook handling code assumed that every invoice would be
for a subscription, but that is not the case. There are valid use-cases
of using the same Stripe account in order to sell items with a one-off
purchase. Here we update the handling to ignore all invoices which are
not for subscriptions.
2021-11-02 15:34:02 +02:00
Fabien O'Carroll
d0b349828a Published new versions
- @tryghost/members-api@2.6.1
2021-11-02 12:45:02 +02:00
Fabien O'Carroll
02bf858903 Fixed behaviour of sending emails when adding member
no-issue

When adding a new member, we allow an email to be sent, and the type of
email to be chosen. This choice was being overriden by our signup email
logic - here we allow the BREAD API to have full control over which
email is sent.
2021-11-02 12:37:07 +02:00
Fabien O'Carroll
1acf31833c Published new versions
- @tryghost/members-api@2.6.0
2021-10-25 14:33:48 +02:00
Fabien O'Carroll
68163863c2 Removed invoice.payment_failed webhook handling
refs https://github.com/TryGhost/Team/issues/885

This webhook isn't used and can cause issues when Checkout Sessions are
completed but with a failed payment. Removing it will remove those
errors.
2021-10-25 14:31:44 +02:00
Fabien O'Carroll
41b23dceb7 Published new versions
- @tryghost/members-api@2.5.0
2021-10-25 13:36:08 +02:00
Fabien O'Carroll
ed8a3ca27c Updated browse to not include products by default
no-issue

The Members API does not currently include 'products' by default when
browsing. This ensures the functionality is maintained.
2021-10-25 13:34:20 +02:00
Fabien O'Carroll
0144ad1f7e Published new versions
- @tryghost/members-api@2.4.4
 - @tryghost/members-offers@0.10.1
 - @tryghost/members-payments@0.1.3
2021-10-22 16:49:55 +02:00
Fabien O'Carroll
af1a019f0e Published new versions
- @tryghost/members-api@2.4.3
 - @tryghost/members-offers@0.10.0
 - @tryghost/members-payments@0.1.2
2021-10-22 14:53:16 +02:00
Fabien O'Carroll
01a1a83c52 Published new versions
- @tryghost/members-api@2.4.2
 - @tryghost/members-offers@0.9.0
 - @tryghost/members-payments@0.1.1
2021-10-22 14:16:29 +02:00