Merge commit '41575d24bb' into webgui8. Some tests still failing.
Conflicts: docs/gotcha.txt lib/WebGUI.pm lib/WebGUI/Asset.pm lib/WebGUI/Asset/File/GalleryFile/Photo.pm lib/WebGUI/Asset/Post.pm lib/WebGUI/Asset/Template.pm lib/WebGUI/Asset/WikiPage.pm lib/WebGUI/Asset/Wobject/WikiMaster.pm lib/WebGUI/Cache.pm lib/WebGUI/Content/Setup.pm lib/WebGUI/Role/Asset/Subscribable.pm lib/WebGUI/Shop/Cart.pm lib/WebGUI/Shop/Pay.pm lib/WebGUI/Shop/PayDriver/ITransact.pm sbin/testEnvironment.pl t/Asset/WikiPage.t t/Shop/PayDriver.t t/Shop/PayDriver/ITransact.t t/Shop/PayDriver/Ogone.t t/Shop/TaxDriver/EU.t t/Shop/TaxDriver/Generic.t t/Workflow/Activity/RemoveOldCarts.t t/lib/WebGUI/Test.pm
This commit is contained in:
commit
5febc0ebbc
258 changed files with 5528 additions and 2230 deletions
|
|
@ -100,7 +100,14 @@ sub getDrivers {
|
|||
=head2 getOptions ( $cart )
|
||||
|
||||
Returns a list of options for the user to ship, along with the cost of using each one. It is a hash of hashrefs,
|
||||
with the key of the primary hash being the shipperId of the driver, and sub keys of label and price.
|
||||
with the key of the primary hash being the shipperId of the driver, and sub keys of label, price, and whether the
|
||||
price actually exists, to tell the difference between 0 and unknown.
|
||||
|
||||
{
|
||||
label => 'ShipDriver label',
|
||||
price => \d+,
|
||||
hasPrice => 1 || 0,
|
||||
}
|
||||
|
||||
=head3 $cart
|
||||
|
||||
|
|
@ -115,15 +122,24 @@ sub getOptions {
|
|||
my %options = ();
|
||||
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;
|
||||
}
|
||||
next SHIPPER unless $shipper->canUse;
|
||||
my ($price, $hasPrice);
|
||||
if ($cart->get('shippingAddressId')) {
|
||||
$price = eval { $shipper->calculate($cart) };
|
||||
if (my $e = WebGUI::Error->caught()) {
|
||||
$self->session->log->warn($e->error);
|
||||
next SHIPPER;
|
||||
}
|
||||
$hasPrice = 1;
|
||||
}
|
||||
else {
|
||||
$price = 0;
|
||||
$hasPrice = 0;
|
||||
}
|
||||
$options{$shipper->getId} = {
|
||||
label => $shipper->get("label"),
|
||||
price => $price,
|
||||
label => $shipper->get("label"),
|
||||
price => $price,
|
||||
hasPrice => $hasPrice,
|
||||
};
|
||||
}
|
||||
return \%options;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue