[freeside-commits] freeside/bin xmlrpc-agent_new_customer.pl, NONE, 1.1
Ivan,,,
ivan at wavetail.420.am
Fri Nov 12 13:51:58 PST 2010
Update of /home/cvs/cvsroot/freeside/bin
In directory wavetail.420.am:/tmp/cvs-serv4315
Added Files:
xmlrpc-agent_new_customer.pl
Log Message:
adding agent new customer example, RT#9608
--- NEW FILE: xmlrpc-agent_new_customer.pl ---
#!/usr/bin/perl
#
# xmlrpc-agent_new_customer.pl username password
use strict;
use Frontier::Client;
use Data::Dumper;
my( $username, $password ) = ( @ARGV );
my $uri = new URI 'http://localhost/selfservice/xmlrpc.cgi';
my $server = new Frontier::Client ( 'url' => $uri );
###
# login
###
my $login_result = $server->call('FS.SelfService.XMLRPC.agent_login',
{
'username' => $username,
'password' => $username,
}
);
die $login_result->{'error'} if $login_result->{'error'};
my $session_id = $login_result->{'session_id'};
warn "logged in w/session_id $session_id\n";
###
# new_customer
###
my $result = $server->call('FS.SelfService.XMLRPC.new_customer',
{
'session_id' => $session_id,
#customer informaiton
'first' => 'Tofu',
'last' => 'Beast',
'address1' => '1234 Soybean Ln.',
'city' => 'Tofutown',
'state' => 'CA',
'zip' => '54321',
'country' => 'US',
'invoicing_list' => 'tofu at example.com',
#billing information
'payby' => 'CARD',
'payinfo' => '4111111111111111',
'paycvv' => '123',
'paydate' => '11/2012',
#package information
'pkgpart' => '2',
'username' => 'tofu',
'_password' => 's33kret',
}
);
die $result->{'error'} if $result->{'error'};
my $custnum = $result->{'custnum'};
warn "added new customer w/custnum $custnum\n";
###
# logout
###
my $logout_result = $server->call('FS.SelfService.XMLRPC.agent_logout',
{
'session_id' => $session_id,
}
);
die $logout_result->{'error'} if $logout_result->{'error'};
warn "logged out\n";
1;
More information about the freeside-commits
mailing list