backoffice API: add new_customer, RT#22830
[freeside.git] / bin / xmlrpc-new_customer
1 #!/usr/bin/perl
2
3 use strict;
4 use Frontier::Client;
5 use Data::Dumper;
6
7 my( $username, $password ) = ( @ARGV );
8
9 my $uri = new URI 'http://localhost:8008/';
10
11 my $server = new Frontier::Client ( 'url' => $uri );
12
13 my $result = $server->call('FS.API.new_customer',
14     #API shared secret
15     'secret'         => 'sharingiscaring',
16
17     #customer informaiton
18     'agentnum'       => 1,
19     'refnum'         => 1, #advertising source
20     'agent_custid'   => '323',
21
22     'first'          => 'Tofu',
23     'last'           => 'Beast',
24     'company'        => 'Bank of Soymerica',
25
26     #address
27     'address1'       => '1234 Soybean Ln.',
28     'city'           => 'Tofutown',
29     'county'         => '',
30     'state'          => 'CA',
31     'zip'            => '54321',
32     'country'        => 'US',
33     'latitude'       => '',
34     'longitude'      => '',
35     'geocode'        => '',
36     'censustract'    => '',
37     'censusyear'     => '',
38
39     #phones
40     'daytime'        => '555 444 3211',
41     'night'          => '',
42     'fax'            => '',
43     'mobile'         => '123 466 3332',
44
45     #invoicing info
46     'invoicing_list'   => 'tofu@example.com', #comma-separated email addresses
47     'postal_invoicing' => 1,
48
49     #billing information
50     'payby'          => 'CARD', # DCRD, CHEK, DCHK, BILL, etc.
51     'payinfo'        => '4111111111111111', #card number / acctno@routing / PO#
52     'paydate'        => '11/2019', #card expiration
53     'paycvv'         => '123',     #card CVV/security code
54     'payname'        => 'Thomas Beast', #"Exact name on card" if different
55 );
56
57 die $result->{'error'} if $result->{'error'};
58
59 my $custnum = $result->{'custnum'};
60 warn "added new customer w/custnum $custnum\n";
61
62 1;