use FS::part_export::null;
use FS::svc_domain;
use FS::part_pkg;
-use Net::OpenSRS;
=head1 NAME
=back
+This export uses Net::OpenSRS. Registration and transfer attempts will fail unless Net::OpenSRS is installed
+and LWP::UserAgent is able to make HTTPS posts. You can turn on debugging messages and use the OpenSRS test
+gateway when setting up this export.
+
=cut
@ISA = qw(FS::part_export::null);
type => 'select',
options => [ 0, 1, 2, 3 ],
default => 0 },
- 'register' => { label => 'Use for registration',
- type => 'checkbox',
- default => '1' },
- 'transfer' => { label => 'Use for transfer',
- type => 'checkbox',
- default => '1' },
+# 'register' => { label => 'Use for registration',
+# type => 'checkbox',
+# default => '1' },
+# 'transfer' => { label => 'Use for transfer',
+# type => 'checkbox',
+# default => '1' },
'tlds' => { label => 'Use this export for these top-level domains (TLDs)',
type => 'select',
multi => 1,
return $c;
}
+sub validate_contact_info {
+ my $c = shift;
+
+ my %fields = (
+ firstname => "first name",
+ lastname => "last name",
+ address => "street address",
+ city => "city",
+ state => "state",
+ zip => "ZIP/postal code",
+ country => "country",
+ email => "email address",
+ phone => "phone number",
+ );
+ my @err = ();
+ foreach (keys %fields) {
+ if (!defined($c->{$_}) || !$c->{$_}) {
+ push @err, $fields{$_};
+ }
+ }
+ if (scalar(@err) > 0) {
+ return "Contact information needs: " . join(', ', @err);
+ }
+ undef;
+}
+
sub testmode {
my $self = shift;
return if $svc_domain->action eq 'I'; # Ignoring registration, just doing DNS
+ eval "use Net::OpenSRS;";
+ return $@ if $@;
+
# Get the TLD of the new domain
my @bits = split /\./, $svc_domain->domain;
my $c = gen_contact_info($cust_main);
+ my $err = validate_contact_info($c);
+ return $err if $err;
+
my $srs = Net::OpenSRS->new();
$srs->debug_level( $self->option('debug_level') ); # Output should be in the Apache error log
}
if ($svc_domain->action eq 'N') {
- return "Domain registration not enabled" if !$self->option('register');
+# return "Domain registration not enabled" if !$self->option('register');
return $srs->last_response() if !$srs->register_domain( $svc_domain->domain, $c);
} elsif ($svc_domain->action eq 'M') {
- return "Domain transfer not enabled" if !$self->option('transfer');
+# return "Domain transfer not enabled" if !$self->option('transfer');
return $srs->last_response() if !$srs->transfer_domain( $svc_domain->domain, $c);
} else {
return "Unknown domain action " . $svc_domain->action;
=head1 SEE ALSO
-L<FS::part_export_option>, L<FS::export_svc>, L<FS::svc_domain>,
+L<Net::OpenSRS>, L<FS::part_export_option>, L<FS::export_svc>, L<FS::svc_domain>,
L<FS::Record>, schema.html from the base documentation.
+
=cut
1;