our $API_VERSION = "1.0";
+our @orderType = qw( NEW CANCEL CHANGE );
+
+our @orderStatus = qw( NEW PENDING CANCELLED COMPLETED ERROR );
+
our $AUTOLOAD;
=head1 SYNOPSIS
'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
DSLServiecId => 123,
} );
+=back
+
=cut
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 );
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 {
return $resphash->{PreQualResponse};
}
+sub orderTypes {
+ @orderType;
+}
+
sub AUTOLOAD {
my $self = shift;
unless $resp->is_success;
my $respxml = $resp->decoded_content;
- $xs = new Net::Ikano::XMLUtil(RootName => undef, SuppressEmpty => '');
+ $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"