1 # Before `make install' is performed this script should be runnable with
2 # `make test'. After `make install' it should work as `perl Business-OnlinePayment-PaySystems.t'
4 #########################
6 # change 'tests => 1' to 'tests => last_test_to_print';
8 use Test::More tests => 22;
11 BEGIN { use_ok('Business::OnlinePayment::PaySystems') };
13 #########################
15 # Insert your test code below, the Test::More module is use()ed here so read
16 # its man page ( perldoc Test::More ) for help writing this test script.
19 my $term = new Term::ReadLine 'foo';
20 diag("Please enter a test account for PaySystems");
21 my $prompt = "login: ";
22 my $login = $term->readline($prompt);
23 diag("Please enter the password for the test account $login");
24 $prompt = "password: ";
25 my $pass = $term->readline($prompt);
26 diag("Please enter a valid creditcard to test against ");
27 diag("It will be charged 2 dollars ");
28 $prompt = "card number: ";
29 my $cc = $term->readline($prompt);
30 diag("Please enter an expiry in the form MMYY");
32 my $exp = $term->readline($prompt);
33 diag("Please enter a cvv2");
35 my $cvv2 = $term->readline($prompt);
38 diag("\n\nTrying Normal Authorization\n\n");
41 ok($transaction = new Business::OnlinePayment('PaySystems'), 'new PaySystems');
42 ok($transaction->content(
49 last_name => 'Public',
50 action => 'NORMAL authorization',
53 address => '123 foo street',
55 state => 'California',
58 email => 'foo@bar.com',
59 customer_ip => '123.123.123.123',
60 phone => '1123342234',
63 ok($transaction->submit(), 'submit');
65 ok($transaction->is_success(), 'is success');
68 ok($authcode = $transaction->authorization(), "authorization $authcode");
70 ok($err = $transaction->error_message(), "error $err");
72 ok($on = $transaction->order_number(), "order number $on");
74 diag("\n\norder number: $on auth: $authcode Error: $err\n\n");
77 diag("\n\nTrying Authorization Only\n\n");
78 ok($tx = new Business::OnlinePayment('PaySystems'), 'new PaySystems 2');
86 last_name => 'Public',
87 action => 'authorization only',
90 address => '123 foo street',
92 state => 'California',
95 email => 'foo@bar.com',
96 customer_ip => '123.123.123.123',
97 phone => '1123342234',
102 ok($tx->submit(), 'submit');
103 $authcode = $err = $on = '';
104 ok($tx->is_success(), 'is success');
105 ok($authcode = $tx->authorization(), "authorization $authcode");
106 ok($err = $tx->error_message(), "error $err");
107 ok($on = $tx->order_number(), "order number $on");
110 diag("\n\norder_number: $on auth: $authcode err: $err\n\n");
113 diag("\n\nTrying Post Authorization\n\n");
114 ok($tx2 = new Business::OnlinePayment('PaySystems'), 'new PaySystems 3');
117 action => 'post authorization',
120 order_number => $ordernum,
123 ok($tx2->submit, 'submit');
124 $authcode = $err = $on = '';
125 ok($tx2->is_success(), 'is success');
126 ok($authcode = $tx2->authorization(), "authorization $authcode");
127 ok($err = $tx2->error_message(), "error $err");
128 ok($on = $tx2->order_number(), "order number $on");
130 diag("\n\norder_number: $on auth: $authcode err: $err\n\n");