Rework build_subs(), thanks to Michal Schwern, closes: CPAN#22073
authorIvan Kohler <ivan@freeside.biz>
Tue, 25 Feb 2014 08:20:32 +0000 (00:20 -0800)
committerIvan Kohler <ivan@freeside.biz>
Tue, 25 Feb 2014 08:20:32 +0000 (00:20 -0800)
Changes
OnlinePayment.pm

diff --git a/Changes b/Changes
index f3fc130..a0fc2b7 100644 (file)
--- a/Changes
+++ b/Changes
@@ -6,6 +6,7 @@ Revision history for Perl extension Business::OnlinePayment.
         - Document repository moved from CVS to git
         - Add avs_code and cvv2_response to build_subs, they're standard fields
         - Document best-practice eval of the submit() method in example
+        - Rework build_subs(), thanks to Michal Schwern, closes: CPAN#22073
 
 3.02    Fri Aug 19 16:20:04 PDT 2011
         - Fix fatal error calling ->info('supported_actions') on a gateway that
index f8417ba..86551c4 100644 (file)
@@ -6,7 +6,7 @@ use Carp;
 
 require 5.005;
 
-$VERSION = '3.03_01';
+$VERSION = '3.03_02';
 $VERSION = eval $VERSION; # modperlstyle: convert the string into a number
 
 # Remember subclasses we have "wrapped" submit() with _pre_submit()
@@ -37,6 +37,8 @@ my @methods = qw(
     cvv2_response
 );
 
+__PACKAGE__->build_subs(@methods);
+
 #fallback
 sub _info {
   my $class = shift;
@@ -88,7 +90,6 @@ sub new {
     croak("unknown processor $processor ($@)") if $@;
 
     my $self = bless {processor => $processor}, $subclass;
-    $self->build_subs(@methods);
 
     if($self->can("set_defaults")) {
         $self->set_defaults(%data);
@@ -159,7 +160,6 @@ sub _pre_submit {
               unless ( $@ =~ m/^Can\'t locate/ );
         } else {
             my $risk_tx = bless( { processor => $fraud_detection }, $subclass );
-            $risk_tx->build_subs(@methods);
             if ($risk_tx->can('set_defaults')) {
                 $risk_tx->set_defaults();
             }