bb-integrations-library 3.0.11__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (217) hide show
  1. bb_integrations_lib/__init__.py +0 -0
  2. bb_integrations_lib/converters/__init__.py +0 -0
  3. bb_integrations_lib/gravitate/__init__.py +0 -0
  4. bb_integrations_lib/gravitate/base_api.py +20 -0
  5. bb_integrations_lib/gravitate/model.py +29 -0
  6. bb_integrations_lib/gravitate/pe_api.py +122 -0
  7. bb_integrations_lib/gravitate/rita_api.py +552 -0
  8. bb_integrations_lib/gravitate/sd_api.py +572 -0
  9. bb_integrations_lib/gravitate/testing/TTE/sd/models.py +1398 -0
  10. bb_integrations_lib/gravitate/testing/TTE/sd/tests/test_models.py +2987 -0
  11. bb_integrations_lib/gravitate/testing/__init__.py +0 -0
  12. bb_integrations_lib/gravitate/testing/builder.py +55 -0
  13. bb_integrations_lib/gravitate/testing/openapi.py +70 -0
  14. bb_integrations_lib/gravitate/testing/util.py +274 -0
  15. bb_integrations_lib/mappers/__init__.py +0 -0
  16. bb_integrations_lib/mappers/prices/__init__.py +0 -0
  17. bb_integrations_lib/mappers/prices/model.py +106 -0
  18. bb_integrations_lib/mappers/prices/price_mapper.py +127 -0
  19. bb_integrations_lib/mappers/prices/protocol.py +20 -0
  20. bb_integrations_lib/mappers/prices/util.py +61 -0
  21. bb_integrations_lib/mappers/rita_mapper.py +523 -0
  22. bb_integrations_lib/models/__init__.py +0 -0
  23. bb_integrations_lib/models/dtn_supplier_invoice.py +487 -0
  24. bb_integrations_lib/models/enums.py +28 -0
  25. bb_integrations_lib/models/pipeline_structs.py +76 -0
  26. bb_integrations_lib/models/probe/probe_event.py +20 -0
  27. bb_integrations_lib/models/probe/request_data.py +431 -0
  28. bb_integrations_lib/models/probe/resume_token.py +7 -0
  29. bb_integrations_lib/models/rita/audit.py +113 -0
  30. bb_integrations_lib/models/rita/auth.py +30 -0
  31. bb_integrations_lib/models/rita/bucket.py +17 -0
  32. bb_integrations_lib/models/rita/config.py +188 -0
  33. bb_integrations_lib/models/rita/constants.py +19 -0
  34. bb_integrations_lib/models/rita/crossroads_entities.py +293 -0
  35. bb_integrations_lib/models/rita/crossroads_mapping.py +428 -0
  36. bb_integrations_lib/models/rita/crossroads_monitoring.py +78 -0
  37. bb_integrations_lib/models/rita/crossroads_network.py +41 -0
  38. bb_integrations_lib/models/rita/crossroads_rules.py +80 -0
  39. bb_integrations_lib/models/rita/email.py +39 -0
  40. bb_integrations_lib/models/rita/issue.py +63 -0
  41. bb_integrations_lib/models/rita/mapping.py +227 -0
  42. bb_integrations_lib/models/rita/probe.py +58 -0
  43. bb_integrations_lib/models/rita/reference_data.py +110 -0
  44. bb_integrations_lib/models/rita/source_system.py +9 -0
  45. bb_integrations_lib/models/rita/workers.py +76 -0
  46. bb_integrations_lib/models/sd/bols_and_drops.py +241 -0
  47. bb_integrations_lib/models/sd/get_order.py +301 -0
  48. bb_integrations_lib/models/sd/orders.py +18 -0
  49. bb_integrations_lib/models/sd_api.py +115 -0
  50. bb_integrations_lib/pipelines/__init__.py +0 -0
  51. bb_integrations_lib/pipelines/parsers/__init__.py +0 -0
  52. bb_integrations_lib/pipelines/parsers/distribution_report/__init__.py +0 -0
  53. bb_integrations_lib/pipelines/parsers/distribution_report/order_by_site_product_parser.py +50 -0
  54. bb_integrations_lib/pipelines/parsers/distribution_report/tank_configs_parser.py +47 -0
  55. bb_integrations_lib/pipelines/parsers/dtn/__init__.py +0 -0
  56. bb_integrations_lib/pipelines/parsers/dtn/dtn_price_parser.py +102 -0
  57. bb_integrations_lib/pipelines/parsers/dtn/model.py +79 -0
  58. bb_integrations_lib/pipelines/parsers/price_engine/__init__.py +0 -0
  59. bb_integrations_lib/pipelines/parsers/price_engine/parse_accessorials_prices_parser.py +67 -0
  60. bb_integrations_lib/pipelines/parsers/price_engine/price_file_upload/__init__.py +0 -0
  61. bb_integrations_lib/pipelines/parsers/price_engine/price_file_upload/price_merge_parser.py +111 -0
  62. bb_integrations_lib/pipelines/parsers/price_engine/price_file_upload/price_sync_parser.py +107 -0
  63. bb_integrations_lib/pipelines/parsers/price_engine/price_file_upload/shared.py +81 -0
  64. bb_integrations_lib/pipelines/parsers/tank_reading_parser.py +155 -0
  65. bb_integrations_lib/pipelines/parsers/tank_sales_parser.py +144 -0
  66. bb_integrations_lib/pipelines/shared/__init__.py +0 -0
  67. bb_integrations_lib/pipelines/shared/allocation_matching.py +227 -0
  68. bb_integrations_lib/pipelines/shared/bol_allocation.py +2793 -0
  69. bb_integrations_lib/pipelines/steps/__init__.py +0 -0
  70. bb_integrations_lib/pipelines/steps/create_accessorials_step.py +80 -0
  71. bb_integrations_lib/pipelines/steps/distribution_report/__init__.py +0 -0
  72. bb_integrations_lib/pipelines/steps/distribution_report/distribution_report_datafram_to_raw_data.py +33 -0
  73. bb_integrations_lib/pipelines/steps/distribution_report/get_model_history_step.py +50 -0
  74. bb_integrations_lib/pipelines/steps/distribution_report/get_order_by_site_product_step.py +62 -0
  75. bb_integrations_lib/pipelines/steps/distribution_report/get_tank_configs_step.py +40 -0
  76. bb_integrations_lib/pipelines/steps/distribution_report/join_distribution_order_dos_step.py +85 -0
  77. bb_integrations_lib/pipelines/steps/distribution_report/upload_distribution_report_datafram_to_big_query.py +47 -0
  78. bb_integrations_lib/pipelines/steps/echo_step.py +14 -0
  79. bb_integrations_lib/pipelines/steps/export_dataframe_to_rawdata_step.py +28 -0
  80. bb_integrations_lib/pipelines/steps/exporting/__init__.py +0 -0
  81. bb_integrations_lib/pipelines/steps/exporting/bbd_export_payroll_file_step.py +107 -0
  82. bb_integrations_lib/pipelines/steps/exporting/bbd_export_readings_step.py +236 -0
  83. bb_integrations_lib/pipelines/steps/exporting/cargas_wholesale_bundle_upload_step.py +33 -0
  84. bb_integrations_lib/pipelines/steps/exporting/dataframe_flat_file_export.py +29 -0
  85. bb_integrations_lib/pipelines/steps/exporting/gcs_bucket_export_file_step.py +34 -0
  86. bb_integrations_lib/pipelines/steps/exporting/keyvu_export_step.py +356 -0
  87. bb_integrations_lib/pipelines/steps/exporting/pe_price_export_step.py +238 -0
  88. bb_integrations_lib/pipelines/steps/exporting/platform_science_order_sync_step.py +500 -0
  89. bb_integrations_lib/pipelines/steps/exporting/save_rawdata_to_disk.py +15 -0
  90. bb_integrations_lib/pipelines/steps/exporting/sftp_export_file_step.py +60 -0
  91. bb_integrations_lib/pipelines/steps/exporting/sftp_export_many_files_step.py +23 -0
  92. bb_integrations_lib/pipelines/steps/exporting/update_exported_orders_table_step.py +64 -0
  93. bb_integrations_lib/pipelines/steps/filter_step.py +22 -0
  94. bb_integrations_lib/pipelines/steps/get_latest_sync_date.py +34 -0
  95. bb_integrations_lib/pipelines/steps/importing/bbd_import_payroll_step.py +30 -0
  96. bb_integrations_lib/pipelines/steps/importing/get_order_numbers_to_export_step.py +138 -0
  97. bb_integrations_lib/pipelines/steps/importing/load_file_to_dataframe_step.py +46 -0
  98. bb_integrations_lib/pipelines/steps/importing/load_imap_attachment_step.py +172 -0
  99. bb_integrations_lib/pipelines/steps/importing/pe_bulk_sync_price_structure_step.py +68 -0
  100. bb_integrations_lib/pipelines/steps/importing/pe_price_merge_step.py +86 -0
  101. bb_integrations_lib/pipelines/steps/importing/sftp_file_config_step.py +124 -0
  102. bb_integrations_lib/pipelines/steps/importing/test_exact_file_match.py +57 -0
  103. bb_integrations_lib/pipelines/steps/null_step.py +15 -0
  104. bb_integrations_lib/pipelines/steps/pe_integration_job_step.py +32 -0
  105. bb_integrations_lib/pipelines/steps/processing/__init__.py +0 -0
  106. bb_integrations_lib/pipelines/steps/processing/archive_gcs_step.py +76 -0
  107. bb_integrations_lib/pipelines/steps/processing/archive_sftp_step.py +48 -0
  108. bb_integrations_lib/pipelines/steps/processing/bbd_format_tank_readings_step.py +492 -0
  109. bb_integrations_lib/pipelines/steps/processing/bbd_upload_prices_step.py +54 -0
  110. bb_integrations_lib/pipelines/steps/processing/bbd_upload_tank_sales_step.py +124 -0
  111. bb_integrations_lib/pipelines/steps/processing/bbd_upload_tankreading_step.py +80 -0
  112. bb_integrations_lib/pipelines/steps/processing/convert_bbd_order_to_cargas_step.py +226 -0
  113. bb_integrations_lib/pipelines/steps/processing/delete_sftp_step.py +33 -0
  114. bb_integrations_lib/pipelines/steps/processing/dtn/__init__.py +2 -0
  115. bb_integrations_lib/pipelines/steps/processing/dtn/convert_dtn_invoice_to_sd_model.py +145 -0
  116. bb_integrations_lib/pipelines/steps/processing/dtn/parse_dtn_invoice_step.py +38 -0
  117. bb_integrations_lib/pipelines/steps/processing/file_config_parser_step.py +720 -0
  118. bb_integrations_lib/pipelines/steps/processing/file_config_parser_step_v2.py +418 -0
  119. bb_integrations_lib/pipelines/steps/processing/get_sd_price_price_request.py +105 -0
  120. bb_integrations_lib/pipelines/steps/processing/keyvu_upload_deliveryplan_step.py +39 -0
  121. bb_integrations_lib/pipelines/steps/processing/mark_orders_exported_in_bbd_step.py +185 -0
  122. bb_integrations_lib/pipelines/steps/processing/pe_price_rows_processing_step.py +174 -0
  123. bb_integrations_lib/pipelines/steps/processing/send_process_report_step.py +47 -0
  124. bb_integrations_lib/pipelines/steps/processing/sftp_renamer_step.py +61 -0
  125. bb_integrations_lib/pipelines/steps/processing/tank_reading_touchup_steps.py +75 -0
  126. bb_integrations_lib/pipelines/steps/processing/upload_supplier_invoice_step.py +16 -0
  127. bb_integrations_lib/pipelines/steps/send_attached_in_rita_email_step.py +44 -0
  128. bb_integrations_lib/pipelines/steps/send_rita_email_step.py +34 -0
  129. bb_integrations_lib/pipelines/steps/sleep_step.py +24 -0
  130. bb_integrations_lib/pipelines/wrappers/__init__.py +0 -0
  131. bb_integrations_lib/pipelines/wrappers/accessorials_transformation.py +104 -0
  132. bb_integrations_lib/pipelines/wrappers/distribution_report.py +191 -0
  133. bb_integrations_lib/pipelines/wrappers/export_tank_readings.py +237 -0
  134. bb_integrations_lib/pipelines/wrappers/import_tank_readings.py +192 -0
  135. bb_integrations_lib/pipelines/wrappers/wrapper.py +81 -0
  136. bb_integrations_lib/protocols/__init__.py +0 -0
  137. bb_integrations_lib/protocols/flat_file.py +210 -0
  138. bb_integrations_lib/protocols/gravitate_client.py +104 -0
  139. bb_integrations_lib/protocols/pipelines.py +697 -0
  140. bb_integrations_lib/provider/__init__.py +0 -0
  141. bb_integrations_lib/provider/api/__init__.py +0 -0
  142. bb_integrations_lib/provider/api/cargas/__init__.py +0 -0
  143. bb_integrations_lib/provider/api/cargas/client.py +43 -0
  144. bb_integrations_lib/provider/api/cargas/model.py +49 -0
  145. bb_integrations_lib/provider/api/cargas/protocol.py +23 -0
  146. bb_integrations_lib/provider/api/dtn/__init__.py +0 -0
  147. bb_integrations_lib/provider/api/dtn/client.py +128 -0
  148. bb_integrations_lib/provider/api/dtn/protocol.py +9 -0
  149. bb_integrations_lib/provider/api/keyvu/__init__.py +0 -0
  150. bb_integrations_lib/provider/api/keyvu/client.py +30 -0
  151. bb_integrations_lib/provider/api/keyvu/model.py +149 -0
  152. bb_integrations_lib/provider/api/macropoint/__init__.py +0 -0
  153. bb_integrations_lib/provider/api/macropoint/client.py +28 -0
  154. bb_integrations_lib/provider/api/macropoint/model.py +40 -0
  155. bb_integrations_lib/provider/api/pc_miler/__init__.py +0 -0
  156. bb_integrations_lib/provider/api/pc_miler/client.py +130 -0
  157. bb_integrations_lib/provider/api/pc_miler/model.py +6 -0
  158. bb_integrations_lib/provider/api/pc_miler/web_services_apis.py +131 -0
  159. bb_integrations_lib/provider/api/platform_science/__init__.py +0 -0
  160. bb_integrations_lib/provider/api/platform_science/client.py +147 -0
  161. bb_integrations_lib/provider/api/platform_science/model.py +82 -0
  162. bb_integrations_lib/provider/api/quicktrip/__init__.py +0 -0
  163. bb_integrations_lib/provider/api/quicktrip/client.py +52 -0
  164. bb_integrations_lib/provider/api/telapoint/__init__.py +0 -0
  165. bb_integrations_lib/provider/api/telapoint/client.py +68 -0
  166. bb_integrations_lib/provider/api/telapoint/model.py +178 -0
  167. bb_integrations_lib/provider/api/warren_rogers/__init__.py +0 -0
  168. bb_integrations_lib/provider/api/warren_rogers/client.py +207 -0
  169. bb_integrations_lib/provider/aws/__init__.py +0 -0
  170. bb_integrations_lib/provider/aws/s3/__init__.py +0 -0
  171. bb_integrations_lib/provider/aws/s3/client.py +126 -0
  172. bb_integrations_lib/provider/ftp/__init__.py +0 -0
  173. bb_integrations_lib/provider/ftp/client.py +140 -0
  174. bb_integrations_lib/provider/ftp/interface.py +273 -0
  175. bb_integrations_lib/provider/ftp/model.py +76 -0
  176. bb_integrations_lib/provider/imap/__init__.py +0 -0
  177. bb_integrations_lib/provider/imap/client.py +228 -0
  178. bb_integrations_lib/provider/imap/model.py +3 -0
  179. bb_integrations_lib/provider/sqlserver/__init__.py +0 -0
  180. bb_integrations_lib/provider/sqlserver/client.py +106 -0
  181. bb_integrations_lib/secrets/__init__.py +4 -0
  182. bb_integrations_lib/secrets/adapters.py +98 -0
  183. bb_integrations_lib/secrets/credential_models.py +222 -0
  184. bb_integrations_lib/secrets/factory.py +85 -0
  185. bb_integrations_lib/secrets/providers.py +160 -0
  186. bb_integrations_lib/shared/__init__.py +0 -0
  187. bb_integrations_lib/shared/exceptions.py +25 -0
  188. bb_integrations_lib/shared/model.py +1039 -0
  189. bb_integrations_lib/shared/shared_enums.py +510 -0
  190. bb_integrations_lib/storage/README.md +236 -0
  191. bb_integrations_lib/storage/__init__.py +0 -0
  192. bb_integrations_lib/storage/aws/__init__.py +0 -0
  193. bb_integrations_lib/storage/aws/s3.py +8 -0
  194. bb_integrations_lib/storage/defaults.py +72 -0
  195. bb_integrations_lib/storage/gcs/__init__.py +0 -0
  196. bb_integrations_lib/storage/gcs/client.py +8 -0
  197. bb_integrations_lib/storage/gcsmanager/__init__.py +0 -0
  198. bb_integrations_lib/storage/gcsmanager/client.py +8 -0
  199. bb_integrations_lib/storage/setup.py +29 -0
  200. bb_integrations_lib/util/__init__.py +0 -0
  201. bb_integrations_lib/util/cache/__init__.py +0 -0
  202. bb_integrations_lib/util/cache/custom_ttl_cache.py +75 -0
  203. bb_integrations_lib/util/cache/protocol.py +9 -0
  204. bb_integrations_lib/util/config/__init__.py +0 -0
  205. bb_integrations_lib/util/config/manager.py +391 -0
  206. bb_integrations_lib/util/config/model.py +41 -0
  207. bb_integrations_lib/util/exception_logger/__init__.py +0 -0
  208. bb_integrations_lib/util/exception_logger/exception_logger.py +146 -0
  209. bb_integrations_lib/util/exception_logger/test.py +114 -0
  210. bb_integrations_lib/util/utils.py +364 -0
  211. bb_integrations_lib/workers/__init__.py +0 -0
  212. bb_integrations_lib/workers/groups.py +13 -0
  213. bb_integrations_lib/workers/rpc_worker.py +50 -0
  214. bb_integrations_lib/workers/topics.py +20 -0
  215. bb_integrations_library-3.0.11.dist-info/METADATA +59 -0
  216. bb_integrations_library-3.0.11.dist-info/RECORD +217 -0
  217. bb_integrations_library-3.0.11.dist-info/WHEEL +4 -0
