From: erickson Date: Mon, 19 Oct 2009 15:55:14 +0000 (+0000) Subject: added some basic log lines. Add the approval code in the newly created credit_card_p... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=4fd057a6fe00cd643e9cf3e5b5ae028e59e48844;p=evergreen%2Fmasslnc.git added some basic log lines. Add the approval code in the newly created credit_card_payment objects git-svn-id: svn://svn.open-ils.org/ILS/trunk@14493 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Money.pm b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Money.pm index 9b15e55e3a..2aa3240c72 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Money.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Money.pm @@ -103,6 +103,8 @@ sub make_payments { $xacts{$xact_id} = $xact; } + my @payment_objs; + for my $pay (@{$payments->{payments}}) { my $transid = $pay->[0]; @@ -187,6 +189,7 @@ sub make_payments { 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 @@ sub make_payments { "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;