3 #----------------------------------------------------------------
5 #----------------------------------------------------------------
7 require '../oils_header.pl';
8 use strict; use warnings;
13 return <<END_OF_USAGE;
14 $0 [-h] --login=UserName --password==MyPass [OPTIONS] [Transaction data]
17 -l --login Assigned by your processor API (specified in -t)
18 -p --password Assigned by your processor API (specified in -t)
19 -o --org-unit What library/branch is making this payment (numeric)
22 -t --target Payment processor (default PayPal)
23 -s --signature A "long password" required by PayPal in leiu of certificates
24 -r --server Use a specific server with a processor (AuthorizeNet)
25 -c --config_file opensrf_core.xml file (default /openils/conf/opensrf_core.xml)
28 -a --amount Monetary value, no dollar sign, default a random value under 25.00
29 -i --id Patron ID#, default 5 (for no reason)
30 -n --number Credit card number to be charged
31 -x --expires Date (MM-YYYY) of card expiration, default 12-2014
35 $0 --login=seller_1254418209_biz_api1.example.org \\
36 --password=1254618222 \\
37 --signature=AiPC9xjkCyDFQXbSkoZcgqH3hpacAVPVw5GcZgNKVA9SGKcbrqLuhLks \\
45 my $config = '/openils/conf/opensrf_core.xml';
46 my $processor = 'PayPal';
47 my $number = '4123000011112228';
48 my $expires = '12-2014';
52 my ($login, $password, $ou, $signature, $help, $amount, $server);
55 'config_file=s' => \$config,
56 'target=s' => \$processor,
59 'password=s' => \$password,
60 's|signature=s' => \$signature,
61 'amount=f' => \$amount,
63 'number=s' => \$number,
64 'x|expires=s' => \$expires,
65 'r|server=s' => \$server,
69 $help and print usage and exit;
71 unless ($login and $processor and $password and $ou) {
75 osrf_connect($config);
77 $amount or $amount = int(rand(25)) . '.' . sprintf("%02d", int(rand(99)));
80 Attempting transaction:
82 processor => $processor,
84 password => $password,
85 signature => $signature,
89 expiration => $expires,
94 description => test transaction processid $$
99 my( $user, $evt ) = simplereq('open-ils.credit', 'open-ils.credit.process',
101 processor => $processor,
103 password => $password,
104 signature => $signature,
108 expiration => $expires,
113 description => "test transaction processid $$"
116 oils_event_die($evt); # this user was not found / not all methods return events..