[freeside-commits] freeside/httemplate/misc/process payment.cgi, 1.17, 1.18

Ivan,,, ivan at wavetail.420.am
Fri Sep 25 05:29:19 PDT 2009


Update of /home/cvs/cvsroot/freeside/httemplate/misc/process
In directory wavetail.420.am:/tmp/cvs-serv20352/httemplate/misc/process

Modified Files:
	payment.cgi 
Log Message:
processing fee on credit card recharges, RT#5889

Index: payment.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/misc/process/payment.cgi,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- payment.cgi	16 Mar 2009 07:13:59 -0000	1.17
+++ payment.cgi	25 Sep 2009 12:29:16 -0000	1.18
@@ -32,6 +32,11 @@
 my $amount = $1;
 errorpage("amount <= 0") unless $amount > 0;
 
+if ( $cgi->param('fee') =~ /^\s*(\d*(\.\d\d)?)\s*$/ ) {
+  my $fee = $1;
+  $amount = sprintf('%.2f', $amount + $fee);
+}
+
 $cgi->param('year') =~ /^(\d+)$/
   or errorpage("illegal year ". $cgi->param('year'));
 my $year = $1;
@@ -143,6 +148,15 @@
   );
   errorpage($error) if $error;
 
+  #no error, so order the fee package if applicable...
+  if ( $cgi->param('fee_pkgpart') =~ /^(\d+)$/ ) {
+    my $error = $cust_main->order_pkg(
+      'cust_pkg' => new FS::cust_pkg { 'pkgpart' => $1 }
+    );
+    errorpage("payment processed successfully, but error ordering fee: $error")
+      if $error;
+  }
+
   $cust_main->apply_payments;
 
 }



More information about the freeside-commits mailing list