[open-ils-commits] r14493 - trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Oct 19 11:55:17 EDT 2009


Author: erickson
Date: 2009-10-19 11:55:14 -0400 (Mon, 19 Oct 2009)
New Revision: 14493

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Money.pm
Log:
added some basic log lines.  Add the approval code in the newly created credit_card_payment objects

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Money.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Money.pm	2009-10-19 15:44:32 UTC (rev 14492)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Money.pm	2009-10-19 15:55:14 UTC (rev 14493)
@@ -103,6 +103,8 @@
         $xacts{$xact_id} = $xact;
     }
 
+    my @payment_objs;
+
 	for my $pay (@{$payments->{payments}}) {
 
         my $transid = $pay->[0];
@@ -187,6 +189,7 @@
 
         my $method = "create_money_$type";
         $e->$method($payobj) or return $e->die_event;
+        push(@payment_objs, $payobj);
 
 	} # all payment objects have been created and inserted. 
 
@@ -217,21 +220,25 @@
                 "ou" => $this_ou
             }
         );
-        # senator: Should failures and/or declines be logged somewhere?  Is
-        # some other cog taking care of this?  Actually, what about the
-        # successes, too?  There's an approval code from the payment processor
-        # that could go somewhere...
+
         if (exists $response->{ilsevent}) {
             $e->rollback;
             return $response;
         }
         if ($response->{statusCode} != 200) {
             $e->rollback;
+            $logger->info("Credit card payment for user $user_id failed with message: " . $response->{statusText});
             return OpenILS::Event->new(
                 'CREDIT_PROCESSOR_DECLINED_TRANSACTION',
                 note => $response->{statusText}
             );
         }
+
+        for my $payment (@payment_objs) {
+            $payment->approval_code($response->{approvalCode});
+            $e->update_money_credit_card_payment($payment) or return $e->die_event;
+        }
+        $logger->info("Credit card payment for user $user_id succeeded");
     }
 
     $e->commit;



More information about the open-ils-commits mailing list