Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
https://eaflood.atlassian.net/browse/WATER-3906
https://eaflood.atlassian.net/browse/WATER-3925
In the sroc-charging-module-api project all our 'presenters' inherited from a
base.presenter.js
. It contained handy util methods, for example,formatDate()
which formats a date as aDD-MMM-YYYY
string.Turns out, we need exactly that when preparing the transaction data to be sent to the charging module API! So, we add a
base.presenter.js
module for the first time. We'll bring over some of what we have in the sroc-charging-module-api as it hasformatDate()
andleftPadZeroes()
which is what we need right now.One thing to note is the sroc-charging-module-api was built mainly from classes. We wanted to align more with JavaScript conventions for this project so have stuck to modules. That means our presenters won't inherit the base. Instead, those that need it can just
require()
it and its functions. We've stuck with the name 'base' though as it's our convention for a base object that is intended to be used by related objects.