Support SIP payment type 02 - credit card
authorJeff Godin <jgodin@tadl.org>
Tue, 19 Jun 2012 16:31:03 +0000 (12:31 -0400)
committerLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Mon, 30 Jul 2012 22:55:46 +0000 (18:55 -0400)
Record SIP payments with payment type 02 as credit_card_payment in
Evergreen.

Signed-off-by: Jeff Godin <jgodin@tadl.org>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>

Open-ILS/src/perlmods/lib/OpenILS/SIP.pm
Open-ILS/src/perlmods/lib/OpenILS/SIP/Transaction/FeePayment.pm

index 4774174..75a8b53 100644 (file)
@@ -466,9 +466,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();
 
index d0b3fa4..b9c0654 100644 (file)
@@ -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);
+    }
 }