9 my( $email, $password, $custpaybynum ) = @ARGV;
10 die "Usage: xmlrpc-update_payby email password custpaybynum
11 [-w weight -b payby -i payinfo -c paycvv -d paydate -n payname -s paystate -t paytype -p payip]\n"
12 unless $email && length($password) && $custpaybynum;
16 "by=s" => \$opts{'payby'},
17 "cvv=s" => \$opts{'paycvv'},
18 "date=s" => \$opts{'paydate'},
19 "info=s" => \$opts{'payinfo'},
20 "name=s" => \$opts{'payname'},
21 "payip=s" => \$opts{'payip'},
22 "state=s" => \$opts{'paystate'},
23 "type=s" => \$opts{'paytype'},
24 "weight=i" => \$opts{'weight'},
27 foreach my $key (keys %opts) {
28 delete($opts{$key}) unless defined($opts{$key});
31 my $uri = new URI 'http://localhost:8080/';
33 my $server = new Frontier::Client ( 'url' => $uri );
35 my $login_result = $server->call(
36 'FS.ClientAPI_XMLRPC.login',
38 'password' => $password,
40 die $login_result->{'error'}."\n" if $login_result->{'error'};
42 my $call_result = $server->call(
43 'FS.ClientAPI_XMLRPC.update_payby',
44 'session_id' => $login_result->{'session_id'},
45 'custpaybynum' => $custpaybynum,
48 die $call_result->{'error'}."\n" if $call_result->{'error'};
50 print Dumper($call_result);
51 print "Successfully updated\n";