CashRegister - Simple Perl interface to IBM WebSphere Payment Manager 2.2 API
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();
Perl5.005
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.
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.
Send a transaction using the Payment Manager engine, with the data specified in the hash referenced by paydataref.
Closes a batch given the merchantnumber within a hash reference and the number of the batch to be closed
Given the merchantnumber within a hash reference returns the number of the batch if exists
Create a new merchant in the payment manager system
Authorize a merchant to use a pay system (SET for example).
Create a new Account for a merchant. An account represents the relationship between a merchant and an acquirer
Set permissions to a user of the Realm. The user must have the same name of the merchant
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
Luis Moreno, luis@cantv.net
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.
perl(1), IBM WebSphere Payment Manager Programmer's Guide and Reference
To install WebSphere::Payment, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WebSphere::Payment
CPAN shell
perl -MCPAN -e shell install WebSphere::Payment
For more information on module installation, please visit the detailed CPAN module installation guide.