9edfee5d3b3141170807d416474c562105f26c36
[freeside.git] / FS / FS / part_export / broadband_http.pm
1 package FS::part_export::broadband_http;
2
3 use vars qw( @ISA %info );
4 use FS::part_export::http;
5 use Tie::IxHash;
6
7 @ISA = qw( FS::part_export::http );
8
9 tie %options, 'Tie::IxHash',
10   'method' => { label   =>'Method',
11                 type    =>'select',
12                 #options =>[qw(POST GET)],
13                 options =>[qw(POST)],
14                 default =>'POST' },
15   'url'    => { label   => 'URL', default => 'http://', },
16   'insert_data' => {
17     label   => 'Insert data',
18     type    => 'textarea',
19     default => join("\n",
20       "action 'add'",
21       "address \$svc_x->ip_addr",
22       "name \$cust_main->first.' '.\$cust_main->last",
23     ),
24   },
25   'delete_data' => {
26     label   => 'Delete data',
27     type    => 'textarea',
28     default => join("\n",
29       "action  'remove'",
30       "address \$svc_x->ip_addr",
31     ),
32   },
33   'replace_data' => {
34     label   => 'Replace data',
35     type    => 'textarea',
36     default => '',
37   },
38   'success_regexp' => {
39     label   => 'Success Regexp',
40     default => '',
41   },
42 ;
43
44 %info = (
45   'svc'     => 'svc_broadband',
46   'desc'    => 'Send an HTTP or HTTPS GET or POST request, for accounts.',
47   'options' => \%options,
48   'notes'   => <<'END'
49 <p>Send an HTTP or HTTPS GET or POST to the specified URL on account addition,
50 modification and deletion.  For HTTPS support,
51 <a href="http://search.cpan.org/dist/Crypt-SSLeay">Crypt::SSLeay</a>
52 or <a href="http://search.cpan.org/dist/IO-Socket-SSL">IO::Socket::SSL</a>
53 is required.</p>
54 <p>Each "Data" option takes a list of <i>name value</i> pairs on successive 
55 lines.
56 <ul><li><i>name</i> is an unquoted, literal string without whitespace.</li>
57 <li><i>value</i> is a Perl expression that will be evaluated.  If it's a 
58 literal string, it must be quoted.  This expression has access to the
59 svc_broadband object as '$svc_x' (or '$new' and '$old' in "Replace Data") 
60 and the customer record as '$cust_main'.</li></ul>
61 If "Success Regexp" is specified, the response from the server will be
62 tested against it to determine if the export succeeded.</p>
63 END
64 );
65
66 1;