Commit Graph

15 Commits

Author SHA1 Message Date
Ronald Langeveld
010e8394aa
🐛 Fixed direct paid signups on Stripe beta (#20215)
ref ONC-35

- customer_update should only be defined where cutomer_id exists and
labs are enabled.
- added additional unit testing
2024-05-16 08:47:23 +08:00
Sag
60ac3c735b
🐛 Fixed updating payment method when beta flag is on (#20171)
refs https://linear.app/tryghost/issue/ONC-20
refs https://linear.app/tryghost/issue/ENG-867

- when using dynamic payment methods in Stripe, we need to provide a
currency. Stripe uses that parameter to determine which payment methods
to render
- docs: https://docs.stripe.com/api/checkout/sessions/create
2024-05-08 20:56:17 +02:00
Fabien O'Carroll
c1b72b3997 Wired up additional payment types with labs flag
ref ENG-812
ref https://linear.app/tryghost/issue/ENG-812
2024-04-04 23:13:10 +07:00
Michael Barrett
094ea1d2b0
🐛 Fixed plan upgrade not cancelling trial (#18699)
closes https://github.com/TryGhost/Product/issues/4036

Fixed a bug where a member on a trial plan would not have their trial
cancelled when they upgraded to a paid plan
2023-10-20 08:52:08 +01:00
Sag
daa19e06b4
Added request throttling to stay under the Stripe Search API rate limits (#17393)
refs https://github.com/TryGhost/Product/issues/3593

- also uses `.current_period_end` instead of `.created_at` to retrieve
the most recent subscription, when multiple customer with the same email
address are found. Reason: `created_at` date is reset when migrating
subscriptions between Stripe accounts
2023-07-18 09:41:42 +00:00
Sag
9f438972f1
Added search by email for Stripe Customer ID during member import (#17326)
closes https://github.com/TryGhost/Product/issues/3593

- when importing members via CSV, it's now possible to add the value "auto" for the "stripe_customer_id" field. When this option is passed, the importer will search for a Stripe customer based on the email address provided
- if there are multiple Stripe customers with the same email address, the customer with the most recent subscription is returned
2023-07-13 13:20:54 +02:00
Hannah Wolfe
6161f94910
Updated to use assert/strict everywhere (#17047)
refs: https://github.com/TryGhost/Toolbox/issues/595

We're rolling out new rules around the node assert library, the first of which is enforcing the use of assert/strict. This means we don't need to use the strict version of methods, as the standard version will work that way by default.

This caught some gotchas in our existing usage of assert where the lack of strict mode had unexpected results:
- Url matching needs to be done on `url.href` see aa58b354a4
- Null and undefined are not the same thing,  there were a few cases of this being confused
- Particularly questionable changes in [PostExporter tests](c1a468744b) tracked [here](https://github.com/TryGhost/Team/issues/3505).
- A typo see eaac9c293a

Moving forward, using assert strict should help us to catch unexpected behaviour, particularly around nulls and undefineds during implementation.
2023-06-21 09:56:59 +01:00
Fabien "egg" O'Carroll
104f84f252 Added eslint rule for file naming convention
As discussed with the product team we want to enforce kebab-case file names for
all files, with the exception of files which export a single class, in which
case they should be PascalCase and reflect the class which they export.

This will help find classes faster, and should push better naming for them too.

Some files and packages have been excluded from this linting, specifically when
a library or framework depends on the naming of a file for the functionality
e.g. Ember, knex-migrator, adapter-manager
2023-05-09 12:34:34 -04:00
Patrick McKenzie
559ca9d866
🐛 Stopped creating redundant Stripe Customers for Members
fixes https://github.com/TryGhost/Ghost/issues/16057

Briefly, Ghost created two Customer objects via the Stripe API when an
existing subscriber would upgrade to a paid subscription, one in an API
call to create the Customer and then a second as a side effect of an API
call to create a Checkout session for the user. The fix is passing the
reference to the Customer object to the API call to create the Checkout
session; Stripe will no longer redundantly create a Customer object in
this case.

This largely impacts the owner's experience of the Stripe Dashboard; it
will correct their new Customer count (going forward) and make searches
for users by name or email address return one responsive object which
has the actual subscription in it versus returning two and forcing them
to look in each to e.g. refund a transaction or similar.
2023-01-06 11:44:56 +07:00
Rishabh
da0254846b Fixed trial days validation for stripe checkout
refs e26c977c66

- updates check for valid non null trial days before creating checkout session
2022-08-09 14:14:22 +05:30
Rishabh
54860d2b64 Wired trial days to stripe checkout session
refs https://github.com/TryGhost/Team/issues/1724

- wires trial days stored on a tier to stripe checkout session creation
- removes deprecated `trial_from_plan` if trial days is set
2022-08-05 17:23:40 +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
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
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