The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

CashRegister - Simple Perl interface to IBM WebSphere Payment Manager 2.2 API

SYNOPSIS

use WebSphere::Payment; $cashregister = new WebSphere::Payment($pmurl,$currency,$admin, $timeout); # Creating a merchant $paystubref = {merchantnumber => $merchantnumber, merchanttitle => $merchantname, cassettename => 'SET', }; my ($errortext) = ();

if ($cashregister->createMerchant($paystubref) and !($cashregister->{prirc} or $cashregister->{secrc})) { if ($cashregister->createPaySystem($paystubref) and !($cashregister->{prirc} or $cashregister->{secrc})) { if ($cashregister->createAccount($paystubref) and !($cashregister->{prirc} or $cashregister->{secrc})) { if (! $cashregister->setUserAccessRights($paystubref) or ($cashregister->{prirc} or $cashregister->{secrc})) { $errortext = "SetUserAccessRights error"; } } else { $errortext = "Create Account error"; } } else { $errortext = "Create PaySystem error"; } } else { $errortext = "Create Merchant error"; } if ($errortext) { print "Fail...$errortext\n"; } else { print "Results...OK\n"; } print "prirc: " . $cashregister->{prirc} . "\n"; print "secrc: " . $cashregister->{secrc} . "\n"; print "pmmessage: " . $cashregister->{pmmessage} . "\n";

$paystubref = {merchantnumber => $merchantnumber, ordernumber => $ordernumber, approveflag => 0, depositflag => 0, amount => $amount, '%24expiry' => $yyyydd, '%24pan' => $cardnumber, '%24brand' => $cardtype, '%24orderdescription' => $description, '%24cardverifycodes' => $cvv2};

# Sending a transaction if ($cashregister->acceptPayment($paystubref)) { print "Results\n"; print "prirc: " . $cashregister->{prirc} . "\n"; print "secrc: " . $cashregister->{secrc} . "\n"; } print "pmmessage: " . $cashregister->{pmmessage} . "\n"; # Closing a Batch if ($batch = $cashregister->getOpenBatchNumber($paystubref)) { print "\n\nClosing the Batch number: $batch\n"; $cashregister->batchClose($paystubref, $batch); print "prirc: " . $cashregister->{prirc} . "\n"; print "secrc: " . $cashregister->{secrc} . "\n"; print "pmmessage: " . $cashregister->{pmmessage} . "\n"; } else { print "No batch opens. " . $cashregister->{error}; } $cashregister->close();

REQUIRES

Perl5.005

EXPORTS Nothing

DESCRIPTION

WebSphere::Payment provides a simple Interface to the API of the payment engine IBM WebSphere Payment Manager 2.2. It achieves this task, through commands send via http POST method.

METHODS

Creation

new WebSphere::Payment($pmurl,$admin,$currency,$timeout)

Create a new WebSphere::Payment object. If no parameters are specified, the object will be initialized with the default values. The pmurl is the url where the Payment Manager servlet (PaymentServlet) is listening. The currency parameter, represent the type of currency the transactions will use. The admin parameter consists of a userid and password string, separated by a single colon (":") character, encoded with a base64 encoding. This userid must have administrator permissions on the Payment Manager.

API Methods

acceptPayment($paydataref)

Send a transaction using the Payment Manager engine, with the data specified in the hash referenced by paydataref.

batchClose($paydataref, batchnumber)

Closes a batch given the merchantnumber within a hash reference and the number of the batch to be closed

getOpenBatchNumber($paydataref)

Given the merchantnumber within a hash reference returns the number of the batch if exists

createMerchant($paydataref)

Create a new merchant in the payment manager system

createPaySystem($paydataref)

Authorize a merchant to use a pay system (SET for example).

createAccount($paydataref)

Create a new Account for a merchant. An account represents the relationship between a merchant and an acquirer

SetUserAccessRights($paydataref)

Set permissions to a user of the Realm. The user must have the same name of the merchant

HISTORY

This module was originally created in Jun 2001 by Luis Moreno 1.20 Methods: batchClose, getOpenBatchNumber, createMerchant, createPaySystem, createAccount, setUserAccessRights (Oct 2001) 1.21 Minor documentation changes

AUTHOR

Luis Moreno, luis@cantv.net

COPYRIGHT

The IBM WebSphere Payment Manager is trademark of the IBM Corporation in the United States or both.

    This library is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.

SEE ALSO

perl(1), IBM WebSphere Payment Manager Programmer's Guide and Reference