-rename qual export sub to part_export, RT7111
[freeside.git] / FS / FS / part_export / ikano.pm
1 package FS::part_export::ikano;
2
3 use strict;
4 use warnings;
5 use vars qw(@ISA %info %loopType $me);
6 use Tie::IxHash;
7 use Date::Format qw( time2str );
8 use Date::Parse qw( str2time );
9 use FS::Record qw(qsearch qsearchs dbh);
10 use FS::part_export;
11 use FS::svc_dsl;
12 use Data::Dumper;
13
14 @ISA = qw(FS::part_export);
15 $me= '[' .  __PACKAGE__ . ']';
16
17 tie my %options, 'Tie::IxHash',
18   'keyid'         => { label=>'Ikano keyid' },
19   'username'      => { label=>'Ikano username',
20                         default => 'admin',
21                         },
22   'password'      => { label=>'Ikano password' },
23   'check_networks' => { label => 'Check Networks',
24                     default => 'ATT,BELLCA',
25                     },
26   'debug' => { label => 'Debug Mode',  type => 'checkbox' },
27 ;
28
29 %info = (
30   'svc'     => 'svc_dsl',
31   'desc'    => 'Provision DSL to Ikano',
32   'options' => \%options,
33   'notes'   => <<'END'
34 Requires installation of
35 <a href="http://search.cpan.org/dist/Net-Ikano">Net::Ikano</a> from CPAN.
36 END
37 );
38     
39 %loopType = ( '' => 'Line-share', '0' => 'Standalone' );
40
41 sub rebless { shift; }
42
43 sub external_pkg_map { 1; }
44
45 sub dsl_pull {
46 # we distinguish between invalid new data (return error) versus data that
47 # has legitimately changed (may eventually execute hooks; now just update)
48 # if we do add hooks later, we should work on a copy of svc_dsl and pass
49 # the old and new svc_dsl to the hooks so they know what changed
50 #
51 # current assumptions of what won't change (from their side):
52 # vendor_order_id, vendor_qual_id, vendor_order_type, pushed, monitored,
53 # last_pull, address (from qual), contact info, ProductCustomId
54     my($self, $svc_dsl, $threshold) = (shift, shift, shift);
55     $self->loadmod;
56     my $result = $self->valid_order($svc_dsl,'pull');
57     return $result unless $result eq '';
58
59     my $now = time;
60     if($now - $svc_dsl->last_pull < $threshold) {
61         warn "$me skipping pull since threshold not reached (svcnum="
62             . $svc_dsl->svcnum . ",now=$now,threshold=$threshold,last_pull="
63             . $svc_dsl->last_pull .")" if $self->option('debug');
64         return '';
65     }
66   
67     $result = $self->ikano_command('ORDERSTATUS', 
68         { OrderId => $svc_dsl->vendor_order_id } ); 
69     return $result unless ref($result); # scalar (string) is an error
70
71     # now we're getting an OrderResponse which should have one Order in it
72     warn "$me pull OrderResponse hash:\n".Dumper($result) 
73         if $self->option('debug');
74   
75     return 'Invalid order response' unless defined $result->{'Order'};
76     $result = $result->{'Order'};
77
78     return 'No order id or status returned' 
79         unless defined $result->{'Status'} && defined $result->{'OrderId'};
80         
81     local $SIG{HUP} = 'IGNORE';
82     local $SIG{INT} = 'IGNORE';
83     local $SIG{QUIT} = 'IGNORE';
84     local $SIG{TERM} = 'IGNORE';
85     local $SIG{TSTP} = 'IGNORE';
86     local $SIG{PIPE} = 'IGNORE';
87
88     my $oldAutoCommit = $FS::UID::AutoCommit;
89     local $FS::UID::AutoCommit = 0;
90     my $dbh = dbh;
91
92     # 1. status 
93     my $order_status = grep($_ eq $result->{'Status'}, @Net::Ikano::orderStatus)
94                             ? $result->{'Status'} : '';
95     return 'Invalid new status' if $order_status eq '';
96     $svc_dsl->vendor_order_status($order_status) 
97         if($svc_dsl->vendor_order_status ne $order_status);
98     $svc_dsl->monitored('') 
99             if ($order_status eq 'CANCELLED' || $order_status eq 'COMPLETED');
100
101     # 2. fields we don't care much about
102     my %justUpdate = ( 'first' => 'FirstName',
103                     'last' => 'LastName',
104                     'company' => 'CompanyName',
105                     'username' => 'Username',
106                     'password' => 'Password' );
107
108     my($fsf, $ikanof);
109     while (($fsf, $ikanof) = each %justUpdate) {
110        $svc_dsl->$fsf($result->{$ikanof}) 
111             if $result->{$ikanof} ne $svc_dsl->$fsf;
112     }
113
114     # let's look inside the <Product> response element
115     my @product = $result->{'Product'}; 
116     return 'Invalid number of products on order' if scalar(@product) != 1;
117     my $product = $result->{'Product'}[0];
118
119     # 3. phonenum 
120     if($svc_dsl->loop_type eq '') { # line-share
121 # TN may change only if sub changes it and New or Change order in Completed status
122         my $tn = $product->{'PhoneNumber'};
123         if($tn ne $svc_dsl->phonenum) {
124             if( ($svc_dsl->vendor_order_type eq 'NEW' 
125                 || $svc_dsl->vendor_order_type eq 'CHANGE')
126                && $svc_dsl->vendor_order_status eq 'COMPLETED' ) {
127                 $svc_dsl->phonenum($tn);
128             }
129             else { return 'TN has changed in an invalid state'; }
130         }
131     }
132     elsif($svc_dsl->loop_type eq '0') { # dry loop
133 # TN may change only if it's assigned while a New or Change order is in progress
134         return 'Invalid PhoneNumber value for a dry loop' 
135             if $product->{'PhoneNumber'} ne 'STANDALONE';
136         my $tn = $product->{'VirtualPhoneNumber'};
137         if($tn ne $svc_dsl->phonenum) {
138             if( ($svc_dsl->vendor_order_type eq 'NEW' 
139                 || $svc_dsl->vendor_order_type eq 'CHANGE')
140               && $svc_dsl->vendor_order_status ne 'COMPLETED'
141               && $svc_dsl->vendor_order_status ne 'CANCELLED') {
142                 $svc_dsl->phonenum($tn);
143             }
144             else { return 'TN has changed in an invalid state'; }
145         }
146     }
147     
148     # 4. desired_due_date - may change if manually changed
149     if($svc_dsl->vendor_order_type eq 'NEW' 
150             || $svc_dsl->vendor_order_type eq 'CHANGE'){
151         my $f = str2time($product->{'DateToOrder'});
152         return 'Invalid DateToOrder' unless $f;
153         $svc_dsl->desired_due_date($f) if $svc_dsl->desired_due_date ne $f;
154         # XXX: optionally sync back to start_date or whatever... 
155     }
156     elsif($svc_dsl->vendor_order_type eq 'CANCEL'){
157         my $f = str2time($product->{'DateToDisconnect'});
158         return 'Invalid DateToDisconnect' unless $f;
159         $svc_dsl->desired_due_date($f) if $svc_dsl->desired_due_date ne $f;
160         # XXX: optionally sync back to expire or whatever... 
161     }
162
163     # 5. due_date
164     if($svc_dsl->vendor_order_type eq 'NEW' 
165           || $svc_dsl->vendor_order_type eq 'CHANGE') {
166         my $f = str2time($product->{'ActivationDate'});
167         if($svc_dsl->vendor_order_status ne 'NEW'
168             && $svc_dsl->vendor_order_status ne 'CANCELLED') {
169             return 'Invalid ActivationDate' unless $f;
170             $svc_dsl->due_date($f) if $svc_dsl->due_date ne $f;
171         }
172     }
173     # Ikano API does not implement the proper disconnect date,
174     # so we can't do anything about it
175
176     # 6. staticips - for now just comma-separate them
177     my $tstatics = $result->{'StaticIps'};
178     my @istatics = defined $tstatics ? @$tstatics : ();
179     my $ostatics = $svc_dsl->staticips;
180     my @ostatics = split(',',$ostatics);
181     # more horrible search/sync code below...
182     my $staticsChanged = 0;
183     foreach my $istatic ( @istatics ) { # they have, we don't
184         unless ( grep($_ eq $istatic, @ostatics) ) {
185             push @ostatics, $istatic;
186             $staticsChanged = 1;
187         }
188     }
189     for(my $i=0; $i < scalar(@ostatics); $i++) {
190         unless ( grep($_ eq $ostatics[$i], @istatics) ) {
191             splice(@ostatics,$i,1);
192             $i--;
193             $staticsChanged = 1;
194         }
195     }
196     $svc_dsl->staticips(join(',',@ostatics)) if $staticsChanged;
197
198     # 7. notes - put them into the common format and compare
199     my $tnotes = $result->{'OrderNotes'}; 
200     my @tnotes = defined $tnotes ? @$tnotes : ();
201     my @inotes = (); # all Ikano OrderNotes as FS::dsl_note objects
202     my $notesChanged = 0; 
203     foreach my $tnote ( @tnotes ) {
204         my $inote = $self->ikano2fsnote($tnote,$svc_dsl->svcnum);
205         return 'Cannot parse note' unless ref($inote);
206         push @inotes, $inote;
207     }
208     my @onotes = $svc_dsl->notes;
209     # assume notes we already have don't change & no notes added from our side
210     # so using the horrible code below just find what we're missing and add it
211     my $error;
212     foreach my $inote ( @inotes ) {
213         my $found = 0;
214         foreach my $onote ( @onotes ) {
215             if($onote->date == $inote->date && $onote->note eq $inote->note) {
216                 $found = 1;
217                 last;
218             }
219         }
220         $error = $inote->insert unless ( $found );
221         if ( $error ) {
222           $dbh->rollback if $oldAutoCommit;
223           return "Cannot add note: $error";
224         }
225     }
226     
227     $svc_dsl->last_pull((time));
228     local $FS::svc_Common::noexport_hack = 1;
229     $error = $svc_dsl->replace; 
230     if ( $error ) {
231       $dbh->rollback if $oldAutoCommit;
232       return "Cannot update DSL data: $error";
233     }
234
235     $dbh->commit or die $dbh->errstr if $oldAutoCommit;
236
237     '';
238 }
239
240 sub ikano2fsnote {
241     my($self,$n,$svcnum) = (shift,shift,shift);
242     my @ikanoRequired = qw( HighPriority StaffId Date Text CompanyStaffId );
243     return '' unless defined $n->{'HighPriority'}
244                 && defined $n->{'StaffId'}
245                 && defined $n->{'CompanyStaffId'}
246                 && defined $n->{'Date'}
247                 && defined $n->{'Text'}
248                 ;
249     my $by = 'Unknown';
250     $by = "Ikano" if $n->{'CompanyStaffId'} == -1 && $n->{'StaffId'} != -1;
251     $by = "Us" if $n->{'StaffId'} == -1 && $n->{'CompanyStaffId'} != -1;
252
253     new FS::dsl_note( {
254         'svcnum' => $svcnum,
255         'author' => $by,
256         'priority' => $n->{'HighPriority'} eq 'false' ? 'N' : 'H',
257         '_date' => int(str2time($n->{'Date'})),
258         'note' => $n->{'Text'},
259      } );
260 }
261
262 sub qual {
263     my($self,$qual) = (shift,shift);
264 # address always required for Ikano qual, TN optional (assume dry if not given)
265
266     my %location_hash = $qual->location; 
267     return 'No address provided' unless %location_hash;
268     my $svctn = $qual->phonenum;
269
270     my $result = $self->ikano_command('PREQUAL',
271       { AddressLine1 => $location_hash{address1},
272         AddressUnitType => $location_hash{location_type},
273         AddressUnitValue => $location_hash{location_number},
274         AddressCity => $location_hash{city},
275         AddressState => $location_hash{state},
276         ZipCode => $location_hash{zip},
277         Country => $location_hash{country},
278         LocationType => $location_hash{location_kind},
279         PhoneNumber => length($svctn) > 1 ? $svctn : "STANDALONE",
280         RequestClientIP => '127.0.0.1',
281         CheckNetworks => $self->option('check_networks'),
282       } ); 
283     return $result unless ref($result); # error case
284     return 'Invalid prequal response' unless defined $result->{'PrequalId'};
285
286     my $qoptions = {};
287     # lame data structure traversal...
288     # don't spend much time here, just get TermsId and ProductCustomId
289     my $networks = $result->{'Network'};
290     my @networks = defined $networks ? @$networks : ();
291     my $netcount = 0;
292     foreach my $network ( @networks ) { 
293         my $productgroups = $network->{'ProductGroup'};
294         my @productgroups = defined $productgroups ? @$productgroups : ();
295         my $pgcount = 0;
296         foreach my $productgroup ( @productgroups ) {
297             my $prefix = "ikano_Network_$netcount"."_ProductGroup_$pgcount"."_";
298             $qoptions->{$prefix."TermsId"} = $productgroup->{'TermsId'};
299             my $products = $productgroup->{'Product'};
300             my @products = defined $products ? @$products : ();
301             my $prodcount = 0;
302             foreach my $product ( @products ) {
303                 $qoptions->{$prefix."Product_$prodcount"."_ProductCustomId"} = $product->{'ProductCustomId'};
304                 $prodcount++;
305             }
306             $pgcount++;
307         }
308         $netcount++;
309     }
310
311     {   'vendor_qual_id' => $result->{'PrequalId'},
312         'status' => scalar(@networks) ? 'Q' : 'D',
313         'options' => $qoptions,
314     };
315 }
316
317 sub qual_html {
318     my($self,$qual) = (shift,shift);
319     
320     my %qual_options = $qual->options;
321     my @externalids = ();
322     my( $optionname, $optionvalue );
323     while (($optionname, $optionvalue) = each %qual_options) {
324         push @externalids, $optionvalue 
325             if ( $optionname =~ /^ikano_Network_(\d+)_ProductGroup_(\d+)_Product_(\d+)_ProductCustomId$/
326                 && $optionvalue ne '' );
327     }
328
329     # XXX: eventually perhaps this should return both the packages a link to
330     # order each package and go to the svc prov with the prequal id filled in
331     # but only if cust, not prospect!
332     my $list = "<B>Qualifying Packages:</B><UL>";
333     my @part_pkgs = qsearch( 'part_pkg', { 'disabled' => '' } );
334     foreach my $part_pkg ( @part_pkgs ) {
335         my $externalid = $part_pkg->option('externalid',1);
336         if ( $externalid ) {
337             $list .= "<LI>".$part_pkg->pkgpart.": ".$part_pkg->pkg." - "
338                 .$part_pkg->comment."</LI>" 
339               if grep( $_ eq $externalid, @externalids );
340         }
341     }
342     $list .= "</UL>";
343     $list;
344 }
345
346 sub notes_html { 
347     my($self,$svc_dsl) = (shift,shift);
348     my $conf = new FS::Conf;
349     my $date_format = $conf->config('date_format') || '%m/%d/%Y';
350     my @notes = $svc_dsl->notes;
351     my $html = '<TABLE border="1" cellspacing="2" cellpadding="2" id="dsl_notes">
352         <TR><TH>Date</TH><TH>By</TH><TH>Priority</TH><TH>Note</TH></TR>';
353     foreach my $note ( @notes ) {
354         $html .= "<TR>
355             <TD>".time2str("$date_format %H:%M",$note->date)."</TD>
356             <TD>".$note->by."</TD>
357             <TD>". ($note->priority eq 'N' ? 'Normal' : 'High') ."</TD>
358             <TD>".$note->note."</TD></TR>";
359     }
360     $html .= '</TABLE>';
361     $html;
362 }
363
364 sub loop_type_long { # sub, not a method
365     my($svc_dsl) = (shift);
366     return $loopType{$svc_dsl->loop_type};
367 }
368
369 sub ikano_command {
370   my( $self, $command, $args ) = @_;
371
372   $self->loadmod;
373
374   my $ikano = Net::Ikano->new(
375     'keyid' => $self->option('keyid'),
376     'username'  => $self->option('username'),
377     'password'  => $self->option('password'),
378     'debug'    => $self->option('debug'),
379   );
380
381   $ikano->$command($args);
382 }
383
384 sub loadmod {
385   eval "use Net::Ikano;";
386   die $@ if $@;
387 }
388
389 sub valid_order {
390   my( $self, $svc_dsl, $action ) = (shift, shift, shift);
391  
392   $self->loadmod;
393   
394   warn "$me valid_order action=$action svc_dsl:\n". Dumper($svc_dsl)
395         if $self->option('debug');
396
397   # common to all order types/status/loop_type
398   my $error = !($svc_dsl->desired_due_date
399             &&  grep($_ eq $svc_dsl->vendor_order_type, Net::Ikano->orderTypes)
400             &&  $svc_dsl->first
401             &&  $svc_dsl->last
402             &&  defined $svc_dsl->loop_type
403             &&  $svc_dsl->vendor_qual_id
404             );
405   return 'Missing or invalid order data' if $error;
406   
407   return 'Package does not have an external id configured'
408     if $svc_dsl->cust_svc->cust_pkg->part_pkg->options('externalid',1) eq '';
409
410   return 'No valid qualification for this order' 
411     unless qsearch( 'qual', { 'vendor_qual_id' => $svc_dsl->vendor_qual_id });
412
413   # now go by order type
414   # weird ifs & long lines for readability and ease of understanding - don't change
415   if($svc_dsl->vendor_order_type eq 'NEW') {
416     if($svc_dsl->pushed) {
417         $error = !( ($action eq 'pull' || $action eq 'statuschg' 
418                         || $action eq 'delete')
419             &&  length($svc_dsl->vendor_order_id) > 0
420             &&  length($svc_dsl->vendor_order_status) > 0
421                 );
422         return 'Invalid order data' if $error;
423
424         return 'Phone number required for status change'
425             if ($action eq 'statuschg' && length($svc_dsl->phonenum) < 1);
426     }
427     else { # unpushed New order - cannot do anything other than push it
428         $error = !($action eq 'insert'
429             &&  length($svc_dsl->vendor_order_id) < 1
430             &&  length($svc_dsl->vendor_order_status) < 1
431             && ( ($svc_dsl->phonenum eq '' && $svc_dsl->loop_type eq '0') # dry
432               || ($svc_dsl->phonenum ne '' && $svc_dsl->loop_type eq '') # line-share
433                )
434             );  
435         return 'Invalid order data' if $error;
436     }
437   }
438   elsif($svc_dsl->vendor_order_type eq 'CANCEL') {
439   }
440   elsif($svc_dsl->vendor_order_type eq 'CHANGE') {
441   }
442
443  '';
444 }
445
446 sub qual2termsid {
447     my ($self,$vendor_qual_id,$ProductCustomId) = (shift,shift,shift);
448     my $qual = qsearchs( 'qual', { 'vendor_qual_id' => $vendor_qual_id });
449     return '' unless $qual;
450     my %qual_options = $qual->options;
451     my( $optionname, $optionvalue );
452     while (($optionname, $optionvalue) = each %qual_options) {
453         if ( $optionname =~ /^ikano_Network_(\d+)_ProductGroup_(\d+)_Product_(\d+)_ProductCustomId$/ 
454             && $optionvalue eq $ProductCustomId ) {
455             my $network = $1;
456             my $productgroup = $2;
457             return $qual->option("ikano_Network_".$network."_ProductGroup_".$productgroup."_TermsId");
458         }
459     }
460     '';
461 }
462
463 sub _export_insert {
464   my( $self, $svc_dsl ) = (shift, shift);
465
466   $self->loadmod;
467
468   my $result = $self->valid_order($svc_dsl,'insert');
469   return $result unless $result eq '';
470
471   my $isp_chg = $svc_dsl->isp_chg eq 'Y' ? 'YES' : 'NO';
472   my $contactTN = $svc_dsl->cust_svc->cust_pkg->cust_main->daytime;
473   $contactTN =~ s/[^0-9]//g;
474
475   my $ProductCustomId = $svc_dsl->cust_svc->cust_pkg->part_pkg->option('externalid',1);
476
477   my $args = {
478         orderType => 'NEW',
479         ProductCustomId => $ProductCustomId,
480         TermsId => $self->qual2termsid($svc_dsl->vendor_qual_id,$ProductCustomId),
481         DSLPhoneNumber => $svc_dsl->loop_type eq '0' ? 'STANDALONE'
482                                                     : $svc_dsl->phonenum,
483         Password => $svc_dsl->password,
484         PrequalId => $svc_dsl->vendor_qual_id,
485         CompanyName => $svc_dsl->company,
486         FirstName => $svc_dsl->first,
487         LastName => $svc_dsl->last,
488         MiddleName => '',
489         ContactMethod => 'PHONE',
490         ContactPhoneNumber => $contactTN,
491         ContactEmail => 'x@x.xx',
492         ContactFax => '',
493         DateToOrder => time2str("%Y-%m-%d",$svc_dsl->desired_due_date),
494         RequestClientIP => '127.0.0.1',
495         IspChange => $isp_chg,
496         IspPrevious => $isp_chg eq 'YES' ? $svc_dsl->isp_prev : '',
497         CurrentProvider => $isp_chg eq 'NO' ? $svc_dsl->isp_prev : '',
498   };
499
500   $result = $self->ikano_command('ORDER',$args); 
501   return $result unless ref($result); # scalar (string) is an error
502
503   # now we're getting an OrderResponse which should have one Order in it
504   warn "$me _export_insert OrderResponse hash:\n".Dumper($result)
505         if $self->option('debug');
506   
507   return 'Invalid order response' unless defined $result->{'Order'};
508   $result = $result->{'Order'};
509
510   return 'No/invalid order id or status returned' 
511     unless defined $result->{'Status'} && defined $result->{'OrderId'}
512         && grep($_ eq $result->{'Status'}, @Net::Ikano::orderStatus);
513
514   $svc_dsl->pushed(time);
515   $svc_dsl->last_pull((time)+1); 
516   $svc_dsl->vendor_order_id($result->{'OrderId'});
517   $svc_dsl->vendor_order_status($result->{'Status'});
518   $svc_dsl->username($result->{'Username'});
519   local $FS::svc_Common::noexport_hack = 1;
520   $result = $svc_dsl->replace; 
521   return "Error setting DSL fields: $result" if $result;
522   '';
523 }
524
525 sub _export_replace {
526   my( $self, $new, $old ) = (shift, shift, shift);
527 # XXX only supports password changes now, but should return error if 
528 # another change is attempted?
529
530   if($new->password ne $old->password) {
531       my $result = $self->valid_order($new,'statuschg');
532       return $result unless $result eq '';
533       
534       $result = $self->ikano_command('PASSWORDCHANGE',
535             { DSLPhoneNumber => $new->phonenum,
536               NewPassword => $new->password,
537             } ); 
538       return $result unless ref($result); # scalar (string) is an error
539
540       return 'Error changing password' unless defined $result->{'Password'}
541         && $result->{'Password'} eq $new->password;
542   }
543
544   '';
545 }
546
547 sub _export_delete {
548   my( $self, $svc_dsl ) = (shift, shift);
549   
550   my $result = $self->valid_order($svc_dsl,'delete');
551   return $result unless $result eq '';
552
553   # for now allow an immediate cancel only on New orders in New/Pending status
554   #XXX: add support for Chance and Cancel orders in New/Pending status later
555
556   if($svc_dsl->vendor_order_type eq 'NEW') {
557     if($svc_dsl->vendor_order_status eq 'NEW' 
558             || $svc_dsl->vendor_order_status eq 'PENDING') {
559         my $result = $self->ikano_command('CANCEL', 
560             { OrderId => $svc_dsl->vendor_order_id, } );
561         return $result unless ref($result); # scalar (string) is an error
562         return 'Unable to cancel order' unless $result->{'Order'};
563         $result = $result->{'Order'};
564         return 'Invalid cancellation response' 
565             unless $result->{'Status'} eq 'CANCELLED' 
566                 && $result->{'OrderId'} eq $svc_dsl->vendor_order_id;
567
568         # we're supposed to do a pull, but it will break everything, so don't
569         # this is very wrong...
570     }
571     else {
572         return "Cannot cancel a NEW order unless it's in NEW or PENDING status";
573     }
574   }
575   else {
576     return 'Canceling orders other than NEW orders is not currently implemented';
577   }
578
579   '';
580 }
581
582 sub statuschg {
583   my( $self, $svc_dsl, $type ) = (shift, shift, shift);
584
585   my $result = $self->valid_order($svc_dsl,'statuschg');
586   return $result unless $result eq '';
587
588   # get the DSLServiceId
589   $result = $self->ikano_command('CUSTOMERLOOKUP',
590         { PhoneNumber => $svc_dsl->phonenum } ); 
591   return $result unless ref($result); # scalar (string) is an error
592   return 'No DSLServiceId found' unless defined $result->{'DSLServiceId'};
593   my $DSLServiceId = $result->{'DSLServiceId'};
594
595   $result = $self->ikano_command('ACCOUNTSTATUSCHANGE',
596         { DSLPhoneNumber => $svc_dsl->phonenum,
597           DSLServiceId => $DSLServiceId,
598           type => $type,
599         } ); 
600   return $result unless ref($result); # scalar (string) is an error
601   ''; 
602 }
603
604 sub _export_suspend {
605   my( $self, $svc_dsl ) = (shift, shift);
606   $self->statuschg($svc_dsl,"SUSPEND");
607 }
608
609 sub _export_unsuspend {
610   my( $self, $svc_dsl ) = (shift, shift);
611   $self->statuschg($svc_dsl,"UNSUSPEND");
612 }
613
614 1;