File Coverage

blib/lib/Business/FedEx/Constants.pm
Criterion Covered Total %
statement 19 37 51.3
branch 0 14 0.0
condition 0 3 0.0
subroutine 6 10 60.0
pod 3 3 100.0
total 28 67 41.7


line stmt bran cond sub pod time code
1             # FedEx::Constants
2             # $Id: Constants.pm,v 1.17 2004/08/09 16:07:20 jay.powers Exp $
3             # Copyright (c) 2004 Jay Powers
4             # All rights reserved.
5             #
6             # This program is free software; you can redistribute it and/or
7             # modify it under the same terms as Perl itself
8             package Business::FedEx::Constants;
9              
10             require 5.006_000;
11              
12 1     1   5 use strict;
  1         1  
  1         30  
13 1     1   4 use Carp qw(croak);
  1         2  
  1         54  
14             require Exporter;
15             require Tie::StrictHash;
16              
17 1     1   16 use vars qw(@ISA @EXPORT $VERSION);
  1         2  
  1         73  
18             BEGIN {
19 1     1   17 @ISA = ('Exporter');
20 1         3 @EXPORT = qw(
21             %FE_RE %FE_SE %FE_TT %FE_UTI_BY_TT %FE_RQ
22             $FE_RE $FE_SE $FE_TT $FE_RQ
23             field_name_to_tag
24             field_tag_to_name
25             uti_by_tt_carrier
26             );
27 1         35 $VERSION = '1.01';
28             }
29 1     1   4 use vars grep { /^[$@%]/ } @EXPORT;
  1         1  
  1         2  
  12         1505  
