[freeside-commits] freeside/FS/FS cust_main.pm, 1.464.2.37, 1.464.2.38 msg_template.pm, 1.1.2.7, 1.1.2.8

Mark Wells mark at wavetail.420.am
Wed Aug 4 17:27:08 PDT 2010


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv18460/FS/FS

Modified Files:
      Tag: FREESIDE_1_9_BRANCH
	cust_main.pm msg_template.pm 
Log Message:
error message in decline templates, RT#9507

Index: msg_template.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/msg_template.pm,v
retrieving revision 1.1.2.7
retrieving revision 1.1.2.8
diff -u -w -d -r1.1.2.7 -r1.1.2.8
--- msg_template.pm	30 Jul 2010 22:20:49 -0000	1.1.2.7
+++ msg_template.pm	5 Aug 2010 00:27:06 -0000	1.1.2.8
@@ -166,7 +166,7 @@
 =item object
 
 Additional context object (currently, can be a cust_main, cust_pkg, 
-cust_bill, svc_acct, or cust_pay object).
+cust_bill, svc_acct, cust_pay, or cust_pay_pending object).
 
 =back
 
@@ -322,6 +322,9 @@
       [ company_name      => sub { 
           $conf->config('company_name', shift->agentnum) 
         } ],
+      [ company_address   => sub {
+          $conf->config('company_address', shift->agentnum)
+        } ],
     ],
     # next_bill_date
     'cust_pkg'  => [qw( 
@@ -349,11 +352,13 @@
     )],
     #XXX not really thinking about cust_bill substitutions quite yet
     
+    # for welcome and limit warning messages
     'svc_acct' => [qw(
       username
       ),
       [ password          => sub { shift->getfield('_password') } ],
-    ], # for welcome messages
+    ],
+    # for payment receipts
     'cust_pay' => [qw(
       paynum
       _date
@@ -368,6 +373,22 @@
             $cust_pay->paymask : $cust_pay->decrypt($cust_pay->payinfo)
         } ],
     ],
+    # for payment decline messages
+    # try to support all cust_pay fields
+    # 'error' is a special case, it contains the raw error from the gateway
+    'cust_pay_pending' => [qw(
+      _date
+      error
+      ),
+      [ paid              => sub { sprintf("%.2f", shift->paid) } ],
+      [ payby             => sub { FS::payby->shortname(shift->payby) } ],
+      [ date              => sub { time2str("%a %B %o, %Y", shift->_date) } ],
+      [ payinfo           => sub {
+          my $pending = shift;
+          ($pending->payby eq 'CARD' || $pending->payby eq 'CHEK') ?
+            $pending->paymask : $pending->decrypt($pending->payinfo)
+        } ],
+    ],
   };
 }
 

Index: cust_main.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_main.pm,v
retrieving revision 1.464.2.37
retrieving revision 1.464.2.38
diff -u -w -d -r1.464.2.37 -r1.464.2.38
--- cust_main.pm	28 Jul 2010 23:20:56 -0000	1.464.2.37
+++ cust_main.pm	5 Aug 2010 00:27:06 -0000	1.464.2.38
@@ -4622,8 +4622,11 @@
       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
 



More information about the freeside-commits mailing list