Skip to content
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

Feature/Handle Meter Value Cost Update #301

Merged
merged 4 commits into from
Dec 17, 2024

Conversation

lydiazcheng
Copy link
Contributor

Context

If sendCostUpdatedOnMeterValue is true, meterValues handler should trigger cost update

Changes

  1. Add checks for sendCostUpdatedOnMeterValue config and meterValue context in the meterValues handler. If they are true and ReadingContextEnumType.Sample_Periodic, handler stores the transactionDbId in meterValue record. And then it triggers a CostUpdated request.
  2. Update the totalCost in database.
  3. Fix missing last meterValue problem when creating a new meterValue in db and then reading all meterValues.

Test

  1. In config, remove costUpdatedInterval and set sendCostUpdatedOnMeterValue to true.
  2. Create a tariff for charger.
  3. Charger sends TransactionEvent with "eventType":"Started" to start a new transaction
  4. Charger sends MeterValues
  5. Citrine responds the request and sends a CostUpdated req containing the totalCostScreenshot 2024-11-25 at 11 49 54 AM
  6. The totalCost is updated in db. Screenshot 2024-11-25 at 11 53 53 AM

@lydiazcheng lydiazcheng self-assigned this Nov 25, 2024
Base automatically changed from rc-1.5.0 to main December 2, 2024 19:28
@thanaParis thanaParis changed the base branch from main to rc-1.6.0 December 2, 2024 19:58
Signed-off-by: thanaParis <thana.paris@s44.team>
Signed-off-by: thanaParis <thana.paris@s44.team>
Signed-off-by: thanaParis <thana.paris@s44.team>
@thanaParis thanaParis force-pushed the feature/handle-meter-value-cost-update branch from 4ad95a6 to 239ac1f Compare December 17, 2024 22:59
Copy link
Collaborator

@thanaParis thanaParis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved

@thanaParis thanaParis merged commit b788bd3 into rc-1.6.0 Dec 17, 2024
6 checks passed
@thanaParis thanaParis deleted the feature/handle-meter-value-cost-update branch December 17, 2024 23:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants