X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=lib%2FNet%2FIkano.pm;h=879e8eed3602f884de2f019984cc10aad16f67f6;hb=7415fc54c1ba7ff6920c6e514490c1e85450dfdb;hp=de409122b4791473666fc529f8f06598b2bb1539;hpb=81afca64157ecbca5ef6bee0a5310ac733200a7c;p=Net-Ikano.git diff --git a/lib/Net/Ikano.pm b/lib/Net/Ikano.pm index de40912..879e8ee 100644 --- a/lib/Net/Ikano.pm +++ b/lib/Net/Ikano.pm @@ -24,6 +24,10 @@ our $SCHEMA_ROOT = 'https://orders.value.net/osiriswebservice/schema/v1'; our $API_VERSION = "1.0"; +our @orderType = qw( NEW CANCEL CHANGE ); + +our @orderStatus = qw( NEW PENDING CANCELLED COMPLETED ERROR ); + our $AUTOLOAD; =head1 SYNOPSIS @@ -34,13 +38,15 @@ our $AUTOLOAD; 'keyid' => $your_ikano_api_keyid, 'password' => $your_ikano_admin_user_password, 'debug' => 1 # remove this for prod - 'reqpreviewonly' => 1 # remove this for prod - 'minimalQualResp' => 1 # on quals, return pairs of ProductCustomId+TermsId only - 'minimalOrderResp' => 1 # return minimal data on order responses - ); - + 'reqpreviewonly' => 1 # remove this for prod + 'minimalQualResp' => 1 # on quals, return pairs of ProductCustomId+TermsId only + 'minimalOrderResp' => 1 # return minimal data on order responses + ); + =head1 SUPPORTED API METHODS +=over 4 + =item ORDER NOTE: supports orders by ProductCustomId only @@ -122,6 +128,8 @@ $ikano->ACCOUNTSTATUSCHANGE(( { DSLServiecId => 123, } ); +=back + =cut sub new { @@ -143,12 +151,10 @@ sub new { sub req_ORDER { my ($self, $args) = (shift, shift); - my @validOrderTypes = qw( NEW CHANGE CANCEL ); - return "invalid order data" unless defined $args->{orderType} && defined $args->{ProductCustomId} && defined $args->{DSLPhoneNumber}; return "invalid order type ".$args->{orderType} - unless grep($_ eq $args->{orderType}, @validOrderTypes); + unless grep($_ eq $args->{orderType}, @orderType); # XXX: rewrite this uglyness? my @ignoreFields = qw( orderType ProductCustomId ); @@ -252,9 +258,10 @@ sub req_PASSWORDCHANGE { sub resp_PASSWORDCHANGE { my ($self, $resphash, $reqhash) = (shift, shift); - return "invalid change password response" - unless defined $resphash->{ChangePasswordResponse}; - return $resphash->{ChangePasswordResponse}; + return "invalid change password response" + unless defined $resphash->{ChangePasswordResponse} + && defined $resphash->{ChangePasswordResponse}->{Customer}; + $resphash->{ChangePasswordResponse}->{Customer}; } sub req_PREQUAL { @@ -278,6 +285,10 @@ sub resp_PREQUAL { return $resphash->{PreQualResponse}; } +sub orderTypes { + @orderType; +} + sub AUTOLOAD { my $self = shift; @@ -321,6 +332,9 @@ sub AUTOLOAD { return "invalid HTTP response from Ikano: " . $resp->status_line unless $resp->is_success; my $respxml = $resp->decoded_content; + + $xs = new Net::Ikano::XMLUtil(RootName => undef, SuppressEmpty => '', + ForceArray => [ 'Address', 'Product', 'StaticIp', 'OrderNotes' ] ); my $resphash = $xs->XMLin($respxml); warn "DEBUG RESPONSE\n\tHASH:\n ".Dumper($resphash)."\n\tXML:\n $respxml"