Use the correct classes for Exceptions. Use the correct parameter for shipping code.
This commit is contained in:
parent
d55a901e43
commit
86be7f2abc
1 changed files with 4 additions and 3 deletions
|
|
@ -3,6 +3,7 @@ package WebGUI::Shop::ShipDriver::UPS;
|
||||||
use strict;
|
use strict;
|
||||||
use base qw/WebGUI::Shop::ShipDriver/;
|
use base qw/WebGUI::Shop::ShipDriver/;
|
||||||
use WebGUI::Exception;
|
use WebGUI::Exception;
|
||||||
|
use WebGUI::Exception::Shop;
|
||||||
use XML::Simple;
|
use XML::Simple;
|
||||||
use LWP;
|
use LWP;
|
||||||
use Tie::IxHash;
|
use Tie::IxHash;
|
||||||
|
|
@ -85,7 +86,7 @@ sub buildXML {
|
||||||
# RequestOption => [ 'shop' ],
|
# RequestOption => [ 'shop' ],
|
||||||
};
|
};
|
||||||
$xmlRate->{PickupType} = {
|
$xmlRate->{PickupType} = {
|
||||||
Code => [ $self->get('pickupCode') ],
|
Code => [ $self->get('pickupType') ],
|
||||||
};
|
};
|
||||||
$xmlRate->{Shipment} = {
|
$xmlRate->{Shipment} = {
|
||||||
Shipper => {
|
Shipper => {
|
||||||
|
|
@ -193,12 +194,12 @@ sub calculate {
|
||||||
my $response = $self->_doXmlRequest($xml);
|
my $response = $self->_doXmlRequest($xml);
|
||||||
##Error handling
|
##Error handling
|
||||||
if (! $response->is_success) {
|
if (! $response->is_success) {
|
||||||
WebGUI::Error::RemoteShippingRate->throw(error => 'Problem connecting to UPS Web Tools: '. $response->status_line);
|
WebGUI::Error::Shop::RemoteShippingRate->throw(error => 'Problem connecting to UPS Web Tools: '. $response->status_line);
|
||||||
}
|
}
|
||||||
my $returnedXML = $response->content;
|
my $returnedXML = $response->content;
|
||||||
my $xmlData = XMLin($returnedXML, ForceArray => [qw/RatedPackage/]);
|
my $xmlData = XMLin($returnedXML, ForceArray => [qw/RatedPackage/]);
|
||||||
if (! $xmlData->{Response}->{ResponseStatusCode}) {
|
if (! $xmlData->{Response}->{ResponseStatusCode}) {
|
||||||
WebGUI::Error::RemoteShippingRate->throw(error => 'Problem with UPS Online Tools XML: '. $xmlData->{Response}->{Error}->{ErrorDescription});
|
WebGUI::Error::Shop::RemoteShippingRate->throw(error => 'Problem with UPS Online Tools XML: '. $xmlData->{Response}->{Error}->{ErrorDescription});
|
||||||
}
|
}
|
||||||
##Summarize costs from returned data
|
##Summarize costs from returned data
|
||||||
$cost += $self->_calculateFromXML($xmlData);
|
$cost += $self->_calculateFromXML($xmlData);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue