Commit Graph

960 Commits

Author SHA1 Message Date
Fabien O'Carroll
2b58ecd82e Added support for creating fixed offers with currency
refs https://github.com/TryGhost/Team/issues/1083

We now allow creating offers for a fixed amount, rather than a
percentage. These require a currency to be passed as a fixed amount is
meaningless without one.
2021-10-07 17:37:48 +02:00
Fabien O'Carroll
2c04afe810 Updated types of Offers to "fixed" and "percent"
no-issue

This is inline with the language used elsewhere to describe these types.
2021-10-07 17:35:34 +02:00
Fabien O'Carroll
6d383c2d0e Added support for "once" and "forever" Offer duration
refs https://github.com/TryGhost/Team/issues/1083

Instead of Offers being hardcoded to the "once" duration this will allow
Admins to start creating offers of variable durations.
2021-10-07 17:13:23 +02:00
Fabien O'Carroll
ea0282c80e Published new versions
- @tryghost/members-offers@0.3.2
2021-10-07 16:46:52 +02:00
Fabien O'Carroll
504fb1bfa1 Used Value Objects to validate outside of Offer factory
no-issue

This adds the concept of "Value Objects" to an Offers properties,
allowing us to move validation out and ensure that an Offer will only
ever have valid properties, without having to duplicate checks - or
leave them to the persistent layer. This means we can fail early, as
well as write unit tests for all of our validation.
2021-10-07 16:46:08 +02:00
Fabien O'Carroll
a673b2ae99 Published new versions
- @tryghost/members-offers@0.3.1
2021-10-07 12:47:03 +02:00
Fabien O'Carroll
d9e40c6070 Ensured Offer code is slugified
refs https://github.com/TryGhost/Team/issues/1083

This ensures that the code will be URL safe for redirects
2021-10-07 12:45:51 +02:00
Fabien O'Carroll
309e827a7f Published new versions
- @tryghost/members-api@2.1.0
 - @tryghost/members-offers@0.3.0
2021-10-06 16:55:51 +02:00
Fabien O'Carroll
6ae8b7eb0c Added stripeCouponId to Offer
refs https://github.com/TryGhost/Team/issues/1090

When creating a Stripe Checkout Session for an Offer - we need access to
the underlying Stripe Coupon. Exposing it here allows consumers of the
OfferRepository access.
2021-10-06 16:12:53 +02:00
Fabien O'Carroll
f0141f08ff Applied Offers when creating Stripe Checkout Session
refs https://github.com/TryGhost/Team/issues/1090

Instead of the hardcoded 1-day version for Offers, we can now talk
directly to the Offers repository and use the real values for Stripe
Checkout.
2021-10-06 16:12:53 +02:00
Fabien O'Carroll
d57d082c39 Exposed OfferRepository from OffersModule
refs https://github.com/TryGhost/Team/issues/1090

When creating checkout session we will need to be able to look up Offers
from the OfferRepository. This exposes the repository so that it can be
passed as a dependency elsewhere.
2021-10-06 15:15:03 +02:00
Fabien O'Carroll
371581f677 Published new versions
- @tryghost/members-offers@0.2.1
2021-10-06 12:08:48 +02:00
Fabien O'Carroll
dbc7d73be7 Fixed updateOffer API method
no-issue

- Property names were out of sync with API
- Async methods were not awaited
- Transaction was erroneously commited
2021-10-06 12:07:03 +02:00
Fabien O'Carroll
6397438e73 Published new versions
- @tryghost/members-offers@0.2.0
2021-10-05 16:27:31 +02:00
Fabien O'Carroll
33d042ccf7 Added getOffer method to OffersAPI
refs https://github.com/TryGhost/Team/issues/1083
2021-10-05 16:25:56 +02:00
Fabien O'Carroll
b3ed676e53 Moved redirect handling outside of repository
no-issue

