-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate renewal token when one is requested #898
Conversation
https://eaflood.atlassian.net/browse/RUBY-1166 If a registration is eligible for renewal NCCC would like us to display the same renewal link that gets included in the renewal reminder emails and letters in registration details. Currently though we only generate the token used in the link when first generating the reminder email. A registration is eligible for renewal before this is done. And when we first release there will be hundreds that are eligible which will never go through the reminder process because it is too late. The simplest solution we have for this is to generate it if required. This way we avoid any timing issues or another scheduled task that would have to try and identify all eligible registrations and update them in one go. So this change will add some logic to automatically generate and save a token if one does not exist when the token is requested.
Kept getting messages about using the wrong version of bundler when trying to run up the rails console in the dummy app. Spotted that we had a .ruby-version file with the old version in it. I could have corrected the version but actually there is no need for it to be here when we have one in the root of the project.
Documentation was scant but found there is a way to override the default getter Mongoid provides. The key thing is to access the underlying data field you need to use `self[:field_name]`. So now we can just ask for `renew_token` where we need it, and one will be generated automatically if it doesn't exist.
We should no longer need to call this method when we can request `renew_token` directly.
https://eaflood.atlassian.net/browse/RUBY-1166 If a registration is eligible for renewal NCCC would like us to display the same renewal link that gets included in the renewal reminder emails and letters in registration details. Currently though we only generate the token used in the link when first generating the reminder email. A registration is eligible for renewal before this is done. And when we first release there will be hundreds that are eligible which will never go through the reminder process because it is too late. The simplest solution we have for this is to generate it if required. We made that change in the engine in [PR #898](DEFRA/waste-carriers-engine#898). This change updates the back-office to use the new functionality.
@irisfaraway check out DEFRA/waste-carriers-back-office#962 to see how using this version of the engine affects the back-office 😁 |
More for future reference as finding examples of this was super-hard A subsequent answer recommends using |
https://eaflood.atlassian.net/browse/RUBY-1166 If a registration is eligible for renewal NCCC would like us to display the same renewal link that gets included in the renewal reminder emails and letters in registration details. Currently, though we only generate the token used in the link when first generating the reminder email. A registration is eligible for renewal before this is done. And when we first release there will be hundreds that are eligible which will never go through the reminder process because it is too late. The simplest solution we have for this is to generate it if required. We made that change in the engine in [PR #898](DEFRA/waste-carriers-engine#898). This change updates the back-office to use the new functionality.
https://eaflood.atlassian.net/browse/RUBY-1166 If a registration is eligible for renewal NCCC would like us to display the same renewal link that gets included in the renewal reminder emails and letters in registration details. Currently though we only generate the token used in the link when first generating the reminder email. A registration is eligible for renewal before this is done. And when we first release there will be hundreds that are eligible which will never go through the reminder process because it is too late. The simplest solution we have for this is to generate it if required. We made that change in the engine in [PR #898](DEFRA/waste-carriers-engine#898). This change updates the back-office to use the new functionality.
https://eaflood.atlassian.net/browse/RUBY-1166
If a registration is eligible for renewal NCCC would like us to display the same renewal link that gets included in the renewal reminder emails and letters in registration details.
Currently though we only generate the token used in the link when first generating the reminder email. A registration is eligible for renewal before this is done. And when we first release there will be hundreds that are eligible which will never go through the reminder process because it is too late.
The simplest solution we have for this is to generate it if required. This way we avoid any timing issues or another scheduled task that would have to try and identify all eligible registrations and update them in one go.
So this change will add some logic to automatically generate and save a token if one does not exist when the token is requested.