Add USPS Shipping Driver with tests, and i18n.
Change the Ship, Cart to do exception handling when calling a shipping driver, as that's the message passing interface between the modules. Add a noFormProcess field property that is recognized by processPropertiesFromFormPost.
This commit is contained in:
parent
909c8f62ae
commit
cbdd6077d5
10 changed files with 1209 additions and 18 deletions
|
|
@ -97,12 +97,17 @@ sub getOptions {
|
|||
WebGUI::Error::InvalidParam->throw(error => q{Need a cart.}) unless defined $cart and $cart->isa("WebGUI::Shop::Cart");
|
||||
my $session = $cart->session;
|
||||
my %options = ();
|
||||
foreach my $shipper (@{$self->getShippers()}) {
|
||||
next unless $shipper->get('enabled');
|
||||
SHIPPER: foreach my $shipper (@{$self->getShippers()}) {
|
||||
next SHIPPER unless $shipper->get('enabled');
|
||||
my $price = eval { $shipper->calculate($cart) };
|
||||
if (my $e = WebGUI::Error->caught()) {
|
||||
$self->session->log->warn($e->error);
|
||||
next SHIPPER;
|
||||
}
|
||||
$options{$shipper->getId} = {
|
||||
label => $shipper->get("label"),
|
||||
price => $shipper->calculate($cart),
|
||||
};
|
||||
price => $price,
|
||||
};
|
||||
}
|
||||
return \%options;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue