Commit Graph

4 Commits

Author SHA1 Message Date
Fabien O'Carroll
ff2da8a417 Added and emitted events for Offer Created
refs https://github.com/TryGhost/Team/issues/1166

Since we removed the creation of coupons from the Offers module, we must
emit events so that the Payments module can handle creating Coupons when
Offers are created.

We also export the events from the module so that they can be listened
to by the Payments module.

We also export other internals of the module so that the types can be
used.
2021-10-21 15:40:55 +02:00
Fabien O'Carroll
947fa74b9e Removed stripe_coupon_id handling from Offers
refs https://github.com/TryGhost/Team/issues/1166

This will be handled by a payments module instead. In order to
disconnect Stripe we must delete all Stripe related data, which means an
Offer doesn't inherently have a stripe coupon id. Instead we can use a
payments service which will get/create the coupon for us when we need
it.
2021-10-21 15:40:55 +02:00
Fabien O'Carroll
1312943f5b Updated Offer to only change code once
no-issue

This simplifies the handling of updating redirects for a code, and
doesn't affect our application layer because we never have the need to
change a code twice.

In future this should be replaced with events at the domain level - so
that we do not have to track changed properties and instead a redirect
service can listen to events, which would be dispatched on a successful
save by the repository.
2021-10-08 13:02:22 +02:00
Fabien O'Carroll
4a27ef68df Moved events into domain directory
no-issue

Events are a domain concern and as such should live in this directory
2021-10-08 12:21:27 +02:00