Commit Graph

20 Commits

Author SHA1 Message Date
Rishabh
2ac24b9d4c Handled newsletter preference for paid members signup
refs https://github.com/TryGhost/Team/issues/1490

With multiple newsletters, paid members can choose their newsletter preference at the time of signup via Portal. This change handles the newsletter preference via stripe checkout metadata and stores it against the member on completing signup.
2022-04-13 15:02:58 +05:30
Naz
af4d7b4938 Fixed failing migration requests when client runs in a test env
no issue

- When Ghost is running in a test environment, it is configured with an invalid Stripe key that looks like `sk_test***`. In this case the migrations try runnig creating request to Stripe, which fail. The failures pollute the output, which makes other valid errors lost.
- An example of such error log is following:
```
Invalid API Key provided: sk_test_******ripe

----------------------------------------

Error: Invalid API Key provided: sk_test_******ripe
    at res.toJSON.then.StripeAPIError.message (/home/naz/Workspace/Ghost/Ghost/node_modules/stripe/lib/StripeResource.js:214:23)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
```
- There doesn't seem to be a good reason to do migrations in the test environment. Skipping them as a special case to fix the output pollution problem seems like a right solution
2022-04-05 21:36:22 +12:00
Fabien 'egg' O'Carroll
633dc08c11 Added migration to update Stripe Product names (#376)
refs https://github.com/TryGhost/Team/issues/1289

We had a bug where Tiers would have a name of 'Default Product', and a
Stripe Product would be created with the same name. This migration will
fixes those broken Stripe Products
2022-03-09 14:41:59 +00:00
Naz
27fe7ed61c 🐛 Fixed StripeAPI disconnection
refs https://github.com/TryGhost/Toolbox/issues/214

- After disconnecting Stripe API the `_configured` flag stayed as `true`, causing behaviors as if Stripe was still connnected.
- The `api.configure` method was never reachable when disconnecting Stripe API, thus causes hanging "configured === false" state inside of the StripeAPI wrapper
2022-02-18 22:21:56 +13:00
Fabien "egg" O'Carroll
f452df7e92 Fixed error handling webhook for unknown member
refs https://github.com/TryGhost/Team/issues/1374

We cannot update payment details for members which we don't know about,
so returning and giving a successful response to Stripe is the correct
thing to do.
2022-02-17 13:51:47 +02:00
Hannah Wolfe
3dcf85d5e4 Ensured correct usage of @tryghost/errors everywhere
refs: 23b383bedf

- @tryghost/error constructors take an object, not a string - the expectation is that message, context & help should all be set
- This does the bare minimum and just ensures message is set correctly
2022-02-15 12:30:36 +00:00
Fabien "egg" O'Carroll
6ce441f760 Moved the last of the Stripe config out of Members
refs https://github.com/TryGhost/Team/issues/1322

We no longer restart the Members service based on the Stripe service
being updated, which meant that if it was initially configured with
missing URL's and later Stripe connected, it would not get the new
config until a server restart. This moves the last of Stripe config into
the Stripe service, so that all things concerning Stripe can be handled
in one place and updated together.
2022-02-15 10:57:40 +02:00
Fabien "egg" O'Carroll
8915d15a1d Added migration to update Default Tier name
refs https://github.com/TryGhost/Team/issues/1289

This ensures that we set the default tier's name to the title of the
site - which looks a lot better than "Default Product".
2022-02-01 13:16:06 +02:00
Fabien "egg" O'Carroll
7698729375 Updated email handler for webhooks
refs https://github.com/TryGhost/Team/issues/1168

This ensures that the correct email type is sent
2022-02-01 11:54:16 +02:00
Fabien "egg" O'Carroll
fc5ff5c9e4 Fixed sending emails to paid signups
refs https://github.com/TryGhost/Team/issues/1293

We were referencing the incorrect method from the members-api which
would fail to send the email.
2022-01-26 22:25:07 +02:00
Fabien "egg" O'Carroll
560d1f72d8 Fixed reference to sendMagicLink
no-issue

This was referencing the wrong object to get the sendMagicLink method.
2022-01-24 17:35:51 +02:00
Fabien "egg" O'Carroll
ab215fb96a Added missing default parameter for opts
no-issue

The `opts` parameter is optional but there was no default defined, this
was causing errors when trying to read the forceCreate property if opts
was not passed.
2022-01-20 10:58:34 +02:00
Fabien "egg" O'Carroll
f488438ad0 Added check for Stripe config before migrations
no-issue

This stops us from attempting to run the migrations if Stripe has not
been configured.
2022-01-18 11:18:08 +02:00
Fabien "egg" O'Carroll
74225779a2 Moved webhook handling into Stripe service
no-issue

Handling Stripe webhooks is a Stripe concern and so we're moving it into
the Stripe module.
2022-01-18 10:37:47 +02:00
Fabien "egg" O'Carroll
635aa8aa3f Added WebhookManager and StripeService modules
no-issue
2022-01-18 10:37:47 +02:00
Fabien "egg" O'Carroll
344102f1aa Cleaned up StripeAPI
no-issue

- Removed unused types
- Removed configure on creation feature (unused)
- Explicitly handled configuration with no config
2022-01-18 10:37:47 +02:00
Fabien "egg" O'Carroll
1b837b8ed0 Updated internals of Migrations module
no-issue

This simplifies the dependency structure.
2022-01-18 10:37:47 +02:00
Fabien "egg" O'Carroll
8dee8752d3 Moved Stripe migrations into Stripe package
refs https://github.com/TryGhost/Team/issues/1257

This will allow us to run the Stripe migrations without rebooting the
Members service.
2022-01-18 10:25:37 +02:00
Fabien "egg" O'Carroll
00ec7157a6 Renamed StripeService -> StripeAPI
no-issue

This module is going to encapsulate all of the Stripe related logic, so
I'm renaming this file to be a little more specific about what it
relates to. Essentially this module will export a Stripe Service, and
this file is just one part of that.
2022-01-18 10:25:37 +02:00
Fabien "egg" O'Carroll
c120490a00 Moved members-stripe-service -> stripe
no-issue

We are already in the Members repository so there's no need for members
in the directory name. The NPM package name however is unchanged and
still requires specificity as it is scoped to @tryghost as a whole
rather than the Members feature.
2022-01-18 10:25:37 +02:00