[OPEN-ILS-DEV] SIP2 Fee Payment Code

Mike Rylander mrylander at gmail.com
Thu May 12 17:17:06 EDT 2011


On Thu, May 12, 2011 at 4:04 PM, Jason Stephenson <jstephenson at mvlc.org> wrote:
> Hello, all.
>
> I am working on code to handle the SIP2 Fee Paid message (37)/response (38)
> pair with Evergreen.
>

That's great news! Everyone wants this, but no one has stepped up to
fund development or donate code yet.

> I have some code that basically works, that is, it can accept a 37 message
> from the self check, apply the payment to a patron's fees, and return a 38
> response indicating whether or not the payment was applied.
>
> Payments are applied in a very rudimentary fashion, though if the self check
> sends a transaction id that it perhaps got earlier from the server, it will
> try to apply the payment to the corresponding transaction for the patron.
>

The way you're applying payments to unidentified transactions is
more-or-less in line with what the staff client does when it all
transactions are checked in the billing interface.  With transaction
id support, the client can simulate specific bill payment, so that's
good.  I'm a little concerned about piggy-backing this on a generic
find-all-with-balance call, since it could certainly be done with a
direct lookup, but that's an optimization for later, perhaps, assuming
identified transactions are common enough to support that codepath.

> The code still needs more testing and perhaps more logging. I also need to
> add the ability to process credit card payments. Currently it is hard coded
> to handle all payments as cash.
>

Right ... is there a way for a generic SIP client to pass this
information, or will we likely be looking at an EG-user (SIP client
user) setting, or SIP config file setting, or something else entirely?
 Or will this require some specialized extensions to 36/37?

A couple minor style nits: please declare your for[each] loop vars
inline, and please cuddle your braces! ;)

There are also some very idiomatic things going on in the Transaction
subclass, but I can't blame those on you -- the surrounding (peer)
modules do the same things (like slice assignments).

What I would /really/ like to see is lots of inline comments
explaining the assumptions in do_fee_payment().  For instance, the
'else' of the outermost 'if' block is magical and could use explicit
documentation, as could IMO the central foreach loop.

One last thought before I set this aside for now, I wonder if it
wouldn't be best to batch up all sub-payments to submit them in one
go.  This way, if one payment fails they all fail, and you don't have
to deal with partial refunds or other strange issues -- just kick it
all back to the SIP client to handle atomically.

> If anyone wants to play with it and try it on their self checks you can get
> the code from the following git repository:
>
> git://git.mvlcstaff.org/jason/ILS
>
> You will want the SIP23738 branch. (HTTP URL should work as well for
> cloning/merging.)
>
> You will also want to get the SIPServer code from the following repository:
>
> git://git.mvlcstaff.org/jason/SIPServer
>
> Here, you will want the fixes branch. This branch contains fixes to the
> SIPServer code from github so that checksums work properly with clients, and
> so that the Fee Paid message is correctly parsed by the server.

I've not looked at this at all ... and won't be the best to do so.  Anyone?

>
> The above code has all been tested on a trunk installation of Evergreen so
> far, but it *should* merge and work with a 2.1 or 2.0 branch, since I don't
> think there have been any changes to SIP in the mean time.
>

As far as the authoritative repo, it won't be able to go into anything
but trunk since we're in beta (aka feature freeze) for 2.1 and we
haven't branched 2.2 yet.  Of course that shouldn't stop anyone from
testing it if they feel so inclined.

> I have a standing DCO, so if anyone from ESI wants to merge any of this code
> into the main repository of either SIPServer or Open-ILS/Evergreen, then
> feel free. It is our intention that this code make it into the mainline
> repositories when it is deemed ready by the community.
>

While I am "from ESI", surely any committer is free to do this.  :)

Thanks again, Jason.

-- 
Mike Rylander
 | VP, Research and Design
 | Equinox Software, Inc. / Your Library's Guide to Open Source
 | phone:  1-877-OPEN-ILS (673-6457)
 | email:  miker at esilibrary.com
 | web:  http://www.esilibrary.com


More information about the Open-ils-dev mailing list