Class: Edi::Wayfair::ShipCodeMapper

Inherits:
Object
  • Object
show all
Defined in:
app/services/edi/wayfair/ship_code_mapper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(orchestrator) ⇒ ShipCodeMapper

Returns a new instance of ShipCodeMapper.



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
# File 'app/services/edi/wayfair/ship_code_mapper.rb', line 12

def initialize(orchestrator)
  @orchestrator = orchestrator
  @shipping_map = case @orchestrator.warehouse_code
                  #
                  # Here we look at the warehouse code to ensure we are looking at Canada vs US shipping methods
                  #
                  when 'WY-CA', '24331'
                    # This is Canada so use Canadian defaults
                    [
                      # From: https://partners.wayfair.com/help/2/article/323
                      # Wayfair definitely leverages the carrier code so match with those
                      ShippingOptionResult.new(carrier_code: 'UPSN', ship_speed: 'GROUND', name: 'standard'), # for Wayfair CA
                      ShippingOptionResult.new(carrier_code: 'FDEG', ship_speed: 'GROUND', name: 'fedex_ground_ca'), # for Wayfair CA
                      ShippingOptionResult.new(carrier_code: 'FDEG', ship_speed: 'FEDEX_HOME', name: 'fedex_ground_residential_ca'), # for Wayfair CA
                      ShippingOptionResult.new(carrier_code: 'UPSN', ship_speed: 'NEXT_DAY', name: 'expresssaver'), # for Wayfair CA
                      ShippingOptionResult.new(carrier_code: 'FDEG', ship_speed: 'NEXT_DAY', name: 'fedex_standard_overnight_ca'), # for Wayfair CA
                      ShippingOptionResult.new(carrier_code: 'UPSN', ship_speed: 'SECOND_DAY_AIR', name: 'expedited'), # for Wayfair CA
                      ShippingOptionResult.new(carrier_code: 'FDEG', ship_speed: 'SECOND_DAY_AIR', name: 'fedex_twoday_ca'), # for Wayfair CA
                      ShippingOptionResult.new(carrier_code: 'UPSN', ship_speed: 'THREE_DAY', name: 'threedayselectcanada'), # for Wayfair CA
                      ShippingOptionResult.new(carrier_code: 'FDEG', ship_speed: 'THREE_DAY', name: 'fedex_twoday_ca'), # for Wayfair CA, have to decide since FedEx Express Saver in Canada is not an option
                      ShippingOptionResult.new(carrier_code: '', ship_speed: 'GROUND', name: 'standard'), # for Wayfair CA
                      ShippingOptionResult.new(carrier_code: 'GROUND', ship_speed: 'GROUND', name: 'standard'), # sheesh they throw all kinds of junk at us

                      # LTL carriers for Wayfair Canada - actual BOL will be manually printed from Wayfair Extranet/Portal
                      # AMJM is Aris T Special Maritime Enterprise
                      ShippingOptionResult.new(carrier_code: 'AMJM', ship_speed: 'CURBSIDE', name: 'AMJM'),
                      ShippingOptionResult.new(carrier_code: 'AMJM', ship_speed: 'CURBSIDE_WITH_UNLOAD', name: 'AMJM'),
                      ShippingOptionResult.new(carrier_code: 'AMJM', ship_speed: 'WHITE_GLOVE_ROOM_OF_CHOICE', name: 'AMJM'),
                      ShippingOptionResult.new(carrier_code: 'AMJM', ship_speed: 'WHITE_GLOVE_SILVER', name: 'AMJM'),
                      ShippingOptionResult.new(carrier_code: 'AMJM', ship_speed: 'WHITE_GLOVE_GOLD', name: 'AMJM'),
                      ShippingOptionResult.new(carrier_code: 'AMJM', ship_speed: 'WHITE_GLOVE_PLATINUM', name: 'AMJM'),
                      ShippingOptionResult.new(carrier_code: 'AMJM', ship_speed: 'WHITE_GLOVE_TWO_MAN', name: 'AMJM'),
                      ShippingOptionResult.new(carrier_code: 'AMJM', ship_speed: 'LARGE_PARCEL_COURIER', name: 'AMJM'),
                      ShippingOptionResult.new(carrier_code: 'AMJM', ship_speed: 'ECONOMY', name: 'AMJM'),
                      ShippingOptionResult.new(carrier_code: 'AMJM', ship_speed: 'LOW_COST_CARRIER', name: 'AMJM')
                    ]
                  else
                    # Otherwise, use USA defaults
                    [
                      # From: https://partners.wayfair.com/help/2/article/323
                      # Wayfair definitely leverages the carrier code so match with those
                      ShippingOptionResult.new(carrier_code: 'UPSN', ship_speed: 'GROUND', name: 'ground'), # for Wayfair US
                      ShippingOptionResult.new(carrier_code: 'FDEG', ship_speed: 'GROUND', name: 'fedex_ground'), # for Wayfair US
                      ShippingOptionResult.new(carrier_code: 'FDEG', ship_speed: 'FEDEX_HOME', name: 'fedex_ground_residential'), # for Wayfair US
                      ShippingOptionResult.new(carrier_code: 'UPSN', ship_speed: 'NEXT_DAY', name: 'nextdayairsaver'), # for Wayfair US
                      ShippingOptionResult.new(carrier_code: 'FDEG', ship_speed: 'NEXT_DAY', name: 'fedex_standard_overnight'), # for Wayfair US
                      ShippingOptionResult.new(carrier_code: 'UPSN', ship_speed: 'SECOND_DAY_AIR', name: 'seconddayair'), # for Wayfair US
                      ShippingOptionResult.new(carrier_code: 'FDEG', ship_speed: 'SECOND_DAY_AIR', name: 'fedex_twoday'), # for Wayfair US
                      ShippingOptionResult.new(carrier_code: 'UPSN', ship_speed: 'THREE_DAY', name: 'threedayselect'), # for Wayfair US
                      ShippingOptionResult.new(carrier_code: 'FDEG', ship_speed: 'THREE_DAY', name: 'fedex_express_saver'), # for Wayfair US

                      ShippingOptionResult.new(carrier_code: 'UPSN', ship_speed: 'GROUND', name: 'ground', is_puerto_rico: true), # for Wayfair US to PR
                      ShippingOptionResult.new(carrier_code: 'FDEG', ship_speed: 'GROUND', name: 'fedex_international_economy', is_puerto_rico: true), # for Wayfair US to PR
                      ShippingOptionResult.new(carrier_code: 'UPSN', ship_speed: 'NEXT_DAY', name: 'nextdayairsaver', is_puerto_rico: true), # for Wayfair US to PR
                      ShippingOptionResult.new(carrier_code: 'FDEG', ship_speed: 'NEXT_DAY', name: 'fedex_international_priority', is_puerto_rico: true), # for Wayfair US to PR
                      ShippingOptionResult.new(carrier_code: '', ship_speed: 'GROUND', name: 'ground'), # for Wayfair US
                      ShippingOptionResult.new(carrier_code: 'GROUND', ship_speed: 'GROUND', name: 'standard'), # sheesh they throw all kinds of junk at us

                      # From: https://partners.wayfair.com/help/2/article/351 These are LTL carriers and ship speeds, actual BOL will be manually printed from Wayfair Extranet/Portal, map to Heatwave
                      ShippingOptionResult.new(carrier_code: 'RDWY', ship_speed: 'CURBSIDE', name: 'RDWY'), # RDWY is YRC but manual, use standard but actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'RDWY', ship_speed: 'CURBSIDE_WITH_UNLOAD', name: 'RDWY'), # RDWY is YRC but manual, use standard but actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'RDWY', ship_speed: 'WHITE_GLOVE_ROOM_OF_CHOICE', name: 'RDWY'), # RDWY is YRC but manual, use enhanced but actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'RDWY', ship_speed: 'WHITE_GLOVE_SILVER', name: 'RDWY'), # RDWY is YRC but manual, actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'RDWY', ship_speed: 'WHITE_GLOVE_GOLD', name: 'RDWY'), # RDWY is YRC but manual, actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'RDWY', ship_speed: 'WHITE_GLOVE_PLATINUM', name: 'RDWY'), # RDWY is YRC but manual, actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'RDWY', ship_speed: 'WHITE_GLOVE_TWO_MAN', name: 'RDWY'), # RDWY is YRC but manual, actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'RDWY', ship_speed: 'LARGE_PARCEL_COURIER', name: 'RDWY'), # RDWY is YRC but manual, actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'RDWY', ship_speed: 'ECONOMY', name: 'RDWY'), # RDWY is YRC but manual, actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'RDWY', ship_speed: 'LOW_COST_CARRIER', name: 'RDWY'), # RDWY is YRC but manual, actual BOL will be manually printed from Wayfair Extranet/Portal

                      ShippingOptionResult.new(carrier_code: 'CNWY', ship_speed: 'CURBSIDE', name: 'XPO_TH'), # XPO acquired Conway Freight, use standard but actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'CNWY', ship_speed: 'CURBSIDE_WITH_UNLOAD', name: 'XPO_TH'), # XPO acquired Conway Freight, use standard but actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'CNWY', ship_speed: 'WHITE_GLOVE_ROOM_OF_CHOICE', name: 'XPO_WG'), # XPO acquired Conway Freight, use enhanced but actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'CNWY', ship_speed: 'WHITE_GLOVE_SILVER', name: 'XPO_WG'), # XPO acquired Conway Freight, use enhanced but actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'CNWY', ship_speed: 'WHITE_GLOVE_GOLD', name: 'XPO_WG'), # XPO acquired Conway Freight, use enhanced but actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'CNWY', ship_speed: 'WHITE_GLOVE_PLATINUM', name: 'XPO_WG'), # XPO acquired Conway Freight, use enhanced but actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'CNWY', ship_speed: 'WHITE_GLOVE_TWO_MAN', name: 'XPO_WG'), # XPO acquired Conway Freight, use enhanced but actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'CNWY', ship_speed: 'LARGE_PARCEL_COURIER', name: 'XPO_TH'), # XPO acquired Conway Freight, use standard but actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'CNWY', ship_speed: 'ECONOMY', name: 'XPO_TH'), # XPO acquired Conway Freight, use standard but actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'CNWY', ship_speed: 'LOW_COST_CARRIER', name: 'XPO_TH'), # XPO acquired Conway Freight, use standard but actual BOL will be manually printed from Wayfair Extranet/Portal

                      ShippingOptionResult.new(carrier_code: 'EXLA', ship_speed: 'CURBSIDE', name: 'NSD_ESTES'), # EXLA is ESTES, use standard but actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'EXLA', ship_speed: 'CURBSIDE_WITH_UNLOAD', name: 'NSD_ESTES'), # EXLA is ESTES, use standard but actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'EXLA', ship_speed: 'WHITE_GLOVE_ROOM_OF_CHOICE', name: 'NSD_ESTES'), # EXLA is ESTES, use enhanced but actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'EXLA', ship_speed: 'WHITE_GLOVE_SILVER', name: 'NSD_ESTES'), # EXLA is ESTES, actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'EXLA', ship_speed: 'WHITE_GLOVE_GOLD', name: 'NSD_ESTES'), # EXLA is ESTES, actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'EXLA', ship_speed: 'WHITE_GLOVE_PLATINUM', name: 'NSD_ESTES'), # EXLA is ESTES, actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'EXLA', ship_speed: 'WHITE_GLOVE_TWO_MAN', name: 'NSD_ESTES'), # EXLA is ESTES, actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'EXLA', ship_speed: 'LARGE_PARCEL_COURIER', name: 'NSD_ESTES'), # EXLA is ESTES, actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'EXLA', ship_speed: 'ECONOMY', name: 'NSD_ESTES'), # EXLA is ESTES, actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'EXLA', ship_speed: 'LOW_COST_CARRIER', name: 'NSD_ESTES'), # EXLA is ESTES, actual BOL will be manually printed from Wayfair Extranet/Portal

                      ShippingOptionResult.new(carrier_code: 'RDFS', ship_speed: 'CURBSIDE', name: 'RDFS'), # RDFS is RoadRunner, use standard but actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'RDFS', ship_speed: 'CURBSIDE_WITH_UNLOAD', name: 'RDFS'), # RDFS is RoadRunner, use standard but actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'RDFS', ship_speed: 'WHITE_GLOVE_ROOM_OF_CHOICE', name: 'RDFS'), # RDFS is RoadRunner, use enhanced but actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'RDFS', ship_speed: 'WHITE_GLOVE_SILVER', name: 'RDFS'), # RDFS is RoadRunner, actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'RDFS', ship_speed: 'WHITE_GLOVE_GOLD', name: 'RDFS'), # RDFS is RoadRunner, actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'RDFS', ship_speed: 'WHITE_GLOVE_PLATINUM', name: 'RDFS'), # RDFS is RoadRunner, actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'RDFS', ship_speed: 'WHITE_GLOVE_TWO_MAN', name: 'RDFS'), # RDFS is RoadRunner, actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'RDFS', ship_speed: 'LARGE_PARCEL_COURIER', name: 'RDFS'), # RDFS is RoadRunner, actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'RDFS', ship_speed: 'ECONOMY', name: 'RDFS'), # RDFS is RoadRunner, actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'RDFS', ship_speed: 'LOW_COST_CARRIER', name: 'RDFS'), # RDFS is RoadRunner, actual BOL will be manually printed from Wayfair Extranet/Portal

                      ShippingOptionResult.new(carrier_code: 'ZEFL', ship_speed: 'CURBSIDE', name: 'NSD_ZENITH'), # ZEFL is ZENITH, use standard but actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'ZEFL', ship_speed: 'CURBSIDE_WITH_UNLOAD', name: 'NSD_ZENITH'), # ZEFL is ZENITH, use standard but actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'ZEFL', ship_speed: 'WHITE_GLOVE_ROOM_OF_CHOICE', name: 'NSD_ZENITH'), # ZEFL is ZENITH, use enhanced but actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'ZEFL', ship_speed: 'WHITE_GLOVE_SILVER', name: 'NSD_ZENITH'), # ZEFL is ZENITH, actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'ZEFL', ship_speed: 'WHITE_GLOVE_GOLD', name: 'NSD_ZENITH'), # ZEFL is ZENITH, actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'ZEFL', ship_speed: 'WHITE_GLOVE_PLATINUM', name: 'NSD_ZENITH'), # ZEFL is ZENITH, actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'ZEFL', ship_speed: 'WHITE_GLOVE_TWO_MAN', name: 'NSD_ZENITH'), # ZEFL is ZENITH, actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'ZEFL', ship_speed: 'LARGE_PARCEL_COURIER', name: 'NSD_ZENITH'), # ZEFL is ZENITH, actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'ZEFL', ship_speed: 'ECONOMY', name: 'NSD_ZENITH'), # ZEFL is ZENITH, actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'ZEFL', ship_speed: 'LOW_COST_CARRIER', name: 'NSD_ZENITH'), # ZEFL is ZENITH, actual BOL will be manually printed from Wayfair Extranet/Portal

                      ShippingOptionResult.new(carrier_code: 'WKSH', ship_speed: 'CURBSIDE', name: 'NSD_WATKINS'), # WKSH is WATKINS, use standard but actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'WKSH', ship_speed: 'CURBSIDE_WITH_UNLOAD', name: 'NSD_WATKINS'), # WKSH is WATKINS, use standard but actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'WKSH', ship_speed: 'WHITE_GLOVE_ROOM_OF_CHOICE', name: 'NSD_WATKINS'), # WKSH is WATKINS, use enhanced but actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'WKSH', ship_speed: 'WHITE_GLOVE_SILVER', name: 'NSD_WATKINS'), # WKSH is WATKINS, actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'WKSH', ship_speed: 'WHITE_GLOVE_GOLD', name: 'NSD_WATKINS'), # WKSH is WATKINS, actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'WKSH', ship_speed: 'WHITE_GLOVE_PLATINUM', name: 'NSD_WATKINS'), # WKSH is WATKINS, actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'WKSH', ship_speed: 'WHITE_GLOVE_TWO_MAN', name: 'NSD_WATKINS'), # WKSH is WATKINS, actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'WKSH', ship_speed: 'LARGE_PARCEL_COURIER', name: 'NSD_WATKINS'), # WKSH is WATKINS, actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'WKSH', ship_speed: 'ECONOMY', name: 'NSD_WATKINS'), # WKSH is WATKINS, actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'WKSH', ship_speed: 'LOW_COST_CARRIER', name: 'NSD_WATKINS'), # WKSH is WATKINS, actual BOL will be manually printed from Wayfair Extranet/Portal

                      ShippingOptionResult.new(carrier_code: 'XPO_WG', name: 'XPO_WG'), # XPO Enhanced Delivery
                      ShippingOptionResult.new(carrier_code: 'XPO_TH', name: 'XPO_TH'), # XPO Standard Delivery
                      ShippingOptionResult.new(carrier_code: 'NSD_ESTES', name: 'NSD_ESTES'), # ESTES Standard
                      ShippingOptionResult.new(carrier_code: 'FIDELITONE_WATKINS', name: 'FIDELITONE_WATKINS'), # Watkins & Shepard Freight
                      ShippingOptionResult.new(carrier_code: 'ZENITH_WATKINS', name: 'ZENITH_WATKINS'), # Watkins & Shepard Freight
                      ShippingOptionResult.new(carrier_code: 'XPO_WATKINS', name: 'XPO_WATKINS'), # Watkins & Shepard Freight
                      ShippingOptionResult.new(carrier_code: 'NSD_WATKINS', name: 'NSD_WATKINS'), # Watkins & Shepard Freight
                      ShippingOptionResult.new(carrier_code: 'ZENITH_GROUND', name: 'ZENITH_GROUND'), # Zenith Freight
                      ShippingOptionResult.new(carrier_code: 'FIDELITONE_ZENITH', name: 'FIDELITONE_ZENITH'), # Zenith Freight
                      ShippingOptionResult.new(carrier_code: 'XPO_ZENITH', name: 'XPO_ZENITH'), # Zenith Freight
                      ShippingOptionResult.new(carrier_code: 'NSD_ZENITH', name: 'NSD_ZENITH'), # Zenith Freight

                      ShippingOptionResult.new(carrier_code: 'AVRT', ship_speed: 'CURBSIDE', name: 'AVRT'), # AVRT is Averitt, use standard but actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'AVRT', ship_speed: 'CURBSIDE_WITH_UNLOAD', name: 'AVRT'), # AVRT is Averitt, use standard but actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'AVRT', ship_speed: 'WHITE_GLOVE_ROOM_OF_CHOICE', name: 'AVRT'), # AVRT is Averitt, use enhanced but actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'AVRT', ship_speed: 'WHITE_GLOVE_SILVER', name: 'AVRT'), # AVRT is Averitt, actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'AVRT', ship_speed: 'WHITE_GLOVE_GOLD', name: 'AVRT'), # AVRT is Averitt, actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'AVRT', ship_speed: 'WHITE_GLOVE_PLATINUM', name: 'AVRT'), # AVRT is Averitt, actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'AVRT', ship_speed: 'WHITE_GLOVE_TWO_MAN', name: 'AVRT'), # AVRT is Averitt, actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'AVRT', ship_speed: 'LARGE_PARCEL_COURIER', name: 'AVRT'), # AVRT is Averitt, actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'AVRT', ship_speed: 'ECONOMY', name: 'AVRT'), # AVRT is Averitt, actual BOL will be manually printed from Wayfair Extranet/Portal
                      ShippingOptionResult.new(carrier_code: 'AVRT', ship_speed: 'LOW_COST_CARRIER', name: 'AVRT') # AVRT is Averitt, actual BOL will be manually printed from Wayfair Extranet/Portal

                    ]
                  end
