error message in decline templates, RT#9507
[freeside.git] / FS / FS / cust_main.pm
index b1bf179..5898a6a 100644 (file)
@@ -5116,8 +5116,11 @@ sub _realtime_bop_result {
       my $msgnum = $conf->config('decline_msgnum', $self->agentnum);
       my $error = '';
       if ( $msgnum ) {
+        # include the raw error message in the transaction state
+        $cust_pay_pending->setfield('error', $transaction->error_message);
         my $msg_template = qsearchs('msg_template', { msgnum => $msgnum });
-        $error = $msg_template->send( 'cust_main' => $self );
+        $error = $msg_template->send( 'cust_main' => $self,
+                                      'object'    => $cust_pay_pending );
       }
       else { #!$msgnum