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