1 package FS::part_export::infostreet;
6 @ISA = qw(FS::part_export);
11 my( $self, $svc_acct ) = (shift, shift);
12 $self->infostreet_queue( $svc_acct->svcnum,
13 'createUser', $svc_acct->username, $svc_acct->_password );
17 my( $self, $new, $old ) = (shift, shift, shift);
18 return "can't change username with InfoStreet"
19 if $old->username ne $new->username;
20 return '' unless $old->_password ne $new->_password;
21 $self->infostreet_queue( $new->svcnum,
22 'passwd', $new->username, $new->_password );
26 my( $self, $svc_acct ) = (shift, shift);
27 $self->infostreet_queue( $svc_acct->svcnum,
28 'purgeAccount,releaseUsername', $svc_acct->username );
31 sub infostreet_queue {
32 my( $self, $svcnum, $method ) = (shift, shift, shift);
33 my $queue = new FS::queue {
35 'job' => 'FS::part_export::infostreet::infostreet_command',
39 $self->option('login'),
40 $self->option('password'),
41 $self->option('groupID'),
47 sub infostreet_command { #subroutine, not method
48 my($url, $username, $password, $groupID, $method, @args) = @_;
51 if ( $method =~ /,/ ) {
52 foreach my $part ( split(/,\s*/, $method) ) {
53 infostreet_command($url, $username, $password, $groupID, $part, @args);
58 eval "use Frontier::Client;";
60 my $conn = Frontier::Client->new( url => $url );
61 my $key_result = $conn->call( 'authenticate', $username, $password, $groupID);
62 my %key_result = _infostreet_parse($key_result);
63 die $key_result{error} unless $key_result{success};
64 my $key = $key_result{data};
66 #my $result = $conn->call($method, $key, @args);
67 my $result = $conn->call($method, $key, map { $conn->string($_) } @args);
68 my %result = _infostreet_parse($result);
69 die $result{error} unless $result{success};
73 sub _infostreet_parse { #subroutine, not method
76 my $value = $arg->{$_};
78 $value = $value->value()
79 if ref($value) && $value->isa('Frontier::RPC2::DataType');