ReduceRewardPoints should not recalculate points

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
2 года назад
The code does not consider that reward configurations are "point in time".  The rewards configuration at purchase time affect the awarded amount of points.  The configuration could change prior to the time the refund is made.  The rewardPointsHistoryEntry has the actual Points rewarded.

1. nopCommerce version:   4.40  (but likely in older versions too)
2. Expected behavior:  Points should be taken from the rewardPointsHistoryEntry.Points
3. Actual behavior:        Points are calculated using the current (today's) configuration
4. Steps to reproduce the problem:  See code snippet below
5. Any private modifications you made to your nopCommerce:  Any custom configurations/code would also be impacted, because of the "point in time" configuration problem.

protected virtual async Task ReduceRewardPointsAsync(Order order)
{
...
    var totalForRewardPoints = _orderTotalCalculationService
        .CalculateApplicableOrderTotalForRewardPoints(...
    var points = ...
        await _orderTotalCalculationService.CalculateRewardPointsAsync(...

...
    //get appropriate history entry
    var rewardPointsHistoryEntry = await _rewardPointService.GetRewardPointsHistoryEntryByIdAsync(...
...
      //or reduce reward points if the entry already exists
      await _rewardPointService.AddRewardPointsHistoryEntryAsync(..., -points ...
2 года назад
Thanks for the info. We'll check it.
2 года назад
We fixed it. Thanks.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.