From 6fa5042945672ac49a92f8fea6e3d8f9976a916d Mon Sep 17 00:00:00 2001 From: Jeff Godin Date: Tue, 19 Jun 2012 12:31:03 -0400 Subject: [PATCH] Support SIP payment type 02 - credit card Record SIP payments with payment type 02 as credit_card_payment in Evergreen. Signed-off-by: Jeff Godin --- Open-ILS/src/perlmods/lib/OpenILS/SIP.pm | 4 ++-- .../perlmods/lib/OpenILS/SIP/Transaction/FeePayment.pm | 16 +++++++++++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/SIP.pm b/Open-ILS/src/perlmods/lib/OpenILS/SIP.pm index e015de75d3..9e877a53f8 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/SIP.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/SIP.pm @@ -473,9 +473,9 @@ sub pay_fee { $xact->sip_fee_type($fee_type); $xact->transaction_id($trans_id); $xact->fee_id($fee_id); - # We don't presently use these, but we might in the future. - $xact->patron_password($patron_pwd); $xact->sip_payment_type($pay_type); + # We don't presently use this, but we might in the future. + $xact->patron_password($patron_pwd); $xact->do_fee_payment(); 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 d0b3fa4709..b9c0654553 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/SIP/Transaction/FeePayment.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/SIP/Transaction/FeePayment.pm @@ -189,9 +189,19 @@ sub do_fee_payment { sub pay_bills { my ($self, $paymentref) = @_; my $user = $self->patron->{user}; - 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); + if ($self->sip_payment_type eq '02') { + # '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); + } } -- 2.11.0