This commit was generated by cvs2svn to compensate for changes in r57, which
[freeside.git] / etc / example-direct-cardin
1 #!/usr/local/bin/perl
2
3 ###
4 # THIS IS FROM CYBERCASH (is there a newer version?)
5 ###
6
7 $paymentserverhost = 'localhost';
8 $paymentserverport = 8000;
9 $paymentserversecret = 'two-turntables';
10 use CCLib qw(sendmserver);
11
12 # first lets fake up some data 
13 # use time of day and pid to give me my pretend
14 # order number
15 # you obviously need to get real data from somewhere...
16
17 $oid = "test$$"; #fake order number.
18 $amount = 'usd 42.42';
19 $ramount = 'usd 24.24';
20 $pan = '4111111111111111';
21 $name = 'John Q. Doe';
22 $addr = '17 Richard Rd.';
23 $city = 'Ivyland';
24 $state = 'PA';
25 $zip = '18974';
26 $country = 'USA';
27 $exp = '7/97';
28
29
30 %result = &sendmserver('mauthcapture', 
31                        'Order-ID', $oid,
32                        'Amount', $amount,
33                        'Card-Number', $pan,
34                        'Card-Name', $name,
35                        'Card-Address', $addr,
36                        'Card-City', $city,
37                        'Card-State', $state,
38                        'Card-Zip', $zip,
39                        'Card-Country', $country,
40                        'Card-Exp', $exp);
41
42 #
43 # just dump results to stdout.
44 # you should process them...
45 # to allow results to affect operation of your fulfillment...
46 #
47 foreach (keys(%result)) {
48    print " $_ ==> $result{$_}\n";
49 }
50
51 print "\n";
52
53 exit;
54
55 $trans=$result{'MTransactionNumber'};
56 $code=$result{'MRetrievalCode'};
57
58 %result = &sendmserver('return',
59                         'Order-ID', $oid,
60                         'Return-Amount',$ramount,
61                         'Amount',$amount,
62                         );
63
64 foreach (keys(%result)) {
65    print " $_ ==> $result{$_}\n";
66 }
67