fix Net::Ikano bug causing invalid response type error messages
authorlevinse <levinse>
Thu, 9 Dec 2010 20:22:16 +0000 (20:22 +0000)
committerlevinse <levinse>
Thu, 9 Dec 2010 20:22:16 +0000 (20:22 +0000)
lib/Net/Ikano.pm

index 40eb7d8..cdf7e39 100644 (file)
@@ -350,18 +350,11 @@ sub AUTOLOAD {
        . $resphash->{FailureResponse}->{FailureMessage} 
        if $resphash->{type} eq 'FAILURE';
 
-    my $validRespTypes = {
-       'PREQUAL' => qw( PREQUAL ),
-       'ORDERSTATUS' => qw( ORDERSTATUS ),
-       'ORDER' => qw( NEWORDER CHANGEORDER CANCELORDER ),
-       'CANCEL' => qw( ORDERCANCEL ),
-       'PASSWORDCHANGE' => qw( PASSWORDCHANGE ),
-       'ACCOUNTSTATUSCHANGE' => qw( ACCOUNTSTATUSCHANGE ),
-       'CUSTOMERLOOKUP' => qw( CUSTOMERLOOKUP ),
-    };
-
     return "invalid response type ".$resphash->{type}." for request type $cmd"
-       unless grep( $_ eq $resphash->{type}, $validRespTypes->{$cmd});
+       unless ( $cmd eq $resphash->{type} 
+               || ($cmd eq 'ORDER' && $resphash->{type} =~ /(NEW|CHANGE|CANCEL)ORDER/ )
+               || ($cmd eq "CANCEL" && $resphash->{type} eq "ORDERCANCEL")
+            );
 
     return $self->$respsub($resphash,$reqhash);
 }