>I wrote that before I got your post. I am on CFMX. I am not a CGI
>programmer but can you let me know what kind of scripting you had to do to
>get it to work? Any help is appreciated - thanks.
well, it's mostly hacked together in Perl, but if you want to wade
through the following and have a strong understanding of how
CyberCash works behind the scenes, then i bet you can get it to
work... you'll of course need to download the Perl MCK and agree to
whatever license agreement it includes. it took me lots of trial and
error before i stumbled across exactly the right steps and permission
settings to make this work. also, that was about 9 months ago so i'm
not sure how much help i'll be if you can't get it working, but feel
free to ask...
to see it in action you can go buy something from www.aes.org. ;-)
steve
-------------
*** excerpt from CF Custom Tag which calls the Perl script ***
<!--- create a temp file to capture output of cfexecute --->
<cfset tmpFile = getTempFile(getTempDirectory(),"cc")>
<cfif fileExists(tmpFile)>
<!--- charge card and put output into the temp file --->
<cfexecute
name="/htdocs/cybercash/perl_cybercash"
outputfile="#tmpFile#"
arguments="mauthonly #ccid# #attributes.amount#
#attributes.card_exp# #attributes.card_number#
#attributes.card_name#">
</cfexecute>
<!--- loop over the temp file until cfexecute has put it's
output there --->
<cfsilent>
<cfset fileDone = FALSE>
<cfloop condition="not fileDone">
<cffile action="read" file="#tmpFile#" variable="fileContents">
<cfif fileContents contains "done1234567890">
<cfset fileDone = TRUE>
</cfif>
</cfloop>
</cfsilent>
<!--- populate status and errorMsg variables with info in
temp file --->
<cfset ccResultMStatus = "">
<cfset ccResultMErrMsg = "">
<cfloop index="lineFromFile" list="#fileContents#"
delimiters="#chr(10)#">
<cfif lineFromFile contains "MStatus">
<cfset ccResultMStatus =
replace(lineFromFile,"MStatus:","")>
<cfelseif lineFromFile contains "MErrMsg">
<cfset ccResultMErrMsg =
replace(lineFromFile,"MErrMsg:","")>
</cfif>
</cfloop>
<!--- delete temp file to keep server clean but to also
protect credit card info --->
<cffile action="delete" file="#tmpFile#">
<cfelse>
<cfset ccResultMStatus = "failure-internal">
<cfset ccResultMErrMsg = "Failure: internal CF error -
couldn't open temp file">
</cfif>
*** entire Perl script "perl_cybercash" ***
#!/usr/bin/perl
# Note: you must copy the three compiled apps into a directory in the PATH
# for whatever process calls CFEXECUTE. i.e. i first ran this command:
# print "PATH=$ENV{PATH}\n";
# from a Perl script called with CFEXECUTE and then copied computeMD5hash,
# MCKdecrypt, and MCKencrypt to /usr/local/bin
# if you try to alter the PATH yourself you'll bang your head
against the wall for days
require 5.005;
$ConfigFile = "/htdocs/cybercash/merchant_conf";
use lib "/htdocs/cybercash";
use CCMckLib3_2 qw($MCKversion %Config InitConfig CCError CCDebug CCDebug2 );
use CCMckDirectLib3_2 qw(SendCC2_1Server);
use CCMckErrno3_2 qw(MCKGetErrorMessage $E_NoErr);
# load and check the config file (this code stolen from the CyberCash MCK)
($status) = &InitConfig($ConfigFile);
if ($status != $E_NoErr) {
# %Config is a failure struct
foreach (keys(%Config)) {
print " $_ ==> $Config{$_}\n";
}
$errmsg = &MCKGetErrorMessage($status);
die("$0: $errmsg\n");
}
&CCDebug("Entering $0\n");
if ($ARGV[0] eq "mauthonly") {
#print "running mauthonly...\n";
if ($ARGV[1] eq "") {
print "Error: proper mauthonly is 'mauthonly order_id
amount card_exp card_number card_name'\n";
} else {
$action="mauthonly";
$order_id=$ARGV[1];
$amount="$ARGV[2] $ARGV[3]";
$card_exp=$ARGV[4];
$card_number=$ARGV[5];
$card_name="$ARGV[6] $ARGV[7] $ARGV[8] $ARGV[9]
$ARGV[10] $ARGV[11] $ARGV[12]";
$card_name =~ s/\s+$//;
# send the parameters to the CyberCash server
%result = &SendCC2_1Server($action
, 'order-id', $order_id
, 'amount', $amount
, 'card-exp', $card_exp
, 'card-number', $card_number
, 'card-name', $card_name
);
#print "action=$action / order-id=$order_id /
amount=$amount\n";
#print "card_exp=$card_exp / card_number=$card_number\n";
#print "card_name=$card_name!\n";
}
} elsif ($ARGV[0] eq "postauth") {
#print "running postauth...\n";
if ($ARGV[1] eq "") {
print "Error: proper postauth is 'postauth order_id
amount card_exp card_number'\n";
} else {
$action="postauth";
$order_id=$ARGV[1];
$amount="$ARGV[2] $ARGV[3]";
$card_exp=$ARGV[4];
$card_number=$ARGV[5];
# send the parameters to the CyberCash server
%result = &SendCC2_1Server($action
, 'order-id', $order_id
, 'amount', $amount
, 'card-exp', $card_exp
, 'card-number', $card_number
);
#print "action=$action / order-id=$order_id /
amount=$amount\n";
#print "card_exp=$card_exp / card_number=$card_number\n";
}
} elsif ($ARGV[0] eq "return") {
#print "running return...\n";
if ($ARGV[1] eq "") {
print "Error: proper return is 'return order_id amount'\n";
} else {
$action="return";
$order_id=$ARGV[1];
$amount="$ARGV[2] $ARGV[3]";
# send the parameters to the CyberCash server
%result = &SendCC2_1Server($action
, 'order-id', $order_id
, 'amount', $amount
);
#print "action=$action / order-id=$order_id /
amount=$amount\n";
}
} else {
print "Error: first argument must be mauthonly, postauth, or return\n";
}
# spit out the results so that the CF tag can parse them
foreach (keys(%result)) {
print "$_:$result{$_}\n";
}
# spit out a final marker so that CF knows the script is finished running
print "done1234567890\n";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=14
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=14
Signup for the Fusion Authority news alert and keep up with the latest news in
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.14