From 26cc0f7cc437d31870a44d93e5e8005a41ef0956 Mon Sep 17 00:00:00 2001 From: jeff Date: Tue, 19 Jan 2010 02:03:28 +0000 Subject: [PATCH 1/1] debugged and tested opensrs export --- FS/FS/cust_bill_ApplicationCommon.pm | 2 +- FS/FS/part_export/domreg_opensrs.pm | 24 +++++++++++++++--------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/FS/FS/cust_bill_ApplicationCommon.pm b/FS/FS/cust_bill_ApplicationCommon.pm index 6004b6cf7..4e221dc50 100644 --- a/FS/FS/cust_bill_ApplicationCommon.pm +++ b/FS/FS/cust_bill_ApplicationCommon.pm @@ -420,7 +420,7 @@ sub apply_to_lineitems { $cust_svc->part_svc->part_export; foreach my $part_export ( $cust_svc->part_svc->part_export ) { - $error = $part_export->export_insert_on_payment($svc_x); + $error = $part_export->_export_insert_on_payment($svc_x); if ( $error ) { $dbh->rollback if $oldAutoCommit; return $error; diff --git a/FS/FS/part_export/domreg_opensrs.pm b/FS/FS/part_export/domreg_opensrs.pm index dc9f92389..a9afc91cc 100644 --- a/FS/FS/part_export/domreg_opensrs.pm +++ b/FS/FS/part_export/domreg_opensrs.pm @@ -1,6 +1,6 @@ package FS::part_export::domreg_opensrs; -use vars qw(@ISA %info %options $conf); +use vars qw(@ISA %info %options $conf $me $DEBUG); use Tie::IxHash; use DateTime; use FS::Record qw(qsearchs qsearch); @@ -39,6 +39,8 @@ gateway when setting up this export. =cut @ISA = qw(FS::part_export::null); +$me = '[' . __PACKAGE__ . ']'; +$DEBUG = 1; my @tldlist = qw/com net org biz info name mobi at be ca cc ch cn de dk es eu fr it mx nl tv uk us/; @@ -249,13 +251,14 @@ sub _export_insert { sub _export_insert_on_payment { my( $self, $svc_domain ) = ( shift, shift ); + warn "$me:_export_insert_on_payment called\n" if $DEBUG; return '' unless $self->option('wait_for_pay'); my $queue = new FS::queue { 'svcnum' => $svc_domain->svcnum, 'job' => 'FS::part_export::domreg_opensrs::renew_through', }; - $queue->insert( $self, $svc_domain->svcnum ); #_export_insert with 'R' action? + $queue->insert( $self, $svc_domain ); #_export_insert with 'R' action? return ''; } @@ -395,10 +398,11 @@ sub register { my $srs = $self->get_srs; - my $cookie = $srs->get_cookie( $self->option('masterdomain') ); - if (!$cookie) { - return "Unable to get cookie at OpenSRS: " . $srs->last_response(); - } +# cookie not required for registration +# my $cookie = $srs->get_cookie( $self->option('masterdomain') ); +# if (!$cookie) { +# return "Unable to get cookie at OpenSRS: " . $srs->last_response(); +# } # return "Domain registration not enabled" if !$self->option('register'); return $srs->last_response() if !$srs->register_domain( $svc_domain->domain, $c); @@ -485,6 +489,7 @@ Like most export functions, returns an error message on failure or undef on succ sub renew_through { my ( $self, $svc_domain, $date ) = @_; + warn "$me: renew_through called\n" if $DEBUG; eval "use Net::OpenSRS;"; return $@ if $@; @@ -498,9 +503,8 @@ sub renew_through { my $err = $self->is_supported_domain( $svc_domain ); return $err if $err; - my $srs = $self->get_srs; - - $rv = $srs->check_transfer($svc_domain->domain); + warn "$me: checking status\n" if $DEBUG; + my $rv = $self->get_status($svc_domain); return "Domain ". $svc_domain->domain. " is not renewable" unless $rv->{expdate}; @@ -531,6 +535,8 @@ sub renew_through { if $years > 10; #no infinite loop } + warn "$me: renewing ". $svc_domain->domain. "for $years years\n" if $DEBUG; + my $srs = $self->get_srs; $rv = $srs->make_request( { action => 'renew', -- 2.11.0