PageRenderTime 53ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/includes/fedex/fedex-tags.php

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