Class: Edi::Commercehub::ShipCodeMapper
- Inherits:
-
Object
- Object
- Edi::Commercehub::ShipCodeMapper
- Defined in:
- app/services/edi/commercehub/ship_code_mapper.rb
Instance Attribute Summary collapse
-
#orchestrator ⇒ Object
readonly
Returns the value of attribute orchestrator.
-
#shipping_map ⇒ Object
readonly
Returns the value of attribute shipping_map.
Instance Method Summary collapse
-
#ch_to_hw(shipping_code) ⇒ Object
Pass a commercehub shipping code, e.g UPSN_SE, and retrieves a shipping option result object describing the service requested.
-
#hw_to_ch(shipping_method_name, signature: false, saturday: false) ⇒ Object
Translates a heatwave shipping option parameters into a commercehub shipping code.
-
#initialize(orchestrator) ⇒ ShipCodeMapper
constructor
A new instance of ShipCodeMapper.
Constructor Details
#initialize(orchestrator) ⇒ ShipCodeMapper
Returns a new instance of ShipCodeMapper.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 |
# File 'app/services/edi/commercehub/ship_code_mapper.rb', line 11 def initialize(orchestrator) @orchestrator = orchestrator # Right now this is not used but might be in the future case @orchestrator.partner when :commercehub_lowes_com # This is Lowe's US so use US defaults, default to UPS, when unspecified # "CODE TYPE","DESCRIPTION","CODE","SEND","RECEIVE" # "A. Duie Pyle Inc.","PYLR","TRUE","TRUE" # "A. Duie Pyle Inc.","PYLE","TRUE","FALSE" # "AAA Cooper Transportation","AACT","TRUE","FALSE" # "ABF - Basic Service","ABFS_G2","TRUE","TRUE" # "Accurate Transportation Inc","AUEP","TRUE","FALSE" # "AIT Worldwide Logistics","AITW","TRUE","FALSE" # "Associated Air Freight","ASAF","TRUE","FALSE" # "Averitt Express - Basic Service","AVRT_G2","TRUE","TRUE" # "Braun\'s Express (service level unspecified)","BRXS","TRUE","FALSE" # "C.H. Robinson Worldwide Inc.","RBTW","TRUE","FALSE" # "Canada Post - Regular Parcel","CG_CG","TRUE","TRUE" # "Central Freight Lines","CENF","TRUE","TRUE" # "Central Freight Lines","CENT","TRUE","FALSE" # "Central Transport Inc.","CETR","TRUE","FALSE" # "Central Transport Inc.","CTII","TRUE","FALSE" # "CEVA Logistics - Basic Service","CEVA_G2","TRUE","TRUE" # "Crete Carrier Corporation","CRCR","TRUE","FALSE" # "Custom Global Logistics (service unspecified)","CGLY","TRUE","FALSE" # "Custom Transport, Inc.","CTBV","TRUE","FALSE" # "Custom Transport, Inc.","CUGM","TRUE","FALSE" # "Day & Ross","DAYR","TRUE","FALSE" # "Daylight Transport","DYLT","TRUE","FALSE" # "Dayton Freight","DAFG","TRUE","TRUE" # "Dependable Highway Express","DPHE","TRUE","FALSE" # "Dohrn Transfer Co.","DHRN","TRUE","FALSE" # "Estenson Logistics LLC","ESNL","TRUE","FALSE" # "Estes Express Lines","EXLA","TRUE","TRUE" # "Estes Express Lines","EXLA_CG","TRUE","FALSE" # "Estes Forwarding Worldwide - Basic Service","EFWW_G2","TRUE","FALSE" # "FedEx (service level unspecified)","FEDX","TRUE","FALSE" # "FedEx (service level unspecified)","FEPL","TRUE","FALSE" # "FedEx 2Day","FEDX_SE","TRUE","TRUE" # "FedEx 2Day","FDEG_SE","TRUE","FALSE" # "FedEx 2Day","FDE_SC","TRUE","FALSE" # "FedEx 2Day","FX2D","TRUE","FALSE" # "FedEx Express Saver","FEDX_3D","TRUE","TRUE" # "FedEx Freight Economy","FEDF","TRUE","TRUE" # "FedEx Freight Economy","FXFE","TRUE","FALSE" # "FedEx Freight Economy","FDEN","TRUE","FALSE" # "FedEx Freight Priority","FEDP","TRUE","TRUE" # "FedEx Ground","FEDX_CG","TRUE","TRUE" # "FedEx Ground","FDEG_CG","TRUE","FALSE" # "FedEx Ground","FDEG","TRUE","FALSE" # "FedEx Ground","FEDEXG","TRUE","FALSE" # "FedEx Ground","FDXG","TRUE","FALSE" # "FedEx Ground, Signature Required","FEDX_CG_ET","TRUE","FALSE" # "FedEx Home Delivery","FEDX_09","TRUE","TRUE" # "FedEx Home Delivery","FEDH","TRUE","FALSE" # "FedEx Next Day (Standard)","FEDX_ND","TRUE","TRUE" # "FedEx Next Day (Standard)","FDEG_ND","TRUE","FALSE" # "FedEx Next Day (Standard)","FXND","TRUE","FALSE" # "FedEx Next Day (Standard)","FDEX","TRUE","FALSE" # "FedEx Priority Overnight","FEDX_NM","TRUE","TRUE" # "FedEx SmartPost","FXSP","TRUE","TRUE" # "Forward Air Inc.","FWDN","TRUE","FALSE" # "Frontline Freight - Threshold Service","FCSY_DS","TRUE","FALSE" # "G & P Trucking Company Inc","GPTC","TRUE","TRUE" # "Heartland Express Services Inc","HAEI","TRUE","TRUE" # "Hercules Freight (service unspecified)","HRCF","TRUE","FALSE" # "HNRY Logistics Inc","HNRF","TRUE","FALSE" # "Hollywood Delivery Service","HWDQ","TRUE","FALSE" # "Hub Group (intermodal division)","HUBG","TRUE","FALSE" # "JB Hunt_1","HJBT","TRUE","FALSE" # "Knight Transportation Inc","KNIG","TRUE","TRUE" # "Landstar Ranger Inc","LRGR","TRUE","TRUE" # "Mesilla Valley Transportation","MSLV","TRUE","TRUE" # "Metropolitan Warehouse & Delivery - Basic Service","MWDP_G2","TRUE","TRUE" # "MJB Freight Systems - Basic Service","MJBF_G2","TRUE","FALSE" # "N & M Transfer","NMTF","TRUE","FALSE" # "New Penn Motor Express","NPME","TRUE","TRUE" # "NonstopDelivery","NDLV","TRUE","FALSE" # "NonstopDelivery - Room Choice, Install","NDLV_09","TRUE","TRUE" # "NonstopDelivery - Threshold Service","NDLV_DS","TRUE","TRUE" # "Normandin Transit Inc","NRMA","TRUE","FALSE" # "Oak Harbor Freight Lines, Inc.","OAKH","TRUE","FALSE" # "Old Dominion","ODFL","TRUE","TRUE" # "Other","OTHR","TRUE","FALSE" # "Paschall Truck Lines","PASC","TRUE","FALSE" # "Pilot Freight Services","PAAF","TRUE","FALSE" # "PITT Ohio","PITD","TRUE","FALSE" # "PTG Logistics LLC","PTGO","TRUE","FALSE" # "R & L Carriers","RNLO","TRUE","TRUE" # "RIST Transport","RISF","TRUE","FALSE" # "Roadrunner Transportation","RDFS","TRUE","TRUE" # "Saia Motor Freight","SAIA","TRUE","TRUE" # "Schneider National Carriers Inc-Optimodal","SCDS","TRUE","FALSE" # "Schneider National Carriers Inc. (Truck/Rail)","SNCK","TRUE","FALSE" # "Seko - Basic Service","SEKW_G2","TRUE","TRUE" # "Seko - Room Choice, Install","SEKW_09","TRUE","TRUE" # "Seko - Threshold Service","SEKW_DS","TRUE","TRUE" # "Southeastern Freight Lines","SEFL","TRUE","TRUE" # "Southwestern Motor Transport","SWMT","TRUE","FALSE" # "Standard Forwarding LLC","STDF","TRUE","FALSE" # "Summit Trucking LLC","SMMT","TRUE","FALSE" # "Sutton Transport - Basic Service","SUON_G2","TRUE","FALSE" # "Swift Transport (service unspecified)","SWFT","TRUE","TRUE" # "Swift Transport (service unspecified)","SWFC","TRUE","FALSE" # "TDS Unlimited","TDUM","TRUE","FALSE" # "Total Transportation of Mississippi","TTMS","TRUE","FALSE" # "Unspecified","UNSP","FALSE","TRUE" # "UPS (service level unspecified)","UPSN","TRUE","FALSE" # "UPS (service level unspecified)","UPS","TRUE","FALSE" # "UPS 2nd Day Air","UPSN_SE","TRUE","TRUE" # "UPS 2nd Day Air","UB","TRUE","FALSE" # "UPS 2nd Day Air","UPSN_SC","TRUE","FALSE" # "UPS 3 Day Select","UPSN_3D","TRUE","TRUE" # "UPS 3 Day Select","UPS3","TRUE","FALSE" # "UPS Freight (service level unspecified)","UPGS","TRUE","TRUE" # "UPS Ground","UPSN_CG","TRUE","TRUE" # "UPS Ground","UG","TRUE","FALSE" # "UPS Ground","UPSG","TRUE","FALSE" # "UPS Ground, Signature Required","UPSET_CG","TRUE","FALSE" # "UPS Ground, Signature Required","UX","TRUE","FALSE" # "UPS Mail Innovations - Standard","UPSN_FC","TRUE","FALSE" # "UPS Mail Innovations - Standard","UPSM","TRUE","FALSE" # "UPS Next Day Air","UPSN_ND","TRUE","TRUE" # "UPS Next Day Air","UPND","TRUE","FALSE" # "UPS Next Day Air","UR","TRUE","FALSE" # "UPS Next Day Air","UPS1","TRUE","FALSE" # "UPS Next Day Air","UPSN_NM","TRUE","FALSE" # "UPS Next Day Air Saver","UPSN_PM","TRUE","TRUE" # "UPS SurePost 1 lb or greater","UPSN_ST","TRUE","TRUE" # "USA Truck Inc","USIT","TRUE","FALSE" # "USF Holland","HMES","TRUE","FALSE" # "USF Reddaway","RETL","TRUE","FALSE" # "USPS (service level unspecified)","USPSB_FC","FALSE","TRUE" # "USPS (service level unspecified)","USPS","TRUE","FALSE" # "USPS (service level unspecified)","USPS_CG","TRUE","FALSE" # "USPS Express Mail","USPS_ND","TRUE","TRUE" # "USPS First Class Mail","USPSB_FC","TRUE","TRUE" # "USPS Parcel Select - Non Presort","USPS_BC","TRUE","TRUE" # "USPS Priority Mail","USPS_PB","TRUE","TRUE" # "Vision Express","VSXP","TRUE","FALSE" # "WARD Trucking","WARD","TRUE","FALSE" # "Werner Multimodel","WMMI","TRUE","FALSE" # "Worldwide Express","WEXF","TRUE","FALSE" # "XPO Logistics LLC","XPOL","TRUE","TRUE" # "Xpress Global Systems - Basic Service","XGSI_G2","TRUE","FALSE" # "Yellow (YRC) - Basic Service","YFSY_G2","TRUE","TRUE" @shipping_map = [ # "FedEx (service level unspecified)","FEDX","TRUE","FALSE" ShippingOptionResult.new(code: 'FEDX', name: 'fedex_ground'), # Unspecified Fedex # "FedEx (service level unspecified)","FEPL","TRUE","FALSE" ShippingOptionResult.new(code: 'FEPL', name: 'fedex_ground'), # Unspecified Fedex # "FedEx 2Day","FEDX_SE","TRUE","TRUE" ShippingOptionResult.new(code: 'FEDX_SE', name: 'fedex_twoday'), # "FedEx 2Day","FDEG_SE","TRUE","FALSE" ShippingOptionResult.new(code: 'FDEG_SE', name: 'fedex_twoday'), # "FedEx 2Day","FDE_SC","TRUE","FALSE" ShippingOptionResult.new(code: 'FDE_SC', name: 'fedex_twoday'), # "FedEx 2Day","FX2D","TRUE","FALSE" ShippingOptionResult.new(code: 'FX2D', name: 'fedex_twoday'), # "FedEx Express Saver","FEDX_3D","TRUE","TRUE" ShippingOptionResult.new(code: 'FEDX_3D', name: 'fedex_express_saver'), # "FedEx Ground","FEDX_CG","TRUE","TRUE" ShippingOptionResult.new(code: 'FEDX_CG', name: 'fedex_ground'), # "FedEx Ground","FDEG_CG","TRUE","FALSE" ShippingOptionResult.new(code: 'FDEG_CG', name: 'fedex_ground'), # "FedEx Ground","FDEG","TRUE","FALSE" ShippingOptionResult.new(code: 'FDEG', name: 'fedex_ground'), # "FedEx Ground","FEDEXG","TRUE","FALSE" ShippingOptionResult.new(code: 'FEDEXG', name: 'fedex_ground'), # "FedEx Ground","FDXG","TRUE","FALSE" ShippingOptionResult.new(code: 'FDXG', name: 'fedex_ground'), # "FedEx Ground, Signature Required","FEDX_CG_ET","TRUE","FALSE" ShippingOptionResult.new(code: 'FDXG', name: 'fedex_ground', signature: true), # "FedEx Home Delivery","FEDX_09","TRUE","TRUE" ShippingOptionResult.new(code: 'FEDX_09', name: 'fedex_ground_residential'), # "FedEx Home Delivery","FEDH","TRUE","FALSE" ShippingOptionResult.new(code: 'FEDH', name: 'fedex_ground_residential'), # "FedEx Next Day (Standard)","FEDX_ND","TRUE","TRUE" ShippingOptionResult.new(code: 'FEDX_ND', name: 'fedex_standard_overnight'), # "FedEx Next Day (Standard)","FDEG_ND","TRUE","FALSE" ShippingOptionResult.new(code: 'FDEG_ND', name: 'fedex_standard_overnight'), # "FedEx Next Day (Standard)","FXND","TRUE","FALSE" ShippingOptionResult.new(code: 'FXND', name: 'fedex_standard_overnight'), # "FedEx Next Day (Standard)","FDEX","TRUE","FALSE" ShippingOptionResult.new(code: 'FDEX', name: 'fedex_standard_overnight'), # "FedEx Priority Overnight","FEDX_NM","TRUE","TRUE" ShippingOptionResult.new(code: 'FEDX_NM', name: 'fedex_priority_overnight'), # "UPS (service level unspecified)","UPSN","TRUE","FALSE" ShippingOptionResult.new(code: 'UPSN', name: 'ground'), # "UPS (service level unspecified)","UPS","TRUE","FALSE" ShippingOptionResult.new(code: 'UPS', name: 'ground'), # "UPS 2nd Day Air","UPSN_SE","TRUE","TRUE" ShippingOptionResult.new(code: 'UPSN_SE', name: 'seconddayair'), # "UPS 2nd Day Air","UB","TRUE","FALSE" ShippingOptionResult.new(code: 'UB', name: 'seconddayair'), # "UPS 2nd Day Air","UPSN_SC","TRUE","FALSE" ShippingOptionResult.new(code: 'UPSN_SC', name: 'seconddayair'), # "UPS 3 Day Select","UPSN_3D","TRUE","TRUE" ShippingOptionResult.new(code: 'UPSN_3D', name: 'threedayselect'), # "UPS 3 Day Select","UPS3","TRUE","FALSE" ShippingOptionResult.new(code: 'UPS3', name: 'threedayselect'), # "UPS Freight (service level unspecified)","UPGS","TRUE","TRUE" ShippingOptionResult.new(code: 'UPGS', name: 'ups_freight_ltl'), # "UPS Ground","UPSN_CG","TRUE","TRUE" ShippingOptionResult.new(code: 'UPSN_CG', name: 'ground'), # "UPS Ground","UG","TRUE","FALSE" ShippingOptionResult.new(code: 'UG', name: 'ground'), # "UPS Ground","UPSG","TRUE","FALSE" ShippingOptionResult.new(code: 'UPSG', name: 'ground'), # "UPS Ground, Signature Required","UPSET_CG","TRUE","FALSE" ShippingOptionResult.new(code: 'UPSET_CG', name: 'ground', signature: true), # "UPS Ground, Signature Required","UX","TRUE","FALSE" ShippingOptionResult.new(code: 'UX', name: 'ground', signature: true), # "UPS Next Day Air","UPSN_ND","TRUE","TRUE" ShippingOptionResult.new(code: 'UPSN_ND', name: 'nextdayair'), # "UPS Next Day Air","UPND","TRUE","FALSE" ShippingOptionResult.new(code: 'UPND', name: 'nextdayair'), # "UPS Next Day Air","UR","TRUE","FALSE" ShippingOptionResult.new(code: 'UR', name: 'nextdayair'), # "UPS Next Day Air","UPS1","TRUE","FALSE" ShippingOptionResult.new(code: 'UPS1', name: 'nextdayair'), # "UPS Next Day Air","UPSN_NM","TRUE","FALSE" ShippingOptionResult.new(code: 'UPSN_NM', name: 'nextdayair'), # "UPS Next Day Air Saver","UPSN_PM","TRUE","TRUE" ShippingOptionResult.new(code: 'UPSN_PM', name: 'nextdayairsaver'), # Unspecified UNSP ShippingOptionResult.new(code: 'UNSP', name: 'ground'), # default to UPS ground for Lowe's # "USPS (service level unspecified)","USPSB_FC","FALSE","TRUE" ShippingOptionResult.new(code: 'USPSB_FC', name: 'usps_parcel_select'), # "USPS (service level unspecified)","USPS","TRUE","FALSE" ShippingOptionResult.new(code: 'USPS', name: 'usps_parcel_select'), # "USPS (service level unspecified)","USPS_CG","TRUE","FALSE" ShippingOptionResult.new(code: 'USPS_CG', name: 'usps_parcel_select'), # "USPS Express Mail","USPS_ND","TRUE","TRUE" ShippingOptionResult.new(code: 'USPS_PB', name: 'usps_priority_express'), # "USPS First Class Mail","USPSB_FC","TRUE","TRUE" ShippingOptionResult.new(code: 'USPSB_FC', name: 'usps_parcel_select'), # "USPS Parcel Select - Non Presort","USPS_BC","TRUE","TRUE" ShippingOptionResult.new(code: 'USPS_BC', name: 'usps_parcel_select'), # "USPS Priority Mail","USPS_PB","TRUE","TRUE" ShippingOptionResult.new(code: 'USPS_PB', name: 'usps_priority_mail') ] when :commercehub_lowes_ca # This is Lowe's Canada so use Canadian defaults and do not default to UPS, default to Purolator when unspecified # Description Code Send Receive # Day & Ross DAYR # Fastfrate FASC # Frontier Supply Chain Solutions FSCF # NLI International Corp. - Threshold Service NLIH_DS # NLI International Corp. - Threshold Service NLNC_DS # Robert Transport TRRB # Saia Motor Freight SAIA @shipping_map = [ # UPS Ground UPSN_CG ShippingOptionResult.new(code: 'UPSN_CG', name: 'standard'), # UPS Standard # UPS Ground, Signature Required UPSET_CG ShippingOptionResult.new(code: 'UPSET_CG', name: 'standard', signature: true), # UPS Ground, Signature Required # UPS Ground UG ShippingOptionResult.new(code: 'UG', name: 'standard'), # UPS Standard # UPS Ground UPSG ShippingOptionResult.new(code: 'UPSG', name: 'standard'), # UPS Standard # UPS Ground, Signature Required UX ShippingOptionResult.new(code: 'UX', name: 'standard', signature: true), # UPS Ground, Signature Required # UPS Trade Direct Cross Border - Basic Service UPSF_G2 ShippingOptionResult.new(code: 'UPSF_G2', name: 'standard'), # UPS Standard # FedEx Ground FEDX_CG ShippingOptionResult.new(code: 'FEDX_CG', name: 'fedex_ground'), # FedEx Ground FDXG ShippingOptionResult.new(code: 'FDXG', name: 'fedex_ground'), # FedEx Ground FEDEXG ShippingOptionResult.new(code: 'FEDEXG', name: 'fedex_ground'), # FedEx Ground FDEG ShippingOptionResult.new(code: 'FDEG', name: 'fedex_ground'), # FedEx Ground FDEG_CG ShippingOptionResult.new(code: 'FDEG_CG', name: 'fedex_ground'), # Canada Post - Regular Parcel CG_CG ShippingOptionResult.new(code: 'CG_CG', name: 'canada_post_regular_parcel'), # Canada Post - Regular Parcel Signature Required CG_CG_ET ShippingOptionResult.new(code: 'CG_CG_ET', name: 'canada_post_regular_parcel', signature: true), # Purolator Courier, ground PRLA_CG ShippingOptionResult.new(code: 'PRLA_CG', name: 'purolator_ground'), # Purolator Courier, ground, Signature Req. PRLA_CG_ET ShippingOptionResult.new(code: 'PRLA_CG_ET', name: 'purolator_ground', signature: true), # Purolator Courier, ground PRLA ShippingOptionResult.new(code: 'PRLA', name: 'purolator_ground'), # Ground (carrier not specified) UNSP_CG ShippingOptionResult.new(code: 'UNSP_CG', name: 'purolator_ground'), # default to Purolator based on Ppdated Shipping Methods for Lowe's Canada email # Unspecified UNSP ShippingOptionResult.new(code: 'UNSP', name: 'purolator_ground'), # default to Purolator based on Ppdated Shipping Methods for Lowe's Canada email # Sameday Worldwide - Threshold Service SDCR_DS ShippingOptionResult.new(code: 'SDCR_DS', name: 'same_day_worldwide_threshold'), # Same day worldwide is not a supported shipping method, but we will do it via 3rd party ] when :commercehub_thd_us # This is Home Depot US, so use US defaults @shipping_map = [ ShippingOptionResult.new(code: 'FEDX', name: 'fedex_ground'), # Unspecified Fedex ShippingOptionResult.new(code: 'FEPL', name: 'fedex_ground'), # Unspecified Fedex ShippingOptionResult.new(code: 'FEDX_CG', name: 'fedex_ground'), ShippingOptionResult.new(code: 'FDXG', name: 'fedex_ground'), ShippingOptionResult.new(code: 'FEDEXG', name: 'fedex_ground'), ShippingOptionResult.new(code: 'FDEG', name: 'fedex_ground'), ShippingOptionResult.new(code: 'FDEG_CG', name: 'fedex_ground'), ShippingOptionResult.new(code: 'FX2D', name: 'fedex_twoday'), ShippingOptionResult.new(code: 'FEDX_SE', name: 'fedex_twoday'), ShippingOptionResult.new(code: 'FDEG_SE', name: 'fedex_twoday'), ShippingOptionResult.new(code: 'FDE_SC', name: 'fedex_twoday'), ShippingOptionResult.new(code: 'FEDH', name: 'fedex_ground_residential'), ShippingOptionResult.new(code: 'FEDX_09', name: 'fedex_ground_residential'), ShippingOptionResult.new(code: 'FEDX_ND', name: 'fedex_standard_overnight'), ShippingOptionResult.new(code: 'FXND', name: 'fedex_standard_overnight'), ShippingOptionResult.new(code: 'FDEX', name: 'fedex_standard_overnight'), ShippingOptionResult.new(code: 'FDEG_ND', name: 'fedex_standard_overnight'), ShippingOptionResult.new(code: 'UPSN_CG', name: 'ground'), ShippingOptionResult.new(code: 'UNSP', name: 'ground'), # Unspecified, so use UPS Ground (home depot USA) ShippingOptionResult.new(code: 'UNSP_CG', name: 'ground'), # UPS Ground (home depot USA) ShippingOptionResult.new(code: 'UPSN_SC', name: 'seconddayair'), ShippingOptionResult.new(code: 'UPSN_SE', name: 'seconddayair'), ShippingOptionResult.new(code: 'UPSN', name: 'ground'), ShippingOptionResult.new(code: 'UPS', name: 'ground'), ShippingOptionResult.new(code: 'MCC', name: 'ground'), ShippingOptionResult.new(code: 'UG', name: 'ground'), ShippingOptionResult.new(code: 'UPSG', name: 'ground'), ShippingOptionResult.new(code: 'UPSET_CG', name: 'ground', signature: true), ShippingOptionResult.new(code: 'UX', name: 'ground', signature: true), ShippingOptionResult.new(code: 'UB', name: 'seconddayair'), ShippingOptionResult.new(code: 'UPSET_SE', name: 'seconddayair', signature: true), ShippingOptionResult.new(code: 'UY', name: 'seconddayair', signature: true), ShippingOptionResult.new(code: 'UNSP_SE', name: 'seconddayair'), ShippingOptionResult.new(code: 'UPS3', name: 'threedayselect'), ShippingOptionResult.new(code: 'UPSN_3D', name: 'threedayselect'), ShippingOptionResult.new(code: 'UPGS', name: 'ups_freight_ltl'), ShippingOptionResult.new(code: 'UPGF_G2', name: 'ups_freight_ltl'), ShippingOptionResult.new(code: 'UPGF', name: 'ups_freight_ltl'), ShippingOptionResult.new(code: 'UPND', name: 'nextdayair'), ShippingOptionResult.new(code: 'UPS1', name: 'nextdayair'), ShippingOptionResult.new(code: 'UPSN_ND', name: 'nextdayair'), ShippingOptionResult.new(code: 'UPSN_NM', name: 'nextdayair'), ShippingOptionResult.new(code: 'UR', name: 'nextdayair'), ShippingOptionResult.new(code: 'UPSET_ND', name: 'nextdayair', signature: true), ShippingOptionResult.new(code: 'UZ', name: 'nextdayair', signature: true), ShippingOptionResult.new(code: 'UNSP_ND', name: 'nextdayair'), ShippingOptionResult.new(code: 'UPSN_PM', name: 'nextdayairsaver'), ShippingOptionResult.new(code: 'USPS', name: 'usps_parcel_select'), ShippingOptionResult.new(code: 'USPS_CG', name: 'usps_parcel_select'), ShippingOptionResult.new(code: 'USPSB_FC', name: 'usps_parcel_select'), ShippingOptionResult.new(code: 'USPSB_FC', name: 'usps_parcel_select') ] else # Use Canadian defaults @shipping_map = [ ShippingOptionResult.new(code: 'UPSN_SE', name: 'expedited'), # UPS 2nd Day Air ShippingOptionResult.new(code: 'UPSET_SE', name: 'expedited', signature: true), # UPS 2nd Day Air, Signature Required ShippingOptionResult.new(code: 'UPSN_3D', name: 'expedited'), # UPS 3 Day Select ShippingOptionResult.new(code: 'UPSC_ND', name: 'express'), # UPS Express Saver Canada ShippingOptionResult.new(code: 'UPSN_CG', name: 'standard'), # Unknown but in test file, will assume ground ShippingOptionResult.new(code: 'UPSET_CG', name: 'standard', signature: true), # UPS Ground, Signature Required ShippingOptionResult.new(code: 'UPSC_G2', name: 'standard'), ShippingOptionResult.new(code: 'UNSP', name: 'standard'), # Unspecified, so use default for costco ShippingOptionResult.new(code: 'UPSN_ND', name: 'expressearlyam'), # UPS Next Day Air ShippingOptionResult.new(code: 'UPSN_PM', name: 'express'), # UPS Next Day Air Saver ShippingOptionResult.new(code: 'UPSET_ND', name: 'expressearlyam', signature: true), # UPS Next Day Air, Signature Required ShippingOptionResult.new(code: 'UPSN_IX', name: 'worldwide_express'), # UPS Worldwide Express ShippingOptionResult.new(code: 'FEDX', name: 'fedex_ground'), # Unspecified Fedex ShippingOptionResult.new(code: 'FEPL', name: 'fedex_ground'), # Unspecified Fedex ShippingOptionResult.new(code: 'FEDX_CG', name: 'fedex_ground'), ShippingOptionResult.new(code: 'FDXG', name: 'fedex_ground'), ShippingOptionResult.new(code: 'FEDEXG', name: 'fedex_ground'), ShippingOptionResult.new(code: 'FDEG', name: 'fedex_ground'), ShippingOptionResult.new(code: 'FDEG_CG', name: 'fedex_ground'), ShippingOptionResult.new(code: 'FX2D', name: 'fedex_twoday'), ShippingOptionResult.new(code: 'FEDX_SE', name: 'fedex_twoday'), ShippingOptionResult.new(code: 'FDEG_SE', name: 'fedex_twoday'), ShippingOptionResult.new(code: 'FDE_SC', name: 'fedex_twoday'), ShippingOptionResult.new(code: 'FEDH', name: 'fedex_ground_residential'), ShippingOptionResult.new(code: 'FEDX_09', name: 'fedex_ground_residential'), ShippingOptionResult.new(code: 'FEDX_ND', name: 'fedex_standard_overnight'), ShippingOptionResult.new(code: 'FXND', name: 'fedex_standard_overnight'), ShippingOptionResult.new(code: 'FDEX', name: 'fedex_standard_overnight'), ShippingOptionResult.new(code: 'FDEG_ND', name: 'fedex_standard_overnight'), ShippingOptionResult.new(code: 'CG', name: 'canada_post_expedited_parcel'), ShippingOptionResult.new(code: 'CG_SE', name: 'canada_post_xpresspost'), ShippingOptionResult.new(code: 'CG_CG', name: 'canada_post_regular_parcel'), ShippingOptionResult.new(code: 'CG_CG_ET', name: 'canada_post_regular_parcel', signature: true), ShippingOptionResult.new(code: 'CNPL', name: 'canpar_ground'), ShippingOptionResult.new(code: 'CNPL_SE', name: 'canpar_select'), ShippingOptionResult.new(code: 'PRLA_CG', name: 'purolator_ground'), ShippingOptionResult.new(code: 'PRLA_CG_ET', name: 'purolator_ground', signature: true), ShippingOptionResult.new(code: 'PRLA', name: 'purolator_ground'), ShippingOptionResult.new(code: 'PRLA_PM', name: 'purolator_express'), ShippingOptionResult.new(code: 'PRLA_PM_ET', name: 'purolator_express', signature: true), ShippingOptionResult.new(code: 'SDCR_G2', name: 'same_day_worldwide_basic'), # Same day worldwide is not supported but in the test file ShippingOptionResult.new(code: 'SDCR_G2_ET', name: 'same_day_worldwide_basic_signature', signature: true), # Same day worldwide is not supported but in the test file ShippingOptionResult.new(code: 'SDCR_CG', name: 'same_day_worldwide_basic'), # Same day worldwide for Walmart.ca ShippingOptionResult.new(code: 'SDCR_DS', name: 'same_day_worldwide_threshold'), # Same day worldwide for Walmart.ca ShippingOptionResult.new(code: 'SDCR_DT', name: 'same_day_worldwide_threshold_2_person'), # Same day worldwide for Walmart.ca ShippingOptionResult.new(code: 'SDCR-NS', name: 'same_day_worldwide_basic'), # Same day worldwide for Walmart.ca ShippingOptionResult.new(code: 'SDCR-H1', name: 'same_day_worldwide_threshold'), # Same day worldwide for Walmart.ca ShippingOptionResult.new(code: 'SDCR-H4', name: 'same_day_worldwide_threshold_2_person'), # Same day worldwide for Walmart.ca # 04282023 # Sameday Worldwide - Basic Service, No Appointment SDCR_GT ShippingOptionResult.new(code: 'SDCR_GT', name: 'same_day_worldwide_basic') # Same day worldwide for Walmart.ca # Sameday Worldwide - Expedited Ground SDCR_CG # Sameday Worldwide - Threshold, 2 person handling SDCR_DT ] end end |
Instance Attribute Details
#orchestrator ⇒ Object (readonly)
Returns the value of attribute orchestrator.
9 10 11 |
# File 'app/services/edi/commercehub/ship_code_mapper.rb', line 9 def orchestrator @orchestrator end |
#shipping_map ⇒ Object (readonly)
Returns the value of attribute shipping_map.
9 10 11 |
# File 'app/services/edi/commercehub/ship_code_mapper.rb', line 9 def shipping_map @shipping_map end |
Instance Method Details
#ch_to_hw(shipping_code) ⇒ Object
Pass a commercehub shipping code, e.g UPSN_SE, and retrieves a shipping option result object describing the service requested
424 425 426 427 428 429 |
# File 'app/services/edi/commercehub/ship_code_mapper.rb', line 424 def ch_to_hw(shipping_code) match = shipping_map.detect { |sor| sor.code == shipping_code } raise "Unmatched shipping code #{shipping_code}" unless match match end |
#hw_to_ch(shipping_method_name, signature: false, saturday: false) ⇒ Object
Translates a heatwave shipping option parameters into a commercehub shipping code
432 433 434 |
# File 'app/services/edi/commercehub/ship_code_mapper.rb', line 432 def hw_to_ch(shipping_method_name, signature: false, saturday: false) shipping_map.detect { |sor| sor.name == shipping_method_name && sor.signature == signature.to_b && sor.saturday == saturday.to_b }&.code || 'UNSP' end |