From: Bill Erickson Date: Wed, 12 Jun 2019 15:37:56 +0000 (+0000) Subject: JBAS-2297 Support SIP check payments X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=bae164eccd664fed72e41cc0ffa11dc6beb8af17;p=working%2FEvergreen.git JBAS-2297 Support SIP check payments Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/SIP.pm b/Open-ILS/src/perlmods/lib/OpenILS/SIP.pm index 500efa22bc..fab7163432 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/SIP.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/SIP.pm @@ -463,7 +463,8 @@ sub end_patron_session { sub pay_fee { my ($self, $patron_id, $patron_pwd, $fee_amt, $fee_type, - $pay_type, $fee_id, $trans_id, $currency) = @_; + $pay_type, $fee_id, $trans_id, $currency, $check_number, + $register_login) = @_; $self->verify_session; @@ -485,6 +486,8 @@ sub pay_fee { $xact->sip_payment_type($pay_type); # We don't presently use this, but we might in the future. $xact->patron_password($patron_pwd); + $xact->check_number($check_number); + $xact->register_login($register_login); $xact->do_fee_payment(); diff --git a/Open-ILS/src/perlmods/lib/OpenILS/SIP/Transaction.pm b/Open-ILS/src/perlmods/lib/OpenILS/SIP/Transaction.pm index 729182eade..9d6564e2a8 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/SIP/Transaction.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/SIP/Transaction.pm @@ -27,6 +27,8 @@ my %fields = ( editor => undef, authtoken => '', fee_ack => 0, + check_number => undef, + register_login => undef ); our $AUTOLOAD; diff --git a/Open-ILS/src/perlmods/lib/OpenILS/SIP/Transaction/FeePayment.pm b/Open-ILS/src/perlmods/lib/OpenILS/SIP/Transaction/FeePayment.pm index df424dda3f..827572da7e 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/SIP/Transaction/FeePayment.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/SIP/Transaction/FeePayment.pm @@ -189,20 +189,45 @@ sub do_fee_payment { sub pay_bills { my ($self, $paymentref) = @_; my $user = $self->patron->{user}; - if ($self->sip_payment_type eq '02' || $self->sip_payment_type eq '01') { + my $ptype = $self->sip_payment_type || ''; + my $rlogin = $self->register_login || ''; + + my $params = { + userid => $user->id, + note => "Via SIP2", + payments => $paymentref, + payment_type => 'cash_payment' + }; + + if ($rlogin) { + syslog('LOG_DEBUG', "Register login sent as '$rlogin'"); + + if ($rlogin =~ /\\.+/) { # Windows domain login + my @parts = split(/\\/, $rlogin); + $rlogin = $parts[1]; + } + + $params->{note} = "Via SIP2: Register login '$rlogin'"; + } + + if ($ptype eq '02' || $ptype eq '01') { # '01' is "VISA" # '02' is "credit card" - my $transaction_id = $self->transaction_id ? $self->transaction_id : 'Not provided by SIP client'; - return $U->simplereq('open-ils.circ', 'open-ils.circ.money.payment', $self->{authtoken}, - { payment_type => "credit_card_payment", userid => $user->id, note => "via SIP2", - cc_args => { approval_code => $transaction_id, }, - payments => $paymentref}, $user->last_xact_id); - } else { - # record as "cash" - return $U->simplereq('open-ils.circ', 'open-ils.circ.money.payment', $self->{authtoken}, - { payment_type => "cash_payment", userid => $user->id, note => "via SIP2", - payments => $paymentref}, $user->last_xact_id); + + $params->{payment_type} = 'credit_card_payment'; + $params->{cc_args} = { + approval_code => + $self->transaction_id || 'Not provided by SIP client' + }; + + } elsif ($ptype eq '05') { + $params->{payment_type} = 'check_payment'; + $params->{check_number} = + $self->check_number || 'Not Provided by SIP Client'; } + + return $U->simplereq('open-ils.circ', 'open-ils.circ.money.payment', + $self->{authtoken}, $params, $user->last_xact_id); }