summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--FS/FS/ClientAPI/MyAccount.pm23
-rw-r--r--FS/FS/ClientAPI_XMLRPC.pm1
-rwxr-xr-xbin/xmlrpc-customer_recurring30
-rw-r--r--fs_selfservice/FS-SelfService/SelfService.pm26
4 files changed, 80 insertions, 0 deletions
diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm
index 630346a81..23fbf6cf6 100644
--- a/FS/FS/ClientAPI/MyAccount.pm
+++ b/FS/FS/ClientAPI/MyAccount.pm
@@ -645,6 +645,29 @@ sub customer_info_short {
};
}
+sub customer_recurring {
+ my $p = shift;
+
+ my($context, $session, $custnum) = _custoragent_session_custnum($p);
+ return { 'error' => $session } if $context eq 'error';
+
+ my %return;
+
+ my $conf = new FS::Conf;
+
+ my $search = { 'custnum' => $custnum };
+ $search->{'agentnum'} = $session->{'agentnum'} if $context eq 'agent';
+ my $cust_main = qsearchs('cust_main', $search )
+ or return { 'error' => "customer_info_short: unknown custnum $custnum" };
+
+ $return{'display_recurring'} = [ $cust_main->display_recurring ];
+
+ return { 'error' => '',
+ 'custnum' => $custnum,
+ %return,
+ };
+}
+
sub billing_history {
my $p = shift;
diff --git a/FS/FS/ClientAPI_XMLRPC.pm b/FS/FS/ClientAPI_XMLRPC.pm
index 97019d194..7a1fc3e0f 100644
--- a/FS/FS/ClientAPI_XMLRPC.pm
+++ b/FS/FS/ClientAPI_XMLRPC.pm
@@ -111,6 +111,7 @@ sub ss2clientapi {
'switch_acct' => 'MyAccount/switch_acct',
'customer_info' => 'MyAccount/customer_info',
'customer_info_short' => 'MyAccount/customer_info_short',
+ 'customer_recurring' => 'MyAccount/customer_recurring',
'contact_passwd' => 'MyAccount/contact/contact_passwd',
'list_contacts' => 'MyAccount/contact/list_contacts',
diff --git a/bin/xmlrpc-customer_recurring b/bin/xmlrpc-customer_recurring
new file mode 100755
index 000000000..18dd3e896
--- /dev/null
+++ b/bin/xmlrpc-customer_recurring
@@ -0,0 +1,30 @@
+#!/usr/bin/perl
+
+use strict;
+use Frontier::Client;
+use Data::Dumper;
+
+my( $email, $password ) = @ARGV;
+die "Usage: xmlrpc-customer_recurring email password\n"
+ unless $email && length($password);
+
+my $uri = new URI 'http://localhost:8080/';
+
+my $server = new Frontier::Client ( 'url' => $uri );
+
+my $login_result = $server->call(
+ 'FS.ClientAPI_XMLRPC.login',
+ 'email' => $email,
+ 'password' => $password,
+);
+die $login_result->{'error'}."\n" if $login_result->{'error'};
+
+my $list_result = $server->call(
+ 'FS.ClientAPI_XMLRPC.customer_recurring',
+ 'session_id' => $login_result->{'session_id'},
+);
+die $list_result->{'error'}."\n" if $list_result->{'error'};
+
+print Dumper($list_result);
+
+1;
diff --git a/fs_selfservice/FS-SelfService/SelfService.pm b/fs_selfservice/FS-SelfService/SelfService.pm
index ecbb6e932..32b2ded32 100644
--- a/fs_selfservice/FS-SelfService/SelfService.pm
+++ b/fs_selfservice/FS-SelfService/SelfService.pm
@@ -32,6 +32,7 @@ $socket .= '.'.$tag if defined $tag && length($tag);
'switch_acct' => 'MyAccount/switch_acct',
'customer_info' => 'MyAccount/customer_info',
'customer_info_short' => 'MyAccount/customer_info_short',
+ 'customer_recurring' => 'MyAccount/customer_recurring',
'contact_passwd' => 'MyAccount/contact/contact_passwd',
'list_contacts' => 'MyAccount/contact/list_contacts',
@@ -479,6 +480,31 @@ first last company address1 address2 city county state zip country daytime night
=back
+=item customer_recurring HASHREF
+
+Takes a hash reference as parameter with a single key B<session_id>
+or keys B<agent_session_id> and B<custnum>.
+
+Returns a hash reference with the keys error, custnum and display_recurring.
+
+display_recurring is an arrayref of hashrefs with the following keys:
+
+=over 4
+
+=item freq
+
+frequency of charge, in months unless units are specified
+
+=item freq_pretty
+
+frequency of charge, suitable for display
+
+=item amount
+
+amount charged at this frequency
+
+=back
+
=item edit_info HASHREF
Takes a hash reference as parameter with any of the following keys: