4 "http://localhost:2080/selfservice.cgi?action=finish_thirdparty_payment";
8 use Date::Format 'time2str';
12 my $cache = Cache::FileCache->new(
13 { cache_root => '/tmp', namespace => 'FCMB-Faker' }
16 my $landing = URI->new($LANDING_URL);
19 my $reference = $cgi->param('reference');
20 my $txn = $cache->get($reference);
22 if ( $cgi->param('submit') eq 'Cancel' ) {
23 $txn->{status} = 3; #canceled
24 $landing->query_form(_cancel => 1);
27 # some information captured from the customer
28 # (in Real Life this would also be their credit card/bank account number)
29 $txn->{first} = $cgi->param('first');
30 $txn->{last} = $cgi->param('last');
31 # set status = the last digit of cents
33 my $cents = ($txn->{amt} - int($txn->{amt})) * 100;
34 $txn->{status} = $cents % 10;
35 $txn->{date} = time2str('%Y-%m-%d', time);
39 'OrderID' => $txn->{orderId},
40 'TransactionReference' => $reference
44 $cache->set($reference => $txn);
45 print $cgi->redirect($landing);