4 use Test::More tests => 2;
7 my $FS = FS::Test->new;
9 # In the stock database, cust#5 has open invoices
10 my $cust_main = FS::cust_main->by_key(5);
11 my $balance = $cust_main->balance;
12 ok( $balance > 10.00, 'customer has an outstanding balance of more than $10.00' );
14 # Get the payment form
15 $FS->post('/misc/payment.cgi?payby=CARD;custnum=5');
16 my $form = $FS->form('OneTrueForm');
17 $form->value('amount' => '10.00');
18 $form->value('custpaybynum' => '');
19 $form->value('payinfo' => '4012888888881881');
20 $form->value('month' => '01');
21 $form->value('year' => '2020');
22 # payname and location fields should already be set
23 $form->value('save' => 1);
24 $form->value('auto' => 1);
27 # on success, gives a redirect to the payment receipt
29 if ($FS->redirect =~ m[^/view/cust_pay.html\?paynum=(\d+)]) {
30 pass('payment processed');
32 } elsif ( $FS->error ) {
33 fail('payment rejected');
36 fail('unknown result');