30              
31             # Here are all the UTI codes from FedEx
32             #1002 = 007 / 107 FDXG End-of-day close
33             #1005 = 023 / 123 FDXE FedEx Express Delete-A-Package
34             #2016 = 021 / 121 FDXE FedEx Express Ship-A-Package
35             #2017 = 022 / 122 FDXE Global Rate-A-Package
36             #2018 = 019 / 119 FDXE Service Availability
37             #2024 = 025 / 125 ALL Rate Available Services
38             #2025 = 410 / 510 ALL FedEx Locator
39             #3000 = 021 / 121 FDXG FedEx Ground Ship-A-Package
40             #3001 = 023 / 123 FDXG FedEx Ground Delete-A-Package
41             #3003 = 211 / 311 ALL Subscription
42             #3004 = 022 / 122 FDXG Global Rate-A-Package
43             #5000 = 402 / 502 ALL Track By Number, Destination, Ship Date, and Reference
44             #5001 = 405 / 505 ALL Signature Proof of Delivery
45             #5002 = 403 / 503 ALL Track By Number, Destination, Ship Date, and Reference
46             #
47             # XXX UTI 5000 isn't in the tagged transaction guide version 1.2
48             # (2003-07-10).
49              
50             our $FE_TT = {
51             1002 => ['007','FDXG'],
52             1005 => ['023','FDXE'],
53             2016 => ['021','FDXE'],
54             2017 => ['022','FDXE'],
55             2018 => ['019','FDXE'],
56             2024 => ['025',''],
57             2025 => ['410',''],
58             3000 => ['021','FDXG'],
59             3001 => ['023','FDXG'],
60             3003 => ['211',''],
61             3004 => ['022','FDXG'],
62             5000 => ['402',''],
63             5001 => ['405',''],
64             5002 => ['403','']
65             };
66              
67             # First check $FE_UTI_BY_TT->{$tt}{$carrier}, if that doesn't exist (you
68             # can use a simple boolean test), use $FE_UTI_BY_TT->{$tt}{''}.
69              
70             our $FE_UTI_BY_TT = { };
71             for my $uti (keys %{ $FE_TT }) {
72             my ($tt, $carrier) = @{ $FE_TT->{$uti} };
73             if (exists $FE_UTI_BY_TT->{$tt}{$carrier}) {
74             die "Duplicate %FE_TT entry for $tt/$carrier";
75             }
76             $FE_UTI_BY_TT->{$tt}{$carrier} = $uti;
77             }
78              
79             our $FE_RQ = {
80             1002 => [0,10,498,3025,1007,1366],
81             1005 => [0,10,498,3025,29],
82             2016 => [0,10,498,3025,4,32,5,7,8,9,117,183,13,18,50,68,23,1273,1401,1333],
83             2017 => [0,10,498,3025,8,9,117,16,17,50,75,1274,1401,1333],
84             2018 => [0,10,498,3025,47,9,17,50,24],
85             2024 => [0,10,498,8,9,117,16,17,50,1401,1333],
86             2025 => [0,10,498,3025,9],
87             3000 => [0,10,498,3025,4,32,5,7,8,9,117,183,13,18,50,68,23,1273,1401,1333],
88             3001 => [0,10,29,498,3025],
89             3003 => [0,10,4003,4008,4011,4012,4013,4014,4015],
90             5000 => [0,10,498,3025,24,29],
91             5001 => [0,10,498,3025,24,29],
92             5002 => [0,10,498,3025,24,29],
93             };
94              
95             our $FE_RE = {
96             0 => 'transaction_code',
97             1 => 'customer_transaction_identifier',
98             2 => 'transaction_error_code',
99             3 => 'transaction_error_message',
100             4 => 'sender_company',
101             5 => 'sender_address_line_1',
102             6 => 'sender_address_line_2',
103             7 => 'sender_city',
104             8 => 'sender_state',
105             9 => 'sender_postal_code',
106             10 => 'sender_fedex_express_account_number',
107             11 => 'recipient_company',
108             12 => 'recipient_contact_name',
109             13 => 'recipient_address_line_1',
110             14 => 'recipient_address_line_2',
111             15 => 'recipient_city',
112             16 => 'recipient_state',
113             17 => 'recipient_postal_code',
114             18 => 'recipient_phone_number',
115             20 => 'payer_account_number',
116             23 => 'pay_type',
117             24 => 'ship_date',
118             25 => 'reference_information',
119             27 => 'cod_flag',
120             28 => 'cod_return_tracking_number',
121             29 => 'tracking_number',
122             30 => 'ursa_code',
123             32 => 'sender_contact_name',
124             33 => 'service_commitment',
125             38 => 'sender_department',
126             40 => 'alcohol_type',
127             41 => 'alcohol_packaging',
128             44 => 'hal_address',
129             46 => 'hal_city',
130             47 => 'hal_state',
131             48 => 'hal_postal_code',
132             49 => 'hal_phone_number',
133             50 => 'recipient_country',
134             51 => 'signature_release_ok_flag',
135             52 => 'alcohol_packages',
136             57 => 'dim_height',
137             58 => 'dim_width',
138             59 => 'dim_length',
139             65 => 'astra_barcode',
140             66 => 'broker_name',
141             67 => 'broker_phone_number',
142             68 => 'customs_declared_value_currency_type',
143             70 => 'duties_pay_type',
144             71 => 'duties_payer_account',
145             72 => 'terms_of_sale',
146             73 => 'parties_to_transaction',
147             74 => 'country_of_ultimate_destination',
148             75 => 'weight_units',
149             76 => 'commodity_number_of_pieces',
150             79 => 'description_of_contents',
151             80 => 'country_of_manufacturer',
152             81 => 'harmonized_code',
153             82 => 'unit_quantity',
154             83 => 'export_license_number',
155             84 => 'export_license_expiration_date',
156             99 => 'end_of_record',
157             113 => 'commercial_invoice_flag',
158             116 => 'package_total',
159             117 => 'sender_country_code',
160             118 => 'recipient_irs',
161             120 => 'ci_marks_and_numbers',
162             169 => 'importer_country',
163             170 => 'importer_name',
164             171 => 'importer_company',
165             172 => 'importer_address_line_1',
166             173 => 'importer_address_line_2',
167             174 => 'importer_city',
168             175 => 'importer_state',
169             176 => 'importer_postal_code',
170             177 => 'importer_account_number',
171             178 => 'importer_number_phone',
172             180 => 'importer_id',
173             183 => 'sender_phone_number',
174             186 => 'cod_add_freight_charges_flag',
175             188 => 'label_buffer_data_stream',
176             190 => 'document_pib_shipment_flag',
177             194 => 'delivery_day',
178             195 => 'destination',
179             198 => 'destination_location_id',
180             404 => 'commodity_license_exception',
181             409 => 'delivery_date',
182             411 => 'cod_return_label_buffer_data_stream',
183             413 => 'nafta_flag',
184             414 => 'commodity_unit_of_measure',
185             418 => 'ci_comments',
186             431 => 'dim_weight_used_flag',
187             439 => 'cod_return_contact_name',
188             440 => 'residential_delivery_flag',
189             496 => 'freight_service_commitment',
190             498 => 'meter_number',
191             526 => 'form_id',
192             527 => 'cod_return_form_id',
193             528 => 'commodity_eccn',
194             535 => 'cod_return',
195             536 => 'cod_return_service_commitment',
196             543 => 'cod_return_collect_plus_freight_amount',
197             557 => 'message_type_code',
198             558 => 'message_code',
199             559 => 'message_text',
200             600 => 'forwarding_agent_routed_export_transaction_indicator',
201             602 => 'exporter_ein_ssn_indicator',
202             603 => 'int-con_company_name',
203             604 => 'int-con_contact_name',
204             605 => 'int-con_address_line_1',
205             606 => 'int-con_address_line_2',
206             607 => 'int-con_city',
207             608 => 'int-con_state',
208             609 => 'int-con_zip',
209             610 => 'int-con_phone_number',
210             611 => 'int-con_country',
211             1005 => 'manifest_invoic_e_file_name',
212             1006 => 'domain_name',
213             1007 => 'close_manifest_date',
214             1008 => 'package_ready_time',
215             1009 => 'time_companyclose',
216             1032 => 'duties_payer_country_code',
217             1089 => 'rate_scale',
218             1090 => 'rate_currency_type',
219             1092 => 'rate_zone',
220             1096 => 'origin_location_id',
221             1099 => 'volume_units',
222             1101 => 'payer_credit_card_number',
223             1102 => 'payer_credit_card_type',
224             1103 => 'sender_fax',
225             1104 => 'payer_credit_card_expiration_date',
226             1115 => 'ship_time',
227             1116 => 'dim_units',
228             1117 => 'package_sequence',
229             1118 => 'release_authorization_number',
230             1119 => 'future_day_shipment',
231             1120 => 'inside_pickup_flag',
232             1121 => 'inside_delivery_flag',
233             1123 => 'master_tracking_number',
234             1124 => 'master_form_id',
235             1137 => 'ursa_uned_prefix',
236             1139 => 'sender_irs_ein_number',
237             1145 => 'recipient_department',
238             1159 => 'scan_description',
239             1160 => 'scan_location_city',
240             1161 => 'scan_location_state',
241             1162 => 'scan_date',
242             1163 => 'scan_time',
243             1164 => 'scan_location_country',
244             1167 => 'disp_exception_cd',
245             1168 => 'status_exception_cd',
246             1174 => 'bso_flag',
247             1178 => 'ursa_suffix_code',
248             1179 => 'broker_fdx_account_number',
249             1180 => 'broker_company',
250             1181 => 'broker_line_1_address',
251             1182 => 'broker_line_2_address',
252             1183 => 'broker_city',
253             1184 => 'broker_state',
254             1185 => 'broker_postal_code',
255             1186 => 'broker_country_code',
256             1187 => 'broker_id_number',
257             1193 => 'ship_delete_message',
258             1195 => 'payer_country_code',
259             1200 => 'hold_at_location_hal_flag',
260             1201 => 'sender_email_address',
261             1202 => 'recipient_email_address',
262             1203 => 'optional_ship_alert_message',
263             1204 => 'ship_alert_email_address',
264             1206 => 'ship_alert_notification_flag',
265             1208 => 'no_indirect_delivery_flag_signature_required',
266             1210 => 'purpose_of_shipment',
267             1211 => 'pod_address',
268             1213 => 'proactive_notification_flag',
269             1237 => 'cod_return_phone',
270             1238 => 'cod_return_company',
271             1239 => 'cod_return_department',
272             1240 => 'cod_return_address_1',
273             1241 => 'cod_return_address_2',
274             1242 => 'cod_return_city',
275             1243 => 'cod_return_state',
276             1244 => 'cod_return_postal_code',
277             1253 => 'packaging_list_enclosed_flag',
278             1265 => 'hold_at_location_contact_name',
279             1266 => 'saturday_delivery_flag',
280             1267 => 'saturday_pickup_flag',
281             1268 => 'dry_ice_flag',
282             1271 => 'shippers_load_and_count_slac',
283             1272 => 'booking_number',
284             1273 => 'packaging_type',
285             1274 => 'service_type',
286             1286 => 'exporter_ppi-_contact_name',
287             1287 => 'exporter_ppi-company_name',
288             1288 => 'exporter_ppi-address_line_1',
289             1289 => 'exporter_ppi-address_line_2',
290             1290 => 'exporter_ppi-city',
291             1291 => 'exporter_ppi-state',
292             1292 => 'exporter_ppi-zip',
293             1293 => 'exporter_ppi-country',
294             1294 => 'exporter_ppi-phone_number',
295             1295 => 'exporter_ppi-ein_ssn',
296             1297 => 'customer_invoice_number',
297             1300 => 'purchase_order_number',
298             1331 => 'dangerous',
299             1332 => 'alcohol_flag',
300             1333 => 'drop_off_type',
301             1337 => 'package_content_information',
302             1339 => 'estimated_delivery_date',
303             1340 => 'estimated_delivery_time',
304             1341 => 'sender_pager_number',
305             1342 => 'recipient_pager_number',
306             1343 => 'broker_email_address',
307             1344 => 'broker_fax_number',
308             1346 => 'emerge_shipment_identifier',
309             1347 => 'emerge_merchant_identifier',
310             1349 => 'aes_filing_status',
311             1350 => 'xtn_suffix_number',
312             1352 => 'sender_ein_ssn_identificator',
313             1358 => 'aes_ftsr_exemption_number',
314             1359 => 'sed_legend_number',
315             1366 => 'close_manifest_time',
316             1367 => 'close_manifest_data_buffer',
317             1368 => 'label_type',
318             1369 => 'label_printer_type',
319             1370 => 'label_media_type',
320             1371 => 'manifest_only_request_flag',
321             1372 => 'manifest_total',
322             1376 => 'rate_weight_unit_of_measure',
323             1377 => 'dim_weight_unit_of_measure',
324             1391 => 'client_revision_indicator',
325             1392 => 'inbound_visibility_block_shipment_data_indicator',
326             1394 => 'shipment_content_records_total',
327             1395 => 'part_number',
328             1396 => 'sku_item_upc',
329             1397 => 'receive_quantity',
330             1398 => 'description',
331             1399 => 'aes_entry_number',
332             1400 => 'total_shipment_weight',
333             1401 => 'total_package_weight',
334             1402 => 'billed_weight',
335             1403 => 'dim_weight',
336             1404 => 'total_volume',
337             1405 => 'alcohol_volume',
338             1406 => 'dry_ice_weight',
339             1407 => 'commodity_weight',
340             1408 => 'commodity_unit_value',
341             1409 => 'cod_amount',
342             1410 => 'commodity_customs_value',
343             1411 => 'total_customs_value',
344             1412 => 'freight_charge',
345             1413 => 'insurance_charge',
346             1414 => 'taxes_miscellaneous_charge',
347             1415 => 'declared_value_carriage_value',
348             1416 => 'base_rate_amount',
349             1417 => 'total_surcharge_amount',
350             1418 => 'total_discount_amount',
351             1419 => 'net_charge_amount',
352             1420 => 'total_rebate_amount',
353             1429 => 'list_variable_handling_charge_amount',
354             1431 => 'list_total_customer_charge',
355             1432 => 'cod_customer_amount',
356             1450 => 'more_data_indicator',
357             1451 => 'sequence_number',
358             1452 => 'last_tracking_number',
359             1453 => 'track_reference_type',
360             1454 => 'track_reference',
361             1456 => 'spod_type_request',
362             1458 => 'spod_fax_recipient_name',
363             1459 => 'spod_fax_recipient_number',
364             1460 => 'spod_fax_sender_name',
365             1461 => 'spod_fax_sender_phone_number',
366             1462 => 'language_indicator',
367             1463 => 'spod_fax_recipient_company_name_mail',
368             1464 => 'spod_fax_recipient_address_line_1_mail',
369             1465 => 'spod_fax_recipient_address_line_2_mail',
370             1466 => 'spod_fax_recipient_city_mail',
371             1467 => 'spod_fax_recipient_state_mail',
372             1468 => 'spod_fax_recipient_zip_postal_code_mail',
373             1469 => 'spod_fax_recipient_country_mail',
374             1470 => 'spod_fax_confirmation',
375             1471 => 'spod_letter',
376             1472 => 'spod_ground_recipient_name',
377             1473 => 'spod_ground_recipient_company_name',
378             1474 => 'spod_ground_recipient_address_line_1',
379             1475 => 'spod_ground_recipient_address_line_2',
380             1476 => 'spod_ground_recipient_city',
381             1477 => 'spod_ground_recipient_state_province',
382             1478 => 'spod_ground_recipient_zip_postal_code',
383             1479 => 'spod_ground_recipient_country',
384             1480 => 'more_information',
385             1507 => 'list_total_surcharge_amount',
386             1525 => 'effective_net_discount',
387             1528 => 'list_net_charge_amount',
388             1529 => 'rate_indicator_1_numeric_valid_values',
389             1530 => 'list_base_rate_amount',
390             1531 => 'list_total_discount_amount',
391             1532 => 'list_total_rebate_amount',
392             1534 => 'detail_scan_indicator',
393             1535 => 'paging_token',
394             1536 => 'number_of_relationships',
395             1537 => 'search_relationship_string',
396             1538 => 'search_relationship_type_code',
397             1551 => 'delivery_notification_flag',
398             1552 => 'language_code',
399             1553 => 'shipper_delivery_notification_flag',
400             1554 => 'shipper_ship_alert_flag',
401             1555 => 'shipper_language_code',
402             1556 => 'recipient_delivery_notification_flag',
403             1557 => 'recipient_ship_alert_flag',
404             1558 => 'recipient_language_code',
405             1559 => 'broker_delivery_notification_flag',
406             1560 => 'broker_ship_alert_flag',
407             1561 => 'broker_language_code',
408             1562 => 'fedex_staffed_location_flag',
409             1563 => 'fedex_self_service_location_indicator',
410             1564 => 'fasc',
411             1565 => 'latest_express_dropoff_flag',
412             1566 => 'express_dropoff_after_time',
413             1567 => 'fedex_location_intersection_street_address',
414             1568 => 'distance',
415             1569 => 'hours_of_operation',
416             1570 => 'hours_of_operation_sat',
417             1571 => 'last_express_dropoff',
418             1572 => 'last_express_dropoff_sat',
419             1573 => 'express_service_flag',
420             1574 => 'location_count',
421             1575 => 'fedex_location_business_name',
422             1576 => 'fedex_location_business_type',
423             1577 => 'fedex_location_city',
424             1578 => 'fedex_location_state',
425             1579 => 'fedex_location_postal_code',
426             1580 => 'dangerous_goods_flag',
427             1581 => 'saturday_service_flag',
428             1582 => 'begin_date',
429             1583 => 'end_date',
430             1584 => 'tracking_groups',
431             1606 => 'variable_handling_charge_level',
432             1607 => 'doc_tab_header_1',
433             1608 => 'doc_tab_header_2',
434             1609 => 'doc_tab_header_3',
435             1610 => 'doc_tab_header_4',
436             1611 => 'doc_tab_header_5',
437             1612 => 'doc_tab_header_6',
438             1613 => 'doc_tab_header_7',
439             1614 => 'doc_tab_header_8',
440             1615 => 'doc_tab_header_9',
441             1616 => 'doc_tab_header_10',
442             1617 => 'doc_tab_header_11',
443             1618 => 'doc_tab_header_12',
444             1624 => 'doc_tab_field_1',
445             1625 => 'doc_tab_field_2',
446             1626 => 'doc_tab_field_3',
447             1627 => 'doc_tab_field_4',
448             1628 => 'doc_tab_field_5',
449             1629 => 'doc_tab_field_6',
450             1630 => 'doc_tab_field_7',
451             1631 => 'doc_tab_field_8',
452             1632 => 'doc_tab_field_9',
453             1633 => 'doc_tab_field_10',
454             1634 => 'doc_tab_field_11',
455             1635 => 'doc_tab_field_12',
456             1636 => 'delivery_area_surcharge',
457             1637 => 'list_delivery_area_surcharge',
458             1638 => 'fuel_surcharge',
459             1639 => 'list_fuel_surcharge',
460             1640 => 'fice_surcharge',
461             1642 => 'value_added_tax',
462             1644 => 'offshore_surcharge',
463             1645 => 'list_offshore_surcharge',
464             1649 => 'other_surcharges',
465             1650 => 'list_other_surcharges',
466             1704 => 'service_type_description',
467             1705 => 'deliver_to',
468             1706 => 'signed_for',
469             1707 => 'delivery_time',
470             1711 => 'status_exception',
471             1713 => 'tracking_cod_flag',
472             1715 => 'number_of_track_activities',
473             1716 => 'delivery_reattempt_date',
474             1717 => 'delivery_reattempt_time',
475             1718 => 'package_type_description',
476             1720 => 'delivery_date_numeric',
477             1721 => 'tracking_activity_line_1',
478             1722 => 'tracking_activity_line_2',
479             1723 => 'tracking_activity_line_3',
480             1724 => 'tracking_activity_line_4',
481             1725 => 'tracking_activity_line_5',
482             1726 => 'tracking_activity_line_6',
483             1727 => 'tracking_activity_line_7',
484             1728 => 'tracking_activity_line_8',
485             1729 => 'tracking_activity_line_9',
486             1730 => 'tracking_activity_line_10',
487             1731 => 'tracking_activity_line_11',
488             1732 => 'tracking_activity_line_12',
489             1733 => 'tracking_activity_line_13',
490             1734 => 'tracking_activity_line_14',
491             1735 => 'tracking_activity_line_15',
492             2254 => 'recipient_fax_number',
493             2382 => 'return_shipment_indicator',
494             3000 => 'cod_type_collection',
495             3001 => 'fedex_ground_purchase_order',
496             3002 => 'fedex_ground_invoice',
497             3003 => 'fedex_ground_customer_reference',
498             3008 => 'autopod_flag',
499             3009 => 'aod_flag',
500             3010 => 'oversize_flag',
501             3011 => 'other_oversize_flag',
502             3018 => 'nonstandard_container_flag',
503             3019 => 'fedex_signature_home_delivery_flag',
504             3020 => 'fedex_home_delivery_type',
505             3023 => 'fedex_home_delivery_date',
506             3024 => 'fedex_home_delivery_phone_number',
507             3025 => 'carrier_code',
508             3028 => 'ground_account_number',
509             3035 => 'ship_alert_fax_number',
510             3045 => 'cod_return_reference_indicator',
511             3046 => 'additional_handling_detected',
512             3053 => 'multiweight_net_charge',
513             3090 => 'last_ground_dropoff',
514             3091 => 'last_ground_dropoff_sat',
515             3092 => 'ground_service_flag',
516             3124 => 'oversize_classification',
517             4003 => 'subscriber_contact_name',
518             4004 => 'subscriber_password_reminder',
519             4007 => 'subscriber_company_name',
520             4008 => 'subscriber_address_line_1',
521             4009 => 'subscriber_address_line_2',
522             4011 => 'subscriber_city_name',
523             4012 => 'subscriber_state_code',
524             4013 => 'subscriber_postal_code',
525             4014 => 'subscriber_country_code',
526             4015 => 'subscriber_phone_number',
527             4017 => 'subscriber_pager_number',
528             4018 => 'subscriber_email_address',
529             4021 => 'subscription_service_name',
530             4022 => 'subscriber_fax_number'
531             };
532             ## Better to reverse this hash when sending data to FedEx
533             our $FE_SE;
534             while (my ($tag, $name) = each %$FE_RE) {
535             if (exists $FE_SE->{$name}) {
536             die "Duplicate value `$name' in %FE_RE";
537             }
538             $FE_SE->{$name} = $tag;
539             }
540              
541             # For each of my hash refs set up a hash which allows only those keys.
542             #
543             # XXX also automatically lower-case the keys
544              
545             for my $name (map { /^%(FE_\w+)/ ? $1 : () } @EXPORT) {
546 1     1   7 no strict 'refs';
  1         2  
  1         531  
547             my $r = ${ $name };
548             tie %$name, 'Tie::StrictHash', %$r;
549             }
550              
551             sub _split_tag {
552 0     0     my ($tag) = @_;
553 0 0         my ($base, $mult) = ($tag =~ /^(.*?)(-[1-9]\d*)?\z/)
554             or croak "Invalid field tag or name `$tag'";
555 0 0         $mult = '' if !defined $mult;
556             #print "[$base] [$mult]";
557              
558 0 0         my $num = ($base =~ /^\d+\z/)
559             ? $base
560             : $FE_SE{lc $base};
561 0           my $name = $FE_RE{$num};
562 0 0         defined $name
563             or croak "Invalid FE_RE `$num'";
564 0           return $num, $name, $mult;
565             }
566              
567             sub field_name_to_tag {
568 0 0   0 1   @_ == 1 or croak "need 1 arg, got ", 0+@_;
569 0           my ($in) = @_;
570              
571 0           my ($num, $name, $mult) = _split_tag $in;
572 0           return "$num$mult";
573             }
574              
575             sub field_tag_to_name {
576 0 0   0 1   @_ == 1 or croak "need 1 arg, got ", 0+@_;
577 0           my ($in) = @_;
578              
579 0           my ($num, $name, $mult) = _split_tag $in;
580 0           return "$name$mult";
581             }
582              
583             sub uti_by_tt_carrier {
584 0 0   0 1   @_ == 2 or croak "need 2 args, got ", 0+@_;
585 0           my ($tt, $carrier) = @_;
586              
587 0   0       return $FE_UTI_BY_TT{$tt}{$carrier}
588             || $FE_UTI_BY_TT{$tt}{''}
589             || croak "UTI for transaction [$tt] carrier [$carrier] unknown";
590             }
591              
592             1;
593             __END__