summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2004-10-17 14:01:47 +0000
committerivan <ivan>2004-10-17 14:01:47 +0000
commitdda265d579b6f754feea0deacd12ae358d552f11 (patch)
tree5a3e65646f7af3a19145f333c457e82b09a7525e
parentb50276a1fc993e07ef839f87a0611680bbda2ce7 (diff)
add artera turbo handling to self-service and reseller interfaces
-rw-r--r--FS/FS/ClientAPI/MyAccount.pm82
-rw-r--r--FS/FS/part_export/artera_turbo.pm13
-rw-r--r--fs_selfservice/FS-SelfService/SelfService.pm1
-rw-r--r--fs_selfservice/FS-SelfService/cgi/agent.cgi25
-rw-r--r--fs_selfservice/FS-SelfService/cgi/process_svc_external.html16
-rw-r--r--fs_selfservice/FS-SelfService/cgi/provision_list.html17
-rw-r--r--fs_selfservice/FS-SelfService/cgi/selfservice.cgi12
7 files changed, 127 insertions, 39 deletions
diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm
index 34dad3870..fe2e1c228 100644
--- a/FS/FS/ClientAPI/MyAccount.pm
+++ b/FS/FS/ClientAPI/MyAccount.pm
@@ -21,22 +21,23 @@ use FS::cust_pkg;
use FS::ClientAPI; #hmm
FS::ClientAPI->register_handlers(
- 'MyAccount/login' => \&login,
- 'MyAccount/logout' => \&logout,
- 'MyAccount/customer_info' => \&customer_info,
- 'MyAccount/edit_info' => \&edit_info,
- 'MyAccount/invoice' => \&invoice,
- 'MyAccount/list_invoices' => \&list_invoices,
- 'MyAccount/cancel' => \&cancel,
- 'MyAccount/payment_info' => \&payment_info,
- 'MyAccount/process_payment' => \&process_payment,
- 'MyAccount/list_pkgs' => \&list_pkgs,
- 'MyAccount/order_pkg' => \&order_pkg,
- 'MyAccount/cancel_pkg' => \&cancel_pkg,
- 'MyAccount/charge' => \&charge,
- 'MyAccount/part_svc_info' => \&part_svc_info,
- 'MyAccount/provision_acct' => \&provision_acct,
- 'MyAccount/unprovision_svc' => \&unprovision_svc,
+ 'MyAccount/login' => \&login,
+ 'MyAccount/logout' => \&logout,
+ 'MyAccount/customer_info' => \&customer_info,
+ 'MyAccount/edit_info' => \&edit_info,
+ 'MyAccount/invoice' => \&invoice,
+ 'MyAccount/list_invoices' => \&list_invoices,
+ 'MyAccount/cancel' => \&cancel,
+ 'MyAccount/payment_info' => \&payment_info,
+ 'MyAccount/process_payment' => \&process_payment,
+ 'MyAccount/list_pkgs' => \&list_pkgs,
+ 'MyAccount/order_pkg' => \&order_pkg,
+ 'MyAccount/cancel_pkg' => \&cancel_pkg,
+ 'MyAccount/charge' => \&charge,
+ 'MyAccount/part_svc_info' => \&part_svc_info,
+ 'MyAccount/provision_acct' => \&provision_acct,
+ 'MyAccount/provision_external' => \&provision_external,
+ 'MyAccount/unprovision_svc' => \&unprovision_svc,
);
use vars qw( @cust_main_editable_fields );
@@ -48,6 +49,8 @@ use vars qw( @cust_main_editable_fields );
payby payinfo payname
);
+use subs qw(_provision);
+
#store in db?
my $cache = new Cache::SharedMemoryCache( {
'namespace' => 'FS::ClientAPI::MyAccount',
@@ -611,6 +614,33 @@ sub cancel_pkg {
sub provision_acct {
my $p = shift;
+ return { 'error' => gettext('passwords_dont_match') }
+ if $p->{'_password'} ne $p->{'_password2'};
+ return { 'error' => gettext('empty_password') }
+ unless length($p->{'_password'});
+
+ _provision( 'FS::svc_acct',
+ [qw(username _password)],
+ [qw(username _password)],
+ $p,
+ @_
+ );
+}
+
+sub provision_external {
+ my $p = shift;
+ #_provision( 'FS::svc_external', [qw(id title)], [qw(id title)], $p, @_ );
+ _provision( 'FS::svc_external',
+ [],
+ [qw(id title)],
+ $p,
+ @_
+ );
+}
+
+sub _provision {
+ my( $class, $fields, $return_fields, $p ) = splice(@_, 0, 4);
+
my($context, $session, $custnum) = _custoragent_session_custnum($p);
return { 'error' => $session } if $context eq 'error';
@@ -629,20 +659,18 @@ sub provision_acct {
my $part_svc = qsearchs('part_svc', { 'svcpart' => $p->{'svcpart'} } )
or return { 'error' => "unknown svcpart $p->{'svcpart'}" };
- return { 'error' => gettext('passwords_dont_match') }
- if $p->{'_password'} ne $p->{'_password2'};
- return { 'error' => gettext('empty_password') }
- unless length($p->{'_password'});
-
- my $svc_acct = new FS::svc_acct( {
- 'pkgnum' => $p->{'pkgnum'},
- 'svcpart' => $p->{'svcpart'},
- 'username' => $p->{'username'},
- '_password' => $p->{'_password'},
+ my $svc_x = $class->new( {
+ 'pkgnum' => $p->{'pkgnum'},
+ 'svcpart' => $p->{'svcpart'},
+ map { $_ => $p->{$_} } @$fields
} );
+ my $error = $svc_x->insert;
+ $svc_x = qsearchs($svc_x->table, { 'svcnum' => $svc_x->svcnum })
+ unless $error;
return { 'svc' => $part_svc->svc,
- 'error' => $svc_acct->insert
+ 'error' => $error,
+ map { $_ => $svc_x->get($_) } @$return_fields
};
}
diff --git a/FS/FS/part_export/artera_turbo.pm b/FS/FS/part_export/artera_turbo.pm
index 52ab232e0..1e2296155 100644
--- a/FS/FS/part_export/artera_turbo.pm
+++ b/FS/FS/part_export/artera_turbo.pm
@@ -61,7 +61,6 @@ sub _export_insert {
eval "use Net::Artera;";
return $@ if $@;
-
my $artera = $self->_new_Artera;
my $cust_pkg = $svc_external->cust_svc->cust_pkg;
@@ -113,25 +112,27 @@ sub _export_replace {
sub _export_delete {
my( $self, $svc_external ) = (shift, shift);
- $self->StatusChange(17, $svc_external);
+ $self->statusChange(17, $svc_external);
}
sub _export_suspend {
my( $self, $svc_external ) = (shift, shift);
- $self->StatusChange(16, $svc_external);
+ $self->statusChange(16, $svc_external);
}
sub _export_unsuspend {
my( $self, $svc_external ) = (shift, shift);
- $self->StatusChange(15, $svc_external);
+ $self->statusChange(15, $svc_external);
}
-sub StatusChange {
+sub statusChange {
my( $self, $status, $svc_external ) = @_;
+ eval "use Net::Artera;";
+ return $@ if $@;
my $artera = $self->_new_Artera;
- my $result = $artera->StatusChange(
+ my $result = $artera->statusChange(
'asn' => sprintf('%010d', $svc_external->id),
'akc' => $svc_external->title,
'statusid' => $status,
diff --git a/fs_selfservice/FS-SelfService/SelfService.pm b/fs_selfservice/FS-SelfService/SelfService.pm
index de33b75b1..6e3ca3b5a 100644
--- a/fs_selfservice/FS-SelfService/SelfService.pm
+++ b/fs_selfservice/FS-SelfService/SelfService.pm
@@ -36,6 +36,7 @@ $socket .= '.'.$tag if defined $tag && length($tag);
'charge' => 'MyAccount/charge', #?
'part_svc_info' => 'MyAccount/part_svc_info',
'provision_acct' => 'MyAccount/provision_acct',
+ 'provision_external' => 'MyAccount/provision_external',
'unprovision_svc' => 'MyAccount/unprovision_svc',
'signup_info' => 'Signup/signup_info',
'new_customer' => 'Signup/new_customer',
diff --git a/fs_selfservice/FS-SelfService/cgi/agent.cgi b/fs_selfservice/FS-SelfService/cgi/agent.cgi
index b88709862..92c76f38e 100644
--- a/fs_selfservice/FS-SelfService/cgi/agent.cgi
+++ b/fs_selfservice/FS-SelfService/cgi/agent.cgi
@@ -14,7 +14,8 @@ use FS::SelfService qw( agent_login agent_logout agent_info
agent_list_customers
signup_info new_customer
customer_info list_pkgs order_pkg
- part_svc_info provision_acct unprovision_svc
+ part_svc_info provision_acct provision_external
+ unprovision_svc
);
$DEBUG = 0;
@@ -67,7 +68,7 @@ $session_id = $cgi->param('session');
warn "$me checking action\n" if $DEBUG;
$cgi->param('action') =~
- /^(agent_main|signup|process_signup|list_customers|view_customer|agent_provision|provision_svc|process_svc_acct|delete_svc|agent_order_pkg|process_order_pkg|logout)$/
+ /^(agent_main|signup|process_signup|list_customers|view_customer|agent_provision|provision_svc|process_svc_acct|process_svc_external|delete_svc|agent_order_pkg|process_order_pkg|logout)$/
or die "unknown action ". $cgi->param('action');
my $action = $1;
@@ -321,6 +322,26 @@ sub process_svc_acct {
}
+sub process_svc_external {
+
+ my $result = provision_external (
+ 'agent_session_id' => $session_id,
+ map { $_ => $cgi->param($_) } qw( custnum pkgnum svcpart )
+ );
+
+ #warn "$result $result->{'error'}";
+ $action = 'agent_provision';
+ return {
+ %{agent_provision()},
+ 'message' => $result->{'error'}
+ ? '<FONT COLOR="#FF0000">'. $result->{'error'}. '</FONT>'
+ : $result->{'svc'}. ' setup sucessfully'.
+ ': serial number '.
+ sprintf('%010d', $result->{'id'}). '-'. $result->{'title'}
+ };
+
+}
+
sub delete_svc {
my $result = unprovision_svc(
'agent_session_id' => $session_id,
diff --git a/fs_selfservice/FS-SelfService/cgi/process_svc_external.html b/fs_selfservice/FS-SelfService/cgi/process_svc_external.html
new file mode 100644
index 000000000..772cf0838
--- /dev/null
+++ b/fs_selfservice/FS-SelfService/cgi/process_svc_external.html
@@ -0,0 +1,16 @@
+<HTML><HEAD><TITLE><%= $error ? 'MyAccount' : sprintf("Your serial number is %010d-$title", $id) %></TITLE></HEAD>
+<BODY BGCOLOR="#eeeeee"><FONT SIZE=5>MyAccount</FONT><BR><BR>
+<%= $url = "$selfurl?session=$session_id;action="; ''; %>
+<TABLE BORDER=0 CELLPADDING=4><TR>
+<%= include('myaccount_menu') %>
+<TD VALIGN="top">
+
+<FONT SIZE=4><%= $svc %> setup sucessfully.</FONT>
+
+<BR><BR>Your serial number is <%= sprintf("%010d-$title", $id) %>
+
+</TD></TR></TABLE>
+<HR>
+<FONT SIZE="-2">powered by <a href="http://www.sisd.com/freeside">freeside</a></FONT>
+</BODY></HTML>
+
diff --git a/fs_selfservice/FS-SelfService/cgi/provision_list.html b/fs_selfservice/FS-SelfService/cgi/provision_list.html
index 7e7059388..0c8e05078 100644
--- a/fs_selfservice/FS-SelfService/cgi/provision_list.html
+++ b/fs_selfservice/FS-SelfService/cgi/provision_list.html
@@ -58,9 +58,22 @@ function areyousure(href, message) {
my $td = qq!<TD BGCOLOR="#$col"!;
+ my $link;
+
+ if ( $part_svc->{'svcdb'} eq 'svc_external'
+ #&& $conf->exists('svc_external-skip_manual')
+ ) {
+ $link = "${url}process_svc_external;".
+ "pkgnum=$pkg->{'pkgnum'};".
+ "svcpart=$part_svc->{'svcpart'}";
+ } else {
+ $link = "${url}provision_svc;".
+ "pkgnum=$pkg->{'pkgnum'};".
+ "svcpart=$part_svc->{'svcpart'}";
+ }
+
$OUT .= "<TR>$td COLSPAN=3 ALIGN=center>".
- qq!<A HREF="${url}provision_svc;pkgnum=$pkg->{'pkgnum'};svcpart=$part_svc->{'svcpart'}">!.
- 'Setup '. $part_svc->{'svc'}. '</A> '.
+ qq!<A HREF="$link">!. 'Setup '. $part_svc->{'svc'}. '</A> '.
'('. $part_svc->{'num_avail'}. ' available)'.
'</TD></TR>';
$col = $col eq $col1 ? $col2 : $col1;
diff --git a/fs_selfservice/FS-SelfService/cgi/selfservice.cgi b/fs_selfservice/FS-SelfService/cgi/selfservice.cgi
index 44dd8bb3a..0816758fb 100644
--- a/fs_selfservice/FS-SelfService/cgi/selfservice.cgi
+++ b/fs_selfservice/FS-SelfService/cgi/selfservice.cgi
@@ -10,7 +10,8 @@ use HTML::Entities;
use FS::SelfService qw( login customer_info invoice
payment_info process_payment
list_pkgs
- part_svc_info provision_acct unprovision_svc
+ part_svc_info provision_acct provision_external
+ unprovision_svc
);
$template_dir = '.';
@@ -60,7 +61,7 @@ $session_id = $cgi->param('session');
#order|pw_list XXX ???
$cgi->param('action') =~
- /^(myaccount|view_invoice|make_payment|payment_results|logout|change_bill|change_ship|provision|provision_svc|process_svc_acct|delete_svc)$/
+ /^(myaccount|view_invoice|make_payment|payment_results|logout|change_bill|change_ship|provision|provision_svc|process_svc_acct|process_svc_external|delete_svc)$/
or die "unknown action ". $cgi->param('action');
my $action = $1;
@@ -224,6 +225,13 @@ sub process_svc_acct {
}
+sub process_svc_external {
+ provision_external (
+ 'session_id' => $session_id,
+ map { $_ => $cgi->param($_) } qw( pkgnum svcpart )
+ );
+}
+
sub delete_svc {
unprovision_svc(
'session_id' => $session_id,