Ghost icon indicating copy to clipboard operation
Ghost copied to clipboard

Handled setting up free trial offers

Open rshbhgrg opened this issue 3 years ago • 2 comments

refs https://github.com/TryGhost/Team/issues/1726

  • updates offer type validation to include trial
  • add offer duration validation which includes trial for free trial offers
  • updates offer setup to allow new trial as discount type, was prev only fixed and percent
  • updates offer setup to allow amount as free trial days value
  • updates offer setup to allow trial as discount duration value for trial offers, was prev only once/forever/repeating
  • free trial offers don't need a stripe coupon created for them, checkout sessions for free trial offers ignore stripe coupon and directly pass the trial days value
  • trial days of an offer take precedence over trial days added as default to a tier

rshbhgrg avatar Aug 09 '22 09:08 rshbhgrg

It looks like this PR contains a migration 👀 Here's the checklist for reviewing migrations:

General requirements

  • [ ] Satisfies idempotency requirement (both up() and down())
  • [ ] Does not reference models
  • [ ] Filename is in the correct format
  • [ ] Targets the next minor version
  • [ ] All code paths have appropriate log messages
  • [ ] Uses the correct utils
  • [ ] Contains a minimal changeset
  • [ ] Does not mix DDL/DML operations

Schema changes

  • [ ] Both schema change and related migration have been implemented
  • [ ] For index changes: has been performance tested for large tables
  • [ ] For new tables/columns: fields use the appropriate predefined field lengths
  • [ ] For new tables/columns: field names follow the appropriate conventions
  • [ ] Does not drop a non-alpha table outside of a major version

Data changes

  • [ ] Mass updates/inserts are batched appropriately
  • [ ] Does not loop over large tables/datasets
  • [ ] Defends against missing or invalid data
  • [ ] For settings updates: follows the appropriate guidelines

github-actions[bot] avatar Aug 09 '22 09:08 github-actions[bot]

Codecov Report

Merging #15202 (f7bee77) into main (fa25b72) will increase coverage by 0.04%. The diff coverage is 74.57%.

@@            Coverage Diff             @@
##             main   #15202      +/-   ##
==========================================
+ Coverage   52.69%   52.73%   +0.04%     
==========================================
  Files        1354     1354              
  Lines       86695    86733      +38     
  Branches     9716     9727      +11     
==========================================
+ Hits        45682    45737      +55     
+ Misses      40962    40946      -16     
+ Partials       51       50       -1     
Impacted Files Coverage Δ
ghost/members-api/lib/controllers/router.js 0.00% <0.00%> (ø)
ghost/offers/lib/application/OfferMapper.js 0.00% <0.00%> (ø)
ghost/offers/lib/application/OfferRepository.js 0.00% <0.00%> (ø)
ghost/payments/lib/payments.js 0.00% <0.00%> (ø)
ghost/core/core/server/data/schema/schema.js 100.00% <100.00%> (ø)
ghost/offers/lib/domain/models/Offer.js 94.29% <100.00%> (+0.15%) :arrow_up:
ghost/offers/lib/domain/models/OfferAmount.js 100.00% <100.00%> (ø)
ghost/offers/lib/domain/models/OfferDuration.js 100.00% <100.00%> (ø)
ghost/offers/lib/domain/models/OfferType.js 100.00% <100.00%> (ø)
ghost/core/core/server/data/db/connection.js 82.45% <0.00%> (-1.16%) :arrow_down:
... and 8 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov[bot] avatar Aug 09 '22 09:08 codecov[bot]