The redirect handling is more of an application concern that can happen
at the top level, rather than the lower level of the repository.
2021-10-05 16:24:47 +02:00
Fabien O'Carroll
d4ed604cce Published new versions
- @tryghost/members-offers@0.1.2
2021-10-05 13:15:47 +02:00
Fabien O'Carroll
5dd5b71718 Fixed redirects for new offers
refs https://github.com/TryGhost/Team/issues/1091
2021-10-05 13:14:33 +02:00
Fabien O'Carroll
587954faf9 Published new versions
- @tryghost/members-offers@0.1.1
2021-10-05 11:44:32 +02:00
Fabien O'Carroll
ef73121ae4 Fixed UniqueChecker methods
no-issue

These were returning the opposite of what they should have.
2021-10-05 11:43:38 +02:00
Fabien O'Carroll
81badcae2e Published new versions
- @tryghost/members-offers@0.1.0
2021-10-05 11:19:44 +02:00
Fabien O'Carroll
5674036902 Added initial Offers module
refs https://github.com/TryGhost/Team/issues/1083

This is the initial scaffolding for setting up Offers in Ghost
2021-10-05 11:19:15 +02:00
Fabien O'Carroll
b03221401e Published new versions
- @tryghost/members-api@2.0.0
2021-10-04 13:35:10 +02:00
Fabien 'egg' O'Carroll
c5784da2b6 Updated MembersAPI to take StripeAPIService as dep (#338)
refs https://github.com/TryGhost/Team/issues/1083

The Offers service is going to need access to the StripeAPIService too,
so we must pull its initialisation out of this module up to the Ghost
application layer, which will allow us to pass a reference of the
StripeAPIService to wherever needs it.
2021-10-04 13:34:17 +02:00
Fabien O'Carroll
9341c318d3 Published new versions
- @tryghost/members-api@1.39.1
 - @tryghost/members-stripe-service@0.3.0
2021-10-01 13:18:02 +02:00
Fabien O'Carroll
515a50f2a4 Updated subscription price changes to always invoice
refs https://github.com/TryGhost/Team/issues/1075

Without this flag, payment for upgrading to a more expensive plan will
be taken at the end of the current billing cycle, which could be a year
from the date of the switch - this would effectively give free access to
more expensive prices.
2021-10-01 12:27:09 +02:00
Fabien O'Carroll
a438795d4a Published new versions
- @tryghost/express-dynamic-redirects@0.1.0
2021-09-29 12:02:26 +02:00
Fabien 'egg' O'Carroll
8c92f5744c Added express-dynamic-redirects module (#337)
refs https://github.com/TryGhost/Team/issues/1091

The Offers feature needs to be able to add and remove redirects to Ghost
- which is very similar to the custom redirects functionality. Here we've
pulled out the core of the dynamic redirect part of custom redirects so
that it can be used by both features and have code shared between them.
2021-09-29 12:01:40 +02:00
Fabien O'Carroll
dad54a25b1 Published new versions
- @tryghost/domain-events@0.1.2
 - @tryghost/magic-link@1.0.13
 - @tryghost/member-analytics-service@0.1.2
 - @tryghost/member-events@0.2.1
 - @tryghost/members-analytics-ingress@0.1.3
 - @tryghost/members-api@1.39.0
 - @tryghost/members-csv@1.1.7
 - @tryghost/members-importer@0.3.3
 - @tryghost/members-ssr@1.0.14
 - @tryghost/members-stripe-service@0.2.0
2021-09-28 13:40:14 +02:00
Fabien O'Carroll
cd6e87774a Added 1-day version of Offers
refs https://github.com/TryGhost/Team/issues/1090

This 1-day version of Offers allows us to test the full flow of the
Offers feature without having to implement all of it. The focus here is
that we can pass an Offer ID when creating a Stripe Checkout session and
have it apply. Here we use hardcoded Stripe Coupons as we haven't yet
got persistence implemented for Offers & their related Stripe Coupons
2021-09-28 13:39:04 +02:00
Fabien O'Carroll
e5b0cf8686 Added basic support for coupons
refs https://github.com/TryGhost/Team/issues/1090

This allows us to create Stripe Coupons and use them with Stripe
Checkout from the members-api module whilst we develop the Offers
feature.
2021-09-28 13:39:04 +02:00
Renovate Bot
c13be723e6 Update dependency mocha to v9.1.2 2021-09-28 07:42:20 +00:00
Fabien O'Carroll
2d68442af1 Published new versions
- @tryghost/members-api@1.38.1
2021-09-23 11:16:44 +02:00
Fabien O'Carroll
e93d092766 Fixed handling of invalid tokens when changing email
no-issue

Without a return after ending the response, the code will continue to
attempt to send emails and then send another response which results in
an uncaught error.
2021-09-23 11:12:23 +02:00
Fabien O'Carroll
9031602406 Published new versions
- @tryghost/members-api@1.38.0
2021-09-22 16:50:02 +02:00
Fabien O'Carroll
4e947a88ce Fixed security hole in email address change flow
refs https://github.com/TryGhost/Ghost/security/advisories/GHSA-65p7-pjj8-ggmr

The email address change flow was built on top of the unauthenticated
signin/signup flow. This meant that ownership of the email being changed
wasn't verified and allowed a malicious actore to change the email
address of arbitrary accounts to an email address which they controlled.

We remove the ability to change email addresses from the signin/signup
flow and instead create a dedicated, authenticated flow for changing
email address.
2021-09-22 16:49:17 +02:00
Rishabh
21fbaff41b Published new versions
- @tryghost/members-api@1.37.5
2021-09-22 18:13:43 +05:30
Rishabh
fe4fb78830 Cleaned up stripe-service package usage
no refs

- updates all usages of `stripe-service` package to new correct `members-stripe-service` package
2021-09-22 18:12:40 +05:30
Rishabh
aa0b95528e Published new versions
- @tryghost/members-api@1.37.4
 - @tryghost/members-stripe-service@0.1.0
2021-09-22 18:09:11 +05:30
Rishabh
c21a77cd01 Removed tests temporarily to publish new stripe package
no refs
2021-09-22 18:08:30 +05:30
Rishabh
3e54819469 Revert "Updated usage of stripe-service package to members-stripe-service package"
This reverts commit 7363f0769d.
2021-09-22 18:05:41 +05:30
Rishabh
7363f0769d Updated usage of stripe-service package to members-stripe-service package
refs 8b90c93a79
2021-09-22 18:02:50 +05:30
Rishabh
8b90c93a79 Renamed stripe-service package to members-stripe-service
no refs

- the package `@tryghost/stripe-service` was already published and used in a different context, so this package was never able to get published and the references in Members package are incorrectly pointing to wrong package
- renames the package in members context
2021-09-22 18:00:47 +05:30
Rishabh
dacb1d6fa0 Published new versions
- @tryghost/member-analytics-service@0.1.1
 - @tryghost/members-analytics-ingress@0.1.2
 - @tryghost/members-api@1.37.3
2021-09-22 17:21:49 +05:30
Rishabh
e1d96b5086 Updated missing packages
no refs

- cleans up package usage across new members packages
2021-09-22 17:18:39 +05:30
Rishabh
1c25665e7e Published new versions
- @tryghost/members-api@1.37.2
2021-09-22 16:57:30 +05:30
Rishabh
85db4aa8bd Removed unused packages from members-api
no refs

Cleans up unused package dependencies on members-api
2021-09-22 16:56:28 +05:30
Rishabh
411345ed42 Published new versions
- @tryghost/members-analytics-ingress@0.1.1
 - @tryghost/members-api@1.37.1
2021-09-22 16:53:59 +05:30
Rishabh
37001c539d Fixed lint
no refs
2021-09-22 16:52:40 +05:30
Rishabh
317caacc0e Updated ingress event handler to use new analytics ingress package
refs https://github.com/TryGhost/Team/issues/1064

- updates handling of member events to use new analytics ingress package which is responsible to ensure storage of event
2021-09-22 16:51:03 +05:30