@@ -0,0 +1,2793 @@
1
+ import asyncio
2
+ import logging
3
+ from dataclasses import dataclass
4
+ from unittest.mock import AsyncMock, MagicMock
5
+
6
+ from egg import Egg, hatch_eggs
7
+ from httpx import Response
8
+
9
+ from bb_integrations_lib.gravitate.sd_api import GravitateSDAPI
10
+ from bb_integrations_lib.pipelines.shared.allocation_matching import (
11
+ MatchedAllocation,
12
+ match_allocations,
13
+ )
14
+ from bb_integrations_lib.shared.model import GetOrderBolsAndDropsRequest
15
+ from bb_integrations_lib.util.utils import lookup
16
+ from loguru import logger
17
+
18
+ mock_bols_and_drops_response = [
19
+ {
20
+ "order_number": "1103",
21
+ "order_id": "6953f4eda8bb5f01056eaca6",
22
+ "po": None,
23
+ "carrier": "",
24
+ "carrier_id": None,
25
+ "manager": None,
26
+ "manager_id": None,
27
+ "last_movement_update": "2025-12-30T18:32:27.749000",
28
+ "order_date": "2025-12-30T15:51:09Z",
29
+ "status": "complete",
30
+ "type": "regular",
31
+ "drops": [
32
+ {
33
+ "compartment_indexes": [0],
34
+ "before_stick_inches": 22,
35
+ "before_stick_time": "2025-12-30T18:28:44.281000Z",
36
+ "after_stick_inches": 47,
37
+ "after_stick_time": "2025-12-30T18:28:52.122000Z",
38
+ "drop_id": "6953f4eda8bb5f01056eac9e",
39
+ "location": "1082",
40
+ "location_id": "69090f2e5a7ba1bea579a965",
41
+ "location_source_id": None,
42
+ "location_source_system": "",
43
+ "product": "87OCT 10%ETH - SUNOCO",
44
+ "product_id": "6908f4469257414108faf071",
45
+ "product_source_id": "FO-87-E10 | SUN",
46
+ "product_source_system": "PDI",
47
+ "tank_id": 1,
48
+ "tank_source_id": None,
49
+ "tank_source_system": None,
50
+ "volume": 3998,
51
+ "driver_id": "690912c7cca24d51e38ca2ea",
52
+ "driver_username": "rstewart7468",
53
+ "driver_extra_data": {"source_id": "1182", "source_system_id": "PDI"},
54
+ "driver_name": "Joel Stewart",
55
+ "driver_date": "2025-12-30T00:00:00",
56
+ "driver_shift": "am",
57
+ "driver_shift_id": "6952ab2e05e52270b51f3d0c",
58
+ "tractor_number": "202",
59
+ "trailer_number": "1609",
60
+ "blend_codes": [],
61
+ "site_counterparty_id": "6908f1eab4fcf6a36e6660e1",
62
+ "site_counterparty_name": "Bazco",
63
+ "freight_customer_id": None,
64
+ "freight_customer_name": None,
65
+ },
66
+ {
67
+ "compartment_indexes": [1],
68
+ "before_stick_inches": 31,
69
+ "before_stick_time": "2025-12-30T18:30:30.745000Z",
70
+ "after_stick_inches": 78,
71
+ "after_stick_time": "2025-12-30T18:30:34.427000Z",
72
+ "drop_id": "6953f4eda8bb5f01056eac9f",
73
+ "location": "1083",
74
+ "location_id": "69090f2e5a7ba1bea579a969",
75
+ "location_source_id": None,
76
+ "location_source_system": "",
77
+ "product": "87OCT 10%ETH - SUNOCO",
78
+ "product_id": "6908f4469257414108faf071",
79
+ "product_source_id": "FO-87-E10 | SUN",
80
+ "product_source_system": "PDI",
81
+ "tank_id": 3,
82
+ "tank_source_id": None,
83
+ "tank_source_system": None,
84
+ "volume": 6001,
85
+ "driver_id": "690912c7cca24d51e38ca2ea",
86
+ "driver_username": "rstewart7468",
87
+ "driver_extra_data": {"source_id": "1182", "source_system_id": "PDI"},
88
+ "driver_name": "Joel Stewart",
89
+ "driver_date": "2025-12-30T00:00:00",
90
+ "driver_shift": "am",
91
+ "driver_shift_id": "6952ab2e05e52270b51f3d0c",
92
+ "tractor_number": "202",
93
+ "trailer_number": "1609",
94
+ "blend_codes": [],
95
+ "site_counterparty_id": "6908f1eab4fcf6a36e6660e1",
96
+ "site_counterparty_name": "Bazco",
97
+ "freight_customer_id": None,
98
+ "freight_customer_name": None,
99
+ },
100
+ {
101
+ "compartment_indexes": [2],
102
+ "before_stick_inches": 15,
103
+ "before_stick_time": "2025-12-30T18:30:53.323000Z",
104
+ "after_stick_inches": 26,
105
+ "after_stick_time": "2025-12-30T18:30:57.401000Z",
106
+ "drop_id": "6953f4eda8bb5f01056eaca0",
107
+ "location": "1083",
108
+ "location_id": "69090f2e5a7ba1bea579a969",
109
+ "location_source_id": None,
110
+ "location_source_system": "",
111
+ "product": "93OCT 10%ETH - SUNOCO",
112
+ "product_id": "6908f409b4fcf6a36e6660f3",
113
+ "product_source_id": "FO-93-E10 | SUN",
114
+ "product_source_system": "PDI",
115
+ "tank_id": 1,
116
+ "tank_source_id": None,
117
+ "tank_source_system": None,
118
+ "volume": 1003,
119
+ "driver_id": "690912c7cca24d51e38ca2ea",
120
+ "driver_username": "rstewart7468",
121
+ "driver_extra_data": {"source_id": "1182", "source_system_id": "PDI"},
122
+ "driver_name": "Joel Stewart",
123
+ "driver_date": "2025-12-30T00:00:00",
124
+ "driver_shift": "am",
125
+ "driver_shift_id": "6952ab2e05e52270b51f3d0c",
126
+ "tractor_number": "202",
127
+ "trailer_number": "1609",
128
+ "blend_codes": [],
129
+ "site_counterparty_id": "6908f1eab4fcf6a36e6660e1",
130
+ "site_counterparty_name": "Bazco",
131
+ "freight_customer_id": None,
132
+ "freight_customer_name": None,
133
+ },
134
+ ],
135
+ "bols": [
136
+ {
137
+ "bol_number": "334618136",
138
+ "bol_id": "6954191e8c10fc0f85cbda35",
139
+ "date": "2025-12-30T18:23:06.337000Z",
140
+ "details": [
141
+ {
142
+ "compartment_index": None,
143
+ "load_number": None,
144
+ "product": "87OCT 10%ETH - CITGO",
145
+ "product_id": "6908f409b4fcf6a36e6660f1",
146
+ "product_source_id": "FO-87-E10 | CIT",
147
+ "product_source_system": "PDI",
148
+ "net_volume": 10097,
149
+ "gross_volume": 9999,
150
+ "supplier": "Citgo Branded",
151
+ "supplier_id": "6908f1eab4fcf6a36e6660c8",
152
+ "supplier_source_id": "5002",
153
+ "supplier_source_system": "",
154
+ "contract": "",
155
+ "price_details": {
156
+ "price": None,
157
+ "price_id": None,
158
+ "curve_id": None,
159
+ "date": "2025-12-30T18:23:06.337000",
160
+ "counterparty_id": "6",
161
+ },
162
+ },
163
+ {
164
+ "compartment_index": None,
165
+ "load_number": None,
166
+ "product": "93OCT 10%ETH - CITGO",
167
+ "product_id": "6908f409b4fcf6a36e6660f2",
168
+ "product_source_id": "FO-93-E10 | CIT",
169
+ "product_source_system": "PDI",
170
+ "net_volume": 1026,
171
+ "gross_volume": 1003,
172
+ "supplier": "Citgo Branded",
173
+ "supplier_id": "6908f1eab4fcf6a36e6660c8",
174
+ "supplier_source_id": "5002",
175
+ "supplier_source_system": "",
176
+ "contract": "",
177
+ "price_details": {
178
+ "price": None,
179
+ "price_id": None,
180
+ "curve_id": None,
181
+ "date": "2025-12-30T18:23:06.337000",
182
+ "counterparty_id": "6",
183
+ },
184
+ },
185
+ ],
186
+ "load_or_drop": "Load",
187
+ "location": "MARATHON -Detroit",
188
+ "location_id": "69090ecad6ff2d863efaf07b",
189
+ "location_source_id": "T-38-MI-3015",
190
+ "location_source_system": "PDI",
191
+ "driver_id": "690912c7cca24d51e38ca2ea",
192
+ "driver_username": "rstewart7468",
193
+ "driver_extra_data": {"source_id": "1182", "source_system_id": "PDI"},
194
+ "driver_name": "Joel Stewart",
195
+ "driver_date": "2025-12-30T00:00:00",
196
+ "driver_shift": "am",
197
+ "driver_shift_id": "6952ab2e05e52270b51f3d0c",
198
+ "tractor_number": "202",
199
+ "trailer_number": "1609",
200
+ }
201
+ ],
202
+ "costs": [
203
+ {
204
+ "cost_type": "freight",
205
+ "carrier": "missing",
206
+ "carrier_source_id": "",
207
+ "carrier_source_system": "",
208
+ "per_unit_price": 0.034100000000000005,
209
+ "cost_amount": 375.1,
210
+ }
211
+ ],
212
+ "validation_bypass_on": None,
213
+ "has_additives": False,
214
+ "estimated_freight": {
215
+ "id": "6953f4eda8bb5f01056eaca4",
216
+ "parent": None,
217
+ "created_at": "2025-12-30T15:51:09.909000",
218
+ "type": "freight",
219
+ "status": "open",
220
+ "reversed": False,
221
+ "transactions": [
222
+ {
223
+ "model_type": "base",
224
+ "type": "Base Freight",
225
+ "subtype": "Band 31-35",
226
+ "rate": 0.0341,
227
+ "amount": 4000,
228
+ "total": 136.4,
229
+ "uom": "gallons",
230
+ "errors": [],
231
+ "id": "6953f4eda8bb5f01056eaca1",
232
+ "product_group": "Gasoline",
233
+ "product_id": "6908f4469257414108faf071",
234
+ "product_name": "87OCT 10%ETH - SUNOCO",
235
+ "origin": "MARATHON -Detroit",
236
+ "origin_id": "69090ecad6ff2d863efaf07b",
237
+ "origin_override": None,
238
+ "origin_id_override": None,
239
+ "destination": "1082",
240
+ "destination_id": "69090f2e5a7ba1bea579a967",
241
+ "destination_override": None,
242
+ "destination_id_override": None,
243
+ "legs": [
244
+ {
245
+ "origin": "1082",
246
+ "origin_id": "69090f2e5a7ba1bea579a965",
247
+ "destination": "1083",
248
+ "destination_id": "69090f2e5a7ba1bea579a969",
249
+ "distance": 16.05,
250
+ },
251
+ {
252
+ "origin": "MARATHON -Detroit",
253
+ "origin_id": "69090ecad6ff2d863efaf07b",
254
+ "destination": "1082",
255
+ "destination_id": "69090f2e5a7ba1bea579a965",
256
+ "distance": 14.37,
257
+ },
258
+ ],
259
+ "use_surcharge": True,
260
+ "manual": False,
261
+ "has_dependency": False,
262
+ "created_date": None,
263
+ "requires_approval": False,
264
+ "requires_approval_reason_code": False,
265
+ "is_approved": False,
266
+ "approved_by": None,
267
+ "approved_date": None,
268
+ "approved_reason_code": None,
269
+ "amount_override": None,
270
+ "rate_override": None,
271
+ "product_id_override": None,
272
+ "product_name_override": None,
273
+ "product_group_override": None,
274
+ "subtype_override": None,
275
+ "uom_override": None,
276
+ "total_override": None,
277
+ "override_by": None,
278
+ "override_date": None,
279
+ "exclude_from_invoice": False,
280
+ "credit_rebill_metadata": None,
281
+ "extra_data": {"mileage": 30},
282
+ "gross_volume": None,
283
+ "net_volume": None,
284
+ "bol_date": None,
285
+ "bol_number": None,
286
+ "bol_number_override": None,
287
+ "delivery_date": None,
288
+ },
289
+ {
290
+ "model_type": "base",
291
+ "type": "Base Freight",
292
+ "subtype": "Band 31-35",
293
+ "rate": 0.0341,
294
+ "amount": 6000,
295
+ "total": 204.6,
296
+ "uom": "gallons",
297
+ "errors": [],
298
+ "id": "6953f4eda8bb5f01056eaca2",
299
+ "product_group": "Gasoline",
300
+ "product_id": "6908f4469257414108faf071",
301
+ "product_name": "87OCT 10%ETH - SUNOCO",
302
+ "origin": "MARATHON -Detroit",
303
+ "origin_id": "69090ecad6ff2d863efaf07b",
304
+ "origin_override": None,
305
+ "origin_id_override": None,
306
+ "destination": "1083",
307
+ "destination_id": "69090f2e5a7ba1bea579a96b",
308
+ "destination_override": None,
309
+ "destination_id_override": None,
310
+ "legs": [
311
+ {
312
+ "origin": "1082",
313
+ "origin_id": "69090f2e5a7ba1bea579a965",
314
+ "destination": "1083",
315
+ "destination_id": "69090f2e5a7ba1bea579a969",
316
+ "distance": 16.05,
317
+ },
318
+ {
319
+ "origin": "MARATHON -Detroit",
320
+ "origin_id": "69090ecad6ff2d863efaf07b",
321
+ "destination": "1082",
322
+ "destination_id": "69090f2e5a7ba1bea579a965",
323
+ "distance": 14.37,
324
+ },
325
+ ],
326
+ "use_surcharge": True,
327
+ "manual": False,
328
+ "has_dependency": False,
329
+ "created_date": None,
330
+ "requires_approval": False,
331
+ "requires_approval_reason_code": False,
332
+ "is_approved": False,
333
+ "approved_by": None,
334
+ "approved_date": None,
335
+ "approved_reason_code": None,
336
+ "amount_override": None,
337
+ "rate_override": None,
338
+ "product_id_override": None,
339
+ "product_name_override": None,
340
+ "product_group_override": None,
341
+ "subtype_override": None,
342
+ "uom_override": None,
343
+ "total_override": None,
344
+ "override_by": None,
345
+ "override_date": None,
346
+ "exclude_from_invoice": False,
347
+ "credit_rebill_metadata": None,
348
+ "extra_data": {"mileage": 30},
349
+ "gross_volume": None,
350
+ "net_volume": None,
351
+ "bol_date": None,
352
+ "bol_number": None,
353
+ "bol_number_override": None,
354
+ "delivery_date": None,
355
+ },
356
+ {
357
+ "model_type": "base",
358
+ "type": "Base Freight",
359
+ "subtype": "Band 31-35",
360
+ "rate": 0.0341,
361
+ "amount": 1000,
362
+ "total": 34.1,
363
+ "uom": "gallons",
364
+ "errors": [],
365
+ "id": "6953f4eda8bb5f01056eaca3",
366
+ "product_group": "Gasoline",
367
+ "product_id": "6908f409b4fcf6a36e6660f3",
368
+ "product_name": "93OCT 10%ETH - SUNOCO",
369
+ "origin": "MARATHON -Detroit",
370
+ "origin_id": "69090ecad6ff2d863efaf07b",
371
+ "origin_override": None,
372
+ "origin_id_override": None,
373
+ "destination": "1083",
374
+ "destination_id": "69090f2e5a7ba1bea579a96b",
375
+ "destination_override": None,
376
+ "destination_id_override": None,
377
+ "legs": [
378
+ {
379
+ "origin": "1082",
380
+ "origin_id": "69090f2e5a7ba1bea579a965",
381
+ "destination": "1083",
382
+ "destination_id": "69090f2e5a7ba1bea579a969",
383
+ "distance": 16.05,
384
+ },
385
+ {
386
+ "origin": "MARATHON -Detroit",
387
+ "origin_id": "69090ecad6ff2d863efaf07b",
388
+ "destination": "1082",
389
+ "destination_id": "69090f2e5a7ba1bea579a965",
390
+ "distance": 14.37,
391
+ },
392
+ ],
393
+ "use_surcharge": True,
394
+ "manual": False,
395
+ "has_dependency": False,
396
+ "created_date": None,
397
+ "requires_approval": False,
398
+ "requires_approval_reason_code": False,
399
+ "is_approved": False,
400
+ "approved_by": None,
401
+ "approved_date": None,
402
+ "approved_reason_code": None,
403
+ "amount_override": None,
404
+ "rate_override": None,
405
+ "product_id_override": None,
406
+ "product_name_override": None,
407
+ "product_group_override": None,
408
+ "subtype_override": None,
409
+ "uom_override": None,
410
+ "total_override": None,
411
+ "override_by": None,
412
+ "override_date": None,
413
+ "exclude_from_invoice": False,
414
+ "credit_rebill_metadata": None,
415
+ "extra_data": {"mileage": 30},
416
+ "gross_volume": None,
417
+ "net_volume": None,
418
+ "bol_date": None,
419
+ "bol_number": None,
420
+ "bol_number_override": None,
421
+ "delivery_date": None,
422
+ },
423
+ ],
424
+ "counterparty_id": "6908f1eab4fcf6a36e6660e1",
425
+ "book_type": "Cost",
426
+ "effective_date_used": "2025-12-30T00:00:00",
427
+ "invoice_group_id": None,
428
+ "invoice_number": None,
429
+ "accessorial_invoice_number": None,
430
+ "new_version_available": False,
431
+ "new_version_total": None,
432
+ "error": None,
433
+ },
434
+ "actual_freight": {
435
+ "id": "69541abb8c10fc0f85cbda90",
436
+ "parent": None,
437
+ "created_at": "2025-12-30T18:32:27.707000",
438
+ "type": "freight",
439
+ "status": "open",
440
+ "reversed": False,
441
+ "transactions": [
442
+ {
443
+ "model_type": "base",
444
+ "type": "Base Freight",
445
+ "subtype": "Band 31-35",
446
+ "rate": 0.0341,
447
+ "amount": 4037,
448
+ "total": 137.66,
449
+ "uom": "gallons",
450
+ "errors": [],
451
+ "id": "69541abb8c10fc0f85cbda8d",
452
+ "product_group": "Gasoline",
453
+ "product_id": "6908f4469257414108faf071",
454
+ "product_name": "87OCT 10%ETH - SUNOCO",
455
+ "origin": "MARATHON -Detroit",
456
+ "origin_id": "69090ecad6ff2d863efaf07b",
457
+ "origin_override": None,
458
+ "origin_id_override": None,
459
+ "destination": "1082",
460
+ "destination_id": "69090f2e5a7ba1bea579a965",
461
+ "destination_override": None,
462
+ "destination_id_override": None,
463
+ "legs": [
464
+ {
465
+ "origin": "1082",
466
+ "origin_id": "69090f2e5a7ba1bea579a965",
467
+ "destination": "1083",
468
+ "destination_id": "69090f2e5a7ba1bea579a969",
469
+ "distance": 16.05,
470
+ },
471
+ {
472
+ "origin": "MARATHON -Detroit",
473
+ "origin_id": "69090ecad6ff2d863efaf07b",
474
+ "destination": "1082",
475
+ "destination_id": "69090f2e5a7ba1bea579a965",
476
+ "distance": 14.37,
477
+ },
478
+ ],
479
+ "use_surcharge": True,
480
+ "manual": False,
481
+ "has_dependency": False,
482
+ "created_date": None,
483
+ "requires_approval": False,
484
+ "requires_approval_reason_code": False,
485
+ "is_approved": False,
486
+ "approved_by": None,
487
+ "approved_date": None,
488
+ "approved_reason_code": None,
489
+ "amount_override": None,
490
+ "rate_override": None,
491
+ "product_id_override": None,
492
+ "product_name_override": None,
493
+ "product_group_override": None,
494
+ "subtype_override": None,
495
+ "uom_override": None,
496
+ "total_override": None,
497
+ "override_by": None,
498
+ "override_date": None,
499
+ "exclude_from_invoice": False,
500
+ "credit_rebill_metadata": None,
501
+ "extra_data": {"mileage": 30},
502
+ "gross_volume": 3998,
503
+ "net_volume": 4037,
504
+ "bol_date": "2025-12-30T18:23:06.337000",
505
+ "bol_number": "334618136",
506
+ "bol_number_override": None,
507
+ "delivery_date": "2025-12-30T18:28:52.122000",
508
+ },
509
+ {
510
+ "model_type": "base",
511
+ "type": "Base Freight",
512
+ "subtype": "Band 31-35",
513
+ "rate": 0.0341,
514
+ "amount": 1026,
515
+ "total": 34.99,
516
+ "uom": "gallons",
517
+ "errors": [],
518
+ "id": "69541abb8c10fc0f85cbda8e",
519
+ "product_group": "Gasoline",
520
+ "product_id": "6908f409b4fcf6a36e6660f3",
521
+ "product_name": "93OCT 10%ETH - SUNOCO",
522
+ "origin": "MARATHON -Detroit",
523
+ "origin_id": "69090ecad6ff2d863efaf07b",
524
+ "origin_override": None,
525
+ "origin_id_override": None,
526
+ "destination": "1083",
527
+ "destination_id": "69090f2e5a7ba1bea579a969",
528
+ "destination_override": None,
529
+ "destination_id_override": None,
530
+ "legs": [
531
+ {
532
+ "origin": "1082",
533
+ "origin_id": "69090f2e5a7ba1bea579a965",
534
+ "destination": "1083",
535
+ "destination_id": "69090f2e5a7ba1bea579a969",
536
+ "distance": 16.05,
537
+ },
538
+ {
539
+ "origin": "MARATHON -Detroit",
540
+ "origin_id": "69090ecad6ff2d863efaf07b",
541
+ "destination": "1082",
542
+ "destination_id": "69090f2e5a7ba1bea579a965",
543
+ "distance": 14.37,
544
+ },
545
+ ],
546
+ "use_surcharge": True,
547
+ "manual": False,
548
+ "has_dependency": False,
549
+ "created_date": None,
550
+ "requires_approval": False,
551
+ "requires_approval_reason_code": False,
552
+ "is_approved": False,
553
+ "approved_by": None,
554
+ "approved_date": None,
555
+ "approved_reason_code": None,
556
+ "amount_override": None,
557
+ "rate_override": None,
558
+ "product_id_override": None,
559
+ "product_name_override": None,
560
+ "product_group_override": None,
561
+ "subtype_override": None,
562
+ "uom_override": None,
563
+ "total_override": None,
564
+ "override_by": None,
565
+ "override_date": None,
566
+ "exclude_from_invoice": False,
567
+ "credit_rebill_metadata": None,
568
+ "extra_data": {"mileage": 30},
569
+ "gross_volume": 1003,
570
+ "net_volume": 1026,
571
+ "bol_date": "2025-12-30T18:23:06.337000",
572
+ "bol_number": "334618136",
573
+ "bol_number_override": None,
574
+ "delivery_date": "2025-12-30T18:30:57.401000",
575
+ },
576
+ {
577
+ "model_type": "base",
578
+ "type": "Base Freight",
579
+ "subtype": "Band 31-35",
580
+ "rate": 0.0341,
581
+ "amount": 6060,
582
+ "total": 206.65,
583
+ "uom": "gallons",
584
+ "errors": [],
585
+ "id": "69541abb8c10fc0f85cbda8f",
586
+ "product_group": "Gasoline",
587
+ "product_id": "6908f4469257414108faf071",
588
+ "product_name": "87OCT 10%ETH - SUNOCO",
589
+ "origin": "MARATHON -Detroit",
590
+ "origin_id": "69090ecad6ff2d863efaf07b",
591
+ "origin_override": None,
592
+ "origin_id_override": None,
593
+ "destination": "1083",
594
+ "destination_id": "69090f2e5a7ba1bea579a969",
595
+ "destination_override": None,
596
+ "destination_id_override": None,
597
+ "legs": [
598
+ {
599
+ "origin": "1082",
600
+ "origin_id": "69090f2e5a7ba1bea579a965",
601
+ "destination": "1083",
602
+ "destination_id": "69090f2e5a7ba1bea579a969",
603
+ "distance": 16.05,
604
+ },
605
+ {
606
+ "origin": "MARATHON -Detroit",
607
+ "origin_id": "69090ecad6ff2d863efaf07b",
608
+ "destination": "1082",
609
+ "destination_id": "69090f2e5a7ba1bea579a965",
610
+ "distance": 14.37,
611
+ },
612
+ ],
613
+ "use_surcharge": True,
614
+ "manual": False,
615
+ "has_dependency": False,
616
+ "created_date": None,
617
+ "requires_approval": False,
618
+ "requires_approval_reason_code": False,
619
+ "is_approved": False,
620
+ "approved_by": None,
621
+ "approved_date": None,
622
+ "approved_reason_code": None,
623
+ "amount_override": None,
624
+ "rate_override": None,
625
+ "product_id_override": None,
626
+ "product_name_override": None,
627
+ "product_group_override": None,
628
+ "subtype_override": None,
629
+ "uom_override": None,
630
+ "total_override": None,
631
+ "override_by": None,
632
+ "override_date": None,
633
+ "exclude_from_invoice": False,
634
+ "credit_rebill_metadata": None,
635
+ "extra_data": {"mileage": 30},
636
+ "gross_volume": 6001,
637
+ "net_volume": 6060,
638
+ "bol_date": "2025-12-30T18:23:06.337000",
639
+ "bol_number": "334618136",
640
+ "bol_number_override": None,
641
+ "delivery_date": "2025-12-30T18:30:34.427000",
642
+ },
643
+ ],
644
+ "counterparty_id": "6908f1eab4fcf6a36e6660e1",
645
+ "book_type": "Cost",
646
+ "effective_date_used": "2025-12-30T00:00:00",
647
+ "invoice_group_id": None,
648
+ "invoice_number": None,
649
+ "accessorial_invoice_number": None,
650
+ "new_version_available": False,
651
+ "new_version_total": None,
652
+ "error": None,
653
+ },
654
+ "allocated_bol_error": None,
655
+ "allocated_bol_issue": None,
656
+ "allocated_bols": [
657
+ {
658
+ "bol_number": "334618136",
659
+ "bol_id": "6954191e8c10fc0f85cbda35",
660
+ "bol_terminal_id": "69090ecad6ff2d863efaf07b",
661
+ "bol_terminal": "MARATHON -Detroit",
662
+ "bol_product": "87OCT 10%ETH - CITGO",
663
+ "bol_product_id": "6908f409b4fcf6a36e6660f1",
664
+ "bol_supplier": "Citgo Branded",
665
+ "bol_supplier_id": "6908f1eab4fcf6a36e6660c8",
666
+ "bol_net_volume_original": 10097,
667
+ "bol_gross_volume_original": 9999,
668
+ "store_number": "1082",
669
+ "store_id": "69090f2e5a7ba1bea579a967",
670
+ "location_id": "69090f2e5a7ba1bea579a965",
671
+ "store_tank": 1,
672
+ "store_product": "87OCT 10%ETH - SUNOCO",
673
+ "store_product_id": "6908f4469257414108faf071",
674
+ "store_timezone": "America/New_York",
675
+ "bol_net_volume_allocated": 4037,
676
+ "bol_gross_volume_allocated": 3998,
677
+ "driver_schedule": "6952ab2e05e52270b51f3d0c",
678
+ "bol_date": "2025-12-30T18:23:06.337000",
679
+ "delivered_date": "2025-12-30T18:28:52.122000",
680
+ "price": {
681
+ "contract": "",
682
+ "price_type": "rack",
683
+ "price_id": "6953080ab9ee7ece772690e7",
684
+ "curve_id": "6945cec2f88ce49ef5fc504a",
685
+ "price": 1.6712,
686
+ "date": "2025-12-30T18:23:06.337000",
687
+ "expired": False,
688
+ },
689
+ },
690
+ {
691
+ "bol_number": "334618136",
692
+ "bol_id": "6954191e8c10fc0f85cbda35",
693
+ "bol_terminal_id": "69090ecad6ff2d863efaf07b",
694
+ "bol_terminal": "MARATHON -Detroit",
695
+ "bol_product": "87OCT 10%ETH - CITGO",
696
+ "bol_product_id": "6908f409b4fcf6a36e6660f1",
697
+ "bol_supplier": "Citgo Branded",
698
+ "bol_supplier_id": "6908f1eab4fcf6a36e6660c8",
699
+ "bol_net_volume_original": 10097,
700
+ "bol_gross_volume_original": 9999,
701
+ "store_number": "1083",
702
+ "store_id": "69090f2e5a7ba1bea579a96b",
703
+ "location_id": "69090f2e5a7ba1bea579a969",
704
+ "store_tank": 3,
705
+ "store_product": "87OCT 10%ETH - SUNOCO",
706
+ "store_product_id": "6908f4469257414108faf071",
707
+ "store_timezone": "America/New_York",
708
+ "bol_net_volume_allocated": 6060,
709
+ "bol_gross_volume_allocated": 6001,
710
+ "driver_schedule": "6952ab2e05e52270b51f3d0c",
711
+ "bol_date": "2025-12-30T18:23:06.337000",
712
+ "delivered_date": "2025-12-30T18:30:34.427000",
713
+ "price": {
714
+ "contract": "",
715
+ "price_type": "rack",
716
+ "price_id": "6953080ab9ee7ece772690e7",
717
+ "curve_id": "6945cec2f88ce49ef5fc504a",
718
+ "price": 1.6712,
719
+ "date": "2025-12-30T18:23:06.337000",
720
+ "expired": False,
721
+ },
722
+ },
723
+ {
724
+ "bol_number": "334618136",
725
+ "bol_id": "6954191e8c10fc0f85cbda35",
726
+ "bol_terminal_id": "69090ecad6ff2d863efaf07b",
727
+ "bol_terminal": "MARATHON -Detroit",
728
+ "bol_product": "93OCT 10%ETH - CITGO",
729
+ "bol_product_id": "6908f409b4fcf6a36e6660f2",
730
+ "bol_supplier": "Citgo Branded",
731
+ "bol_supplier_id": "6908f1eab4fcf6a36e6660c8",
732
+ "bol_net_volume_original": 1026,
733
+ "bol_gross_volume_original": 1003,
734
+ "store_number": "1083",
735
+ "store_id": "69090f2e5a7ba1bea579a96b",
736
+ "location_id": "69090f2e5a7ba1bea579a969",
737
+ "store_tank": 1,
738
+ "store_product": "93OCT 10%ETH - SUNOCO",
739
+ "store_product_id": "6908f409b4fcf6a36e6660f3",
740
+ "store_timezone": "America/New_York",
741
+ "bol_net_volume_allocated": 1026,
742
+ "bol_gross_volume_allocated": 1003,
743
+ "driver_schedule": "6952ab2e05e52270b51f3d0c",
744
+ "bol_date": "2025-12-30T18:23:06.337000",
745
+ "delivered_date": "2025-12-30T18:30:57.401000",
746
+ "price": {
747
+ "contract": "",
748
+ "price_type": "rack",
749
+ "price_id": "6953080ab9ee7ece772690ea",
750
+ "curve_id": "6945cec2f88ce49ef5fc5050",
751
+ "price": 2.6813,
752
+ "date": "2025-12-30T18:23:06.337000",
753
+ "expired": False,
754
+ },
755
+ },
756
+ ],
757
+ "last_change_date": "2025-12-30T18:32:27.749000",
758
+ "reference_order_number": None,
759
+ },
760
+ {
761
+ "order_number": "1196",
762
+ "order_id": "69581c65ee5aaa626ed7ddee",
763
+ "po": None,
764
+ "carrier": "",
765
+ "carrier_id": None,
766
+ "manager": None,
767
+ "manager_id": None,
768
+ "last_movement_update": "2026-01-02T19:29:59.497000",
769
+ "order_date": "2026-01-02T19:28:37Z",
770
+ "status": "complete",
771
+ "type": "regular",
772
+ "drops": [
773
+ {
774
+ "compartment_indexes": [
775
+ 0
776
+ ],
777
+ "before_stick_inches": None,
778
+ "before_stick_time": "2026-01-02T18:29:00Z",
779
+ "after_stick_inches": None,
780
+ "after_stick_time": "2026-01-02T18:29:00Z",
781
+ "drop_id": "69581c65ee5aaa626ed7dde6",
782
+ "location": "1082",
783
+ "location_id": "69090f2e5a7ba1bea579a965",
784
+ "location_source_id": None,
785
+ "location_source_system": "",
786
+ "product": "87OCT 10%ETH - SUNOCO",
787
+ "product_id": "6908f4469257414108faf071",
788
+ "product_source_id": "FO-87-E10 | SUN",
789
+ "product_source_system": "PDI",
790
+ "tank_id": 1,
791
+ "tank_source_id": None,
792
+ "tank_source_system": None,
793
+ "volume": 4000,
794
+ "driver_id": None,
795
+ "driver_username": None,
796
+ "driver_extra_data": None,
797
+ "driver_name": None,
798
+ "driver_date": None,
799
+ "driver_shift": None,
800
+ "driver_shift_id": None,
801
+ "tractor_number": None,
802
+ "trailer_number": None,
803
+ "blend_codes": [],
804
+ "site_counterparty_id": "6908f1eab4fcf6a36e6660e1",
805
+ "site_counterparty_name": "Bazco",
806
+ "freight_customer_id": None,
807
+ "freight_customer_name": None
808
+ },
809
+ {
810
+ "compartment_indexes": [
811
+ 1
812
+ ],
813
+ "before_stick_inches": None,
814
+ "before_stick_time": "2026-01-02T18:29:00Z",
815
+ "after_stick_inches": None,
816
+ "after_stick_time": "2026-01-02T18:29:00Z",
817
+ "drop_id": "69581c65ee5aaa626ed7dde7",
818
+ "location": "1083",
819
+ "location_id": "69090f2e5a7ba1bea579a969",
820
+ "location_source_id": None,
821
+ "location_source_system": "",
822
+ "product": "87OCT 10%ETH - SUNOCO",
823
+ "product_id": "6908f4469257414108faf071",
824
+ "product_source_id": "FO-87-E10 | SUN",
825
+ "product_source_system": "PDI",
826
+ "tank_id": 3,
827
+ "tank_source_id": None,
828
+ "tank_source_system": None,
829
+ "volume": 6000,
830
+ "driver_id": None,
831
+ "driver_username": None,
832
+ "driver_extra_data": None,
833
+ "driver_name": None,
834
+ "driver_date": None,
835
+ "driver_shift": None,
836
+ "driver_shift_id": None,
837
+ "tractor_number": None,
838
+ "trailer_number": None,
839
+ "blend_codes": [],
840
+ "site_counterparty_id": "6908f1eab4fcf6a36e6660e1",
841
+ "site_counterparty_name": "Bazco",
842
+ "freight_customer_id": None,
843
+ "freight_customer_name": None
844
+ },
845
+ {
846
+ "compartment_indexes": [
847
+ 2
848
+ ],
849
+ "before_stick_inches": None,
850
+ "before_stick_time": "2026-01-02T18:29:00Z",
851
+ "after_stick_inches": None,
852
+ "after_stick_time": "2026-01-02T18:29:00Z",
853
+ "drop_id": "69581c65ee5aaa626ed7dde8",
854
+ "location": "1083",
855
+ "location_id": "69090f2e5a7ba1bea579a969",
856
+ "location_source_id": None,
857
+ "location_source_system": "",
858
+ "product": "93OCT 10%ETH - SUNOCO",
859
+ "product_id": "6908f409b4fcf6a36e6660f3",
860
+ "product_source_id": "FO-93-E10 | SUN",
861
+ "product_source_system": "PDI",
862
+ "tank_id": 1,
863
+ "tank_source_id": None,
864
+ "tank_source_system": None,
865
+ "volume": 1000,
866
+ "driver_id": None,
867
+ "driver_username": None,
868
+ "driver_extra_data": None,
869
+ "driver_name": None,
870
+ "driver_date": None,
871
+ "driver_shift": None,
872
+ "driver_shift_id": None,
873
+ "tractor_number": None,
874
+ "trailer_number": None,
875
+ "blend_codes": [],
876
+ "site_counterparty_id": "6908f1eab4fcf6a36e6660e1",
877
+ "site_counterparty_name": "Bazco",
878
+ "freight_customer_id": None,
879
+ "freight_customer_name": None
880
+ }
881
+ ],
882
+ "bols": [
883
+ {
884
+ "bol_number": "243242",
885
+ "bol_id": "69581c9d37fc1998fed7e946",
886
+ "date": "2026-01-02T18:28:00Z",
887
+ "details": [
888
+ {
889
+ "compartment_index": None,
890
+ "load_number": None,
891
+ "product": "87OCT 10%ETH - SUNOCO",
892
+ "product_id": "6908f4469257414108faf071",
893
+ "product_source_id": "FO-87-E10 | SUN",
894
+ "product_source_system": "PDI",
895
+ "net_volume": 10000,
896
+ "gross_volume": 9999,
897
+ "supplier": "Sunoco",
898
+ "supplier_id": "6908f1eab4fcf6a36e6660d9",
899
+ "supplier_source_id": "5008",
900
+ "supplier_source_system": "",
901
+ "contract": "",
902
+ "price_details": {
903
+ "price": None,
904
+ "price_id": None,
905
+ "curve_id": None,
906
+ "date": "2026-01-02T18:28:00",
907
+ "counterparty_id": "6"
908
+ }
909
+ },
910
+ {
911
+ "compartment_index": None,
912
+ "load_number": None,
913
+ "product": "93OCT 10%ETH - SUNOCO",
914
+ "product_id": "6908f409b4fcf6a36e6660f3",
915
+ "product_source_id": "FO-93-E10 | SUN",
916
+ "product_source_system": "PDI",
917
+ "net_volume": 1026,
918
+ "gross_volume": 1003,
919
+ "supplier": "Sunoco",
920
+ "supplier_id": "6908f1eab4fcf6a36e6660d9",
921
+ "supplier_source_id": "5008",
922
+ "supplier_source_system": "",
923
+ "contract": "",
924
+ "price_details": {
925
+ "price": None,
926
+ "price_id": None,
927
+ "curve_id": None,
928
+ "date": "2026-01-02T18:28:00",
929
+ "counterparty_id": "6"
930
+ }
931
+ }
932
+ ],
933
+ "load_or_drop": "Load",
934
+ "location": "SUNOCO -RIVER ROUGE",
935
+ "location_id": "69090ecad6ff2d863efaf084",
936
+ "location_source_id": "T-38-MI-3030",
937
+ "location_source_system": "PDI",
938
+ "driver_id": None,
939
+ "driver_username": None,
940
+ "driver_extra_data": None,
941
+ "driver_name": None,
942
+ "driver_date": None,
943
+ "driver_shift": None,
944
+ "driver_shift_id": None,
945
+ "tractor_number": None,
946
+ "trailer_number": None
947
+ }
948
+ ],
949
+ "costs": [
950
+ {
951
+ "cost_type": "freight",
952
+ "carrier": "missing",
953
+ "carrier_source_id": "",
954
+ "carrier_source_system": "",
955
+ "per_unit_price": 0.0324,
956
+ "cost_amount": 356.4
957
+ }
958
+ ],
959
+ "validation_bypass_on": "2026-01-02T19:29:59.303000",
960
+ "has_additives": False,
961
+ "estimated_freight": {
962
+ "id": "69581c65ee5aaa626ed7ddec",
963
+ "parent": None,
964
+ "created_at": "2026-01-02T19:28:37.447000",
965
+ "type": "freight",
966
+ "status": "open",
967
+ "reversed": False,
968
+ "transactions": [
969
+ {
970
+ "model_type": "base",
971
+ "type": "Base Freight",
972
+ "subtype": "Band 26-30",
973
+ "rate": 0.0324,
974
+ "amount": 4000,
975
+ "total": 129.6,
976
+ "uom": "gallons",
977
+ "errors": [],
978
+ "id": "69581c65ee5aaa626ed7dde9",
979
+ "product_group": "Gasoline",
980
+ "product_id": "6908f4469257414108faf071",
981
+ "product_name": "87OCT 10%ETH - SUNOCO",
982
+ "origin": "SUNOCO -RIVER ROUGE",
983
+ "origin_id": "69090ecad6ff2d863efaf084",
984
+ "origin_override": None,
985
+ "origin_id_override": None,
986
+ "destination": "1082",
987
+ "destination_id": "69090f2e5a7ba1bea579a967",
988
+ "destination_override": None,
989
+ "destination_id_override": None,
990
+ "legs": [
991
+ {
992
+ "origin": "SUNOCO -RIVER ROUGE",
993
+ "origin_id": "69090ecad6ff2d863efaf084",
994
+ "destination": "1082",
995
+ "destination_id": "69090f2e5a7ba1bea579a965",
996
+ "distance": 13.6
997
+ },
998
+ {
999
+ "origin": "1082",
1000
+ "origin_id": "69090f2e5a7ba1bea579a965",
1001
+ "destination": "1083",
1002
+ "destination_id": "69090f2e5a7ba1bea579a969",
1003
+ "distance": 16.05
1004
+ }
1005
+ ],
1006
+ "use_surcharge": True,
1007
+ "manual": False,
1008
+ "has_dependency": False,
1009
+ "created_date": None,
1010
+ "requires_approval": False,
1011
+ "requires_approval_reason_code": False,
1012
+ "is_approved": False,
1013
+ "approved_by": None,
1014
+ "approved_date": None,
1015
+ "approved_reason_code": None,
1016
+ "amount_override": None,
1017
+ "rate_override": None,
1018
+ "product_id_override": None,
1019
+ "product_name_override": None,
1020
+ "product_group_override": None,
1021
+ "subtype_override": None,
1022
+ "uom_override": None,
1023
+ "total_override": None,
1024
+ "override_by": None,
1025
+ "override_date": None,
1026
+ "exclude_from_invoice": False,
1027
+ "credit_rebill_metadata": None,
1028
+ "extra_data": {
1029
+ "mileage": 30
1030
+ },
1031
+ "gross_volume": None,
1032
+ "net_volume": None,
1033
+ "bol_date": None,
1034
+ "bol_number": None,
1035
+ "bol_number_override": None,
1036
+ "delivery_date": None
1037
+ },
1038
+ {
1039
+ "model_type": "base",
1040
+ "type": "Base Freight",
1041
+ "subtype": "Band 26-30",
1042
+ "rate": 0.0324,
1043
+ "amount": 6000,
1044
+ "total": 194.4,
1045
+ "uom": "gallons",
1046
+ "errors": [],
1047
+ "id": "69581c65ee5aaa626ed7ddea",
1048
+ "product_group": "Gasoline",
1049
+ "product_id": "6908f4469257414108faf071",
1050
+ "product_name": "87OCT 10%ETH - SUNOCO",
1051
+ "origin": "SUNOCO -RIVER ROUGE",
1052
+ "origin_id": "69090ecad6ff2d863efaf084",
1053
+ "origin_override": None,
1054
+ "origin_id_override": None,
1055
+ "destination": "1083",
1056
+ "destination_id": "69090f2e5a7ba1bea579a96b",
1057
+ "destination_override": None,
1058
+ "destination_id_override": None,
1059
+ "legs": [
1060
+ {
1061
+ "origin": "SUNOCO -RIVER ROUGE",
1062
+ "origin_id": "69090ecad6ff2d863efaf084",
1063
+ "destination": "1082",
1064
+ "destination_id": "69090f2e5a7ba1bea579a965",
1065
+ "distance": 13.6
1066
+ },
1067
+ {
1068
+ "origin": "1082",
1069
+ "origin_id": "69090f2e5a7ba1bea579a965",
1070
+ "destination": "1083",
1071
+ "destination_id": "69090f2e5a7ba1bea579a969",
1072
+ "distance": 16.05
1073
+ }
1074
+ ],
1075
+ "use_surcharge": True,
1076
+ "manual": False,
1077
+ "has_dependency": False,
1078
+ "created_date": None,
1079
+ "requires_approval": False,
1080
+ "requires_approval_reason_code": False,
1081
+ "is_approved": False,
1082
+ "approved_by": None,
1083
+ "approved_date": None,
1084
+ "approved_reason_code": None,
1085
+ "amount_override": None,
1086
+ "rate_override": None,
1087
+ "product_id_override": None,
1088
+ "product_name_override": None,
1089
+ "product_group_override": None,
1090
+ "subtype_override": None,
1091
+ "uom_override": None,
1092
+ "total_override": None,
1093
+ "override_by": None,
1094
+ "override_date": None,
1095
+ "exclude_from_invoice": False,
1096
+ "credit_rebill_metadata": None,
1097
+ "extra_data": {
1098
+ "mileage": 30
1099
+ },
1100
+ "gross_volume": None,
1101
+ "net_volume": None,
1102
+ "bol_date": None,
1103
+ "bol_number": None,
1104
+ "bol_number_override": None,
1105
+ "delivery_date": None
1106
+ },
1107
+ {
1108
+ "model_type": "base",
1109
+ "type": "Base Freight",
1110
+ "subtype": "Band 26-30",
1111
+ "rate": 0.0324,
1112
+ "amount": 1000,
1113
+ "total": 32.4,
1114
+ "uom": "gallons",
1115
+ "errors": [],
1116
+ "id": "69581c65ee5aaa626ed7ddeb",
1117
+ "product_group": "Gasoline",
1118
+ "product_id": "6908f409b4fcf6a36e6660f3",
1119
+ "product_name": "93OCT 10%ETH - SUNOCO",
1120
+ "origin": "SUNOCO -RIVER ROUGE",
1121
+ "origin_id": "69090ecad6ff2d863efaf084",
1122
+ "origin_override": None,
1123
+ "origin_id_override": None,
1124
+ "destination": "1083",
1125
+ "destination_id": "69090f2e5a7ba1bea579a96b",
1126
+ "destination_override": None,
1127
+ "destination_id_override": None,
1128
+ "legs": [
1129
+ {
1130
+ "origin": "SUNOCO -RIVER ROUGE",
1131
+ "origin_id": "69090ecad6ff2d863efaf084",
1132
+ "destination": "1082",
1133
+ "destination_id": "69090f2e5a7ba1bea579a965",
1134
+ "distance": 13.6
1135
+ },
1136
+ {
1137
+ "origin": "1082",
1138
+ "origin_id": "69090f2e5a7ba1bea579a965",
1139
+ "destination": "1083",
1140
+ "destination_id": "69090f2e5a7ba1bea579a969",
1141
+ "distance": 16.05
1142
+ }
1143
+ ],
1144
+ "use_surcharge": True,
1145
+ "manual": False,
1146
+ "has_dependency": False,
1147
+ "created_date": None,
1148
+ "requires_approval": False,
1149
+ "requires_approval_reason_code": False,
1150
+ "is_approved": False,
1151
+ "approved_by": None,
1152
+ "approved_date": None,
1153
+ "approved_reason_code": None,
1154
+ "amount_override": None,
1155
+ "rate_override": None,
1156
+ "product_id_override": None,
1157
+ "product_name_override": None,
1158
+ "product_group_override": None,
1159
+ "subtype_override": None,
1160
+ "uom_override": None,
1161
+ "total_override": None,
1162
+ "override_by": None,
1163
+ "override_date": None,
1164
+ "exclude_from_invoice": False,
1165
+ "credit_rebill_metadata": None,
1166
+ "extra_data": {
1167
+ "mileage": 30
1168
+ },
1169
+ "gross_volume": None,
1170
+ "net_volume": None,
1171
+ "bol_date": None,
1172
+ "bol_number": None,
1173
+ "bol_number_override": None,
1174
+ "delivery_date": None
1175
+ }
1176
+ ],
1177
+ "counterparty_id": "6908f1eab4fcf6a36e6660e1",
1178
+ "book_type": "Cost",
1179
+ "effective_date_used": "2026-01-03T00:00:00",
1180
+ "invoice_group_id": None,
1181
+ "invoice_number": None,
1182
+ "accessorial_invoice_number": None,
1183
+ "new_version_available": False,
1184
+ "new_version_total": None,
1185
+ "error": None
1186
+ },
1187
+ "actual_freight": {
1188
+ "id": "69581cb74309aa3937d7df5b",
1189
+ "parent": None,
1190
+ "created_at": "2026-01-02T19:29:59.488000",
1191
+ "type": "freight",
1192
+ "status": "open",
1193
+ "reversed": False,
1194
+ "transactions": [
1195
+ {
1196
+ "model_type": "base",
1197
+ "type": "Base Freight",
1198
+ "subtype": "Band 26-30",
1199
+ "rate": 0.0324,
1200
+ "amount": 4000,
1201
+ "total": 129.6,
1202
+ "uom": "gallons",
1203
+ "errors": [],
1204
+ "id": "69581cb74309aa3937d7df56",
1205
+ "product_group": "Gasoline",
1206
+ "product_id": "6908f4469257414108faf071",
1207
+ "product_name": "87OCT 10%ETH - SUNOCO",
1208
+ "origin": "SUNOCO -RIVER ROUGE",
1209
+ "origin_id": "69090ecad6ff2d863efaf084",
1210
+ "origin_override": None,
1211
+ "origin_id_override": None,
1212
+ "destination": "1082",
1213
+ "destination_id": "69090f2e5a7ba1bea579a965",
1214
+ "destination_override": None,
1215
+ "destination_id_override": None,
1216
+ "legs": [
1217
+ {
1218
+ "origin": "SUNOCO -RIVER ROUGE",
1219
+ "origin_id": "69090ecad6ff2d863efaf084",
1220
+ "destination": "1082",
1221
+ "destination_id": "69090f2e5a7ba1bea579a965",
1222
+ "distance": 13.6
1223
+ },
1224
+ {
1225
+ "origin": "1082",
1226
+ "origin_id": "69090f2e5a7ba1bea579a965",
1227
+ "destination": "1083",
1228
+ "destination_id": "69090f2e5a7ba1bea579a969",
1229
+ "distance": 16.05
1230
+ }
1231
+ ],
1232
+ "use_surcharge": True,
1233
+ "manual": False,
1234
+ "has_dependency": False,
1235
+ "created_date": None,
1236
+ "requires_approval": False,
1237
+ "requires_approval_reason_code": False,
1238
+ "is_approved": False,
1239
+ "approved_by": None,
1240
+ "approved_date": None,
1241
+ "approved_reason_code": None,
1242
+ "amount_override": None,
1243
+ "rate_override": None,
1244
+ "product_id_override": None,
1245
+ "product_name_override": None,
1246
+ "product_group_override": None,
1247
+ "subtype_override": None,
1248
+ "uom_override": None,
1249
+ "total_override": None,
1250
+ "override_by": None,
1251
+ "override_date": None,
1252
+ "exclude_from_invoice": False,
1253
+ "credit_rebill_metadata": None,
1254
+ "extra_data": {
1255
+ "mileage": 30
1256
+ },
1257
+ "gross_volume": 4000,
1258
+ "net_volume": 4000,
1259
+ "bol_date": "2026-01-02T18:28:00",
1260
+ "bol_number": "243242",
1261
+ "bol_number_override": None,
1262
+ "delivery_date": "2026-01-02T18:29:00"
1263
+ },
1264
+ {
1265
+ "model_type": "base",
1266
+ "type": "Base Freight",
1267
+ "subtype": "Band 26-30",
1268
+ "rate": 0.0324,
1269
+ "amount": 1026,
1270
+ "total": 33.24,
1271
+ "uom": "gallons",
1272
+ "errors": [],
1273
+ "id": "69581cb74309aa3937d7df58",
1274
+ "product_group": "Gasoline",
1275
+ "product_id": "6908f409b4fcf6a36e6660f3",
1276
+ "product_name": "93OCT 10%ETH - SUNOCO",
1277
+ "origin": "SUNOCO -RIVER ROUGE",
1278
+ "origin_id": "69090ecad6ff2d863efaf084",
1279
+ "origin_override": None,
1280
+ "origin_id_override": None,
1281
+ "destination": "1083",
1282
+ "destination_id": "69090f2e5a7ba1bea579a969",
1283
+ "destination_override": None,
1284
+ "destination_id_override": None,
1285
+ "legs": [
1286
+ {
1287
+ "origin": "SUNOCO -RIVER ROUGE",
1288
+ "origin_id": "69090ecad6ff2d863efaf084",
1289
+ "destination": "1082",
1290
+ "destination_id": "69090f2e5a7ba1bea579a965",
1291
+ "distance": 13.6
1292
+ },
1293
+ {
1294
+ "origin": "1082",
1295
+ "origin_id": "69090f2e5a7ba1bea579a965",
1296
+ "destination": "1083",
1297
+ "destination_id": "69090f2e5a7ba1bea579a969",
1298
+ "distance": 16.05
1299
+ }
1300
+ ],
1301
+ "use_surcharge": True,
1302
+ "manual": False,
1303
+ "has_dependency": False,
1304
+ "created_date": None,
1305
+ "requires_approval": False,
1306
+ "requires_approval_reason_code": False,
1307
+ "is_approved": False,
1308
+ "approved_by": None,
1309
+ "approved_date": None,
1310
+ "approved_reason_code": None,
1311
+ "amount_override": None,
1312
+ "rate_override": None,
1313
+ "product_id_override": None,
1314
+ "product_name_override": None,
1315
+ "product_group_override": None,
1316
+ "subtype_override": None,
1317
+ "uom_override": None,
1318
+ "total_override": None,
1319
+ "override_by": None,
1320
+ "override_date": None,
1321
+ "exclude_from_invoice": False,
1322
+ "credit_rebill_metadata": None,
1323
+ "extra_data": {
1324
+ "mileage": 30
1325
+ },
1326
+ "gross_volume": 1003,
1327
+ "net_volume": 1026,
1328
+ "bol_date": "2026-01-02T18:28:00",
1329
+ "bol_number": "243242",
1330
+ "bol_number_override": None,
1331
+ "delivery_date": "2026-01-02T18:29:00"
1332
+ },
1333
+ {
1334
+ "model_type": "base",
1335
+ "type": "Base Freight",
1336
+ "subtype": "Band 26-30",
1337
+ "rate": 0.0324,
1338
+ "amount": 6000,
1339
+ "total": 194.4,
1340
+ "uom": "gallons",
1341
+ "errors": [],
1342
+ "id": "69581cb74309aa3937d7df5a",
1343
+ "product_group": "Gasoline",
1344
+ "product_id": "6908f4469257414108faf071",
1345
+ "product_name": "87OCT 10%ETH - SUNOCO",
1346
+ "origin": "SUNOCO -RIVER ROUGE",
1347
+ "origin_id": "69090ecad6ff2d863efaf084",
1348
+ "origin_override": None,
1349
+ "origin_id_override": None,
1350
+ "destination": "1083",
1351
+ "destination_id": "69090f2e5a7ba1bea579a969",
1352
+ "destination_override": None,
1353
+ "destination_id_override": None,
1354
+ "legs": [
1355
+ {
1356
+ "origin": "SUNOCO -RIVER ROUGE",
1357
+ "origin_id": "69090ecad6ff2d863efaf084",
1358
+ "destination": "1082",
1359
+ "destination_id": "69090f2e5a7ba1bea579a965",
1360
+ "distance": 13.6
1361
+ },
1362
+ {
1363
+ "origin": "1082",
1364
+ "origin_id": "69090f2e5a7ba1bea579a965",
1365
+ "destination": "1083",
1366
+ "destination_id": "69090f2e5a7ba1bea579a969",
1367
+ "distance": 16.05
1368
+ }
1369
+ ],
1370
+ "use_surcharge": True,
1371
+ "manual": False,
1372
+ "has_dependency": False,
1373
+ "created_date": None,
1374
+ "requires_approval": False,
1375
+ "requires_approval_reason_code": False,
1376
+ "is_approved": False,
1377
+ "approved_by": None,
1378
+ "approved_date": None,
1379
+ "approved_reason_code": None,
1380
+ "amount_override": None,
1381
+ "rate_override": None,
1382
+ "product_id_override": None,
1383
+ "product_name_override": None,
1384
+ "product_group_override": None,
1385
+ "subtype_override": None,
1386
+ "uom_override": None,
1387
+ "total_override": None,
1388
+ "override_by": None,
1389
+ "override_date": None,
1390
+ "exclude_from_invoice": False,
1391
+ "credit_rebill_metadata": None,
1392
+ "extra_data": {
1393
+ "mileage": 30
1394
+ },
1395
+ "gross_volume": 5999,
1396
+ "net_volume": 6000,
1397
+ "bol_date": "2026-01-02T18:28:00",
1398
+ "bol_number": "243242",
1399
+ "bol_number_override": None,
1400
+ "delivery_date": "2026-01-02T18:29:00"
1401
+ }
1402
+ ],
1403
+ "counterparty_id": "6908f1eab4fcf6a36e6660e1",
1404
+ "book_type": "Cost",
1405
+ "effective_date_used": "2026-01-02T00:00:00",
1406
+ "invoice_group_id": None,
1407
+ "invoice_number": None,
1408
+ "accessorial_invoice_number": None,
1409
+ "new_version_available": False,
1410
+ "new_version_total": None,
1411
+ "error": None
1412
+ },
1413
+ "allocated_bol_error": None,
1414
+ "allocated_bol_issue": None,
1415
+ "allocated_bols": [
1416
+ {
1417
+ "bol_number": "243242",
1418
+ "bol_id": "69581c9d37fc1998fed7e946",
1419
+ "bol_terminal_id": "69090ecad6ff2d863efaf084",
1420
+ "bol_terminal": "SUNOCO -RIVER ROUGE",
1421
+ "bol_product": "87OCT 10%ETH - SUNOCO",
1422
+ "bol_product_id": "6908f4469257414108faf071",
1423
+ "bol_supplier": "Sunoco",
1424
+ "bol_supplier_id": "6908f1eab4fcf6a36e6660d9",
1425
+ "bol_net_volume_original": 10000,
1426
+ "bol_gross_volume_original": 9999,
1427
+ "store_number": "1082",
1428
+ "store_id": "69090f2e5a7ba1bea579a967",
1429
+ "location_id": "69090f2e5a7ba1bea579a965",
1430
+ "store_tank": 1,
1431
+ "store_product": "87OCT 10%ETH - SUNOCO",
1432
+ "store_product_id": "6908f4469257414108faf071",
1433
+ "store_timezone": "America/New_York",
1434
+ "bol_net_volume_allocated": 4000,
1435
+ "bol_gross_volume_allocated": 4000,
1436
+ "driver_schedule": None,
1437
+ "bol_date": "2026-01-02T18:28:00",
1438
+ "delivered_date": "2026-01-02T18:29:00",
1439
+ "price": {
1440
+ "contract": "",
1441
+ "price_type": "rack",
1442
+ "price_id": "6955ab1fb816b69ba5c18eca",
1443
+ "curve_id": "6945cec2f88ce49ef5fc509c",
1444
+ "price": 1.7556,
1445
+ "date": "2026-01-02T18:28:00",
1446
+ "expired": True
1447
+ }
1448
+ },
1449
+ {
1450
+ "bol_number": "243242",
1451
+ "bol_id": "69581c9d37fc1998fed7e946",
1452
+ "bol_terminal_id": "69090ecad6ff2d863efaf084",
1453
+ "bol_terminal": "SUNOCO -RIVER ROUGE",
1454
+ "bol_product": "87OCT 10%ETH - SUNOCO",
1455
+ "bol_product_id": "6908f4469257414108faf071",
1456
+ "bol_supplier": "Sunoco",
1457
+ "bol_supplier_id": "6908f1eab4fcf6a36e6660d9",
1458
+ "bol_net_volume_original": 10000,
1459
+ "bol_gross_volume_original": 9999,
1460
+ "store_number": "1083",
1461
+ "store_id": "69090f2e5a7ba1bea579a96b",
1462
+ "location_id": "69090f2e5a7ba1bea579a969",
1463
+ "store_tank": 3,
1464
+ "store_product": "87OCT 10%ETH - SUNOCO",
1465
+ "store_product_id": "6908f4469257414108faf071",
1466
+ "store_timezone": "America/New_York",
1467
+ "bol_net_volume_allocated": 6000,
1468
+ "bol_gross_volume_allocated": 5999,
1469
+ "driver_schedule": None,
1470
+ "bol_date": "2026-01-02T18:28:00",
1471
+ "delivered_date": "2026-01-02T18:29:00",
1472
+ "price": {
1473
+ "contract": "",
1474
+ "price_type": "rack",
1475
+ "price_id": "6955ab1fb816b69ba5c18eca",
1476
+ "curve_id": "6945cec2f88ce49ef5fc509c",
1477
+ "price": 1.7556,
1478
+ "date": "2026-01-02T18:28:00",
1479
+ "expired": True
1480
+ }
1481
+ },
1482
+ {
1483
+ "bol_number": "243242",
1484
+ "bol_id": "69581c9d37fc1998fed7e946",
1485
+ "bol_terminal_id": "69090ecad6ff2d863efaf084",
1486
+ "bol_terminal": "SUNOCO -RIVER ROUGE",
1487
+ "bol_product": "93OCT 10%ETH - SUNOCO",
1488
+ "bol_product_id": "6908f409b4fcf6a36e6660f3",
1489
+ "bol_supplier": "Sunoco",
1490
+ "bol_supplier_id": "6908f1eab4fcf6a36e6660d9",
1491
+ "bol_net_volume_original": 1026,
1492
+ "bol_gross_volume_original": 1003,
1493
+ "store_number": "1083",
1494
+ "store_id": "69090f2e5a7ba1bea579a96b",
1495
+ "location_id": "69090f2e5a7ba1bea579a969",
1496
+ "store_tank": 1,
1497
+ "store_product": "93OCT 10%ETH - SUNOCO",
1498
+ "store_product_id": "6908f409b4fcf6a36e6660f3",
1499
+ "store_timezone": "America/New_York",
1500
+ "bol_net_volume_allocated": 1026,
1501
+ "bol_gross_volume_allocated": 1003,
1502
+ "driver_schedule": None,
1503
+ "bol_date": "2026-01-02T18:28:00",
1504
+ "delivered_date": "2026-01-02T18:29:00",
1505
+ "price": {
1506
+ "contract": "",
1507
+ "price_type": "rack",
1508
+ "price_id": "6955ab1fb816b69ba5c18ea9",
1509
+ "curve_id": "6945cec2f88ce49ef5fc505a",
1510
+ "price": 2.8061,
1511
+ "date": "2026-01-02T18:28:00",
1512
+ "expired": True
1513
+ }
1514
+ }
1515
+ ],
1516
+ "last_change_date": "2026-01-02T19:29:59.497000",
1517
+ "reference_order_number": None
1518
+ }
1519
+ ]
1520
+
1521
+ mock_get_orders_response = [
1522
+ {
1523
+ "type": "regular",
1524
+ "order_id": "6953f4eda8bb5f01056eaca6",
1525
+ "drivers": [
1526
+ {
1527
+ "driver_id": "690912c7cca24d51e38ca2ea",
1528
+ "driver_schedule_id": "6952ab2e05e52270b51f3d0c",
1529
+ "name": "Joel Stewart",
1530
+ "username": "rstewart7468"
1531
+ }
1532
+ ],
1533
+ "order_number": 1103,
1534
+ "order_date": "2025-12-30T15:51:09Z",
1535
+ "order_state": "complete",
1536
+ "carrier_window_start": None,
1537
+ "carrier_window_end": None,
1538
+ "carrier_window_start_local": None,
1539
+ "carrier_window_end_local": None,
1540
+ "carrier_notify_state": "none",
1541
+ "load_window_start": "2025-12-29T23:00:00Z",
1542
+ "load_window_end": "2026-01-04T23:00:00Z",
1543
+ "dispatch_window_start": "2025-12-25T23:29:00Z",
1544
+ "dispatch_window_end": "2025-12-25T23:29:00Z",
1545
+ "hauler_counterparty_id": "None",
1546
+ "hauler_counterparty_name": "",
1547
+ "hauler_counterparty_source_id": None,
1548
+ "hauler_counterparty_source_system": "",
1549
+ "hauled_by_updated_by": "JBerninger",
1550
+ "hauled_by_updated": "2025-12-30T15:51:33.218000",
1551
+ "loads": [
1552
+ {
1553
+ "location_id": "69090ecad6ff2d863efaf07b",
1554
+ "location_name": "MARATHON -Detroit",
1555
+ "location_source_id": "T-38-MI-3015",
1556
+ "location_source_system": "PDI",
1557
+ "location_type": "Terminal",
1558
+ "details": [
1559
+ {
1560
+ "detail_id": "6953f4eda8bb5f01056eac9c",
1561
+ "counterparty_id": "6908f1eab4fcf6a36e6660c8",
1562
+ "counterparty_name": "Citgo Branded",
1563
+ "counterparty_source_id": "5002",
1564
+ "counterparty_source_system": None,
1565
+ "price_type": "rack",
1566
+ "contract": "",
1567
+ "product_id": "6908f409b4fcf6a36e6660f1",
1568
+ "product_name": "87OCT 10%ETH - CITGO",
1569
+ "product_source_id": "FO-87-E10 | CIT",
1570
+ "product_source_system": "PDI",
1571
+ "drop_product_id": "6908f4469257414108faf071",
1572
+ "drop_product_name": "87OCT 10%ETH - SUNOCO",
1573
+ "drop_product_source_id": "FO-87-E10 | SUN",
1574
+ "drop_product_source_system": "PDI",
1575
+ "quantity": 4000,
1576
+ "compartment_index": 0,
1577
+ "blend_code": None,
1578
+ "product_codes": [],
1579
+ "load_number": None
1580
+ },
1581
+ {
1582
+ "detail_id": "6953f4eda8bb5f01056eac9c",
1583
+ "counterparty_id": "6908f1eab4fcf6a36e6660c8",
1584
+ "counterparty_name": "Citgo Branded",
1585
+ "counterparty_source_id": "5002",
1586
+ "counterparty_source_system": None,
1587
+ "price_type": "rack",
1588
+ "contract": "",
1589
+ "product_id": "6908f409b4fcf6a36e6660f1",
1590
+ "product_name": "87OCT 10%ETH - CITGO",
1591
+ "product_source_id": "FO-87-E10 | CIT",
1592
+ "product_source_system": "PDI",
1593
+ "drop_product_id": "6908f4469257414108faf071",
1594
+ "drop_product_name": "87OCT 10%ETH - SUNOCO",
1595
+ "drop_product_source_id": "FO-87-E10 | SUN",
1596
+ "drop_product_source_system": "PDI",
1597
+ "quantity": 6000,
1598
+ "compartment_index": 1,
1599
+ "blend_code": None,
1600
+ "product_codes": [],
1601
+ "load_number": None
1602
+ },
1603
+ {
1604
+ "detail_id": "6953f4eda8bb5f01056eac9d",
1605
+ "counterparty_id": "6908f1eab4fcf6a36e6660c8",
1606
+ "counterparty_name": "Citgo Branded",
1607
+ "counterparty_source_id": "5002",
1608
+ "counterparty_source_system": None,
1609
+ "price_type": "rack",
1610
+ "contract": "",
1611
+ "product_id": "6908f409b4fcf6a36e6660f2",
1612
+ "product_name": "93OCT 10%ETH - CITGO",
1613
+ "product_source_id": "FO-93-E10 | CIT",
1614
+ "product_source_system": "PDI",
1615
+ "drop_product_id": "6908f409b4fcf6a36e6660f3",
1616
+ "drop_product_name": "93OCT 10%ETH - SUNOCO",
1617
+ "drop_product_source_id": "FO-93-E10 | SUN",
1618
+ "drop_product_source_system": "PDI",
1619
+ "quantity": 1000,
1620
+ "compartment_index": 2,
1621
+ "blend_code": None,
1622
+ "product_codes": [],
1623
+ "load_number": None
1624
+ }
1625
+ ],
1626
+ "eta": "2025-12-30T18:22:55.199000",
1627
+ "status": "complete"
1628
+ }
1629
+ ],
1630
+ "drops": [
1631
+ {
1632
+ "location_id": "69090f2e5a7ba1bea579a965",
1633
+ "location_name": "1082",
1634
+ "location_source_id": None,
1635
+ "location_source_system": "",
1636
+ "location_type": "Store",
1637
+ "details": [
1638
+ {
1639
+ "detail_id": "6953f4eda8bb5f01056eac9e",
1640
+ "counterparty_id": "",
1641
+ "counterparty_name": "",
1642
+ "counterparty_source_id": None,
1643
+ "counterparty_source_system": None,
1644
+ "product_id": "6908f4469257414108faf071",
1645
+ "product_name": "87OCT 10%ETH - SUNOCO",
1646
+ "product_source_id": "FO-87-E10 | SUN",
1647
+ "product_source_system": "PDI",
1648
+ "quantity": 4000,
1649
+ "tank_id": 1,
1650
+ "sources": [
1651
+ {
1652
+ "compartment_index": 0,
1653
+ "volume": 4000
1654
+ }
1655
+ ],
1656
+ "destination_codes": [],
1657
+ "blend_codes": []
1658
+ }
1659
+ ],
1660
+ "eta": "2025-12-30T18:26:36.339000",
1661
+ "status": "complete"
1662
+ },
1663
+ {
1664
+ "location_id": "69090f2e5a7ba1bea579a969",
1665
+ "location_name": "1083",
1666
+ "location_source_id": None,
1667
+ "location_source_system": "",
1668
+ "location_type": "Store",
1669
+ "details": [
1670
+ {
1671
+ "detail_id": "6953f4eda8bb5f01056eac9f",
1672
+ "counterparty_id": "",
1673
+ "counterparty_name": "",
1674
+ "counterparty_source_id": None,
1675
+ "counterparty_source_system": None,
1676
+ "product_id": "6908f4469257414108faf071",
1677
+ "product_name": "87OCT 10%ETH - SUNOCO",
1678
+ "product_source_id": "FO-87-E10 | SUN",
1679
+ "product_source_system": "PDI",
1680
+ "quantity": 6000,
1681
+ "tank_id": 3,
1682
+ "sources": [
1683
+ {
1684
+ "compartment_index": 1,
1685
+ "volume": 6000
1686
+ }
1687
+ ],
1688
+ "destination_codes": [],
1689
+ "blend_codes": []
1690
+ },
1691
+ {
1692
+ "detail_id": "6953f4eda8bb5f01056eaca0",
1693
+ "counterparty_id": "",
1694
+ "counterparty_name": "",
1695
+ "counterparty_source_id": None,
1696
+ "counterparty_source_system": None,
1697
+ "product_id": "6908f409b4fcf6a36e6660f3",
1698
+ "product_name": "93OCT 10%ETH - SUNOCO",
1699
+ "product_source_id": "FO-93-E10 | SUN",
1700
+ "product_source_system": "PDI",
1701
+ "quantity": 1000,
1702
+ "tank_id": 1,
1703
+ "sources": [
1704
+ {
1705
+ "compartment_index": 2,
1706
+ "volume": 1000
1707
+ }
1708
+ ],
1709
+ "destination_codes": [],
1710
+ "blend_codes": []
1711
+ }
1712
+ ],
1713
+ "eta": "2025-12-30T18:30:06.668000",
1714
+ "status": "complete"
1715
+ }
1716
+ ],
1717
+ "detours": [],
1718
+ "trip_status": "complete",
1719
+ "last_change_date": "2025-12-30T18:32:27.749000",
1720
+ "market": "Michigan",
1721
+ "supply_option": {
1722
+ "option": "recommended",
1723
+ "carrier_id": None,
1724
+ "carrier": None,
1725
+ "loaded_miles": 30.42233356032,
1726
+ "freight": 0.034100000000000005,
1727
+ "freight_cost": 0,
1728
+ "stops": 3,
1729
+ "prices": [
1730
+ {
1731
+ "product_name": "87OCT 10%ETH - SUNOCO",
1732
+ "volume": 10000,
1733
+ "components": [
1734
+ {
1735
+ "timezone_data": None,
1736
+ "curve_id": "6945cec2f88ce49ef5fc504a",
1737
+ "price_id": "6953080ab9ee7ece772690e7",
1738
+ "terminal_id": "69090ecad6ff2d863efaf07b",
1739
+ "terminal": "MARATHON -Detroit",
1740
+ "supplier_id": "6908f1eab4fcf6a36e6660c8",
1741
+ "supplier": "Citgo Branded",
1742
+ "price_type": "rack",
1743
+ "product_id": "6908f409b4fcf6a36e6660f1",
1744
+ "product": "87OCT 10%ETH - CITGO",
1745
+ "supply_owner_id": "6908f1eab4fcf6a36e6660e1",
1746
+ "supply_owner": "Bazco",
1747
+ "price": 1.6712,
1748
+ "contract": "",
1749
+ "volume": 10000,
1750
+ "effective_from": "2025-12-29T23:00:00Z",
1751
+ "effective_to": "2026-01-04T23:00:00Z",
1752
+ "group_id": None,
1753
+ "group_effective_cutover": None,
1754
+ "group_effective_cutover_timezone": None,
1755
+ "group_identifier": None,
1756
+ "group_name": None,
1757
+ "min_constraint": None,
1758
+ "max_constraint": None,
1759
+ "load_number": None,
1760
+ "load_numbers": [],
1761
+ "directive_info": None
1762
+ }
1763
+ ],
1764
+ "product_total": 16712,
1765
+ "blend_code": None
1766
+ },
1767
+ {
1768
+ "product_name": "93OCT 10%ETH - SUNOCO",
1769
+ "volume": 1000,
1770
+ "components": [
1771
+ {
1772
+ "timezone_data": None,
1773
+ "curve_id": "6945cec2f88ce49ef5fc5050",
1774
+ "price_id": "6953080ab9ee7ece772690ea",
1775
+ "terminal_id": "69090ecad6ff2d863efaf07b",
1776
+ "terminal": "MARATHON -Detroit",
1777
+ "supplier_id": "6908f1eab4fcf6a36e6660c8",
1778
+ "supplier": "Citgo Branded",
1779
+ "price_type": "rack",
1780
+ "product_id": "6908f409b4fcf6a36e6660f2",
1781
+ "product": "93OCT 10%ETH - CITGO",
1782
+ "supply_owner_id": "6908f1eab4fcf6a36e6660e1",
1783
+ "supply_owner": "Bazco",
1784
+ "price": 2.6813,
1785
+ "contract": "",
1786
+ "volume": 1000,
1787
+ "effective_from": "2025-12-29T23:00:00Z",
1788
+ "effective_to": "2026-01-04T23:00:00Z",
1789
+ "group_id": None,
1790
+ "group_effective_cutover": None,
1791
+ "group_effective_cutover_timezone": None,
1792
+ "group_identifier": None,
1793
+ "group_name": None,
1794
+ "min_constraint": None,
1795
+ "max_constraint": None,
1796
+ "load_number": None,
1797
+ "load_numbers": [],
1798
+ "directive_info": None
1799
+ }
1800
+ ],
1801
+ "product_total": 2681.2999999999997,
1802
+ "blend_code": None
1803
+ }
1804
+ ],
1805
+ "product_total": 19393.3,
1806
+ "landed_cost": 19768.399999999998,
1807
+ "supply_owner_map": {
1808
+ "definitions": [
1809
+ {
1810
+ "location_name": "1082",
1811
+ "product": "87OCT 10%ETH - SUNOCO",
1812
+ "supply_owner_id": "6908f1eab4fcf6a36e6660e1"
1813
+ },
1814
+ {
1815
+ "location_name": "1083",
1816
+ "product": "87OCT 10%ETH - SUNOCO",
1817
+ "supply_owner_id": "6908f1eab4fcf6a36e6660e1"
1818
+ },
1819
+ {
1820
+ "location_name": "1083",
1821
+ "product": "93OCT 10%ETH - SUNOCO",
1822
+ "supply_owner_id": "6908f1eab4fcf6a36e6660e1"
1823
+ }
1824
+ ]
1825
+ },
1826
+ "freight_customer_id": "6908f1eab4fcf6a36e6660e1",
1827
+ "delivered": False,
1828
+ "out_of_network": False,
1829
+ "estimated_freight": {
1830
+ "id": "6953f4eda8bb5f01056eaca4",
1831
+ "parent": None,
1832
+ "created_at": "2025-12-30T15:51:09.909000",
1833
+ "type": "freight",
1834
+ "status": "open",
1835
+ "reversed": False,
1836
+ "transactions": [
1837
+ {
1838
+ "model_type": "base",
1839
+ "type": "Base Freight",
1840
+ "subtype": "Band 31-35",
1841
+ "rate": 0.0341,
1842
+ "amount": 4000,
1843
+ "total": 136.4,
1844
+ "uom": "gallons",
1845
+ "errors": [],
1846
+ "id": "6953f4eda8bb5f01056eaca1",
1847
+ "product_group": "Gasoline",
1848
+ "product_id": "6908f4469257414108faf071",
1849
+ "product_name": "87OCT 10%ETH - SUNOCO",
1850
+ "origin": "MARATHON -Detroit",
1851
+ "origin_id": "69090ecad6ff2d863efaf07b",
1852
+ "origin_override": None,
1853
+ "origin_id_override": None,
1854
+ "destination": "1082",
1855
+ "destination_id": "69090f2e5a7ba1bea579a967",
1856
+ "destination_override": None,
1857
+ "destination_id_override": None,
1858
+ "legs": [
1859
+ {
1860
+ "origin": "1082",
1861
+ "origin_id": "69090f2e5a7ba1bea579a965",
1862
+ "destination": "1083",
1863
+ "destination_id": "69090f2e5a7ba1bea579a969",
1864
+ "distance": 16.05
1865
+ },
1866
+ {
1867
+ "origin": "MARATHON -Detroit",
1868
+ "origin_id": "69090ecad6ff2d863efaf07b",
1869
+ "destination": "1082",
1870
+ "destination_id": "69090f2e5a7ba1bea579a965",
1871
+ "distance": 14.37
1872
+ }
1873
+ ],
1874
+ "use_surcharge": True,
1875
+ "manual": False,
1876
+ "has_dependency": False,
1877
+ "created_date": None,
1878
+ "requires_approval": False,
1879
+ "requires_approval_reason_code": False,
1880
+ "is_approved": False,
1881
+ "approved_by": None,
1882
+ "approved_date": None,
1883
+ "approved_reason_code": None,
1884
+ "amount_override": None,
1885
+ "rate_override": None,
1886
+ "product_id_override": None,
1887
+ "product_name_override": None,
1888
+ "product_group_override": None,
1889
+ "subtype_override": None,
1890
+ "uom_override": None,
1891
+ "total_override": None,
1892
+ "override_by": None,
1893
+ "override_date": None,
1894
+ "exclude_from_invoice": False,
1895
+ "credit_rebill_metadata": None,
1896
+ "extra_data": {
1897
+ "mileage": 30
1898
+ },
1899
+ "gross_volume": None,
1900
+ "net_volume": None,
1901
+ "bol_date": None,
1902
+ "bol_number": None,
1903
+ "bol_number_override": None,
1904
+ "delivery_date": None
1905
+ },
1906
+ {
1907
+ "model_type": "base",
1908
+ "type": "Base Freight",
1909
+ "subtype": "Band 31-35",
1910
+ "rate": 0.0341,
1911
+ "amount": 6000,
1912
+ "total": 204.6,
1913
+ "uom": "gallons",
1914
+ "errors": [],
1915
+ "id": "6953f4eda8bb5f01056eaca2",
1916
+ "product_group": "Gasoline",
1917
+ "product_id": "6908f4469257414108faf071",
1918
+ "product_name": "87OCT 10%ETH - SUNOCO",
1919
+ "origin": "MARATHON -Detroit",
1920
+ "origin_id": "69090ecad6ff2d863efaf07b",
1921
+ "origin_override": None,
1922
+ "origin_id_override": None,
1923
+ "destination": "1083",
1924
+ "destination_id": "69090f2e5a7ba1bea579a96b",
1925
+ "destination_override": None,
1926
+ "destination_id_override": None,
1927
+ "legs": [
1928
+ {
1929
+ "origin": "1082",
1930
+ "origin_id": "69090f2e5a7ba1bea579a965",
1931
+ "destination": "1083",
1932
+ "destination_id": "69090f2e5a7ba1bea579a969",
1933
+ "distance": 16.05
1934
+ },
1935
+ {
1936
+ "origin": "MARATHON -Detroit",
1937
+ "origin_id": "69090ecad6ff2d863efaf07b",
1938
+ "destination": "1082",
1939
+ "destination_id": "69090f2e5a7ba1bea579a965",
1940
+ "distance": 14.37
1941
+ }
1942
+ ],
1943
+ "use_surcharge": True,
1944
+ "manual": False,
1945
+ "has_dependency": False,
1946
+ "created_date": None,
1947
+ "requires_approval": False,
1948
+ "requires_approval_reason_code": False,
1949
+ "is_approved": False,
1950
+ "approved_by": None,
1951
+ "approved_date": None,
1952
+ "approved_reason_code": None,
1953
+ "amount_override": None,
1954
+ "rate_override": None,
1955
+ "product_id_override": None,
1956
+ "product_name_override": None,
1957
+ "product_group_override": None,
1958
+ "subtype_override": None,
1959
+ "uom_override": None,
1960
+ "total_override": None,
1961
+ "override_by": None,
1962
+ "override_date": None,
1963
+ "exclude_from_invoice": False,
1964
+ "credit_rebill_metadata": None,
1965
+ "extra_data": {
1966
+ "mileage": 30
1967
+ },
1968
+ "gross_volume": None,
1969
+ "net_volume": None,
1970
+ "bol_date": None,
1971
+ "bol_number": None,
1972
+ "bol_number_override": None,
1973
+ "delivery_date": None
1974
+ },
1975
+ {
1976
+ "model_type": "base",
1977
+ "type": "Base Freight",
1978
+ "subtype": "Band 31-35",
1979
+ "rate": 0.0341,
1980
+ "amount": 1000,
1981
+ "total": 34.1,
1982
+ "uom": "gallons",
1983
+ "errors": [],
1984
+ "id": "6953f4eda8bb5f01056eaca3",
1985
+ "product_group": "Gasoline",
1986
+ "product_id": "6908f409b4fcf6a36e6660f3",
1987
+ "product_name": "93OCT 10%ETH - SUNOCO",
1988
+ "origin": "MARATHON -Detroit",
1989
+ "origin_id": "69090ecad6ff2d863efaf07b",
1990
+ "origin_override": None,
1991
+ "origin_id_override": None,
1992
+ "destination": "1083",
1993
+ "destination_id": "69090f2e5a7ba1bea579a96b",
1994
+ "destination_override": None,
1995
+ "destination_id_override": None,
1996
+ "legs": [
1997
+ {
1998
+ "origin": "1082",
1999
+ "origin_id": "69090f2e5a7ba1bea579a965",
2000
+ "destination": "1083",
2001
+ "destination_id": "69090f2e5a7ba1bea579a969",
2002
+ "distance": 16.05
2003
+ },
2004
+ {
2005
+ "origin": "MARATHON -Detroit",
2006
+ "origin_id": "69090ecad6ff2d863efaf07b",
2007
+ "destination": "1082",
2008
+ "destination_id": "69090f2e5a7ba1bea579a965",
2009
+ "distance": 14.37
2010
+ }
2011
+ ],
2012
+ "use_surcharge": True,
2013
+ "manual": False,
2014
+ "has_dependency": False,
2015
+ "created_date": None,
2016
+ "requires_approval": False,
2017
+ "requires_approval_reason_code": False,
2018
+ "is_approved": False,
2019
+ "approved_by": None,
2020
+ "approved_date": None,
2021
+ "approved_reason_code": None,
2022
+ "amount_override": None,
2023
+ "rate_override": None,
2024
+ "product_id_override": None,
2025
+ "product_name_override": None,
2026
+ "product_group_override": None,
2027
+ "subtype_override": None,
2028
+ "uom_override": None,
2029
+ "total_override": None,
2030
+ "override_by": None,
2031
+ "override_date": None,
2032
+ "exclude_from_invoice": False,
2033
+ "credit_rebill_metadata": None,
2034
+ "extra_data": {
2035
+ "mileage": 30
2036
+ },
2037
+ "gross_volume": None,
2038
+ "net_volume": None,
2039
+ "bol_date": None,
2040
+ "bol_number": None,
2041
+ "bol_number_override": None,
2042
+ "delivery_date": None
2043
+ }
2044
+ ],
2045
+ "counterparty_id": "6908f1eab4fcf6a36e6660e1",
2046
+ "book_type": "Cost",
2047
+ "effective_date_used": "2025-12-30T00:00:00",
2048
+ "invoice_group_id": None,
2049
+ "invoice_number": None,
2050
+ "accessorial_invoice_number": None,
2051
+ "new_version_available": False,
2052
+ "new_version_total": None,
2053
+ "error": None
2054
+ },
2055
+ "legs": [
2056
+ {
2057
+ "origin": "1082",
2058
+ "origin_id": "69090f2e5a7ba1bea579a965",
2059
+ "destination": "1083",
2060
+ "destination_id": "69090f2e5a7ba1bea579a969",
2061
+ "distance": 16.05
2062
+ },
2063
+ {
2064
+ "origin": "MARATHON -Detroit",
2065
+ "origin_id": "69090ecad6ff2d863efaf07b",
2066
+ "destination": "1082",
2067
+ "destination_id": "69090f2e5a7ba1bea579a965",
2068
+ "distance": 14.37
2069
+ }
2070
+ ],
2071
+ "freight_distance": 30.42,
2072
+ "supply_owner_id": "6908f1eab4fcf6a36e6660e1"
2073
+ },
2074
+ "created_by": "JBerninger",
2075
+ "note": None,
2076
+ "estimated_load_minutes": 44,
2077
+ "total_miles": 35.91836175356,
2078
+ "loaded_miles": 30.42233356032,
2079
+ "unloaded_miles": 5.49602819324,
2080
+ "reference_order_number": None,
2081
+ "extra_data": {},
2082
+ "tractor": "202",
2083
+ "trailer": "1609",
2084
+ "po_number": None
2085
+ },
2086
+ {
2087
+ "type": "regular",
2088
+ "order_id": "69581c65ee5aaa626ed7ddee",
2089
+ "drivers": [],
2090
+ "order_number": 1196,
2091
+ "order_date": "2026-01-02T19:28:37Z",
2092
+ "order_state": "complete",
2093
+ "carrier_window_start": None,
2094
+ "carrier_window_end": None,
2095
+ "carrier_window_start_local": None,
2096
+ "carrier_window_end_local": None,
2097
+ "carrier_notify_state": "none",
2098
+ "load_window_start": "2025-12-31T23:00:00Z",
2099
+ "load_window_end": "2026-01-06T23:00:00Z",
2100
+ "dispatch_window_start": "2026-01-03T06:00:00Z",
2101
+ "dispatch_window_end": "2026-01-03T12:00:00Z",
2102
+ "hauler_counterparty_id": "None",
2103
+ "hauler_counterparty_name": "",
2104
+ "hauler_counterparty_source_id": None,
2105
+ "hauler_counterparty_source_system": "",
2106
+ "hauled_by_updated_by": None,
2107
+ "hauled_by_updated": None,
2108
+ "loads": [
2109
+ {
2110
+ "location_id": "69090ecad6ff2d863efaf084",
2111
+ "location_name": "SUNOCO -RIVER ROUGE",
2112
+ "location_source_id": "T-38-MI-3030",
2113
+ "location_source_system": "PDI",
2114
+ "location_type": "Terminal",
2115
+ "details": [
2116
+ {
2117
+ "detail_id": "69581c65ee5aaa626ed7dde4",
2118
+ "counterparty_id": "6908f1eab4fcf6a36e6660d9",
2119
+ "counterparty_name": "Sunoco",
2120
+ "counterparty_source_id": "5008",
2121
+ "counterparty_source_system": None,
2122
+ "price_type": "rack",
2123
+ "contract": "",
2124
+ "product_id": "6908f4469257414108faf071",
2125
+ "product_name": "87OCT 10%ETH - SUNOCO",
2126
+ "product_source_id": "FO-87-E10 | SUN",
2127
+ "product_source_system": "PDI",
2128
+ "drop_product_id": "6908f4469257414108faf071",
2129
+ "drop_product_name": "87OCT 10%ETH - SUNOCO",
2130
+ "drop_product_source_id": "FO-87-E10 | SUN",
2131
+ "drop_product_source_system": "PDI",
2132
+ "quantity": 4000,
2133
+ "compartment_index": 0,
2134
+ "blend_code": None,
2135
+ "product_codes": [],
2136
+ "load_number": None
2137
+ },
2138
+ {
2139
+ "detail_id": "69581c65ee5aaa626ed7dde4",
2140
+ "counterparty_id": "6908f1eab4fcf6a36e6660d9",
2141
+ "counterparty_name": "Sunoco",
2142
+ "counterparty_source_id": "5008",
2143
+ "counterparty_source_system": None,
2144
+ "price_type": "rack",
2145
+ "contract": "",
2146
+ "product_id": "6908f4469257414108faf071",
2147
+ "product_name": "87OCT 10%ETH - SUNOCO",
2148
+ "product_source_id": "FO-87-E10 | SUN",
2149
+ "product_source_system": "PDI",
2150
+ "drop_product_id": "6908f4469257414108faf071",
2151
+ "drop_product_name": "87OCT 10%ETH - SUNOCO",
2152
+ "drop_product_source_id": "FO-87-E10 | SUN",
2153
+ "drop_product_source_system": "PDI",
2154
+ "quantity": 6000,
2155
+ "compartment_index": 1,
2156
+ "blend_code": None,
2157
+ "product_codes": [],
2158
+ "load_number": None
2159
+ },
2160
+ {
2161
+ "detail_id": "69581c65ee5aaa626ed7dde5",
2162
+ "counterparty_id": "6908f1eab4fcf6a36e6660d9",
2163
+ "counterparty_name": "Sunoco",
2164
+ "counterparty_source_id": "5008",
2165
+ "counterparty_source_system": None,
2166
+ "price_type": "rack",
2167
+ "contract": "",
2168
+ "product_id": "6908f409b4fcf6a36e6660f3",
2169
+ "product_name": "93OCT 10%ETH - SUNOCO",
2170
+ "product_source_id": "FO-93-E10 | SUN",
2171
+ "product_source_system": "PDI",
2172
+ "drop_product_id": "6908f409b4fcf6a36e6660f3",
2173
+ "drop_product_name": "93OCT 10%ETH - SUNOCO",
2174
+ "drop_product_source_id": "FO-93-E10 | SUN",
2175
+ "drop_product_source_system": "PDI",
2176
+ "quantity": 1000,
2177
+ "compartment_index": 2,
2178
+ "blend_code": None,
2179
+ "product_codes": [],
2180
+ "load_number": None
2181
+ }
2182
+ ],
2183
+ "eta": None,
2184
+ "status": "unset"
2185
+ }
2186
+ ],
2187
+ "drops": [
2188
+ {
2189
+ "location_id": "69090f2e5a7ba1bea579a965",
2190
+ "location_name": "1082",
2191
+ "location_source_id": None,
2192
+ "location_source_system": "",
2193
+ "location_type": "Store",
2194
+ "details": [
2195
+ {
2196
+ "detail_id": "69581c65ee5aaa626ed7dde6",
2197
+ "counterparty_id": "",
2198
+ "counterparty_name": "",
2199
+ "counterparty_source_id": None,
2200
+ "counterparty_source_system": None,
2201
+ "product_id": "6908f4469257414108faf071",
2202
+ "product_name": "87OCT 10%ETH - SUNOCO",
2203
+ "product_source_id": "FO-87-E10 | SUN",
2204
+ "product_source_system": "PDI",
2205
+ "quantity": 4000,
2206
+ "tank_id": 1,
2207
+ "sources": [
2208
+ {
2209
+ "compartment_index": 0,
2210
+ "volume": 4000
2211
+ }
2212
+ ],
2213
+ "destination_codes": [],
2214
+ "blend_codes": []
2215
+ }
2216
+ ],
2217
+ "eta": None,
2218
+ "status": "unset"
2219
+ },
2220
+ {
2221
+ "location_id": "69090f2e5a7ba1bea579a969",
2222
+ "location_name": "1083",
2223
+ "location_source_id": None,
2224
+ "location_source_system": "",
2225
+ "location_type": "Store",
2226
+ "details": [
2227
+ {
2228
+ "detail_id": "69581c65ee5aaa626ed7dde7",
2229
+ "counterparty_id": "",
2230
+ "counterparty_name": "",
2231
+ "counterparty_source_id": None,
2232
+ "counterparty_source_system": None,
2233
+ "product_id": "6908f4469257414108faf071",
2234
+ "product_name": "87OCT 10%ETH - SUNOCO",
2235
+ "product_source_id": "FO-87-E10 | SUN",
2236
+ "product_source_system": "PDI",
2237
+ "quantity": 6000,
2238
+ "tank_id": 3,
2239
+ "sources": [
2240
+ {
2241
+ "compartment_index": 1,
2242
+ "volume": 6000
2243
+ }
2244
+ ],
2245
+ "destination_codes": [],
2246
+ "blend_codes": []
2247
+ },
2248
+ {
2249
+ "detail_id": "69581c65ee5aaa626ed7dde8",
2250
+ "counterparty_id": "",
2251
+ "counterparty_name": "",
2252
+ "counterparty_source_id": None,
2253
+ "counterparty_source_system": None,
2254
+ "product_id": "6908f409b4fcf6a36e6660f3",
2255
+ "product_name": "93OCT 10%ETH - SUNOCO",
2256
+ "product_source_id": "FO-93-E10 | SUN",
2257
+ "product_source_system": "PDI",
2258
+ "quantity": 1000,
2259
+ "tank_id": 1,
2260
+ "sources": [
2261
+ {
2262
+ "compartment_index": 2,
2263
+ "volume": 1000
2264
+ }
2265
+ ],
2266
+ "destination_codes": [],
2267
+ "blend_codes": []
2268
+ }
2269
+ ],
2270
+ "eta": None,
2271
+ "status": "unset"
2272
+ }
2273
+ ],
2274
+ "detours": [],
2275
+ "trip_status": "complete",
2276
+ "last_change_date": "2026-01-02T19:29:59.497000",
2277
+ "market": "Michigan",
2278
+ "supply_option": {
2279
+ "option": "recommended",
2280
+ "carrier_id": None,
2281
+ "carrier": None,
2282
+ "loaded_miles": 29.655561509392,
2283
+ "freight": 0.0324,
2284
+ "freight_cost": 0,
2285
+ "stops": 3,
2286
+ "prices": [
2287
+ {
2288
+ "product_name": "87OCT 10%ETH - SUNOCO",
2289
+ "volume": 10000,
2290
+ "components": [
2291
+ {
2292
+ "timezone_data": None,
2293
+ "curve_id": "6945cec2f88ce49ef5fc509c",
2294
+ "price_id": "6955ab1fb816b69ba5c18eca",
2295
+ "terminal_id": "69090ecad6ff2d863efaf084",
2296
+ "terminal": "SUNOCO -RIVER ROUGE",
2297
+ "supplier_id": "6908f1eab4fcf6a36e6660d9",
2298
+ "supplier": "Sunoco",
2299
+ "price_type": "rack",
2300
+ "product_id": "6908f4469257414108faf071",
2301
+ "product": "87OCT 10%ETH - SUNOCO",
2302
+ "supply_owner_id": "6908f1eab4fcf6a36e6660e1",
2303
+ "supply_owner": "Bazco",
2304
+ "price": 1.7556,
2305
+ "contract": "",
2306
+ "volume": 10000,
2307
+ "effective_from": "2025-12-31T23:00:00Z",
2308
+ "effective_to": "2026-01-06T23:00:00Z",
2309
+ "group_id": None,
2310
+ "group_effective_cutover": None,
2311
+ "group_effective_cutover_timezone": None,
2312
+ "group_identifier": None,
2313
+ "group_name": None,
2314
+ "min_constraint": None,
2315
+ "max_constraint": None,
2316
+ "load_number": None,
2317
+ "load_numbers": [],
2318
+ "directive_info": None
2319
+ }
2320
+ ],
2321
+ "product_total": 17556,
2322
+ "blend_code": None
2323
+ },
2324
+ {
2325
+ "product_name": "93OCT 10%ETH - SUNOCO",
2326
+ "volume": 1000,
2327
+ "components": [
2328
+ {
2329
+ "timezone_data": None,
2330
+ "curve_id": "6945cec2f88ce49ef5fc505a",
2331
+ "price_id": "6955ab1fb816b69ba5c18ea9",
2332
+ "terminal_id": "69090ecad6ff2d863efaf084",
2333
+ "terminal": "SUNOCO -RIVER ROUGE",
2334
+ "supplier_id": "6908f1eab4fcf6a36e6660d9",
2335
+ "supplier": "Sunoco",
2336
+ "price_type": "rack",
2337
+ "product_id": "6908f409b4fcf6a36e6660f3",
2338
+ "product": "93OCT 10%ETH - SUNOCO",
2339
+ "supply_owner_id": "6908f1eab4fcf6a36e6660e1",
2340
+ "supply_owner": "Bazco",
2341
+ "price": 2.8061,
2342
+ "contract": "",
2343
+ "volume": 1000,
2344
+ "effective_from": "2025-12-31T23:00:00Z",
2345
+ "effective_to": "2026-01-06T23:00:00Z",
2346
+ "group_id": None,
2347
+ "group_effective_cutover": None,
2348
+ "group_effective_cutover_timezone": None,
2349
+ "group_identifier": None,
2350
+ "group_name": None,
2351
+ "min_constraint": None,
2352
+ "max_constraint": None,
2353
+ "load_number": None,
2354
+ "load_numbers": [],
2355
+ "directive_info": None
2356
+ }
2357
+ ],
2358
+ "product_total": 2806.1,
2359
+ "blend_code": None
2360
+ }
2361
+ ],
2362
+ "product_total": 20362.1,
2363
+ "landed_cost": 20718.5,
2364
+ "supply_owner_map": {
2365
+ "definitions": [
2366
+ {
2367
+ "location_name": "1082",
2368
+ "product": "87OCT 10%ETH - SUNOCO",
2369
+ "supply_owner_id": "6908f1eab4fcf6a36e6660e1"
2370
+ },
2371
+ {
2372
+ "location_name": "1083",
2373
+ "product": "87OCT 10%ETH - SUNOCO",
2374
+ "supply_owner_id": "6908f1eab4fcf6a36e6660e1"
2375
+ },
2376
+ {
2377
+ "location_name": "1083",
2378
+ "product": "93OCT 10%ETH - SUNOCO",
2379
+ "supply_owner_id": "6908f1eab4fcf6a36e6660e1"
2380
+ }
2381
+ ]
2382
+ },
2383
+ "freight_customer_id": "6908f1eab4fcf6a36e6660e1",
2384
+ "delivered": False,
2385
+ "out_of_network": False,
2386
+ "estimated_freight": {
2387
+ "id": "69581c65ee5aaa626ed7ddec",
2388
+ "parent": None,
2389
+ "created_at": "2026-01-02T19:28:37.447000",
2390
+ "type": "freight",
2391
+ "status": "open",
2392
+ "reversed": False,
2393
+ "transactions": [
2394
+ {
2395
+ "model_type": "base",
2396
+ "type": "Base Freight",
2397
+ "subtype": "Band 26-30",
2398
+ "rate": 0.0324,
2399
+ "amount": 4000,
2400
+ "total": 129.6,
2401
+ "uom": "gallons",
2402
+ "errors": [],
2403
+ "id": "69581c65ee5aaa626ed7dde9",
2404
+ "product_group": "Gasoline",
2405
+ "product_id": "6908f4469257414108faf071",
2406
+ "product_name": "87OCT 10%ETH - SUNOCO",
2407
+ "origin": "SUNOCO -RIVER ROUGE",
2408
+ "origin_id": "69090ecad6ff2d863efaf084",
2409
+ "origin_override": None,
2410
+ "origin_id_override": None,
2411
+ "destination": "1082",
2412
+ "destination_id": "69090f2e5a7ba1bea579a967",
2413
+ "destination_override": None,
2414
+ "destination_id_override": None,
2415
+ "legs": [
2416
+ {
2417
+ "origin": "SUNOCO -RIVER ROUGE",
2418
+ "origin_id": "69090ecad6ff2d863efaf084",
2419
+ "destination": "1082",
2420
+ "destination_id": "69090f2e5a7ba1bea579a965",
2421
+ "distance": 13.6
2422
+ },
2423
+ {
2424
+ "origin": "1082",
2425
+ "origin_id": "69090f2e5a7ba1bea579a965",
2426
+ "destination": "1083",
2427
+ "destination_id": "69090f2e5a7ba1bea579a969",
2428
+ "distance": 16.05
2429
+ }
2430
+ ],
2431
+ "use_surcharge": True,
2432
+ "manual": False,
2433
+ "has_dependency": False,
2434
+ "created_date": None,
2435
+ "requires_approval": False,
2436
+ "requires_approval_reason_code": False,
2437
+ "is_approved": False,
2438
+ "approved_by": None,
2439
+ "approved_date": None,
2440
+ "approved_reason_code": None,
2441
+ "amount_override": None,
2442
+ "rate_override": None,
2443
+ "product_id_override": None,
2444
+ "product_name_override": None,
2445
+ "product_group_override": None,
2446
+ "subtype_override": None,
2447
+ "uom_override": None,
2448
+ "total_override": None,
2449
+ "override_by": None,
2450
+ "override_date": None,
2451
+ "exclude_from_invoice": False,
2452
+ "credit_rebill_metadata": None,
2453
+ "extra_data": {
2454
+ "mileage": 30
2455
+ },
2456
+ "gross_volume": None,
2457
+ "net_volume": None,
2458
+ "bol_date": None,
2459
+ "bol_number": None,
2460
+ "bol_number_override": None,
2461
+ "delivery_date": None
2462
+ },
2463
+ {
2464
+ "model_type": "base",
2465
+ "type": "Base Freight",
2466
+ "subtype": "Band 26-30",
2467
+ "rate": 0.0324,
2468
+ "amount": 6000,
2469
+ "total": 194.4,
2470
+ "uom": "gallons",
2471
+ "errors": [],
2472
+ "id": "69581c65ee5aaa626ed7ddea",
2473
+ "product_group": "Gasoline",
2474
+ "product_id": "6908f4469257414108faf071",
2475
+ "product_name": "87OCT 10%ETH - SUNOCO",
2476
+ "origin": "SUNOCO -RIVER ROUGE",
2477
+ "origin_id": "69090ecad6ff2d863efaf084",
2478
+ "origin_override": None,
2479
+ "origin_id_override": None,
2480
+ "destination": "1083",
2481
+ "destination_id": "69090f2e5a7ba1bea579a96b",
2482
+ "destination_override": None,
2483
+ "destination_id_override": None,
2484
+ "legs": [
2485
+ {
2486
+ "origin": "SUNOCO -RIVER ROUGE",
2487
+ "origin_id": "69090ecad6ff2d863efaf084",
2488
+ "destination": "1082",
2489
+ "destination_id": "69090f2e5a7ba1bea579a965",
2490
+ "distance": 13.6
2491
+ },
2492
+ {
2493
+ "origin": "1082",
2494
+ "origin_id": "69090f2e5a7ba1bea579a965",
2495
+ "destination": "1083",
2496
+ "destination_id": "69090f2e5a7ba1bea579a969",
2497
+ "distance": 16.05
2498
+ }
2499
+ ],
2500
+ "use_surcharge": True,
2501
+ "manual": False,
2502
+ "has_dependency": False,
2503
+ "created_date": None,
2504
+ "requires_approval": False,
2505
+ "requires_approval_reason_code": False,
2506
+ "is_approved": False,
2507
+ "approved_by": None,
2508
+ "approved_date": None,
2509
+ "approved_reason_code": None,
2510
+ "amount_override": None,
2511
+ "rate_override": None,
2512
+ "product_id_override": None,
2513
+ "product_name_override": None,
2514
+ "product_group_override": None,
2515
+ "subtype_override": None,
2516
+ "uom_override": None,
2517
+ "total_override": None,
2518
+ "override_by": None,
2519
+ "override_date": None,
2520
+ "exclude_from_invoice": False,
2521
+ "credit_rebill_metadata": None,
2522
+ "extra_data": {
2523
+ "mileage": 30
2524
+ },
2525
+ "gross_volume": None,
2526
+ "net_volume": None,
2527
+ "bol_date": None,
2528
+ "bol_number": None,
2529
+ "bol_number_override": None,
2530
+ "delivery_date": None
2531
+ },
2532
+ {
2533
+ "model_type": "base",
2534
+ "type": "Base Freight",
2535
+ "subtype": "Band 26-30",
2536
+ "rate": 0.0324,
2537
+ "amount": 1000,
2538
+ "total": 32.4,
2539
+ "uom": "gallons",
2540
+ "errors": [],
2541
+ "id": "69581c65ee5aaa626ed7ddeb",
2542
+ "product_group": "Gasoline",
2543
+ "product_id": "6908f409b4fcf6a36e6660f3",
2544
+ "product_name": "93OCT 10%ETH - SUNOCO",
2545
+ "origin": "SUNOCO -RIVER ROUGE",
2546
+ "origin_id": "69090ecad6ff2d863efaf084",
2547
+ "origin_override": None,
2548
+ "origin_id_override": None,
2549
+ "destination": "1083",
2550
+ "destination_id": "69090f2e5a7ba1bea579a96b",
2551
+ "destination_override": None,
2552
+ "destination_id_override": None,
2553
+ "legs": [
2554
+ {
2555
+ "origin": "SUNOCO -RIVER ROUGE",
2556
+ "origin_id": "69090ecad6ff2d863efaf084",
2557
+ "destination": "1082",
2558
+ "destination_id": "69090f2e5a7ba1bea579a965",
2559
+ "distance": 13.6
2560
+ },
2561
+ {
2562
+ "origin": "1082",
2563
+ "origin_id": "69090f2e5a7ba1bea579a965",
2564
+ "destination": "1083",
2565
+ "destination_id": "69090f2e5a7ba1bea579a969",
2566
+ "distance": 16.05
2567
+ }
2568
+ ],
2569
+ "use_surcharge": True,
2570
+ "manual": False,
2571
+ "has_dependency": False,
2572
+ "created_date": None,
2573
+ "requires_approval": False,
2574
+ "requires_approval_reason_code": False,
2575
+ "is_approved": False,
2576
+ "approved_by": None,
2577
+ "approved_date": None,
2578
+ "approved_reason_code": None,
2579
+ "amount_override": None,
2580
+ "rate_override": None,
2581
+ "product_id_override": None,
2582
+ "product_name_override": None,
2583
+ "product_group_override": None,
2584
+ "subtype_override": None,
2585
+ "uom_override": None,
2586
+ "total_override": None,
2587
+ "override_by": None,
2588
+ "override_date": None,
2589
+ "exclude_from_invoice": False,
2590
+ "credit_rebill_metadata": None,
2591
+ "extra_data": {
2592
+ "mileage": 30
2593
+ },
2594
+ "gross_volume": None,
2595
+ "net_volume": None,
2596
+ "bol_date": None,
2597
+ "bol_number": None,
2598
+ "bol_number_override": None,
2599
+ "delivery_date": None
2600
+ }
2601
+ ],
2602
+ "counterparty_id": "6908f1eab4fcf6a36e6660e1",
2603
+ "book_type": "Cost",
2604
+ "effective_date_used": "2026-01-03T00:00:00",
2605
+ "invoice_group_id": None,
2606
+ "invoice_number": None,
2607
+ "accessorial_invoice_number": None,
2608
+ "new_version_available": False,
2609
+ "new_version_total": None,
2610
+ "error": None
2611
+ },
2612
+ "legs": [
2613
+ {
2614
+ "origin": "SUNOCO -RIVER ROUGE",
2615
+ "origin_id": "69090ecad6ff2d863efaf084",
2616
+ "destination": "1082",
2617
+ "destination_id": "69090f2e5a7ba1bea579a965",
2618
+ "distance": 13.6
2619
+ },
2620
+ {
2621
+ "origin": "1082",
2622
+ "origin_id": "69090f2e5a7ba1bea579a965",
2623
+ "destination": "1083",
2624
+ "destination_id": "69090f2e5a7ba1bea579a969",
2625
+ "distance": 16.05
2626
+ }
2627
+ ],
2628
+ "freight_distance": 29.65,
2629
+ "supply_owner_id": "6908f1eab4fcf6a36e6660e1"
2630
+ },
2631
+ "created_by": "felipe.bucheli",
2632
+ "note": None,
2633
+ "estimated_load_minutes": 43,
2634
+ "total_miles": 29.655561509392,
2635
+ "loaded_miles": 29.655561509392,
2636
+ "unloaded_miles": 0,
2637
+ "reference_order_number": None,
2638
+ "extra_data": {},
2639
+ "tractor": None,
2640
+ "trailer": None,
2641
+ "po_number": None
2642
+ }
2643
+ ]
2644
+
2645
+
2646
+ def create_mock_sd_client() -> GravitateSDAPI:
2647
+ mock = MagicMock(spec=GravitateSDAPI)
2648
+ mock.get_bols_and_drops = AsyncMock(return_value=_mock_response(mock_bols_and_drops_response))
2649
+ mock.get_orders = AsyncMock(return_value=_mock_response(mock_get_orders_response))
2650
+ return mock
2651
+
2652
+
2653
+ def _mock_response(json_data) -> MagicMock:
2654
+ """Create a mock httpx Response."""
2655
+ response = MagicMock(spec=Response)
2656
+ response.status_code = 200
2657
+ response.json.return_value = json_data
2658
+ response.raise_for_status = MagicMock()
2659
+ return response
2660
+
2661
+
2662
+ @dataclass
2663
+ class OrderData:
2664
+ """Container for fetched order data with error tracking."""
2665
+
2666
+ order_number: str
2667
+ bols_and_drops: dict | None = None
2668
+ planned_order: dict | None = None
2669
+ error: str | None = None
2670
+
2671
+
2672
+ class AllocationMatcher:
2673
+ """A matcher used for matching executed details to planned details.
2674
+ Sole purpose is to allow us from matching an allocated bol
2675
+ to its planned details.
2676
+
2677
+ Carriers generally need this information to pay their drivers and
2678
+ bill their customers.
2679
+ """
2680
+
2681
+ _semaphore: asyncio.Semaphore | None = None
2682
+
2683
+ def __init__(
2684
+ self,
2685
+ order_numbers: list[int],
2686
+ max_concurrent: int = 10,
2687
+ ):
2688
+ self.order_numbers = order_numbers
2689
+ self.max_concurrent = max_concurrent
2690
+
2691
+ @property
2692
+ def semaphore(self) -> asyncio.Semaphore:
2693
+ """Lazy-initialized semaphore for rate limiting API calls."""
2694
+ if self._semaphore is None:
2695
+ self._semaphore = asyncio.Semaphore(self.max_concurrent)
2696
+ return self._semaphore
2697
+
2698
+ async def get_planned_details(
2699
+ self,
2700
+ client: GravitateSDAPI,
2701
+ order_number: str,
2702
+ ) -> tuple[str, dict | None, str | None]:
2703
+ """Get planned order details for a single order number."""
2704
+ async with self.semaphore:
2705
+ try:
2706
+ resp = await client.get_orders(order_number=order_number)
2707
+ data = resp.json()
2708
+ return order_number, data[0] if data else None, None
2709
+ except Exception as e:
2710
+ logger.warning(f"Failed to get planned order {order_number}: {e}")
2711
+ return order_number, None, str(e)
2712
+
2713
+ @hatch_eggs
2714
+ async def get_order_data(
2715
+ self,
2716
+ client: GravitateSDAPI = Egg(create_mock_sd_client),
2717
+ ) -> list[OrderData]:
2718
+ """
2719
+ Get all planned + executed order data for a list of order numbers.
2720
+ """
2721
+ results = []
2722
+
2723
+ bols_and_drops_req = GetOrderBolsAndDropsRequest(order_numbers=self.order_numbers)
2724
+ bols_response = await client.get_bols_and_drops(bols_and_drops_req)
2725
+ all_bols = bols_response.json()
2726
+ bols_by_order = lookup(all_bols, lambda x: x['order_number'])
2727
+ order_strs = [str(n) for n in self.order_numbers]
2728
+ planned_results = await asyncio.gather(
2729
+ *[self.get_planned_details(client, n) for n in order_strs]
2730
+ )
2731
+
2732
+ for order_num, planned, error in planned_results:
2733
+ results.append(OrderData(
2734
+ order_number=order_num,
2735
+ bols_and_drops=bols_by_order.get(order_num),
2736
+ planned_order=planned,
2737
+ error=error,
2738
+ ))
2739
+ return results
2740
+
2741
+ @hatch_eggs
2742
+ async def run_allocation_matching(
2743
+ self,
2744
+ sd_client: GravitateSDAPI = Egg(create_mock_sd_client),
2745
+ ) -> list[MatchedAllocation]:
2746
+ """
2747
+ Get order data and match allocations for all order numbers.
2748
+
2749
+ Uses mock_sd_client by default (via Egg DI), can be overridden
2750
+ with a real client in production.
2751
+ """
2752
+ order_data_list = await self.get_order_data(sd_client)
2753
+ all_results: list[MatchedAllocation] = []
2754
+ for data in order_data_list:
2755
+ if data.error or not data.bols_and_drops or not data.planned_order:
2756
+ continue
2757
+
2758
+ results = match_allocations(
2759
+ allocated_bols=data.bols_and_drops["allocated_bols"],
2760
+ executed_bols=data.bols_and_drops["bols"],
2761
+ executed_drops=data.bols_and_drops["drops"],
2762
+ planned_loads=data.planned_order["loads"],
2763
+ planned_drops=data.planned_order["drops"],
2764
+ )
2765
+ all_results.extend(results)
2766
+
2767
+ return all_results
2768
+
2769
+ @classmethod
2770
+ @hatch_eggs
2771
+ async def match_order_numbers(
2772
+ cls,
2773
+ order_numbers: list[int],
2774
+ sd_client: GravitateSDAPI = Egg(create_mock_sd_client),
2775
+ max_concurrent: int = 10,
2776
+ ):
2777
+ return await cls(order_numbers, max_concurrent).run_allocation_matching(sd_client)
2778
+
2779
+
2780
+ if __name__ == "__main__":
2781
+ async def main():
2782
+ results = await AllocationMatcher.match_order_numbers([1103, 1196])
2783
+ print(f"Matched {len(results)} allocations:\n")
2784
+ for r in results:
2785
+ print(f"Store {r.allocated_bol.store_number}, Tank {r.allocated_bol.store_tank}")
2786
+ print(f" Product: {r.allocated_bol.store_product}")
2787
+ print(f" Planned: {r.planned_quantity} gal")
2788
+ print(f" Actual: {r.actual_quantity} gal")
2789
+ print(f" Variance: {r.variance:+d} gal ({r.variance_pct:.2f}%)")
2790
+ print()
2791
+
2792
+
2793
+ asyncio.run(main())