From 4e93612040b85e943082e02ff66ca8702e9c01e7 Mon Sep 17 00:00:00 2001 From: Chris Sharp Date: Thu, 20 Apr 2023 13:46:45 -0400 Subject: [PATCH] add more/clearer logging for Stripe payments --- Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Money.pm | 10 +++++----- Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm | 4 +++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Money.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Money.pm index b96c3985c7..3dd4e43267 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Money.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Money.pm @@ -106,10 +106,10 @@ sub process_stripe_or_bop_payment { my $stripe = Business::Stripe->new(-api_key => $psettings->{secretkey}); $stripe->api('post','payment_intents/' . $cc_args->{stripe_payment_intent}); if ($stripe->success) { - $logger->info('Stripe payment intent retrieved'); + $logger->info('STRIPE: Stripe payment intent retrieved'); my $intent = $stripe->success; if ($intent->{status} eq 'succeeded') { - $logger->info('Stripe payment succeeded'); + $logger->info('STRIPE: Stripe payment succeeded'); return OpenILS::Event->new( 'SUCCESS', payload => { invoice => $intent->{invoice}, @@ -121,15 +121,15 @@ sub process_stripe_or_bop_payment { } ); } else { - $logger->info('Stripe payment failed'); + $logger->info('STRIPE: Stripe payment failed'); return OpenILS::Event->new( 'CREDIT_PROCESSOR_DECLINED_TRANSACTION', payload => $intent->{last_payment_error} ); } } else { - $logger->info('Stripe payment intent not retrieved'); - $logger->info('Stripe payment failed'); + $logger->info('STRIPE: Stripe payment intent not retrieved'); + $logger->info('STRIPE: Stripe payment failed'); return OpenILS::Event->new( "CREDIT_PROCESSOR_DECLINED_TRANSACTION", payload => $stripe->error # XXX what happens if this contains diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm index ffcda9a956..83d4b71108 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm @@ -2341,6 +2341,7 @@ sub load_myopac_payment_form { && $self->ctx->{get_org_setting}->($e->requestor->home_ou, 'credit.processor.default') eq 'Stripe') { my $skey = $self->ctx->{get_org_setting}->($e->requestor->home_ou, 'credit.processor.stripe.secretkey'); my $currency = $self->ctx->{get_org_setting}->($e->requestor->home_ou, 'credit.processor.stripe.currency'); + $logger->info("STRIPE: about to start Stripe with amount = $self->ctx->{fines}->{balance_owed} * 100 " . ($currency || 'usd') . " for user " . $self->ctx->{user}->id); my $stripe = Business::Stripe->new(-api_key => $skey); my $intent = $stripe->api('post', 'payment_intents', amount => $self->ctx->{fines}->{balance_owed} * 100, @@ -2349,8 +2350,9 @@ sub load_myopac_payment_form { ); if ($stripe->success) { $self->ctx->{stripe_client_secret} = $stripe->success()->{client_secret}; + $logger->info("STRIPE: Success for user " . $self->ctx->{user}->id); } else { - $logger->error('Error initializing Stripe: ' . Dumper($stripe->error)); + $logger->error('STRIPE: Error initializing Stripe: ' . Dumper($stripe->error)); $self->ctx->{cc_configuration_error} = 1; } } -- 2.11.0