/
available_www_shipping.coretag
59 lines (55 loc) · 2.1 KB
/
available_www_shipping.coretag
1
2
3
4
5
6
7
8
9
10
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
# Copyright 2002-2007 Interchange Development Group and others
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version. See the LICENSE file for details.
UserTag available_www_shipping Order only
UserTag available_www_shipping Version 1.5
UserTag available_www_shipping Routine <<EOR
sub {
my ($only) = @_;
my $ups;
if(! $only or $only =~ /ups/i) {
eval {
require Business::UPS;
};
$ups = $@ ? 0 : 1;
}
my @ups_modes;
if($ups) {
push @ups_modes,
'1DM' => {type => 'UPS', description => 'Next Day Air Early AM'},
'1DML' => {type => 'UPS', description => 'Next Day Air Early AM Letter'},
'1DA' => {type => 'UPS', description => 'Next Day Air'},
'1DAL' => {type => 'UPS', description => 'Next Day Air Letter'},
'1DP' => {type => 'UPS', description => 'Next Day Air Saver'},
'1DPL' => {type => 'UPS', description => 'Next Day Air Saver Letter'},
'2DM' => {type => 'UPS', description => '2nd Day Air A.M.'},
'2DA' => {type => 'UPS', description => '2nd Day Air'},
'2DML' => {type => 'UPS', description => '2nd Day Air A.M. Letter'},
'2DAL' => {type => 'UPS', description => '2nd Day Air Letter'},
'3DS' => {type => 'UPS', description => '3 Day Select'},
'GNDCOM' => {type => 'UPS', description => 'Ground Commercial'},
'GNDRES' => {type => 'UPS', description => 'Ground Residential'},
'XPR' => {type => 'UPS', description => 'Worldwide Express'},
'XDM' => {type => 'UPS', description => 'Worldwide Express Plus'},
'XPRL' => {type => 'UPS', description => 'Worldwide Express Letter'},
'XDML' => {type => 'UPS', description => 'Worldwide Express Plus Letter'},
'XPD' => {type => 'UPS', description => 'Worldwide Expedited'},
;
}
if (wantarray) {
return @ups_modes;
}
else {
my $out = '';
my $i;
for ($i = 0; $i < @ups_modes; $i += 2) {
my $ref = $ups_modes[$i + 1];
$out .= qq{UPSE:$ups_modes[$i]\t$ref->{type}: $ref->{description}\n};
}
return $out;
}
}
EOR