end

Instance Attribute Details

#orchestratorObject (readonly)

Returns the value of attribute orchestrator.



10
11
12
# File 'app/services/edi/wayfair/ship_code_mapper.rb', line 10

def orchestrator
  @orchestrator
end

#shipping_mapObject (readonly)

Returns the value of attribute shipping_map.



10
11
12
# File 'app/services/edi/wayfair/ship_code_mapper.rb', line 10

def shipping_map
  @shipping_map
end

Instance Method Details

#hw_to_wf(shipping_method_name, signature = false, saturday = false) ⇒ Object

Translates a heatwave shipping option parameters into a wayfair shipping speed and carrier code



178
179
180
181
182
183
# File 'app/services/edi/wayfair/ship_code_mapper.rb', line 178

def hw_to_wf(shipping_method_name, signature = false, saturday = false)
  match = shipping_map.detect { |sor| sor.name == shipping_method_name && sor.signature == signature.to_b && sor.saturday == saturday.to_b }
  raise "Unmatched shipping code #{shipping_method_name}" unless match

  match
end

#wf_to_hw(ship_speed, carrier_code, is_puerto_rico = nil) ⇒ Object

Pass a wayfair shipping speed and carrier code and potentially a flag for is_puerto_rico, and retrieves a shipping option result object describing the service requested



165
166
167
168
169
170
171
172
173
174
175
# File 'app/services/edi/wayfair/ship_code_mapper.rb', line 165

def wf_to_hw(ship_speed, carrier_code, is_puerto_rico = nil)
  match = nil
  match = if is_puerto_rico
            shipping_map.detect { |sor| sor.ship_speed == ship_speed && sor.carrier_code == carrier_code && sor.is_puerto_rico == true }
          else
            shipping_map.detect { |sor| sor.ship_speed == ship_speed && sor.carrier_code == carrier_code }
          end
  raise "Unmatched shipping speed #{ship_speed} and carrier code #{carrier_code} (is_puerto_rico: #{is_puerto_rico || 'n/a'})" unless match

  match
end