9 my( $email, $password ) = @ARGV;
10 die "Usage: xmlrpc-insert_payby email password
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);
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.insert_payby',
44 'session_id' => $login_result->{'session_id'},
47 die $call_result->{'error'}."\n" if $call_result->{'error'};
49 print Dumper($call_result);
50 print "Successfully inserted\n";