+
+ my $result = $self->valid_order($svc_dsl,'insert');
+ return $result unless $result eq '';
+
+ my $isp_chg = $svc_dsl->isp_chg eq 'Y' ? 'YES' : 'NO';
+ my $contactTN = $svc_dsl->cust_svc->cust_pkg->cust_main->daytime;
+ $contactTN =~ s/[^0-9]//g;
+
+ my $args = {
+ orderType => 'NEW',
+ ProductCustomId =>
+ $svc_dsl->cust_svc->cust_pkg->part_pkg->option('externalid',1),
+ TermsId => $self->qual2termsid($svc_dsl->vendor_qual_id),
+ DSLPhoneNumber => $svc_dsl->loop_type eq '0' ? 'STANDALONE'
+ : $svc_dsl->svctn,
+ Password => $svc_dsl->password,
+ PrequalId => $svc_dsl->vendor_qual_id,
+ CompanyName => $svc_dsl->company,
+ FirstName => $svc_dsl->first,
+ LastName => $svc_dsl->last,
+ MiddleName => '',
+ ContactMethod => 'PHONE',
+ ContactPhoneNumber => $contactTN,
+ ContactEmail => 'x@x.xx',
+ ContactFax => '',
+ DateToOrder => time2str("%Y-%m-%d",$svc_dsl->desired_dd),
+ RequestClientIP => '127.0.0.1',
+ IspChange => $isp_chg,
+ IspPrevious => $isp_chg eq 'YES' ? $svc_dsl->isp_prev : '',
+ CurrentProvider => $isp_chg eq 'NO' ? $svc_dsl->isp_prev : '',
+ };
+
+ $result = $self->ikano_command('ORDER',$args);
+ return $result unless ref($result); # scalar (string) is an error
+
+ # now we're getting an OrderResponse which should have one Order in it
+ warn Dumper($result) if $DEBUG;
+ my ($pushed,$vendor_order_id,$vendor_order_status,$last_pull);
+ $pushed = time;
+ $last_pull = time;
+ $last_pull++;
+
+ return 'Invalid order response' unless defined $result->{'Order'};
+ $result = $result->{'Order'};
+
+ return 'No order id or status returned'
+ unless defined $result->{'Status'} && defined $result->{'OrderId'};
+
+ $vendor_order_id = $result->{'OrderId'};
+ $vendor_order_status = $result->{'Status'};
+
+# XXX we need to set all of these values (everything in the last my statement
+# above) in the svc without:
+# a. re-triggering exports
+# b. committing the svc into the db now (because other things in the caller
+# and further up the stack may decide that the svc shouldn't be inserted)
+
+ return '';