#!/usr/bin/perl use strict; use warnings; use diagnostics -verbose; use Win32; use Win32::GUI qw(ES_WANTRETURN WS_VISIBLE WS_VSCROLL ); my ($DOShwnd, $DOShinstance) = Win32::GUI::GetPerlWindow(); #Win32::GUI::Hide($DOShwnd); my $desk = Win32::GUI::GetDesktopWindow(); my $dw = Win32::GUI::Width($desk); my $dh = Win32::GUI::Height($desk); use vars qw/$window $status_bar $button1 $button2 $button3 $card_field $sale_field $event_field $card_number_label $option_flag/; $window = Win32::GUI::Window->new( -name => 'main', -text => "Credit Card Authorization", -pos => [170,130], -size => [625,450], -helpbox => 0, -resizable => 0, -maximizebox => 0, ); my $transaction_info = read_psin(); my @transaction_info = @{$transaction_info}; my $card_type = $transaction_info[0]; my $sale_amount = $transaction_info[1]; $status_bar = $window->AddStatusBar( -name => 'status_bar', -text => '', ); $window->Change( -onMouseMove => sub { $status_bar->Text(''); }, ); $button1 = $window->AddButton( -name => 'manual_dial', -text => '1', -size => [60,25], -pos => [120,355], -onMouseMove => sub { $status_bar->Text('Manual card entry with dial-out for approval'); }, ); $button2 = $window->AddButton( -name => 'swipe_phone', -text => '2', -size => [60,25], -pos => [270,355], -onMouseMove => sub { $status_bar->Text('Swipe card entry with phone call for an approval'); }, ); $button3 = $window->AddButton( -name => 'manual_phone', -text => '3', -size => [60,25], -pos => [420,355], -onMouseMove => sub { $status_bar->Text('Manual card entry with phone call for an approval'); }, ); $window->AddLabel( -name => 'header', -text => 'Credit Card Authorization', -pos => [160,10], ); $window->AddLabel( -name => 'card_type', -text => 'Card Type:', -pos => [20,40], ); $window->AddLabel( -name => 'amount', -text => 'Sale Amount:', -pos => [20,80], ); $card_field = $window->AddTextfield ( -name => 'card_field', -text => $card_type, -size => [180,20], -pos => [90,39], -readonly => 1, ); $sale_field = $window->AddTextfield( -name => 'sale_field', -text => $sale_amount, -size => [180,20], -pos => [90,79], -readonly => 1, ); $event_field = $window->AddTextfield( -name => 'event_field', -size => [360,180], -pos => [120,160], -readonly => 0, -multiline => 1, ); my $card_input = $window->AddTextfield( -name => 'card_input', -size => [480,40], -pos => [90,119], -multiline => 1, -visible => 0, ); $card_number_label = $window->AddLabel( -name => 'card_number_label', -text => 'Card Number: ', -pos => [280,40&], -visible => 0, ); $window->Show(); $window->DoEvents(); $event_field->Append("Initializing modem... "); init_modem(); $event_field->Append("initialized\n"); $card_input->SetFocus(); $event_field->Append("Please swipe card... "); $window->Show(); $window->DoEvents(); my $input1 = $card_input->GetLine(0); my $input2 = $card_input->GetLine(1); while ($card_input->GetLine(1) !~ /\?$/) { #swipe ends second line with a question mark $card_input->SetFocus(); $input1 = $card_input->GetLine(0); $input2 = $card_input->GetLine(1); $window->DoEvents(); # Win32::GUI::Dialog(); ####working here to take in the click event#### } $event_field->Append("swiped\n"); print "\$input1: $input1\n"; print "\$input2: $input2\n"; my $cc_number; if ($input1 =~ /^\%B(\d{16})/i) { $cc_number = $1; } my $exp_dt; if ($input2 =~ /\=(\d{2})(\d{2})(.*)/) { $exp_dt = $2 . $1; } sleep 1; $event_field->Append("Connecting... ");