This commit was generated by cvs2svn to compensate for changes in r11022,
[freeside.git] / FS / FS / cust_main / Billing_Realtime.pm
index 55517ad..bee1e03 100644 (file)
@@ -850,12 +850,14 @@ sub _realtime_bop_result {
 
     if ( $error ) {
       $cust_pay->invnum(''); #try again with no specific invnum
+      $cust_pay->paynum('');
       my $error2 = $cust_pay->insert( $options{'manual'} ?
                                       ( 'manual' => 1 ) : ()
                                     );
       if ( $error2 ) {
         # gah.  but at least we have a record of the state we had to abort in
         # from cust_pay_pending now.
+        $dbh->rollback or die $dbh->errstr if $oldAutoCommit;
         my $e = "WARNING: $options{method} captured but payment not recorded -".
                 " error inserting payment (". $payment_gateway->gateway_module.
                 "): $error2".