| 1 | #!/usr/bin/perl | ||||||||||||||||||||||||||||||||||||||||||
| 2 | ################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 3 | # | ||||||||||||||||||||||||||||||||||||||||||
| 4 | # Script Name : UPS_XML.pm | ||||||||||||||||||||||||||||||||||||||||||
| 5 | # Version : 1 | ||||||||||||||||||||||||||||||||||||||||||
| 6 | # Company : Down Home Web Design, Inc | ||||||||||||||||||||||||||||||||||||||||||
| 7 | # Author : Duane Hinkley ( duane@dhwd.com ) | ||||||||||||||||||||||||||||||||||||||||||
| 8 | # Website : www.DownHomeWebDesign.com | ||||||||||||||||||||||||||||||||||||||||||
| 9 | # | ||||||||||||||||||||||||||||||||||||||||||
| 10 | # Description: A custom self contained module to calculate UPS rates using the | ||||||||||||||||||||||||||||||||||||||||||
| 11 | # newer XML method. This module properly calulates rates between | ||||||||||||||||||||||||||||||||||||||||||
| 12 | # and within other non-US countries including Canada. | ||||||||||||||||||||||||||||||||||||||||||
| 13 | # | ||||||||||||||||||||||||||||||||||||||||||
| 14 | # Copyright (c) 2003-2004 Down Home Web Design, Inc. All rights reserved. | ||||||||||||||||||||||||||||||||||||||||||
| 15 | # | ||||||||||||||||||||||||||||||||||||||||||
| 16 | # $Header: /home/cvs/interchange_upsxml/lib/Business/Shipping/UPS_XML.pm,v 1.1 2004/06/27 13:59:11 dlhinkley Exp $ | ||||||||||||||||||||||||||||||||||||||||||
| 17 | # | ||||||||||||||||||||||||||||||||||||||||||
| 18 | # $Log: UPS_XML.pm,v $ | ||||||||||||||||||||||||||||||||||||||||||
| 19 | # Revision 1.1 2004/06/27 13:59:11 dlhinkley | ||||||||||||||||||||||||||||||||||||||||||
| 20 | # Rename module | ||||||||||||||||||||||||||||||||||||||||||
| 21 | # | ||||||||||||||||||||||||||||||||||||||||||
| 22 | # Revision 1.6 2004/06/27 13:53:20 dlhinkley | ||||||||||||||||||||||||||||||||||||||||||
| 23 | # Rename module to UPS_XML | ||||||||||||||||||||||||||||||||||||||||||
| 24 | # | ||||||||||||||||||||||||||||||||||||||||||
| 25 | # Revision 1.5 2004/06/16 00:52:45 dlhinkley | ||||||||||||||||||||||||||||||||||||||||||
| 26 | # Clean up docs and add capability of multiple quantity of packages | ||||||||||||||||||||||||||||||||||||||||||
| 27 | # | ||||||||||||||||||||||||||||||||||||||||||
| 28 | # Revision 1.4 2004/06/15 14:56:34 dlhinkley | ||||||||||||||||||||||||||||||||||||||||||
| 29 | # Added sending dimensions for multiple packages | ||||||||||||||||||||||||||||||||||||||||||
| 30 | # | ||||||||||||||||||||||||||||||||||||||||||
| 31 | # Revision 1.3 2004/06/10 02:03:16 dlhinkley | ||||||||||||||||||||||||||||||||||||||||||
| 32 | # Fixed bugs from breaking up code and putting in CPAN format | ||||||||||||||||||||||||||||||||||||||||||
| 33 | # | ||||||||||||||||||||||||||||||||||||||||||
| 34 | # Revision 1.2 2004/06/01 02:48:25 dlhinkley | ||||||||||||||||||||||||||||||||||||||||||
| 35 | # Changes to make work | ||||||||||||||||||||||||||||||||||||||||||
| 36 | # | ||||||||||||||||||||||||||||||||||||||||||
| 37 | # Revision 1.5 2004/05/21 21:28:36 dlhinkley | ||||||||||||||||||||||||||||||||||||||||||
| 38 | # Add Currency | ||||||||||||||||||||||||||||||||||||||||||
| 39 | # | ||||||||||||||||||||||||||||||||||||||||||
| 40 | # Revision 1.4 2004/04/20 01:28:00 dlhinkley | ||||||||||||||||||||||||||||||||||||||||||
| 41 | # Added option for dimensions | ||||||||||||||||||||||||||||||||||||||||||
| 42 | # | ||||||||||||||||||||||||||||||||||||||||||
| 43 | # Revision 1.3 2004/03/14 18:50:31 dlhinkley | ||||||||||||||||||||||||||||||||||||||||||
| 44 | # Working version | ||||||||||||||||||||||||||||||||||||||||||
| 45 | # | ||||||||||||||||||||||||||||||||||||||||||
| 46 | # | ||||||||||||||||||||||||||||||||||||||||||
| 47 | ################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||
| 49 | package Business::Shipping::UPS_XML; | ||||||||||||||||||||||||||||||||||||||||||
| 50 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||
| 52 | 2 | ▶ | use vars qw($VERSION); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||
| 54 | 2 | $VERSION = "0.07"; | |||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||
| 56 | 2 | ▶ | use Net::SSLeay qw(post_https make_form make_headers); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||
| 58 | 2 | ▶ | use Business::Shipping::UPS_XML::Parser; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | my $type = shift; | |||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | my ($userid,$userid_pass,$access_key,$origin_country) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | my $self = {}; | |||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | $self->{'_userid'} = $userid; | |||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | $self->{'_userid_pass'} = $userid_pass; | |||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | $self->{'_access_key'} = $access_key; | |||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | $self->{'_from_country'} = $origin_country; | |||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | $self->{'package_type'} = '02'; | |||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | $self->{'residential'} = "1"; | |||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | $self->{'package_count'} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | bless $self, $type; | |||||||||||||||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | ▶ | sub query_ups { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
query_ups: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | my ($xml) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | my ($page, $response, %reply_headers) = post_https('www.ups.com', '443', '/ups.app/xml/Rate', | |||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||
| 83 | make_headers( | ||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||
| 85 | 'content-type' => 'application/x-www-form-urlencoded', | ||||||||||||||||||||||||||||||||||||||||||
| 86 | ), | ||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||
| 88 | $xml | ||||||||||||||||||||||||||||||||||||||||||
| 89 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | return ($page,$response); | |||||||||||||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | ▶ | sub set_dimensions { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_dimensions: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | my ( $width, $height, $length, $unit_of_measure, $weight) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | $self->{'package_count'}++; | |||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | $self->{'length'}->[ $self->{'package_count'} ] = $length; | |||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | $self->{'width'}->[ $self->{'package_count'} ] = $width; | |||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | $self->{'height'}->[ $self->{'package_count'} ] = $height; | |||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | $self->{'unit_of_measure'}->[ $self->{'package_count'} ] = $unit_of_measure; | |||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | $self->{'weight'}->[ $self->{'package_count'} ] = $weight; | |||||||||||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | ▶ | sub clr_dimensions { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clr_dimensions: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | $self->{'length'} = undef; | |||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | $self->{'width'} = undef; | |||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | $self->{'height'} = undef; | |||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | $self->{'unit_of_measure'} = undef; | |||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | $self->{'package_count'} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | ▶ | sub getUPS { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getUPS: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | my ( $service_code, $from_zip, $to_zip, $to_country, $weight) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | my $access_key = $self->{'_access_key'}; | |||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | my $userid = $self->{'_userid'}; | |||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | my $userid_pass = $self->{'_userid_pass'}; | |||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | my $from_country = $self->{'_from_country'}; | |||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | my $package_type = $self->{'package_type'}; | |||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | my $residential = $self->{'residential'}; | |||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | $self->{'single_weight'} = $weight; | |||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | my $error = ""; | |||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | my $maxcost; | |||||||||||||||||||||||||||||||||||||||||
| 130 | my $response; | ||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | my $zone; | |||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | my $x; | |||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | my $currency; | |||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | $self->{'send_xml'} = undef; | |||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | $self->{'rcv_xml'} = undef; | |||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | my $xml = "<?xml version=\"1.0\"?> | |||||||||||||||||||||||||||||||||||||||||
| 141 | <AccessRequest xml:lang=\"en-US\"> | ||||||||||||||||||||||||||||||||||||||||||
| 142 | <AccessLicenseNumber>$access_key</AccessLicenseNumber> | ||||||||||||||||||||||||||||||||||||||||||
| 143 | <UserId>$userid</UserId> | ||||||||||||||||||||||||||||||||||||||||||
| 144 | <Password>$userid_pass</Password> | ||||||||||||||||||||||||||||||||||||||||||
| 145 | </AccessRequest> | ||||||||||||||||||||||||||||||||||||||||||
| 146 | <?xml version=\"1.0\"?> | ||||||||||||||||||||||||||||||||||||||||||
| 147 | <RatingServiceSelectionRequest xml:lang=\"en-US\"> | ||||||||||||||||||||||||||||||||||||||||||
| 148 | <Request> | ||||||||||||||||||||||||||||||||||||||||||
| 149 | <TransactionReference> | ||||||||||||||||||||||||||||||||||||||||||
| 150 | <CustomerContext>Rating and Service</CustomerContext> | ||||||||||||||||||||||||||||||||||||||||||
| 151 | <XpciVersion>1.0001</XpciVersion> | ||||||||||||||||||||||||||||||||||||||||||
| 152 | </TransactionReference> | ||||||||||||||||||||||||||||||||||||||||||
| 153 | <RequestAction>Rate</RequestAction> | ||||||||||||||||||||||||||||||||||||||||||
| 154 | <RequestOption>Rate</RequestOption> | ||||||||||||||||||||||||||||||||||||||||||
| 155 | </Request> | ||||||||||||||||||||||||||||||||||||||||||
| 156 | <PickupType> | ||||||||||||||||||||||||||||||||||||||||||
| 157 | <Code>01</Code> | ||||||||||||||||||||||||||||||||||||||||||
| 158 | </PickupType> | ||||||||||||||||||||||||||||||||||||||||||
| 159 | <Shipment> | ||||||||||||||||||||||||||||||||||||||||||
| 160 | <Shipper> | ||||||||||||||||||||||||||||||||||||||||||
| 161 | <Address> | ||||||||||||||||||||||||||||||||||||||||||
| 162 | <StateProvinceCode></StateProvinceCode> | ||||||||||||||||||||||||||||||||||||||||||
| 163 | <PostalCode>$from_zip</PostalCode> | ||||||||||||||||||||||||||||||||||||||||||
| 164 | <CountryCode>$from_country</CountryCode> | ||||||||||||||||||||||||||||||||||||||||||
| 165 | </Address> | ||||||||||||||||||||||||||||||||||||||||||
| 166 | </Shipper> | ||||||||||||||||||||||||||||||||||||||||||
| 167 | <ShipTo> | ||||||||||||||||||||||||||||||||||||||||||
| 168 | <Address> | ||||||||||||||||||||||||||||||||||||||||||
| 169 | <StateProvinceCode></StateProvinceCode> | ||||||||||||||||||||||||||||||||||||||||||
| 170 | <PostalCode>$to_zip</PostalCode> | ||||||||||||||||||||||||||||||||||||||||||
| 171 | <CountryCode>$to_country</CountryCode> | ||||||||||||||||||||||||||||||||||||||||||
| 172 | <ResidentialAddressIndicator>$residential</ResidentialAddressIndicator> | ||||||||||||||||||||||||||||||||||||||||||
| 173 | </Address> | ||||||||||||||||||||||||||||||||||||||||||
| 174 | </ShipTo> | ||||||||||||||||||||||||||||||||||||||||||
| 175 | <Service> | ||||||||||||||||||||||||||||||||||||||||||
| 176 | <Code>$service_code</Code> | ||||||||||||||||||||||||||||||||||||||||||
| 177 | </Service> | ||||||||||||||||||||||||||||||||||||||||||
| 178 | " . $self->_packages() . " | ||||||||||||||||||||||||||||||||||||||||||
| 179 | <ShipmentServiceOptions/> | ||||||||||||||||||||||||||||||||||||||||||
| 180 | </Shipment> | ||||||||||||||||||||||||||||||||||||||||||
| 181 | </RatingServiceSelectionRequest>"; | ||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||
| 183 | #print "$xml\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | $self->{'send_xml'} = $xml; | |||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | ($xml,$response) = $self->query_ups($xml); | |||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | $self->{'rcv_xml'} = $xml; | |||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||
| 189 | #print "$response\n\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | $x = new Business::Shipping::UPS_XML::Parser($xml); | |||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | $x->parse(); | |||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | my ($method,$return,$status) = split(/ /,$response); | |||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||
| 196 | # Check for error | ||||||||||||||||||||||||||||||||||||||||||
| 197 | # | ||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | ▶ | if ( $return ne "200" ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | $error = "HTML $return '$response'"; | |||||||||||||||||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||||||||||||||||
| 202 | elsif ( $x->{'RatingServiceSelectionResponse'}->{'Response'}->{'ResponseStatusDescription'} eq 'Failure' ) { | ||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | $error = "UPS XML Error: " . $x->{'RatingServiceSelectionResponse'}->{'Response'}->{'Error'}->{'ErrorDescription'}; | |||||||||||||||||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||||||||||||||||
| 206 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | $maxcost = $x->{'RatingServiceSelectionResponse'}->{'RatedShipment'}->{'TotalCharges'}->{'MonetaryValue'}; | |||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | $currency = $x->{'RatingServiceSelectionResponse'}->{'RatedShipment'}->{'TotalCharges'}->{'CurrencyCode'}; | |||||||||||||||||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | $self->clr_dimensions(); | |||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | return ($maxcost, $zone, $error,$currency); | |||||||||||||||||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | ▶ | sub _packages { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_packages: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | my $xml; | |||||||||||||||||||||||||||||||||||||||||
| 220 | my $l; | ||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||
| 222 | # Do packages with dimensions | ||||||||||||||||||||||||||||||||||||||||||
| 223 | # | ||||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | ▶ | if ( $self->{'package_count'} > 0 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | ▶ | for ($l = 1; $l <= $self->{'package_count'}; $l++) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||
| 229 | $xml .= " | ||||||||||||||||||||||||||||||||||||||||||
| 230 | <Package> | ||||||||||||||||||||||||||||||||||||||||||
| 231 | <PackagingType> | ||||||||||||||||||||||||||||||||||||||||||
| 232 | 0 | <Code>" . $self->{'package_type'} . "</Code> | |||||||||||||||||||||||||||||||||||||||||
| 233 | <Description>Package</Description> | ||||||||||||||||||||||||||||||||||||||||||
| 234 | </PackagingType>"; | ||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | ▶ | if ( $self->{'length'}->[ $l ] && $self->{'width'}->[ $l ] && $self->{'height'}->[ $l ] ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$self->{"length"}[$l] and $self->{"width"}[$l] and $self->{"height"}[$l]
$self->{"length"}[$l] and $self->{"width"}[$l]
MC/DC0%0/3
$self->{"length"}[$l] and $self->{"width"}[$l] and $self->{"height"}[$l]
$self->{"length"}[$l]
$self->{"width"}[$l]
$self->{"height"}[$l]
Truth table0%0/4
A and B and C
A= $self->{"length"}[$l]B= $self->{"width"}[$l]C= $self->{"height"}[$l]
| |||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||
| 238 | $xml .= " | ||||||||||||||||||||||||||||||||||||||||||
| 239 | <Dimensions> | ||||||||||||||||||||||||||||||||||||||||||
| 240 | <UnitOfMeasurement> | ||||||||||||||||||||||||||||||||||||||||||
| 241 | <Code>" . $self->{'unit_of_measure'}->[ $l ] . "</Code> | ||||||||||||||||||||||||||||||||||||||||||
| 242 | </UnitOfMeasurement> | ||||||||||||||||||||||||||||||||||||||||||
| 243 | <Length>" . $self->{'length'}->[ $l ] . "</Length> | ||||||||||||||||||||||||||||||||||||||||||
| 244 | <Width>" . $self->{'width'}->[ $l ] . "</Width> | ||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | <Height>" . $self->{'height'}->[ $l ] . "</Height> | |||||||||||||||||||||||||||||||||||||||||
| 246 | </Dimensions>"; | ||||||||||||||||||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | $xml .= " | |||||||||||||||||||||||||||||||||||||||||
| 250 | <Description>Rate Shopping</Description>"; | ||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | ▶ | if ( $self->{'weight'}->[ $l ] ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||
| 254 | $xml .= " | ||||||||||||||||||||||||||||||||||||||||||
| 255 | <PackageWeight> | ||||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | <Weight>". $self->{'weight'}->[ $l ] . "</Weight> | |||||||||||||||||||||||||||||||||||||||||
| 257 | </PackageWeight>"; | ||||||||||||||||||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | $xml .= " | |||||||||||||||||||||||||||||||||||||||||
| 261 | </Package> | ||||||||||||||||||||||||||||||||||||||||||
| 262 | "; | ||||||||||||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||||||||||
| 264 | } | ||||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||
| 266 | } | ||||||||||||||||||||||||||||||||||||||||||
| 267 | else { # A single package no dimensions | ||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||
| 269 | $xml .= " | ||||||||||||||||||||||||||||||||||||||||||
| 270 | <Package> | ||||||||||||||||||||||||||||||||||||||||||
| 271 | <PackagingType> | ||||||||||||||||||||||||||||||||||||||||||
| 272 | 0 | <Code>" . $self->{'package_type'} . "</Code> | |||||||||||||||||||||||||||||||||||||||||
| 273 | <Description>Package</Description> | ||||||||||||||||||||||||||||||||||||||||||
| 274 | </PackagingType>"; | ||||||||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | $xml .= " | |||||||||||||||||||||||||||||||||||||||||
| 277 | <Description>Rate Shopping</Description>"; | ||||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||
| 279 | 0 | ▶ | if ( $self->{'single_weight'} > 0 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||
| 281 | $xml .= " | ||||||||||||||||||||||||||||||||||||||||||
| 282 | <PackageWeight> | ||||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | <Weight>". $self->{'single_weight'} . "</Weight> | |||||||||||||||||||||||||||||||||||||||||
| 284 | </PackageWeight>"; | ||||||||||||||||||||||||||||||||||||||||||
| 285 | } | ||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | $xml .= " | |||||||||||||||||||||||||||||||||||||||||
| 288 | </Package> | ||||||||||||||||||||||||||||||||||||||||||
| 289 | "; | ||||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||
| 291 | } | ||||||||||||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||||||||||||
| 293 | 0 | return $xml; | |||||||||||||||||||||||||||||||||||||||||
| 294 | } | ||||||||||||||||||||||||||||||||||||||||||
| 295 | 0 | ▶ | sub send_xml { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
send_xml: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||||||||
| 297 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||||||||||||||||
| 299 | 0 | return $self->{'send_xml'}; | |||||||||||||||||||||||||||||||||||||||||
| 300 | } | ||||||||||||||||||||||||||||||||||||||||||
| 301 | 0 | ▶ | sub rcv_xml { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rcv_xml: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||||||||||||
| 303 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||
| 305 | 0 | return $self->{'rcv_xml'}; | |||||||||||||||||||||||||||||||||||||||||
| 306 | } | ||||||||||||||||||||||||||||||||||||||||||
| 307 | #########################################################################################33 | ||||||||||||||||||||||||||||||||||||||||||
| 308 | # End of class | ||||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||
| 310 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 311 | __END__ | ||||||||||||||||||||||||||||||||||||||||||