home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.wwiv.com
/
ftp.wwiv.com.zip
/
ftp.wwiv.com
/
pub
/
BBS
/
SHOP230.ZIP
/
EXAMPLE1.ARJ
/
CHKCARD.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1995-05-03
|
7KB
|
159 lines
{ ************************************************************************** }
{ Program-name: ChkCard.exe }
{ }
{ ************************************************************************** }
{ This is a little Sample of a 'ShopDoor' to 'CreditCard Authorize system' }
{ Interface. An explanation: }
{ }
{ 1) A CreditCard Authorize system would scan for files with }
{ the filename-format 'SHOP###.CC'. The '###' is the nodenumber. }
{ If it found such a file, it will contact the Authorize-link and }
{ write an answer back. This answer will be a file with }
{ the filename-format 'NODE###.OK' or 'NODE###.DEC'. }
{ The '.OK'-file will be written if the transaction has been authorized, }
{ and the '.DEC'-file will be written if the transaction has NOT }
{ been authorized... }
{ }
{ 2) The 'SHOP###.CC'-file is a simple 3-line text-file like this: }
{ }
{ 4929 1234 5678 1234 }
{ 0595 }
{ 120 }
{ }
{ The first line is the CreditCard number, }
{ ShopDoor's format: 4929123456781234. }
{ (conversion needed) }
{ }
{ The second line is the Expire Date, }
{ ShopDoor's format: 05/95. }
{ (conversion needed) }
{ }
{ The third line is the amount of money, }
{ ShopDoor's format: 120,24. }
{ (a round Up and a conversion needed) }
{ }
{ Just take a good look at the little program and design your own }
{ interface if needed. Contact us if you need help ! }
{ }
{ ************************************************************************** }
{ }
{ (C) 1995 by: A.S. Kerkmeester, Simplesoft Developments }
{ }
{ Written with Turbo Pascal v7.0 }
{ }
{ Possible parameters: }
{ ----------------------------------------- }
{ Rem Parameter %1 = CreditCard Number }
{ Rem Parameter %2 = CreditCard Expire Date }
{ Rem Parameter %3 = Valuta symbol }
{ Rem Parameter %4 = Amount of Money }
{ Rem Parameter %5 = Node }
{ }
{ ************************************************************************** }
program CardDriver;
uses crt;
const Errorcode = 0;
Approved = 1;
Declined = 2;
var
f_chk : text;
retcode : Byte;
n,code : integer;
amount_int : longint;
amount_real : real;
hulpstr,number,nodenr : string;
expire,valuta,amount : string;
ccfile,okfile,decfile : string;
{ ************************************************************************** }
Function FileExist(filename: String): Boolean; { File exist: TRUE , else: FALSE }
var f: Text;
begin
assign(f,filename);
{$I-}
reset(f);
close(f);
{$I+}
FileExist:=ioresult=0;
end;
{ ************************************************************************** }
begin
retcode:=Errorcode;
if paramcount<5 then
begin
writeln('ShopDoor to ''CreditCard Authorize system'' Interface');
writeln;
writeln('Usuage: ');
writeln;
writeln('CHKCARD.EXE %1 %2 %3 %4 %5');
writeln;
writeln('%1 = <creditcard no>');
writeln('%2 = <expire date>');
writeln('%3 = <valuta symbol>');
writeln('%4 = <amount of money>');
writeln('%5 = <node number>');
writeln;
halt(retcode); { Not enough Parameters: Error ! }
end;
number:=paramstr(1); { Get CreditCard number }
expire:=paramstr(2); { Get Expire Date }
valuta:=paramstr(3); { Get Valuta Symbol }
amount:=paramstr(4); { Get Amount of money }
nodenr:=paramstr(5); { Get Node-number }
{ make filename for Authorize system }
if length(nodenr)=1 then
nodenr:='00'+nodenr;
if length(nodenr)=2 then
nodenr:='0'+nodenr;
ccfile := 'SHOP'+nodenr+'.CC';
okfile := 'NODE'+nodenr+'.OK';
decfile := 'NODE'+nodenr+'.DEC';
{ change number format }
hulpstr:='';
for n:=1 to 16 do
begin
hulpstr:=hulpstr+number[n];
if (n=4) or (n=8) or (n=12) then
hulpstr:=hulpstr+' ';
end;
number:=hulpstr;
{ change expire date format }
hulpstr:='';
for n:=1 to 5 do
begin
if n<>3 then hulpstr:=hulpstr+expire[n];
end;
expire:=hulpstr;
{ change amount in a round value }
val(amount,amount_real,code);
amount_int:=round(amount_real);
str(amount_int,amount);
Assign(f_chk,ccfile); { Create special file for Authorize system }
Rewrite(f_chk);
Writeln(f_chk,number);
Writeln(f_chk,expire);
Writeln(f_chk,amount);
Close(f_chk);
delay(8000); { wait for 8000ms : Authorize system shall examine the file }
if fileexist(okfile) then
retcode:=Approved
else
begin
if fileexist(decfile) then
retcode:=Declined;
end;
halt(retcode); { Stop Driver, change DOS Errorlevel }
end.
{ ************************************************************************** }