Commit 41f5bdf
committed
Refactor shipping_rate calculation
The easypost_shipments were being created again upon retrieving shipping_rates.
Hence modified estimator to check if an EasyPost shipment has already been created for the shipment.
If it exists, it fetches the stored shipping rates instead of creating a new EasyPost shipment.
Upon updating default shipping rate, all the other shipping rates of a shipment were being discarded.
The change ensure that the newly selected shipping rate is set while also keeping the rest.
Once the shipping rate is updated, the cost of shipment needs to be updated.
Thereby reloading shipment to reflect any updates to the selected shipping rate also ensuring that the shipment cost is recalculated based on the latest
selected shipping rate.1 parent e6f2d36 commit 41f5bdf
File tree
4 files changed
+415
-4
lines changed- app/decorators/models/solidus_easypost/spree
- lib/solidus_easypost
- spec
- cassettes/shipment
- models/spree
4 files changed
+415
-4
lines changedLines changed: 33 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
32 | 58 | | |
33 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
34 | 67 | | |
35 | 68 | | |
36 | 69 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
10 | 22 | | |
11 | 23 | | |
12 | 24 | | |
| |||
0 commit comments