File: D:/web/homefly/inc/incpayprov.asp
<%
'This code is copyright (c) Internet Business Solutions SL, all rights reserved.
'The contents of this file are protect under law as the intellectual property
'of Internet Business Solutions SL. Any use, reproduction, disclosure or copying
'of any kind without the express and written permission of Internet Business
'Solutions SL is forbidden.
'Author: Vince Reid, vince@virtualred.net
if Session("loggedon") <> "virtualstore" then response.end
Dim sSQL,rs,alldata,success,cnn,rowcounter,errmsg,data1name,data2name,isenabled,demomode,vsdetails
success=true
demomodeavailable=true
Set rs = Server.CreateObject("ADODB.RecordSet")
Set cnn=Server.CreateObject("ADODB.Connection")
cnn.open sDSN
if request.form("act")="domodify" then
isenabled=0
demomode=0
if request.form("isenabled")="1" then isenabled=1
if request.form("demomode")="1" then demomode=1
sSQL = "UPDATE payprovider SET payProvShow='"&replace(request.form("showas"),"'","''")&"',payProvEnabled="&isenabled&",payProvDemo="&demomode&","
if Request.Form("id")="7" then ' VeriSign
sSQL = sSQL & "payProvData1='"&replace(request.form("data1"),"'","''")&"&"&replace(request.form("data2"),"'","''")&"&"&replace(request.form("data3"),"'","''")&"&"&replace(request.form("data4"),"'","''")&"'"
elseif Request.Form("id")="10" then ' Capture Card
data1 = ""
for index=1 to 12
if Request.Form("cardtype" & index)="X" then
data1=data1&"X"
else
data1=data1&"O"
end if
next
sSQL = sSQL & "payProvData1='"&data1&"'"
if Trim(request.form("data2"))<>"" then
sSQL2 = "UPDATE admin SET adminCert='"&replace(request.form("data2"),"'","''")&"' WHERE adminID=1"
cnn.Execute(sSQL2)
end if
else
sSQL = sSQL & "payProvData1='"&replace(request.form("data1"),"'","''")&"',payProvData2='"&replace(request.form("data2"),"'","''")&"'"
end if
if Trim(request.form("transtype"))<>"" then sSQL = sSQL & ",payProvMethod=" & Trim(request.form("transtype"))
sSQL = sSQL & " WHERE payProvID="&Request.Form("id")
on error resume next
cnn.Execute(sSQL)
if err.number<>0 then
success=false
errmsg = "There was an error writing to the database.<br>"
if err.number = -2147467259 then
errmsg = errmsg & "Your database does not have write permissions."
else
errmsg = errmsg & err.description
end if
else
response.write "<meta http-equiv=""refresh"" content=""3; url=adminpayprov.asp"">"
end if
on error goto 0
elseif request.form("act")="changepos" then
currentorder = Int(Request.Form("selectedq"))
neworder = Int(Request.Form("newval"))
sSQL = "SELECT payProvID FROM payprovider ORDER BY payProvEnabled DESC,payProvOrder"
rs.Open sSQL,cnn,0,1
alldata=rs.getrows
rs.Close
FOR rowcounter=0 TO ubound(alldata,2)
theorder = rowcounter+1
if currentorder = theorder then
theorder = neworder
elseif (currentorder > theorder) AND (neworder <= theorder) then
theorder = theorder + 1
elseif (currentorder < theorder) AND (neworder >= theorder) then
theorder = theorder - 1
end if
sSQL="UPDATE payprovider SET payProvOrder="&theorder&" WHERE payProvID="&alldata(0,rowcounter)
cnn.Execute(sSQL)
NEXT
response.write "<meta http-equiv=""refresh"" content=""2; url=adminpayprov.asp"">"
else
sSQL = "SELECT payProvID,payProvName,payProvShow,payProvDemo,payProvEnabled,payProvData1,payProvData2,payProvMethod FROM payprovider WHERE payProvAvailable=1"
if Request.Form("id")<>"" then
sSQL = sSQL & " AND payProvID=" & request.form("id")
else
sSQL = sSQL & " ORDER BY payProvEnabled DESC,payProvOrder"
end if
rs.Open sSQL,cnn,0,1
alldata=rs.getrows
rs.Close
end if
%>
<script language="JavaScript">
<!--
function modrec(id) {
document.mainform.id.value = id;
document.mainform.act.value = "modify";
document.mainform.submit();
}
// -->
</script>
<table border="0" cellspacing="<%=maintablespacing%>" cellpadding="<%=maintablepadding%>" width="<%=maintablewidth%>" bgcolor="<%=maintablebg%>" align="center">
<% if request.form("act")="domodify" AND success then %>
<tr>
<td width="100%">
<table width="<%=innertablewidth%>" border="0" cellspacing="<%=innertablespacing%>" cellpadding="<%=innertablepadding%>" bgcolor="<%=innertablebg%>">
<tr>
<td width="100%" colspan="2" align="center"><br><b>Update Successful !</b><br><br>You will now be forwarded
to the Payment Provider admin page.<br><br>If that does not happen automatically then please <A href="adminpayprov.asp"><b>click here</b></a>.<br><br>
<img src="../images/clearpixel.gif" width="350" height="3">
</td>
</tr>
</table></td>
</tr>
<% elseif request.form("act")="domodify" then %>
<tr>
<td width="100%">
<table width="<%=innertablewidth%>" border="0" cellspacing="<%=innertablespacing%>" cellpadding="<%=innertablepadding%>" bgcolor="<%=innertablebg%>">
<tr>
<td width="100%" colspan="2" align="center"><br><font color="#FF0000"><b>Operation Failed ! !</b></font><br><br><%=errmsg%><br><br>
<a href="javascript:history.go(-1)"><b>Click here to go back.</b></a></td>
</tr>
</table></td>
</tr>
<% elseif request.form("act")="modify" then
data2name=""
if alldata(0,0)=1 then ' PayPal
data1name="Email Address"
demomodeavailable=false
elseif alldata(0,0)=2 then ' 2Checkout
data1name="Account Number"
elseif alldata(0,0)=3 OR alldata(0,0)=13 then ' Authorize.net
data1name="Merchant Login ID"
data2name="Transaction Key"
elseif alldata(0,0)=4 then ' Email
data1name="Email Address for Orders"
demomodeavailable=false
elseif alldata(0,0)=5 then ' World Pay
data1name="Account Number"
elseif alldata(0,0)=6 then ' NOCHEX
data1name="Email Address"
elseif alldata(0,0)=8 then ' Payflow Link
data1name="Login"
data2name="Partner"
elseif alldata(0,0)=9 then ' secpay
data1name="Merchant ID"
elseif alldata(0,0)=10 then ' Capture Card
demomodeavailable=false
elseif alldata(0,0)=11 OR alldata(0,0)=12 then ' PSiGate
data1name="Merchant ID"
elseif alldata(0,0)=14 then ' Custom Payment Processor
data1name="Data 1"
data2name="Data 2"
elseif alldata(0,0)=15 then ' Netbanx
data1name="Merchant ID"
demomodeavailable=false
else
data1name="Data 1"
end if
%>
<tr>
<form name="mainform" method="POST" action="adminpayprov.asp">
<td width="100%">
<input type="hidden" name="posted" value="1">
<input type="hidden" name="act" value="domodify">
<input type="hidden" name="id" value="<%=alldata(0,0)%>">
<table width="<%=innertablewidth%>" border="0" cellspacing="<%=innertablespacing%>" cellpadding="<%=innertablepadding%>" bgcolor="<%=innertablebg%>">
<tr>
<td width="100%" colspan="2" align="center"><br><b>Use this page to update payment provider details.</b><br> </td>
</tr>
<tr>
<td width="50%" align="right" valign="top"><b>Provider Name : </b></td>
<td width="50%" align="left" valign="top"><b><%=alldata(1,0)%></b></td>
</tr>
<tr>
<td width="50%" align="right" valign="top"><b>Show As : </b></td>
<td width="50%" align="left" valign="top"><input type="text" name="showas" value="<%=alldata(2,0)%>" size="25"></td>
</tr>
<% if alldata(0,0)=7 then ' VeriSign PayFlo Pro %>
<tr>
<td colspan="2" align="center" valign="top">Please note, enabling VeriSign Payflow Pro will force the second stage of checkout to be carried out on a secure (https) connection. Please see the online help for more details.</td>
</tr>
<% end if %>
<tr>
<td width="50%" align="right" valign="top"><b>Enabled : </b></td>
<td width="50%" align="left" valign="top"><input type="checkbox" name="isenabled" value="1" <%if alldata(4,0)=1 then response.write "checked"%>></td>
</tr>
<% if demomodeavailable then %>
<tr>
<td width="50%" align="right" valign="top"><b>Demo Mode : </b></td>
<td width="50%" align="left" valign="top"><input type="checkbox" name="demomode" value="1" <%if alldata(3,0)=1 then response.write "checked"%>></td>
</tr>
<% end if
if alldata(0,0)=7 then ' VeriSign PayFlo Pro
Dim vs1,vs2,vs3,vs4
if IsNull(alldata(5,0)) then alldata(5,0)=""
vsdetails = Split(alldata(5,0), "&")
if UBOUND(vsdetails) > 0 then
vs1=vsdetails(0)
vs2=vsdetails(1)
vs3=vsdetails(2)
vs4=vsdetails(3)
end if
%>
<tr>
<td width="50%" align="right" valign="top"><b>User ID : </b></td>
<td width="50%" align="left" valign="top"><input type="text" name="data1" value="<%=vs1%>" size="25"></td>
</tr>
<tr>
<td width="50%" align="right" valign="top"><b>Vendor : </b></td>
<td width="50%" align="left" valign="top"><input type="text" name="data2" value="<%=vs2%>" size="25"></td>
</tr>
<tr>
<td width="50%" align="right" valign="top"><b>Partner : </b></td>
<td width="50%" align="left" valign="top"><input type="text" name="data3" value="<%=vs3%>" size="25"></td>
</tr>
<tr>
<td width="50%" align="right" valign="top"><b>Password : </b></td>
<td width="50%" align="left" valign="top"><input type="text" name="data4" value="<%=vs4%>" size="25"></td>
</tr>
<% elseif alldata(0,0)=10 then ' Capture Card %>
<tr>
<td align="center" valign="top" colspan="2"><hr width="50%"><b>Accept Cards</b><br> </td>
</tr>
<tr>
<td align="right" valign="top"><b>Visa : </b></td>
<td align="left" valign="top"><input type="checkbox" name="cardtype1" value="X" <% if Mid(alldata(5,0),1,1)="X" then response.write "checked" %>></td>
</tr>
<tr>
<td align="right" valign="top"><b>Mastercard : </b></td>
<td align="left" valign="top"><input type="checkbox" name="cardtype2" value="X" <% if Mid(alldata(5,0),2,1)="X" then response.write "checked" %>></td>
</tr>
<tr>
<td align="right" valign="top"><b>American Express : </b></td>
<td align="left" valign="top"><input type="checkbox" name="cardtype3" value="X" <% if Mid(alldata(5,0),3,1)="X" then response.write "checked" %>></td>
</tr>
<tr>
<td align="right" valign="top"><b>Diners Club : </b></td>
<td align="left" valign="top"><input type="checkbox" name="cardtype4" value="X" <% if Mid(alldata(5,0),4,1)="X" then response.write "checked" %>></td>
</tr>
<tr>
<td align="right" valign="top"><b>Discover : </b></td>
<td align="left" valign="top"><input type="checkbox" name="cardtype5" value="X" <% if Mid(alldata(5,0),5,1)="X" then response.write "checked" %>></td>
</tr>
<tr>
<td align="right" valign="top"><b>En Route : </b></td>
<td align="left" valign="top"><input type="checkbox" name="cardtype6" value="X" <% if Mid(alldata(5,0),6,1)="X" then response.write "checked" %>></td>
</tr>
<tr>
<td align="right" valign="top"><b>JCB : </b></td>
<td align="left" valign="top"><input type="checkbox" name="cardtype7" value="X" <% if Mid(alldata(5,0),7,1)="X" then response.write "checked" %>></td>
</tr>
<tr>
<td align="center" valign="top" colspan="2"><hr width="50%"><b>Upload New Certificate</b><br> </td>
</tr>
<tr>
<td colspan="2" align="center" valign="top"><textarea name="data2" rows="10" cols="82"></textarea></td>
</tr>
<% else %>
<tr>
<td width="50%" align="right" valign="top"><b><%=data1name%> : </b></td>
<td width="50%" align="left" valign="top"><input type="text" name="data1" value="<%=alldata(5,0)%>" size="25"></td>
</tr>
<% end if %>
<% if data2name<>"" then %>
<tr>
<td width="50%" align="right" valign="top"><b><%=data2name%> : </b></td>
<td width="50%" align="left" valign="top"><input type="text" name="data2" value="<%=alldata(6,0)%>" size="25"></td>
</tr>
<% end if
if alldata(0,0)=11 OR alldata(0,0)=12 OR alldata(0,0)=3 OR alldata(0,0)=13 OR alldata(0,0)=14 then ' Pay Providers we can set authorization type %>
<tr>
<td width="50%" align="right" valign="top"><b>Transaction Type : </b></td>
<td width="50%" align="left" valign="top"><select name="transtype" size="1"><option value="0">Authorize Capture</option><option value="1" <% if alldata(7,0)="1" then response.write "selected" %>>Authorize Only</option></select></td>
</tr>
<% end if %>
<tr>
<td width="50%" align="right" valign="top"><input type="submit" value="Submit"></td>
<td width="50%" align="left" valign="top"><input type="reset" value="Reset"></td>
</tr>
</table>
</td>
</form>
</tr>
<% elseif request.form("act")="changepos" then %>
<tr>
<td width="100%" align="center">
<p> </p>
<p> </p>
<p> </p>
<p><b>Updating . . . . . . . </b></font></p>
<p> </p>
<p>If you are not automatically forwarded, please <a href="adminpayprov.asp">click here</a>.</p>
<p> </p>
<p> </p>
</td>
</tr>
<% else
function writeposition(currpos,maxpos)
Dim reqtext,i
reqtext="<select name='newpos" & currpos & "' size='1' onChange='javascript:validate_index("&currpos&");'>"
for i = 1 to maxpos
reqtext = reqtext & "<option value='"&i&"'"
if currpos=i then reqtext=reqtext&" selected"
reqtext = reqtext & ">"&i&"</option>"
next
writeposition = reqtext & "</select>"
end function
%>
<script language="JavaScript">
<!--
function validate_index(currindex)
{
var i = eval("mainform.newpos"+currindex+".selectedIndex")+1;
mainform.newval.value = i;
mainform.selectedq.value = currindex;
mainform.act.value = "changepos";
if(currindex < 1 || currindex > <%=ubound(alldata,2)+1 %>){
alert("Please enter a value between 1 and <%=ubound(alldata,2)+1%>");
return(false);
}
if(i==mainform.selectedq.value){
alert("No change in position");
return (false);
}
mainform.submit();
}
//-->
</script>
<tr>
<form name="mainform" method="POST" action="adminpayprov.asp">
<td width="100%">
<input type="hidden" name="posted" value="1">
<input type="hidden" name="act" value="modify">
<input type="hidden" name="id" value="1">
<input type="hidden" name="selectedq" value="1">
<input type="hidden" name="newval" value="1">
<table width="<%=innertablewidth%>" border="0" cellspacing="<%=innertablespacing%>" cellpadding="<%=innertablepadding%>" bgcolor="<%=innertablebg%>">
<tr>
<td width="100%" colspan="3" align="center"><br><b>Use this page to update payment providers.</b><br> </td>
</tr>
<tr>
<td width="10%" align="center" valign="top"><b>Order</b>
</td>
<td width="45%" align="center" valign="top"><b>Provider Name</b>
</td>
<td width="45%" align="center" valign="top"><b>Configure</b>
</td>
</tr>
<% enabledProv=0
for rowcounter=0 to UBOUND(alldata,2)
if alldata(4,rowcounter)=1 then enabledProv=enabledProv+1
next
for rowcounter=0 to UBOUND(alldata,2) %>
<tr>
<td align="center"><%if alldata(4,rowcounter)=1 then response.write writeposition(rowcounter+1,enabledProv) else response.write "-" %>
</td>
<td align="center"><%if alldata(3,rowcounter)=1 then response.write "<font color='#FF0000'>" %><%if alldata(4,rowcounter)=1 then response.write "<b>" %><%=alldata(1,rowcounter)%><%if alldata(4,rowcounter)=1 then response.write "</b>" %><%if alldata(3,rowcounter)=1 then response.write "</font>" %>
</td>
<td align="center"><input type=button name="modify" value="Modify" onClick="modrec('<%=alldata(0,rowcounter)%>')">
</td>
</tr>
<% next %>
<tr>
<td width="100%" colspan="3" align="center"><br>Please note, payment methods in demo mode are shown in <font color="#FF0000">red</font>.<br>
Payment methods that are enabled are shown in <b>bold</b>. </td>
</tr>
<tr>
<td width="100%" colspan="3" align="center"><br><a href="admin.asp"><b>Admin Home</b></a><br> </td>
</tr>
</table></td>
</form>
</tr>
<%
end if
cnn.Close
%>
</table>