* Add upcominginvoice field to Subscription type
* Add support for fetching upcoming invoices
* Put back upcominginvoice
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
* created selfhosted endpoint
* make autogenerated mocks
* add test
* add user id
* remove user id requirement
* add tests
* send user id with request
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
* Call Cloud HandleLicenseChange when license is changed in a cloud context
* Remove UpdateSubscriptionFromHook as its no longer necessary
* Update mocks
* Remove another reference
* Remove translation
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
There were lots of cases where we were using the code 501
in an incorrect manner, and since 5xx codes are considered
as SLO violations, these were flagged by our monitoring incorrectly.
These were the guidelines to change the codes:
1. Any case of missing license or config not correctly enabled
is set as Forbidden. The logic is that the user is correctly
authenticated with a session, but does not have enough privileges
to have the higher license, or hasn't changed the config correctly.
2. Any case of incorrectly formed request is obviously a 400.
https://mattermost.atlassian.net/browse/MM-43202
```release-note
NONE
```
* MM-45713 - change 500 error to json object
* validate possible encoding errors and follow standards
* replace normal debugging string with true string
* use bool type instead of string
Co-authored-by: Pablo Velez Vidal <pablo.velez@mattermost.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
* MM-45174 - split validate business email logic
* remove unnecessary interface method
* check for error just after the cloud call to prevent server panic
Co-authored-by: Pablo Velez Vidal <pablo.velez@mattermost.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
* [MM-43649] - Ability for end users to notify admin to upgrade workspace
* add test case
* move code to app layer
* feedback impl
* feedback impl-1
* feedback impl
* simplify logic
* fix typo and lint
* fix app layers
* Use a single critical section for users notified admin (#20488)
* Use a single critical section for users notifying admin
* change persistence mechanism
* add more tests
* change bot message
* fix translations
* update logic to notify once within cooloff period
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Nathaniel Allred <neallred@protonmail.com>
* MM-44863 - update trial details in product menu
* update the test to reflect the initial returned subscription
Co-authored-by: Pablo Velez Vidal <pablo.velez@mattermost.com>
* MM-44509 - subscription change not reflected after trial
* fix the tests
* receive the subscription id as param, defer the cache invalidation
* validate business email with body request
* update api request to accept json body payload
* fix unit tests
* fix tests after merge conflict fixes
Co-authored-by: Pablo Velez Vidal <pablo.velez@mattermost.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
* MM-43666 - request bussiness email
* add the newValidEmail information
* revert ff model changes
* remove unnecessary pointer and fix test spelling
* fix unit tests and add a new one for when passing a valid email
* fix go lint
Co-authored-by: Pablo Velez Vidal <pablo.velez@mattermost.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
* MM-43529 - start freemium trial
* change the method to put
* Add unit testing for the request-trial-endpoint
* use correct require
* add the translation texts
* fix texts
* remove unnecessary log
* change response status code to forbidden when non cloud
Co-authored-by: Pablo Velez Vidal <pablo.velez@mattermost.com>
* Updating email templates for trial will end and trial will end emails
* put back variable
* Rebuilding
* fix tests
* Updates
* [MM-43339] Add Cloud Subscription Upgrade Confirmation Email (#19989)
* Add Cloud Upgrade Confirmation email
* Updates
* String change
* i18n-extract
* Updates
* make email-mocks
* Appease linter
* Add a test
* GMAIL NEVER RENDERS RIGHT
* Important EVERYWHERE because gmail just cant deal
* l
* Last one
* Update image
* Update tests
* Fix tests
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
* Change internal getProducts to filter on a set of families instead of a single family.
* Extend /products endpoint to be able to return any of the current four sets of product families.
* Use include_legacy query param to decide which cloud products to request.
* Add a controller for changing subscription
* Changes for PR
* Another change
* Fix pipeline
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
* add request context
* move initialialization to server
* use app interface instead of global app functions
* remove app context from webconn
* cleanup
* remove duplicated services
* move context to separate package
* remove finalize init method and move content to NewServer function
* restart workers and schedulers after adding license for tests
* reflect review comments
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
* [MM-35039] - Send trial ended email
* Generations
* Use First name with fallback to username
* Use First name with fallback to username for trial ending email