Commit fed4c2f
committed
HP-2769: implement progressive price rendering and unit tests (#575)
* HP-2769: implement progressive price rendering and unit tests
- Added `RepresentablePrice` interface for price representation.
- Updated `ProgressivePricePresenter` to handle progressive pricing logic.
- Added unit tests for `ProgressivePricePresenter`.
- Improved `Threshold` and `Price` models to support new pricing structure.
* HP-2769: update `ProgressivePricePresenter` to include 'Custom' label in price rendering and enhance unit tests
* HP-2769: enhance progressive price handling framework
- Introduced `ProgressivePresenter` widget for price progressive rendering.
- Updated `ProgressivePricePresenter` and `PricePresenter` to utilize user permissions.
- Improved `Threshold` and `Price` models for detailed progressive pricing.
- Added `getSubtype`, `isOveruse`, and `isQuantityPredefined` methods to `RepresentablePrice`.
- Refined `DynamicFormWidget` integration to better handle pricing thresholds.
- Adjusted controllers to support new progressive price logic.
- Revised unit tests for `ProgressivePricePresenter` to validate progressive thresholds and permissions.
* HP-2769: refine DynamicFormWidget and ProgressivePresenter integration
- Updated `ProgressivePresenter` to utilize `DynamicFormWidget` instance instead of widget container class for better encapsulation.
- Adjusted JS logic to handle dynamic form widget updates more effectively.
- Improved thresholds rendering in `priceFields.php` for progressive pricing.
* HP-2769: remove unused `actionShowProgressive` and fix progressive price data mapping
- Deleted unused `actionShowProgressive` method in `PlanController`.
- Improved data mapping in `actionGetProgressiveInfo` to filter price keys dynamically and handle nested arrays correctly.
* HP-2769: add tests and refine prepaid quantity handling in ProgressivePricePresenter
- Added unit tests to validate rendering logic for prepaid quantities in `ProgressivePricePresenter`.
- Enhanced `renderPrice` method to properly skip thresholds within prepaid quantity range and adjust "Next" tiers.
- Updated `createPrice` method in tests to support `quantity` for prepaid handling.
- Improved logic to differentiate between "Included" and priced thresholds.
* HP-2769: add discount calculation and tests to ProgressivePricePresenter
- Introduced discount calculation logic to `ProgressivePricePresenter` for accurate progressive pricing.
- Updated `renderPrice` method to display discounts for each threshold tier, except the first one.
- Added extensive unit tests to validate discount rendering, calculation rounding, and prepaid handling.
- Refined CSS style in `ProgressivePresenter` for better visual display of progressive pricing.
* HP-2769: update tests and refine logic in ProgressivePricePresenter
- Adjusted price assertions in unit tests to reflect updated price values.
- Implemented `getSubtype`, `isOveruse`, and `isQuantityPredefined` methods in `RepresentablePrice` to return default values.
- Declared strict types in `Threshold` model for better type safety.
- Added `getThresholds` method to `RepresentablePrice`.
- Updated `ProgressivePresenter` to simplify `ProgressivePricePresenter` initialization.
- Enhanced `PriceController` to skip processing thresholds when prices are not defined.
* HP-2769: refactor unit tests in ProgressivePricePresenterTest for cleaner assertions and enhanced readability
- Added helper methods: `assertLinesContain` and `getCleanLines` for streamlined validation.
- Replaced repetitive assertions with ordered line checks to simplify test structure and improve maintainability.
- Updated all relevant test cases to utilize the new helper methods.
* HP-2769: validate objects in PriceController before processing
- Added validation checks for `Price` and `Threshold` objects to ensure data consistency.
- Refined `array_map` logic in `PriceController` to skip invalid price rows.
- Updated threshold handling to validate and process valid threshold objects only.
* HP-2769: refine doc comments and improve `Threshold` property handling
- Corrected and clarified doc comments for `ProgressivePricePresenterTest`.
- Updated `Threshold` model to ensure proper null checks and type consistency for `unitLabel` and `currencyLabel`.
* minor1 parent 0a7d316 commit fed4c2f
File tree
15 files changed
+726
-89
lines changed- src
- controllers
- grid
- presenters/price
- models
- views/price/formRow
- widgets
- views
- tests/unit/grid/presenters/price
15 files changed
+726
-89
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
| 50 | + | |
54 | 51 | | |
55 | 52 | | |
56 | 53 | | |
| |||
440 | 437 | | |
441 | 438 | | |
442 | 439 | | |
443 | | - | |
444 | 440 | | |
445 | 441 | | |
446 | 442 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| 31 | + | |
30 | 32 | | |
31 | 33 | | |
32 | 34 | | |
| |||
225 | 227 | | |
226 | 228 | | |
227 | 229 | | |
228 | | - | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
229 | 234 | | |
230 | 235 | | |
231 | 236 | | |
| |||
262 | 267 | | |
263 | 268 | | |
264 | 269 | | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
265 | 310 | | |
266 | 311 | | |
267 | 312 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
38 | 36 | | |
39 | 37 | | |
40 | | - | |
41 | 38 | | |
42 | 39 | | |
43 | 40 | | |
| |||
60 | 57 | | |
61 | 58 | | |
62 | 59 | | |
63 | | - | |
64 | 60 | | |
65 | 61 | | |
66 | 62 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| 20 | + | |
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
| |||
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | 32 | | |
35 | 33 | | |
36 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
37 | 38 | | |
38 | | - | |
39 | | - | |
40 | 39 | | |
41 | 40 | | |
42 | 41 | | |
| |||
51 | 50 | | |
52 | 51 | | |
53 | 52 | | |
54 | | - | |
55 | | - | |
| 53 | + | |
56 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
57 | 58 | | |
58 | | - | |
| 59 | + | |
59 | 60 | | |
60 | 61 | | |
61 | 62 | | |
62 | 63 | | |
63 | 64 | | |
64 | 65 | | |
65 | | - | |
| 66 | + | |
66 | 67 | | |
67 | 68 | | |
68 | | - | |
| 69 | + | |
69 | 70 | | |
70 | | - | |
71 | | - | |
72 | | - | |
| 71 | + | |
73 | 72 | | |
74 | 73 | | |
75 | 74 | | |
| |||
81 | 80 | | |
82 | 81 | | |
83 | 82 | | |
84 | | - | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
85 | 88 | | |
86 | 89 | | |
87 | 90 | | |
88 | 91 | | |
89 | 92 | | |
90 | | - | |
| 93 | + | |
91 | 94 | | |
92 | 95 | | |
93 | 96 | | |
94 | | - | |
| 97 | + | |
95 | 98 | | |
96 | 99 | | |
97 | 100 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | | - | |
| 19 | + | |
| 20 | + | |
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
| |||
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
30 | | - | |
| 32 | + | |
31 | 33 | | |
32 | 34 | | |
33 | 35 | | |
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
| 39 | + | |
37 | 40 | | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
48 | 44 | | |
49 | | - | |
50 | 45 | | |
51 | 46 | | |
52 | 47 | | |
53 | 48 | | |
54 | 49 | | |
55 | | - | |
| 50 | + | |
| 51 | + | |
56 | 52 | | |
57 | | - | |
| 53 | + | |
58 | 54 | | |
59 | 55 | | |
60 | 56 | | |
| |||
65 | 61 | | |
66 | 62 | | |
67 | 63 | | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | 64 | | |
72 | 65 | | |
73 | 66 | | |
| |||
0 commit comments