add the Courier::FixedAU shipping driver.
authorTony Cook <tony@develop-help.com>
Mon, 30 Apr 2012 02:07:06 +0000 (12:07 +1000)
committerTony Cook <tony@develop-help.com>
Mon, 30 Apr 2012 02:07:06 +0000 (12:07 +1000)
Changes.txt
MANIFEST
site/cgi-bin/modules/Courier/FixedAU.pm [new file with mode: 0644]

index 2826290fe8bb0a900d675c9a84abca3094207bf0..17f23851311b8d3fefac1a0d1c668b55b78bbb4c 100644 (file)
@@ -38,6 +38,8 @@ Enhancements:
    and use it to display a thumbnail.
    https://rt4.develop-help.com/Ticket/Display.html?id=1290
 
+ - add the Courier::FixedAU shipping driver.
+
 Templates:
 
  - admin/order_detail.tmpl - the product tag now uses tag_article as
index eeb502cf7a7c26b81bbf3742d82ef9866ec9ddaa..0b16e08c5e90853ec0628111c16fb0501ae32831 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -289,6 +289,7 @@ site/cgi-bin/modules/Courier/AustraliaPost/Standard.pm
 site/cgi-bin/modules/Courier/Fastway.pm
 site/cgi-bin/modules/Courier/Fastway/Road.pm
 site/cgi-bin/modules/Courier/Fastway/Satchel.pm
+site/cgi-bin/modules/Courier/FixedAU.pm
 site/cgi-bin/modules/Courier/Null.pm
 site/cgi-bin/modules/DevHelp/Cfg.pm
 site/cgi-bin/modules/DevHelp/Date.pm
diff --git a/site/cgi-bin/modules/Courier/FixedAU.pm b/site/cgi-bin/modules/Courier/FixedAU.pm
new file mode 100644 (file)
index 0000000..c41250b
--- /dev/null
@@ -0,0 +1,93 @@
+package Courier::FixedAU;
+
+our $VERSION = "1.000";
+
+use strict;
+use Courier;
+
+our @ISA = qw(Courier);
+
+sub _config {
+  my ($self, $key, $def) = @_;
+
+  return $self->{config}->entry("fixed au shipping", $key, $def);
+}
+
+sub name {
+  my ($self) = @_;
+
+  return $self->_config("name", "fixed-au");
+}
+
+sub description {
+  my ($self) = @_;
+
+  return $self->_config("description", "no description set in [fixed au shipping]");
+}
+
+sub can_deliver {
+  my ($self, %opts) = @_;
+
+  return $opts{country} && $opts{country} eq "AU";
+}
+
+sub calculate_shipping {
+  my ($self, %opts) = @_;
+  
+  my $price = $self->_config("price");
+
+  unless (defined $price) {
+    $self->{error} = "No price set in [fixed au shipping]";
+    return;
+  }
+
+  return $price;
+}
+
+1;
+
+=head1 NAME
+
+Courier::FixedAU - fixed price shipping within Australia
+
+=head1 SYNOPSIS
+
+  [shipping]
+  couriers=FixedAU
+
+  [fixed au shipping]
+  description=your description here
+  price=1000
+
+=head1 DESCRIPTION
+
+Courier::FixedAU provides a common fixed price to Australia shipping
+option for BSE.
+
+=head1 CONFIGURATION
+
+Configuration is done within the C<[fixed au shipping]> section:
+
+=over
+
+=item *
+
+name - internal id of the shipper.  Default: C<fixed-au>.  Typically
+does not need to be set.
+
+=item *
+
+description - the description of the shipping option displayed to the
+customer.  Default: "no description set in [fixed au shipping]"
+
+=item *
+
+price - the price in cents to charge for shipping.  Must be set.
+
+=back
+
+=head1 AUTHOR
+
+Tony Cook <tony@develop-help.com>
+
+=cut