Initial commit
98
production/modules/affiliate/JROX/admin/index.inc.php
Normal file
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| CubeCart 4
|
||||
| ========================================
|
||||
| CubeCart is a Trade Mark of Devellion Limited
|
||||
| Copyright Devellion Limited 2005 - 2006. All rights reserved.
|
||||
| Devellion Limited,
|
||||
| 5 Bridge Street,
|
||||
| Bishops Stortford,
|
||||
| HERTFORDSHIRE.
|
||||
| CM23 2JU
|
||||
| UNITED KINGDOM
|
||||
| http://www.devellion.com
|
||||
| UK Private Limited Company No. 5323904
|
||||
| ========================================
|
||||
| Web: http://www.cubecart.com
|
||||
| Email: info (at) cubecart (dot) com
|
||||
| License Type: CubeCart is NOT Open Source Software and Limitations Apply
|
||||
| Licence Info: http://www.cubecart.com/site/faq/license.php
|
||||
+--------------------------------------------------------------------------
|
||||
| index.inc.php
|
||||
| ========================================
|
||||
| Configure JROX.COM Affiliate Manager
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
if(!defined('CC_INI_SET')){ die("Access Denied"); }
|
||||
|
||||
permission("settings","read",$halt=TRUE);
|
||||
|
||||
require($glob['adminFolder'].CC_DS."includes".CC_DS."header.inc.php");
|
||||
|
||||
if(isset($_POST['module'])){
|
||||
require CC_ROOT_DIR.CC_DS.'modules'.CC_DS.'status.inc.php';
|
||||
$cache = new cache("config.".$moduleName);
|
||||
$cache->clearCache();
|
||||
//$module = fetchDbConfig($moduleName); // Uncomment this is you wish to merge old config with new
|
||||
$module = array(); // Comment this out if you don't want the old config to merge with new
|
||||
$msg = writeDbConf($_POST['module'], $moduleName, $module);
|
||||
|
||||
}
|
||||
$module = fetchDbConfig($moduleName);
|
||||
?>
|
||||
|
||||
<p><a href="http://jam.jrox.com" target="_blank"><img src="modules/<?php echo $moduleType; ?>/<?php echo $moduleName; ?>/admin/logo.gif" alt="JROX.COM Affiliate Manager" border="0" title="" /></a></p>
|
||||
<?php
|
||||
if(isset($msg)){
|
||||
echo stripslashes($msg);
|
||||
}
|
||||
?>
|
||||
<form action="<?php echo $module['URL']; ?>/admin/" id="fx_admin_login_form" name="fx_admin_login_form" method="post" target="_blank">
|
||||
<table border="0" cellspacing="0" cellpadding="3" class="mainTable">
|
||||
<tr>
|
||||
<td colspan="2" class="tdTitle">Login to JAM (Opens in new window) </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText">Admin Username:</td>
|
||||
<td class="tdText"><input name="jX_User_Name" type="text" id="jX_User_Name" value="" size="20" maxlength="20" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText">Admin Password:</td>
|
||||
<td class="tdText"><input name="jX_Pass_Word" type="password" id="jX_Pass_Word" value="" size="20" maxlength="20" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" class="tdText"> </td>
|
||||
<td class="tdText"><input type="submit" class="submit" value="Login As Admin" /><input name="fx_adm_login" type="hidden" id="fx_adm_login" value="fx_login" />
|
||||
<input name="adm_req" type="hidden" id="adm_req" value="fx_validate" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<br />
|
||||
<form action="<?php echo $glob['adminFile']; ?>?_g=<?php echo $_GET['_g']; ?>&module=<?php echo $_GET['module']; ?>" method="post" enctype="multipart/form-data">
|
||||
<table border="0" cellspacing="0" cellpadding="3" class="mainTable">
|
||||
<tr>
|
||||
<td colspan="2" class="tdTitle">Configuration Settings </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Status:</strong></td>
|
||||
<td class="tdText">
|
||||
<select name="module[status]">
|
||||
<option value="1" <?php if($module['status']==1) echo "selected='selected'"; ?>>Enabled</option>
|
||||
<option value="0" <?php if($module['status']==0) echo "selected='selected'"; ?>>Disabled</option>
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" valign="top" class="tdText"><strong>URL to JAM:</strong></td>
|
||||
<td class="tdText"><input type="text" name="module[URL]" value="<?php echo $module['URL']; ?>" class="textbox" size="40" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" class="tdText"> </td>
|
||||
<td class="tdText"><input type="submit" class="submit" value="Edit Config" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
|
||||
BIN
production/modules/affiliate/JROX/admin/logo.gif
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
3
production/modules/affiliate/JROX/index.php
Normal file
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
die("Access Denied");
|
||||
?>
|
||||
33
production/modules/affiliate/JROX/tracker.inc.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| CubeCart 4
|
||||
| ========================================
|
||||
| CubeCart is a Trade Mark of Devellion Limited
|
||||
| Copyright Devellion Limited 2005 - 2006. All rights reserved.
|
||||
| Devellion Limited,
|
||||
| 5 Bridge Street,
|
||||
| Bishops Stortford,
|
||||
| HERTFORDSHIRE.
|
||||
| CM23 2JU
|
||||
| UNITED KINGDOM
|
||||
| http://www.devellion.com
|
||||
| UK Private Limited Company No. 5323904
|
||||
| ========================================
|
||||
| Web: http://www.cubecart.com
|
||||
| Email: info (at) cubecart (dot) com
|
||||
| License Type: CubeCart is NOT Open Source Software and Limitations Apply
|
||||
| Licence Info: http://www.cubecart.com/site/faq/license.php
|
||||
+--------------------------------------------------------------------------
|
||||
| tracker.inc.php
|
||||
| ========================================
|
||||
| Tracking code for JROX.COM Affiliate Manager
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
$module = fetchDbConfig('JROX');
|
||||
|
||||
$affCode = "<!-- Begin JAM Affiliate Tracker -->
|
||||
<img border='0' src='".$module['URL']."/sale.php?amount=".sprintf("%.2f", $orderSum['prod_total'])."&trans_id=".$cart_order_id."' width='0' height='0' alt='' />
|
||||
<!-- End JAM Affiliate Tracker -->";
|
||||
?>
|
||||
87
production/modules/affiliate/clixGalore/admin/index.inc.php
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| CubeCart 4
|
||||
| ========================================
|
||||
| CubeCart is a Trade Mark of Devellion Limited
|
||||
| Copyright Devellion Limited 2006. All rights reserved.
|
||||
| Devellion Limited,
|
||||
| 5 Bridge Street,
|
||||
| Bishops Stortford,
|
||||
| HERTFORDSHIRE.
|
||||
| CM23 2JU
|
||||
| UNITED KINGDOM
|
||||
| http://www.devellion.com
|
||||
| UK Private Limited Company No. 5323904
|
||||
| ========================================
|
||||
| Web: http://www.cubecart.com
|
||||
| Email: info (at) cubecart (dot) com
|
||||
| License Type: CubeCart is NOT Open Source Software and Limitations Apply
|
||||
| Licence Info: http://www.cubecart.com/site/faq/license.php
|
||||
+--------------------------------------------------------------------------
|
||||
| index.inc.php
|
||||
| ========================================
|
||||
| Configure ClixGalore
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
if(!defined('CC_INI_SET')){ die("Access Denied"); }
|
||||
|
||||
permission("settings","read",$halt=TRUE);
|
||||
|
||||
require($glob['adminFolder'].CC_DS."includes".CC_DS."header.inc.php");
|
||||
|
||||
if(isset($_POST['module'])){
|
||||
require CC_ROOT_DIR.CC_DS.'modules'.CC_DS.'status.inc.php';
|
||||
|
||||
$cache = new cache("config.".$moduleName);
|
||||
$cache->clearCache();
|
||||
//$module = fetchDbConfig($moduleName); // Uncomment this is you wish to merge old config with new
|
||||
$module = array(); // Comment this out if you don't want the old config to merge with new
|
||||
$msg = writeDbConf($_POST['module'], $moduleName, $module);
|
||||
|
||||
}
|
||||
$module = fetchDbConfig($moduleName);
|
||||
?>
|
||||
<p><a href="http://www.clixgalore.com/"><img src="modules/<?php echo $moduleType; ?>/<?php echo $moduleName; ?>/admin/logo.gif" alt="clixGalore" border="0" title="" /></a></p>
|
||||
<?php
|
||||
if(isset($msg))
|
||||
{
|
||||
echo msg($msg);
|
||||
}
|
||||
?>
|
||||
<p class="copyText">"Solutions that boost revenue, sales, leads and hits to your website."<br />
|
||||
<a href="http://www.clixgalore.com/" target="_blank" class="txtLink">http://www.clixgalore.com/</a></p>
|
||||
<form action="https://www.clixgalore.com/memberlogin.aspx" method="post" enctype="multipart/form-data" name="frm_Login" target="_blank" id="frm_Login">
|
||||
<table border="0" cellspacing="1" cellpadding="3" class="mainTable">
|
||||
<tr>
|
||||
<td class="tdTitle">Login to clixGalore (Opens in new window) </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center" class="tdText"><a href="https://www.clixgalore.com/memberlogin.aspx" class="txtLink" target="_blank">Login to Admin</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<br />
|
||||
<form action="<?php echo $glob['adminFile']; ?>?_g=<?php echo $_GET['_g']; ?>&module=<?php echo $_GET['module']; ?>" method="post" enctype="multipart/form-data">
|
||||
<table border="0" cellspacing="1" cellpadding="3" class="mainTable">
|
||||
<tr>
|
||||
<td colspan="2" class="tdTitle">Configuration Settings </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Status:</strong></td>
|
||||
<td class="tdText">
|
||||
<select name="module[status]">
|
||||
<option value="1" <?php if($module['status']==1) echo "selected='selected'"; ?>>Enabled</option>
|
||||
<option value="0" <?php if($module['status']==0) echo "selected='selected'"; ?>>Disabled</option>
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" valign="top" class="tdText"><strong>clixGalore A/C No: </strong></td>
|
||||
<td class="tdText"><input type="text" name="module[acNo]" value="<?php echo $module['acNo']; ?>" class="textbox" size="40" /> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" class="tdText"> </td>
|
||||
<td class="tdText"><input type="submit" class="submit" value="Edit Config" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
BIN
production/modules/affiliate/clixGalore/admin/logo.gif
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
3
production/modules/affiliate/clixGalore/index.php
Normal file
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
die("Access Denied");
|
||||
?>
|
||||
33
production/modules/affiliate/clixGalore/tracker.inc.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| CubeCart 4
|
||||
| ========================================
|
||||
| CubeCart is a registered trade mark of Devellion Limited
|
||||
| Copyright Devellion Limited 2006. All rights reserved.
|
||||
| Devellion Limited,
|
||||
| 5 Bridge Street,
|
||||
| Bishops Stortford,
|
||||
| HERTFORDSHIRE.
|
||||
| CM23 2JU
|
||||
| UNITED KINGDOM
|
||||
| http://www.devellion.com
|
||||
| UK Private Limited Company No. 5323904
|
||||
| ========================================
|
||||
| Web: http://www.cubecart.com
|
||||
| Email: info (at) cubecart (dot) com
|
||||
| License Type: CubeCart is NOT Open Source Software and Limitations Apply
|
||||
| Licence Info: http://www.cubecart.com/site/faq/license.php
|
||||
+--------------------------------------------------------------------------
|
||||
| tracker.inc.php
|
||||
| ========================================
|
||||
| Tracking code for clixGalore
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
$module = fetchDbConfig('clixGalore');
|
||||
|
||||
$affCode = "<!-- Begin ClixGalore Affliate Tracking -->
|
||||
<img src='https://www.clixGalore.com/AdvTransaction.aspx?AdID=".$module['acNo']."&SV=".sprintf("%.2f", $orderSum['prod_total'])."&OID=".$cart_order_id."' height='0' width='0' border='0' />
|
||||
<!-- End ClixGalore Affliate Tracking -->";
|
||||
?>
|
||||
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| CubeCart 4
|
||||
| ========================================
|
||||
| CubeCart is a Trade Mark of Devellion Limited
|
||||
| Copyright Devellion Limited 2006. All rights reserved.
|
||||
| Devellion Limited,
|
||||
| 5 Bridge Street,
|
||||
| Bishops Stortford,
|
||||
| HERTFORDSHIRE.
|
||||
| CM23 2JU
|
||||
| UNITED KINGDOM
|
||||
| http://www.devellion.com
|
||||
| UK Private Limited Company No. 5323904
|
||||
| ========================================
|
||||
| Web: http://www.cubecart.com
|
||||
| Email: info (at) cubecart (dot) com
|
||||
| License Type: CubeCart is NOT Open Source Software and Limitations Apply
|
||||
| Licence Info: http://www.cubecart.com/site/faq/license.php
|
||||
+--------------------------------------------------------------------------
|
||||
| index.inc.php
|
||||
| ========================================
|
||||
| Configure iDevAffiliate
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
if(!defined('CC_INI_SET')){ die("Access Denied"); }
|
||||
|
||||
permission("settings","read",$halt=TRUE);
|
||||
|
||||
require($glob['adminFolder'].CC_DS."includes".CC_DS."header.inc.php");
|
||||
|
||||
if(isset($_POST['module'])){
|
||||
require CC_ROOT_DIR.CC_DS.'modules'.CC_DS.'status.inc.php';
|
||||
$cache = new cache("config.".$moduleName);
|
||||
$cache->clearCache();
|
||||
//$module = fetchDbConfig($moduleName); // Uncomment this is you wish to merge old config with new
|
||||
$module = array(); // Comment this out if you don't want the old config to merge with new
|
||||
$msg = writeDbConf($_POST['module'], $moduleName, $module);
|
||||
|
||||
}
|
||||
$module = fetchDbConfig($moduleName);
|
||||
?>
|
||||
|
||||
<p><a href="http://www.idevdirect.com/affiliates/idevaffiliate.php?id=370"><img src="modules/<?php echo $moduleType; ?>/<?php echo $moduleName; ?>/admin/logo.gif" alt="iDevAffilliate" border="0" title="" /></a></p>
|
||||
<?php
|
||||
if(isset($msg))
|
||||
{
|
||||
echo msg($msg);
|
||||
}
|
||||
?>
|
||||
<p class="copyText">"Adding affiliate tracking software to your site is one of the most effective ways to achieve more sales and more traffic!"<br />
|
||||
<a href="http://www.idevdirect.com/affiliates/idevaffiliate.php?id=370" target="_blank" class="txtLink">http://www.idevdirect.com</a></p>
|
||||
<form action="<?php echo $module['URL']; ?>/admin/setup.php" method="post" enctype="multipart/form-data" name="login" target="_blank" id="login">
|
||||
<table border="0" cellspacing="1" cellpadding="3" class="mainTable">
|
||||
<tr>
|
||||
<td colspan="2" class="tdTitle">Login to iDevAffiliate (Opens in new window) </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText">Admin Username:</td>
|
||||
<td class="tdText"><input type="text" name="aduser" class="textbox" size="20" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText">Admin Password:</td>
|
||||
<td class="tdText"><input type="password" name="adpass" class="textbox" size="20" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" class="tdText"> </td>
|
||||
<td class="tdText"><input type="submit" class="submit" value="Login As Admin" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<br />
|
||||
<form action="<?php echo $glob['adminFile']; ?>?_g=<?php echo $_GET['_g']; ?>&module=<?php echo $_GET['module']; ?>" method="post" enctype="multipart/form-data">
|
||||
<table border="0" cellspacing="1" cellpadding="3" class="mainTable">
|
||||
<tr>
|
||||
<td colspan="2" class="tdTitle">Configuration Settings </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Status:</strong></td>
|
||||
<td class="tdText">
|
||||
<select name="module[status]">
|
||||
<option value="1" <?php if($module['status']==1) echo "selected='selected'"; ?>>Enabled</option>
|
||||
<option value="0" <?php if($module['status']==0) echo "selected='selected'"; ?>>Disabled</option>
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" valign="top" class="tdText"><strong>URL to iDevAffiliate: </strong></td>
|
||||
<td class="tdText"><input type="text" name="module[URL]" value="<?php echo $module['URL']; ?>" class="textbox" size="40" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" class="tdText"> </td>
|
||||
<td class="tdText"><input type="submit" class="submit" value="Edit Config" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
BIN
production/modules/affiliate/iDevAffiliate/admin/logo.gif
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
3
production/modules/affiliate/iDevAffiliate/index.php
Normal file
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
die("Access Denied");
|
||||
?>
|
||||
33
production/modules/affiliate/iDevAffiliate/tracker.inc.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| CubeCart 4
|
||||
| ========================================
|
||||
| CubeCart is a registered trade mark of Devellion Limited
|
||||
| Copyright Devellion Limited 2006. All rights reserved.
|
||||
| Devellion Limited,
|
||||
| 5 Bridge Street,
|
||||
| Bishops Stortford,
|
||||
| HERTFORDSHIRE.
|
||||
| CM23 2JU
|
||||
| UNITED KINGDOM
|
||||
| http://www.devellion.com
|
||||
| UK Private Limited Company No. 5323904
|
||||
| ========================================
|
||||
| Web: http://www.cubecart.com
|
||||
| Email: info (at) cubecart (dot) com
|
||||
| License Type: CubeCart is NOT Open Source Software and Limitations Apply
|
||||
| Licence Info: http://www.cubecart.com/site/faq/license.php
|
||||
+--------------------------------------------------------------------------
|
||||
| tracker.inc.php
|
||||
| ========================================
|
||||
| Tracking code for iDevAffiliate
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
$module = fetchDbConfig('iDevAffiliate');
|
||||
|
||||
$affCode = "<!-- Begin iDevAffiliate Affiliate Tracker -->
|
||||
<img border='0' src='".$module['URL']."sale.php?idev_cube_1=".sprintf("%.2f", $orderSum['prod_total'])."&idev_cube_2=".$cart_order_id."' width='0' height='0' alt='' />
|
||||
<!-- End iDevAffiliate Affiliate Tracker -->";
|
||||
?>
|
||||
3
production/modules/affiliate/index.php
Normal file
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
die("Access Denied");
|
||||
?>
|
||||
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| CubeCart 4
|
||||
| ========================================
|
||||
| CubeCart is a Trade Mark of Devellion Limited
|
||||
| Copyright Devellion Limited 2006. All rights reserved.
|
||||
| Devellion Limited,
|
||||
| 5 Bridge Street,
|
||||
| Bishops Stortford,
|
||||
| HERTFORDSHIRE.
|
||||
| CM23 2JU
|
||||
| UNITED KINGDOM
|
||||
| http://www.devellion.com
|
||||
| UK Private Limited Company No. 5323904
|
||||
| ========================================
|
||||
| Web: http://www.cubecart.com
|
||||
| Email: info (at) cubecart (dot) com
|
||||
| License Type: CubeCart is NOT Open Source Software and Limitations Apply
|
||||
| Licence Info: http://www.cubecart.com/site/faq/license.php
|
||||
+--------------------------------------------------------------------------
|
||||
| index.inc.php
|
||||
| ========================================
|
||||
| Configure tradeDoubler
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
if(!defined('CC_INI_SET')){ die("Access Denied"); }
|
||||
|
||||
permission("settings","read",$halt=TRUE);
|
||||
|
||||
require($glob['adminFolder'].CC_DS."includes".CC_DS."header.inc.php");
|
||||
|
||||
if(isset($_POST['module'])){
|
||||
require CC_ROOT_DIR.CC_DS.'modules'.CC_DS.'status.inc.php';
|
||||
$cache = new cache("config.".$moduleName);
|
||||
$cache->clearCache();
|
||||
//$module = fetchDbConfig($moduleName); // Uncomment this is you wish to merge old config with new
|
||||
$module = array(); // Comment this out if you don't want the old config to merge with new
|
||||
$msg = writeDbConf($_POST['module'], $moduleName, $module);
|
||||
|
||||
}
|
||||
$module = fetchDbConfig($moduleName);
|
||||
?>
|
||||
|
||||
<p><a href="http://www.tradedoubler.com/"><img src="modules/<?php echo $moduleType; ?>/<?php echo $moduleName; ?>/admin/logo.gif" alt="TradeDoubler" border="0" title="" /></a></p>
|
||||
<?php
|
||||
if(isset($msg))
|
||||
{
|
||||
echo msg($msg);
|
||||
}
|
||||
?>
|
||||
<p class="copyText">"TradeDoubler - Improving Online Business."<br />
|
||||
<a href="http://www.tradedoubler.com/" target="_blank" class="txtLink">http://www.tradedoubler.com/</a></p>
|
||||
<form action="http://www.tradedoubler.com" method="post" enctype="multipart/form-data" name="frm_Login" target="_blank" id="frm_Login">
|
||||
<table border="0" cellspacing="1" cellpadding="3" class="mainTable">
|
||||
<tr>
|
||||
<td class="tdTitle">Login to TradeDoubler (Opens in new window) </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center" class="tdText"><a href="http://www.tradedoubler.com" class="txtLink" target="_blank">Login to Admin</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<br />
|
||||
<form action="<?php echo $glob['adminFile']; ?>?_g=<?php echo $_GET['_g']; ?>&module=<?php echo $_GET['module']; ?>" method="post" enctype="multipart/form-data">
|
||||
<table border="0" cellspacing="1" cellpadding="3" class="mainTable">
|
||||
<tr>
|
||||
<td colspan="2" class="tdTitle">Configuration Settings </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Status:</strong></td>
|
||||
<td class="tdText">
|
||||
<select name="module[status]">
|
||||
<option value="1" <?php if($module['status']==1) echo "selected='selected'"; ?>>Enabled</option>
|
||||
<option value="0" <?php if($module['status']==0) echo "selected='selected'"; ?>>Disabled</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" valign="top" class="tdText"><strong>TradeDoubler A/C No: </strong></td>
|
||||
<td class="tdText"><input type="text" name="module[acNo]" value="<?php echo $module['acNo']; ?>" class="textbox" size="40" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" valign="top" class="tdText"><strong>Test Mode: </strong></td>
|
||||
<td class="tdText">
|
||||
<select name="module[testMode]">
|
||||
<option value="1" <?php if($module['testMode']==1) echo "selected='selected'"; ?>>On</option>
|
||||
<option value="0" <?php if($module['testMode']==0) echo "selected='selected'"; ?>>Off</option>
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" class="tdText"> </td>
|
||||
<td class="tdText"><input type="submit" class="submit" value="Edit Config" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
BIN
production/modules/affiliate/tradeDoubler/admin/logo.gif
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
3
production/modules/affiliate/tradeDoubler/index.php
Normal file
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
die("Access Denied");
|
||||
?>
|
||||
42
production/modules/affiliate/tradeDoubler/tracker.inc.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| CubeCart 4
|
||||
| ========================================
|
||||
| CubeCart is a registered trade mark of Devellion Limited
|
||||
| Copyright Devellion Limited 2006. All rights reserved.
|
||||
| Devellion Limited,
|
||||
| 5 Bridge Street,
|
||||
| Bishops Stortford,
|
||||
| HERTFORDSHIRE.
|
||||
| CM23 2JU
|
||||
| UNITED KINGDOM
|
||||
| http://www.devellion.com
|
||||
| UK Private Limited Company No. 5323904
|
||||
| ========================================
|
||||
| Web: http://www.cubecart.com
|
||||
| Email: info (at) cubecart (dot) com
|
||||
| License Type: CubeCart is NOT Open Source Software and Limitations Apply
|
||||
| Licence Info: http://www.cubecart.com/site/faq/license.php
|
||||
+--------------------------------------------------------------------------
|
||||
| tracker.inc.php
|
||||
| ========================================
|
||||
| Tracking code for tradeDoubler
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
$module = fetchDbConfig('tradeDoubler');
|
||||
|
||||
if($module['testMode'] == 1)
|
||||
{
|
||||
$testVar = "&testonly=1";
|
||||
}
|
||||
else
|
||||
{
|
||||
$testVar = "";
|
||||
}
|
||||
|
||||
$affCode = "<!-- Begin tradeDoubler Affiliate Tracker -->
|
||||
<img src='http://www.awin1.com/sale.php?sale=".sprintf("%.2f",$orderSum['prod_total'])."&extra=".$cart_order_id."&type=s&mid=".$module['acNo'].$testVar."' width='0' height='0' alt='' />
|
||||
<!-- End tradeDoubler Affiliate Tracker -->";
|
||||
?>
|
||||
@@ -0,0 +1,133 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| CubeCart 4
|
||||
| ========================================
|
||||
| CubeCart is a registered trade mark of Devellion Limited
|
||||
| Copyright Devellion Limited 2006. All rights reserved.
|
||||
| Devellion Limited,
|
||||
| 5 Bridge Street,
|
||||
| Bishops Stortford,
|
||||
| HERTFORDSHIRE.
|
||||
| CM23 2JU
|
||||
| UNITED KINGDOM
|
||||
| http://www.devellion.com
|
||||
| UK Private Limited Company No. 5323904
|
||||
| ========================================
|
||||
| Web: http://www.cubecart.com
|
||||
| Email: info (at) cubecart (dot) com
|
||||
| License Type: CubeCart is NOT Open Source Software and Limitations Apply
|
||||
| Licence Info: http://www.cubecart.com/site/faq/license.php
|
||||
+--------------------------------------------------------------------------
|
||||
| index.inc.php
|
||||
| ========================================
|
||||
| Configure Google Checkout
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
if(!defined('CC_INI_SET')){ die("Access Denied"); }
|
||||
|
||||
permission("settings","read",$halt=TRUE);
|
||||
|
||||
require($glob['adminFolder'].CC_DS."includes".CC_DS."header.inc.php");
|
||||
|
||||
if(isset($_POST['module'])){
|
||||
require CC_ROOT_DIR.CC_DS.'modules'.CC_DS.'status.inc.php';
|
||||
$cache = new cache("config.".$moduleName);
|
||||
$cache->clearCache();
|
||||
//$module = fetchDbConfig($moduleName); // Uncomment this is you wish to merge old config with new
|
||||
$module = array(); // Comment this out if you don't want the old config to merge with new
|
||||
$msg = writeDbConf($_POST['module'], $moduleName, $module);
|
||||
|
||||
}
|
||||
$module = fetchDbConfig($moduleName);
|
||||
?>
|
||||
<p><a href="http://checkout.google.com/"><img src="modules/<?php echo $moduleType; ?>/<?php echo $moduleName; ?>/admin/logo.gif" alt="" border="0" title="" /></a></p>
|
||||
<?php
|
||||
if(isset($msg))
|
||||
{
|
||||
echo msg($msg);
|
||||
}
|
||||
|
||||
?>
|
||||
<p class="tdText"><strong>IMPORTANT:</strong> Google Checkouts is not compatible with real time shipping quotes or the shipping methods built into the CubeCart. This because no customer information is captured prior to transferring them to Google. For this reason you must configure custom shipping methods for them and a table of this data is sent to Google. Tax settings will be inherited from your CubeCart stores tax settings.</p>
|
||||
<p class="tdText"><a href='<?php echo $glob['adminFile']."?_g=settings/altShipping";?>' class="txtLink">Configure Google Shipping Methods</a></p>
|
||||
<p>Google Checkout will ONLY function with a valid SSL certificate in operation. The URLS will show below once this has been enabled.</p>
|
||||
<form action="<?php echo $glob['adminFile']; ?>?_g=<?php echo $_GET['_g']; ?>&module=<?php echo $_GET['module']; ?>" method="post" enctype="multipart/form-data">
|
||||
<table border="0" cellspacing="1" cellpadding="3" class="mainTable">
|
||||
<tr>
|
||||
<td colspan="2" class="tdTitle">Configuration Settings </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Status:</strong></td>
|
||||
<td class="tdText">
|
||||
<select name="module[status]">
|
||||
<option value="1" <?php if($module['status']==1) echo "selected='selected'"; ?>>Enabled</option>
|
||||
<option value="0" <?php if($module['status']==0) echo "selected='selected'"; ?>>Disabled</option>
|
||||
</select> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Google merchant ID:</strong></td>
|
||||
<td class="tdText"><input type="text" name="module[merchId]" value="<?php echo $module['merchId']; ?>" class="textbox" size="30" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Google merchant key:</strong></td>
|
||||
<td class="tdText"><input type="text" name="module[merchKey]" value="<?php echo $module['merchKey']; ?>" class="textbox" size="30" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Mode:</strong></td>
|
||||
<td class="tdText"><select name="module[mode]">
|
||||
<option value="sandbox" <?php if($module['mode'] == "sandbox") echo "selected='selected'"; ?>>SandBox (Testing Environment)</option>
|
||||
<option value="live" <?php if($module['mode'] == "live") echo "selected='selected'"; ?>>Live</option>
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="33%" align="left" valign="top" class="tdText"><strong>Send Welcome Email:</strong><br />
|
||||
(Contains user/password for future access)</td>
|
||||
<td class="tdText"><select name="module[welcomeEmail]">
|
||||
<option value="0" <?php if($module['welcomeEmail'] == 0) echo "selected='selected'"; ?>>No</option>
|
||||
<option value="1" <?php if($module['welcomeEmail'] == 1) echo "selected='selected'"; ?>>Yes</option>
|
||||
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Button size:</strong></td>
|
||||
<td class="tdText">
|
||||
<select name="module[size]">
|
||||
<option value="large" <?php if($module['size'] == "large") echo "selected='selected'"; ?>>Large</option>
|
||||
<option value="medium" <?php if($module['size'] == "medium") echo "selected='selected'"; ?>>Medium</option>
|
||||
<option value="small" <?php if($module['size'] == "small") echo "selected='selected'"; ?>>Small</option>
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Debug:</strong></td>
|
||||
<td class="tdText">
|
||||
<select name="module[debug]">
|
||||
<option value="1" <?php if($module['debug'] == 1) echo "selected='selected'"; ?>>Yes</option>
|
||||
<option value="0" <?php if($module['debug'] == 0) echo "selected='selected'"; ?>>No</option>
|
||||
</select> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>API Callback URL: </strong></td>
|
||||
<td class="tdText"><input type="text" value="<?php if($config['ssl']==true) { echo $config['storeURL_SSL']."/index.php?_g=rm&type=altCheckout&cmd=call&module=Google_Checkout"; } else { echo "VALID SSL CONFIGURATION REQUIRED"; } ?>" style="width: 95%;" /><br />
|
||||
Please set callback method to XML. <br />
|
||||
<strong>IMPORTANT:</strong> Google Checkout will ONLY work in Live mode if the API Callback URL is under the HTTPS protocol. You may need to purchase an SSL certificate if your hosting doesn't have this functionality allready.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Public business website:</strong></td>
|
||||
<td class="tdText"><input type="text" value="<?php if($config['ssl']==true) { echo $config['storeURL_SSL']."/index.php?_g=co&_a=confirmed&s=3"; } else { echo "VALID SSL CONFIGURATION REQUIRED"; } ?>" style="width: 95%;" /><br />
|
||||
Customers will be returned here after payment. (Set under the "Settings" tab in the Google Checkout control panel)
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right" class="tdText"> </td>
|
||||
<td class="tdText"><input type="submit" class="submit" value="Edit Config" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
BIN
production/modules/altCheckout/Google_Checkout/admin/logo.gif
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
183
production/modules/altCheckout/Google_Checkout/button.php
Normal file
@@ -0,0 +1,183 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2006 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//Point to the correct directory
|
||||
//chdir("..");
|
||||
//Include all the required files
|
||||
require_once('library/googlecart.php');
|
||||
require_once('library/googleitem.php');
|
||||
require_once('library/googleshipping.php');
|
||||
require_once('library/googletaxrule.php');
|
||||
require_once('library/googletaxtable.php');
|
||||
|
||||
// Invoke any of the provided use cases
|
||||
class Google_Checkout {
|
||||
|
||||
function buildIt($moduleName="") {
|
||||
|
||||
global $altCheckoutInv, $altShippingPrices, $config, $config_tax_mod, $db, $glob;
|
||||
|
||||
$module = fetchDbConfig($moduleName);
|
||||
|
||||
// Create a new shopping cart object
|
||||
$merchant_id = $module['merchId']; //Your Merchant ID
|
||||
$merchant_key = $module['merchKey']; //Your Merchant Key
|
||||
$server_type = $module['mode'];
|
||||
|
||||
require("classes".CC_DS."cart".CC_DS."order.php");
|
||||
$order = new order();
|
||||
|
||||
$merchant_private_data = array("sessionid" => $GLOBALS[CC_SESSION_NAME],"cart_order_id" => $order->mkOrderNo());
|
||||
$cart = new GoogleCart($merchant_id, $merchant_key, $server_type, $merchant_private_data);
|
||||
|
||||
// Add items to the cart
|
||||
if(is_array($altCheckoutInv)){
|
||||
|
||||
/*
|
||||
$altCheckoutInv[$i]['taxType']; // to work out tax tables
|
||||
$altCheckoutInv[$i]['name'];
|
||||
$altCheckoutInv[$i]['options'];
|
||||
$altCheckoutInv[$i]['quantity'];
|
||||
$altCheckoutInv[$i]['price'];
|
||||
$altCheckoutInv[$i]['private_data']
|
||||
*/
|
||||
|
||||
$taxTypes = array();
|
||||
|
||||
for($i=1;$i<=count($altCheckoutInv);$i++)
|
||||
{
|
||||
|
||||
$item = new GoogleItem($altCheckoutInv[$i]['name'],
|
||||
$altCheckoutInv[$i]['options'],
|
||||
$altCheckoutInv[$i]['quantity'],
|
||||
$altCheckoutInv[$i]['price'],
|
||||
$money = $config['defaultCurrency'],
|
||||
$private_data = $altCheckoutInv[$i]['private_data'],
|
||||
$tax_selector = "rule_".$altCheckoutInv[$i]['taxType']
|
||||
);
|
||||
|
||||
$cart->AddItem($item);
|
||||
|
||||
$taxTypes[$altCheckoutInv[$i]['taxType']] = TRUE;
|
||||
|
||||
}
|
||||
|
||||
// build tax rules and let fun fun commence
|
||||
if(is_array($taxTypes))
|
||||
{
|
||||
|
||||
foreach($taxTypes as $key => $value) {
|
||||
|
||||
if($config_tax_mod['status']==1) {
|
||||
// Google checkout only supports US sellers right now
|
||||
$query = "SELECT t.tax_percent, c.iso, county_id, shipping FROM ".$glob['dbprefix']."CubeCart_tax_rates t LEFT JOIN ".$glob['dbprefix']."CubeCart_iso_countries c ON t.country_id = c.id WHERE `type_id` = 1 AND `active` = 1 AND c.iso = 'US' ORDER BY tax_percent DESC";
|
||||
|
||||
$taxRates = $db->select($query);
|
||||
|
||||
if($taxRates==TRUE) {
|
||||
|
||||
|
||||
for($i=0;$i<count($taxRates);$i++) {
|
||||
|
||||
if($taxRates[$i-1]['tax_percent']!==$taxRates[$i]['tax_percent'] || $i==0) {
|
||||
|
||||
$n=0;
|
||||
|
||||
if($taxRates[$i]['shippping']==1) { $shipping_taxed = "true"; } else { $shipping_taxed = "false"; }
|
||||
|
||||
$tax_rule = new GoogleTaxRule("alternate", ($taxRates[$i]['tax_percent']*0.01), $country_area="", $shipping_taxed);
|
||||
|
||||
}
|
||||
|
||||
|
||||
$states[$n] = countyAbbrev($taxRates[$i]['county_id']);
|
||||
$n++;
|
||||
|
||||
if($taxRates[$i]['tax_percent']!==$taxRates[$i+1]['tax_percent']){
|
||||
$tax_rule->SetStateAreas($states);
|
||||
unset($states);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
$tax_table = new GoogleTaxTable("alternate","rule_".$key, $standalone = "true");
|
||||
$tax_table->AddTaxRules($tax_rule);
|
||||
$cart->AddTaxTables($tax_table);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
$taxRate = $db->select("SELECT percent FROM ".$glob['dbprefix']."CubeCart_taxes WHERE `id` = ".$db->mySQLsafe($key));
|
||||
|
||||
$countryIso = getCountryFormat($config['taxCountry'],"id","iso");
|
||||
|
||||
if($config['taxCounty']==0 && $countryIso == "US"){
|
||||
$country_area = "ALL";
|
||||
} else {
|
||||
$country_area = "";
|
||||
}
|
||||
|
||||
$tax_rule = new GoogleTaxRule("alternate", ($taxRate[0]['percent']*0.01), $country_area, $shipping_taxed="false");
|
||||
|
||||
if($config['taxCounty']>0){
|
||||
$stateCode = countyAbbrev($config['taxCounty']);
|
||||
$tax_rule->SetStateAreas($stateCode);
|
||||
} else {
|
||||
// state required to set country?!!? No sense AT all.
|
||||
$tax_rule->SetStateAreas("FALSE");
|
||||
}
|
||||
|
||||
$tax_table = new GoogleTaxTable("alternate","rule_".$key, $standalone = "true");
|
||||
$tax_table->AddTaxRules($tax_rule);
|
||||
$cart->AddTaxTables($tax_table);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(is_array($altShippingPrices)) {
|
||||
|
||||
for($i=0;$i<count($altShippingPrices);$i++) {
|
||||
$ship = new GoogleShipping($altShippingPrices[$i]['name'], "flat-rate", $altShippingPrices[$i]['price']);
|
||||
$ship->SetAllowedCountryArea("ALL");
|
||||
$cart->AddShipping($ship);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if($module['debug']==1) {
|
||||
// echo XML out
|
||||
echo "<pre style='background-color: white; font-family: Courier New, Courier, mono;'><h3>XML -> Google Checkout</h3>".htmlspecialchars($cart->GetXML())."</pre>";
|
||||
}
|
||||
|
||||
// Display Google Checkout button
|
||||
return $cart->CheckoutButtonCode($module['size']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
626
production/modules/altCheckout/Google_Checkout/call.inc.php
Normal file
@@ -0,0 +1,626 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2006 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* This is the response handler code that will be invoked every time
|
||||
* a notification or request is sent by the Google Server
|
||||
*
|
||||
* To allow this code to receive responses, the url for this file
|
||||
* must be set on the seller page under Settings->Integration as the
|
||||
* "API Callback URL'
|
||||
* Order processing commands can be sent automatically by placing these
|
||||
* commands appropriately
|
||||
*
|
||||
* To use this code for merchant-calculated feedback, this url must be
|
||||
* set also as the merchant-calculations-url when the cart is posted
|
||||
* Depending on your calculations for shipping, taxes, coupons and gift
|
||||
* certificates update parts of the code as required
|
||||
*
|
||||
*/
|
||||
|
||||
if(!defined('CC_INI_SET')){ die("Access Denied"); }
|
||||
|
||||
require_once('library/googleresponse.php');
|
||||
require_once('library/googlemerchantcalculations.php');
|
||||
require_once('library/googleresult.php');
|
||||
|
||||
// Retrieve the XML sent in the HTTP POST request to the ResponseHandler
|
||||
$xml_response = $HTTP_RAW_POST_DATA;
|
||||
if (get_magic_quotes_gpc()){
|
||||
$xml_response = stripslashes($xml_response);
|
||||
}
|
||||
$headers = getallheaders();
|
||||
|
||||
require_once(CC_ROOT_DIR.CC_DS."classes".CC_DS."htmlMimeMail".CC_DS."htmlMimeMail.php");
|
||||
|
||||
// Create new response object
|
||||
$merchant_id = $module['merchId'];
|
||||
$merchant_key = $module['merchKey'];
|
||||
$server_type = $module['mode'];
|
||||
|
||||
$response = new GoogleResponse($merchant_id, $merchant_key, $xml_response, $server_type);
|
||||
$root = $response->root;
|
||||
$data = $response->data;
|
||||
|
||||
function doDebug($extra = ""){
|
||||
|
||||
global $config,$module,$xml_response,$response;
|
||||
|
||||
if($module['debug']==1){
|
||||
// email to storekeeper
|
||||
$mail = new htmlMimeMail();
|
||||
|
||||
$text = print_r($response,true)."\n\n\n".$extra;
|
||||
|
||||
$mail->setText($text);
|
||||
$mail->setReturnPath($config['masterEmail']);
|
||||
$mail->setFrom($config['masterEmail']);
|
||||
$mail->setSubject("Google Checkout Debug XML");
|
||||
$mail->setHeader('X-Mailer', 'CubeCart Mailer');
|
||||
$mail->send(array($config['masterEmail']), $config['mailMethod']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Check status and take appropriate action
|
||||
$status = $response->HttpAuthentication($headers);
|
||||
|
||||
switch ($root){
|
||||
|
||||
case "request-received":
|
||||
{
|
||||
break;
|
||||
}
|
||||
case "error":
|
||||
{
|
||||
break;
|
||||
}
|
||||
case "diagnosis":
|
||||
{
|
||||
break;
|
||||
}
|
||||
case "checkout-redirect":
|
||||
{
|
||||
break;
|
||||
}
|
||||
case "merchant-calculation-callback":
|
||||
{
|
||||
// Create the results and send it
|
||||
$merchant_calc = new GoogleMerchantCalculations();
|
||||
|
||||
// Loop through the list of address ids from the callback
|
||||
$addresses = get_arr_result($data[$root]['calculate']['addresses']['anonymous-address']);
|
||||
|
||||
foreach($addresses as $curr_address)
|
||||
{
|
||||
$curr_id = $curr_address['id'];
|
||||
$country = $curr_address['country-code']['VALUE'];
|
||||
$city = $curr_address['city']['VALUE'];
|
||||
$region = $curr_address['region']['VALUE'];
|
||||
$postal_code = $curr_address['region']['VALUE'];
|
||||
|
||||
// Loop through each shipping method if merchant-calculated shipping
|
||||
// support is to be provided
|
||||
if(isset($data[$root]['calculate']['shipping']))
|
||||
{
|
||||
$shipping = get_arr_result($data[$root]['calculate']['shipping']['method']);
|
||||
|
||||
foreach($shipping as $curr_ship)
|
||||
{
|
||||
$name = $curr_ship['name'];
|
||||
//Compute the price for this shipping method and address id
|
||||
$price = 10; // Modify this to get the actual price
|
||||
$shippable = "true"; // Modify this as required
|
||||
$merchant_result = new GoogleResult($curr_id);
|
||||
$merchant_result->SetShippingDetails($name, $price, $config['defaultCurrency'],
|
||||
$shippable);
|
||||
|
||||
if($data[$root]['calculate']['tax']['VALUE'] == "true")
|
||||
{
|
||||
//Compute tax for this address id and shipping type
|
||||
$amount = 15; // Modify this to the actual tax value
|
||||
$merchant_result->SetTaxDetails($amount, $config['defaultCurrency']);
|
||||
}
|
||||
|
||||
$codes = get_arr_result($data[$root]['calculate']['merchant-code-strings']
|
||||
['merchant-code-string']);
|
||||
foreach($codes as $curr_code)
|
||||
{
|
||||
//Update this data as required to set whether the coupon is valid, the code and the amount
|
||||
$coupons = new GoogleCoupons("true", $curr_code['code'], 5, $config['defaultCurrency'], "test2");
|
||||
$merchant_result->AddCoupons($coupons);
|
||||
}
|
||||
$merchant_calc->AddResult($merchant_result);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$merchant_result = new GoogleResult($curr_id);
|
||||
if($data[$root]['calculate']['tax']['VALUE'] == "true")
|
||||
{
|
||||
//Compute tax for this address id and shipping type
|
||||
$amount = 15; // Modify this to the actual tax value
|
||||
$merchant_result->SetTaxDetails($amount, $config['defaultCurrency']);
|
||||
}
|
||||
$codes = get_arr_result($data[$root]['calculate']['merchant-code-strings']
|
||||
['merchant-code-string']);
|
||||
foreach($codes as $curr_code)
|
||||
{
|
||||
//Update this data as required to set whether the coupon is valid, the code and the amount
|
||||
$coupons = new GoogleCoupons("true", $curr_code['code'], 5, $config['defaultCurrency'], "test2");
|
||||
$merchant_result->AddCoupons($coupons);
|
||||
}
|
||||
$merchant_calc->AddResult($merchant_result);
|
||||
}
|
||||
}
|
||||
|
||||
$response->ProcessMerchantCalculations($merchant_calc);
|
||||
break;
|
||||
}
|
||||
case "new-order-notification":
|
||||
{
|
||||
|
||||
////////////////////////////
|
||||
// INSERT ORDER TO DATABASE AND ADD CUSTOMERS
|
||||
/////////
|
||||
|
||||
// multiple items
|
||||
if(isset($data['new-order-notification']['shopping-cart']['items']['item'][0])) {
|
||||
|
||||
$amountofkeys = "multiple";
|
||||
|
||||
$subTotal = 0;
|
||||
// orderInv nees to be a key higher :-/ blame Al for being a dikhed
|
||||
$invKey=1;
|
||||
|
||||
for($i=0;$i<count($data['new-order-notification']['shopping-cart']['items']['item']);$i++) {
|
||||
|
||||
$orderInv[$invKey]['name'] = $data['new-order-notification']['shopping-cart']['items']['item'][$i]['item-name']['VALUE'];
|
||||
$orderInv[$invKey]['price'] = $data['new-order-notification']['shopping-cart']['items']['item'][$i]['unit-price']['VALUE'];
|
||||
$orderInv[$invKey]['quantity'] = $data['new-order-notification']['shopping-cart']['items']['item'][$i]['quantity']['VALUE'];
|
||||
$orderInv[$invKey]['product_options'] = $data['new-order-notification']['shopping-cart']['items']['item'][$i]['item-description']['VALUE'];
|
||||
// custom data
|
||||
$orderInv[$invKey]['productId'] = $data['new-order-notification']['shopping-cart']['items']['item'][$i]['merchant-private-item-data']['productid']['VALUE'];
|
||||
$orderInv[$invKey]['productCode'] = $data['new-order-notification']['shopping-cart']['items']['item'][$i]['merchant-private-item-data']['productcode']['VALUE'];
|
||||
$orderInv[$invKey]['digital'] = $data['new-order-notification']['shopping-cart']['items']['item'][$i]['merchant-private-item-data']['digital']['VALUE'];
|
||||
$orderInv[$invKey]['custom'] = 0;
|
||||
|
||||
$subTotal = $subTotal + $data['new-order-notification']['shopping-cart']['items']['item'][$i]['unit-price']['VALUE'];
|
||||
|
||||
$invKey++;
|
||||
|
||||
}
|
||||
|
||||
// single item
|
||||
} else {
|
||||
|
||||
$amountofkeys = "single";
|
||||
|
||||
$subTotal = 0;
|
||||
// orderInv nees to be a key higher :-/ blame Al
|
||||
$orderInv[1]['name'] = $data['new-order-notification']['shopping-cart']['items']['item']['item-name']['VALUE'];
|
||||
$orderInv[1]['price'] = $data['new-order-notification']['shopping-cart']['items']['item']['unit-price']['VALUE'];
|
||||
$orderInv[1]['quantity'] = $data['new-order-notification']['shopping-cart']['items']['item']['quantity']['VALUE'];
|
||||
$orderInv[1]['product_options'] = $data['new-order-notification']['shopping-cart']['items']['item']['item-description']['VALUE'];
|
||||
// custom data
|
||||
$orderInv[1]['productId'] = $data['new-order-notification']['shopping-cart']['items']['item']['merchant-private-item-data']['productid']['VALUE'];
|
||||
$orderInv[1]['productCode'] = $data['new-order-notification']['shopping-cart']['items']['item']['merchant-private-item-data']['productcode']['VALUE'];
|
||||
$orderInv[1]['digital'] = $data['new-order-notification']['shopping-cart']['items']['item']['merchant-private-item-data']['digital']['VALUE'];
|
||||
$orderInv[1]['custom'] = 0;
|
||||
|
||||
$subTotal = $subTotal + $data['new-order-notification']['shopping-cart']['items']['item']['unit-price']['VALUE'];
|
||||
}
|
||||
|
||||
|
||||
// insert/update customer
|
||||
|
||||
$email = $data['new-order-notification']['buyer-billing-address']['email']['VALUE'];
|
||||
|
||||
$customer = $db->select("SELECT `customer_id` FROM ".$glob['dbprefix']."CubeCart_customer WHERE `email` = ".$db->MySQLSafe($email));
|
||||
|
||||
// update data
|
||||
$billingCountryId = getCountryFormat($data['new-order-notification']['buyer-billing-address']['country-code']['VALUE'],"iso","id");
|
||||
|
||||
function name($fullName,$key)
|
||||
{
|
||||
|
||||
$fullNameArray = explode(" ",$fullName);
|
||||
$maxKey = count($fullNameArray)-1;
|
||||
|
||||
switch ($key)
|
||||
{
|
||||
case 0:
|
||||
return $fullNameArray[$key];
|
||||
break;
|
||||
case 1:
|
||||
|
||||
$first = "";
|
||||
for($i=0;$i<count($fullNameArray);$i++)
|
||||
{
|
||||
if($i!==0 && $i!==$maxKey)
|
||||
{
|
||||
$first .=$fullNameArray[$i]." ";
|
||||
}
|
||||
}
|
||||
|
||||
return trim($first);
|
||||
|
||||
break;
|
||||
case 2:
|
||||
return $fullNameArray[$maxKey];
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$customerData['title'] = $db->MySQLSafe(name($data['new-order-notification']['buyer-billing-address']['contact-name']['VALUE'],0));
|
||||
$customerData['firstName'] = $db->MySQLSafe(name($data['new-order-notification']['buyer-billing-address']['contact-name']['VALUE'],1));
|
||||
$customerData['lastName'] = $db->MySQLSafe(name($data['new-order-notification']['buyer-billing-address']['contact-name']['VALUE'],2));
|
||||
$customerData['add_1'] = $db->MySQLSafe($data['new-order-notification']['buyer-billing-address']['address1']['VALUE']);
|
||||
$customerData['add_2'] = $db->MySQLSafe($data['new-order-notification']['buyer-billing-address']['address2']['VALUE']);
|
||||
$customerData['town'] = $db->MySQLSafe($data['new-order-notification']['buyer-billing-address']['city']['VALUE']);
|
||||
$customerData['county'] = $db->MySQLSafe($data['new-order-notification']['buyer-billing-address']['region']['VALUE']);
|
||||
$customerData['postcode'] = $db->MySQLSafe($data['new-order-notification']['buyer-billing-address']['postal-code']['VALUE']);
|
||||
$customerData['country'] = $db->MySQLSafe($billingCountryId);
|
||||
$customerData['phone'] = $db->MySQLSafe($data['new-order-notification']['buyer-billing-address']['phone']['VALUE']);
|
||||
|
||||
if($data['new-order-notification']['buyer-marketing-preferences']['email-allowed']['VALUE'] == "true")
|
||||
{
|
||||
$customerData['optIn1st'] = 1;
|
||||
}
|
||||
|
||||
if($customer==TRUE)
|
||||
{
|
||||
$db->update($glob['dbprefix']."CubeCart_customer",$customerData,"`email` = ".$db->MySQLSafe($email));
|
||||
$customer_id = $customer[0]['customer_id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
// added insert data
|
||||
$password = randomPass(6);
|
||||
$customerData['password'] = $db->MySQLSafe(md5($password));
|
||||
$customerData['email'] = $db->MySQLSafe($email);
|
||||
$customerData['regTime'] = $db->MySQLSafe(time());
|
||||
$customerData['ipAddress'] = $db->MySQLSafe(get_ip_address()); // this will be googles IP :-/
|
||||
// ghost membership
|
||||
$customerData['type'] = $db->MySQLSafe(2);
|
||||
|
||||
// send welcome email
|
||||
if($module['welcomeEmail']==true) {
|
||||
|
||||
$emailLang = getLang("email.inc.php");
|
||||
|
||||
$mail = new htmlMimeMail();
|
||||
|
||||
$macroArray = array(
|
||||
|
||||
"CUSTOMER_NAME" => $data['new-order-notification']['buyer-billing-address']['contact-name']['VALUE'],
|
||||
"EMAIL" => $email,
|
||||
"PASSWORD" => $password,
|
||||
"STORE_URL" => $glob['storeURL'],
|
||||
"SENDER_IP" => get_ip_address()
|
||||
|
||||
);
|
||||
|
||||
$text = macroSub($lang['email']['new_reg_body'],$macroArray);
|
||||
unset($macroArray);
|
||||
|
||||
$mail->setText($text);
|
||||
$mail->setReturnPath($email);
|
||||
$mail->setFrom($config['masterName'].' <'.$config['masterEmail'].'>');
|
||||
$mail->setSubject($emailLang['email']['new_reg_subject']);
|
||||
$mail->setHeader('X-Mailer', 'CubeCart Mailer');
|
||||
$mail->send(array($email), $config['mailMethod']);
|
||||
// full membership
|
||||
$customerData['type'] = $db->MySQLSafe(1);
|
||||
} else {
|
||||
// ghost membership
|
||||
$customerData['type'] = $db->MySQLSafe(2);
|
||||
}
|
||||
|
||||
$db->insert($glob['dbprefix']."CubeCart_customer",$customerData);
|
||||
$customer_id = $db->insertid();
|
||||
|
||||
}
|
||||
|
||||
// empty basket and login
|
||||
|
||||
$sessionData['customer_id'] = $db->MySQLSafe($customer_id);
|
||||
$sessionData['basket'] = "''";
|
||||
$sessionData['timeLast'] = $db->MySQLSafe(time());
|
||||
|
||||
$db->update($glob['dbprefix']."CubeCart_sessions",$sessionData,"`sessId` = ".$db->MySQLSafe($data['new-order-notification']['shopping-cart']['merchant-private-data']['sessionid']['VALUE']));
|
||||
|
||||
$orderSum['cart_order_id'] = $data['new-order-notification']['shopping-cart']['merchant-private-data']['cart_order_id']['VALUE'];
|
||||
$orderSum['sec_order_id'] = $data['new-order-notification']['google-order-number']['VALUE'];
|
||||
$orderSum['customer_id'] = $customer_id;
|
||||
$orderSum['email'] = $email;
|
||||
$orderSum['name'] = $data['new-order-notification']['buyer-billing-address']['contact-name']['VALUE'];
|
||||
$orderSum['add_1'] = $data['new-order-notification']['buyer-billing-address']['address1']['VALUE'];
|
||||
$orderSum['add_2'] = $data['new-order-notification']['buyer-billing-address']['address2']['VALUE'];
|
||||
$orderSum['town'] = $data['new-order-notification']['buyer-billing-address']['city']['VALUE'];
|
||||
$orderSum['county'] = $data['new-order-notification']['buyer-billing-address']['region']['VALUE'];
|
||||
$orderSum['postcode'] = $data['new-order-notification']['buyer-billing-address']['postal-code']['VALUE'];
|
||||
$orderSum['country'] = getCountryFormat($billingCountryId, 'iso', 'printable_name');
|
||||
$orderSum['phone'] = $data['new-order-notification']['buyer-billing-address']['phone']['VALUE'];
|
||||
$orderSum['mobile'] = ""; // unsupported
|
||||
$orderSum['currency'] = $config['defaultCurrency'];
|
||||
|
||||
$orderSum['name_d'] = $data['new-order-notification']['buyer-shipping-address']['contact-name']['VALUE'];
|
||||
$orderSum['add_1_d'] = $data['new-order-notification']['buyer-shipping-address']['address1']['VALUE'];
|
||||
$orderSum['add_2_d'] = $data['new-order-notification']['buyer-shipping-address']['address2']['VALUE'];
|
||||
$orderSum['town_d'] = $data['new-order-notification']['buyer-shipping-address']['city']['VALUE'];
|
||||
$orderSum['county_d'] = $data['new-order-notification']['buyer-shipping-address']['region']['VALUE'];
|
||||
$orderSum['postcode_d'] = $data['new-order-notification']['buyer-shipping-address']['postal-code']['VALUE'];
|
||||
$orderSum['country_d'] = getCountryFormat($data['new-order-notification']['buyer-shipping-address']['country-code']['VALUE'], 'iso', 'printable_name');
|
||||
|
||||
$orderSum['subtotal'] = $subTotal;
|
||||
$orderSum['discount'] = $data['new-order-notification']['order-adjustment']['merchant-codes']['coupon-adjustment']['applied-amount']['VALUE'];
|
||||
$orderSum['total_ship'] = $data['new-order-notification']['order-adjustment']['shipping']['flat-rate-shipping-adjustment']['shipping-cost']['VALUE'];
|
||||
$orderSum['total_tax'] = $data['new-order-notification']['order-adjustment']['total-tax']['VALUE'];
|
||||
$orderSum['prod_total'] = $data['new-order-notification']['order-total']['VALUE'];
|
||||
$orderSum['shipMethod'] = $data['new-order-notification']['order-adjustment']['shipping']['flat-rate-shipping-adjustment']['shipping-name']['VALUE'];
|
||||
|
||||
// notification of coupon used
|
||||
$orderSum['comments'] = $data['new-order-notification']['order-adjustment']['merchant-codes']['coupon-adjustment']['message']['VALUE'];
|
||||
|
||||
//$orderSum['tax'.$i.'_disp'] = $taxes[$i]['display'];
|
||||
//$orderSum['tax'.$i.'_amt'] = $taxes[$i]['amount'];
|
||||
|
||||
$orderSum['gateway'] = "Google Checkout";
|
||||
|
||||
|
||||
doDebug(count($data['new-order-notification']['shopping-cart']['items']['item'])." - \n".$amountofkeys);
|
||||
|
||||
// add order
|
||||
$order->createOrder($orderInv, $orderSum);
|
||||
|
||||
unset($orderInv,$orderSum);
|
||||
|
||||
$transData['status'] = "NEW ORDER";
|
||||
$transData['notes'] = "A new order has been placed using Google Checkout";
|
||||
$transData['order_id'] = $data['new-order-notification']['shopping-cart']['merchant-private-data']['cart_order_id']['VALUE'];
|
||||
$transData['amount'] = $data['new-order-notification']['order-total']['VALUE'];
|
||||
$transData['trans_id'] = $data['new-order-notification']['google-order-number']['VALUE'];
|
||||
$transData['customer_id'] = $customer_id;
|
||||
$transData['gateway'] = "Google Checkout";
|
||||
$order->storeTrans($transData,FALSE);
|
||||
$response->SendAck();
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
case "order-state-change-notification":
|
||||
{
|
||||
|
||||
doDebug();
|
||||
|
||||
$response->SendAck();
|
||||
$new_financial_state = $data[$root]['new-financial-order-state']['VALUE'];
|
||||
$new_fulfillment_order = $data[$root]['new-fulfillment-order-state']['VALUE'];
|
||||
|
||||
|
||||
$assocData = $db->select("SELECT `customer_id`, `trans_id`, `order_id`, `amount` FROM ".$glob['dbprefix']."CubeCart_transactions WHERE `trans_id` = ".$db->MySQLSafe($data['order-state-change-notification']['google-order-number']['VALUE']));
|
||||
|
||||
$transData = $assocData[0];
|
||||
unset($assocData);
|
||||
$transData['status'] = $new_financial_state;
|
||||
$transData['gateway'] = "Google Checkout";
|
||||
$cart_order_id = $transData['order_id'];
|
||||
|
||||
switch($new_financial_state)
|
||||
{
|
||||
|
||||
case 'REVIEWING':
|
||||
{
|
||||
$order->orderStatus(2,$cart_order_id);
|
||||
|
||||
$transData['notes'] = "REVIEWING is the default financial state for all new orders. Upon receiving a new order, Google reviews the order to confirm that it is chargeable. After determining that the order is chargeable, Google will update the financial order state to CHARGEABLE.";
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
case 'CHARGEABLE':
|
||||
{
|
||||
|
||||
$order->orderStatus(2,$cart_order_id);
|
||||
//$response->SendProcessOrder($data[$root]['google-order-number']['VALUE'],
|
||||
// $message_log);
|
||||
//$response->SendChargeOrder($data[$root]['google-order-number']['VALUE'],
|
||||
// '', $message_log);
|
||||
|
||||
$transData['notes'] = "The CHARGEABLE state indicates that you may charge the customer for an order.";
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
case 'CHARGING':
|
||||
{
|
||||
|
||||
$order->orderStatus(2,$cart_order_id);
|
||||
|
||||
$transData['notes'] = "The CHARGING state indicates that Google is in the process of charging the customer. You may not take any actions on an order in this state. Once the charge is completed, Google will update the financial order state to CHARGED if you charged the customer for the full amount of the order. Google will revert the financial order state to CHARGEABLE if you only partially charged the customer.";
|
||||
|
||||
break;
|
||||
}
|
||||
case 'CHARGED':
|
||||
{
|
||||
/////////////////////
|
||||
// SET ORDER STATUS = PROCESS
|
||||
////
|
||||
$order->orderStatus(3,$cart_order_id);
|
||||
|
||||
$transData['notes'] = "The CHARGED state indicates that you have fully or partially charged the customer for an order. If you have partially charged the customer, the order will still be chargeable until you have charged the customer for the full order amount.
|
||||
|
||||
For partially charged orders, the buyer's account page will display the amount that has been charged.";
|
||||
|
||||
break;
|
||||
}
|
||||
case 'PAYMENT_DECLINED':
|
||||
{
|
||||
|
||||
$order->orderStatus(4,$cart_order_id);
|
||||
|
||||
$transData['notes'] = "The PAYMENT_DECLINED state indicates that Google's effort to authorize or charge the customer's credit card failed. If this happens, Google will email the customer to request a new credit card. The customer will have 72 hours to submit a new card.";
|
||||
|
||||
break;
|
||||
}
|
||||
case 'CANCELLED':
|
||||
{
|
||||
|
||||
$order->orderStatus(6,$cart_order_id);
|
||||
|
||||
$transData['notes'] = "The CANCELLED state indicates that the merchant canceled the order. Once an order is canceled, you may no longer update the order's financial order state.
|
||||
|
||||
You may cancel an order that is in either the CHARGEABLE or the PAYMENT_DECLINED financial state. You may not cancel an order that has already been charged until you have already issued a refund for the offer.";
|
||||
break;
|
||||
|
||||
}
|
||||
case 'CANCELLED_BY_GOOGLE':
|
||||
{
|
||||
|
||||
$order->orderStatus(6,$cart_order_id);
|
||||
//$response->SendBuyerMessage($data[$root]['google-order-number']['VALUE'],
|
||||
// "Sorry, your order is cancelled by Google", true, $message_log);
|
||||
|
||||
$transData['notes'] = "The CANCELLED_BY_GOOGLE state indicates that Google canceled an order. Google may cancel an order if the credit card authorization fails and the customer does not provide a new credit card within 72 hours.";
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
|
||||
$order->storeTrans($transData,FALSE);
|
||||
|
||||
//$transData['status'] = $new_fulfillment_order;
|
||||
|
||||
/*
|
||||
|
||||
switch($new_fulfillment_order)
|
||||
{
|
||||
|
||||
case 'NEW':
|
||||
{
|
||||
//$transData['notes'] = "NEW is the default fulfillment state for all new orders.";
|
||||
break;
|
||||
}
|
||||
case 'PROCESSING':
|
||||
{
|
||||
//$transData['notes'] = "The PROCESSING fulfillment state indicates that you are in the process of filling the customer's order.";
|
||||
break;
|
||||
}
|
||||
case 'DELIVERED':
|
||||
{
|
||||
//$order->orderStatus(3);
|
||||
//$transData['notes'] = "The DELIVERED fulfillment state indicates that you have shipped the order and it has been delivered.";
|
||||
break;
|
||||
}
|
||||
case 'WILL_NOT_DELIVER':
|
||||
{
|
||||
//$transData['notes'] = "The WILL_NOT_DELIVER fulfillment state indicates that you will not ship the items to the customer.";
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// $order->storeTrans($transData,FALSE);
|
||||
|
||||
*/
|
||||
|
||||
}
|
||||
/*
|
||||
case "charge-amount-notification":
|
||||
{
|
||||
|
||||
//doDebug();
|
||||
|
||||
$response->SendAck();
|
||||
//$response->SendDeliverOrder($data[$root]['google-order-number']['VALUE'],
|
||||
// <carrier>, <tracking-number>, <send-email>, $message_log);
|
||||
//$response->SendArchiveOrder($data[$root]['google-order-number']['VALUE'],
|
||||
// $message_log);
|
||||
break;
|
||||
}
|
||||
case "chargeback-amount-notification":
|
||||
{
|
||||
//doDebug();
|
||||
$response->SendAck();
|
||||
break;
|
||||
}
|
||||
case "refund-amount-notification":
|
||||
{
|
||||
//doDebug();
|
||||
$response->SendAck();
|
||||
break;
|
||||
}
|
||||
case "risk-information-notification":
|
||||
{
|
||||
//doDebug();
|
||||
$response->SendAck();
|
||||
break;
|
||||
}
|
||||
*/
|
||||
default:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* In case the XML API contains multiple open tags
|
||||
with the same value, then invoke this function and
|
||||
perform a foreach on the resultant array.
|
||||
This takes care of cases when there is only one unique tag
|
||||
or multiple tags.
|
||||
Examples of this are "anonymous-address", "merchant-code-string"
|
||||
from the merchant-calculations-callback API
|
||||
*/
|
||||
function get_arr_result($child_node)
|
||||
{
|
||||
|
||||
$result = array();
|
||||
|
||||
if(isset($child_node))
|
||||
{
|
||||
if(is_associative_array($child_node))
|
||||
{
|
||||
$result[] = $child_node;
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach($child_node as $curr_node)
|
||||
{
|
||||
$result[] = $curr_node;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/* Returns true if a given variable represents an associative array */
|
||||
function is_associative_array( $var )
|
||||
{
|
||||
return is_array( $var ) && !is_numeric( implode( '', array_keys( $var ) ) );
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,453 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2006 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* This class is used to create a Google Checkout shopping cart and post it
|
||||
* to the Sandbox or Production environment
|
||||
* A very useful function is the CheckoutButtonCode() which returns the HTML
|
||||
* code to post the cart using the standard technique
|
||||
* Refer demo/cartdemo.php for different use case scenarios for this code
|
||||
*/
|
||||
|
||||
class GoogleCart {
|
||||
var $merchant_id;
|
||||
var $merchant_key;
|
||||
var $server_url;
|
||||
var $schema_url;
|
||||
var $base_url;
|
||||
var $checkout_url;
|
||||
var $checkout_diagnose_url;
|
||||
var $request_url;
|
||||
var $request_diagnose_url;
|
||||
|
||||
var $cart_expiration = "";
|
||||
var $merchant_private_data = "";
|
||||
var $edit_cart_url = "";
|
||||
var $continue_shopping_url = "";
|
||||
var $request_buyer_phone = "";
|
||||
var $merchant_calculated = "";
|
||||
var $merchant_calculations_url = "";
|
||||
var $accept_merchant_coupons = "";
|
||||
var $accept_gift_certificates = "";
|
||||
var $default_tax_table;
|
||||
|
||||
var $item_arr;
|
||||
var $shipping_arr;
|
||||
var $alternate_tax_table_arr;
|
||||
var $xml_data;
|
||||
|
||||
//The Constructor method which requires a merchant id, merchant key
|
||||
//and the operation type(sandbox or checkout)
|
||||
function GoogleCart($id, $key, $server_type ="checkout", $merchant_private_data) {
|
||||
|
||||
$this->merchant_id = $id;
|
||||
$this->merchant_key = $key;
|
||||
|
||||
$this->merchant_private_data = $merchant_private_data;
|
||||
|
||||
if(strtolower($server_type) == "sandbox")
|
||||
// changed from https://sandbox.google.com/ on 17 Jan 2007
|
||||
$this->server_url = "https://sandbox.google.com/checkout/";
|
||||
else
|
||||
$this->server_url= "https://checkout.google.com/";
|
||||
|
||||
$this->schema_url = "http://checkout.google.com/schema/2";
|
||||
$this->base_url = $this->server_url."cws/v2/Merchant/" .
|
||||
$this->merchant_id;
|
||||
$this->checkout_url = $this->base_url . "/checkout";
|
||||
$this->checkout_diagnose_url = $this->base_url .
|
||||
"/checkout/diagnose";
|
||||
$this->request_url = $this->base_url . "/request";
|
||||
$this->request_diagnose_url = $this->base_url .
|
||||
"/request/diagnose";
|
||||
|
||||
//The item, shipping and tax table arrays are initialized
|
||||
$this->item_arr = array();
|
||||
$this->shipping_arr = array();
|
||||
$this->alternate_tax_table_arr = array();
|
||||
}
|
||||
|
||||
function SetCartExpiration($cart_expire) {
|
||||
$this->cart_expiration = $cart_expire;
|
||||
}
|
||||
|
||||
function SetMerchantPrivateData($data) {
|
||||
$this->merchant_private_data = $data;
|
||||
}
|
||||
|
||||
function SetEditCartUrl($url) {
|
||||
$this->edit_cart_url= $url;
|
||||
}
|
||||
|
||||
function SetContinueShoppingUrl($url) {
|
||||
$this->continue_shopping_url = $url;
|
||||
}
|
||||
|
||||
function SetRequestBuyerPhone($req) {
|
||||
$this->_SetBooleanValue('request_buyer_phone', $req, "");
|
||||
}
|
||||
|
||||
function SetMerchantCalculations($url, $tax_option = "false" ,
|
||||
$coupons="false",
|
||||
$gift_cert ="false") {
|
||||
$this->merchant_calculations_url = $url;
|
||||
$this->_SetBooleanValue('merchant_calculated', $tax_option, "false");
|
||||
$this->_SetBooleanValue('accept_merchant_coupons', $coupons, "false");
|
||||
$this->_SetBooleanValue('accept_gift_certificates', $gift_cert, "false");
|
||||
}
|
||||
|
||||
function AddItem($google_item) {
|
||||
$this->item_arr[] = $google_item;
|
||||
}
|
||||
|
||||
function AddShipping($ship) {
|
||||
$this->shipping_arr[] = $ship;
|
||||
}
|
||||
|
||||
function AddTaxTables($tax) {
|
||||
if($tax->type == "default")
|
||||
$this->default_tax_table = $tax;
|
||||
else if ($tax->type == "alternate")
|
||||
$this->alternate_tax_table_arr[] = $tax;
|
||||
}
|
||||
|
||||
function GetXML() {
|
||||
|
||||
require_once('xml-processing/xmlbuilder.php');
|
||||
|
||||
$xml_data = new XmlBuilder();
|
||||
|
||||
$xml_data->Push('checkout-shopping-cart',
|
||||
array('xmlns' => $this->schema_url));
|
||||
$xml_data->Push('shopping-cart');
|
||||
|
||||
$xml_data->Push('merchant-private-data');
|
||||
foreach($this->merchant_private_data as $key => $value){
|
||||
$xml_data->Element($key,
|
||||
$value);}
|
||||
$xml_data->Pop('merchant-private-data');
|
||||
|
||||
//Add cart expiration if set
|
||||
if($this->cart_expiration != "") {
|
||||
$xml_data->Push('cart-expiration');
|
||||
$xml_data->Element('good-until-date', $this->cart_expiration);
|
||||
$xml_data->Pop('cart-expiration');
|
||||
}
|
||||
|
||||
//Add XML data for each of the items
|
||||
$xml_data->Push('items');
|
||||
foreach($this->item_arr as $item) {
|
||||
$xml_data->Push('item');
|
||||
$xml_data->Element('item-name', $item->item_name);
|
||||
$xml_data->Element('item-description', $item->item_description);
|
||||
$xml_data->Element('unit-price', $item->unit_price,
|
||||
array('currency'=> $item->currency));
|
||||
$xml_data->Element('quantity', $item->quantity);
|
||||
if($item->merchant_private_data != '')
|
||||
$xml_data->Push('merchant-private-item-data');
|
||||
if(is_array($item->merchant_private_data)){
|
||||
foreach($item->merchant_private_data as $key => $value){
|
||||
$xml_data->Element($key,
|
||||
$value);}}
|
||||
$xml_data->Pop('merchant-private-item-data');
|
||||
if($item->tax_table_selector != '')
|
||||
$xml_data->Element('tax-table-selector', $item->tax_table_selector);
|
||||
$xml_data->Pop('item');
|
||||
}
|
||||
$xml_data->Pop('items');
|
||||
|
||||
$xml_data->Pop('shopping-cart');
|
||||
|
||||
$xml_data->Push('checkout-flow-support');
|
||||
$xml_data->Push('merchant-checkout-flow-support');
|
||||
if($this->edit_cart_url != '')
|
||||
$xml_data->Element('edit-cart-url', $this->edit_cart_url);
|
||||
if($this->continue_shopping_url != '')
|
||||
$xml_data->Element('continue-shopping-url',
|
||||
$this->continue_shopping_url);
|
||||
|
||||
if(count($this->shipping_arr) > 0)
|
||||
$xml_data->Push('shipping-methods');
|
||||
|
||||
//Add the shipping methods
|
||||
foreach($this->shipping_arr as $ship) {
|
||||
//Pickup shipping handled in else part
|
||||
if($ship->type == "flat-rate" ||
|
||||
$ship->type == "merchant-calculated") {
|
||||
$xml_data->Push($ship->type.'-shipping',
|
||||
array('name' => $ship->name));
|
||||
$xml_data->Element('price', $ship->price,
|
||||
array('currency' => $ship->currency));
|
||||
|
||||
//Check if shipping restrictions have been specifd=ied
|
||||
if( $ship->allowed_restrictions ||
|
||||
$ship->excluded_restrictions) {
|
||||
$xml_data->Push('shipping-restrictions');
|
||||
|
||||
//Check if allowed restrictions specified
|
||||
if($ship->allowed_restrictions) {
|
||||
$xml_data->Push('allowed-areas');
|
||||
if($ship->allowed_country_area != "")
|
||||
$xml_data->Element('us-country-area','',
|
||||
array('country-area' =>
|
||||
$ship->allowed_country_area));
|
||||
foreach($ship->allowed_state_areas_arr as $current) {
|
||||
$xml_data->Push('us-state-area');
|
||||
$xml_data->Element('state', $current);
|
||||
$xml_data->Pop('us-state-area');
|
||||
}
|
||||
foreach($ship->allowed_zip_patterns_arr as $current) {
|
||||
$xml_data->Push('us-zip-area');
|
||||
$xml_data->Element('zip-pattern', $current);
|
||||
$xml_data->Pop('us-zip-area');
|
||||
}
|
||||
$xml_data->Pop('allowed-areas');
|
||||
}
|
||||
|
||||
if($ship->excluded_restrictions) {
|
||||
$xml_data->Push('allowed-areas');
|
||||
$xml_data->Pop('allowed-areas');
|
||||
$xml_data->Push('excluded-areas');
|
||||
if($ship->excluded_country_area != "")
|
||||
$xml_data->Element('us-country-area','',
|
||||
array('country-area' =>
|
||||
$ship->excluded_country_area));
|
||||
foreach($ship->excluded_state_areas_arr as $current) {
|
||||
$xml_data->Push('us-state-area');
|
||||
$xml_data->Element('state', $current);
|
||||
$xml_data->Pop('us-state-area');
|
||||
}
|
||||
foreach($ship->excluded_zip_patterns_arr as $current) {
|
||||
$xml_data->Push('us-zip-area');
|
||||
$xml_data->Element('zip-pattern', $current);
|
||||
$xml_data->Pop('us-zip-area');
|
||||
}
|
||||
$xml_data->Pop('excluded-areas');
|
||||
}
|
||||
$xml_data->Pop('shipping-restrictions');
|
||||
}
|
||||
$xml_data->Pop($ship->type.'-shipping');
|
||||
}
|
||||
else if ($ship->type == "pickup") {
|
||||
$xml_data->Push('pickup', array('name' => $ship->name));
|
||||
$xml_data->Element('price', $ship->price,
|
||||
array('currency' => $ship->currency));
|
||||
$xml_data->Pop('pickup');
|
||||
}
|
||||
}
|
||||
if(count($this->shipping_arr) > 0)
|
||||
$xml_data->Pop('shipping-methods');
|
||||
|
||||
if($this->request_buyer_phone != "")
|
||||
$xml_data->Element('request-buyer-phone-number',
|
||||
$this->request_buyer_phone);
|
||||
|
||||
if($this->merchant_calculations_url != "") {
|
||||
$xml_data->Push('merchant-calculations');
|
||||
$xml_data->Element('merchant-calculations-url',
|
||||
$this->merchant_calculations_url);
|
||||
if($this->accept_merchant_coupons != "")
|
||||
$xml_data->Element('accept-merchant-coupons',
|
||||
$this->accept_merchant_coupons);
|
||||
if($this->accept_gift_certificates != "")
|
||||
$xml_data->Element('accept-gift-certificates',
|
||||
$this->accept_gift_certificates);
|
||||
$xml_data->Pop('merchant-calculations');
|
||||
}
|
||||
|
||||
//Set Default and Alternate tax tables
|
||||
if( (count($this->alternate_tax_table_arr) != 0) || (isset($this->default_tax_table))) {
|
||||
if($this->merchant_calculated != "")
|
||||
$xml_data->Push('tax-tables', array('merchant-calculated' => $this->merchant_calculated));
|
||||
else
|
||||
$xml_data->Push('tax-tables');
|
||||
|
||||
if(isset($this->default_tax_table)) {
|
||||
$curr_table = $this->default_tax_table;
|
||||
foreach($curr_table->tax_rules_arr as $curr_rule) {
|
||||
|
||||
|
||||
$xml_data->Push('default-tax-table');
|
||||
$xml_data->Push('tax-rules');
|
||||
foreach($curr_rule->state_areas_arr as $current) {
|
||||
$xml_data->Push('default-tax-rule');
|
||||
|
||||
$xml_data->Element('shipping-taxed', $curr_rule->shipping_taxed);
|
||||
$xml_data->Element('rate', $curr_rule->tax_rate);
|
||||
$xml_data->Push('tax-area');
|
||||
if($curr_rule->country_area != "")
|
||||
$xml_data->Element('us-country-area','', array('country-area' => $curr_rule->country_area));
|
||||
$xml_data->Push('us-state-area');
|
||||
$xml_data->Element('state', $current);
|
||||
$xml_data->Pop('us-state-area');
|
||||
|
||||
$xml_data->Pop('tax-area');
|
||||
$xml_data->Pop('default-tax-rule');
|
||||
}
|
||||
foreach($curr_rule->zip_patterns_arr as $current) {
|
||||
$xml_data->Push('default-tax-rule');
|
||||
|
||||
$xml_data->Element('shipping-taxed', $curr_rule->shipping_taxed);
|
||||
$xml_data->Element('rate', $curr_rule->tax_rate);
|
||||
$xml_data->Push('tax-area');
|
||||
|
||||
if($curr_rule->country_area != "")
|
||||
$xml_data->Element('us-country-area','', array('country-area' => $curr_rule->country_area));
|
||||
$xml_data->Push('us-zip-area');
|
||||
$xml_data->Element('zip-pattern', $current);
|
||||
$xml_data->Pop('us-zip-area');
|
||||
$xml_data->Pop('tax-area');
|
||||
$xml_data->Pop('default-tax-rule');
|
||||
}
|
||||
$xml_data->Pop('tax-rules');
|
||||
$xml_data->Pop('default-tax-table');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(count($this->alternate_tax_table_arr) != 0) {
|
||||
$xml_data->Push('alternate-tax-tables');
|
||||
foreach($this->alternate_tax_table_arr as $curr_table) {
|
||||
foreach($curr_table->tax_rules_arr as $curr_rule) {
|
||||
$xml_data->Push('alternate-tax-table',array('standalone' => $curr_table->standalone, 'name' => $curr_table->name));
|
||||
$xml_data->Push('alternate-tax-rules');
|
||||
foreach($curr_rule->state_areas_arr as $current) {
|
||||
$xml_data->Push('alternate-tax-rule');
|
||||
// shipping-taxed not allowed in alternate rules Al B
|
||||
//$xml_data->Element('shipping-taxed', $curr_rule->shipping_taxed);
|
||||
$xml_data->Element('rate', $curr_rule->tax_rate);
|
||||
$xml_data->Push('tax-area');
|
||||
if($curr_rule->country_area != "")
|
||||
$xml_data->Element('us-country-area','', array('country-area' => $curr_rule->country_area));
|
||||
|
||||
// Google PHP SDK is CRAP
|
||||
if($current!=="FALSE") {
|
||||
$xml_data->Push('us-state-area');
|
||||
$xml_data->Element('state', $current);
|
||||
$xml_data->Pop('us-state-area');
|
||||
}
|
||||
|
||||
$xml_data->Pop('tax-area');
|
||||
$xml_data->Pop('alternate-tax-rule');
|
||||
}
|
||||
foreach($curr_rule->zip_patterns_arr as $current) {
|
||||
$xml_data->Push('alternate-tax-rule');
|
||||
|
||||
//$xml_data->Element('shipping-taxed', $curr_rule->shipping_taxed);
|
||||
$xml_data->Element('rate', $curr_rule->tax_rate);
|
||||
$xml_data->Push('tax-area');
|
||||
|
||||
if($curr_rule->country_area != "")
|
||||
$xml_data->Element('us-country-area','', array('country-area' => $curr_rule->country_area));
|
||||
$xml_data->Push('us-zip-area');
|
||||
$xml_data->Element('zip-pattern', $current);
|
||||
$xml_data->Pop('us-zip-area');
|
||||
$xml_data->Pop('tax-area');
|
||||
$xml_data->Pop('alternate-tax-rule');
|
||||
}
|
||||
$xml_data->Pop('alternate-tax-rules');
|
||||
$xml_data->Pop('alternate-tax-table');
|
||||
}
|
||||
}
|
||||
$xml_data->Pop('alternate-tax-tables');
|
||||
}
|
||||
$xml_data->Pop('tax-tables');
|
||||
}
|
||||
$xml_data->Pop('merchant-checkout-flow-support');
|
||||
$xml_data->Pop('checkout-flow-support');
|
||||
$xml_data->Pop('checkout-shopping-cart');
|
||||
|
||||
return $xml_data->GetXML();
|
||||
}
|
||||
|
||||
//Code for generating Checkout button
|
||||
function CheckoutButtonCode($size="large", $style="white",
|
||||
$variant="text", $loc="en_US") {
|
||||
|
||||
switch ($size) {
|
||||
case "large":
|
||||
$width = "180";
|
||||
$height = "46";
|
||||
break;
|
||||
|
||||
case "medium":
|
||||
$width = "168";
|
||||
$height = "44";
|
||||
break;
|
||||
|
||||
case "small":
|
||||
$width = "160";
|
||||
$height = "43";
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if ($variant == "text") {
|
||||
$data =
|
||||
"<form method=\"POST\" action=\"". $this->checkout_url . "\" style=\"margin:0px; padding: 0px;\">
|
||||
<input type=\"hidden\" name=\"cart\" value=\"". base64_encode($this->GetXML()) ."\">
|
||||
<input type=\"hidden\" name=\"signature\" value=\"". base64_encode($this->CalcHmacSha1($this->GetXML())). "\">
|
||||
<input type=\"image\" name=\"Checkout\" alt=\"Checkout\"
|
||||
src=\"". $this->server_url."buttons/checkout.gif?merchant_id=".$this->merchant_id."&w=".$width. "&h=".$height."&style=".$style."&variant=".$variant."&loc=".$loc."\"
|
||||
height=\"".$height."\" width=\"".$width. "\" />
|
||||
</form>";
|
||||
} elseif ($variant == "disabled") {
|
||||
$data = "<img alt=\"Checkout\"
|
||||
src=\"". $this->server_url."buttons/checkout.gif?merchant_id=".$this->merchant_id."&w=".$width. "&h=".$height."&style=".$style."&variant=".$variant."&loc=".$loc."\"
|
||||
height=\"".$height."\" width=\"".$width. "\" />";
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
//Method which returns the encrypted google cart to make sure that the carts are not tampered with
|
||||
function CalcHmacSha1($data) {
|
||||
$key = $this->merchant_key;
|
||||
$blocksize = 64;
|
||||
$hashfunc = 'sha1';
|
||||
if (strlen($key) > $blocksize) {
|
||||
$key = pack('H*', $hashfunc($key));
|
||||
}
|
||||
$key = str_pad($key, $blocksize, chr(0x00));
|
||||
$ipad = str_repeat(chr(0x36), $blocksize);
|
||||
$opad = str_repeat(chr(0x5c), $blocksize);
|
||||
$hmac = pack(
|
||||
'H*', $hashfunc(
|
||||
($key^$opad).pack(
|
||||
'H*', $hashfunc(
|
||||
($key^$ipad).$data
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
return $hmac;
|
||||
}
|
||||
|
||||
//Method used internally to set true/false cart variables
|
||||
function _SetBooleanValue($string, $value, $default) {
|
||||
$value = strtolower($value);
|
||||
if($value== "true" || $value == "false")
|
||||
eval('$this->'.$string.'="'.$value.'";');
|
||||
else
|
||||
eval('$this->'.$string.'="'.$default.'";');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2006 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* This class is used to create items to be added to the shopping cart
|
||||
* Invoke a separate instance of this class for each item to be
|
||||
* added to the cart.
|
||||
* Required fields are the item name, description, quantity and price
|
||||
* The private-data and tax-selector for each item can be set in the
|
||||
* constructor call or using individual Set functions
|
||||
*/
|
||||
class GoogleItem {
|
||||
|
||||
var $item_name;
|
||||
var $item_description;
|
||||
var $unit_price;
|
||||
var $currency;
|
||||
var $quantity;
|
||||
var $merchant_private_data;
|
||||
var $tax_table_selector;
|
||||
|
||||
function GoogleItem($name, $desc, $qty, $price, $money= "USD",
|
||||
$private_data = "", $tax_selector = "") {
|
||||
|
||||
global $config;
|
||||
|
||||
$this->item_name = $name;
|
||||
$this->item_description= $desc;
|
||||
$this->unit_price = $price;
|
||||
$this->quantity = $qty;
|
||||
$this->currency= $config['defaultCurrency'];
|
||||
$this->merchant_private_data = $private_data;
|
||||
$this->tax_table_selector= $tax_selector;
|
||||
}
|
||||
|
||||
function SetMerchantPrivateData($private_data) {
|
||||
$this->merchant_private_data = $private_data;
|
||||
}
|
||||
|
||||
function SetTaxTableSelector($tax_selector) {
|
||||
$this->tax_table_selector= $tax_selector;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2006 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* This class is used to create the merchant callback results
|
||||
* when a merchant-calculated-feedback structure is received
|
||||
*
|
||||
* Multiple results are generated depending on the possible
|
||||
* combinations for shipping options and address ids
|
||||
*
|
||||
* Refer demo/responsehandler.php for generating these results
|
||||
*/
|
||||
|
||||
class GoogleMerchantCalculations {
|
||||
var $results_arr;
|
||||
var $schema_url = "http://checkout.google.com/schema/2";
|
||||
|
||||
function GoogleMerchantCalculations() {
|
||||
$this->results_arr = array();
|
||||
}
|
||||
|
||||
function AddResult($results) {
|
||||
$this->results_arr[] = $results;
|
||||
}
|
||||
|
||||
function GetXML() {
|
||||
require_once('xml-processing/xmlbuilder.php');
|
||||
|
||||
$xml_data = new XmlBuilder();
|
||||
$xml_data->Push('merchant-calculation-results',
|
||||
array('xmlns' => $this->schema_url));
|
||||
$xml_data->Push('results');
|
||||
|
||||
foreach($this->results_arr as $result) {
|
||||
if($result->shipping_name != "") {
|
||||
$xml_data->Push('result', array('shipping-name' =>
|
||||
$result->shipping_name, 'address-id' => $result->address_id));
|
||||
$xml_data->Element('shipping-rate', $result->ship_price,
|
||||
array('currency' => $result->ship_currency));
|
||||
$xml_data->Element('shippable', $result->shippable);
|
||||
} else
|
||||
$xml_data->Push('result', array('address-id' => $result->address_id));
|
||||
|
||||
if($result->tax_amount != "")
|
||||
$xml_data->Element('total-tax', $result->tax_amount,
|
||||
array('currency' => $result->tax_currency));
|
||||
|
||||
if((count($result->coupon_arr) != 0) ||
|
||||
(count($result->giftcert_arr) != 0) ) {
|
||||
$xml_data->Push('merchant-code-results');
|
||||
|
||||
foreach($result->coupon_arr as $curr_coupon) {
|
||||
$xml_data->Push('coupon-result');
|
||||
$xml_data->Element('valid', $curr_coupon->coupon_valid);
|
||||
$xml_data->Element('code', $curr_coupon->coupon_code);
|
||||
$xml_data->Element('calculated-amount', $curr_coupon->coupon_amount,
|
||||
array('currency'=> $curr_coupon->coupon_currency));
|
||||
$xml_data->Element('message', $curr_coupon->coupon_message);
|
||||
$xml_data->Pop('coupon-result');
|
||||
}
|
||||
foreach($result->giftcert_arr as $curr_gift) {
|
||||
$xml_data->Push('gift-result');
|
||||
$xml_data->Element('valid', $curr_gift->gift_valid);
|
||||
$xml_data->Element('code', $curr_gift->gift_code);
|
||||
$xml_data->Element('calculated-amount', $curr_gift->gift_amount,
|
||||
array('currency'=> $curr_gift->gift_currency));
|
||||
$xml_data->Element('message', $curr_gift->gift_message);
|
||||
$xml_data->Pop('gift-result');
|
||||
}
|
||||
$xml_data->Pop('merchant-code-results');
|
||||
}
|
||||
$xml_data->Pop('result');
|
||||
}
|
||||
$xml_data->Pop('results');
|
||||
$xml_data->Pop('merchant-calculation-results');
|
||||
return $xml_data->GetXML();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,278 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2006 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* This class is instantiated everytime any notification or
|
||||
* order processing commands are received.
|
||||
*
|
||||
* It has a SendReq function to post different requests to the Google Server
|
||||
* Send functions are provided for most of the commands that are supported
|
||||
* by the server
|
||||
* Refer demo/responsehandlerdemo.php for different use case scenarios
|
||||
* for this code
|
||||
*/
|
||||
class GoogleResponse {
|
||||
var $merchant_id;
|
||||
var $merchant_key;
|
||||
var $server_url;
|
||||
var $schema_url;
|
||||
var $base_url;
|
||||
var $checkout_url;
|
||||
var $checkout_diagnose_url;
|
||||
var $request_url;
|
||||
var $request_diagnose_url;
|
||||
|
||||
var $response;
|
||||
var $root;
|
||||
var $data;
|
||||
var $xml_parser;
|
||||
|
||||
function GoogleResponse($id, $key, $response, $server_type ="checkout") {
|
||||
$this->merchant_id = $id;
|
||||
$this->merchant_key = $key;
|
||||
|
||||
if($server_type == "sandbox")
|
||||
// changed from https://sandbox.google.com/ on 17 Jan 2007
|
||||
$this->server_url = "https://sandbox.google.com/checkout/";
|
||||
else
|
||||
$this->server_url = "https://checkout.google.com/";
|
||||
|
||||
$this->schema_url = "http://checkout.google.com/schema/2";
|
||||
$this->base_url = $this->server_url."cws/v2/Merchant/" .
|
||||
$this->merchant_id;
|
||||
$this->checkout_url = $this->base_url . "/checkout";
|
||||
$this->checkout_diagnose_url = $this->base_url . "/checkout/diagnose";
|
||||
$this->request_url = $this->base_url . "/request";
|
||||
$this->request_diagnose_url = $this->base_url . "/request/diagnose";
|
||||
|
||||
$this->response = $response;
|
||||
|
||||
if(strpos(__FILE__, ':') !== false)
|
||||
$path_delimiter = ';';
|
||||
else
|
||||
$path_delimiter = ':';
|
||||
|
||||
ini_set('include_path', ini_get('include_path').$path_delimiter.'.');
|
||||
require_once('xml-processing/xmlparser.php');
|
||||
$this->xml_parser = new XmlParser($response);
|
||||
$this->root = $this->xml_parser->GetRoot();
|
||||
$this->data = $this->xml_parser->GetData();
|
||||
}
|
||||
|
||||
function HttpAuthentication($headers) {
|
||||
if(isset($headers['Authorization'])) {
|
||||
$auth_encode = $headers['Authorization'];
|
||||
$auth = base64_decode(substr($auth_encode,
|
||||
strpos($auth_encode, " ") + 1));
|
||||
$compare_mer_id = substr($auth, 0, strpos($auth,":"));
|
||||
$compare_mer_key = substr($auth, strpos($auth,":")+1);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
if($compare_mer_id != $this->merchant_id ||
|
||||
$compare_mer_key != $this->merchant_key)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
function SendChargeOrder($google_order, $amount='', $message_log) {
|
||||
|
||||
global $config;
|
||||
|
||||
$postargs = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
||||
<charge-order xmlns=\"".$this->schema_url.
|
||||
"\" google-order-number=\"". $google_order. "\">";
|
||||
if ($amount != '') {
|
||||
$postargs .= "<amount currency=\"".$config['defaultCurrency']."\">" . $amount . "</amount>";
|
||||
}
|
||||
$postargs .= "</charge-order>";
|
||||
return $this->SendReq($this->request_url, $this->GetAuthenticationHeaders(),
|
||||
$postargs, $message_log);
|
||||
}
|
||||
|
||||
function SendRefundOrder($google_order, $amount, $reason, $comment, $message_log) {
|
||||
global $config;
|
||||
|
||||
$postargs = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
||||
<refund-order xmlns=\"".$this->schema_url.
|
||||
"\" google-order-number=\"". $google_order. "\">
|
||||
<reason>". $reason . "</reason>
|
||||
<amount currency=\"".$config['defaultCurrency']."\">".htmlentities($amount)."</amount>
|
||||
<comment>". htmlentities($comment) . "</comment>
|
||||
</refund-order>";
|
||||
return $this->SendReq($this->request_url, $this->GetAuthenticationHeaders(),
|
||||
$postargs, $message_log);
|
||||
}
|
||||
|
||||
function SendCancelOrder($google_order, $reason, $comment, $message_log) {
|
||||
$postargs = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
||||
<cancel-order xmlns=\"".$this->schema_url.
|
||||
"\" google-order-number=\"". $google_order. "\">
|
||||
<reason>". htmlentities($reason) . "</reason>
|
||||
<comment>". htmlentities($comment) . "</comment>
|
||||
</cancel-order>";
|
||||
return $this->SendReq($this->request_url, $this->GetAuthenticationHeaders(),
|
||||
$postargs, $message_log);
|
||||
}
|
||||
|
||||
function SendTrackingData($google_order, $carrier, $tracking_no, $message_log) {
|
||||
$postargs = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
||||
<add-tracking-data xmlns=\"". $this->schema_url .
|
||||
"\" google-order-number=\"". $google_order . "\">
|
||||
<tracking-data>
|
||||
<carrier>". htmlentities($carrier) . "</carrier>
|
||||
<tracking-number>". $tracking_no . "</tracking-number>
|
||||
</tracking-data>
|
||||
</add-tracking-data>";
|
||||
return $this->SendReq($this->request_url, $this->GetAuthenticationHeaders(),
|
||||
$postargs, $message_log);
|
||||
}
|
||||
|
||||
function SendMerchantOrderNumber($google_order, $merchant_order, $message_log) {
|
||||
$postargs = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
||||
<add-merchant-order-number xmlns=\"". $this->schema_url .
|
||||
"\" google-order-number=\"". $google_order . "\">
|
||||
<merchant-order-number>" . $merchant_order .
|
||||
"</merchant-order-number>
|
||||
</add-merchant-order-number>";
|
||||
return $this->SendReq($this->request_url, $this->GetAuthenticationHeaders(),
|
||||
$postargs, $message_log);
|
||||
}
|
||||
|
||||
function SendBuyerMessage($google_order, $message, $send_mail="true",$message_log) {
|
||||
$postargs = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
||||
<send-buyer-message xmlns=\"". $this->schema_url .
|
||||
"\" google-order-number=\"". $google_order . "\">
|
||||
<message>" . $message . "</message>
|
||||
<send-mail>" . $send_mail . "</send-mail>
|
||||
</send-buyer-message>";
|
||||
return $this->SendReq($this->request_url, $this->GetAuthenticationHeaders(),
|
||||
$postargs, $message_log);
|
||||
}
|
||||
|
||||
function SendProcessOrder($google_order, $message_log) {
|
||||
$postargs = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
||||
<process-order xmlns=\"".$this->schema_url .
|
||||
"\" google-order-number=\"". $google_order. "\"/> ";
|
||||
return $this->SendReq($this->request_url, $this->GetAuthenticationHeaders(),
|
||||
$postargs, $message_log);
|
||||
}
|
||||
|
||||
function SendDeliverOrder($google_order, $carrier, $tracking_no, $send_mail = "true", $message_log) {
|
||||
$postargs = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
||||
<deliver-order xmlns=\"". $this->schema_url .
|
||||
"\" google-order-number=\"". $google_order . "\">
|
||||
<tracking-data>
|
||||
<carrier>". htmlentities($carrier) . "</carrier>
|
||||
<tracking-number>". $tracking_no . "</tracking-number>
|
||||
</tracking-data>
|
||||
<send-email>". $send_mail . "</send-email>
|
||||
</deliver-order>";
|
||||
return $this->SendReq($this->request_url, $this->GetAuthenticationHeaders(),
|
||||
$postargs, $message_log);
|
||||
}
|
||||
|
||||
function SendArchiveOrder($google_order, $message_log) {
|
||||
$postargs = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
||||
<archive-order xmlns=\"".$this->schema_url.
|
||||
"\" google-order-number=\"". $google_order. "\"/>";
|
||||
return $this->SendReq($this->request_url, $this->GetAuthenticationHeaders(),
|
||||
$postargs, $message_log);
|
||||
}
|
||||
|
||||
function SendUnarchiveOrder($google_order, $message_log) {
|
||||
$postargs = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
||||
<unarchive-order xmlns=\"".
|
||||
$this->schema_url."\" google-order-number=\"".
|
||||
$google_order. "\"/>";
|
||||
return $this->SendReq($this->request_url, $this->GetAuthenticationHeaders(),
|
||||
$postargs, $message_log);
|
||||
}
|
||||
|
||||
function ProcessMerchantCalculations($merchant_calc) {
|
||||
$result = $merchant_calc->GetXML();
|
||||
echo $result;
|
||||
}
|
||||
|
||||
function GetAuthenticationHeaders() {
|
||||
$headers = array();
|
||||
$headers[] = "Authorization: Basic ".base64_encode(
|
||||
$this->merchant_id.':'.$this->merchant_key);
|
||||
$headers[] = "Content-Type: application/xml";
|
||||
$headers[] = "Accept: application/xml";
|
||||
return $headers;
|
||||
}
|
||||
|
||||
function SendReq($url, $header_arr, $postargs, $message_log) {
|
||||
global $config;
|
||||
|
||||
// Get the curl session object
|
||||
$session = curl_init($url);
|
||||
|
||||
// Set the POST options.
|
||||
curl_setopt($session, CURLOPT_POST, true);
|
||||
curl_setopt($session, CURLOPT_HTTPHEADER, $header_arr);
|
||||
curl_setopt($session, CURLOPT_POSTFIELDS, $postargs);
|
||||
curl_setopt($session, CURLOPT_HEADER, true);
|
||||
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
|
||||
if($config['proxy']==1){
|
||||
curl_setopt ($session, CURLOPT_PROXY, $config['proxyHost'].":".$config['proxyPort']);
|
||||
}
|
||||
|
||||
// Do the POST and then close the session
|
||||
$response = curl_exec($session);
|
||||
if (curl_errno($session)) {
|
||||
die(curl_error($session));
|
||||
} else {
|
||||
curl_close($session);
|
||||
}
|
||||
|
||||
// Get HTTP Status code from the response
|
||||
$status_code = array();
|
||||
preg_match('/\d\d\d/', $response, $status_code);
|
||||
|
||||
// Check for errors
|
||||
switch( $status_code[0] ) {
|
||||
case 200:
|
||||
// Success
|
||||
break;
|
||||
case 503:
|
||||
die('Error 503: Service unavailable.');
|
||||
break;
|
||||
case 403:
|
||||
die('Error 403: Forbidden.');
|
||||
break;
|
||||
case 400:
|
||||
die('Error 400: Bad request.');
|
||||
break;
|
||||
default:
|
||||
echo $response;
|
||||
die('Error :' . $status_code[0]);
|
||||
}
|
||||
fwrite($message_log, sprintf("\n\r%s:- %s\n",date("D M j G:i:s T Y"),
|
||||
$response));
|
||||
}
|
||||
|
||||
function SendAck() {
|
||||
$acknowledgment = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" .
|
||||
"<notification-acknowledgment xmlns=\"" .
|
||||
$this->schema_url . "\"/>";
|
||||
echo $acknowledgment;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2006 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* This class is used to create a Google Checkout result for merchant
|
||||
* as a response to merchant-calculations feedback structure
|
||||
* Refer demo/responsehandlerdemo.php for usage of this code
|
||||
*
|
||||
* Methods are provided to set the shipping, tax, coupons and gift certificate
|
||||
* options
|
||||
*/
|
||||
|
||||
class GoogleResult {
|
||||
var $shipping_name;
|
||||
var $address_id;
|
||||
var $shippable;
|
||||
var $ship_price;
|
||||
var $ship_currency;
|
||||
|
||||
var $tax_currency;
|
||||
var $tax_amount;
|
||||
|
||||
var $coupon_arr = array();
|
||||
var $giftcert_arr = array();
|
||||
|
||||
function GoogleResult($address_id) {
|
||||
$this->address_id = $address_id;
|
||||
}
|
||||
|
||||
function SetShippingDetails($name, $price, $money = "USD",
|
||||
$shippable = "true") {
|
||||
global $config;
|
||||
$this->shipping_name = $name;
|
||||
$this->ship_price = $price;
|
||||
$this->ship_currency = $config['defaultCurrency'];
|
||||
$this->shippable = $shippable;
|
||||
|
||||
|
||||
}
|
||||
|
||||
function SetTaxDetails($amount, $currency = "USD") {
|
||||
global $config;
|
||||
$this->tax_amount = $amount;
|
||||
$this->tax_currency = $config['defaultCurrency'];
|
||||
}
|
||||
|
||||
function AddCoupons($coupon) {
|
||||
$this->coupon_arr[] = $coupon;
|
||||
}
|
||||
|
||||
function AddGiftCertificates($gift) {
|
||||
$this->giftcert_arr[] = $gift;
|
||||
}
|
||||
}
|
||||
|
||||
/* This is a class used to return the results of coupons
|
||||
* that the buyer entered code for on the place order page
|
||||
*/
|
||||
class GoogleCoupons {
|
||||
var $coupon_valid;
|
||||
var $coupon_code;
|
||||
var $coupon_currency;
|
||||
var $coupon_amount;
|
||||
var $coupon_message;
|
||||
|
||||
function googlecoupons($valid, $code, $amount, $currency, $message) {
|
||||
$this->coupon_valid = $valid;
|
||||
$this->coupon_code = $code;
|
||||
$this->coupon_currency = $currency;
|
||||
$this->coupon_amount = $amount;
|
||||
$this->coupon_message = $message;
|
||||
}
|
||||
}
|
||||
|
||||
/* This is a class used to return the results of gift certificates
|
||||
* that the buyer entered code for on the place order page
|
||||
*/
|
||||
class GoogleGiftcerts {
|
||||
var $gift_valid;
|
||||
var $gift_code;
|
||||
var $gift_currency;
|
||||
var $gift_amount;
|
||||
var $gift_message;
|
||||
|
||||
function googlegiftcerts($valid, $code, $amount, $currency, $message) {
|
||||
$this->gift_valid = $valid;
|
||||
$this->gift_code = $code;
|
||||
$this->gift_currency = $currency;
|
||||
$this->gift_amount = $amount;
|
||||
$this->gift_message = $message;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2006 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* This class is used to add the shipping options for the cart
|
||||
* There are 3 types of shipping supported
|
||||
* 1. Flat (Type:flat-rate)
|
||||
* 2. Pickup (Type:pickup)
|
||||
* 3. Merchant calculated (Type:merchant-calculated)
|
||||
*
|
||||
* Invoke a separate instance of this class for each type of shipping
|
||||
* to be included
|
||||
* Required fields are shipping name, shipping type and price
|
||||
* Allowed and excluded country areas can be specified as part of constructor
|
||||
* arguments or using individual Set methods. Possible values here are
|
||||
* 1. CONTINENTAL_48
|
||||
* 2. FULL_50_STATES
|
||||
* 3. ALL
|
||||
* State and zip patterns must be exclusively updated using their individual Set methods
|
||||
*/
|
||||
class GoogleShipping {
|
||||
|
||||
var $type;
|
||||
var $price;
|
||||
var $currency;
|
||||
var $name;
|
||||
|
||||
var $allowed_state_areas_arr;
|
||||
var $allowed_zip_patterns_arr;
|
||||
var $excluded_state_areas_arr;
|
||||
var $excluded_zip_patterns_arr;
|
||||
var $allowed_country_area;
|
||||
var $excluded_country_area;
|
||||
var $allowed_restrictions = false;
|
||||
var $excluded_restrictions = false;
|
||||
|
||||
function GoogleShipping($name, $type, $price, $money = "USD",
|
||||
$allowed_country_area="",
|
||||
$excluded_country_area="") {
|
||||
|
||||
global $config;
|
||||
|
||||
$this->price = $price;
|
||||
$this->name = $name;
|
||||
$this->type= strtolower($type);
|
||||
$this->currency = $config['defaultCurrency'];
|
||||
|
||||
if($allowed_country_area != "")
|
||||
$this->SetAllowedCountryArea($allowed_country_area);
|
||||
|
||||
if($excluded_country_area != "")
|
||||
$this->SetExcludedCountryArea($excluded_country_area);
|
||||
|
||||
$this->allowed_state_areas_arr = array();
|
||||
$this->allowed_zip_patterns_arr = array();
|
||||
$this->excluded_state_areas_arr = array();
|
||||
$this->excluded_zip_patterns_arr = array();
|
||||
}
|
||||
|
||||
function SetAllowedStateAreas($areas) {
|
||||
$this->allowed_restrictions = true;
|
||||
$this->allowed_state_areas_arr = $areas;
|
||||
}
|
||||
|
||||
function SetAllowedZipPattens($zips) {
|
||||
$this->allowed_restrictions = true;
|
||||
$this->allowed_zip_patterns_arr = $zips;
|
||||
}
|
||||
|
||||
function SetExcludedStateAreas($areas) {
|
||||
$this->excluded_restrictions = true;
|
||||
$this->excluded_state_areas_arr = $areas;
|
||||
}
|
||||
|
||||
function SetExcludedZipPatternsStateAreas($zips) {
|
||||
$this->excluded_restrictions = true;
|
||||
$this->excluded_zip_patterns_arr = $zips;
|
||||
}
|
||||
|
||||
function SetAllowedCountryArea($country_area) {
|
||||
if($country_area == "CONTINENTAL_48" ||
|
||||
$country_area == "FULL_50_STATES" ||
|
||||
$country_area = "ALL" ) {
|
||||
$this->allowed_country_area = $country_area;
|
||||
$this->allowed_restrictions = true;
|
||||
}
|
||||
else
|
||||
$this->allowed_country_area = "";
|
||||
}
|
||||
function SetExcludedCountryArea($country_area) {
|
||||
if($country_area == "CONTINENTAL_48" ||
|
||||
$country_area == "FULL_50_STATES" ||
|
||||
$country_area = "ALL" ) {
|
||||
$this->excluded_country_area = $country_area;
|
||||
$this->excluded_restrictions = true;
|
||||
}
|
||||
else
|
||||
$this->excluded_country_area = "";
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2006 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/* This class is used to create Tax rules to be added to the tax tables
|
||||
* in the shopping cart
|
||||
* Ther are two types of tax rules
|
||||
* 1. default (should be added to a default tax table)
|
||||
* 2. alternate (should be added to an alternate tax table)
|
||||
*
|
||||
* Invoke a separate instance of this class for each tax rule to be
|
||||
* added to the cart
|
||||
* Required fields are the rule type and the tax rate
|
||||
* Country area can be specified as part of constructor arguments or
|
||||
* using individual Set methods. Possible values here are
|
||||
* 1. CONTINENTAL_48
|
||||
* 2. FULL_50_STATES
|
||||
* 3. ALL
|
||||
* State and zip patterns must be exclusively updated using their
|
||||
* individual Set methods
|
||||
*/
|
||||
class GoogleTaxRule {
|
||||
|
||||
var $shipping_taxed;
|
||||
var $tax_rule_type;
|
||||
var $tax_rate;
|
||||
|
||||
var $state_areas_arr;
|
||||
var $zip_patterns_arr;
|
||||
var $country_area;
|
||||
|
||||
function GoogleTaxRule($type, $tax_rate, $country_area="",
|
||||
$shipping_taxed="false") {
|
||||
$this->rax_rule_type = strtolower($type);
|
||||
$this->shipping_taxed= $shipping_taxed;
|
||||
$this->tax_rate = $tax_rate;
|
||||
|
||||
if($country_area != "")
|
||||
$this->SetCountryArea($country_area);
|
||||
|
||||
$this->state_areas_arr = array();
|
||||
$this->zip_patterns_arr = array();
|
||||
}
|
||||
|
||||
function SetStateAreas($areas) {
|
||||
if(is_array($areas))
|
||||
$this->state_areas_arr = $areas;
|
||||
else
|
||||
$this->state_areas_arr = array($areas);
|
||||
}
|
||||
|
||||
function SetZipPatterns($zips) {
|
||||
if(is_array($zips))
|
||||
$this->zip_patterns_arr = $zips;
|
||||
else
|
||||
$this->zip_patterns_arr = array($zips);
|
||||
|
||||
}
|
||||
|
||||
function SetCountryArea($country_area) {
|
||||
if($country_area == "CONTINENTAL_48" || $country_area == "FULL_50_STATES"
|
||||
|| $country_area = "ALL" )
|
||||
$this->country_area = $country_area;
|
||||
else
|
||||
$this->country_area = "";
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2006 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* This class is used to add tax tables to the shopping cart
|
||||
* There are two types of tax tables
|
||||
* 1. default (there can be only a single default tax table)
|
||||
* 2. alternate
|
||||
*
|
||||
* Invoke a separate instance of this class for each tax table required
|
||||
* Required field is the type
|
||||
* Multiple default/alternate tax rules can be added using the AddTaxRulesMethod
|
||||
*/
|
||||
|
||||
class GoogleTaxTable {
|
||||
|
||||
var $type;
|
||||
var $name;
|
||||
var $tax_rules_arr;
|
||||
var $standalone;
|
||||
|
||||
function GoogleTaxTable($type, $name = "", $standalone = "false") {
|
||||
if(($type == "default") || ($type == "alternate" && $name != "")) {
|
||||
$this->name = $name;
|
||||
$this->type= strtolower($type);
|
||||
$this->tax_rules_arr = array();
|
||||
$this->standalone = $standalone;
|
||||
}
|
||||
}
|
||||
|
||||
function AddTaxRules($rules) {
|
||||
$this->tax_rules_arr[] = $rules;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
/*
|
||||
Copyright (C) 2006 Google Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Class used to generate XML data
|
||||
* Based on sample code available at http://simon.incutio.com/code/php/XmlWriter.class.php.txt
|
||||
*/
|
||||
|
||||
class XmlBuilder {
|
||||
var $xml;
|
||||
var $indent;
|
||||
var $stack = array();
|
||||
|
||||
function XmlBuilder($indent = ' ') {
|
||||
$this->indent = $indent;
|
||||
$this->xml = '<?xml version="1.0" encoding="utf-8"?>'."\n";
|
||||
}
|
||||
|
||||
function _indent() {
|
||||
for ($i = 0, $j = count($this->stack); $i < $j; $i++) {
|
||||
$this->xml .= $this->indent;
|
||||
}
|
||||
}
|
||||
|
||||
//Used when an element has sub-elements
|
||||
// This function adds an open tag to the output
|
||||
function Push($element, $attributes = array()) {
|
||||
$this->_indent();
|
||||
$this->xml .= '<'.$element;
|
||||
foreach ($attributes as $key => $value) {
|
||||
$this->xml .= ' '.$key.'="'.htmlentities($value).'"';
|
||||
}
|
||||
$this->xml .= ">\n";
|
||||
$this->stack[] = $element;
|
||||
}
|
||||
|
||||
//Used when an element has no subelements.
|
||||
//Data within the open and close tags are provided with the
|
||||
//contents variable
|
||||
function Element($element, $content, $attributes = array()) {
|
||||
$this->_indent();
|
||||
$this->xml .= '<'.$element;
|
||||
foreach ($attributes as $key => $value) {
|
||||
$this->xml .= ' '.$key.'="'.htmlentities($value).'"';
|
||||
}
|
||||
$this->xml .= '>'.htmlentities($content).'</'.$element.'>'."\n";
|
||||
}
|
||||
|
||||
function EmptyElement($element, $attributes = array()) {
|
||||
$this->_indent();
|
||||
$this->xml .= '<'.$element;
|
||||
foreach ($attributes as $key => $value) {
|
||||
$this->xml .= ' '.$key.'="'.htmlentities($value).'"';
|
||||
}
|
||||
$this->xml .= " />\n";
|
||||
}
|
||||
|
||||
//Used to close an open tag
|
||||
function Pop($pop_element) {
|
||||
$element = array_pop($this->stack);
|
||||
$this->_indent();
|
||||
if($element !== $pop_element)
|
||||
die('XML Error: Tag Mismatch when trying to close "'. $pop_element. '"');
|
||||
else
|
||||
$this->xml .= "</$element>\n";
|
||||
}
|
||||
|
||||
function GetXML() {
|
||||
if(count($this->stack) != 0)
|
||||
die ('XML Error: No matching closing tag found for " '. array_pop($this->stack). '"');
|
||||
else
|
||||
return $this->xml;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,163 @@
|
||||
<?php
|
||||
/*
|
||||
Copyright (C) 2006 Google Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/* This uses SAX parser to convert XML data into PHP associative arrays
|
||||
* When invoking the constructor with the input data, strip out the first XML line
|
||||
*
|
||||
* Member field Description:
|
||||
* $params: This stores the XML data. The attributes and contents of XML tags
|
||||
* can be accessed as follows
|
||||
*
|
||||
* <addresses>
|
||||
* <anonymous-address id="123"> <test>data 1 </test>
|
||||
* </anonymous-address>
|
||||
* <anonymous-address id="456"> <test>data 2 </test>
|
||||
* </anonymous-address>
|
||||
* </addresses>
|
||||
*
|
||||
* print_r($this->params) will return
|
||||
Array
|
||||
(
|
||||
[addresses] => Array
|
||||
(
|
||||
[anonymous-address] => Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[id] => 123
|
||||
[test] => Array
|
||||
(
|
||||
[VALUE] => data 1
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
[1] => Array
|
||||
(
|
||||
[id] => 456
|
||||
[test] => Array
|
||||
(
|
||||
[VALUE] => data 2
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
)
|
||||
* XmlParser returns an empty params array if it encounters
|
||||
* any error during parsing
|
||||
*/
|
||||
class XmlParser {
|
||||
|
||||
var $params= array(); //Stores the object representation of XML data
|
||||
var $root;
|
||||
var $global_index = -1;
|
||||
|
||||
/* Constructor for the class
|
||||
* Takes in XML data as input( do not include the <xml> tag
|
||||
*/
|
||||
function XmlParser($input) {
|
||||
$xmlp = xml_parser_create();
|
||||
xml_parse_into_struct($xmlp, $input, $vals, $index);
|
||||
xml_parser_free($xmlp);
|
||||
$this->root = strtolower($vals[0]['tag']);
|
||||
$this->params = $this->UpdateRecursive($vals);
|
||||
}
|
||||
|
||||
/* Returns true if a given variable represents an associative array */
|
||||
function is_associative_array( $var ) {
|
||||
return is_array( $var ) && !is_numeric( implode( '', array_keys( $var ) ) );
|
||||
}
|
||||
|
||||
/* Converts the output of SAX parser into a PHP associative array similar to the
|
||||
* DOM parser output
|
||||
*/
|
||||
function UpdateRecursive($vals) {
|
||||
$this->global_index++;
|
||||
//Reached end of array
|
||||
if($this->global_index >= count($vals))
|
||||
return;
|
||||
|
||||
$tag = strtolower($vals[$this->global_index]['tag']);
|
||||
$value = trim($vals[$this->global_index]['value']);
|
||||
$type = $vals[$this->global_index]['type'];
|
||||
|
||||
//Add attributes
|
||||
if(isset($vals[$this->global_index]['attributes'])) {
|
||||
foreach($vals[$this->global_index]['attributes'] as $key=>$val) {
|
||||
$key = strtolower($key);
|
||||
$params[$tag][$key] = $val;
|
||||
}
|
||||
}
|
||||
|
||||
if($type == 'open') {
|
||||
$new_arr = array();
|
||||
|
||||
//Read all elements at the next levels and add to an array
|
||||
while($vals[$this->global_index]['type'] != 'close' &&
|
||||
$this->global_index < count($vals)) {
|
||||
$arr = $this->UpdateRecursive($vals);
|
||||
if(count($arr) > 0) {
|
||||
$new_arr[] = $arr;
|
||||
}
|
||||
}
|
||||
$this->global_index++;
|
||||
foreach($new_arr as $arr) {
|
||||
foreach($arr as $key=>$val) {
|
||||
if(isset($params[$tag][$key])) {
|
||||
//If this key already exists
|
||||
if($this->is_associative_array($params[$tag][$key])) {
|
||||
//If this is an associative array and not an indexed array
|
||||
// remove exisiting value and convert to an indexed array
|
||||
$val_key = $params[$tag][$key];
|
||||
array_splice($params[$tag][$key], 0);
|
||||
$params[$tag][$key][0] = $val_key;
|
||||
$params[$tag][$key][] = $val;
|
||||
} else {
|
||||
$params[$tag][$key][] = $val;
|
||||
}
|
||||
} else {
|
||||
$params[$tag][$key] = $val;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ($type == 'complete') {
|
||||
if($value != '')
|
||||
$params[$tag]['VALUE'] = $value;
|
||||
}
|
||||
else
|
||||
$params = array();
|
||||
return $params;
|
||||
}
|
||||
|
||||
/* Returns the root of the XML data */
|
||||
function GetRoot() {
|
||||
return $this->root;
|
||||
}
|
||||
|
||||
/* Returns the array representing the XML data */
|
||||
function GetData() {
|
||||
return $this->params;
|
||||
}
|
||||
}
|
||||
?>
|
||||
234
production/modules/altCheckout/PayPal_Pro/admin/index.inc.php
Normal file
@@ -0,0 +1,234 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| CubeCart 4
|
||||
| ========================================
|
||||
| CubeCart is a registered trade mark of Devellion Limited
|
||||
| Copyright Devellion Limited 2006. All rights reserved.
|
||||
| Devellion Limited,
|
||||
| 5 Bridge Street,
|
||||
| Bishops Stortford,
|
||||
| HERTFORDSHIRE.
|
||||
| CM23 2JU
|
||||
| UNITED KINGDOM
|
||||
| http://www.devellion.com
|
||||
| UK Private Limited Company No. 5323904
|
||||
| ========================================
|
||||
| Web: http://www.cubecart.com
|
||||
| Email: info (at) cubecart (dot) com
|
||||
| License Type: CubeCart is NOT Open Source Software and Limitations Apply
|
||||
| Licence Info: http://www.cubecart.com/site/faq/license.php
|
||||
+--------------------------------------------------------------------------
|
||||
| index.inc.php
|
||||
| ========================================
|
||||
| Configure PayPal Express Checkout
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
if(!defined('CC_INI_SET')){ die("Access Denied"); }
|
||||
|
||||
permission("settings","read",$halt=TRUE);
|
||||
|
||||
|
||||
|
||||
if(isset($_POST['module'])){
|
||||
require CC_ROOT_DIR.CC_DS.'modules'.CC_DS.'status.inc.php';
|
||||
$cache = new cache("config.".$moduleName);
|
||||
$cache->clearCache();
|
||||
//$module = fetchDbConfig($moduleName); // Uncomment this is you wish to merge old config with new
|
||||
$module = array(); // Comment this out if you don't want the old config to merge with new
|
||||
$msg = writeDbConf($_POST['module'], $moduleName, $module);
|
||||
|
||||
}
|
||||
$module = fetchDbConfig($moduleName);
|
||||
|
||||
$thisPage = currentPage(array("mode"=> 0));
|
||||
|
||||
if(!isset($_GET['mode']) && isset($module['mode']) && !empty($module['mode'])) {
|
||||
httpredir($thisPage."&mode=".$module['mode']);
|
||||
}
|
||||
require($glob['adminFolder'].CC_DS."includes".CC_DS."header.inc.php");
|
||||
?>
|
||||
<p><a href="http://www.paypal.com/"><img src="https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif" alt="" border="0" title="" /></a></p>
|
||||
<?php
|
||||
if(isset($msg)){
|
||||
echo msg($msg);
|
||||
}
|
||||
?>
|
||||
<p class="copyText">"Get our most comprehensive solution to process credit cards directly on your site and also accept PayPal and bank account payments with Website Payments Pro."</p>
|
||||
|
||||
<p>Please choose your module mode: <select name="itdoesntneedonesoicalleditthis" onchange="jumpMenu('parent',this,0)">
|
||||
<?php if(!isset($_GET['mode'])) { ?><option value="<?php echo $thisPage; ?>" <?php if(!isset($_GET['mode'])) echo "selected='selected'"; ?>>-- Select --</option><?php } ?>
|
||||
<option value="<?php echo $thisPage; ?>&mode=US" <?php if($_GET['mode']=="US") echo "selected='selected'"; ?>>Website Payments Pro (US)</option>
|
||||
<option value="<?php echo $thisPage; ?>&mode=UK" <?php if($_GET['mode']=="UK") echo "selected='selected'"; ?>>Website Payments Pro (UK)</option>
|
||||
</select></p>
|
||||
|
||||
<?php if(isset($_GET['mode']) && !empty($_GET['mode'])) { ?>
|
||||
|
||||
<form action="<?php echo $glob['adminFile']; ?>?_g=<?php echo $_GET['_g']; ?>&module=<?php echo $_GET['module']; ?>&mode=<?php echo $_GET['mode']; ?>" method="post" enctype="multipart/form-data">
|
||||
<table border="0" cellspacing="1" cellpadding="3" class="mainTable">
|
||||
<tr>
|
||||
<td colspan="2" class="tdTitle">Configuration Settings </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="33%" align="left" class="tdText"><strong>PayPal Pro Mode:</strong></td>
|
||||
<td class="tdText">
|
||||
<?php
|
||||
echo "Website Payments Pro (".$_GET['mode'].")";
|
||||
?>
|
||||
<input type="hidden" name="module[mode]" value="<?php echo $_GET['mode'];?>" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="33%" align="left" class="tdText"><strong>Status:</strong></td>
|
||||
<td class="tdText">
|
||||
<select name="module[status]">
|
||||
<option value="1" <?php if($module['status']==1) echo "selected='selected'"; ?>>Enabled</option>
|
||||
<option value="0" <?php if($module['status']==0) echo "selected='selected'"; ?>>Disabled</option>
|
||||
</select> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="33%" align="left" class="tdText"><strong>Currency:</strong></td>
|
||||
<td class="tdText"><?php echo $config['defaultCurrency']; ?> (This can be edited under general settings)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="33%" align="left" class="tdText"><strong>Enable Card Validation:</strong></td>
|
||||
<td class="tdText"><select name="module[validation]">
|
||||
<option value="1" <?php if($module['validation']==1) echo "selected='selected'"; ?>>Enabled</option>
|
||||
<option value="0" <?php if($module['validation']==0) echo "selected='selected'"; ?>>Disabled</option>
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="33%" align="left" class="tdText"><strong>Gateway Server:</strong></td>
|
||||
<td class="tdText">
|
||||
<select name="module[gateway]">
|
||||
<option value="1" <?php if($module['gateway'] == 1) echo "selected='selected'"; ?>>Live</option>
|
||||
<option value="0" <?php if($module['gateway'] == 0) echo "selected='selected'"; ?>>Sandbox</option>
|
||||
</select> </td>
|
||||
</tr>
|
||||
<?php
|
||||
if($_GET['mode']=="US") {
|
||||
?>
|
||||
<tr>
|
||||
<td width="33%" align="left" class="tdText"><strong> API Username:</strong></td>
|
||||
<td class="tdText"><input type="text" name="module[username]" value="<?php echo $module['username']; ?>" class="textbox" size="30" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="33%" align="left" class="tdText"><strong>API Password:</strong></td>
|
||||
<td class="tdText"><input type="text" name="module[password]" value="<?php echo $module['password']; ?>" class="textbox" size="30" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="33%" align="left" class="tdText"><strong>API Signature:</strong></td>
|
||||
<td class="tdText">
|
||||
<input type="text" name="module[signature]" value="<?php echo $module['signature']; ?>" class="textbox" size="65" /> </td>
|
||||
</tr>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<tr>
|
||||
<td width="33%" align="left" class="tdText"><strong>Username:</strong><br />
|
||||
If you set up one or more additional users on the account,
|
||||
this value is the ID of the user authorised to process
|
||||
transactions. If, however, you have not setup additional
|
||||
users on the account, username should be the same value as
|
||||
vendor.</td>
|
||||
<td class="tdText"><input type="text" name="module[user]" value="<?php echo $module['user']; ?>" class="textbox" size="45" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="33%" align="left" class="tdText"><strong>Password:</strong><br />
|
||||
The 6 to 32-character password that you defined while
|
||||
registering for the account.</td>
|
||||
<td class="tdText"><input type="text" name="module[pass]" value="<?php echo $module['pass']; ?>" class="textbox" size="45" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="33%" align="left" class="tdText"><strong>Merchant ID:</strong><br />
|
||||
Your merchant login ID that you created when you
|
||||
registered for the Website Payments Pro account.
|
||||
|
||||
</td>
|
||||
<td class="tdText">
|
||||
<input type="text" name="module[vendor]" value="<?php echo $module['vendor']; ?>" class="textbox" size="45" /> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="33%" align="left" class="tdText"><strong>Partner:</strong><br />
|
||||
The ID provided to you by the authorised PayPal Reseller
|
||||
who registered. If you
|
||||
purchased your account directly from PayPal, use
|
||||
PayPalUK.</td>
|
||||
<td class="tdText">
|
||||
<input type="text" name="module[partner]" value="<?php echo $module['partner']; ?>" class="textbox" size="45" /> </td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td width="33%" align="left" valign="top" class="tdText"><strong>Require PayPal confirmed address:</strong><br />
|
||||
(Express Checkout Only)</td>
|
||||
<td class="tdText"><select name="module[confAddress]">
|
||||
<option value="0" <?php if($module['confAddress'] == 0) echo "selected='selected'"; ?>>No</option>
|
||||
<option value="1" <?php if($module['confAddress'] == 1) echo "selected='selected'"; ?>>Yes</option>
|
||||
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="33%" align="left" valign="top" class="tdText"><strong>Send Welcome Email:</strong><br />
|
||||
(Contains user/password for future access)</td>
|
||||
<td class="tdText"><select name="module[welcomeEmail]">
|
||||
<option value="0" <?php if($module['welcomeEmail'] == 0) echo "selected='selected'"; ?>>No</option>
|
||||
<option value="1" <?php if($module['welcomeEmail'] == 1) echo "selected='selected'"; ?>>Yes</option>
|
||||
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="33%" align="left" valign="top" class="tdText"><strong>Payment Acton:</strong></td>
|
||||
<td class="tdText">
|
||||
<select name="module[paymentAction]">
|
||||
<option value="Sale" <?php if($module['paymentAction'] == "Sale") echo "selected='selected'"; ?>>Sale</option>
|
||||
<option value="Authorization" <?php if($module['paymentAction'] == "Authorization") echo "selected='selected'"; ?>>Authorization</option>
|
||||
<?php
|
||||
if($_GET['mode']=="US") {
|
||||
?>
|
||||
<option value="Order" <?php if($module['paymentAction'] == "Order") echo "selected='selected'"; ?>>Order (Express Checkout Only*)</option>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<br />
|
||||
- Sale indicates that this is a final sale for which you are requesting payment.<br />
|
||||
- Authorization <?php if($_GET['mode']=="US") { ?>or Order<?php } ?> indicates that this payment is subject to settlement with PayPal Authorization & Capture.
|
||||
<?php if($_GET['mode']=="US") { ?><p>* If this is selected and a credit card payment is made it will force "Authorization" instead.</p><?php } ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="33%" align="left" class="tdText"><strong>Debug:</strong></td>
|
||||
<td class="tdText">
|
||||
<select name="module[debug]">
|
||||
<option value="1" <?php if($module['debug'] == 1) echo "selected='selected'"; ?>>Yes</option>
|
||||
<option value="0" <?php if($module['debug'] == 0) echo "selected='selected'"; ?>>No</option>
|
||||
</select> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="33%" align="right" class="tdText"> </td>
|
||||
<td class="tdText"><input type="submit" class="submit" value="Edit Config" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
if($module['mode']=="US") { ?>
|
||||
<p class="pageTitle">How to add PayPal Merchant Referral Banner</p>
|
||||
The Merchant Referral Bonus Program rewards you for bringing new businesses to PayPal.<br /><br />
|
||||
1. Login to your PayPal account at <a href="http://www.paypal.com" target="_blank" class="txtLink">http://www.paypal.com</a><br />
|
||||
2. Click on the "Referrals" link.<br />
|
||||
3. You can then see HTML code which can be cut and paste into the stores HTML template files.<br />
|
||||
<br />
|
||||
The HTML template files can be found and edited using an <a href="http://en.wikipedia.org/wiki/FTP_Client" target="_blank" class="txtLink">FTP</a> Client to access the website files:<br />
|
||||
<br />
|
||||
<span style="font-family:'Courier New', Courier, monospace;">/skins/<?php echo $config['skinDir'];?>/styleTemplates/global/index.tpl</span>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</li>
|
||||
</ol>
|
||||
BIN
production/modules/altCheckout/PayPal_Pro/admin/logo.gif
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
66
production/modules/altCheckout/PayPal_Pro/button.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| CubeCart 4
|
||||
| ========================================
|
||||
| CubeCart is a registered trade mark of Devellion Limited
|
||||
| Copyright Devellion Limited 2006. All rights reserved.
|
||||
| Devellion Limited,
|
||||
| 5 Bridge Street,
|
||||
| Bishops Stortford,
|
||||
| HERTFORDSHIRE.
|
||||
| CM23 2JU
|
||||
| UNITED KINGDOM
|
||||
| http://www.devellion.com
|
||||
| UK Private Limited Company No. 5323904
|
||||
| ========================================
|
||||
| Web: http://www.cubecart.com
|
||||
| Email: info (at) cubecart (dot) com
|
||||
| License Type: CubeCart is NOT Open Source Software and Limitations Apply
|
||||
| Licence Info: http://www.cubecart.com/site/faq/license.php
|
||||
+--------------------------------------------------------------------------
|
||||
| button.inc.php
|
||||
| ========================================
|
||||
| Button PayPal EC
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
class PayPal_Pro {
|
||||
|
||||
function buildIt($moduleName="", $urlOnly = false) {
|
||||
|
||||
global $subTotal,$config,$orderSum;
|
||||
|
||||
switch(strtolower(LANG_FOLDER)) {
|
||||
case "es":
|
||||
$locale = "es_ES";
|
||||
break;
|
||||
case "fr":
|
||||
$locale = "fr_FR";
|
||||
break;
|
||||
case "nl":
|
||||
$locale = "nl_NL";
|
||||
break;
|
||||
case "de":
|
||||
$locale = "de_DE";
|
||||
break;
|
||||
case "it":
|
||||
$locale = "it_IT";
|
||||
break;
|
||||
default:
|
||||
$locale = "en_US";
|
||||
break;
|
||||
}
|
||||
|
||||
if($urlOnly==true) {
|
||||
$link = "index.php?_g=rm&type=altCheckout&cmd=process&module=PayPal_Pro&ccb=".base64_encode($orderSum['prod_total'].",".$config['defaultCurrency']);
|
||||
} else {
|
||||
|
||||
$link = "<a href='index.php?_g=rm&type=altCheckout&cmd=process&module=PayPal_Pro&ccb=".base64_encode($subTotal.",".$config['defaultCurrency'])."' target='_self' /><img src='https://www.paypal.com/".$locale."/i/btn/btn_xpressCheckout.gif' border='0' title='' alt='' /></a>";
|
||||
|
||||
}
|
||||
|
||||
return $link;
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
421
production/modules/altCheckout/PayPal_Pro/form.inc.php
Normal file
@@ -0,0 +1,421 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| CubeCart 4
|
||||
| ========================================
|
||||
| CubeCart is a Trade Mark of Devellion Limited
|
||||
| Copyright Devellion Limited 2005 - 2006. All rights reserved.
|
||||
| Devellion Limited,
|
||||
| 5 Bridge Street,
|
||||
| Bishops Stortford,
|
||||
| HERTFORDSHIRE.
|
||||
| CM23 2JU
|
||||
| UNITED KINGDOM
|
||||
| http://www.devellion.com
|
||||
| UK Private Limited Company No. 5323904
|
||||
| ========================================
|
||||
| Web: http://www.cubecart.com
|
||||
| Date: Tuesday, 17th October 2006
|
||||
| Email: sales (at) cubecart (dot) com
|
||||
| License Type: CubeCart is NOT Open Source Software and Limitations Apply
|
||||
| Licence Info: http://www.cubecart.com/site/faq/license.php
|
||||
+--------------------------------------------------------------------------
|
||||
| form.inc.php
|
||||
| ========================================
|
||||
| PayPal Direct Payment Gateway
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
//if(detectSSL() == FALSE) die ("<strong>Critical Error:</strong> This page can ONLY be viewed under SSL!");
|
||||
|
||||
// Get Direct Payment module vars
|
||||
$module = fetchDbConfig("PayPal_Pro");
|
||||
|
||||
if($_GET['process']==1){
|
||||
|
||||
$gatewayName = "PayPal Website Payments Pro (".$module['paymentAction'].")";
|
||||
|
||||
$transData['customer_id'] = $orderSum["customer_id"];
|
||||
$transData['order_id'] = $orderSum['cart_order_id'];
|
||||
$transData['amount'] = $orderSum['prod_total'];
|
||||
$transData['gateway'] = $gatewayName;
|
||||
$transData['extra'] = "C";
|
||||
|
||||
require("classes".CC_DS."validate".CC_DS."validateCard.php");
|
||||
|
||||
$card = new validateCard();
|
||||
|
||||
if($module['mode']=="US") {
|
||||
|
||||
$cardNo = trim($_POST['cardNumber']);
|
||||
$issueNo = trim($_POST['issueNo']);
|
||||
$issueDate = false;
|
||||
$issueFormat = false;
|
||||
$expireDate = trim($_POST["expirationYear"]).str_pad(trim($_POST["expirationMonth"]), 2, '0', STR_PAD_LEFT);
|
||||
$expireFormat = 6;
|
||||
$scReqd = TRUE;
|
||||
$securityCode = trim($_POST["cvc2"]);
|
||||
|
||||
} else {
|
||||
|
||||
$cardNo = trim($_POST['cardNumber']);
|
||||
$issueNo = trim($_POST['issueNo']);
|
||||
$issueDate = trim($_POST["issueYear"]).str_pad(trim($_POST["issueMonth"]), 2, '0', STR_PAD_LEFT);
|
||||
$issueFormat = 6;
|
||||
$expireDate = trim($_POST["expirationYear"]).str_pad(trim($_POST["expirationMonth"]), 2, '0', STR_PAD_LEFT);
|
||||
$expireFormat = 6;
|
||||
$scReqd = TRUE;
|
||||
$securityCode = trim($_POST["cvc2"]);
|
||||
|
||||
}
|
||||
|
||||
$card = $card->check($cardNo, $issueNo, $issueDate, $issueFormat, $expireDate, $expireFormat, $scReqd, $securityCode);
|
||||
|
||||
if($module['validation']==1 && $card['response']=="FAIL"){
|
||||
|
||||
$errorMsg['customer'] = "";
|
||||
|
||||
foreach($card['error'] as $val){
|
||||
|
||||
$errorMsg['customer'] .= $val."<br />";
|
||||
|
||||
}
|
||||
|
||||
$transData['trans_id'] = "";
|
||||
$transData['status'] = "Fail";
|
||||
$transData['notes'] = $errorMsg['customer'];
|
||||
|
||||
} else {
|
||||
|
||||
$extraNotes = "";
|
||||
|
||||
include("modules".CC_DS."altCheckout".CC_DS."PayPal_Pro".CC_DS."wpp-".$module['mode'].CC_DS."DoDirectPaymentReceipt.php");
|
||||
|
||||
if($ack=="SUCCESS") {
|
||||
|
||||
// Sale = Funds taken immediately otherwise they may be taken later
|
||||
$paymentResult = ($module['paymentAction'] == "Sale") ? 3 : 2; // 3 is payment complete, 2 is processing
|
||||
$confirmationScreen = ($module['paymentAction'] == "Sale") ? 2 : 3; // Just to confuse matter Al you plonker!! 2 = money taken 3 = money not yet taken (Athorized)
|
||||
$order->orderStatus($paymentResult,$orderSum['cart_order_id']);
|
||||
$jumpTo = "index.php?_g=co&_a=confirmed&s=".$confirmationScreen;
|
||||
|
||||
$transData['trans_id'] = $resArray['TRANSACTIONID'];
|
||||
$transData['status'] = "SUCCESS";
|
||||
$transData['notes'] = "Successful transaction via Credit Card. ".$extraNotes;
|
||||
|
||||
} else {
|
||||
$transData['trans_id'] = "";
|
||||
$transData['status'] = "FAIL";
|
||||
$transData['notes'] = "<strong>Error displayed to customer:</strong> ".$errorMsg['customer']."<br /><strong>Error:</strong> ".$errorMsg['admin']."<br /><strong>PayPal Response:</strong> ".$errorMsg['paypal'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$order->storeTrans($transData);
|
||||
|
||||
if(isset($jumpTo) && !empty($jumpTo)) {
|
||||
|
||||
httpredir($jumpTo);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
$formTemplate = new XTemplate ("modules".CC_DS."altCheckout".CC_DS."PayPal_Pro".CC_DS."form.tpl",'',null,'main',true,$skipPath=TRUE);
|
||||
|
||||
if(isset($errorMsg)) {
|
||||
|
||||
$formTemplate->assign("LANG_ERROR",$errorMsg['customer']);
|
||||
$formTemplate->parse("form.error");
|
||||
|
||||
}
|
||||
|
||||
$formTemplate->assign("VAL_AMOUNT_DUE",sprintf($lang['gateway']['amount_due'],priceformat($orderSum['prod_total'],true)));
|
||||
|
||||
$formTemplate->assign("VAL_FIRST_NAME",$cc_session->ccUserData['firstName']);
|
||||
$formTemplate->assign("VAL_LAST_NAME",$cc_session->ccUserData['lastName']);
|
||||
$formTemplate->assign("VAL_EMAIL_ADDRESS",$orderSum['email']);
|
||||
$formTemplate->assign("VAL_ADD_1",$orderSum['add_1']);
|
||||
$formTemplate->assign("VAL_ADD_2",$orderSum['add_2']);
|
||||
$formTemplate->assign("VAL_CITY",$orderSum['town']);
|
||||
|
||||
$siteCountryIso = getCountryFormat($config['siteCountry'],"id","iso");
|
||||
|
||||
if($siteCountryIso=="US" || $siteCountryIso=="CA") {
|
||||
|
||||
// look up county
|
||||
$isoLookup = $db->select("SELECT abbrev FROM `".$glob['dbprefix']."CubeCart_iso_counties`
|
||||
WHERE `name` LIKE '%".ucfirst(str_replace(" ","",strtolower($orderSum['county'])))."%'");
|
||||
|
||||
$states = array (
|
||||
"Alberta" => "AB",
|
||||
"British Columbia" => "BC",
|
||||
"Manitoba" => "MB",
|
||||
"New Brunswick" => "NB",
|
||||
"Newfoundland and Labrador" => "NF",
|
||||
"Northwest Territories" => "NT",
|
||||
"Nova Scotia" => "NS",
|
||||
"Nunavut" => "NU",
|
||||
"Ontario" => "ON",
|
||||
"Prince Edward Island" => "PE",
|
||||
"Quebec" => "QC",
|
||||
"Saskatchewan" => "SK",
|
||||
"Yukon" => "YK",
|
||||
"Alabama" => "AL",
|
||||
"Alaska" => "AK",
|
||||
"American Samoa" => "AS",
|
||||
"Arizona" => "AZ",
|
||||
"Arkansas" => "AR",
|
||||
"California" => "CA",
|
||||
"Colorado" => "CO",
|
||||
"Connecticut" => "CT",
|
||||
"Delaware" => "DE",
|
||||
"District of Columbia" => "DC",
|
||||
"Federated States of Micronesia" => "FM",
|
||||
"Florida" => "FL",
|
||||
"Georgia" => "GA",
|
||||
"Guam" => "GU",
|
||||
"Hawaii" => "HI",
|
||||
"Idaho" => "ID",
|
||||
"Illinois" => "IL",
|
||||
"Indiana" => "IN",
|
||||
"Iowa" => "IA",
|
||||
"Kansas" => "KS",
|
||||
"Kentucky" => "KY",
|
||||
"Louisiana" => "LA",
|
||||
"Maine" => "ME",
|
||||
"Marshall" => "Islands MH",
|
||||
"Maryland" => "MD",
|
||||
"Massachusetts" => "MA",
|
||||
"Michigan" => "MI",
|
||||
"Minnesota" => "MN",
|
||||
"Mississippi" => "MS",
|
||||
"Missouri" => "MO",
|
||||
"Montana" => "MT",
|
||||
"Nebraska" => "NE",
|
||||
"Nevada" => "NV",
|
||||
"New Hampshire" => "NH",
|
||||
"New Jersey" => "NJ",
|
||||
"New Mexico" => "NM",
|
||||
"New York" => "NY",
|
||||
"North Carolina" => "NC",
|
||||
"North Dakota" => "ND",
|
||||
"Northern Mariana Islands" => "MP",
|
||||
"Ohio" => "OH",
|
||||
"Oklahoma" => "OK",
|
||||
"Oregon" => "OR",
|
||||
"Palau" => "PW",
|
||||
"Pennsylvania" => "PA",
|
||||
"Puerto Rico" => "PR",
|
||||
"Rhode Island" => "RI",
|
||||
"South Carolina" => "SC",
|
||||
"South Dakota" => "SD",
|
||||
"Tennessee" => "TN",
|
||||
"Texas" => "TX",
|
||||
"Utah" => "UT",
|
||||
"Vermont" => "VT",
|
||||
"Virgin Islands" => "VI",
|
||||
"Virginia" => "VA",
|
||||
"Washington" => "WA",
|
||||
"West Virginia" => "WV",
|
||||
"Wisconsin" => "WI",
|
||||
"Wyoming" => "WY",
|
||||
"Armed Forces Americas" => "A",
|
||||
"Armed Forces" => "AE",
|
||||
"Armed Forces Pacific" => "AP"
|
||||
);
|
||||
|
||||
foreach($states as $key => $value) {
|
||||
if($value == $isoLookup[0]['abbrev']) {
|
||||
$formTemplate->assign("VAL_STATE_SELECTED","selected='selected'");
|
||||
} else {
|
||||
$formTemplate->assign("VAL_STATE_SELECTED","");
|
||||
}
|
||||
|
||||
$formTemplate->assign("VAL_STATE_ABBR",$value);
|
||||
$formTemplate->assign("VAL_STATE",$key);
|
||||
$formTemplate->parse("form.states_list.states_loop");
|
||||
}
|
||||
|
||||
$formTemplate->assign("LANG_STATE",$lang['gateway']['state']);
|
||||
|
||||
$formTemplate->parse("form.states_list");
|
||||
|
||||
} else {
|
||||
$formTemplate->assign("LANG_STATE",$lang['gateway']['state']);
|
||||
$formTemplate->assign("VAL_STATE",$orderSum['county']);
|
||||
$formTemplate->parse("form.states_txtbox");
|
||||
}
|
||||
|
||||
$formTemplate->assign("VAL_POST_CODE",$orderSum['postcode']);
|
||||
$formTemplate->assign("VAL_CART_ORDER_ID",$basket['cart_order_id']);
|
||||
$formTemplate->assign("VAL_ORDER_TOTAL",$basket['grandTotal']);
|
||||
$formTemplate->assign("VAL_ITEM_TOTAL",$basket['subTotal']);
|
||||
$formTemplate->assign("VAL_TAX_TOTAL",$basket['tax']);
|
||||
$formTemplate->assign("VAL_SHIPPING_TOTAL",$basket['shipCost']);
|
||||
|
||||
|
||||
$currency = $db->select("SELECT currency FROM ".$glob['dbprefix']."CubeCart_sessions WHERE sessId = ".$db->mySQLSafe($GLOBALS[CC_SESSION_NAME]));
|
||||
|
||||
if($currency == TRUE && $currency[0]['currency'] != ''){
|
||||
$formTemplate->assign("VAL_CURRENCY_ID", $currency[0]['currency']);
|
||||
} else {
|
||||
$formTemplate->assign("VAL_CURRENCY_ID", $config['defaultCurrency']);
|
||||
}
|
||||
|
||||
if($module['mode']=="US") {
|
||||
|
||||
$cards = array(
|
||||
"Visa" => "Visa",
|
||||
"MasterCard" => "MasterCard",
|
||||
"Discover" => "Discover",
|
||||
"Amex" => "American Express"
|
||||
);
|
||||
|
||||
} else {
|
||||
|
||||
$cards = array(
|
||||
"0" => "Visa",
|
||||
"8" => "Visa Electron",
|
||||
"8" => "Delta",
|
||||
"1" => "MasterCard",
|
||||
"9" => "Maestro / Switch",
|
||||
"S" => "Solo"
|
||||
//"8" => "Other"
|
||||
);
|
||||
}
|
||||
|
||||
foreach($cards as $key => $value) {
|
||||
|
||||
$formTemplate->assign("VAL_CARD_TYPE",$key);
|
||||
|
||||
if($key == $_POST['cardType']){
|
||||
$formTemplate->assign("CARD_SELECTED","selected='selected'");
|
||||
} else {
|
||||
$formTemplate->assign("CARD_SELECTED","");
|
||||
}
|
||||
$formTemplate->assign("VAL_CARD_NAME",$value);
|
||||
|
||||
$formTemplate->parse("form.repeat_cards");
|
||||
|
||||
}
|
||||
|
||||
for($i=1;$i<=12;$i++) {
|
||||
|
||||
$val = sprintf('%02d',$i);
|
||||
|
||||
if($val == $_POST['expirationMonth']){
|
||||
$formTemplate->assign("EXPIRE_MONTHS_SELECTED","selected='selected'");
|
||||
} else {
|
||||
$formTemplate->assign("EXPIRE_MONTHS_SELECTED","");
|
||||
}
|
||||
$formTemplate->assign("VAL_EXPIRE_MONTH",$val);
|
||||
|
||||
$formTemplate->parse("form.expiration_months");
|
||||
|
||||
}
|
||||
|
||||
$thisYear = date("Y");
|
||||
$maxYear = $thisYear + 10;
|
||||
|
||||
for($i=$thisYear;$i<=$maxYear;$i++) {
|
||||
|
||||
if($i == $_POST['expirationYear']){
|
||||
$formTemplate->assign("EXPIRE_YEARS_SELECTED","selected='selected'");
|
||||
} else {
|
||||
$formTemplate->assign("EXPIRE_YEARS_SELECTED","");
|
||||
}
|
||||
$formTemplate->assign("VAL_EXPIRE_YEAR",$i);
|
||||
|
||||
$formTemplate->parse("form.expiration_years");
|
||||
|
||||
}
|
||||
|
||||
|
||||
$cache = new cache('glob.countries');
|
||||
$countries = $cache->readCache();
|
||||
|
||||
$countries = $db->select("SELECT id, iso, printable_name FROM ".$glob['dbprefix']."CubeCart_iso_countries ORDER BY printable_name");
|
||||
|
||||
for($i=0; $i<count($countries); $i++){
|
||||
|
||||
if($countries[$i]['id'] == $orderSum['country']){
|
||||
$formTemplate->assign("COUNTRY_SELECTED","selected='selected'");
|
||||
} else {
|
||||
$formTemplate->assign("COUNTRY_SELECTED","");
|
||||
}
|
||||
|
||||
$formTemplate->assign("VAL_COUNTRY_ISO",$countries[$i]['iso']);
|
||||
|
||||
$countryName = "";
|
||||
$countryName = $countries[$i]['printable_name'];
|
||||
|
||||
if(strlen($countryName)>20){
|
||||
$countryName = substr($countryName,0,20)."…";
|
||||
}
|
||||
|
||||
$formTemplate->assign("VAL_COUNTRY_NAME",$countryName);
|
||||
$formTemplate->parse("form.repeat_countries");
|
||||
}
|
||||
|
||||
$formTemplate->assign("LANG_CC_INFO_TITLE",$lang['gateway']['cc_info_title']);
|
||||
$formTemplate->assign("LANG_FIRST_NAME",$lang['gateway']['first_name']);
|
||||
$formTemplate->assign("LANG_LAST_NAME",$lang['gateway']['last_name']);
|
||||
$formTemplate->assign("LANG_CARD_TYPE",$lang['gateway']['card_type']);
|
||||
$formTemplate->assign("LANG_CARD_NUMBER",$lang['gateway']['card_number']);
|
||||
$formTemplate->assign("LANG_EXPIRES",$lang['gateway']['expires']);
|
||||
$formTemplate->assign("LANG_MMYYYY",$lang['gateway']['mmyyyy']);
|
||||
$formTemplate->assign("LANG_SECURITY_CODE",$lang['gateway']['security_code']);
|
||||
$formTemplate->assign("LANG_CUST_INFO_TITLE",$lang['gateway']['customer_info']);
|
||||
$formTemplate->assign("LANG_EMAIL",$lang['gateway']['email']);
|
||||
$formTemplate->assign("LANG_ADDRESS",$lang['gateway']['address']);
|
||||
$formTemplate->assign("LANG_CITY",$lang['gateway']['city']);
|
||||
$formTemplate->assign("LANG_ZIPCODE",$lang['gateway']['zipcode']);
|
||||
$formTemplate->assign("LANG_COUNTRY",$lang['gateway']['country']);
|
||||
$formTemplate->assign("LANG_OPTIONAL",$lang['gateway']['optional']);
|
||||
|
||||
if($module['mode']=="UK"){
|
||||
|
||||
|
||||
for($i=1;$i<=12;$i++) {
|
||||
|
||||
$val = sprintf('%02d',$i);
|
||||
|
||||
if($val == $_POST['issueMonth']){
|
||||
$formTemplate->assign("ISSUE_MONTHS_SELECTED","selected='selected'");
|
||||
} else {
|
||||
$formTemplate->assign("ISSUE_MONTHS_SELECTED","");
|
||||
}
|
||||
$formTemplate->assign("VAL_ISSUE_MONTH",$val);
|
||||
|
||||
$formTemplate->parse("form.issue_info.issue_months");
|
||||
|
||||
}
|
||||
|
||||
$minYear = $thisYear - 10;
|
||||
|
||||
for($i = $thisYear; $i>=$minYear; $i--) {
|
||||
|
||||
if($i == $_POST['issueYear']){
|
||||
$formTemplate->assign("ISSUE_YEARS_SELECTED","selected='selected'");
|
||||
} else {
|
||||
$formTemplate->assign("ISSUE_YEARS_SELECTED","");
|
||||
}
|
||||
$formTemplate->assign("VAL_ISSUE_YEAR",$i);
|
||||
|
||||
$formTemplate->parse("form.issue_info.issue_years");
|
||||
|
||||
}
|
||||
|
||||
|
||||
$formTemplate->assign("LANG_ISSUE_DATE", $lang['gateway']['issue_date']);
|
||||
$formTemplate->assign("LANG_ISSUE_NO", $lang['gateway']['issue_number']);
|
||||
$formTemplate->parse("form.issue_info");
|
||||
}
|
||||
|
||||
$formTemplate->assign("VAL_GATEWAY","PayPal Website Payments Pro (".$module['paymentAction'].")");
|
||||
|
||||
$formTemplate->parse("form");
|
||||
$formTemplate = $formTemplate->text("form");
|
||||
?>
|
||||
132
production/modules/altCheckout/PayPal_Pro/form.tpl
Normal file
@@ -0,0 +1,132 @@
|
||||
<!-- BEGIN: form -->
|
||||
<!-- BEGIN: error -->
|
||||
<p class="txtError" style="text-align: left;">{LANG_ERROR}</p>
|
||||
<!-- END: error -->
|
||||
<p>{VAL_AMOUNT_DUE}</p>
|
||||
<table width="100%" cellpadding="3" cellspacing="0" border="0">
|
||||
<tr align="left">
|
||||
<td colspan="4" class="tdcartTitle"><strong>{LANG_CC_INFO_TITLE}</strong></td>
|
||||
</tr>
|
||||
<tr align="left">
|
||||
<td><strong>{LANG_FIRST_NAME}</strong></td>
|
||||
<td><input type="text" name="firstName" value="{VAL_FIRST_NAME}" class="textbox" /></td>
|
||||
<td><strong>{LANG_LAST_NAME}</strong></td>
|
||||
<td><input type="text" name="lastName" value="{VAL_LAST_NAME}" class="textbox" /></td>
|
||||
</tr>
|
||||
<tr align="left">
|
||||
<td align="left"><strong>{LANG_CARD_NUMBER}</strong></td>
|
||||
<td align="left"><input type="text" name="cardNumber" value="" size="19" maxlength="19" class="textbox" /></td>
|
||||
<td><strong>{LANG_CARD_TYPE}</strong></td>
|
||||
<td><select name="cardType" class="textbox">
|
||||
<!-- BEGIN: repeat_cards -->
|
||||
<option value="{VAL_CARD_TYPE}" {CARD_SELECTED}>{VAL_CARD_NAME}</option>
|
||||
<!-- END: repeat_cards -->
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr align="left">
|
||||
<td align="left"><strong>{LANG_EXPIRES}</strong>
|
||||
|
||||
<td align="left">
|
||||
<select name="expirationMonth" class="textbox">
|
||||
<!-- BEGIN: expiration_months -->
|
||||
<option value="{VAL_EXPIRE_MONTH}" {EXPIRE_MONTHS_SELECTED}>{VAL_EXPIRE_MONTH}</option>
|
||||
<!-- END: expiration_months -->
|
||||
</select>
|
||||
/
|
||||
<select name="expirationYear" class="textbox">
|
||||
<!-- BEGIN: expiration_years -->
|
||||
<option value="{VAL_EXPIRE_YEAR}" {EXPIRE_YEARS_SELECTED}>{VAL_EXPIRE_YEAR}</option>
|
||||
<!-- END: expiration_years -->
|
||||
</select></td>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
|
||||
<!-- BEGIN: issue_info -->
|
||||
<tr align="left">
|
||||
<td><strong>{LANG_ISSUE_DATE}</strong>
|
||||
<td>
|
||||
<select name="issueMonth" class="textbox">
|
||||
<!-- BEGIN: issue_months -->
|
||||
<option value="{VAL_ISSUE_MONTH}" {ISSUE_MONTHS_SELECTED}>{VAL_ISSUE_MONTH}</option>
|
||||
<!-- END: issue_months -->
|
||||
</select>
|
||||
/
|
||||
<select name="issueYear" class="textbox">
|
||||
<!-- BEGIN: issue_years -->
|
||||
<option value="{VAL_ISSUE_YEAR}" {ISSUE_YEARS_SELECTED}>{VAL_ISSUE_YEAR}</option>
|
||||
<!-- END: issue_years -->
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr align="left">
|
||||
<td><strong>{LANG_ISSUE_NO}</strong>
|
||||
<td><input type="text" name="issueNo" value="" size="4" maxlength="4" class="textbox" style="text-align: center" /></td>
|
||||
</tr>
|
||||
<!-- END: issue_info -->
|
||||
<tr align="left">
|
||||
<td align="left"><strong>{LANG_SECURITY_CODE}</strong>
|
||||
<td align="left"><input type="text" name="cvc2" value="" size="4" maxlength="4" class="textbox" style="text-align: center" />
|
||||
<span onmouseover="findObj('cvv-img').src='images/general/cvv.gif'" onmouseout="findObj('cvv-img').src='images/general/px.gif'" style="cursor: pointer; cursor: hand;"> ? </span> <div id="cvv" style="position:absolute; width: 1px; height: 1px;"><img src="images/general/px.gif" border="0" id="cvv-img" alt="" /></div></td>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6" align="right" valign="bottom"> </td>
|
||||
</tr>
|
||||
<tr align="left">
|
||||
<td colspan="6" class="tdcartTitle"><strong>{LANG_CUST_INFO_TITLE}</strong></td>
|
||||
</tr>
|
||||
<tr align="left">
|
||||
<td><strong>{LANG_EMAIL}</strong>
|
||||
<td colspan="3"><input type="text" name="emailAddress" value="{VAL_EMAIL_ADDRESS}" size="50" class="textbox" /></td>
|
||||
</tr>
|
||||
<tr align="left">
|
||||
<td><strong>{LANG_ADDRESS}</strong></td>
|
||||
<td colspan="3"><input type="text" name="addr1" value="{VAL_ADD_1}" size="50" class="textbox" /></td>
|
||||
</tr>
|
||||
<tr align="left">
|
||||
<td> </td>
|
||||
<td colspan="3"><input type="text" name="addr2" value="{VAL_ADD_2}" size="50" class="textbox" /> {LANG_OPTIONAL}</td>
|
||||
</tr>
|
||||
<tr align="left">
|
||||
<td>
|
||||
<strong>{LANG_CITY}</strong> </td>
|
||||
<td colspan="3">
|
||||
<input type="text" name="city" value="{VAL_CITY}" class="textbox" /> </td>
|
||||
</tr>
|
||||
|
||||
<tr align="left">
|
||||
<td>
|
||||
<strong>{LANG_STATE}</strong> </td>
|
||||
<td colspan="3">
|
||||
<!-- BEGIN: states_list -->
|
||||
<select id="state" name="state" class="textbox">
|
||||
<!-- BEGIN: states_loop -->
|
||||
<option value="{VAL_STATE_ABBR}" {VAL_STATE_SELECTED}>{VAL_STATE}</option>
|
||||
<!-- END: states_loop -->
|
||||
</select>
|
||||
<!-- END: states_list -->
|
||||
<!-- BEGIN: states_txtbox -->
|
||||
<input type="text" name="state" value="{VAL_STATE}" class="textbox" />
|
||||
<!-- END: states_txtbox --> </td>
|
||||
</tr>
|
||||
|
||||
<tr align="left">
|
||||
<td>
|
||||
<strong>{LANG_ZIPCODE}</strong> </td>
|
||||
<td colspan="3">
|
||||
<input type="text" name="postalCode" value="{VAL_POST_CODE}" size="10" maxlength="10" class="textbox" /> </td>
|
||||
</tr>
|
||||
<tr align="left">
|
||||
<td><strong>{LANG_COUNTRY}</strong>
|
||||
<td colspan="3">
|
||||
<select name="country" class="textbox">
|
||||
<!-- BEGIN: repeat_countries -->
|
||||
<option value="{VAL_COUNTRY_ISO}" {COUNTRY_SELECTED}>{VAL_COUNTRY_NAME}</option>
|
||||
<!-- END: repeat_countries -->
|
||||
</select> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<input type="hidden" name="gateway" value="{VAL_GATEWAY}" />
|
||||
<!-- END: form -->
|
||||
3
production/modules/altCheckout/PayPal_Pro/index.php
Normal file
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
die("Access Denied");
|
||||
?>
|
||||
1
production/modules/altCheckout/PayPal_Pro/logs/index.htm
Normal file
@@ -0,0 +1 @@
|
||||
Access Denied
|
||||
BIN
production/modules/altCheckout/PayPal_Pro/paypal_cards_uk.gif
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
BIN
production/modules/altCheckout/PayPal_Pro/paypal_cards_us.gif
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
33
production/modules/altCheckout/PayPal_Pro/process.inc.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| CubeCart 4
|
||||
| ========================================
|
||||
| CubeCart is a registered trade mark of Devellion Limited
|
||||
| Copyright Devellion Limited 2006. All rights reserved.
|
||||
| Devellion Limited,
|
||||
| 5 Bridge Street,
|
||||
| Bishops Stortford,
|
||||
| HERTFORDSHIRE.
|
||||
| CM23 2JU
|
||||
| UNITED KINGDOM
|
||||
| http://www.devellion.com
|
||||
| UK Private Limited Company No. 5323904
|
||||
| ========================================
|
||||
| Web: http://www.cubecart.com
|
||||
| Email: info (at) cubecart (dot) com
|
||||
| License Type: CubeCart is NOT Open Source Software and Limitations Apply
|
||||
| Licence Info: http://www.cubecart.com/site/faq/license.php
|
||||
+--------------------------------------------------------------------------
|
||||
| process.inc.php
|
||||
| ========================================
|
||||
| Process PayPal Express Checkout
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
if($_GET['payment']==1) {
|
||||
$orderSum = $order->getOrderSum($_GET['cart_order_id']);
|
||||
include("modules".CC_DS."altCheckout".CC_DS."PayPal_Pro".CC_DS."wpp-".$module['mode'].CC_DS."DoExpressCheckoutPayment.php");
|
||||
} else {
|
||||
include("modules".CC_DS."altCheckout".CC_DS."PayPal_Pro".CC_DS."wpp-".$module['mode'].CC_DS."ReviewOrder.php");
|
||||
}
|
||||
?>
|
||||
49
production/modules/altCheckout/PayPal_Pro/transfer.inc.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| CubeCart 4
|
||||
| ========================================
|
||||
| CubeCart is a Trade Mark of Devellion Limited
|
||||
| Copyright Devellion Limited 2005 - 2006. All rights reserved.
|
||||
| Devellion Limited,
|
||||
| 5 Bridge Street,
|
||||
| Bishops Stortford,
|
||||
| HERTFORDSHIRE.
|
||||
| CM23 2JU
|
||||
| UNITED KINGDOM
|
||||
| http://www.devellion.com
|
||||
| UK Private Limited Company No. 5323904
|
||||
| ========================================
|
||||
| Web: http://www.cubecart.com
|
||||
| Date: Tuesday, 17th October 2006
|
||||
| Email: sales (at) cubecart (dot) com
|
||||
| License Type: CubeCart is NOT Open Source Software and Limitations Apply
|
||||
| Licence Info: http://www.cubecart.com/site/faq/license.php
|
||||
+--------------------------------------------------------------------------
|
||||
| transfer.inc.php
|
||||
| ========================================
|
||||
| Core functions for the PayPal Direct Payment Gateway
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
function repeatVars(){
|
||||
|
||||
return FALSE;
|
||||
|
||||
}
|
||||
|
||||
function fixedVars(){
|
||||
|
||||
|
||||
return FALSE;
|
||||
|
||||
}
|
||||
|
||||
///////////////////////////
|
||||
// Other Vars
|
||||
////////
|
||||
$formAction = "index.php?_g=co&_a=step3&process=1&cart_order_id=".$_GET['cart_order_id'];
|
||||
$formMethod = "post";
|
||||
$formTarget = "_self";
|
||||
$transfer = "manual";
|
||||
?>
|
||||
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
/*************************************************
|
||||
APIError.php
|
||||
|
||||
Displays error parameters.
|
||||
|
||||
Called by DoDirectPaymentReceipt.php, TransactionDetails.php,
|
||||
GetExpressCheckoutDetails.php and DoExpressCheckoutPayment.php.
|
||||
|
||||
*************************************************/
|
||||
if (!defined('CC_INI_SET')) die("Access Denied");
|
||||
session_start();
|
||||
$resArray=$_SESSION['reshash'];
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<title>PayPal PHP API Response</title>
|
||||
<link href="sdk.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
|
||||
<body alink=#0000FF vlink=#0000FF>
|
||||
|
||||
<center>
|
||||
|
||||
<table width="700">
|
||||
<tr>
|
||||
<td colspan="2"><h3>The PayPal API has returned an error!</h3></td>
|
||||
</tr>
|
||||
|
||||
<?php //it will print if any URL errors
|
||||
if(isset($_SESSION['curl_error_no'])) {
|
||||
$errorCode = $_SESSION['curl_error_no'] ;
|
||||
$errorMessage = $_SESSION['curl_error_msg'] ;
|
||||
?>
|
||||
|
||||
|
||||
<tr>
|
||||
<td><strong>Error Number:</strong></td>
|
||||
<td><?php $errorCode ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Error Message:</strong></td>
|
||||
<td><?php $errorMessage ?></td>
|
||||
</tr>
|
||||
<?php } else {
|
||||
|
||||
/* If there is no URL Errors, Construct the HTML page with
|
||||
Response Error parameters.
|
||||
*/
|
||||
?>
|
||||
|
||||
<td><strong>Ack:</strong></td>
|
||||
<td><?php $resArray['ACK']; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Correlation ID:</strong></td>
|
||||
<td><?php $resArray['CORRELATIONID']; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Version:</strong></td>
|
||||
<td><?php $resArray['VERSION']; ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
$count=0;
|
||||
while (isset($resArray["L_SHORTMESSAGE".$count])) {
|
||||
$errorCode = $resArray["L_ERRORCODE".$count];
|
||||
$shortMessage = $resArray["L_SHORTMESSAGE".$count];
|
||||
$longMessage = $resArray["L_LONGMESSAGE".$count];
|
||||
$count=$count+1;
|
||||
?>
|
||||
<tr>
|
||||
<td><strong>Error Number:</strong></td>
|
||||
<td><?php $errorCode; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Short Message:</strong></td>
|
||||
<td><?php $shortMessage; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Long Message:</strong></td>
|
||||
<td><?php $longMessage; ?></td>
|
||||
</tr>
|
||||
|
||||
<?php }//end while
|
||||
}// end else
|
||||
?>
|
||||
</table>
|
||||
<a class="home" id="CallsLink" href="index.php">Home</a>
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
session_unset();
|
||||
exit;
|
||||
?>
|
||||
@@ -0,0 +1,695 @@
|
||||
<?php
|
||||
if (!defined('CC_INI_SET')) die("Access Denied");
|
||||
|
||||
require_once 'constants.php';
|
||||
|
||||
session_start();
|
||||
|
||||
function pp_debug($nvpreq,$response) {
|
||||
|
||||
$filename = "modules".CC_DS."altCheckout".CC_DS."PayPal_Pro".CC_DS."logs".CC_DS.'PayPal-NVP-UK-Log-'.date("Ymd");
|
||||
$content = "=== ".date("r")." ===\n";
|
||||
$content .= "NVP String:\n".$nvpreq."\n--------------------\n";
|
||||
$content .= "cURL Response:\n".$response."\n=======================================\n\n\n\n";
|
||||
|
||||
$handle = @fopen($filename, 'a');
|
||||
@fwrite($handle, $content);
|
||||
@fclose($handle);
|
||||
}
|
||||
|
||||
function hash_call($TENDER,$TRXTYPE,$nvpStr,$request_id) {
|
||||
|
||||
global $ini;
|
||||
|
||||
$headers[] = "Content-Type: text/namevalue"; // either text/namevalue or text/xml
|
||||
$headers[] = "X-VPS-Timeout: 30";
|
||||
$headers[] = "X-VPS-VIT-OS-Name: ".PHP_OS; // Name of your Operating System (OS)
|
||||
$headers[] = "X-VPS-VIT-OS-Version: Unknown"; // OS Version
|
||||
$headers[] = "X-VPS-VIT-Client-Type: PHP/cURL"; // Language you are using
|
||||
$headers[] = "X-VPS-VIT-Client-Version: 0.01"; // For your info
|
||||
$headers[] = "X-VPS-VIT-Client-Architecture: Unknown"; // For your info
|
||||
$headers[] = "X-VPS-VIT-Client-Certification-Id: 33baf5893fc2123d8b191d2d011b7fdc"; // This header requirement will be removed
|
||||
$headers[] = "X-VPS-VIT-Integration-Product: CubeCart"; // For your info, would populate with application name
|
||||
$headers[] = "X-VPS-VIT-Integration-Version: ".$ini['ver']; // Application version
|
||||
$headers[] = "X-VPS-Request-ID: ".$request_id;
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, API_ENDPOINT);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
|
||||
curl_setopt($ch, CURLOPT_HEADER, 0); // tells curl to include headers in response
|
||||
curl_setopt($ch, CURLOPT_VERBOSE, 1);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
if(USE_PROXY) curl_setopt ($ch, CURLOPT_PROXY, PROXY_HOST.":".PROXY_PORT);
|
||||
|
||||
//NVPRequest for submitting to server
|
||||
|
||||
$verbosity = "MEDIUM";
|
||||
|
||||
$nvpreq = "TRXTYPE[".strlen($TRXTYPE)."]=".$TRXTYPE.
|
||||
"&TENDER[".strlen($TENDER)."]=".$TENDER.
|
||||
"&PWD[".strlen(PWD)."]=".PWD.
|
||||
"&USER[".strlen(USER)."]=".USER.
|
||||
"&VENDOR[".strlen(VENDOR)."]=".VENDOR.
|
||||
"&PARTNER[".strlen(PARTNER)."]=".PARTNER.
|
||||
"&VERBOSITY[".strlen($verbosity)."]=".$verbosity.
|
||||
$nvpStr;
|
||||
|
||||
//setting the nvpreq as POST FIELD to curl
|
||||
curl_setopt($ch,CURLOPT_POSTFIELDS,$nvpreq);
|
||||
|
||||
//getting response from server
|
||||
$response = curl_exec($ch);
|
||||
|
||||
if(PAYPAL_DEBUG==true) {
|
||||
pp_debug($nvpreq,$response);
|
||||
}
|
||||
|
||||
//convrting NVPResponse to an Associative Array
|
||||
$nvpResArray = deformatNVP($response);
|
||||
$nvpReqArray = deformatNVP($nvpreq);
|
||||
$_SESSION['nvpReqArray']=$nvpReqArray;
|
||||
|
||||
if (curl_errno($ch)) {
|
||||
echo "<strong>Curl Error No:</strong> ".curl_errno($ch)."<br />For further info please see: <a href='http://curl.haxx.se/libcurl/c/libcurl-errors.html'>http://curl.haxx.se/libcurl/c/libcurl-errors.html</a>";
|
||||
exit;
|
||||
|
||||
} else {
|
||||
//closing the curl
|
||||
curl_close($ch);
|
||||
}
|
||||
|
||||
return $nvpResArray;
|
||||
|
||||
}
|
||||
|
||||
function deformatNVP($nvpStr) {
|
||||
|
||||
$intial=0;
|
||||
$nvpArray = array();
|
||||
|
||||
|
||||
while(strlen($nvpStr)){
|
||||
//postion of Key
|
||||
$keypos= strpos($nvpStr,'=');
|
||||
//position of value
|
||||
$valuepos = strpos($nvpStr,'&') ? strpos($nvpStr,'&'): strlen($nvpStr);
|
||||
|
||||
/*getting the Key and Value values and storing in a Associative Array*/
|
||||
$keyval=substr($nvpStr,$intial,$keypos);
|
||||
$valval=substr($nvpStr,$keypos+1,$valuepos-$keypos-1);
|
||||
//decoding the respose
|
||||
$nvpArray[urldecode($keyval)] = urldecode( $valval);
|
||||
$nvpStr=substr($nvpStr,$valuepos+1,strlen($nvpStr));
|
||||
}
|
||||
return $nvpArray;
|
||||
}
|
||||
|
||||
function paypalErrors($resArray) {
|
||||
|
||||
|
||||
switch($resArray["RESULT"]) {
|
||||
|
||||
case 1:
|
||||
$error['admin'] = "User authentication failed. Error is caused by one or more of the following:
|
||||
Invalid Processor information entered. Contact merchant bank to verify.
|
||||
'Allowed IP Address' security feature implemented. The transaction is coming from
|
||||
an unknown IP address. See PayPal Manager Online Help for details on how to use
|
||||
Manager to update the allowed IP addresses.
|
||||
You are using a test (not active) account to submit a transaction to the live PayPal
|
||||
servers. Change the URL from test-payflow.verisign.com to payflow.verisign.com.";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
$error['admin'] = "Invalid tender type. Your merchant bank account does not support the following
|
||||
credit card type that was submitted.";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
$error['admin'] = "Invalid transaction type. Transaction type is not appropriate for this transaction. For
|
||||
example, you cannot credit an authorisation-only transaction.";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
$error['admin'] = "Invalid amount format. Use the format: “#####.##” Do not include currency symbols
|
||||
or commas.";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 5:
|
||||
$error['admin'] = "Invalid merchant information. Processor does not recognise your merchant account
|
||||
information. Contact your bank account acquirer to resolve this problem.";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 6:
|
||||
$error['admin'] = "Invalid or unsupported currency code";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 7:
|
||||
$error['admin'] = "Field format error. Invalid information entered. See RESPMSG.";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 8:
|
||||
$error['admin'] = "Not a transaction server";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 9:
|
||||
$error['admin'] = "Too many parameters or invalid stream";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 10:
|
||||
$error['admin'] = "Too many line items";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 11:
|
||||
$error['admin'] = "Client time-out waiting for response";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 12:
|
||||
$error['admin'] = "Declined. Check the credit card number, expiry date and transaction information to
|
||||
make sure they were entered correctly. If this does not resolve the problem, have the
|
||||
customer call their card issuing bank to resolve.";
|
||||
$error['customer'] = "Card declined. Please check the card number and expiry date have been entered correctly.";
|
||||
break;
|
||||
|
||||
case 13:
|
||||
$error['admin'] = "Referral. Transaction cannot be approved electronically but can be approved with a
|
||||
verbal authorisation. Contact your merchant bank to obtain an authorisation and submit
|
||||
a manual Voice Authorisation transaction.";
|
||||
$error['customer'] = "Unfortunately this transaction cannot be approved electronically. Please contact you bank and ask them to manually authorize this transaction.";
|
||||
break;
|
||||
|
||||
case 14:
|
||||
$error['admin'] = "Invalid Client Certification ID. Check the HTTP header. If the tag, X-VPS-VIT-
|
||||
CLIENT-CERTIFICATION-ID, is missing, RESULT code 14 is returned.";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 19:
|
||||
$error['admin'] = "Original transaction ID not found. The transaction ID you entered for this
|
||||
transaction is not valid. See RESPMSG.";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 20:
|
||||
$error['admin'] = "Cannot find the customer reference number";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 22:
|
||||
$error['admin'] = "Invalid ABA number";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 23:
|
||||
$error['admin'] = "Invalid account number. Check credit card number and re-submit.";
|
||||
$error['customer'] = "The credit card number entered is invalid. Please check and try again.";
|
||||
break;
|
||||
|
||||
case 24:
|
||||
$error['admin'] = "Invalid expiry date. Check and re-submit.";
|
||||
$error['customer'] = "Invalid expiry date. Please check and try again.";
|
||||
break;
|
||||
|
||||
case 25:
|
||||
$error['admin'] = "Invalid Host Mapping. You are trying to process a tender type such as Discover Card,
|
||||
but you are not set up with your merchant bank to accept this card type.";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 26:
|
||||
$error['admin'] = "Invalid vendor account";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 27:
|
||||
$error['admin'] = "Insufficient partner permissions";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 28:
|
||||
$error['admin'] = "Insufficient user permissions";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 29:
|
||||
$error['admin'] = "Invalid XML document. This could be caused by an unrecognised XML tag or a bad
|
||||
XML format that cannot be parsed by the system.";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 30:
|
||||
$error['admin'] = "Duplicate transaction";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 31:
|
||||
$error['admin'] = "Error in adding the recurring profile";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 32:
|
||||
$error['admin'] = "Error in modifying the recurring profile";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 33:
|
||||
$error['admin'] = "Error in cancelling the recurring profile";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 34:
|
||||
$error['admin'] = "Error in forcing the recurring profile";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 35:
|
||||
$error['admin'] = "Error in reactivating the recurring profile";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 36:
|
||||
$error['admin'] = "OLTP Transaction failed";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 37:
|
||||
$error['admin'] = "Invalid recurring profile ID";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 50:
|
||||
$error['admin'] = "Insufficient funds available in account";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 51:
|
||||
$error['admin'] = "Exceeds per transaction limit";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 99:
|
||||
$error['admin'] = "General error. See RESPMSG.";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 100:
|
||||
$error['admin'] = "Transaction type not supported by host";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 101:
|
||||
$error['admin'] = "Time-out value too small";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 102:
|
||||
$error['admin'] = "Processor not available";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 103:
|
||||
$error['admin'] = "Error reading response from host";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 104:
|
||||
$error['admin'] = "Timeout waiting for processor response. Try your transaction again.";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 105:
|
||||
$error['admin'] = "Credit error. Make sure you have not already credited this transaction, or that this
|
||||
transaction ID is for a creditable transaction. (For example, you cannot credit an
|
||||
authorisation.)";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 106:
|
||||
$error['admin'] = "Host not available";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 107:
|
||||
$error['admin'] = "Duplicate suppression time-out";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 108:
|
||||
$error['admin'] = "Void error. See RESPMSG. Make sure the transaction ID entered has not already been
|
||||
voided. If not, then look at the Transaction Detail screen for this transaction to see if it
|
||||
has settled. (The Batch field is set to a number greater than zero if the transaction has
|
||||
been settled.) If the transaction has already settled, your only recourse is a reversal
|
||||
(credit a payment or submit a payment for a credit).";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 109:
|
||||
$error['admin'] = "Time-out waiting for host response";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 110:
|
||||
$error['admin'] = "Referenced auth (against order) Error";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 111:
|
||||
$error['admin'] = "Capture error. Either an attempt to capture a transaction that is not an authorisation
|
||||
transaction type, or an attempt to capture an authorisation transaction that has already
|
||||
been captured.";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 112:
|
||||
$error['admin'] = "Failed AVS check. Address and ZIP code do not match. An authorisation may still
|
||||
exist on the cardholder’s account.";
|
||||
$error['customer'] = "Failed AVS check. The address and zip/postcode does not match the card holders account details.";
|
||||
break;
|
||||
|
||||
case 113:
|
||||
$error['admin'] = "Merchant sale total will exceed the sales cap with current transaction. ACH
|
||||
transactions only.";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 114:
|
||||
$error['admin'] = "Card Security Code (CSC) Mismatch. An authorisation may still exist on the
|
||||
cardholder’s account.";
|
||||
$error['customer'] = "The CVV2 security code does not match. Please try again.";
|
||||
break;
|
||||
|
||||
case 115:
|
||||
$error['admin'] = "System busy, try again later";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 116:
|
||||
$error['admin'] = "VPS Internal error. Failed to lock terminal number";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 117:
|
||||
$error['admin'] = "Failed merchant rule check. One or more of the following three failures occurred:
|
||||
An attempt was made to submit a transaction that failed to meet the security settings
|
||||
specified on the PayPal Manager Security Settings page. If the transaction exceeded the
|
||||
Maximum Amount security setting, then no values are returned for AVS or CSC.
|
||||
AVS validation failed. The AVS return value should appear in the RESPMSG.
|
||||
CSC validation failed. The CSC return value should appear in the RESPMSG.";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 118:
|
||||
$error['admin'] = "Invalid keywords found in string fields";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 119:
|
||||
$error['admin'] = "General failure within PIM Adapter";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 120:
|
||||
$error['admin'] = "Attempt to reference a failed transaction";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 121:
|
||||
$error['admin'] = "Not enabled for feature";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 122:
|
||||
$error['admin'] = "Merchant sale total will exceed the credit cap with current transaction. ACH
|
||||
transactions only.";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 125:
|
||||
$error['admin'] = "Fraud Protection Services Filter — Declined by filters";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 126:
|
||||
$error['admin'] = "Fraud Protection Services Filter — Flagged for review by filters
|
||||
Important Note: Result code 126 indicates that a transaction triggered a fraud filter.
|
||||
This is not an error, but a notice that the transaction is in a review status. The
|
||||
transaction has been authorised but requires you to review and manually accept the
|
||||
transaction before it will be allowed to settle.
|
||||
Result code 126 is intended to give you an idea of the kind of transaction that is
|
||||
considered suspicious to enable you to evaluate whether you can benefit from using the
|
||||
Fraud Protection Services.
|
||||
To eliminate result 126, turn the filters off.
|
||||
For more information, see the Fraud Protection Services documentation for your
|
||||
payments solution. It is available on the PayPal Manager Documentation page.";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 127:
|
||||
$error['admin'] = "Fraud Protection Services Filter — Not processed by filters";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 128:
|
||||
$error['admin'] = "Fraud Protection Services Filter — Declined by merchant after being flagged for
|
||||
review by filters";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 131:
|
||||
$error['admin'] = "Version 1 Website Payments Pro SDK client no longer supported. Upgrade to the
|
||||
most recent version of the Website Payments Pro client.";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 132:
|
||||
$error['admin'] = "Card has not been submitted for update";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 133:
|
||||
$error['admin'] = "Data mismatch in HTTP retry request";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 150:
|
||||
$error['admin'] = "Issuing bank timed out";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 151:
|
||||
$error['admin'] = "Issuing bank unavailable";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 200:
|
||||
$error['admin'] = "Reauth error";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 201:
|
||||
$error['admin'] = "Order error";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 402:
|
||||
$error['admin'] = "PIM Adapter Unavailable";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 403:
|
||||
$error['admin'] = "PIM Adapter stream error";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 404:
|
||||
$error['admin'] = "PIM Adapter Timeout";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 600:
|
||||
$error['admin'] = "Cybercash Batch Error";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 601:
|
||||
$error['admin'] = "Cybercash Query Error";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 1000:
|
||||
$error['admin'] = "Generic host error. This is a generic message returned by your credit card processor.
|
||||
The RESPMSG will contain more information describing the error.";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 1001:
|
||||
$error['admin'] = "Buyer Authentication Service unavailable";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 1002:
|
||||
$error['admin'] = "Buyer Authentication Service — Transaction timeout";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 1003:
|
||||
$error['admin'] = "Buyer Authentication Service — Invalid client version";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 1004:
|
||||
$error['admin'] = "Buyer Authentication Service — Invalid timeout value";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 1011:
|
||||
$error['admin'] = "Buyer Authentication Service unavailable";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 1012:
|
||||
$error['admin'] = "Buyer Authentication Service unavailable";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 1013:
|
||||
$error['admin'] = "Buyer Authentication Service unavailable";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 1014:
|
||||
$error['admin'] = "Buyer Authentication Service — Merchant is not enrolled for Buyer
|
||||
Authentication Service (3-D Secure).";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 1016:
|
||||
$error['admin'] = "Buyer Authentication Service — 3-D Secure error response received. Instead of
|
||||
receiving a PARes response to a Validate Authentication transaction, an error response
|
||||
was received.";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 1017:
|
||||
$error['admin'] = "Buyer Authentication Service — 3-D Secure error response is invalid. An error
|
||||
response is received and the response is not well formed for a Validate Authentication
|
||||
transaction.";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 1021:
|
||||
$error['admin'] = "Buyer Authentication Service — Invalid card type";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 1022:
|
||||
$error['admin'] = "Buyer Authentication Service — Invalid or missing currency code";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 1023:
|
||||
$error['admin'] = "Buyer Authentication Service — merchant status for 3D secure is invalid";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 1041:
|
||||
$error['admin'] = "Buyer Authentication Service — Validate Authentication failed: missing or
|
||||
invalid PARES";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 1042:
|
||||
$error['admin'] = "Buyer Authentication Service — Validate Authentication failed: PARES format is
|
||||
invalid";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 1043:
|
||||
$error['admin'] = "Buyer Authentication Service — Validate Authentication failed: Cannot find
|
||||
successful Verify Enrolment";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 1044:
|
||||
$error['admin'] = "Buyer Authentication Service — Validate Authentication failed: Signature
|
||||
validation failed for PARES";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 1045:
|
||||
$error['admin'] = "Buyer Authentication Service — Validate Authentication failed: Mismatched or
|
||||
invalid amount in PARES";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 1046:
|
||||
$error['admin'] = "Buyer Authentication Service — Validate Authentication failed: Mismatched or
|
||||
invalid acquirer in PARES";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 1047:
|
||||
$error['admin'] = "Buyer Authentication Service — Validate Authentication failed: Mismatched or
|
||||
invalid Merchant ID in PARES";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 1048:
|
||||
$error['admin'] = "Buyer Authentication Service — Validate Authentication failed: Mismatched or
|
||||
invalid card number in PARES";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 1049:
|
||||
$error['admin'] = "Buyer Authentication Service — Validate Authentication failed: Mismatched or
|
||||
invalid currency code in PARES";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 1050:
|
||||
$error['admin'] = "Buyer Authentication Service — Validate Authentication failed: Mismatched or
|
||||
invalid XID in PARES";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 1051:
|
||||
$error['admin'] = "Buyer Authentication Service — Validate Authentication failed: Mismatched or
|
||||
invalid order date in PARES";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
case 1052:
|
||||
$error['admin'] = "Buyer Authentication Service — Validate Authentication failed: This PARES was
|
||||
already validated for a previous Validate Authentication transaction";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
|
||||
default:
|
||||
$error['admin'] = "No error code returned by PayPal. I have no idea what is going on.";
|
||||
$error['customer'] = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if($error['customer'] == false) {
|
||||
$error['customer'] = "This transaction is pending approval. A member of staff should contact you shortly with further advice. If you have any questions concerning this message or if you do not hear back from a staff member within a reasonable time please contact us quoting your order number.";
|
||||
}
|
||||
|
||||
$error['paypal'] = $resArray["RESPMSG"];
|
||||
|
||||
return $error;
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
if (!defined('CC_INI_SET')) die("Access Denied");
|
||||
|
||||
require_once 'CallerService.php';
|
||||
|
||||
$pppro = $db->select(sprintf("SELECT min(`id`), trans_id FROM `%sCubeCart_transactions` WHERE order_id = %s and `status` = 'SUCCESS' GROUP BY `id`",$glob['dbprefix'],$db->MySQLSafe($order_id)));
|
||||
|
||||
$authorizationID = trim($_POST['authorizationID']);
|
||||
$amount = sprintf("%.2f",trim($_POST['amount']));
|
||||
$note = trim($_POST['note']);
|
||||
$finalCapture = $_POST['CompleteCodeType']=="Complete" ? "Y" : "N";
|
||||
|
||||
$nvpStr = "&ORIGID[".strlen($authorizationID)."]=".$authorizationID."&AMT[".strlen($amount)."]=".$amount."&COMMENT1[".strlen($note)."]=".$note."&CAPTURECOMPLETE[".strlen($finalCapture)."]=".$finalCapture;
|
||||
|
||||
$request_id = md5($authorizationID.date('YmdGis')."1");
|
||||
|
||||
$resArray = hash_call($_POST['TENDER'],"D",$nvpStr,$request_id);
|
||||
|
||||
$ack = $resArray["RESULT"] == 0 ? "SUCCESS" : "FAIL";
|
||||
|
||||
if($ack!=="SUCCESS"){
|
||||
|
||||
$errorMsg = paypalErrors($resArray);
|
||||
$transNotes = "<strong>Error:</strong> ".$errorMsg["admin"]."<br /><strong>PayPal Response:</strong> ".$errorMsg["paypal"];
|
||||
$ppMsg = "<p class='warnText' id='ppresult'>".nl2br($transNotes)."</p>";
|
||||
} else {
|
||||
$transNotes = priceFormat($amount,true)." of authorization ID ".$authorizationID." captured successfully.";
|
||||
$ppMsg = "<p class='infoText' id='ppresult'>".$transNotes."</p>";
|
||||
|
||||
$query = "UPDATE ".$glob['dbprefix']."CubeCart_transactions SET `remainder` = `remainder` + ".$amount." WHERE `id` = '".$_POST['id']."';";
|
||||
$db->misc($query);
|
||||
}
|
||||
|
||||
$transData['customer_id'] = $orderSum[0]["customer_id"];
|
||||
$transData['gateway'] = "PayPal Website Payments Pro (DoCapture)";
|
||||
$transData['extra'] = $_POST['TENDER'];
|
||||
$transData['trans_id'] = $resArray['PNREF'];
|
||||
$transData['order_id'] = $orderSum[0]['cart_order_id'];
|
||||
$transData['amount'] = $amount;
|
||||
$transData['status'] = $ack;
|
||||
$transData['notes'] = $transNotes;
|
||||
$order->storeTrans($transData);
|
||||
?>
|
||||
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
if (!defined('CC_INI_SET')) die("Access Denied");
|
||||
|
||||
require_once 'CallerService.php';
|
||||
|
||||
$AMT = sprintf("%.2f",$orderSum['prod_total']);
|
||||
$ACCTTYPE = trim($_POST['cardType']);
|
||||
$ACCT = trim($_POST['cardNumber']);
|
||||
$EXPDATE = str_pad(trim($_POST['expirationMonth']), 2, '0', STR_PAD_LEFT).substr(trim($_POST['expirationYear']),2,2);
|
||||
$CVV2 = trim($_POST['cvc2']);
|
||||
$INVNUM = $orderSum['cart_order_id'];
|
||||
$EMAIL = $orderSum['email'];
|
||||
$FIRSTNAME = trim($_POST['firstName']);
|
||||
$LASTNAME = trim($_POST['lastName']);
|
||||
$STREET = trim($_POST['addr1']." ".$_POST['addr2']);
|
||||
$CITY = trim($_POST['city']);
|
||||
$STATE = trim($_POST['state']);
|
||||
$ZIP = trim($_POST['postalCode']);
|
||||
$COUNTRY = trim($_POST['country']);
|
||||
$CURRENCY = $config['defaultCurrency'];
|
||||
$CLIENTIP = trim(get_ip_address());
|
||||
|
||||
$CARDSTART = str_pad(trim($_POST['issueMonth']), 2, '0', STR_PAD_LEFT).substr(trim($_POST['issueYear']),2,2);
|
||||
$CARDISSUE = trim($_POST['issueNo']);
|
||||
|
||||
|
||||
|
||||
|
||||
$nvpStr =
|
||||
"&AMT[".strlen($AMT)."]=".$AMT
|
||||
."&ACCTTYPE[".strlen($ACCTTYPE)."]=".$ACCTTYPE
|
||||
."&ACCT[".strlen($ACCT)."]=".$ACCT
|
||||
."&EXPDATE[".strlen($EXPDATE)."]=".$EXPDATE
|
||||
."&CVV2[".strlen($CVV2)."]=".$CVV2
|
||||
."&INVNUM[".strlen($INVNUM)."]=".$INVNUM
|
||||
."&EMAIL[".strlen($EMAIL)."]=".$EMAIL
|
||||
."&FIRSTNAME[".strlen($FIRSTNAME)."]=".$FIRSTNAME
|
||||
."&LASTNAME[".strlen($LASTNAME)."]=".$LASTNAME
|
||||
."&STREET[".strlen($STREET)."]=".$STREET
|
||||
."&CITY[".strlen($CITY)."]=".$CITY
|
||||
."&STATE[".strlen($STATE)."]=".$STATE
|
||||
."&ZIP[".strlen($ZIP)."]=".$ZIP
|
||||
."&COUNTRY[".strlen($COUNTRY)."]=".$COUNTRY
|
||||
."&CURRENCY[".strlen($CURRENCY)."]=".$CURRENCY
|
||||
."&CLIENTIP[".strlen($CLIENTIP)."]=".$CLIENTIP;
|
||||
|
||||
// start && || issue for Solo/Maestro
|
||||
if($_POST['cardType'] == "9" || $_POST['cardType'] == "S") {
|
||||
$nvpStr .= "&CARDISSUE[".strlen($CARDISSUE)."]=".$CARDISSUE
|
||||
."&CARDSTART[".strlen($CARDSTART)."]=".$CARDSTART;
|
||||
}
|
||||
|
||||
$BUTTONSOURCE = "CubeCart_Cart_PRO2DP";
|
||||
|
||||
$nvpStr .="&BUTTONSOURCE[".strlen($BUTTONSOURCE)."]=".$BUTTONSOURCE;
|
||||
|
||||
$TRXTYPE = $module['paymentAction'] == "Sale" ? "S" : "A";
|
||||
|
||||
$request_id = md5($_POST['ACCT'].$_POST['AMT'].date('YmdGis')."1");
|
||||
|
||||
$resArray = hash_call("C",$TRXTYPE,$nvpStr,$request_id);
|
||||
|
||||
if($resArray["RESULT"] > 0) {
|
||||
|
||||
$ack = "FAIL";
|
||||
$errorMsg = paypalErrors($resArray);
|
||||
|
||||
} else {
|
||||
|
||||
$ack = "SUCCESS";
|
||||
// PPREF is the PayPal response transaction ID
|
||||
$resArray['TRANSACTIONID'] = $resArray["PNREF"];
|
||||
|
||||
include("responseCodes.php");
|
||||
|
||||
if(isset($resArray["AVSADDR"])) {
|
||||
$extraNotes .= "<strong>Address:</strong> ".basicResponse($resArray["AVSADDR"])."<br />";
|
||||
}
|
||||
if(isset($resArray["AVSZIP"])) {
|
||||
$extraNotes .= "<strong>Zip/Post Code:</strong> ".basicResponse($resArray["AVSZIP"])."<br />";
|
||||
}
|
||||
|
||||
if(isset($resArray["AUTHCODE"])) {
|
||||
$extraNotes .= "<strong>Auth code:</strong> ".basicResponse($resArray["AUTHCODE"])."<br />";
|
||||
}
|
||||
|
||||
if(isset($resArray["CVV2MATCH"])) {
|
||||
$extraNotes .= "<strong>CVV2 Match:</strong> ".basicResponse($resArray["CVV2MATCH"])."<br />";
|
||||
}
|
||||
if(isset($resArray["IAVS"])) {
|
||||
$extraNotes .= "<strong>International AVS address response:</strong> ".basicResponse($resArray["IAVS"])."<br />";
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
if (!defined('CC_INI_SET')) die("Access Denied");
|
||||
|
||||
require_once 'CallerService.php';
|
||||
|
||||
session_start();
|
||||
|
||||
$nvpStr = "&ACTION[1]=D".
|
||||
"&TOKEN[".strlen($_SESSION['token'])."]=".$_SESSION['token'].
|
||||
"&PAYERID[".strlen($_SESSION['payer_id'])."]=".$_SESSION['payer_id'].
|
||||
"&AMT[".strlen($orderSum['prod_total'])."]=".$orderSum['prod_total'].
|
||||
"&INVNUM[".strlen($_GET['cart_order_id'])."]=".$_GET['cart_order_id'];
|
||||
|
||||
$BUTTONSOURCE = "CubeCart_Cart_PRO2EC";
|
||||
|
||||
$nvpStr.="&BUTTONSOURCE[".strlen($BUTTONSOURCE)."]=".$BUTTONSOURCE;
|
||||
|
||||
$TRXTYPE = $module['paymentAction'] == "Sale" ? "S" : "A";
|
||||
|
||||
$request_id = md5($_SESSION['payer_id'].$orderSum['prod_total'].$_SESSION['token'].date('YmdGis')."1");
|
||||
|
||||
$resArray = hash_call("P",$TRXTYPE,$nvpStr,$request_id);
|
||||
|
||||
$ack = $resArray["RESULT"] == 0 ? "SUCCESS" : "FAIL";
|
||||
|
||||
$transData['customer_id'] = $orderSum["customer_id"];
|
||||
$transData['gateway'] = "PayPal Website Payments Pro (".$_SESSION['paymentType'].")";
|
||||
$transData['extra'] = "P";
|
||||
$transData['trans_id'] = $resArray['PNREF'];
|
||||
$transData['order_id'] = $_GET['cart_order_id'];
|
||||
$transData['amount'] = $orderSum['prod_total'];
|
||||
$transData['status'] = $ack;
|
||||
|
||||
include("responseCodes.php");
|
||||
|
||||
if(isset($resArray["AVSADDR"])) {
|
||||
$extraNotes .= "Address: ".basicResponse($resArray["AVSADDR"]).", ";
|
||||
}
|
||||
if(isset($resArray["AVSZIP"])) {
|
||||
$extraNotes .= "Zip/Post Code: ".basicResponse($resArray["AVSZIP"]).", ";
|
||||
}
|
||||
|
||||
$extraNotes = substr($extraNotes0,-2);
|
||||
|
||||
if(strlen($extraNotes>5)) {
|
||||
$extraNotes = substr($extraNotes0,-2).".";
|
||||
}
|
||||
|
||||
$transData['notes'] = "Successful transaction via PayPal Express Checkout. Payer status is '".strtolower($_SESSION['PAYERSTATUS'])."'. ".$extraNotes;
|
||||
$order->storeTrans($transData);
|
||||
|
||||
if($ack=="SUCCESS"){
|
||||
// Sale = Funds taken immediately otherwise they may be taken later
|
||||
$orderStatus = ($_SESSION['paymentType'] == "Sale") ? 3 : 2; // 3 is payment complete, 2 is processing
|
||||
|
||||
$paymentResult = ($_SESSION['paymentType'] == "Sale") ? 2 : 3; // Just to confuse matter Al you plonker!! 2 = money taken 3 = money not yet taken (Athorized)
|
||||
|
||||
$order->orderStatus($orderStatus,$_GET['cart_order_id']);
|
||||
} else {
|
||||
$paymentResult = 1;
|
||||
}
|
||||
|
||||
session_unset();
|
||||
?>
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
if (!defined('CC_INI_SET')) die("Access Denied");
|
||||
|
||||
require_once 'CallerService.php';
|
||||
|
||||
$pppro = $db->select(sprintf("SELECT min(`id`), trans_id FROM `%sCubeCart_transactions` WHERE order_id = %s and `status` = 'SUCCESS' GROUP BY `id`",$glob['dbprefix'],$db->MySQLSafe($order_id)));
|
||||
|
||||
$authorizationID=urlencode(trim($_POST['authorizationID']));
|
||||
|
||||
$amount=urlencode(trim($_POST['amount']));
|
||||
|
||||
$currency=urlencode($config['defaultCurrency']);
|
||||
|
||||
$nvpStr="&AUTHORIZATIONID[".strlen($authorizationID)."]=".$authorizationID."&AMT[".strlen($amount)."]=".$amount."&CURRENCYCODE[".strlen($currency)."]=".$currency;
|
||||
|
||||
$resArray=hash_call("DoReauthorization",$nvpStr);
|
||||
|
||||
$ack = strtoupper($resArray["ACK"]);
|
||||
|
||||
if($ack!=="SUCCESS"){
|
||||
$transNotes = $resArray['L_LONGMESSAGE0'];
|
||||
$ppMsg = "<p class='warnText' id='ppresult'>".$resArray['L_LONGMESSAGE0']."</p>";
|
||||
} else {
|
||||
$transNotes = priceFormat($_POST['amount'],true)." of authorization ID ".$_POST['authorizationID']." reauthorized successfully.";
|
||||
$ppMsg = "<p class='infoText' id='ppresult'>".$transNotes."</p>";
|
||||
}
|
||||
|
||||
$transData['customer_id'] = $orderSum[0]["customer_id"];
|
||||
$transData['gateway'] = "PayPal Website Payments Pro (DoAuthorization)";
|
||||
$transData['extra'] = $_POST['TENDER'];
|
||||
$transData['trans_id'] = $resArray['AUTHORIZATIONID'];
|
||||
$transData['order_id'] = $orderSum[0]['cart_order_id'];
|
||||
$transData['amount'] = trim($_POST['amount']);
|
||||
$transData['status'] = $ack;
|
||||
$transData['notes'] = $transNotes;
|
||||
$order->storeTrans($transData);
|
||||
?>
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
if (!defined('CC_INI_SET')) die("Access Denied");
|
||||
|
||||
require_once 'CallerService.php';
|
||||
|
||||
$authorizationID = trim($_POST['authorization_id']);
|
||||
$note = trim($_POST['note']);
|
||||
|
||||
$nvpStr="&ORIGID[".strlen($authorizationID)."]=".$authorizationID;
|
||||
$nvpStr.="&NOTE[".strlen($note)."]=".$note;
|
||||
|
||||
$request_id = md5($authorizationID.date('YmdGis')."1");
|
||||
|
||||
$resArray = hash_call($_POST['TENDER'],"V",$nvpStr,$request_id);
|
||||
|
||||
$ack = $resArray["RESULT"] == 0 ? "SUCCESS" : "FAIL";
|
||||
|
||||
if($ack!=="SUCCESS"){
|
||||
$errorMsg = paypalErrors($resArray);
|
||||
$transNotes = "<strong>Error:</strong> ".$errorMsg["admin"]."<br /><strong>PayPal Response:</strong> ".$errorMsg["paypal"];
|
||||
$ppMsg = "<p class='warnText' id='ppresult'>".nl2br($transNotes)."</p>";
|
||||
} else {
|
||||
$transNotes = "Authorization ".$_POST['authorization_id']." has been void.";
|
||||
$ppMsg = "<p class='infoText' id='ppresult'>".$transNotes."</p>";
|
||||
}
|
||||
|
||||
$transData['customer_id'] = $orderSum[0]["customer_id"];
|
||||
$transData['gateway'] = "PayPal Website Payments Pro (DoVoid)";
|
||||
$transData['extra'] = $_POST['TENDER'];
|
||||
$transData['trans_id'] = $authorizationID;
|
||||
$transData['order_id'] = $orderSum[0]['cart_order_id'];
|
||||
$transData['amount'] = "";
|
||||
$transData['status'] = $ack;
|
||||
$transData['notes'] = $transNotes;
|
||||
$order->storeTrans($transData);
|
||||
?>
|
||||
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
if (!defined('CC_INI_SET')) die("Access Denied");
|
||||
session_start();
|
||||
|
||||
$_SESSION['token'] = $_REQUEST['token'];
|
||||
$_SESSION['payer_id'] = $_REQUEST['PayerID'];
|
||||
|
||||
$_SESSION['paymentAmount'] = $_REQUEST['paymentAmount'];
|
||||
$_SESSION['currCodeType'] = $_REQUEST['currencyCodeType'];
|
||||
$_SESSION['paymentType'] = $_REQUEST['paymentType'];
|
||||
|
||||
$resArray = $_SESSION['reshash'];
|
||||
|
||||
if(!isset($resArray["SHIPTOSTATE"])) {
|
||||
session_unset();
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$customer = $db->select("SELECT `customer_id` FROM ".$glob['dbprefix']."CubeCart_customer WHERE `email` = ".$db->MySQLSafe($resArray['EMAIL']));
|
||||
|
||||
$countryId = getCountryFormat($resArray["SHIPTOCOUNTRY"],"iso","id");
|
||||
|
||||
$state = $db->select("SELECT `name` FROM ".$glob['dbprefix']."CubeCart_iso_counties WHERE `name` = ".$db->MySQLSafe($resArray["SHIPTOSTATE"])." AND `countryId` = '".$countryId."'");
|
||||
|
||||
if($state==true) {
|
||||
$stateName = $state[0]['name'];
|
||||
} else {
|
||||
$stateName = $resArray["SHIPTOSTATE"];
|
||||
}
|
||||
|
||||
$customerData['title'] = $db->MySQLSafe("");
|
||||
$customerData['firstName'] = $db->MySQLSafe($resArray["FIRSTNAME"]);
|
||||
$customerData['lastName'] = $db->MySQLSafe($resArray["LASTNAME"]);
|
||||
$customerData['add_1'] = $db->MySQLSafe($resArray["SHIPTOSTREET"]);
|
||||
$customerData['add_2'] = $db->MySQLSafe($resArray["SHIPTOSTREET2"]);
|
||||
$customerData['town'] = $db->MySQLSafe($resArray["SHIPTOCITY"]);
|
||||
$customerData['county'] = $db->MySQLSafe($stateName);
|
||||
$customerData['postcode'] = $db->MySQLSafe($resArray["SHIPTOZIP"]);
|
||||
$customerData['country'] = $db->MySQLSafe($countryId);
|
||||
$customerData['phone'] = $db->MySQLSafe("");
|
||||
|
||||
|
||||
if($customer==TRUE) {
|
||||
$db->update($glob['dbprefix']."CubeCart_customer",$customerData,"`email` = ".$db->MySQLSafe($resArray['EMAIL']));
|
||||
$customer_id = $customer[0]['customer_id'];
|
||||
} else {
|
||||
|
||||
// added insert data
|
||||
$password = randomPass(6);
|
||||
$customerData['password'] = $db->MySQLSafe(md5($password));
|
||||
$customerData['email'] = $db->MySQLSafe($resArray['EMAIL']);
|
||||
$customerData['regTime'] = $db->MySQLSafe(time());
|
||||
$customerData['ipAddress'] = $db->MySQLSafe(get_ip_address()); // this will be googles IP :-/
|
||||
// ghost membership
|
||||
$customerData['type'] = $db->MySQLSafe(2);
|
||||
|
||||
$db->insert($glob['dbprefix']."CubeCart_customer",$customerData);
|
||||
$customer_id = $db->insertid();
|
||||
|
||||
// send welcome email
|
||||
if($module['welcomeEmail'] == 1) {
|
||||
$emailLang = getLang("email.inc.php");
|
||||
|
||||
include(CC_ROOT_DIR.CC_DS."classes".CC_DS."htmlMimeMail".CC_DS."htmlMimeMail.php");
|
||||
$lang = getLang("email.inc.php");
|
||||
$mail = new htmlMimeMail();
|
||||
|
||||
$macroArray = array(
|
||||
"CUSTOMER_NAME" => sanitizeVar($resArray["FIRSTNAME"])." ".sanitizeVar($resArray["LASTNAME"]),
|
||||
"EMAIL" => sanitizeVar($resArray['EMAIL']),
|
||||
##"PASSWORD" => sanitizeVar((isset($randomPass)) ? $randomPass : $_POST['password']),
|
||||
"PASSWORD" => $password,
|
||||
"STORE_URL" => $GLOBALS['storeURL'],
|
||||
"SENDER_IP" => get_ip_address()
|
||||
);
|
||||
|
||||
$text = macroSub($lang['email']['new_reg_body'],$macroArray);
|
||||
unset($macroArray);
|
||||
|
||||
$mail->setText($text);
|
||||
$mail->setFrom($config['masterName'].' <'.$config['masterEmail'].'>');
|
||||
$mail->setSubject($lang['email']['new_reg_subject']);
|
||||
$mail->setHeader('X-Mailer', 'CubeCart Mailer');
|
||||
$mail->send(array(sanitizeVar($resArray['EMAIL'])), $config['mailMethod']);
|
||||
}
|
||||
|
||||
}
|
||||
## Add Customer ID to session data
|
||||
$data['customer_id'] = $customer_id;
|
||||
$update = $db->update($glob['dbprefix']."CubeCart_sessions", $data,"sessId=".$db->mySQLSafe($_COOKIE[CC_SESSION_NAME]));
|
||||
header("Location: index.php?_g=co&_a=step2");
|
||||
exit;
|
||||
?>
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
if (!defined('CC_INI_SET')) die("Access Denied");
|
||||
|
||||
require_once 'CallerService.php';
|
||||
|
||||
$ORIGID = trim($_POST['transactionId']);
|
||||
|
||||
$amount = sprintf("%.2f",trim($_POST['amount']));
|
||||
$refundType = $amount == $orderSum[0]['prod_total'] ? "FULL" : "PARTIAL";
|
||||
$memo = trim($_POST['note']);
|
||||
$nvpStr = "&ORIGID[".strlen($ORIGID)."]=".$ORIGID."&MEMO[".strlen($memo)."]=".$memo;
|
||||
|
||||
if($refundType=="PARTIAL") $nvpStr .= "&AMT[".strlen($amount)."]=".$amount;
|
||||
|
||||
$request_id = md5($_POST['transactionId'].date('YmdGis')."1");
|
||||
|
||||
$resArray = hash_call($_POST['TENDER'],"C",$nvpStr,$request_id);
|
||||
|
||||
$ack = $resArray["RESULT"] == 0 ? "SUCCESS" : "FAIL";
|
||||
|
||||
if($ack!=="SUCCESS"){
|
||||
$errorMsg = paypalErrors($resArray);
|
||||
$transNotes = "<strong>Error:</strong> ".$errorMsg["admin"]."<br /><strong>PayPal Response:</strong> ".$errorMsg["paypal"];
|
||||
$ppMsg = "<p class='warnText' id='ppresult'>".nl2br($transNotes)."</p>";
|
||||
} else {
|
||||
$transNotes = ucfirst(strtolower($refundType))." Refund of ".priceFormat($amount,true)." successful.";
|
||||
|
||||
$ppMsg = "<p class='infoText' id='ppresult'>".$transNotes."</p>";
|
||||
$db->misc("UPDATE ".$glob['dbprefix']."CubeCart_transactions SET `remainder` = `remainder` + ".$amount." WHERE `id` = '".$_POST['id']."';");
|
||||
}
|
||||
|
||||
$transData['customer_id'] = $orderSum[0]["customer_id"];
|
||||
$transData['gateway'] = "PayPal Website Payments Pro (DoRefund)";
|
||||
$transData['extra'] = $_POST['TENDER'];
|
||||
$transData['trans_id'] = $resArray['PNREF'];
|
||||
$transData['order_id'] = $orderSum[0]['cart_order_id'];
|
||||
$transData['amount'] = $amount;
|
||||
$transData['status'] = $ack;
|
||||
$transData['notes'] = $transNotes;
|
||||
$order->storeTrans($transData);
|
||||
?>
|
||||
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
if (!defined('CC_INI_SET')) die("Access Denied");
|
||||
|
||||
require_once 'CallerService.php';
|
||||
|
||||
require_once 'constants.php';
|
||||
|
||||
session_start();
|
||||
|
||||
$token = $_REQUEST['token'];
|
||||
$TRXTYPE = $module['paymentAction'] == "Sale" ? "S" : "A";
|
||||
|
||||
if(!isset($token)) {
|
||||
|
||||
$parts = explode(",",base64_decode($_GET['ccb']));
|
||||
$paymentAmount = $parts[0];
|
||||
$currencyCodeType = $parts[1];
|
||||
$paymentType = $module['paymentAction'];
|
||||
|
||||
$returnURL = $glob['storeURL'].'/index.php?_g=rm&type=altCheckout&cmd=process&module=PayPal_Pro¤cyCodeType='.$currencyCodeType.'&paymentType='.$paymentType.'&paymentAmount='.$paymentAmount;
|
||||
|
||||
$cancelURL = $glob['storeURL']."/index.php?_g=rm&type=altCheckout&cmd=process&module=PayPal_Pro&paymentType=".$paymentType;
|
||||
|
||||
$AMT = sprintf("%.2f",$paymentAmount);
|
||||
|
||||
$nvpStr = "&ACTION[1]=S".
|
||||
"&AMT[".strlen($AMT)."]=".$AMT.
|
||||
"&RETURNURL[".strlen($returnURL)."]=".$returnURL.
|
||||
"&CANCELURL[".strlen($cancelURL)."]=".$cancelURL;
|
||||
|
||||
if($module['confAddress']==1) {
|
||||
$nvpStr.="&REQCONFIRMSHIPPING[1]=1";
|
||||
} else {
|
||||
$nvpStr.="&REQCONFIRMSHIPPING[1]=0";
|
||||
}
|
||||
|
||||
$BUTTONSOURCE = "CubeCart_Cart_PRO2EC";
|
||||
|
||||
$nvpStr.="&BUTTONSOURCE[".strlen($BUTTONSOURCE)."]=".$BUTTONSOURCE;
|
||||
$request_id = md5($_POST['ACCT'].$paymentAmount.date('YmdGis')."1");
|
||||
//$resArray = hash_call("SetExpressCheckout",$nvpStr);
|
||||
$resArray = hash_call("P",$TRXTYPE,$nvpStr,$request_id);
|
||||
|
||||
$_SESSION['reshash'] = $resArray;
|
||||
|
||||
if($resArray["RESULT"]==0){
|
||||
// Redirect to paypal.com here
|
||||
$token = urldecode($resArray["TOKEN"]);
|
||||
$payPalURL = PAYPAL_URL.$token;
|
||||
header("Location: ".$payPalURL);
|
||||
exit;
|
||||
} else {
|
||||
include("APIError.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
$nvpStr = "&ACTION[1]=G&TOKEN[".strlen($token)."]=".$token;
|
||||
$request_id = md5($token.date('YmdGis')."1");
|
||||
//$resArray=hash_call("GetExpressCheckoutDetails",$nvpStr);
|
||||
$resArray = hash_call("P",$TRXTYPE,$nvpStr,$request_id);
|
||||
|
||||
$_SESSION['reshash']=$resArray;
|
||||
$_SESSION['PAYERSTATUS'] = $resArray['PAYERSTATUS'];
|
||||
|
||||
if($resArray["RESULT"]==0){
|
||||
require_once "GetExpressCheckoutDetails.php";
|
||||
exit;
|
||||
} else {
|
||||
include("APIError.php");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
if (!defined('CC_INI_SET')) die("Access Denied");
|
||||
|
||||
define('USER', $module['user']);
|
||||
define('PWD', $module['pass']);
|
||||
define('VENDOR', $module['vendor']);
|
||||
define('PARTNER', $module['partner']);
|
||||
|
||||
if($module['gateway']==1){ ## LIVE MODE
|
||||
|
||||
define('API_ENDPOINT', 'https://payflowpro.verisign.com/transaction:443/');
|
||||
define('PAYPAL_URL', 'https://www.paypal.com/webscr&cmd=_express-checkout&token=');
|
||||
} else { ## SANDBOX MODE
|
||||
define('API_ENDPOINT', 'https://pilot-payflowpro.verisign.com/transaction:443/');
|
||||
//define('API_ENDPOINT', 'https://test-payflow.verisign.com/transaction:443/');
|
||||
define('PAYPAL_URL', 'https://www.sandbox.paypal.com/webscr&cmd=_express-checkout&token=');
|
||||
}
|
||||
|
||||
if($config['proxy']==1){
|
||||
define('USE_PROXY', true);
|
||||
define('PROXY_HOST', $config['proxyHost']);
|
||||
define('PROXY_PORT', $config['proxyPort']);
|
||||
} else {
|
||||
define('USE_PROXY', false);
|
||||
define('PROXY_HOST', '127.0.0.1');
|
||||
define('PROXY_PORT', '808');
|
||||
}
|
||||
|
||||
if($module['debug']==true) {
|
||||
define("PAYPAL_DEBUG", true);
|
||||
} else {
|
||||
define("PAYPAL_DEBUG", false);
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1 @@
|
||||
Access Denied
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
function basicResponse($in) {
|
||||
|
||||
switch ($in) {
|
||||
|
||||
case "Y":
|
||||
|
||||
$out = "Matches.";
|
||||
|
||||
break;
|
||||
|
||||
case "N":
|
||||
$out = "Does not match.";
|
||||
break;
|
||||
|
||||
case "X":
|
||||
$out = "The cardholder’s bank does not support this service.";
|
||||
break;
|
||||
|
||||
default:
|
||||
$out = "No Response.";
|
||||
break;
|
||||
}
|
||||
|
||||
return $out;
|
||||
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
/*************************************************
|
||||
APIError.php
|
||||
|
||||
Displays error parameters.
|
||||
|
||||
Called by DoDirectPaymentReceipt.php, TransactionDetails.php,
|
||||
GetExpressCheckoutDetails.php and DoExpressCheckoutPayment.php.
|
||||
|
||||
*************************************************/
|
||||
if (!defined('CC_INI_SET')) die("Access Denied");
|
||||
session_start();
|
||||
$resArray=$_SESSION['reshash'];
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<title>PayPal PHP API Response</title>
|
||||
<link href="sdk.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
|
||||
<body alink=#0000FF vlink=#0000FF>
|
||||
|
||||
<center>
|
||||
|
||||
<table width="700">
|
||||
<tr>
|
||||
<td colspan="2"><h3>The PayPal API has returned an error!</h3></td>
|
||||
</tr>
|
||||
|
||||
<?php //it will print if any URL errors
|
||||
if(isset($_SESSION['curl_error_no'])) {
|
||||
$errorCode = $_SESSION['curl_error_no'] ;
|
||||
$errorMessage = $_SESSION['curl_error_msg'] ;
|
||||
?>
|
||||
|
||||
|
||||
<tr>
|
||||
<td><strong>Error Number:</strong></td>
|
||||
<td><?php $errorCode ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Error Message:</strong></td>
|
||||
<td><?php $errorMessage ?></td>
|
||||
</tr>
|
||||
<?php } else {
|
||||
|
||||
/* If there is no URL Errors, Construct the HTML page with
|
||||
Response Error parameters.
|
||||
*/
|
||||
?>
|
||||
|
||||
<td><strong>Ack:</strong></td>
|
||||
<td><?php $resArray['ACK']; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Correlation ID:</strong></td>
|
||||
<td><?php $resArray['CORRELATIONID']; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Version:</strong></td>
|
||||
<td><?php $resArray['VERSION']; ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
$count=0;
|
||||
while (isset($resArray["L_SHORTMESSAGE".$count])) {
|
||||
$errorCode = $resArray["L_ERRORCODE".$count];
|
||||
$shortMessage = $resArray["L_SHORTMESSAGE".$count];
|
||||
$longMessage = $resArray["L_LONGMESSAGE".$count];
|
||||
$count=$count+1;
|
||||
?>
|
||||
<tr>
|
||||
<td><strong>Error Number:</strong></td>
|
||||
<td><?php $errorCode; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Short Message:</strong></td>
|
||||
<td><?php $shortMessage; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Long Message:</strong></td>
|
||||
<td><?php $longMessage; ?></td>
|
||||
</tr>
|
||||
|
||||
<?php }//end while
|
||||
}// end else
|
||||
?>
|
||||
</table>
|
||||
<a class="home" id="CallsLink" href="index.php">Home</a>
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
session_unset();
|
||||
exit;
|
||||
?>
|
||||
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
/****************************************************
|
||||
CallerService.php
|
||||
|
||||
This file uses the constants.php to get parameters needed
|
||||
to make an API call and calls the server.if you want use your
|
||||
own credentials, you have to change the constants.php
|
||||
|
||||
Called by TransactionDetails.php, ReviewOrder.php,
|
||||
DoDirectPaymentReceipt.php and DoExpressCheckoutPayment.php.
|
||||
|
||||
****************************************************/
|
||||
if (!defined('CC_INI_SET')) die("Access Denied");
|
||||
require_once 'constants.php';
|
||||
|
||||
$API_UserName=API_USERNAME;
|
||||
$API_Password=API_PASSWORD;
|
||||
$API_Signature=API_SIGNATURE;
|
||||
$API_Endpoint =API_ENDPOINT;
|
||||
$version=VERSION;
|
||||
|
||||
session_start();
|
||||
|
||||
/**
|
||||
* hash_call: Function to perform the API call to PayPal using API signature
|
||||
* @methodName is name of API method.
|
||||
* @nvpStr is nvp string.
|
||||
* returns an associtive array containing the response from the server.
|
||||
*/
|
||||
function pp_debug($nvpreq,$response) {
|
||||
|
||||
// sanitize string
|
||||
$filename = "modules".CC_DS."altCheckout".CC_DS."PayPal_Pro".CC_DS."logs".CC_DS.'PayPal-NVP-US-Log-'.date("Ymd");
|
||||
$content = "=== ".date("r")." ===\n";
|
||||
$content .= "NVP String:\n".$nvpreq."\n--------------------\n";
|
||||
$content .= "cURL Response:\n".$response."\n=======================================\n\n\n\n";
|
||||
|
||||
$handle = @fopen($filename, 'a');
|
||||
@fwrite($handle, $content);
|
||||
@fclose($handle);
|
||||
}
|
||||
|
||||
function hash_call($methodName,$nvpStr) {
|
||||
//declaring of global variables
|
||||
global $API_Endpoint,$version,$API_UserName,$API_Password,$API_Signature;
|
||||
|
||||
//setting the curl parameters.
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL,$API_Endpoint);
|
||||
curl_setopt($ch, CURLOPT_VERBOSE, 1);
|
||||
|
||||
//turning off the server and peer verification(TrustManager Concept).
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
|
||||
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
//if USE_PROXY constant set to TRUE in Constants.php, then only proxy will be enabled.
|
||||
//Set proxy name to PROXY_HOST and port number to PROXY_PORT in constants.php
|
||||
if(USE_PROXY)
|
||||
curl_setopt ($ch, CURLOPT_PROXY, PROXY_HOST.":".PROXY_PORT);
|
||||
|
||||
//NVPRequest for submitting to server
|
||||
$nvpreq = "METHOD=".urlencode($methodName).
|
||||
"&VERSION=".urlencode($version).
|
||||
"&PWD=".urlencode($API_Password).
|
||||
"&USER=".urlencode($API_UserName).
|
||||
"&SIGNATURE=".urlencode($API_Signature).$nvpStr;
|
||||
|
||||
//setting the nvpreq as POST FIELD to curl
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq);
|
||||
|
||||
//getting response from server
|
||||
$response = curl_exec($ch);
|
||||
|
||||
if(PAYPAL_DEBUG==true) {
|
||||
pp_debug($nvpreq,$response);
|
||||
}
|
||||
|
||||
//convrting NVPResponse to an Associative Array
|
||||
$nvpResArray=deformatNVP($response);
|
||||
$nvpReqArray=deformatNVP($nvpreq);
|
||||
$_SESSION['nvpReqArray']=$nvpReqArray;
|
||||
|
||||
if (curl_errno($ch)) {
|
||||
switch (curl_errno($ch)) {
|
||||
case 18:
|
||||
break;
|
||||
default:
|
||||
echo "<strong>Curl Error No:</strong> ".curl_errno($ch)."<br />For further info please see: <a href='http://curl.haxx.se/libcurl/c/libcurl-errors.html'>http://curl.haxx.se/libcurl/c/libcurl-errors.html</a>";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
curl_close($ch);
|
||||
return $nvpResArray;
|
||||
}
|
||||
|
||||
/** This function will take NVPString and convert it to an Associative Array and it will decode the response.
|
||||
* It is usefull to search for a particular key and displaying arrays.
|
||||
* @nvpstr is NVPString.
|
||||
* @nvpArray is Associative Array.
|
||||
*/
|
||||
|
||||
function deformatNVP($nvpStr)
|
||||
{
|
||||
|
||||
$intial=0;
|
||||
$nvpArray = array();
|
||||
|
||||
|
||||
while(strlen($nvpStr)){
|
||||
//postion of Key
|
||||
$keypos= strpos($nvpStr,'=');
|
||||
//position of value
|
||||
$valuepos = strpos($nvpStr,'&') ? strpos($nvpStr,'&'): strlen($nvpStr);
|
||||
|
||||
/*getting the Key and Value values and storing in a Associative Array*/
|
||||
$keyval=substr($nvpStr,$intial,$keypos);
|
||||
$valval=substr($nvpStr,$keypos+1,$valuepos-$keypos-1);
|
||||
//decoding the respose
|
||||
$nvpArray[urldecode($keyval)] =urldecode( $valval);
|
||||
$nvpStr=substr($nvpStr,$valuepos+1,strlen($nvpStr));
|
||||
}
|
||||
return $nvpArray;
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
if (!defined('CC_INI_SET')) die("Access Denied");
|
||||
|
||||
require_once 'CallerService.php';
|
||||
|
||||
$pppro = $db->select(sprintf("SELECT min(`id`), trans_id FROM `%sCubeCart_transactions` WHERE order_id = %s and `status` = 'SUCCESS' GROUP BY `id`",$glob['dbprefix'],$db->MySQLSafe($order_id)));
|
||||
|
||||
$authorizationID = urlencode(trim($_POST['authorizationID']));
|
||||
$completeCodeType = urlencode(trim($_POST['CompleteCodeType']));
|
||||
$amount = urlencode(trim($_POST['amount']));
|
||||
$invoiceID = urlencode($order_id);
|
||||
$currency = urlencode($config['defaultCurrency']);
|
||||
$note = urlencode(trim($_POST['note']));
|
||||
|
||||
$nvpStr = "&AUTHORIZATIONID=$authorizationID&AMT=$amount&COMPLETETYPE=$completeCodeType&CURRENCYCODE=$currency&NOTE=$note";
|
||||
|
||||
$resArray = hash_call("DOCapture",$nvpStr);
|
||||
|
||||
$ack = strtoupper($resArray["ACK"]);
|
||||
|
||||
if($ack!=="SUCCESS"){
|
||||
$transNotes = $resArray['L_LONGMESSAGE0'];
|
||||
$ppMsg = "<p class='warnText' id='ppresult'>".$resArray['L_LONGMESSAGE0']."</p>";
|
||||
} else {
|
||||
$transNotes = priceFormat(trim($_POST['amount']),true)." of authorization ID ".$_POST['authorizationID']." captured successfully.";
|
||||
$ppMsg = "<p class='infoText' id='ppresult'>".$transNotes."</p>";
|
||||
// Update balance (remainder)
|
||||
if($_POST['CompleteCodeType'] == "Complete"){
|
||||
$query = "UPDATE ".$glob['dbprefix']."CubeCart_transactions SET `remainder` = `amount` WHERE `id` = '".$_POST['id']."';";
|
||||
$db->misc($query);
|
||||
$transNotes .= " Final capture complete.";
|
||||
} else {
|
||||
$query = "UPDATE ".$glob['dbprefix']."CubeCart_transactions SET `remainder` = `remainder` + ".$resArray['AMT']." WHERE `id` = '".$_POST['id']."';";
|
||||
$db->misc($query);
|
||||
}
|
||||
}
|
||||
|
||||
$transData['customer_id'] = $orderSum[0]["customer_id"];
|
||||
$transData['gateway'] = "PayPal Website Payments Pro (DoCapture)";
|
||||
$transData['extra'] = $_POST['TENDER'];
|
||||
$transData['trans_id'] = $resArray['TRANSACTIONID'];
|
||||
$transData['order_id'] = $orderSum[0]['cart_order_id'];
|
||||
$transData['amount'] = $resArray['AMT'];
|
||||
$transData['status'] = $ack;
|
||||
$transData['notes'] = $transNotes;
|
||||
$order->storeTrans($transData);
|
||||
?>
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
if (!defined('CC_INI_SET')) die("Access Denied");
|
||||
|
||||
|
||||
require_once 'CallerService.php';
|
||||
|
||||
// Order is Express Checkkout Only
|
||||
if($module['paymentAction'] == "Order") {
|
||||
$module['paymentAction'] = "Authorization";
|
||||
}
|
||||
|
||||
$paymentType = urlencode($module['paymentAction']);
|
||||
$firstName = urlencode(trim($_POST['firstName']));
|
||||
$lastName = urlencode(trim($_POST['lastName']));
|
||||
$creditCardType = urlencode(trim($_POST['cardType']));
|
||||
$creditCardNumber = urlencode(trim($_POST['cardNumber']));
|
||||
$expDateMonth = urlencode(trim($_POST['expirationMonth']));
|
||||
$expDateYear = urlencode(trim($_POST['expirationYear']));
|
||||
$cvv2Number = urlencode(trim($_POST['cvc2']));
|
||||
$address1 = urlencode(trim($_POST['addr1']));
|
||||
$address2 = urlencode(trim($_POST['addr2']));
|
||||
$city = urlencode(trim($_POST['city']));
|
||||
$state = urlencode(trim($_POST['state']));
|
||||
$zip = urlencode(trim($_POST['postalCode']));
|
||||
$amount = urlencode(sprintf("%.2f",$orderSum['prod_total']));
|
||||
$currencyCode = urlencode($config['defaultCurrency']);
|
||||
$countryCode = urlencode(trim($_POST['country']));
|
||||
$ipAddress = urlencode(trim(get_ip_address()));
|
||||
$padDateMonth = str_pad($expDateMonth, 2, '0', STR_PAD_LEFT);
|
||||
|
||||
$nvpStr =
|
||||
"&PAYMENTACTION=".$paymentType
|
||||
."&AMT=".$amount
|
||||
."&CREDITCARDTYPE=".$creditCardType
|
||||
."&ACCT=".$creditCardNumber
|
||||
."&EXPDATE=".$padDateMonth.$expDateYear
|
||||
."&CVV2=".$cvv2Number
|
||||
."&FIRSTNAME=".$firstName
|
||||
."&LASTNAME=".$lastName
|
||||
."&STREET=".$address1
|
||||
."&CITY=".$city
|
||||
."&STATE=".$state
|
||||
."&ZIP=".$zip
|
||||
."&COUNTRYCODE=".$countryCode
|
||||
."&CURRENCYCODE=".$currencyCode
|
||||
."&IPADDRESS=".$ipAddress
|
||||
.="&BUTTONSOURCE=CubeCart_Cart_DP_US";
|
||||
|
||||
$resArray=hash_call("doDirectPayment",$nvpStr);
|
||||
|
||||
$ack = strtoupper($resArray["ACK"]);
|
||||
|
||||
$errorMsg['customer'] = $resArray["L_LONGMESSAGE0"];
|
||||
?>
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
if (!defined('CC_INI_SET')) die("Access Denied");
|
||||
|
||||
require_once 'CallerService.php';
|
||||
|
||||
session_start();
|
||||
|
||||
$token =urlencode($_SESSION['token']);
|
||||
|
||||
$paymentAmount = urlencode($orderSum['prod_total']);
|
||||
$paymentType = urlencode($_SESSION['paymentType']);
|
||||
$currCodeType = urlencode($_SESSION['currCodeType']);
|
||||
$payerID = urlencode($_SESSION['payer_id']);
|
||||
$serverName = urlencode($_SERVER['SERVER_NAME']);
|
||||
|
||||
$nvpStr='&TOKEN='.$token.'&PAYERID='.$payerID.'&PAYMENTACTION='.$paymentType.'&AMT='.$paymentAmount.'&CURRENCYCODE='.$currCodeType.'&IPADDRESS='.$serverName.'&INVNUM='.$_GET['cart_order_id'] ;
|
||||
|
||||
$nvpStr.="&BUTTONSOURCE=CubeCart_Cart_EC_US";
|
||||
|
||||
$resArray=hash_call("DoExpressCheckoutPayment",$nvpStr);
|
||||
|
||||
$ack = strtoupper($resArray["ACK"]);
|
||||
|
||||
$transData['customer_id'] = $orderSum["customer_id"];
|
||||
$transData['gateway'] = "PayPal Website Payments Pro (".$paymentType.")";
|
||||
$transData['extra'] = "P";
|
||||
$transData['trans_id'] = $resArray['TRANSACTIONID'];
|
||||
$transData['order_id'] = $_GET['cart_order_id'];
|
||||
$transData['amount'] = $orderSum['prod_total'];
|
||||
$transData['status'] = $ack;
|
||||
$transData['notes'] = "Successful transaction via PayPal Express Checkout. Buyers address '".strtolower($_SESSION['ADDRESSSTATUS'])."' and payer status is '".strtolower($_SESSION['PAYERSTATUS'])."'.";
|
||||
$order->storeTrans($transData);
|
||||
|
||||
if($ack=="SUCCESS"){
|
||||
// Sale = Funds taken immediately otherwise they may be taken later
|
||||
$orderStatus = ($paymentType == "Sale") ? 3 : 2; // 3 is payment complete, 2 is processing
|
||||
|
||||
$paymentResult = ($paymentType == "Sale") ? 2 : 3; // Just to confuse matter Al you plonker!! 2 = money taken 3 = money not yet taken (Athorized)
|
||||
|
||||
$order->orderStatus($orderStatus,$_GET['cart_order_id']);
|
||||
} else {
|
||||
$paymentResult = 1;
|
||||
}
|
||||
|
||||
session_unset();
|
||||
?>
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
if (!defined('CC_INI_SET')) die("Access Denied");
|
||||
|
||||
require_once 'CallerService.php';
|
||||
|
||||
$pppro = $db->select(sprintf("SELECT min(`id`), trans_id FROM `%sCubeCart_transactions` WHERE order_id = %s and `status` = 'SUCCESS' GROUP BY `id`",$glob['dbprefix'],$db->MySQLSafe($order_id)));
|
||||
|
||||
$authorizationID = urlencode(trim($_POST['authorizationID']));
|
||||
|
||||
$amount=urlencode(trim($_POST['amount']));
|
||||
|
||||
$currency=urlencode($config['defaultCurrency']);
|
||||
|
||||
if($ppfunction=="doReAuth") {
|
||||
$nvpStr = "&AUTHORIZATIONID=".$authorizationID."&AMT=$amount&CURRENCYCODE=$currency";
|
||||
$authMode = "DoReauthorization";
|
||||
$pre = "re";
|
||||
} else {
|
||||
$nvpStr = "&TRANSACTIONID=".$authorizationID."&AMT=$amount&CURRENCYCODE=$currency&TRANSACTIONENTITY=Order";
|
||||
$authMode = "DoAuthorization";
|
||||
$pre = "";
|
||||
}
|
||||
|
||||
$resArray=hash_call($authMode,$nvpStr);
|
||||
|
||||
$ack = strtoupper($resArray["ACK"]);
|
||||
|
||||
if($ack!=="SUCCESS"){
|
||||
$transNotes = $resArray['L_LONGMESSAGE0'];
|
||||
$ppMsg = "<p class='warnText' id='ppresult'>".$resArray['L_LONGMESSAGE0']."</p>";
|
||||
} else {
|
||||
$transNotes = priceFormat($_POST['amount'],true)." of ".$_POST['authorizationID']." ".$pre."authorized successfully.";
|
||||
$ppMsg = "<p class='infoText' id='ppresult'>".$transNotes."</p>";
|
||||
}
|
||||
|
||||
$transData['customer_id'] = $orderSum[0]["customer_id"];
|
||||
$transData['gateway'] = "PayPal Website Payments Pro (DoAuthorization)";
|
||||
$transData['extra'] = $_POST['TENDER'];
|
||||
$transData['trans_id'] = isset($resArray['TRANSACTIONID']) ? $resArray['TRANSACTIONID'] : $resArray['AUTHORIZATIONID'];
|
||||
$transData['order_id'] = $orderSum[0]['cart_order_id'];
|
||||
$transData['amount'] = trim($_POST['amount']);
|
||||
$transData['status'] = $ack;
|
||||
$transData['notes'] = $transNotes;
|
||||
$order->storeTrans($transData);
|
||||
?>
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
if (!defined('CC_INI_SET')) die("Access Denied");
|
||||
|
||||
require_once 'CallerService.php';
|
||||
|
||||
$authorizationID=urlencode(trim($_POST['authorization_id']));
|
||||
$note=urlencode(trim($_POST['note']));
|
||||
|
||||
$nvpStr="&AUTHORIZATIONID=$authorizationID&NOTE=$note";
|
||||
|
||||
$resArray=hash_call("DoVoid",$nvpStr);
|
||||
|
||||
$ack = strtoupper($resArray["ACK"]);
|
||||
|
||||
if($ack!=="SUCCESS"){
|
||||
$transNotes = $resArray['L_LONGMESSAGE0'];
|
||||
$ppMsg = "<p class='warnText' id='ppresult'>".$resArray['L_LONGMESSAGE0']."</p>";
|
||||
} else {
|
||||
$transNotes = "Authorization ".$_POST['authorization_id']." has been void.";
|
||||
$ppMsg = "<p class='infoText' id='ppresult'>".$transNotes."</p>";
|
||||
}
|
||||
|
||||
$transData['customer_id'] = $orderSum[0]["customer_id"];
|
||||
$transData['gateway'] = "PayPal Website Payments Pro (DoVoid)";
|
||||
$transData['extra'] = $_POST['TENDER'];
|
||||
$transData['trans_id'] = $_POST['authorization_id'];
|
||||
$transData['order_id'] = $orderSum[0]['cart_order_id'];
|
||||
$transData['amount'] = "";
|
||||
$transData['status'] = $ack;
|
||||
$transData['notes'] = $transNotes;
|
||||
$order->storeTrans($transData);
|
||||
?>
|
||||
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
if (!defined('CC_INI_SET')) die("Access Denied");
|
||||
session_start();
|
||||
|
||||
$_SESSION['token']=$_REQUEST['token'];
|
||||
$_SESSION['payer_id'] = $_REQUEST['PayerID'];
|
||||
|
||||
$_SESSION['paymentAmount'] = $_REQUEST['paymentAmount'];
|
||||
$_SESSION['currCodeType'] = $_REQUEST['currencyCodeType'];
|
||||
$_SESSION['paymentType'] = $_REQUEST['paymentType'];
|
||||
|
||||
$resArray = $_SESSION['reshash'];
|
||||
|
||||
if(!isset($resArray["SHIPTOSTATE"])) {
|
||||
session_unset();
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$customer = $db->select("SELECT `customer_id` FROM ".$glob['dbprefix']."CubeCart_customer WHERE `email` = ".$db->MySQLSafe($resArray['EMAIL']));
|
||||
|
||||
$countryId = getCountryFormat($resArray["SHIPTOCOUNTRYNAME"],"printable_name","id");
|
||||
|
||||
$state = $db->select("SELECT `name` FROM ".$glob['dbprefix']."CubeCart_iso_counties WHERE `abbrev` = ".$db->MySQLSafe($resArray["SHIPTOSTATE"])." AND `countryId` = ".$countryId);
|
||||
|
||||
if($state==true) {
|
||||
$stateName = $state[0]['name'];
|
||||
} else {
|
||||
$stateName = $resArray["SHIPTOSTATE"];
|
||||
}
|
||||
|
||||
$customerData['title'] = $db->MySQLSafe("");
|
||||
$customerData['firstName'] = $db->MySQLSafe($resArray["FIRSTNAME"]);
|
||||
$customerData['lastName'] = $db->MySQLSafe($resArray["LASTNAME"]);
|
||||
$customerData['add_1'] = $db->MySQLSafe($resArray["SHIPTOSTREET"]);
|
||||
$customerData['add_2'] = $db->MySQLSafe("");
|
||||
$customerData['town'] = $db->MySQLSafe($resArray["SHIPTOCITY"]);
|
||||
$customerData['county'] = $db->MySQLSafe($stateName);
|
||||
$customerData['postcode'] = $db->MySQLSafe($resArray["SHIPTOZIP"]);
|
||||
$customerData['country'] = $db->MySQLSafe($countryId);
|
||||
$customerData['phone'] = $db->MySQLSafe("");
|
||||
|
||||
|
||||
if($customer==TRUE) {
|
||||
$db->update($glob['dbprefix']."CubeCart_customer",$customerData,"`email` = ".$db->MySQLSafe($resArray['EMAIL']));
|
||||
$customer_id = $customer[0]['customer_id'];
|
||||
} else {
|
||||
|
||||
// added insert data
|
||||
$password = randomPass(6);
|
||||
$customerData['password'] = $db->MySQLSafe(md5($password));
|
||||
$customerData['email'] = $db->MySQLSafe($resArray['EMAIL']);
|
||||
$customerData['regTime'] = $db->MySQLSafe(time());
|
||||
$customerData['ipAddress'] = $db->MySQLSafe(get_ip_address()); // this will be googles IP :-/
|
||||
// ghost membership
|
||||
$customerData['type'] = $db->MySQLSafe(2);
|
||||
|
||||
$db->insert($glob['dbprefix']."CubeCart_customer",$customerData);
|
||||
$customer_id = $db->insertid();
|
||||
|
||||
// send welcome email
|
||||
if($module['welcomeEmail'] == 1) {
|
||||
$emailLang = getLang("email.inc.php");
|
||||
|
||||
include(CC_ROOT_DIR.CC_DS."classes".CC_DS."htmlMimeMail".CC_DS."htmlMimeMail.php");
|
||||
$lang = getLang("email.inc.php");
|
||||
$mail = new htmlMimeMail();
|
||||
|
||||
$macroArray = array(
|
||||
"CUSTOMER_NAME" => sanitizeVar($resArray["FIRSTNAME"])." ".sanitizeVar($resArray["LASTNAME"]),
|
||||
"EMAIL" => sanitizeVar($resArray['EMAIL']),
|
||||
##"PASSWORD" => sanitizeVar((isset($randomPass)) ? $randomPass : $_POST['password']),
|
||||
"PASSWORD" => $password,
|
||||
"STORE_URL" => $GLOBALS['storeURL'],
|
||||
"SENDER_IP" => get_ip_address()
|
||||
);
|
||||
|
||||
$text = macroSub($lang['email']['new_reg_body'],$macroArray);
|
||||
unset($macroArray);
|
||||
|
||||
$mail->setText($text);
|
||||
$mail->setFrom($config['masterName'].' <'.$config['masterEmail'].'>');
|
||||
$mail->setSubject($lang['email']['new_reg_subject']);
|
||||
$mail->setHeader('X-Mailer', 'CubeCart Mailer');
|
||||
$mail->send(array(sanitizeVar($resArray['EMAIL'])), $config['mailMethod']);
|
||||
}
|
||||
|
||||
}
|
||||
## Add Customer ID to session data
|
||||
$data['customer_id'] = $customer_id;
|
||||
$update = $db->update($glob['dbprefix']."CubeCart_sessions", $data,"sessId=".$db->mySQLSafe($_COOKIE[CC_SESSION_NAME]));
|
||||
header("Location: index.php?_g=co&_a=step2");
|
||||
exit;
|
||||
?>
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
if (!defined('CC_INI_SET')) die("Access Denied");
|
||||
|
||||
require_once 'CallerService.php';
|
||||
|
||||
$transaction_id = urlencode(trim($_POST['transactionId']));
|
||||
$amount = sprintf("%.2f",trim($_POST['amount']));
|
||||
$refundType = $amount == $orderSum[0]['prod_total'] ? "FULL" : "PARTIAL";
|
||||
$refundType = urlencode($refundType);
|
||||
$amount = urlencode($amount);
|
||||
$currency = urlencode($config['defaultCurrency']);
|
||||
$memo = urlencode(trim($_POST['note']));
|
||||
|
||||
$nvpStr = "&TRANSACTIONID=$transaction_id&REFUNDTYPE=$refundType&CURRENCYCODE=$currency&NOTE=$memo";
|
||||
|
||||
if($refundType=="PARTIAL") $nvpStr .="&AMT=$amount";
|
||||
|
||||
$resArray = hash_call("RefundTransaction",$nvpStr);
|
||||
|
||||
$ack = strtoupper($resArray["ACK"]);
|
||||
|
||||
if($ack!=="SUCCESS"){
|
||||
$transNotes = $resArray['L_LONGMESSAGE0'];
|
||||
$ppMsg = "<p class='warnText' id='ppresult'>".$resArray['L_LONGMESSAGE0']."</p>";
|
||||
} else {
|
||||
$transNotes = ucfirst(strtolower($refundType))." Refund of ".priceFormat($resArray['GROSSREFUNDAMT'],true)." successful.";
|
||||
|
||||
$ppMsg = "<p class='infoText' id='ppresult'>".$transNotes."</p>";
|
||||
$db->misc("UPDATE ".$glob['dbprefix']."CubeCart_transactions SET `remainder` = `remainder` + ".$resArray['GROSSREFUNDAMT']." WHERE `id` = '".$_POST['id']."';");
|
||||
}
|
||||
|
||||
$transData['customer_id'] = $orderSum[0]["customer_id"];
|
||||
$transData['gateway'] = "PayPal Website Payments Pro (DoRefund)";
|
||||
$transData['extra'] = $_POST['TENDER'];
|
||||
$transData['trans_id'] = $resArray['REFUNDTRANSACTIONID'];
|
||||
$transData['order_id'] = $orderSum[0]['cart_order_id'];
|
||||
$transData['amount'] = $resArray['GROSSREFUNDAMT'];
|
||||
$transData['status'] = $ack;
|
||||
$transData['notes'] = $transNotes;
|
||||
$order->storeTrans($transData);
|
||||
?>
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
if (!defined('CC_INI_SET')) die("Access Denied");
|
||||
|
||||
require_once 'CallerService.php';
|
||||
|
||||
require_once 'constants.php';
|
||||
|
||||
session_start();
|
||||
|
||||
|
||||
$token = $_REQUEST['token'];
|
||||
|
||||
if(! isset($token)) {
|
||||
|
||||
$parts = explode(",",base64_decode($_GET['ccb']));
|
||||
$paymentAmount = $parts[0];
|
||||
$currencyCodeType = $parts[1];
|
||||
$paymentType = $module['paymentAction'];
|
||||
|
||||
$returnURL =urlencode($glob['storeURL'].'/index.php?_g=rm&type=altCheckout&cmd=process&module=PayPal_Pro¤cyCodeType='.$currencyCodeType.'&paymentType='.$paymentType.'&paymentAmount='.$paymentAmount);
|
||||
|
||||
$cancelURL =urlencode($glob['storeURL']."/index.php?_g=rm&type=altCheckout&cmd=process&module=PayPal_Pro&paymentType=".$paymentType);
|
||||
|
||||
$nvpStr="&Amt=".sprintf("%.2f",$paymentAmount)."&PAYMENTACTION=".$paymentType."&ReturnUrl=".$returnURL."&CANCELURL=".$cancelURL ."&CURRENCYCODE=".$currencyCodeType;
|
||||
|
||||
$resArray=hash_call("SetExpressCheckout",$nvpStr);
|
||||
|
||||
$_SESSION['reshash']=$resArray;
|
||||
|
||||
$ack = strtoupper($resArray["ACK"]);
|
||||
|
||||
|
||||
if($ack=="SUCCESS"){
|
||||
// Redirect to paypal.com here
|
||||
$token = urldecode($resArray["TOKEN"]);
|
||||
$payPalURL = PAYPAL_URL.$token;
|
||||
header("Location: ".$payPalURL);
|
||||
exit;
|
||||
} else {
|
||||
include("APIError.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
$token = urlencode( $_REQUEST['token']);
|
||||
|
||||
$nvpStr="&TOKEN=".$token;
|
||||
|
||||
$resArray=hash_call("GetExpressCheckoutDetails",$nvpStr);
|
||||
|
||||
$_SESSION['reshash']=$resArray;
|
||||
$_SESSION['PAYERSTATUS'] = $resArray['PAYERSTATUS'];
|
||||
$_SESSION['ADDRESSSTATUS'] = $resArray["ADDRESSSTATUS"];
|
||||
|
||||
$ack = strtoupper($resArray["ACK"]);
|
||||
|
||||
if($module['confAddress']==1 && strtoupper($resArray["ADDRESSSTATUS"])!=="CONFIRMED") {
|
||||
httpredir("index.php?_g=co&_a=error&code=10003");
|
||||
}
|
||||
|
||||
if($ack=="SUCCESS"){
|
||||
require_once "GetExpressCheckoutDetails.php";
|
||||
exit;
|
||||
} else {
|
||||
include("APIError.php");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
if (!defined('CC_INI_SET')) die("Access Denied");
|
||||
/****************************************************
|
||||
constants.php
|
||||
|
||||
This is the configuration file for the samples.This file
|
||||
defines the parameters needed to make an API call.
|
||||
|
||||
PayPal includes the following API Signature for making API
|
||||
calls to the PayPal sandbox:
|
||||
|
||||
API Username sdk-three_api1.sdk.com
|
||||
API Password QFZCWN5HZM8VBG7Q
|
||||
API Signature A-IzJhZZjhg29XQ2qnhapuwxIDzyAZQ92FRP5dqBzVesOkzbdUONzmOU
|
||||
|
||||
Called by CallerService.php.
|
||||
****************************************************/
|
||||
|
||||
/**
|
||||
# API user: The user that is identified as making the call. you can
|
||||
# also use your own API username that you created on PayPal’s sandbox
|
||||
# or the PayPal live site
|
||||
*/
|
||||
define('API_USERNAME', $module['username']);
|
||||
/**
|
||||
# API_password: The password associated with the API user
|
||||
# If you are using your own API username, enter the API password that
|
||||
# was generated by PayPal below
|
||||
# IMPORTANT - HAVING YOUR API PASSWORD INCLUDED IN THE MANNER IS NOT
|
||||
# SECURE, AND ITS ONLY BEING SHOWN THIS WAY FOR TESTING PURPOSES
|
||||
*/
|
||||
define('API_PASSWORD', $module['password']);
|
||||
/**
|
||||
# API_Signature:The Signature associated with the API user. which is generated by paypal.
|
||||
*/
|
||||
define('API_SIGNATURE', $module['signature']);
|
||||
|
||||
if($module['gateway']==1){ ## LIVE MODE
|
||||
/**
|
||||
# Endpoint: this is the server URL which you have to connect for submitting your API request.
|
||||
*/
|
||||
define('API_ENDPOINT', 'https://api-3t.paypal.com/nvp');
|
||||
/* Define the PayPal URL. This is the URL that the buyer is
|
||||
first sent to to authorize payment with their paypal account
|
||||
change the URL depending if you are testing on the sandbox
|
||||
or going to the live PayPal site
|
||||
For the sandbox, the URL is
|
||||
https://www.sandbox.paypal.com/webscr&cmd=_express-checkout&token=
|
||||
For the live site, the URL is
|
||||
https://www.paypal.com/webscr&cmd=_express-checkout&token=
|
||||
*/
|
||||
define('PAYPAL_URL', 'https://www.paypal.com/webscr&cmd=_express-checkout&token=');
|
||||
} else { ## SANDBOX MODE
|
||||
define('API_ENDPOINT', 'https://api-3t.sandbox.paypal.com/nvp');
|
||||
define('PAYPAL_URL', 'https://www.sandbox.paypal.com/webscr&cmd=_express-checkout&token=');
|
||||
}
|
||||
|
||||
if($config['proxy']==1){
|
||||
|
||||
/**
|
||||
USE_PROXY: Set this variable to true to route all the API requests through proxy.
|
||||
like define('USE_PROXY',true);
|
||||
*/
|
||||
define('USE_PROXY',true);
|
||||
/**
|
||||
PROXY_HOST: Set the host name or the IP address of proxy server.
|
||||
PROXY_PORT: Set proxy port.
|
||||
|
||||
PROXY_HOST and PROXY_PORT will be read only if USE_PROXY is set to true
|
||||
*/
|
||||
define('PROXY_HOST', $config['proxyHost']);
|
||||
define('PROXY_PORT', $config['proxyPort']);
|
||||
} else {
|
||||
define('USE_PROXY',false);
|
||||
define('PROXY_HOST', '127.0.0.1');
|
||||
define('PROXY_PORT', '808');
|
||||
}
|
||||
/**
|
||||
# Version: this is the API version in the request.
|
||||
# It is a mandatory parameter for each API request.
|
||||
# The only supported value at this time is 2.3
|
||||
*/
|
||||
if($module['debug']==true) {
|
||||
define("PAYPAL_DEBUG", true);
|
||||
} else {
|
||||
define("PAYPAL_DEBUG", false);
|
||||
}
|
||||
|
||||
define('VERSION', '2.3');
|
||||
?>
|
||||
@@ -0,0 +1 @@
|
||||
Access Denied
|
||||
107
production/modules/common.inc.php
Normal file
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| CubeCart 4
|
||||
| ========================================
|
||||
| CubeCart is a registered trade mark of Devellion Limited
|
||||
| Copyright Devellion Limited 2006. All rights reserved.
|
||||
| Devellion Limited,
|
||||
| 5 Bridge Street,
|
||||
| Bishops Stortford,
|
||||
| HERTFORDSHIRE.
|
||||
| CM23 2JU
|
||||
| UNITED KINGDOM
|
||||
| http://www.devellion.com
|
||||
| UK Private Limited Company No. 5323904
|
||||
| ========================================
|
||||
| Web: http://www.cubecart.com
|
||||
| Email: info (at) cubecart (dot) com
|
||||
| License Type: CubeCart is NOT Open Source Software and Limitations Apply
|
||||
| Licence Info: http://www.cubecart.com/site/faq/license.php
|
||||
+--------------------------------------------------------------------------
|
||||
| common.inc.php
|
||||
| ========================================
|
||||
| Core Module Functions
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
if (!defined('CC_INI_SET')) die('Access Denied');
|
||||
|
||||
permission('settings', 'read', true);
|
||||
$lang = getLang('admin'.CC_DS.'admin_misc.inc.php');
|
||||
|
||||
require $glob['adminFolder'].CC_DS.'includes'.CC_DS.'header.inc.php';
|
||||
|
||||
class ModuleLoader {
|
||||
|
||||
# Private
|
||||
var $path;
|
||||
var $moduleName;
|
||||
|
||||
# Public
|
||||
var $info;
|
||||
var $language;
|
||||
var $settings;
|
||||
var $message = false;
|
||||
|
||||
function moduleLoader($path, $locale = 'en', &$language, $moduleName = '') {
|
||||
$this->modulePath($path);
|
||||
$this->moduleInfo();
|
||||
|
||||
$this->moduleClasses();
|
||||
|
||||
$this->moduleLanguage($locale);
|
||||
$this->moduleSettings($moduleName);
|
||||
|
||||
$this->moduleName = $moduleName;
|
||||
|
||||
if (isset($_POST['module']) && is_array($_POST['module'])) {
|
||||
$this->moduleSave($_POST['module']);
|
||||
}
|
||||
if (empty($language)) $language = $this->language;
|
||||
}
|
||||
|
||||
function modulePath($path) {
|
||||
$replace = array('admin', 'classes', 'images', 'language');
|
||||
$this->path = str_replace($replace, '', dirname($path));
|
||||
}
|
||||
|
||||
function moduleInfo() {
|
||||
if (file_exists($this->path.CC_DS.'package.conf.inc')) {
|
||||
$this->info = unserialize(file_get_contents($this->path.CC_DS.'package.conf.inc'));
|
||||
}
|
||||
}
|
||||
|
||||
function moduleClasses() {
|
||||
if (is_dir($this->path.CC_DS.'classes')) {
|
||||
foreach (glob($this->path.CC_DS.'classes'.CC_DS.'*.inc.php') as $include) {
|
||||
if (!is_dir($include)) include $include;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function moduleSettings($moduleName) {
|
||||
if (!empty($moduleName)) {
|
||||
$this->settings = fetchDbConfig($moduleName);
|
||||
}
|
||||
}
|
||||
|
||||
function moduleLanguage($locale) {
|
||||
|
||||
if (file_exists($this->path.'language'.CC_DS.$locale.'.lang.php')) {
|
||||
include $this->path.'language'.CC_DS.$locale.'.lang.php';
|
||||
} else if (file_exists($this->path.'language'.CC_DS.'default.lang.php')) {
|
||||
include $this->path.CC_DS.'language'.CC_DS.'default.lang.php';
|
||||
}
|
||||
$this->language = ($language) ? $language : false;
|
||||
}
|
||||
|
||||
function moduleSave($settingsArray) {
|
||||
global $glob, $db;
|
||||
$this->message = writeDbConf($settingsArray, $this->moduleName, $this->settings);
|
||||
$this->moduleSettings($this->moduleName);
|
||||
}
|
||||
}
|
||||
|
||||
include CC_ROOT_DIR.CC_DS.'modules'.CC_DS.'status.inc.php';
|
||||
|
||||
?>
|
||||
99
production/modules/gateway/2Checkout/admin/index.inc.php
Normal file
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| CubeCart 4
|
||||
| ========================================
|
||||
| CubeCart is a registered trade mark of Devellion Limited
|
||||
| Copyright Devellion Limited 2006. All rights reserved.
|
||||
| Devellion Limited,
|
||||
| 5 Bridge Street,
|
||||
| Bishops Stortford,
|
||||
| HERTFORDSHIRE.
|
||||
| CM23 2JU
|
||||
| UNITED KINGDOM
|
||||
| http://www.devellion.com
|
||||
| UK Private Limited Company No. 5323904
|
||||
| ========================================
|
||||
| Web: http://www.cubecart.com
|
||||
| Email: info (at) cubecart (dot) com
|
||||
| License Type: CubeCart is NOT Open Source Software and Limitations Apply
|
||||
| Licence Info: http://www.cubecart.com/site/faq/license.php
|
||||
+--------------------------------------------------------------------------
|
||||
| index.inc.php
|
||||
| ========================================
|
||||
| Configure 2Checkout (v2)
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
if(!defined('CC_INI_SET')){ die("Access Denied"); }
|
||||
|
||||
permission("settings","read",$halt=TRUE);
|
||||
|
||||
require($glob['adminFolder'].CC_DS."includes".CC_DS."header.inc.php");
|
||||
|
||||
if(isset($_POST['module'])){
|
||||
require CC_ROOT_DIR.CC_DS.'modules'.CC_DS.'status.inc.php';
|
||||
$cache = new cache("config.".$moduleName);
|
||||
$cache->clearCache();
|
||||
//$module = fetchDbConfig($moduleName); // Uncomment this is you wish to merge old config with new
|
||||
$module = array(); // Comment this out if you don't want the old config to merge with new
|
||||
$msg = writeDbConf($_POST['module'], $moduleName, $module);
|
||||
|
||||
}
|
||||
$module = fetchDbConfig($moduleName);
|
||||
?>
|
||||
<p><a href="http://www.2checkout.com/"><img src="modules/<?php echo $moduleType; ?>/<?php echo $moduleName; ?>/admin/logo.gif" alt="" border="0" title="" /></a></p>
|
||||
<?php
|
||||
if(isset($msg))
|
||||
{
|
||||
echo msg($msg);
|
||||
}
|
||||
?>
|
||||
<p class="copyText">"Start selling in minutes."</p>
|
||||
|
||||
<form action="<?php echo $glob['adminFile']; ?>?_g=<?php echo $_GET['_g']; ?>&module=<?php echo $_GET['module']; ?>" method="post" enctype="multipart/form-data">
|
||||
<table border="0" cellspacing="1" cellpadding="3" class="mainTable">
|
||||
<tr>
|
||||
<td colspan="2" class="tdTitle">Configuration Settings </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Status:</strong></td>
|
||||
<td class="tdText">
|
||||
<select name="module[status]">
|
||||
<option value="1" <?php if($module['status']==1) echo "selected='selected'"; ?>>Enabled</option>
|
||||
<option value="0" <?php if($module['status']==0) echo "selected='selected'"; ?>>Disabled</option>
|
||||
</select> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Description:</strong> </td>
|
||||
<td class="tdText"><input type="text" name="module[desc]" value="<?php echo $module['desc']; ?>" class="textbox" size="30" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Account Number:</strong></td>
|
||||
<td class="tdText"><input type="text" name="module[acNo]" value="<?php echo $module['acNo']; ?>" class="textbox" size="30" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Default:</strong></td>
|
||||
<td class="tdText">
|
||||
<select name="module[default]">
|
||||
<option value="1" <?php if($module['default'] == 1) echo "selected='selected'"; ?>>Yes</option>
|
||||
<option value="0" <?php if($module['default'] == 0) echo "selected='selected'"; ?>>No</option>
|
||||
</select> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Test Mode:</strong></td>
|
||||
<td class="tdText">
|
||||
<select name="module[testMode]">
|
||||
<option value="Y" <?php if($module['testMode'] == "Y") echo "selected='selected'"; ?>>On</option>
|
||||
<option value="N" <?php if($module['testMode'] == "N") echo "selected='selected'"; ?>>Off</option>
|
||||
</select> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" class="tdText"><div align="left"><strong>Return URL's (All): </strong></div></td>
|
||||
<td class="tdText"><?php echo $GLOBALS['storeURL']."/index.php?_g=rm&type=gateway&cmd=process&module=2Checkout"; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" class="tdText"> </td>
|
||||
<td class="tdText"><input type="submit" class="submit" value="Edit Config" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
BIN
production/modules/gateway/2Checkout/admin/logo.gif
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
3
production/modules/gateway/2Checkout/index.php
Normal file
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
die("Access Denied");
|
||||
?>
|
||||
61
production/modules/gateway/2Checkout/process.inc.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| CubeCart 4
|
||||
| ========================================
|
||||
| CubeCart is a registered trade mark of Devellion Limited
|
||||
| Copyright Devellion Limited 2006. All rights reserved.
|
||||
| Devellion Limited,
|
||||
| 5 Bridge Street,
|
||||
| Bishops Stortford,
|
||||
| HERTFORDSHIRE.
|
||||
| CM23 2JU
|
||||
| UNITED KINGDOM
|
||||
| http://www.devellion.com
|
||||
| UK Private Limited Company No. 5323904
|
||||
| ========================================
|
||||
| Web: http://www.cubecart.com
|
||||
| Email: info (at) cubecart (dot) com
|
||||
| License Type: CubeCart is NOT Open Source Software and Limitations Apply
|
||||
| Licence Info: http://www.cubecart.com/site/faq/license.php
|
||||
+--------------------------------------------------------------------------
|
||||
| process.inc.php
|
||||
| ========================================
|
||||
| Process 2CO Gateway
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
// read the post from PayPal system and add 'cmd'
|
||||
$customer = $db->select("SELECT `customer_id` FROM ".$glob['dbprefix']."CubeCart_customer WHERE `email` = ".$db->MySQLSafe($_POST['email']));
|
||||
|
||||
if($customer==TRUE)
|
||||
{
|
||||
|
||||
$transData['customer_id'] = $customer[0]["customer_id"];
|
||||
$transData['gateway'] = "2Checkout";
|
||||
$transData['trans_id'] = $_POST['order_number'];
|
||||
$transData['order_id'] = $_POST['cart_order_id'];
|
||||
$transData['amount'] = $_POST['total'];
|
||||
$transData['status'] = $_POST['credit_card_processed'];
|
||||
|
||||
if($_POST['credit_card_processed']=="Y")
|
||||
{
|
||||
$paymentResult = 2;
|
||||
$order->orderStatus(3,$_POST['cart_order_id']);
|
||||
$transData['notes'] = "Card charged successfully.";
|
||||
}
|
||||
elseif($_POST['credit_card_processed']=="K")
|
||||
{
|
||||
$paymentResult = 3;
|
||||
$order->orderStatus(2,$_POST['cart_order_id']);
|
||||
$transData['notes'] = "Card waiting for approval.";
|
||||
}
|
||||
|
||||
$order->storeTrans($transData);
|
||||
}
|
||||
else
|
||||
{
|
||||
die("<strong>Fatal Error:</strong> Customer not found from email address.");
|
||||
}
|
||||
|
||||
?>
|
||||
104
production/modules/gateway/2Checkout/transfer.inc.php
Normal file
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| CubeCart 4
|
||||
| ========================================
|
||||
| CubeCart is a registered trade mark of Devellion Limited
|
||||
| Copyright Devellion Limited 2006. All rights reserved.
|
||||
| Devellion Limited,
|
||||
| 5 Bridge Street,
|
||||
| Bishops Stortford,
|
||||
| HERTFORDSHIRE.
|
||||
| CM23 2JU
|
||||
| UNITED KINGDOM
|
||||
| http://www.devellion.com
|
||||
| UK Private Limited Company No. 5323904
|
||||
| ========================================
|
||||
| Web: http://www.cubecart.com
|
||||
| Email: info (at) cubecart (dot) com
|
||||
| License Type: CubeCart is NOT Open Source Software and Limitations Apply
|
||||
| Licence Info: http://www.cubecart.com/site/faq/license.php
|
||||
+--------------------------------------------------------------------------
|
||||
| transfer.inc.php
|
||||
| ========================================
|
||||
| Core functions for the 2Checkout (v2) Gateway
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
function repeatVars() {
|
||||
|
||||
global $i, $orderInv;
|
||||
|
||||
$hiddenVars = "<input type='hidden' name='c_prod_".$i."' value='".$orderInv['productCode'].",".$orderInv['quantity']."' />
|
||||
<input type='hidden' name='id_type_".$i."' value='1' />
|
||||
<input type='hidden' name='c_name_".$i."' value='".$orderInv['name']."' />
|
||||
<input type='hidden' name='c_description_".$i."' value='".$orderInv['name']."' />
|
||||
<input type='hidden' name='c_price_".$i."' value='".sprintf("%.2f",$orderInv['price'])."' />";
|
||||
|
||||
if($product[0]["digital"]==1)
|
||||
{
|
||||
$hiddenVars .= "<input type='hidden' name='c_tangible_".$i."' value='Y' />";
|
||||
}
|
||||
else
|
||||
{
|
||||
$hiddenVars .= "<input type='hidden' name='c_tangible_".$i."' value='N' />";
|
||||
}
|
||||
|
||||
return $hiddenVars;
|
||||
|
||||
}
|
||||
|
||||
function fixedVars()
|
||||
{
|
||||
|
||||
global $module, $orderSum, $config;
|
||||
|
||||
$hiddenVars = "<input type='hidden' name='sid' value='".$module['acNo']."' />
|
||||
<input type='hidden' name='cart_order_id' value='".$orderSum['cart_order_id']."' />
|
||||
<input type='hidden' name='total' value='".$orderSum['prod_total']."' />
|
||||
<input type='hidden' name='card_holder_name' value='".$orderSum['name']."' />
|
||||
<input type='hidden' name='street_address' value='".$orderSum['add_1']." ".$orderSum['add_2']."' />
|
||||
<input type='hidden' name='city' value='".$orderSum['town']."' />
|
||||
<input type='hidden' name='state' value='".$orderSum['county']."' />
|
||||
<input type='hidden' name='country' value='".getCountryFormat($orderSum['country'],"id","printable_name")."' />
|
||||
<input type='hidden' name='zip' value='".$orderSum['postcode']."' />
|
||||
<input type='hidden' name='phone' value='".$orderSum['phone']."' />
|
||||
<input type='hidden' name='email' value='".$orderSum['email']."' />
|
||||
<input type='hidden' name='ship_name' value='".$orderSum['name_d']."' />
|
||||
<input type='hidden' name='ship_street_address' value='".$orderSum['add_1_d']." ".$orderSum['add_2_d']."' />
|
||||
<input type='hidden' name='ship_city' value='".$orderSum['town_d']."' />
|
||||
<input type='hidden' name='ship_state' value='".getCountryFormat($orderSum['country_d'],"id","printable_name")."' />
|
||||
<input type='hidden' name='ship_zip' value='".$orderSum['postcode_d']."' />
|
||||
<input type='hidden' name='ship_country' value='".$orderSum['country_d']."' />";
|
||||
|
||||
if($module['testMode']=="Y")
|
||||
{
|
||||
|
||||
$hiddenVars .= "<input type='hidden' name='demo' value='Y' />";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
$hiddenVars .= "<input type='hidden' name='demo' value='N' />";
|
||||
|
||||
}
|
||||
|
||||
return $hiddenVars;
|
||||
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////
|
||||
// Other Vars
|
||||
////////
|
||||
$formAction = "https://www2.2checkout.com/2co/buyer/purchase";
|
||||
$formMethod = "post";
|
||||
$formTarget = "_self";
|
||||
$transfer = "auto";
|
||||
|
||||
$emailText = "Charges for the purchase will appear on your statement under the name 2Checkout.com\r\n";
|
||||
$emailText .= "Questions regarding your order should be directed to:\r\n\r\n";
|
||||
$emailText .= $config['storeName']."\r\n";
|
||||
$emailText .= $GLOBALS['storeURL']."\r\n";
|
||||
$emailText .= $config['masterEmail'];
|
||||
?>
|
||||
128
production/modules/gateway/Authorize_AIM/admin/index.inc.php
Normal file
@@ -0,0 +1,128 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| CubeCart 4
|
||||
| ========================================
|
||||
| CubeCart is a Trade Mark of Devellion Limited
|
||||
| Copyright Devellion Limited 2006. All rights reserved.
|
||||
| Devellion Limited,
|
||||
| 5 Bridge Street,
|
||||
| Bishops Stortford,
|
||||
| HERTFORDSHIRE.
|
||||
| CM23 2JU
|
||||
| UNITED KINGDOM
|
||||
| http://www.devellion.com
|
||||
| UK Private Limited Company No. 5323904
|
||||
| ========================================
|
||||
| Web: http://www.cubecart.com
|
||||
| Date: Friday, 15 July 2005
|
||||
| Email: info (at) cubecart (dot) com
|
||||
| License Type: CubeCart is NOT Open Source Software and Limitations Apply
|
||||
| Licence Info: http://www.cubecart.com/site/faq/license.php
|
||||
+--------------------------------------------------------------------------
|
||||
| index.inc.php
|
||||
| ========================================
|
||||
| Configure Authorize AIM
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
if(!defined('CC_INI_SET')){ die("Access Denied"); }
|
||||
|
||||
permission("settings","read",$halt=TRUE);
|
||||
|
||||
require($glob['adminFolder'].CC_DS."includes".CC_DS."header.inc.php");
|
||||
|
||||
if(isset($_POST['module']))
|
||||
{
|
||||
require CC_ROOT_DIR.CC_DS.'modules'.CC_DS.'status.inc.php';
|
||||
$cache = new cache("config.".$moduleName);
|
||||
$cache->clearCache();
|
||||
//$module = fetchDbConfig($moduleName); // Uncomment this is you wish to merge old config with new
|
||||
$module = array(); // Comment this out if you don't want the old config to merge with new
|
||||
$msg = writeDbConf($_POST['module'], $moduleName, $module);
|
||||
}
|
||||
$module = fetchDbConfig($moduleName);
|
||||
?>
|
||||
|
||||
<p><a href="http://www.authorize.net/"><img src="modules/<?php echo $moduleType; ?>/<?php echo $moduleName; ?>/admin/logo.gif" alt="" border="0" title="" /></a></p>
|
||||
<?php
|
||||
if(isset($msg))
|
||||
{
|
||||
echo msg($msg);
|
||||
}
|
||||
?>
|
||||
<p class="copyText">"Your Gateway to IP Transactions."</p>
|
||||
|
||||
<form action="<?php echo $glob['adminFile']; ?>?_g=<?php echo $_GET['_g']; ?>&module=<?php echo $_GET['module']; ?>" method="post" enctype="multipart/form-data">
|
||||
<table border="0" cellspacing="1" cellpadding="3" class="mainTable">
|
||||
<tr>
|
||||
<td colspan="2" class="tdTitle">Configuration Settings </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Status:</strong></td>
|
||||
<td class="tdText">
|
||||
<select name="module[status]">
|
||||
<option value="1" <?php if($module['status']==1) echo "selected='selected'"; ?>>Enabled</option>
|
||||
<option value="0" <?php if($module['status']==0) echo "selected='selected'"; ?>>Disabled</option>
|
||||
</select> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Enable Card Validation:</strong></td>
|
||||
<td class="tdText">
|
||||
<select name="module[validation]">
|
||||
<option value="1" <?php if($module['validation']==1) echo "selected='selected'"; ?>>Enabled</option>
|
||||
<option value="0" <?php if($module['validation']==0) echo "selected='selected'"; ?>>Disabled</option>
|
||||
</select> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Require CVV Code:</strong></td>
|
||||
<td class="tdText">
|
||||
<select name="module[reqCvv]">
|
||||
<option value="1" <?php if($module['reqCvv']==1) echo "selected='selected'"; ?>>Yes</option>
|
||||
<option value="0" <?php if($module['reqCvv']==0) echo "selected='selected'"; ?>>No</option>
|
||||
</select> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Description:</strong> </td>
|
||||
<td class="tdText"><input type="text" name="module[desc]" value="<?php echo $module['desc']; ?>" class="textbox" size="30" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Merchant Id:</strong></td>
|
||||
<td class="tdText"><input type="text" name="module[acNo]" value="<?php echo $module['acNo']; ?>" class="textbox" size="30" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Transaction Key:</strong><br/>Please login and create this at <a href="https://secure.authorize.net" target="_blank" class="txtLink">https://secure.authorize.net</a> (opens in new window)</td>
|
||||
<td class="tdText"><input type="text" name="module[txnkey]" value="<?php echo $module['txnkey']; ?>" class="textbox" size="30" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Password:</strong><br/>Only required if Password-Required Mode is enabled. </td>
|
||||
<td class="tdText"><input type="text" name="module[password]" value="<?php echo $module['password']; ?>" class="textbox" size="30" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Testing:</strong></td>
|
||||
<td class="tdText"><select name="module[testMode]">
|
||||
<option value="1" <?php if($module['testMode'] == 1) echo "selected='selected'"; ?>>Yes</option>
|
||||
<option value="0" <?php if($module['testMode'] == 0) echo "selected='selected'"; ?>>No</option>
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Default:</strong></td>
|
||||
<td class="tdText">
|
||||
<select name="module[default]">
|
||||
<option value="1" <?php if($module['default'] == 1) echo "selected='selected'"; ?>>Yes</option>
|
||||
<option value="0" <?php if($module['default'] == 0) echo "selected='selected'"; ?>>No</option>
|
||||
</select> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Debugging: </strong></td>
|
||||
<td class="tdText"><select name="module[debug]">
|
||||
<option value="0" <?php if($module['debug'] == 0) echo "selected='selected'"; ?>>No</option>
|
||||
<option value="1" <?php if($module['debug'] == 1) echo "selected='selected'"; ?>>Yes</option>
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" class="tdText"> </td>
|
||||
<td class="tdText"><input type="submit" class="submit" value="Edit Config" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
BIN
production/modules/gateway/Authorize_AIM/admin/logo.gif
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
937
production/modules/gateway/Authorize_AIM/form.inc.php
Normal file
@@ -0,0 +1,937 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| CubeCart 4
|
||||
| ========================================
|
||||
| CubeCart is a registered trade mark of Devellion Limited
|
||||
| Copyright Devellion Limited 2006. All rights reserved.
|
||||
| Devellion Limited,
|
||||
| 5 Bridge Street,
|
||||
| Bishops Stortford,
|
||||
| HERTFORDSHIRE.
|
||||
| CM23 2JU
|
||||
| UNITED KINGDOM
|
||||
| http://www.devellion.com
|
||||
| UK Private Limited Company No. 5323904
|
||||
| ========================================
|
||||
| Web: http://www.cubecart.com
|
||||
| Email: info (at) cubecart (dot) com
|
||||
| License Type: CubeCart is NOT Open Source Software and Limitations Apply
|
||||
| Licence Info: http://www.cubecart.com/site/faq/license.php
|
||||
+--------------------------------------------------------------------------
|
||||
| form.inc.php
|
||||
| ========================================
|
||||
| Authorize AIM Payment
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
if(detectSSL() == FALSE) die ("<strong>Critical Error:</strong> This page can ONLY be viewed under SSL!");
|
||||
|
||||
if($_GET['process']==1) {
|
||||
|
||||
$transData['customer_id'] = $orderSum["customer_id"];
|
||||
$transData['order_id'] = $orderSum['cart_order_id'];
|
||||
$transData['amount'] = $orderSum['prod_total'];
|
||||
$transData['gateway'] = "Authorize AIM";
|
||||
|
||||
// first check card
|
||||
require("classes".CC_DS."validate".CC_DS."validateCard.php");
|
||||
|
||||
$card = new validateCard();
|
||||
|
||||
$cardNo = trim($_POST["cardNumber"]);
|
||||
$issueNo = false;
|
||||
$issueDate = false;
|
||||
$issueFormat = 4;
|
||||
$expireDate = trim($_POST["expirationYear"]).str_pad(trim($_POST["expirationMonth"]), 2, '0', STR_PAD_LEFT);
|
||||
$expireFormat = 4;
|
||||
if($module['reqCvv']==1){
|
||||
$scReqd = TRUE;
|
||||
} else {
|
||||
$scReqd = FALSE;
|
||||
}
|
||||
$securityCode = trim($_POST["cvv"]);
|
||||
|
||||
$card = $card->check($cardNo,
|
||||
$issueNo,
|
||||
$issueDate,
|
||||
$issueFormat,
|
||||
$expireDate,
|
||||
$expireFormat,
|
||||
$scReqd,
|
||||
$securityCode);
|
||||
|
||||
if($module['validation']==1 && $card['response']=="FAIL") {
|
||||
|
||||
$errorMsg = "";
|
||||
|
||||
foreach($card['error'] as $val) {
|
||||
|
||||
$errorMsg .= $val."<br />";
|
||||
|
||||
}
|
||||
|
||||
$transData['trans_id'] = "";
|
||||
$transData['status'] = "Fail";
|
||||
$transData['notes'] = $errorMsg;
|
||||
|
||||
} else {
|
||||
|
||||
$debug = "<table border=\"0\" cellpadding=\"3\" width=\"600\">
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
|
||||
<b>Authorize.Net<br />
|
||||
Advanced Implementation Method (AIM)<br />
|
||||
<br />
|
||||
<strong>Debug Info:</strong>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>";
|
||||
|
||||
$ERROR_RETRIES = 2; # Number of transactions to post if soft errors occur
|
||||
|
||||
$auth_net_login_id = $module['acNo'];
|
||||
$auth_net_tran_key = $module['txnkey'];
|
||||
$auth_net_password = $module['password'];
|
||||
|
||||
if($module['testMode'] == 1) {
|
||||
$auth_net_url = "https://certification.authorize.net/gateway/transact.dll";
|
||||
//$auth_net_url = "https://test.authorize.net/gateway/transact.dll";
|
||||
$TESTING = 1; # Set the testing flag so that transactions are not live
|
||||
} else {
|
||||
$auth_net_url = "https://secure.authorize.net/gateway/transact.dll";
|
||||
}
|
||||
|
||||
if($module['debug'] == 1) {
|
||||
$DEBUGGING = 1; # Display additional information to track down problems
|
||||
}
|
||||
|
||||
$authnet_values = array
|
||||
(
|
||||
"x_invoice_num" => $orderSum['cart_order_id'],
|
||||
"x_password" => $auth_net_password,
|
||||
"x_login" => $auth_net_login_id,
|
||||
"x_version" => "3.1",
|
||||
"x_delim_char" => "|",
|
||||
"x_delim_data" => "TRUE",
|
||||
"x_url" => "FALSE",
|
||||
"x_type" => "AUTH_CAPTURE",
|
||||
"x_method" => "CC",
|
||||
"x_tran_key" => $auth_net_tran_key,
|
||||
"x_relay_response" => "FALSE",
|
||||
"x_card_num" => trim($_POST["cardNumber"]),
|
||||
"x_card_code" => trim($_POST['CVV']),
|
||||
"x_exp_date" => trim($_POST["expirationMonth"]).trim($_POST["expirationYear"]),
|
||||
"x_description" => "Payment for order number ".$orderSum['cart_order_id'],
|
||||
"x_amount" => $orderSum['prod_total'],
|
||||
"x_first_name" => trim($_POST["firstName"]),
|
||||
"x_last_name" => trim($_POST["lastName"]),
|
||||
"x_address" => trim($_POST["addr1"]).' '.trim($_POST["addr2"]),
|
||||
"x_city" => trim($_POST["city"]),
|
||||
"x_state" => trim($_POST["state"]),
|
||||
"x_zip" => trim($_POST["postalCode"]),
|
||||
"x_country" => trim($_POST["country"]),
|
||||
"x_email" => trim($_POST['emailAddress']),
|
||||
"x_customer_ip" => get_ip_address()
|
||||
|
||||
);
|
||||
|
||||
$fields = "";
|
||||
foreach( $authnet_values as $key => $value ) $fields .= $key."=" . urlencode( $value ) . "&";
|
||||
|
||||
|
||||
$debug .= "<hr />";
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
$debug .= "<b>01: Post the transaction (see the code for specific information):</b><br />";
|
||||
|
||||
|
||||
$ch = curl_init($auth_net_url);
|
||||
curl_setopt($ch, CURLOPT_HEADER, 0); // set to 0 to eliminate header info from response
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // Returns response data instead of TRUE(1)
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, rtrim( $fields, "& " )); // use HTTP POST to send form data
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); // uncomment this line if you get no gateway response. ###
|
||||
if($config['proxy']==1){
|
||||
curl_setopt ($ch, CURLOPT_PROXY, $config['proxyHost'].":".$config['proxyPort']);
|
||||
}
|
||||
$resp = curl_exec($ch); //execute post and get results
|
||||
curl_close ($ch);
|
||||
|
||||
$debug .= "<hr />";
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
$debug .= "<b>02: Get post results:</b><br />";
|
||||
$debug .= $resp;
|
||||
$debug .= "<br />";
|
||||
|
||||
$debug .= "<hr />";
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
$debug .= "03: Parse post results (simple approach)<br />";
|
||||
|
||||
$text = $resp;
|
||||
|
||||
$debug .= "<table cellpadding=\"5\" cellspacing=\"0\" border=\"1\">";
|
||||
$debug .= "<tr>";
|
||||
$debug .= "<td >";
|
||||
|
||||
|
||||
$tok = strtok($text,"|");
|
||||
while(!($tok === FALSE))
|
||||
{
|
||||
//while ($tok) {
|
||||
$debug .= " ".$tok."<br />";
|
||||
$tok = strtok("|");
|
||||
}
|
||||
|
||||
|
||||
$debug .= "</td>";
|
||||
$debug .= "</tr>";
|
||||
$debug .= "</table>";
|
||||
|
||||
|
||||
$debug .= "<hr />";
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
$debug .= "<b>04: Parse the results string into individual, meaningful segments:</b><br />";
|
||||
|
||||
|
||||
$debug .= "<table cellpadding=\"5\" cellspacing=\"0\" border=\"1\">";
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// STATISTICAL USE ONLY: //
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
$debug .= "<tr>";
|
||||
$debug .= "<td>";
|
||||
$debug .= "Length of the returned string from Authorize.Net:";
|
||||
$debug .= "</td>";
|
||||
|
||||
$debug .= "<td>";
|
||||
$debug .= strlen($resp);
|
||||
$debug .= "</td>";
|
||||
|
||||
$debug .= "</tr>";
|
||||
|
||||
$howMany = substr_count($resp, "|");
|
||||
|
||||
$debug .= "<tr>";
|
||||
$debug .= "<td>";
|
||||
$debug .= "Number of delimiter characters in the returned string:";
|
||||
$debug .= "</td>";
|
||||
|
||||
$debug .= "<td>";
|
||||
$debug .= $howMany;
|
||||
$debug .= "</td>";
|
||||
|
||||
$debug .= "</tr>";
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
$text = $resp;
|
||||
$h = substr_count($text, "|");
|
||||
$h++;
|
||||
|
||||
for($j=1; $j <= $h; $j++){
|
||||
|
||||
$p = strpos($text, "|");
|
||||
|
||||
if ($p === false) { // note: three equal signs
|
||||
|
||||
$debug .= "<tr>";
|
||||
$debug .= "<td>";
|
||||
|
||||
// x_delim_char is obviously not found in the last go-around
|
||||
|
||||
if($j>=69){
|
||||
|
||||
$debug .= "Merchant-defined (".$j."): ";
|
||||
$debug .= ": ";
|
||||
|
||||
$debug .= "</td>";
|
||||
$debug .= "<td >";
|
||||
|
||||
$debug .= $text;
|
||||
$debug .= "<br />";
|
||||
|
||||
} else {
|
||||
|
||||
$debug .= $j;
|
||||
$debug .= ": ";
|
||||
|
||||
$debug .= "</td>";
|
||||
$debug .= "<td >";
|
||||
|
||||
$debug .= $text;
|
||||
$debug .= "<br />";
|
||||
|
||||
}
|
||||
|
||||
|
||||
$debug .= "</td>";
|
||||
$debug .= "</tr>";
|
||||
|
||||
}else{
|
||||
|
||||
$p++;
|
||||
|
||||
// We found the x_delim_char and accounted for it . . . now do something with it
|
||||
|
||||
// get one portion of the response at a time
|
||||
$pstr = substr($text, 0, $p);
|
||||
|
||||
// this prepares the text and returns one value of the submitted
|
||||
// and processed name/value pairs at a time
|
||||
// for AIM-specific interpretations of the responses
|
||||
// please consult the AIM Guide and look up
|
||||
// the section called Gateway Response API
|
||||
$pstr_trimmed = substr($pstr, 0, -1); // removes "|" at the end
|
||||
|
||||
if($pstr_trimmed=="")
|
||||
{
|
||||
$pstr_trimmed="NO VALUE RETURNED";
|
||||
}
|
||||
|
||||
|
||||
$debug .= "<tr>";
|
||||
$debug .= "<td>";
|
||||
|
||||
switch($j)
|
||||
{
|
||||
|
||||
case 1:
|
||||
$debug .= "Response Code: ";
|
||||
|
||||
$debug .= "</td>";
|
||||
$debug .= "<td >";
|
||||
|
||||
$fval="";
|
||||
|
||||
if($pstr_trimmed=="1")
|
||||
{
|
||||
$fval="Approved";
|
||||
$statusLog = $fval;
|
||||
$order->orderStatus(3,$orderSum['cart_order_id']);
|
||||
$jumpTo = "index.php?_g=co&_a=confirmed&s=2";
|
||||
$errorMsg = "Card has been charged.";
|
||||
|
||||
}
|
||||
elseif($pstr_trimmed=="2")
|
||||
{
|
||||
$fval="Declined";
|
||||
$statusLog = $fval;
|
||||
$errorMsg = $lang['gateway']['card_declined'];
|
||||
|
||||
}
|
||||
elseif($pstr_trimmed=="3")
|
||||
{
|
||||
$fval="Error";
|
||||
$statusLog = $fval;
|
||||
$errorMsg = $lang['gateway']['card_error'];
|
||||
}
|
||||
|
||||
$debug .= $fval;
|
||||
$debug .= "<br />";
|
||||
break;
|
||||
|
||||
case 2:
|
||||
$debug .= "Response Subcode: ";
|
||||
|
||||
$debug .= "</td>";
|
||||
$debug .= "<td >";
|
||||
|
||||
$debug .= $pstr_trimmed;
|
||||
$debug .= "<br />";
|
||||
break;
|
||||
|
||||
case 3:
|
||||
$debug .= "Response Reason Code: ";
|
||||
|
||||
$debug .= "</td>";
|
||||
$debug .= "<td >";
|
||||
|
||||
$debug .= $pstr_trimmed;
|
||||
$errorMsg .= "<br />Error code ".$pstr_trimmed;
|
||||
$debug .= "<br />";
|
||||
break;
|
||||
|
||||
case 4:
|
||||
$debug .= "Response Reason Text: ";
|
||||
|
||||
$debug .= "</td>";
|
||||
$debug .= "<td >";
|
||||
|
||||
$debug .= $pstr_trimmed;
|
||||
$errorMsg .= " - "".$pstr_trimmed.""";
|
||||
$debug .= "<br />";
|
||||
break;
|
||||
|
||||
case 5:
|
||||
$debug .= "Approval Code: ";
|
||||
|
||||
$debug .= "</td>";
|
||||
$debug .= "<td >";
|
||||
|
||||
$debug .= $pstr_trimmed;
|
||||
$debug .= "<br />";
|
||||
break;
|
||||
|
||||
case 6:
|
||||
$debug .= "AVS Result Code: ";
|
||||
|
||||
$debug .= "</td>";
|
||||
$debug .= "<td >";
|
||||
|
||||
$debug .= $pstr_trimmed;
|
||||
$debug .= "<br />";
|
||||
break;
|
||||
|
||||
case 7:
|
||||
$debug .= "Transaction ID: ";
|
||||
|
||||
$debug .= "</td>";
|
||||
$debug .= "<td >";
|
||||
|
||||
$debug .= $pstr_trimmed;
|
||||
$transactionId = $pstr_trimmed;
|
||||
$debug .= "<br />";
|
||||
break;
|
||||
|
||||
case 8:
|
||||
$debug .= "Invoice Number (x_invoice_num): ";
|
||||
|
||||
$debug .= "</td>";
|
||||
$debug .= "<td >";
|
||||
|
||||
$debug .= $pstr_trimmed;
|
||||
$debug .= "<br />";
|
||||
break;
|
||||
|
||||
case 9:
|
||||
$debug .= "Description (x_description): ";
|
||||
|
||||
$debug .= "</td>";
|
||||
$debug .= "<td >";
|
||||
|
||||
$debug .= $pstr_trimmed;
|
||||
$debug .= "<br />";
|
||||
break;
|
||||
|
||||
case 10:
|
||||
$debug .= "Amount (x_amount): ";
|
||||
|
||||
$debug .= "</td>";
|
||||
$debug .= "<td >";
|
||||
|
||||
$debug .= $pstr_trimmed;
|
||||
$debug .= "<br />";
|
||||
break;
|
||||
|
||||
case 11:
|
||||
$debug .= "Method (x_method): ";
|
||||
|
||||
$debug .= "</td>";
|
||||
$debug .= "<td >";
|
||||
|
||||
$debug .= $pstr_trimmed;
|
||||
$debug .= "<br />";
|
||||
break;
|
||||
|
||||
case 12:
|
||||
$debug .= "Transaction Type (x_type): ";
|
||||
|
||||
$debug .= "</td>";
|
||||
$debug .= "<td >";
|
||||
|
||||
$debug .= $pstr_trimmed;
|
||||
$debug .= "<br />";
|
||||
break;
|
||||
|
||||
case 13:
|
||||
$debug .= "Customer ID (x_cust_id): ";
|
||||
|
||||
$debug .= "</td>";
|
||||
$debug .= "<td >";
|
||||
|
||||
$debug .= $pstr_trimmed;
|
||||
$debug .= "<br />";
|
||||
break;
|
||||
|
||||
case 14:
|
||||
$debug .= "Cardholder First Name (x_first_name): ";
|
||||
|
||||
$debug .= "</td>";
|
||||
$debug .= "<td >";
|
||||
|
||||
$debug .= $pstr_trimmed;
|
||||
$debug .= "<br />";
|
||||
break;
|
||||
|
||||
case 15:
|
||||
$debug .= "Cardholder Last Name (x_last_name): ";
|
||||
|
||||
$debug .= "</td>";
|
||||
$debug .= "<td >";
|
||||
|
||||
$debug .= $pstr_trimmed;
|
||||
$debug .= "<br />";
|
||||
break;
|
||||
|
||||
case 16:
|
||||
$debug .= "Company (x_company): ";
|
||||
|
||||
$debug .= "</td>";
|
||||
$debug .= "<td >";
|
||||
|
||||
$debug .= $pstr_trimmed;
|
||||
$debug .= "<br />";
|
||||
break;
|
||||
|
||||
case 17:
|
||||
$debug .= "Billing Address (x_address): ";
|
||||
|
||||
$debug .= "</td>";
|
||||
$debug .= "<td >";
|
||||
|
||||
$debug .= $pstr_trimmed;
|
||||
$debug .= "<br />";
|
||||
break;
|
||||
|
||||
case 18:
|
||||
$debug .= "City (x_city): ";
|
||||
|
||||
$debug .= "</td>";
|
||||
$debug .= "<td >";
|
||||
|
||||
$debug .= $pstr_trimmed;
|
||||
$debug .= "<br />";
|
||||
break;
|
||||
|
||||
case 19:
|
||||
$debug .= "State (x_state): ";
|
||||
|
||||
$debug .= "</td>";
|
||||
$debug .= "<td >";
|
||||
|
||||
$debug .= $pstr_trimmed;
|
||||
$debug .= "<br />";
|
||||
break;
|
||||
|
||||
case 20:
|
||||
$debug .= "ZIP (x_zip): ";
|
||||
|
||||
$debug .= "</td>";
|
||||
$debug .= "<td >";
|
||||
|
||||
$debug .= $pstr_trimmed;
|
||||
$debug .= "<br />";
|
||||
break;
|
||||
|
||||
case 21:
|
||||
$debug .= "Country (x_country): ";
|
||||
|
||||
$debug .= "</td>";
|
||||
$debug .= "<td >";
|
||||
|
||||
$debug .= $pstr_trimmed;
|
||||
$debug .= "<br />";
|
||||
break;
|
||||
|
||||
case 22:
|
||||
$debug .= "Phone (x_phone): ";
|
||||
|
||||
$debug .= "</td>";
|
||||
$debug .= "<td >";
|
||||
|
||||
$debug .= $pstr_trimmed;
|
||||
$debug .= "<br />";
|
||||
break;
|
||||
|
||||
case 23:
|
||||
$debug .= "Fax (x_fax): ";
|
||||
|
||||
$debug .= "</td>";
|
||||
$debug .= "<td >";
|
||||
|
||||
$debug .= $pstr_trimmed;
|
||||
$debug .= "<br />";
|
||||
break;
|
||||
|
||||
case 24:
|
||||
$debug .= "E-Mail Address (x_email): ";
|
||||
|
||||
$debug .= "</td>";
|
||||
$debug .= "<td >";
|
||||
|
||||
$debug .= $pstr_trimmed;
|
||||
$debug .= "<br />";
|
||||
break;
|
||||
|
||||
case 25:
|
||||
$debug .= "Ship to First Name (x_ship_to_first_name): ";
|
||||
|
||||
$debug .= "</td>";
|
||||
$debug .= "<td >";
|
||||
|
||||
$debug .= $pstr_trimmed;
|
||||
$debug .= "<br />";
|
||||
break;
|
||||
|
||||
case 26:
|
||||
$debug .= "Ship to Last Name (x_ship_to_last_name): ";
|
||||
|
||||
$debug .= "</td>";
|
||||
$debug .= "<td >";
|
||||
|
||||
$debug .= $pstr_trimmed;
|
||||
$debug .= "<br />";
|
||||
break;
|
||||
|
||||
case 27:
|
||||
$debug .= "Ship to Company (x_ship_to_company): ";
|
||||
|
||||
$debug .= "</td>";
|
||||
$debug .= "<td >";
|
||||
|
||||
$debug .= $pstr_trimmed;
|
||||
$debug .= "<br />";
|
||||
break;
|
||||
|
||||
case 28:
|
||||
$debug .= "Ship to Address (x_ship_to_address): ";
|
||||
|
||||
$debug .= "</td>";
|
||||
$debug .= "<td >";
|
||||
|
||||
$debug .= $pstr_trimmed;
|
||||
$debug .= "<br />";
|
||||
break;
|
||||
|
||||
case 29:
|
||||
$debug .= "Ship to City (x_ship_to_city): ";
|
||||
|
||||
$debug .= "</td>";
|
||||
$debug .= "<td >";
|
||||
|
||||
$debug .= $pstr_trimmed;
|
||||
$debug .= "<br />";
|
||||
break;
|
||||
|
||||
case 30:
|
||||
$debug .= "Ship to State (x_ship_to_state): ";
|
||||
|
||||
$debug .= "</td>";
|
||||
$debug .= "<td >";
|
||||
|
||||
$debug .= $pstr_trimmed;
|
||||
$debug .= "<br />";
|
||||
break;
|
||||
|
||||
case 31:
|
||||
$debug .= "Ship to ZIP (x_ship_to_zip): ";
|
||||
|
||||
$debug .= "</td>";
|
||||
$debug .= "<td >";
|
||||
|
||||
$debug .= $pstr_trimmed;
|
||||
$debug .= "<br />";
|
||||
break;
|
||||
|
||||
case 32:
|
||||
$debug .= "Ship to Country (x_ship_to_country): ";
|
||||
|
||||
$debug .= "</td>";
|
||||
$debug .= "<td >";
|
||||
|
||||
$debug .= $pstr_trimmed;
|
||||
$debug .= "<br />";
|
||||
break;
|
||||
|
||||
case 33:
|
||||
$debug .= "Tax Amount (x_tax): ";
|
||||
|
||||
$debug .= "</td>";
|
||||
$debug .= "<td >";
|
||||
|
||||
$debug .= $pstr_trimmed;
|
||||
$debug .= "<br />";
|
||||
break;
|
||||
|
||||
case 34:
|
||||
$debug .= "Duty Amount (x_duty): ";
|
||||
|
||||
$debug .= "</td>";
|
||||
$debug .= "<td >";
|
||||
|
||||
$debug .= $pstr_trimmed;
|
||||
$debug .= "<br />";
|
||||
break;
|
||||
|
||||
case 35:
|
||||
$debug .= "Freight Amount (x_freight): ";
|
||||
|
||||
$debug .= "</td>";
|
||||
$debug .= "<td >";
|
||||
|
||||
$debug .= $pstr_trimmed;
|
||||
$debug .= "<br />";
|
||||
break;
|
||||
|
||||
case 36:
|
||||
$debug .= "Tax Exempt Flag (x_tax_exempt): ";
|
||||
|
||||
$debug .= "</td>";
|
||||
$debug .= "<td >";
|
||||
|
||||
$debug .= $pstr_trimmed;
|
||||
$debug .= "<br />";
|
||||
break;
|
||||
|
||||
case 37:
|
||||
$debug .= "PO Number (x_po_num): ";
|
||||
|
||||
$debug .= "</td>";
|
||||
$debug .= "<td >";
|
||||
|
||||
$debug .= $pstr_trimmed;
|
||||
$debug .= "<br />";
|
||||
break;
|
||||
|
||||
case 38:
|
||||
$debug .= "MD5 Hash: ";
|
||||
|
||||
$debug .= "</td>";
|
||||
$debug .= "<td >";
|
||||
|
||||
$debug .= $pstr_trimmed;
|
||||
$debug .= "<br />";
|
||||
break;
|
||||
|
||||
case 39:
|
||||
$debug .= "Card Code Response: ";
|
||||
|
||||
$debug .= "</td>";
|
||||
$debug .= "<td >";
|
||||
|
||||
$fval="";
|
||||
if($pstr_trimmed=="M"){
|
||||
$fval="M = Match";
|
||||
}elseif($pstr_trimmed=="N"){
|
||||
$fval="N = No Match";
|
||||
}elseif($pstr_trimmed=="P"){
|
||||
$fval="P = Not Processed";
|
||||
}elseif($pstr_trimmed=="S"){
|
||||
$fval="S = Should have been present";
|
||||
}elseif($pstr_trimmed=="U"){
|
||||
$fval="U = Issuer unable to process request";
|
||||
}else{
|
||||
$fval="NO VALUE RETURNED";
|
||||
}
|
||||
|
||||
$debug .= $fval;
|
||||
$debug .= "<br />";
|
||||
break;
|
||||
|
||||
case 40:
|
||||
case 41:
|
||||
case 42:
|
||||
case 43:
|
||||
case 44:
|
||||
case 45:
|
||||
case 46:
|
||||
case 47:
|
||||
case 48:
|
||||
case 49:
|
||||
case 50:
|
||||
case 51:
|
||||
case 52:
|
||||
case 53:
|
||||
case 54:
|
||||
case 55:
|
||||
case 55:
|
||||
case 56:
|
||||
case 57:
|
||||
case 58:
|
||||
case 59:
|
||||
case 60:
|
||||
case 61:
|
||||
case 62:
|
||||
case 63:
|
||||
case 64:
|
||||
case 65:
|
||||
case 66:
|
||||
case 67:
|
||||
case 68:
|
||||
$debug .= "Reserved (".$j."): ";
|
||||
|
||||
$debug .= "</td>";
|
||||
$debug .= "<td >";
|
||||
|
||||
$debug .= $pstr_trimmed;
|
||||
$debug .= "<br />";
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
if($j>=69)
|
||||
{
|
||||
|
||||
$debug .= "Merchant-defined (".$j."): ";
|
||||
$debug .= ": ";
|
||||
|
||||
$debug .= "</td>";
|
||||
$debug .= "<td >";
|
||||
|
||||
$debug .= $pstr_trimmed;
|
||||
$debug .= "<br />";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
$debug .= $j;
|
||||
$debug .= ": ";
|
||||
|
||||
$debug .= "</td>";
|
||||
$debug .= "<td >";
|
||||
|
||||
$debug .= $pstr_trimmed;
|
||||
$debug .= "<br />";
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
$debug .= "</td>";
|
||||
$debug .= "</tr>";
|
||||
|
||||
// remove the part that we identified and work with the rest of the string
|
||||
$text = substr($text, $p);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$debug .= "</table>";
|
||||
|
||||
$debug .= "<br />";
|
||||
|
||||
|
||||
|
||||
|
||||
$debug .= "<hr />";
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
if(!empty($transactionId))
|
||||
{
|
||||
$transData['trans_id'] = $transactionId;
|
||||
}
|
||||
else
|
||||
{
|
||||
$transData['trans_id'] = "N/A";
|
||||
}
|
||||
$transData['status'] = $statusLog;
|
||||
$transData['notes'] = $errorMsg;
|
||||
|
||||
}
|
||||
|
||||
$order->storeTrans($transData);
|
||||
|
||||
if($module['debug'] == 1 && isset($debug))
|
||||
{
|
||||
$debug .= "<b>04: Done.</b><br /></td>
|
||||
</tr>
|
||||
</table>";
|
||||
echo $debug;
|
||||
//exit;
|
||||
}
|
||||
elseif(isset($jumpTo) && !empty($jumpTo))
|
||||
{
|
||||
|
||||
httpredir($jumpTo);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$formTemplate = new XTemplate ("modules".CC_DS."gateway".CC_DS.$_POST['gateway'].CC_DS."form.tpl",'',null,'main',true,$skipPath=TRUE);
|
||||
|
||||
if(isset($errorMsg))
|
||||
{
|
||||
|
||||
$formTemplate->assign("LANG_ERROR",$errorMsg);
|
||||
$formTemplate->parse("form.error");
|
||||
|
||||
}
|
||||
|
||||
$billingName = makeName($orderSum['name']);
|
||||
$deliveryName = makeName($orderSum['name_d']);
|
||||
|
||||
$formTemplate->assign("VAL_AMOUNT_DUE",sprintf($lang['gateway']['amount_due'],priceformat($orderSum['prod_total'],true)));
|
||||
$formTemplate->assign("VAL_FIRST_NAME",$billingName[2]);
|
||||
$formTemplate->assign("VAL_LAST_NAME",$billingName[3]);
|
||||
$formTemplate->assign("VAL_EMAIL_ADDRESS",$orderSum['email']);
|
||||
$formTemplate->assign("VAL_ADD_1",$orderSum['add_1']);
|
||||
$formTemplate->assign("VAL_ADD_2",$orderSum['add_2']);
|
||||
$formTemplate->assign("VAL_CITY",$orderSum['town']);
|
||||
$formTemplate->assign("VAL_COUNTY",$orderSum['county']);
|
||||
$formTemplate->assign("VAL_POST_CODE",$orderSum['postcode']);
|
||||
|
||||
$countries = $db->select("SELECT id, iso, printable_name FROM ".$glob['dbprefix']."CubeCart_iso_countries ORDER BY printable_name");
|
||||
|
||||
for($i=0; $i<count($countries); $i++) {
|
||||
|
||||
if($countries[$i]['id'] == $orderSum['country']) {
|
||||
$formTemplate->assign("COUNTRY_SELECTED","selected='selected'");
|
||||
} else {
|
||||
$formTemplate->assign("COUNTRY_SELECTED","");
|
||||
}
|
||||
|
||||
$formTemplate->assign("VAL_COUNTRY_ISO",$countries[$i]['iso']);
|
||||
|
||||
$countryName = "";
|
||||
$countryName = $countries[$i]['printable_name'];
|
||||
|
||||
if(strlen($countryName)>20) {
|
||||
$countryName = substr($countryName,0,20)."…";
|
||||
}
|
||||
|
||||
$formTemplate->assign("VAL_COUNTRY_NAME",$countryName);
|
||||
$formTemplate->parse("form.repeat_countries");
|
||||
}
|
||||
|
||||
$formTemplate->assign("LANG_CC_INFO_TITLE",$lang['gateway']['cc_info_title']);
|
||||
$formTemplate->assign("LANG_FIRST_NAME",$lang['gateway']['first_name']);
|
||||
$formTemplate->assign("LANG_LAST_NAME",$lang['gateway']['last_name']);
|
||||
//$formTemplate->assign("LANG_CARD_TYPE",$lang['gateway']['card_type']);
|
||||
$formTemplate->assign("LANG_CARD_NUMBER",$lang['gateway']['card_number']);
|
||||
|
||||
if($module['reqCvv']==1) {
|
||||
$formTemplate->assign("LANG_CVV",$lang['gateway']['security_code']);
|
||||
$formTemplate->parse("form.cvv");
|
||||
}
|
||||
$formTemplate->assign("LANG_EXPIRES",$lang['gateway']['expires']);
|
||||
$formTemplate->assign("LANG_MMYYYY",$lang['gateway']['mmyyyy']);
|
||||
$formTemplate->assign("LANG_SECURITY_CODE",$lang['gateway']['security_code']);
|
||||
$formTemplate->assign("LANG_CUST_INFO_TITLE",$lang['gateway']['customer_info']);
|
||||
$formTemplate->assign("LANG_EMAIL",$lang['gateway']['email']);
|
||||
$formTemplate->assign("LANG_ADDRESS",$lang['gateway']['address']);
|
||||
$formTemplate->assign("LANG_CITY",$lang['gateway']['city']);
|
||||
$formTemplate->assign("LANG_STATE",$lang['gateway']['state']);
|
||||
$formTemplate->assign("LANG_ZIPCODE",$lang['gateway']['zipcode']);
|
||||
$formTemplate->assign("LANG_COUNTRY",$lang['gateway']['country']);
|
||||
$formTemplate->assign("LANG_OPTIONAL",$lang['gateway']['optional']);
|
||||
|
||||
$formTemplate->assign("VAL_GATEWAY",$_POST['gateway']);
|
||||
|
||||
|
||||
$formTemplate->parse("form");
|
||||
$formTemplate = $formTemplate->text("form");
|
||||
?>
|
||||
87
production/modules/gateway/Authorize_AIM/form.tpl
Normal file
@@ -0,0 +1,87 @@
|
||||
<!-- BEGIN: form -->
|
||||
<!-- BEGIN: error -->
|
||||
<p class="txtError" style="text-align: left;">{LANG_ERROR}</p>
|
||||
<!-- END: error -->
|
||||
<h3>{VAL_AMOUNT_DUE}</h3>
|
||||
|
||||
<table width="100%" cellpadding="3" cellspacing="0" border="0">
|
||||
<tr align="left">
|
||||
<td colspan="4" class="tdcartTitle"><strong>{LANG_CC_INFO_TITLE}</strong></td>
|
||||
</tr>
|
||||
<tr align="left">
|
||||
<td><strong>{LANG_FIRST_NAME}</strong></td>
|
||||
<td><input type="text" name="firstName" value="{VAL_FIRST_NAME}" class="textbox" /></td>
|
||||
<td><strong>{LANG_LAST_NAME}</strong></td>
|
||||
<td><input type="text" name="lastName" value="{VAL_LAST_NAME}" class="textbox" /></td>
|
||||
</tr>
|
||||
<tr align="left">
|
||||
<td><strong>{LANG_CARD_NUMBER}</strong>
|
||||
|
||||
<td colspan="3"><input type="text" name="cardNumber" value="" size="19" maxlength="19" class="textbox" /></td>
|
||||
</tr>
|
||||
<!-- BEGIN: cvv -->
|
||||
<tr align="left">
|
||||
<td><strong>{LANG_CVV}</strong></td>
|
||||
<td colspan="3"><input type="text" name="cvv" value="" size="5" maxlength="4" class="textbox" />
|
||||
<span onmouseover="findObj('cvv-img').src='images/general/cvv.gif'" onmouseout="findObj('cvv-img').src='images/general/px.gif'" style="cursor: pointer; cursor: hand;"> ? </span> <div id="cvv" style="position:absolute; width: 1px; height: 1px;"><img src="images/general/px.gif" border="0" id="cvv-img" alt="" /></div>
|
||||
</tr>
|
||||
<!-- END: cvv -->
|
||||
<tr align="left">
|
||||
<td><strong>{LANG_EXPIRES}</strong></td>
|
||||
<td colspan="3"><input type="text" name="expirationMonth" value="" size="2" maxlength="2" class="textbox" /> / <input type="text" name="expirationYear" value="" size="2" maxlength="2" class="textbox" /> {LANG_MMYY} </tr>
|
||||
<!--
|
||||
<tr align="left">
|
||||
<td><strong>{LANG_SECURITY_CODE}</strong>
|
||||
<td colspan="3"><input type="text" name="cvc2" value="" size="3" maxlength="3" class="textbox" />
|
||||
<span onmouseover="findObj('cvv-img').src='images/general/cvv.gif'" onmouseout="findObj('cvv-img').src='images/general/px.gif'" style="cursor: pointer; cursor: hand;"> ? </span> <div id="cvv" style="position:absolute; width: 1px; height: 1px;"><img src="images/general/px.gif" border="0" id="cvv-img" alt="" /></div>
|
||||
</td>
|
||||
</tr>
|
||||
-->
|
||||
<tr>
|
||||
<td colspan="4"> </td>
|
||||
</tr>
|
||||
<tr align="left">
|
||||
<td colspan="4" class="tdcartTitle"><strong>{LANG_CUST_INFO_TITLE}</strong></td>
|
||||
</tr>
|
||||
<tr align="left">
|
||||
<td><strong>{LANG_EMAIL}</strong></td>
|
||||
<td colspan="3"><input type="text" name="emailAddress" value="{VAL_EMAIL_ADDRESS}" size="50" class="textbox" /></td>
|
||||
</tr>
|
||||
<tr align="left">
|
||||
<td><strong>{LANG_ADDRESS}</strong></td>
|
||||
<td colspan="3"><input type="text" name="addr1" value="{VAL_ADD_1}" size="50" class="textbox" /></td>
|
||||
</tr>
|
||||
<tr align="left">
|
||||
<td> </td>
|
||||
<td colspan="3"><input type="text" name="addr2" value="{VAL_ADD_2}" size="50" class="textbox" /> {LANG_OPTIONAL}</td>
|
||||
</tr>
|
||||
<tr align="left">
|
||||
<td>
|
||||
<strong>{LANG_CITY}</strong> </td>
|
||||
<td colspan="3">
|
||||
<input type="text" name="city" value="{VAL_CITY}" class="textbox" /> </td>
|
||||
</tr>
|
||||
<tr align="left">
|
||||
<td>
|
||||
<strong>{LANG_STATE}</strong> </td>
|
||||
<td colspan="3">
|
||||
<input type="text" name="state" value="{VAL_COUNTY}" size="2" class="textbox" /> </td>
|
||||
</tr>
|
||||
<tr align="left">
|
||||
<td>
|
||||
<strong>{LANG_ZIPCODE}</strong> </td>
|
||||
<td colspan="3">
|
||||
<input type="text" name="postalCode" value="{VAL_POST_CODE}" size="10" maxlength="10" class="textbox" /> </td>
|
||||
</tr>
|
||||
<tr align="left">
|
||||
<td><strong>{LANG_COUNTRY}</strong>
|
||||
<td colspan="3">
|
||||
<select name="country" class="textbox">
|
||||
<!-- BEGIN: repeat_countries -->
|
||||
<option value="{VAL_COUNTRY_ISO}" {COUNTRY_SELECTED}>{VAL_COUNTRY_NAME}</option>
|
||||
<!-- END: repeat_countries -->
|
||||
</select> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<input type="hidden" name="gateway" value="{VAL_GATEWAY}" />
|
||||
<!-- END: form -->
|
||||
51
production/modules/gateway/Authorize_AIM/transfer.inc.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| CubeCart 4
|
||||
| ========================================
|
||||
| CubeCart is a Trade Mark of Devellion Limited
|
||||
| Copyright Devellion Limited 2006. All rights reserved.
|
||||
| Devellion Limited,
|
||||
| 5 Bridge Street,
|
||||
| Bishops Stortford,
|
||||
| HERTFORDSHIRE.
|
||||
| CM23 2JU
|
||||
| UNITED KINGDOM
|
||||
| http://www.devellion.com
|
||||
| UK Private Limited Company No. 5323904
|
||||
| ========================================
|
||||
| Web: http://www.cubecart.com
|
||||
| Email: info (at) cubecart (dot) com
|
||||
| License Type: CubeCart is NOT Open Source Software and Limitations Apply
|
||||
| Licence Info: http://www.cubecart.com/site/faq/license.php
|
||||
+--------------------------------------------------------------------------
|
||||
| transfer.php
|
||||
| ========================================
|
||||
| Core functions for the Authorize_AIM Gateway
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
function repeatVars()
|
||||
{
|
||||
|
||||
return FALSE;
|
||||
|
||||
}
|
||||
|
||||
function fixedVars()
|
||||
{
|
||||
|
||||
|
||||
return FALSE;
|
||||
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////
|
||||
// Other Vars
|
||||
////////
|
||||
$formAction = "index.php?_g=co&_a=step3&process=1&cart_order_id=".$_GET['cart_order_id'];
|
||||
$formMethod = "post";
|
||||
$formTarget = "_self";
|
||||
$transfer = "manual";
|
||||
?>
|
||||
159
production/modules/gateway/Card_Capture/admin/index.inc.php
Normal file
@@ -0,0 +1,159 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| CubeCart 4
|
||||
| ========================================
|
||||
| CubeCart is a registered trade mark of Devellion Limited
|
||||
| Copyright Devellion Limited 2006. All rights reserved.
|
||||
| Devellion Limited,
|
||||
| 5 Bridge Street,
|
||||
| Bishops Stortford,
|
||||
| HERTFORDSHIRE.
|
||||
| CM23 2JU
|
||||
| UNITED KINGDOM
|
||||
| http://www.devellion.com
|
||||
| UK Private Limited Company No. 5323904
|
||||
| ========================================
|
||||
| Web: http://www.cubecart.com
|
||||
| Email: info (at) cubecart (dot) com
|
||||
| License Type: CubeCart is NOT Open Source Software and Limitations Apply
|
||||
| Licence Info: http://www.cubecart.com/site/faq/license.php
|
||||
+--------------------------------------------------------------------------
|
||||
| index.inc.php
|
||||
| ========================================
|
||||
| Configure Card Capture
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
if(!defined('CC_INI_SET')){ die("Access Denied"); }
|
||||
|
||||
permission("settings","read",$halt=TRUE);
|
||||
|
||||
require($glob['adminFolder'].CC_DS."includes".CC_DS."header.inc.php");
|
||||
|
||||
if(isset($_POST['module'])){
|
||||
if (!function_exists('mcrypt_encrypt')) $_POST['module']['enabled'] = false;
|
||||
require CC_ROOT_DIR.CC_DS.'modules'.CC_DS.'status.inc.php';
|
||||
$cache = new cache("config.".$moduleName);
|
||||
$cache->clearCache();
|
||||
//$module = fetchDbConfig($moduleName); // Uncomment this is you wish to merge old config with new
|
||||
$module = array(); // Comment this out if you don't want the old config to merge with new
|
||||
$msg = writeDbConf($_POST['module'], $moduleName, $module);
|
||||
|
||||
}
|
||||
$module = fetchDbConfig($moduleName);
|
||||
?>
|
||||
<p class="pageTitle">Manual Credit Card Capture</p>
|
||||
<p>This modules captures the customers credit card information and securely encrypts it in the database for processing later. The credit card information can be viewed by vewing the customers order.</p>
|
||||
<?php
|
||||
if(isset($msg))
|
||||
{
|
||||
echo msg($msg);
|
||||
}
|
||||
?>
|
||||
<form action="<?php echo $glob['adminFile']; ?>?_g=<?php echo $_GET['_g']; ?>&module=<?php echo $_GET['module']; ?>" method="post" enctype="multipart/form-data">
|
||||
<table border="0" cellspacing="1" cellpadding="3" class="mainTable">
|
||||
<tr>
|
||||
<td colspan="2" class="tdTitle">Configuration Settings</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Status:</strong></td>
|
||||
<td class="tdText">
|
||||
<select name="module[status]">
|
||||
<option value="1" <?php if($module['status']==1 && function_exists('mcrypt_encrypt')) echo "selected='selected'"; ?>>Enabled</option>
|
||||
<option value="0" <?php if($module['status']==0 || !function_exists('mcrypt_encrypt')) echo "selected='selected'"; ?>>Disabled</option>
|
||||
</select> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Default:</strong></td>
|
||||
<td class="tdText">
|
||||
<select name="module[default]">
|
||||
<option value="1" <?php if($module['default'] == 1) echo "selected='selected'"; ?>>Yes</option>
|
||||
<option value="0" <?php if($module['default'] == 0) echo "selected='selected'"; ?>>No</option>
|
||||
</select> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Enable Card Validation:</strong></td>
|
||||
<td class="tdText">
|
||||
<select name="module[validation]">
|
||||
<option value="1" <?php if($module['validation']==1) echo "selected='selected'"; ?>>Enabled</option>
|
||||
<option value="0" <?php if($module['validation']==0) echo "selected='selected'"; ?>>Disabled</option>
|
||||
</select> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Card Issue Number / Issue Date:</strong></td>
|
||||
<td class="tdText">
|
||||
<select name="module[issue_info]">
|
||||
<option value="1" <?php if($module['issue_info']==1) echo "selected='selected'"; ?>>Enabled</option>
|
||||
<option value="0" <?php if($module['issue_info']==0) echo "selected='selected'"; ?>>Disabled</option>
|
||||
</select> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Description:</strong> </td>
|
||||
<td class="tdText"><input type="text" name="module[desc]" value="<?php echo $module['desc']; ?>" class="textbox" size="30" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Accepted Cards:</strong></td>
|
||||
<td class="tdText"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText">Visa</td>
|
||||
<td class="tdText"><input type="checkbox" name="module[cards][Visa]" value="1" <?php if($module['cards']['Visa']==1) { echo "checked='checked'"; } ?> /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText">MasterCard</td>
|
||||
<td class="tdText"><input type="checkbox" name="module[cards][MasterCard]" value="1" <?php if($module['cards']['MasterCard']==1) { echo "checked='checked'"; } ?> /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText">Discover</td>
|
||||
<td class="tdText"><input type="checkbox" name="module[cards][Discover]" value="1" <?php if($module['cards']['Discover']==1) { echo "checked='checked'"; } ?> /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText">Amex</td>
|
||||
<td class="tdText"><input type="checkbox" name="module[cards][Amex]" value="1" <?php if($module['cards']['Amex']==1) { echo "checked='checked'"; } ?> /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText">Bankcard</td>
|
||||
<td class="tdText"><input type="checkbox" name="module[cards][Bankcard]" value="1" <?php if($module['cards']['Bankcard']==1) { echo "checked='checked'"; } ?> />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText">China UnionPay</td>
|
||||
<td class="tdText"><input type="checkbox" name="module[cards][China_UnionPay]" value="1" <?php if($module['cards']['China_UnionPay']==1) { echo "checked='checked'"; } ?> />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText">Diners Club</td>
|
||||
<td class="tdText"><input type="checkbox" name="module[cards][Diners_Club]" value="1" <?php if($module['cards']['Diners_Club']==1) { echo "checked='checked'"; } ?> />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText">JCB</td>
|
||||
<td class="tdText"><input type="checkbox" name="module[cards][JCB]" value="1" <?php if($module['cards']['JCB']==1) { echo "checked='checked'"; } ?> />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText">Switch/Maestro</td>
|
||||
<td class="tdText"><input type="checkbox" name="module[cards][Switch]" value="1" <?php if($module['cards']['Switch']==1) { echo "checked='checked'"; } ?> /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText">Solo</td>
|
||||
<td class="tdText"><input type="checkbox" name="module[cards][Solo]" value="1" <?php if($module['cards']['Solo']==1) { echo "checked='checked'"; } ?> />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText">Laser</td>
|
||||
<td class="tdText"><input type="checkbox" name="module[cards][Laser]" value="1" <?php if($module['cards']['Laser']==1) { echo "checked='checked'"; } ?> />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText">Other</td>
|
||||
<td class="tdText"><input type="checkbox" name="module[cards][Other]" value="1" <?php if($module['cards']['Other']==1) { echo "checked='checked'"; } ?> />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" class="tdText"> </td>
|
||||
<td class="tdText"><input type="submit" class="submit" value="Edit Config" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
205
production/modules/gateway/Card_Capture/form.inc.php
Normal file
@@ -0,0 +1,205 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| CubeCart 4
|
||||
| ========================================
|
||||
| CubeCart is a registered trade mark of Devellion Limited
|
||||
| Copyright Devellion Limited 2006. All rights reserved.
|
||||
| Devellion Limited,
|
||||
| 5 Bridge Street,
|
||||
| Bishops Stortford,
|
||||
| HERTFORDSHIRE.
|
||||
| CM23 2JU
|
||||
| UNITED KINGDOM
|
||||
| http://www.devellion.com
|
||||
| UK Private Limited Company No. 5323904
|
||||
| ========================================
|
||||
| Web: http://www.cubecart.com
|
||||
| Email: info (at) cubecart (dot) com
|
||||
| License Type: CubeCart is NOT Open Source Software and Limitations Apply
|
||||
| Licence Info: http://www.cubecart.com/site/faq/license.php
|
||||
+--------------------------------------------------------------------------
|
||||
| form.inc.php
|
||||
| ========================================
|
||||
| Capture Credit Card Info
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
//if(detectSSL() == FALSE) die ("<strong>Critical Error:</strong> This page can ONLY be viewed under SSL!");
|
||||
|
||||
if($_GET['process']==1) {
|
||||
|
||||
$transData['customer_id'] = $orderSum["customer_id"];
|
||||
$transData['order_id'] = $orderSum['cart_order_id'];
|
||||
$transData['amount'] = $orderSum['prod_total'];
|
||||
$transData['gateway'] = "Manual Card Processing";
|
||||
|
||||
// first check card
|
||||
require("classes".CC_DS."validate".CC_DS."validateCard.php");
|
||||
|
||||
$card = new validateCard();
|
||||
|
||||
$cardNo = $_POST["cardNumber"];
|
||||
$issueNo = $_POST["issueNo"];
|
||||
$issueDate = str_pad(trim($_POST["issueYear"]), 2, '0', STR_PAD_LEFT).str_pad(trim($_POST["issueMonth"]), 2, '0', STR_PAD_LEFT);
|
||||
$issueFormat = 4;
|
||||
$expireDate = str_pad(trim($_POST["expirationYear"]), 2, '0', STR_PAD_LEFT).str_pad(trim($_POST["expirationMonth"]), 2, '0', STR_PAD_LEFT);
|
||||
$expireFormat = 4;
|
||||
$scReqd = false;
|
||||
$securityCode = false;
|
||||
|
||||
$card = $card->check($cardNo, $issueNo, $issueDate, $issueFormat, $expireDate, $expireFormat, $scReqd, $securityCode);
|
||||
|
||||
if ($module['validation']==1 && $card['response']=="FAIL") {
|
||||
|
||||
$errorMsg = "";
|
||||
|
||||
foreach ($card['error'] as $val) {
|
||||
$errorMsg .= $val."<br />";
|
||||
}
|
||||
|
||||
$transData['trans_id'] = "n/a";
|
||||
$transData['status'] = "Fail";
|
||||
$transData['notes'] = $errorMsg;
|
||||
|
||||
$order->storeTrans($transData);
|
||||
|
||||
} else {
|
||||
## store card details
|
||||
|
||||
$cardData = array(
|
||||
'card_type' => $_POST['cardType'],
|
||||
'card_number' => $_POST['cardNumber'],
|
||||
'card_expire' => str_pad(trim($_POST["expirationMonth"]), 2, '0', STR_PAD_LEFT)."/".str_pad(trim($_POST["expirationYear"]), 2, '0', STR_PAD_LEFT),
|
||||
'card_valid' => str_pad(trim($_POST["issueMonth"]), 2, '0', STR_PAD_LEFT)."/".str_pad(trim($_POST["issueYear"]), 2, '0', STR_PAD_LEFT),
|
||||
'card_issue' => $_POST['issueNo'],
|
||||
);
|
||||
|
||||
$keyArray = array($orderSum['cart_order_id']);
|
||||
|
||||
if (function_exists('mcrypt_module_open')) {
|
||||
require("classes".CC_DS."cart".CC_DS."encrypt.inc.php");
|
||||
$crypt = new encryption($keyArray);
|
||||
$record['offline_capture'] = "'".base64_encode($crypt->encrypt(serialize($cardData)))."'";
|
||||
$db->update($glob['dbprefix'].'CubeCart_order_sum', $record, array('customer_id' => $orderSum['customer_id'], 'cart_order_id' => $orderSum['cart_order_id']));
|
||||
}
|
||||
## log trans details
|
||||
$transData['trans_id'] = "n/a";
|
||||
$transData['status'] = "Success";
|
||||
$transData['notes'] = "Card Details Captured.";
|
||||
$order->storeTrans($transData);
|
||||
|
||||
httpredir("index.php?_g=co&_a=confirmed&s=3");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$formTemplate = new XTemplate ("modules".CC_DS."gateway".CC_DS.$_POST['gateway'].CC_DS."form.tpl",'',null,'main',true,$skipPath=TRUE);
|
||||
|
||||
if (isset($errorMsg)) {
|
||||
$formTemplate->assign("LANG_ERROR",$errorMsg);
|
||||
$formTemplate->parse("form.error");
|
||||
}
|
||||
|
||||
$billingName = makeName($orderSum['name']);
|
||||
$deliveryName = makeName($orderSum['name_d']);
|
||||
|
||||
$formTemplate->assign("VAL_AMOUNT_DUE",sprintf($lang['gateway']['amount_due'],priceformat($orderSum['prod_total'],true)));
|
||||
$formTemplate->assign("VAL_FIRST_NAME",$billingName[2]);
|
||||
$formTemplate->assign("VAL_LAST_NAME",$billingName[3]);
|
||||
$formTemplate->assign("VAL_EMAIL_ADDRESS",$orderSum['email']);
|
||||
$formTemplate->assign("VAL_ADD_1",$orderSum['add_1']);
|
||||
$formTemplate->assign("VAL_ADD_2",$orderSum['add_2']);
|
||||
$formTemplate->assign("VAL_CITY",$orderSum['town']);
|
||||
$formTemplate->assign("VAL_COUNTY",$orderSum['county']);
|
||||
$formTemplate->assign("VAL_POST_CODE",$orderSum['postcode']);
|
||||
|
||||
$cache = new cache('glob.countries');
|
||||
$countries = $cache->readCache();
|
||||
|
||||
if($cache->cacheStatus==FALSE)
|
||||
{
|
||||
$countries = $db->select("SELECT id, iso, printable_name FROM ".$glob['dbprefix']."CubeCart_iso_countries ORDER BY printable_name");
|
||||
$cache->writeCache($countries);
|
||||
}
|
||||
|
||||
for($i=0; $i<count($countries); $i++)
|
||||
{
|
||||
|
||||
if($countries[$i]['id'] == $orderSum['country'])
|
||||
{
|
||||
$formTemplate->assign("COUNTRY_SELECTED","selected='selected'");
|
||||
}
|
||||
else
|
||||
{
|
||||
$formTemplate->assign("COUNTRY_SELECTED","");
|
||||
}
|
||||
|
||||
$formTemplate->assign("VAL_COUNTRY_ISO",$countries[$i]['iso']);
|
||||
|
||||
$countryName = "";
|
||||
$countryName = $countries[$i]['printable_name'];
|
||||
|
||||
if(strlen($countryName)>20)
|
||||
{
|
||||
|
||||
$countryName = substr($countryName,0,20)."…";
|
||||
|
||||
}
|
||||
|
||||
$formTemplate->assign("VAL_COUNTRY_NAME",$countryName);
|
||||
$formTemplate->parse("form.repeat_countries");
|
||||
}
|
||||
|
||||
$formTemplate->assign("LANG_CC_INFO_TITLE",$lang['gateway']['cc_info_title']);
|
||||
$formTemplate->assign("LANG_FIRST_NAME",$lang['gateway']['first_name']);
|
||||
$formTemplate->assign("LANG_LAST_NAME",$lang['gateway']['last_name']);
|
||||
|
||||
ksort($module['cards']);
|
||||
|
||||
foreach($module['cards'] as $key => $value) {
|
||||
|
||||
$formTemplate->assign("VAL_CARD_TYPE",$key);
|
||||
|
||||
if($value==1){
|
||||
|
||||
if($key == $_POST['cardType']){
|
||||
$formTemplate->assign("CARD_SELECTED","selected='selected'");
|
||||
} else {
|
||||
$formTemplate->assign("CARD_SELECTED","");
|
||||
}
|
||||
$formTemplate->assign("VAL_CARD_NAME",str_replace("_"," ",$key));
|
||||
|
||||
$formTemplate->parse("form.repeat_cards");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if($module['issue_info']==1)
|
||||
{
|
||||
|
||||
$formTemplate->assign("LANG_ISSUE_DATE", $lang['gateway']['issue_date']);
|
||||
$formTemplate->assign("LANG_ISSUE_NO", $lang['gateway']['issue_number']);
|
||||
$formTemplate->parse("form.issue_info");
|
||||
}
|
||||
|
||||
$formTemplate->assign("LANG_CARD_NUMBER",$lang['gateway']['card_number']);
|
||||
|
||||
$formTemplate->assign("LANG_EXPIRES",$lang['gateway']['expires']);
|
||||
$formTemplate->assign("LANG_MMYYYY",$lang['gateway']['mmyy']);
|
||||
$formTemplate->assign("LANG_CARD_TYPE",$lang['gateway']['card_type']);
|
||||
$formTemplate->assign("LANG_CUST_INFO_TITLE",$lang['gateway']['customer_info']);
|
||||
$formTemplate->assign("LANG_EMAIL",$lang['gateway']['email']);
|
||||
$formTemplate->assign("LANG_ADDRESS",$lang['gateway']['address']);
|
||||
$formTemplate->assign("LANG_CITY",$lang['gateway']['city']);
|
||||
$formTemplate->assign("LANG_STATE",$lang['gateway']['state']);
|
||||
$formTemplate->assign("LANG_ZIPCODE",$lang['gateway']['zipcode']);
|
||||
$formTemplate->assign("LANG_COUNTRY",$lang['gateway']['country']);
|
||||
$formTemplate->assign("LANG_OPTIONAL",$lang['gateway']['optional']);
|
||||
|
||||
$formTemplate->assign("VAL_GATEWAY",$_POST['gateway']);
|
||||
|
||||
|
||||
$formTemplate->parse("form");
|
||||
$formTemplate = $formTemplate->text("form");
|
||||
?>
|
||||
99
production/modules/gateway/Card_Capture/form.tpl
Normal file
@@ -0,0 +1,99 @@
|
||||
<!-- BEGIN: form -->
|
||||
<!-- BEGIN: error -->
|
||||
<p class="txtError" style="text-align: left;">{LANG_ERROR}</p>
|
||||
<!-- END: error -->
|
||||
<h3>{VAL_AMOUNT_DUE}</h3>
|
||||
|
||||
<table width="100%" cellpadding="3" cellspacing="0" border="0">
|
||||
<tr align="left">
|
||||
<td colspan="4" class="tdcartTitle"><strong>{LANG_CC_INFO_TITLE}</strong></td>
|
||||
</tr>
|
||||
<tr align="left">
|
||||
<td><strong>{LANG_FIRST_NAME}</strong></td>
|
||||
<td><input type="text" name="firstName" value="{VAL_FIRST_NAME}" class="textbox" /></td>
|
||||
<td><strong>{LANG_LAST_NAME}</strong></td>
|
||||
<td><input type="text" name="lastName" value="{VAL_LAST_NAME}" class="textbox" /></td>
|
||||
</tr>
|
||||
<tr align="left">
|
||||
<td><strong>{LANG_CARD_TYPE}</strong>
|
||||
<td colspan="3">
|
||||
|
||||
<select name="cardType" class="textbox">
|
||||
<!-- BEGIN: repeat_cards -->
|
||||
<option value="{VAL_CARD_TYPE}" {CARD_SELECTED}>{VAL_CARD_NAME}</option>
|
||||
<!-- END: repeat_cards -->
|
||||
</select>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr align="left">
|
||||
<td><strong>{LANG_CARD_NUMBER}</strong>
|
||||
<td colspan="3"><input type="text" name="cardNumber" value="" size="19" maxlength="19" class="textbox" /></td>
|
||||
</tr>
|
||||
<!-- BEGIN: issue_info -->
|
||||
<tr align="left">
|
||||
<td><strong>{LANG_ISSUE_DATE}</strong>
|
||||
<td colspan="3"><input type="text" name="issueMonth" value="" size="2" maxlength="2" class="textbox" />
|
||||
/
|
||||
<input type="text" name="issueYear" value="" size="2" maxlength="2" class="textbox" />
|
||||
{LANG_MMYY} </td>
|
||||
</tr>
|
||||
<tr align="left">
|
||||
<td><strong>{LANG_ISSUE_NO}</strong>
|
||||
<td colspan="3"><input type="text" name="issueNo" value="" size="4" maxlength="4" class="textbox" /></td>
|
||||
</tr>
|
||||
<!-- END: issue_info -->
|
||||
<tr align="left">
|
||||
<td><strong>{LANG_EXPIRES}</strong></td>
|
||||
<td colspan="3"><input type="text" name="expirationMonth" value="" size="2" maxlength="2" class="textbox" /> / <input type="text" name="expirationYear" value="" size="2" maxlength="2" class="textbox" />
|
||||
{LANG_MMYY}
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="4"> </td>
|
||||
</tr>
|
||||
<tr align="left">
|
||||
<td colspan="4" class="tdcartTitle"><strong>{LANG_CUST_INFO_TITLE}</strong></td>
|
||||
</tr>
|
||||
<tr align="left">
|
||||
<td><strong>{LANG_EMAIL}</strong></td>
|
||||
<td colspan="3"><input type="text" name="emailAddress" value="{VAL_EMAIL_ADDRESS}" size="50" class="textbox" /></td>
|
||||
</tr>
|
||||
<tr align="left">
|
||||
<td><strong>{LANG_ADDRESS}</strong></td>
|
||||
<td colspan="3"><input type="text" name="addr1" value="{VAL_ADD_1}" size="50" class="textbox" /></td>
|
||||
</tr>
|
||||
<tr align="left">
|
||||
<td> </td>
|
||||
<td colspan="3"><input type="text" name="addr2" value="{VAL_ADD_2}" size="50" class="textbox" /> {LANG_OPTIONAL}</td>
|
||||
</tr>
|
||||
<tr align="left">
|
||||
<td>
|
||||
<strong>{LANG_CITY}</strong> </td>
|
||||
<td colspan="3">
|
||||
<input type="text" name="city" value="{VAL_CITY}" class="textbox" /> </td>
|
||||
</tr>
|
||||
<tr align="left">
|
||||
<td>
|
||||
<strong>{LANG_STATE}</strong> </td>
|
||||
<td colspan="3">
|
||||
<input type="text" name="state" value="{VAL_COUNTY}" size="2" class="textbox" /> </td>
|
||||
</tr>
|
||||
<tr align="left">
|
||||
<td>
|
||||
<strong>{LANG_ZIPCODE}</strong> </td>
|
||||
<td colspan="3">
|
||||
<input type="text" name="postalCode" value="{VAL_POST_CODE}" size="10" maxlength="10" class="textbox" /> </td>
|
||||
</tr>
|
||||
<tr align="left">
|
||||
<td><strong>{LANG_COUNTRY}</strong>
|
||||
<td colspan="3">
|
||||
<select name="country" class="textbox">
|
||||
<!-- BEGIN: repeat_countries -->
|
||||
<option value="{VAL_COUNTRY_ISO}" {COUNTRY_SELECTED}>{VAL_COUNTRY_NAME}</option>
|
||||
<!-- END: repeat_countries -->
|
||||
</select> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<input type="hidden" name="gateway" value="{VAL_GATEWAY}" />
|
||||
<!-- END: form -->
|
||||
51
production/modules/gateway/Card_Capture/transfer.inc.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| CubeCart 4
|
||||
| ========================================
|
||||
| CubeCart is a Trade Mark of Devellion Limited
|
||||
| Copyright Devellion Limited 2006. All rights reserved.
|
||||
| Devellion Limited,
|
||||
| 5 Bridge Street,
|
||||
| Bishops Stortford,
|
||||
| HERTFORDSHIRE.
|
||||
| CM23 2JU
|
||||
| UNITED KINGDOM
|
||||
| http://www.devellion.com
|
||||
| UK Private Limited Company No. 5323904
|
||||
| ========================================
|
||||
| Web: http://www.cubecart.com
|
||||
| Email: info (at) cubecart (dot) com
|
||||
| License Type: CubeCart is NOT Open Source Software and Limitations Apply
|
||||
| Licence Info: http://www.cubecart.com/site/faq/license.php
|
||||
+--------------------------------------------------------------------------
|
||||
| transfer.inc.php
|
||||
| ========================================
|
||||
| Core functions for the Card Capture Gateway
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
function repeatVars()
|
||||
{
|
||||
|
||||
return FALSE;
|
||||
|
||||
}
|
||||
|
||||
function fixedVars()
|
||||
{
|
||||
|
||||
|
||||
return FALSE;
|
||||
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////
|
||||
// Other Vars
|
||||
////////
|
||||
$formAction = "index.php?_g=co&_a=step3&process=1&cart_order_id=".$_GET['cart_order_id'];
|
||||
$formMethod = "post";
|
||||
$formTarget = "_self";
|
||||
$transfer = "manual";
|
||||
?>
|
||||
108
production/modules/gateway/Chronopay/admin/index.inc.php
Normal file
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| CubeCart 4
|
||||
| ========================================
|
||||
| CubeCart is a Trade Mark of Devellion Limited
|
||||
| Copyright Devellion Limited 2005 - 2006. All rights reserved.
|
||||
| Devellion Limited,
|
||||
| 5 Bridge Street,
|
||||
| Bishops Stortford,
|
||||
| HERTFORDSHIRE.
|
||||
| CM23 2JU
|
||||
| UNITED KINGDOM
|
||||
| http://www.devellion.com
|
||||
| UK Private Limited Company No. 5323904
|
||||
| ========================================
|
||||
| Web: http://www.cubecart.com
|
||||
| Date: Thursday, 17th August 2006
|
||||
| Email: sales (at) cubecart (dot) com
|
||||
| License Type: CubeCart is NOT Open Source Software and Limitations Apply
|
||||
| Licence Info: http://www.cubecart.com/site/faq/license.php
|
||||
+--------------------------------------------------------------------------
|
||||
| index.inc.php
|
||||
| ========================================
|
||||
| Configure Chronopay
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
if(!defined('CC_INI_SET')){ die("Access Denied"); }
|
||||
|
||||
permission("settings","read",$halt=TRUE);
|
||||
|
||||
require($glob['adminFolder'].CC_DS."includes".CC_DS."header.inc.php");
|
||||
|
||||
if(isset($_POST['module'])){
|
||||
require CC_ROOT_DIR.CC_DS.'modules'.CC_DS.'status.inc.php';
|
||||
$cache = new cache("config.".$moduleName);
|
||||
$cache->clearCache();
|
||||
//$module = fetchDbConfig($moduleName); // Uncomment this is you wish to merge old config with new
|
||||
$module = array(); // Comment this out if you don't want the old config to merge with new
|
||||
$msg = writeDbConf($_POST['module'], $moduleName, $module);
|
||||
|
||||
}
|
||||
$module = fetchDbConfig($moduleName);
|
||||
?>
|
||||
<p><a href="http://www.chronopay.com/"><img src="modules/<?php echo $moduleType; ?>/<?php echo $moduleName; ?>/admin/logo.gif" alt="" border="0" title="" /></a></p>
|
||||
<?php
|
||||
if(isset($msg)){
|
||||
echo stripslashes($msg);
|
||||
}
|
||||
?>
|
||||
<p class="copyText">"a new gear of e-commerce."</p>
|
||||
|
||||
<form action="<?php echo $glob['adminFile']; ?>?_g=<?php echo $_GET['_g']; ?>&module=<?php echo $_GET['module']; ?>" method="post" enctype="multipart/form-data">
|
||||
<table border="0" cellspacing="0" cellpadding="3" class="mainTable">
|
||||
<tr>
|
||||
<td colspan="2" class="tdTitle">Configuration Settings </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Status:</strong></td>
|
||||
<td class="tdText">
|
||||
<select name="module[status]">
|
||||
<option value="1" <?php if($module['status']==1) echo "selected='selected'"; ?>>Enabled</option>
|
||||
<option value="0" <?php if($module['status']==0) echo "selected='selected'"; ?>>Disabled</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Description:</strong>
|
||||
</td>
|
||||
<td class="tdText"><input type="text" name="module[desc]" value="<?php if( $module['desc']!='' ) echo $module['desc']; else echo 'ChronoPay'; ?>" class="textbox" size="30" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Product ID:</strong></td>
|
||||
<td class="tdText"><input type="text" name="module[productId]" value="<?php echo $module['productId']; ?>" class="textbox" size="30" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Product Name:</strong></td>
|
||||
<td class="tdText"><input type="text" name="module[productName]" value="<?php echo $module['productName']; ?>" class="textbox" size="30" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Currency:</strong></td>
|
||||
<td class="tdText">Ensure the "Default Currency" set in the "<a href="<?php echo $glob['adminFile']; ?>?_g=settings/index" class="txtLink">General Settings</a>" is the same as the currency that
|
||||
ChronoPay will process the order in.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Default:</strong></td>
|
||||
<td class="tdText">
|
||||
<select name="module[default]">
|
||||
<option value="1" <?php if($module['default'] == 1) echo "selected='selected'"; ?>>Yes</option>
|
||||
<option value="0" <?php if($module['default'] == 0) echo "selected='selected'"; ?>>No</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<!--
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Response URL:</strong><br/>This has to be set in the Chronopay Product <br/>in the Chronopay control panel.</td>
|
||||
<td class="tdText">
|
||||
<input type="textbox" name="relayUrl" size="40" value="<?php echo $GLOBALS['storeURL']."/index.php?_g=rm&type=gateway&cmd=process&module=Chronopay";?>" />
|
||||
</td>
|
||||
</tr>
|
||||
-->
|
||||
<tr>
|
||||
<td align="right" class="tdText"> </td>
|
||||
<td class="tdText"><input type="submit" class="submit" value="Edit Config" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
BIN
production/modules/gateway/Chronopay/admin/logo.gif
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
129
production/modules/gateway/Chronopay/call.inc.php
Normal file
@@ -0,0 +1,129 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| CubeCart 4
|
||||
| ========================================
|
||||
| CubeCart is a registered trade mark of Devellion Limited
|
||||
| Copyright Devellion Limited 2006. All rights reserved.
|
||||
| Devellion Limited,
|
||||
| 5 Bridge Street,
|
||||
| Bishops Stortford,
|
||||
| HERTFORDSHIRE.
|
||||
| CM23 2JU
|
||||
| UNITED KINGDOM
|
||||
| http://www.devellion.com
|
||||
| UK Private Limited Company No. 5323904
|
||||
| ========================================
|
||||
| Web: http://www.cubecart.com
|
||||
| Email: info (at) cubecart (dot) com
|
||||
| License Type: CubeCart is NOT Open Source Software and Limitations Apply
|
||||
| Licence Info: http://www.cubecart.com/site/faq/license.php
|
||||
+--------------------------------------------------------------------------
|
||||
| call.inc.php
|
||||
| ========================================
|
||||
| Server Call for ChronoPay
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*********************************************************
|
||||
Basic IPN script to be used on your server to receive IPN POSTed (back)
|
||||
from Chronopay payments.
|
||||
|
||||
This script is provided "as is" with NO WARRANTY OF ANY KIND, INCLUDING
|
||||
THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE
|
||||
|
||||
|
||||
**********************************************************/
|
||||
|
||||
/* testing
|
||||
$_POST = array(
|
||||
'transaction_type' => 'onetime',
|
||||
'customer_id' => '003197-000000050',
|
||||
'site_id' => '003197-0005',
|
||||
'product_id' => '003197-0005-0001',
|
||||
'date' => '',
|
||||
'time' => '',
|
||||
'transaction_id' => '',
|
||||
'email' => 'sam.pipe@gmail.com',
|
||||
'country' => 'BHS',
|
||||
'name' => 'JIM BOB',
|
||||
'city' => 'Auckland',
|
||||
'street' => '21 Jump St',
|
||||
'phone' => '1231231123',
|
||||
'state' => 'XX',
|
||||
'zip' => '1001',
|
||||
'language' => 'EN',
|
||||
'cs1' => '060926-061411-6075',
|
||||
'cs2' => '7722a94230cc9cd0f28fe8e06319ba9f',
|
||||
'cs3' => '6.99',
|
||||
'username' => '',
|
||||
'password' => '',
|
||||
'total' => '6.99',
|
||||
'currency' => 'USD',
|
||||
);
|
||||
// testing */
|
||||
|
||||
// process response.
|
||||
$trans_type = trim( stripslashes($_POST['transaction_type']) );
|
||||
$trans_id = trim( stripslashes($_POST['transaction_id']) );
|
||||
$cust_id = trim( stripslashes($_POST['customer_id']) );
|
||||
$site_id = trim( stripslashes($_POST['site_id']) );
|
||||
$product_id = trim( stripslashes($_POST['product_id']) );
|
||||
$trans_date = trim( stripslashes($_POST['date']) );
|
||||
$trans_time = trim( stripslashes($_POST['time']) );
|
||||
$trans_name = trim( stripslashes($_POST['name']) );
|
||||
$trans_email = trim( stripslashes($_POST['email']) );
|
||||
$total = trim( stripslashes($_POST['total']) );
|
||||
$cart_order_id = trim( stripslashes($_POST['cs1']) );
|
||||
$cHash = trim( stripslashes($_POST['cs2']) );
|
||||
$cTotal = trim( stripslashes($_POST['cs3']) );
|
||||
$amount = trim( stripslashes($_POST['total']) );
|
||||
|
||||
$transData['customer_id'] = $cust_id;
|
||||
$transData['gateway'] = "ChronoPay";
|
||||
$transData['trans_id'] = $trans_id;
|
||||
$transData['order_id'] = $cart_order_id;
|
||||
$transData['amount'] = $amount;
|
||||
|
||||
// now validate the request
|
||||
$retHash = md5( $glob['storeURL'].$product_id.$cTotal );
|
||||
|
||||
if( $retHash==$cHash && $trans_type!='' && $cart_order_id!='' )
|
||||
{
|
||||
// validate taht the order hasn't already been processed.
|
||||
if( $orderSum['status']!==1 )
|
||||
{
|
||||
// order is not at a pending status.. fail as this must be an error somewhere or a fake request.
|
||||
$transData['status'] = "Aborted";
|
||||
$transData['notes'] = "Order status has already been updated. This payment may be a duplicate or a fake.";
|
||||
$order->storeTrans($transData);
|
||||
exit();
|
||||
}
|
||||
|
||||
// check the status of the payment
|
||||
if( $trans_type=='onetime' || $trans_type=='initial' || $trans_type=='rebill' )
|
||||
{
|
||||
// successful payment
|
||||
$transData['status'] = "Successful";
|
||||
$transData['notes'] = "Payment has been taken successfully.";
|
||||
$order->orderStatus(3,$cart_order_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
// failed payment
|
||||
$transData['status'] = "Failed";
|
||||
$transData['notes'] = "Payment failed.";
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// invalid request from Chronopay server.
|
||||
// if the transaction is fraudolent or not correct do something to notify yourself of the problem
|
||||
// failed payment
|
||||
$transData['status'] = "Error";
|
||||
$transData['notes'] = "Invalid request from Chronopay server.";
|
||||
}
|
||||
$order->storeTrans($transData);
|
||||
?>
|
||||
103
production/modules/gateway/Chronopay/transfer.inc.php
Normal file
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| CubeCart 4
|
||||
| ========================================
|
||||
| CubeCart is a Trade Mark of Devellion Limited
|
||||
| Copyright Devellion Limited 2005 - 2006. All rights reserved.
|
||||
| Devellion Limited,
|
||||
| 5 Bridge Street,
|
||||
| Bishops Stortford,
|
||||
| HERTFORDSHIRE.
|
||||
| CM23 2JU
|
||||
| UNITED KINGDOM
|
||||
| http://www.devellion.com
|
||||
| UK Private Limited Company No. 5323904
|
||||
| ========================================
|
||||
| Web: http://www.cubecart.com
|
||||
| Date: Thursday, 17th August 2006
|
||||
| Email: sales (at) cubecart (dot) com
|
||||
| License Type: CubeCart is NOT Open Source Software and Limitations Apply
|
||||
| Licence Info: http://www.cubecart.com/site/faq/license.php
|
||||
+--------------------------------------------------------------------------
|
||||
| transfer.inc.php
|
||||
| ========================================
|
||||
| Core functions for the Chronopay Gateway
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
function repeatVars(){
|
||||
|
||||
global $i, $orderInv;
|
||||
|
||||
// product specific fields are not required.
|
||||
$hiddenVars = "";
|
||||
|
||||
return $hiddenVars;
|
||||
}
|
||||
|
||||
function fixedVars(){
|
||||
|
||||
global $module, $orderSum, $cc_session, $config;
|
||||
|
||||
// get language for payment page
|
||||
switch( trim($ccUserData[0]['lang']) )
|
||||
{
|
||||
case 'nl':
|
||||
$chronoLang = 'NL';
|
||||
break;
|
||||
case 'ru':
|
||||
$chronoLang = 'RU';
|
||||
break;
|
||||
case 'es':
|
||||
$chronoLang = 'ES';
|
||||
break;
|
||||
default:
|
||||
$chronoLang = 'EN';
|
||||
break;
|
||||
}
|
||||
|
||||
$cb_url = $GLOBALS['storeURL']."/index.php?_g=rm&type=gateway&cmd=call&module=Chronopay";
|
||||
$fail_url = $GLOBALS['storeURL']."/index.php?_g=co&_a=confirmed&s=1";
|
||||
|
||||
// small security hash to just add a little request validation
|
||||
$cHash = md5( $glob['storeURL'].$module['productId'].$basket['grandTotal'] );
|
||||
|
||||
$hiddenVars = "<input type='hidden' name='product_id' value='".$module['productId']."' />
|
||||
<input type='hidden' name='product_name' value='".$module['productName']."' />
|
||||
<input type='hidden' name='product_price' value='".$orderSum['prod_total']."' />
|
||||
<input type='hidden' name='product_price_currency' value='".$config['defaultCurrency']."' />
|
||||
<input type='hidden' name='language' value='".$chronoLang."' />
|
||||
<input type='hidden' name='cs1' value='".$orderSum['cart_order_id']."' />
|
||||
<input type='hidden' name='cs2' value='".$cHash."' />
|
||||
<input type='hidden' name='cs3' value='".$orderSum['prod_total']."' />
|
||||
<input type='hidden' name='cb_url' value='".$cb_url."' />
|
||||
<input type='hidden' name='cb_type' value='P' />
|
||||
<input type='hidden' name='decline_url' value='".$fail_url."' />
|
||||
<input type='hidden' name='f_name' value='".$cc_session->ccUserData['firstName']."' />
|
||||
<input type='hidden' name='s_name' value='".$cc_session->ccUserData['lastName']."' />
|
||||
<input type='hidden' name='street' value='".$orderSum['add_1']." ".$orderSum['add_2']."' />
|
||||
<input type='hidden' name='city' value='".$orderSum['town']."' />
|
||||
<input type='hidden' name='state' value='".$orderSum['county']."' />
|
||||
<input type='hidden' name='zip' value='".$orderSum['postcode']."' />
|
||||
<input type='hidden' name='country' value='".getCountryFormat($orderSum['country'],"id","printable_name")."' />
|
||||
<input type='hidden' name='email' value='".$orderSum['email']."' />
|
||||
<input type='hidden' name='phone' value='".$orderSum['phone']."' />";
|
||||
|
||||
return $hiddenVars;
|
||||
|
||||
}
|
||||
|
||||
///////////////////////////
|
||||
// Other Vars
|
||||
////////
|
||||
$formAction = "https://secure.chronopay.com/index_shop.cgi";
|
||||
$formMethod = "post";
|
||||
$formTarget = "_self";
|
||||
$transfer = "auto";
|
||||
|
||||
$emailText = "Questions regarding your order should be directed to:\r\n\r\n";
|
||||
$emailText .= $config['storeName']."\r\n";
|
||||
$emailText .= $GLOBALS['storeURL']."\r\n";
|
||||
$emailText .= $config['masterEmail'];
|
||||
?>
|
||||
126
production/modules/gateway/Nochex_APC/admin/index.inc.php
Normal file
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| CubeCart v3.0.15
|
||||
| ========================================
|
||||
| by Alistair Brookbanks
|
||||
| CubeCart is a Trade Mark of Devellion Limited
|
||||
| Copyright Devellion Limited 2005 - 2006. All rights reserved.
|
||||
| Devellion Limited,
|
||||
| 22 Thomas Heskin Court,
|
||||
| Station Road,
|
||||
| Bishops Stortford,
|
||||
| HERTFORDSHIRE.
|
||||
| CM23 3EE
|
||||
| UNITED KINGDOM
|
||||
| http://www.devellion.com
|
||||
| UK Private Limited Company No. 5323904
|
||||
| ========================================
|
||||
| Web: http://www.cubecart.com
|
||||
| Date: Thursday, 4th January 2007
|
||||
| Email: sales (at) cubecart (dot) com
|
||||
| License Type: CubeCart is NOT Open Source Software and Limitations Apply
|
||||
| Licence Info: http://www.cubecart.com/site/faq/license.php
|
||||
+--------------------------------------------------------------------------
|
||||
| index.inc.php
|
||||
| ========================================
|
||||
| Configure Nochex
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
if(!defined('CC_INI_SET')){ die("Access Denied"); }
|
||||
|
||||
permission("settings","read",$halt=TRUE);
|
||||
|
||||
require($glob['adminFolder'].CC_DS."includes".CC_DS."header.inc.php");
|
||||
|
||||
if(isset($_POST['module'])){
|
||||
require CC_ROOT_DIR.CC_DS.'modules'.CC_DS.'status.inc.php';
|
||||
$cache = new cache("config.".$moduleName);
|
||||
$cache->clearCache();
|
||||
//$module = fetchDbConfig($moduleName); // Uncomment this is you wish to merge old config with new
|
||||
$module = array(); // Comment this out if you don't want the old config to merge with new
|
||||
$msg = writeDbConf($_POST['module'], $moduleName, $module);
|
||||
|
||||
}
|
||||
$module = fetchDbConfig($moduleName);
|
||||
?>
|
||||
<p><a href="http://www.nochex.com/" target="_blank"><img src="modules/gateway/Nochex_APC/admin/logo.gif" alt="" border="0" title="Nochex" /></a></p>
|
||||
<?php
|
||||
if(isset($msg)){
|
||||
echo stripslashes($msg);
|
||||
}
|
||||
?>
|
||||
<p class="copyText">This gateway module is designed to work with the latest seller and merchant facilities offered by Nochex.</p>
|
||||
|
||||
<form action="<?php echo $glob['adminFile']; ?>?_g=<?php echo $_GET['_g']; ?>&module=<?php echo $_GET['module']; ?>" method="post" enctype="multipart/form-data">
|
||||
<table border="0" cellspacing="0" cellpadding="3" class="mainTable">
|
||||
<tr>
|
||||
<td colspan="2" class="tdTitle">Global Configuration Settings </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Status:</strong><br/>
|
||||
Enable or disable this payment gateway</td>
|
||||
<td class="tdText">
|
||||
<select name="module[status]">
|
||||
<option value="1" <?php if($module['status']==1) echo "selected='selected'"; ?>>Enabled</option>
|
||||
<option value="0" <?php if($module['status']==0) echo "selected='selected'"; ?>>Disabled</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Description:</strong><br/>
|
||||
The name of the gateway option as shown to customers
|
||||
</td>
|
||||
<td class="tdText"><input type="text" name="module[desc]" value="<?php echo $module['desc']; ?>" class="textbox" size="30" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Email Address:</strong><br/>
|
||||
Enter your Nochex-registered email address</td>
|
||||
<td class="tdText"><input type="text" name="module[email]" value="<?php echo $module['email']; ?>" class="textbox" size="30" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Nochex Account Type</strong><br/>
|
||||
Choose the type of Nochex account you hold</td>
|
||||
<td class="tdText"><select name="module[accType]">
|
||||
<option value="seller" <?php if($module['accType'] == 'seller') echo "selected='selected'"; ?>>Seller / Personal Account</option>
|
||||
<option value="merchant" <?php if($module['accType'] == 'merchant') echo "selected='selected'"; ?>>Merchant Account</option>
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Merchant ID:</strong><br/>
|
||||
Merchant account holders can enter a merchant ID to <br/>use for the payments page, no effect for seller accounts.</td>
|
||||
<td class="tdText"><input type="text" name="module[merchant_id]" value="<?php echo $module['merchant_id']; ?>" class="textbox" size="30" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Pass dynamic template to Nochex Payments Page?</strong><br/>
|
||||
Include your website header & footer in the Nochex <br/>Payments Page (merchant accounts only!)</td>
|
||||
<td class="tdText">
|
||||
<select name="module[passTemplate]">
|
||||
<option value="1" <?php if($module['passTemplate'] == 1) echo "selected='selected'"; ?>>Yes</option>
|
||||
<option value="0" <?php if($module['passTemplate'] == 0) echo "selected='selected'"; ?>>No</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Status:</strong><br/>
|
||||
You may make test transactions without cost</td>
|
||||
<td class="tdText"><select name="module[testMode]">
|
||||
<option value="0" <?php if($module['testMode'] == 0) echo "selected='selected'"; ?>>Live Mode</option>
|
||||
<option value="1" <?php if($module['testMode'] == 1) echo "selected='selected'"; ?>>Test Mode</option>
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Default Gateway?</strong><br/>
|
||||
Make Nochex the default payment gateway on your site</td>
|
||||
<td class="tdText">
|
||||
<select name="module[default]">
|
||||
<option value="1" <?php if($module['default'] == 1) echo "selected='selected'"; ?>>Yes</option>
|
||||
<option value="0" <?php if($module['default'] == 0) echo "selected='selected'"; ?>>No</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center" colspan="2" class="tdText"><input type="submit" class="submit" value="Save Config" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
BIN
production/modules/gateway/Nochex_APC/admin/logo.gif
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
127
production/modules/gateway/Nochex_APC/call.inc.php
Normal file
@@ -0,0 +1,127 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| CubeCart v3.0.15
|
||||
| ========================================
|
||||
| by Alistair Brookbanks
|
||||
| CubeCart is a Trade Mark of Devellion Limited
|
||||
| Copyright Devellion Limited 2005 - 2006. All rights reserved.
|
||||
| Devellion Limited,
|
||||
| 22 Thomas Heskin Court,
|
||||
| Station Road,
|
||||
| Bishops Stortford,
|
||||
| HERTFORDSHIRE.
|
||||
| CM23 3EE
|
||||
| UNITED KINGDOM
|
||||
| http://www.devellion.com
|
||||
| UK Private Limited Company No. 5323904
|
||||
| ========================================
|
||||
| Web: http://www.cubecart.com
|
||||
| Date: Thursday, 4th January 2007
|
||||
| Email: sales (at) cubecart (dot) com
|
||||
| License Type: CubeCart is NOT Open Source Software and Limitations Apply
|
||||
| Licence Info: http://www.cubecart.com/site/faq/license.php
|
||||
+--------------------------------------------------------------------------
|
||||
| call.inc.php
|
||||
| ========================================
|
||||
| APC for the Nochex Gateway
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
// read the POST data and compile request string for validation call
|
||||
$params = array();
|
||||
foreach ($_POST as $key => $value){
|
||||
$value = urlencode(stripslashes($value));
|
||||
$params[] = "$key=$value";
|
||||
}
|
||||
$params = implode("&", $params);
|
||||
|
||||
$validation_url = "www.nochex.com";
|
||||
|
||||
// post back to Nochex server to validate
|
||||
$header .= "POST /nochex.dll/apc/apc HTTP/1.0\r\n";
|
||||
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
|
||||
$header .= "Content-Length: " . strlen($params) . "\r\n\r\n";
|
||||
$fp = fsockopen ($validation_url, 80, $errno, $errstr, 30);
|
||||
|
||||
if (!$fp) {
|
||||
// HTTP ERROR
|
||||
} else {
|
||||
fputs ($fp, $header . $params);
|
||||
|
||||
while (!feof($fp)){
|
||||
|
||||
$res = fgets ($fp, 1024);
|
||||
|
||||
if (strcmp ($res, "AUTHORISED") == 0){
|
||||
|
||||
$fail = FALSE;
|
||||
$cleared = TRUE;
|
||||
|
||||
$summary = $db->select("SELECT prod_total, comments FROM ".$glob['dbprefix']."CubeCart_order_sum WHERE cart_order_id = ".$db->mySQLsafe($_POST['order_id']));
|
||||
|
||||
// check that the transaction has not been previously processed
|
||||
$txn_id = $db->select("SELECT * FROM ".$glob['dbprefix']."CubeCart_order_sum WHERE sec_order_id = ".$db->mySQLsafe($_POST['transaction_id']));
|
||||
|
||||
if($txn_id == TRUE) {
|
||||
$fail = TRUE;
|
||||
}
|
||||
/*
|
||||
else
|
||||
{
|
||||
//$updateOrderTxn['sec_order_id'] = $db->mySQLSafe($_POST['transaction_id']);
|
||||
//$update = $db->update($glob['dbprefix']."CubeCart_order_sum", $updateOrderTxn,"cart_order_id=".$db->mySQLSafe($_POST['order_id']));
|
||||
}
|
||||
*/
|
||||
|
||||
// check that the transaction status is correct and mark test transactions
|
||||
if(strtolower($_POST['status'])=="test"){
|
||||
if($module['testMode']==0){
|
||||
$fail = TRUE;
|
||||
} else {
|
||||
$cleared = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// check that to_email is your Nochex email address
|
||||
if(strtolower($_POST['to_email'])!==strtolower(trim($module['email']))) {
|
||||
$fail = TRUE;
|
||||
}
|
||||
|
||||
// make sure amount paid is same as in database
|
||||
if($_POST['amount']!=$summary[0]['prod_total']){
|
||||
$fail = TRUE;
|
||||
}
|
||||
|
||||
// process payment
|
||||
if($fail==FALSE)
|
||||
{
|
||||
if($cleared==TRUE){
|
||||
$order->orderStatus(3,$_POST['order_id']);
|
||||
}
|
||||
/*
|
||||
else
|
||||
{
|
||||
//$updateOrderStatus['status'] = $db->mySQLSafe(7);
|
||||
//$update = $db->update($glob['dbprefix']."CubeCart_order_sum", $updateOrderStatus,"cart_order_id=".$db->mySQLSafe($_POST['order_id']));
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
/*
|
||||
elseif (strcmp ($res, "DECLINED") == 0)
|
||||
{
|
||||
// mark order as declined
|
||||
//$updateOrderStatus['status'] = $db->mySQLSafe(4);
|
||||
//$update = $db->update($glob['dbprefix']."CubeCart_order_sum", $updateOrderStatus,"cart_order_id=".$db->mySQLSafe($_POST['order_id']));
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
fclose ($fp);
|
||||
|
||||
}
|
||||
?>
|
||||
BIN
production/modules/gateway/Nochex_APC/header.gif
Normal file
|
After Width: | Height: | Size: 7.9 KiB |
163
production/modules/gateway/Nochex_APC/transfer.inc.php
Normal file
@@ -0,0 +1,163 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| CubeCart v3.0.15
|
||||
| ========================================
|
||||
| by Alistair Brookbanks
|
||||
| CubeCart is a Trade Mark of Devellion Limited
|
||||
| Copyright Devellion Limited 2005 - 2006. All rights reserved.
|
||||
| Devellion Limited,
|
||||
| 22 Thomas Heskin Court,
|
||||
| Station Road,
|
||||
| Bishops Stortford,
|
||||
| HERTFORDSHIRE.
|
||||
| CM23 3EE
|
||||
| UNITED KINGDOM
|
||||
| http://www.devellion.com
|
||||
| UK Private Limited Company No. 5323904
|
||||
| ========================================
|
||||
| Web: http://www.cubecart.com
|
||||
| Date: Thursday, 4th January 2007
|
||||
| Email: sales (at) cubecart (dot) com
|
||||
| License Type: CubeCart is NOT Open Source Software and Limitations Apply
|
||||
| Licence Info: http://www.cubecart.com/site/faq/license.php
|
||||
+--------------------------------------------------------------------------
|
||||
| transfer.inc.php
|
||||
| ========================================
|
||||
| Core functions for the Nochex Gateway
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
function repeatVars() {
|
||||
return false;
|
||||
}
|
||||
|
||||
function fixedVars() {
|
||||
|
||||
global $module, $cc_session, $orderSum, $config;
|
||||
|
||||
$hiddenVars = "";
|
||||
$hiddenVars.= "<input type='hidden' name='description' value='Payment for order #".$orderSum['cart_order_id']."' />";
|
||||
$hiddenVars.= "<input type='hidden' name='amount' value='".$orderSum['prod_total']."' />";
|
||||
|
||||
switch($module['accType']){
|
||||
case "seller":
|
||||
$hiddenVars.= "<input type='hidden' name='firstname' value='".$cc_session->ccUserData['firstName']."' />";
|
||||
$hiddenVars.= "<input type='hidden' name='lastname' value='".$cc_session->ccUserData['lastName']."' />";
|
||||
$hiddenVars.= "<input type='hidden' name='firstline' value='".$orderSum['add_1']."' />";
|
||||
$hiddenVars.= "<input type='hidden' name='town' value='".$orderSum['town']."' />";
|
||||
$hiddenVars.= "<input type='hidden' name='county' value='".$orderSum['county']."' />";
|
||||
$hiddenVars.= "<input type='hidden' name='postcode' value='".$orderSum['postcode']."' />";
|
||||
$hiddenVars.= "<input type='hidden' name='email_address_sender' value='".$orderSum['email']."' />";
|
||||
$hiddenVars.= "<input type='hidden' name='email' value='".$module['email']."' />";
|
||||
$hiddenVars.= "<input type='hidden' name='ordernumber' value='".$orderSum['cart_order_id']."' />";
|
||||
$hiddenVars.= "<input type='hidden' name='returnurl' value='".$GLOBALS['storeURL']."/index.php?_g=rm&type=gateway&cmd=process&module=Nochex_APC' />";
|
||||
$hiddenVars.= "<input type='hidden' name='cancelurl' value='".$GLOBALS['storeURL']."/index.php?_g=rm&type=gateway&cmd=process&module=Nochex_APC' />";
|
||||
$hiddenVars.= "<input type='hidden' name='responderurl' value='".$GLOBALS['storeURL']."/index.php?_g=rm&type=gateway&cmd=call&module=Nochex_APC' />";
|
||||
|
||||
if ($module['testMode']) {
|
||||
$hiddenVars.= "<input type='hidden' name='status' value='test' />";
|
||||
}
|
||||
break;
|
||||
|
||||
case "merchant":
|
||||
|
||||
$billing_address = array();
|
||||
if (strlen($orderSum['add_1'])>0) $billing_address[] = $orderSum['add_1'];
|
||||
if (strlen($orderSum['add_2'])>0) $billing_address[] = $orderSum['add_2'];
|
||||
if (strlen($orderSum['town'])>0) $billing_address[] = $orderSum['town'];
|
||||
if (strlen($orderSum['county'])>0) $billing_address[] = $orderSum['county'];
|
||||
|
||||
$merchant_id = (strlen($module['merchant_id'])>0) ? $module['merchant_id'] : $module['email'];
|
||||
|
||||
$hiddenVars.= "<input type='hidden' name='postage' value='0.00' />";
|
||||
$hiddenVars.= "<input type='hidden' name='billing_fullname' value='".$orderSum['name']."' />";
|
||||
$hiddenVars.= "<input type='hidden' name='billing_address' value='".implode("\r\n", $billing_address)."' />";
|
||||
$hiddenVars.= "<input type='hidden' name='billing_postcode' value='".$orderSum['postcode']."' />";
|
||||
$hiddenVars.= "<input type='hidden' name='customer_phone_number' value='".$orderSum['phone']."' />";
|
||||
$hiddenVars.= "<input type='hidden' name='email_address' value='".$orderSum['email']."' />";
|
||||
$hiddenVars.= "<input type='hidden' name='order_id' value='".$orderSum['cart_order_id']."' />";
|
||||
$hiddenVars.= "<input type='hidden' name='merchant_id' value='".$merchant_id."' />";
|
||||
$hiddenVars.= "<input type='hidden' name='success_url' value='".$GLOBALS['storeURL']."/index.php?_g=co&_a=confirmed&s=2' />";
|
||||
$hiddenVars.= "<input type='hidden' name='test_success_url' value='".$GLOBALS['storeURL']."/index.php?_g=co&_a=confirmed&s=2' />";
|
||||
$hiddenVars.= "<input type='hidden' name='cancel_url' value='".$GLOBALS['storeURL']."/index.php?_g=co&_a=confirmed&s=1' />";
|
||||
$hiddenVars.= "<input type='hidden' name='declined_url' value='".$GLOBALS['storeURL']."/index.php?_g=co&_a=confirmed&s=1' />";
|
||||
$hiddenVars.= "<input type='hidden' name='callback_url' value='".$GLOBALS['storeURL']."/index.php?_g=rm&type=gateway&cmd=call&module=Nochex_APC' />";
|
||||
|
||||
if ($module['passTemplate']) {
|
||||
$template_html = nochex_get_template_html();
|
||||
$hiddenVars.= "<input type='hidden' name='header_html' value='".$template_html[0]."' />";
|
||||
$hiddenVars.= "<input type='hidden' name='footer_html' value='".$template_html[1]."' />";
|
||||
}
|
||||
if ($module['testMode']) {
|
||||
$hiddenVars.= "<input type='hidden' name='test_transaction' value='100' />";
|
||||
}
|
||||
break;
|
||||
}
|
||||
return $hiddenVars;
|
||||
}
|
||||
|
||||
function nochex_get_template_html() {
|
||||
|
||||
global $module, $cc_session, $config;
|
||||
|
||||
global $db, $glob, $config, $lang;
|
||||
|
||||
ob_start();
|
||||
|
||||
$body = new XTemplate ("skins/".$config['skinDir']."/styleTemplates/global/cart.tpl",'',null,'main',true,$skipPath=TRUE);
|
||||
|
||||
$body->assign("SEARCHSTR","");
|
||||
$body->assign("CURRENCY_VER", $currencyVer);
|
||||
$body->assign("VAL_ISO", $charsetIso);
|
||||
$body->assign("VAL_SKIN", $config['skinDir']);
|
||||
$body->assign("PAGE_CONTENT", "<!-- EXPLODER -->");
|
||||
include("includes/boxes/searchForm.inc.php");
|
||||
$body->assign("SEARCH_FORM", $box_content);
|
||||
include("includes/boxes/session.inc.php");
|
||||
$body->assign("SESSION", $box_content);
|
||||
include("includes/boxes/siteDocs.inc.php");
|
||||
$body->assign("SITE_DOCS", $box_content);
|
||||
include("includes/boxes/cartNavi.inc.php");
|
||||
$body->assign("CART_NAVI", $box_content);
|
||||
$body->parse("body");
|
||||
$body->out("body");
|
||||
$body = ob_get_contents();
|
||||
ob_end_clean();
|
||||
$body = str_replace(array("<html>", "<head>", "</head>", "<body>"), "", $body);
|
||||
$body = array_shift(explode("</body>", $body));
|
||||
//die("<pre>".print_r($GLOBALS, true)."</pre>");
|
||||
$body = nochex_insert_absolute_urls($body, array("src", "href"));
|
||||
$body = explode("<!-- EXPLODER -->", $body);
|
||||
$header_html = "<center>".$body[0];
|
||||
$header_html.= "<div><img src=\"" . $GLOBALS['storeURL'] . "/modules/gateway/Nochex_APC/header.gif\" border=\"0\" alt=\"\" ></a></div>";
|
||||
$footer_html = $body[1]."</center>";
|
||||
|
||||
return array(htmlspecialchars($header_html), htmlspecialchars($footer_html));
|
||||
}
|
||||
|
||||
function nochex_insert_absolute_urls($markup, $attribs = array()) {
|
||||
foreach($attribs as $attrib) {
|
||||
$offset = 0;
|
||||
while($pos = strpos($markup, $attrib."=", $offset)) {
|
||||
if ($pos===false) break;
|
||||
|
||||
if (substr($markup, $pos + strlen($attrib) + 1, 1)=="\"" || substr($markup, $pos + strlen($attrib) + 1, 1)=="'") {
|
||||
$pos++;
|
||||
}
|
||||
|
||||
if (substr($markup, $pos + strlen($attrib) + 1, 7)!="http://" && substr($markup, $pos + strlen($attrib) + 1, 8)!="https://") {
|
||||
$markup = substr($markup, 0, $pos + strlen($attrib) + 1) . $GLOBALS['storeURL'] . "/" . substr($markup, $pos + strlen($attrib) + 1);
|
||||
}
|
||||
$offset = $pos;
|
||||
}
|
||||
}
|
||||
return $markup;
|
||||
}
|
||||
|
||||
$formAction = "https://secure.nochex.com/";
|
||||
$formMethod = "post";
|
||||
$formTarget = "_self";
|
||||
|
||||
$transfer = "auto";
|
||||
?>
|
||||
108
production/modules/gateway/PayJunction/admin/index.inc.php
Normal file
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| CubeCart 4
|
||||
| ========================================
|
||||
| CubeCart is a registered trade mark of Devellion Limited
|
||||
| Copyright Devellion Limited 2006. All rights reserved.
|
||||
| Devellion Limited,
|
||||
| 5 Bridge Street,
|
||||
| Bishops Stortford,
|
||||
| HERTFORDSHIRE.
|
||||
| CM23 2JU
|
||||
| UNITED KINGDOM
|
||||
| http://www.devellion.com
|
||||
| UK Private Limited Company No. 5323904
|
||||
| ========================================
|
||||
| Web: http://www.cubecart.com
|
||||
| Email: info (at) cubecart (dot) com
|
||||
| License Type: CubeCart is NOT Open Source Software and Limitations Apply
|
||||
| Licence Info: http://www.cubecart.com/site/faq/license.php
|
||||
+--------------------------------------------------------------------------
|
||||
| index.inc.php
|
||||
| ========================================
|
||||
| Configure Pay Junction
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
if(!defined('CC_INI_SET')){ die("Access Denied"); }
|
||||
|
||||
permission("settings","read",$halt=TRUE);
|
||||
|
||||
require($glob['adminFolder'].CC_DS."includes".CC_DS."header.inc.php");
|
||||
|
||||
if(isset($_POST['module'])){
|
||||
require CC_ROOT_DIR.CC_DS.'modules'.CC_DS.'status.inc.php';
|
||||
$cache = new cache("config.".$moduleName);
|
||||
$cache->clearCache();
|
||||
//$module = fetchDbConfig($moduleName); // Uncomment this is you wish to merge old config with new
|
||||
$module = array(); // Comment this out if you don't want the old config to merge with new
|
||||
$msg = writeDbConf($_POST['module'], $moduleName, $module);
|
||||
|
||||
}
|
||||
$module = fetchDbConfig($moduleName);
|
||||
?>
|
||||
<p><a href="http://www.payjunction.com/"><img src="modules/<?php echo $moduleType; ?>/<?php echo $moduleName; ?>/admin/logo.gif" alt="" border="0" title="" /></a></p>
|
||||
<?php
|
||||
if(isset($msg))
|
||||
{
|
||||
echo msg($msg);
|
||||
}
|
||||
?>
|
||||
<p class="copyText">"Where increased sales and lower costs meet."</p>
|
||||
|
||||
<form action="<?php echo $glob['adminFile']; ?>?_g=<?php echo $_GET['_g']; ?>&module=<?php echo $_GET['module']; ?>" method="post" enctype="multipart/form-data">
|
||||
<table border="0" cellspacing="1" cellpadding="3" class="mainTable">
|
||||
<tr>
|
||||
<td colspan="2" class="tdTitle">Configuration Settings </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Status:</strong></td>
|
||||
<td class="tdText">
|
||||
<select name="module[status]">
|
||||
<option value="1" <?php if($module['status']==1) echo "selected='selected'"; ?>>Enabled</option>
|
||||
<option value="0" <?php if($module['status']==0) echo "selected='selected'"; ?>>Disabled</option>
|
||||
</select> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Enable Card Validation:</strong></td>
|
||||
<td class="tdText">
|
||||
<select name="module[validation]">
|
||||
<option value="1" <?php if($module['validation']==1) echo "selected='selected'"; ?>>Enabled</option>
|
||||
<option value="0" <?php if($module['validation']==0) echo "selected='selected'"; ?>>Disabled</option>
|
||||
</select> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Description:</strong> </td>
|
||||
<td class="tdText"><input type="text" name="module[desc]" value="<?php echo $module['desc']; ?>" class="textbox" size="30" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Username:</strong></td>
|
||||
<td class="tdText"><input type="text" name="module[user]" value="<?php echo $module['user']; ?>" class="textbox" size="30" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Password:</strong></td>
|
||||
<td class="tdText"><input type="text" name="module[pass]" value="<?php echo $module['pass']; ?>" class="textbox" size="30" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Default:</strong></td>
|
||||
<td class="tdText">
|
||||
<select name="module[default]">
|
||||
<option value="1" <?php if($module['default'] == 1) echo "selected='selected'"; ?>>Yes</option>
|
||||
<option value="0" <?php if($module['default'] == 0) echo "selected='selected'"; ?>>No</option>
|
||||
</select> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Test Mode:</strong></td>
|
||||
<td class="tdText">
|
||||
<select name="module[testMode]">
|
||||
<option value="yes" <?php if($module['testMode'] == "yes") echo "selected='selected'"; ?>>Yes</option>
|
||||
<option value="no" <?php if($module['testMode'] == "no") echo "selected='selected'"; ?>>No</option>
|
||||
</select> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" class="tdText"> </td>
|
||||
<td class="tdText"><input type="submit" class="submit" value="Edit Config" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
BIN
production/modules/gateway/PayJunction/admin/logo.gif
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
388
production/modules/gateway/PayJunction/form.inc.php
Normal file
@@ -0,0 +1,388 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| CubeCart 4
|
||||
| ========================================
|
||||
| CubeCart is a registered trade mark of Devellion Limited
|
||||
| Copyright Devellion Limited 2006. All rights reserved.
|
||||
| Devellion Limited,
|
||||
| 5 Bridge Street,
|
||||
| Bishops Stortford,
|
||||
| HERTFORDSHIRE.
|
||||
| CM23 2JU
|
||||
| UNITED KINGDOM
|
||||
| http://www.devellion.com
|
||||
| UK Private Limited Company No. 5323904
|
||||
| ========================================
|
||||
| Web: http://www.cubecart.com
|
||||
| Email: info (at) cubecart (dot) com
|
||||
| License Type: CubeCart is NOT Open Source Software and Limitations Apply
|
||||
| Licence Info: http://www.cubecart.com/site/faq/license.php
|
||||
+--------------------------------------------------------------------------
|
||||
| form.inc.php
|
||||
| ========================================
|
||||
| Pay Junction Processing
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
if(detectSSL() == FALSE) die ("<strong>Critical Error:</strong> This page can ONLY be viewed under SSL!");
|
||||
|
||||
if($_GET['process']==1)
|
||||
{
|
||||
|
||||
$transData['customer_id'] = $orderSum["customer_id"];
|
||||
$transData['order_id'] = $orderSum['cart_order_id'];
|
||||
$transData['amount'] = $orderSum['prod_total'];
|
||||
$transData['gateway'] = "PayJunction";
|
||||
|
||||
// first check card
|
||||
require("classes".CC_DS."validate".CC_DS."validateCard.php");
|
||||
$card = new validateCard();
|
||||
|
||||
$cardNo = $_POST["dc_number"];
|
||||
$issueNo = 0;
|
||||
$issueDate = 0;
|
||||
$issueFormat = 4;
|
||||
$expireDate = str_pad(trim($_POST["dc_expiration_year"]), 2, '0', STR_PAD_LEFT).str_pad(trim($_POST["dc_expiration_month"]), 2, '0', STR_PAD_LEFT);
|
||||
$expireFormat = 4;
|
||||
$scReqd = TRUE;
|
||||
$securityCode = trim($_POST["dc_verification_number"]);
|
||||
|
||||
$card = $card->check($cardNo,
|
||||
$issueNo,
|
||||
$issueDate,
|
||||
$issueFormat,
|
||||
$expireDate,
|
||||
$expireFormat,
|
||||
$scReqd,
|
||||
$securityCode);
|
||||
|
||||
if($module['validation']==1 && $card['response']=="FAIL")
|
||||
{
|
||||
|
||||
$errorMsg = "";
|
||||
|
||||
foreach($card['error'] as $val)
|
||||
{
|
||||
|
||||
$errorMsg .= $val."<br />";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
## Required variables
|
||||
$curl_exec = "/usr/bin/curl -m 64 -d";
|
||||
$server = "https://payjunction.com/live/vendor/quick_link/transact";
|
||||
$request = "";
|
||||
$response = array ();
|
||||
|
||||
$post_array = array
|
||||
(
|
||||
"dc_test" => $module['testMode'],
|
||||
"dc_logon" => $module['user'],
|
||||
"dc_password" => $module['pass'],
|
||||
"dc_transaction_type" => "AUTHORIZATION_CAPTURE",
|
||||
"dc_transaction_amount" => $orderSum['prod_total'],
|
||||
"dc_first_name" => trim($_POST['dc_first_name']),
|
||||
"dc_last_name" => trim($_POST['dc_last_name']),
|
||||
"dc_number" => trim($_POST['dc_number']),
|
||||
"dc_expiration_month" => str_pad(trim($_POST["dc_expiration_month"]), 2, '0', STR_PAD_LEFT),
|
||||
"dc_expiration_year" => str_pad(trim($_POST["dc_expiration_year"]), 2, '0', STR_PAD_LEFT),
|
||||
"dc_verification_number"=> trim($_POST['dc_verification_number']),
|
||||
"dc_address" => trim($_POST['dc_address']),
|
||||
"dc_city" => trim($_POST['dc_city']),
|
||||
"dc_state" => trim($_POST['dc_state']),
|
||||
"dc_zipcode" => trim($_POST['dc_zipcode']),
|
||||
"dc_country" => getCountryFormat($_POST['dc_country'],"iso","printable_name")
|
||||
);
|
||||
|
||||
## Setup the POST string to send to the PayJunction Server
|
||||
reset($post_array);
|
||||
while (list ($key, $val) = each($post_array))
|
||||
{
|
||||
$request .= $key . "=" . urlencode($val) . "&";
|
||||
}
|
||||
$request = rtrim( $request, "&" );
|
||||
|
||||
## Send the secure transaction request to PayJunction
|
||||
//$content = exec ("$curl_exec \"$request\" $server");
|
||||
|
||||
// Use more secure curl_setop instead of exec
|
||||
$ch = curl_init($server);
|
||||
curl_setopt($ch, CURLOPT_HEADER, 0); // set to 0 to eliminate header info from response
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // Returns response data instead of TRUE(1)
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $request); // use HTTP POST to send form data
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); // uncomment this line if you get no gateway response. ###
|
||||
if($config['proxy']==1){
|
||||
curl_setopt ($ch, CURLOPT_PROXY, $config['proxyHost'].":".$config['proxyPort']);
|
||||
}
|
||||
$content = curl_exec($ch); //execute post and get results
|
||||
curl_close ($ch);
|
||||
|
||||
## Parse the response from PayJunction
|
||||
$content = array_values (split (chr (28), $content));
|
||||
while ($key_value = next ($content))
|
||||
{
|
||||
list ($key, $value) = split ("=", $key_value);
|
||||
$response[$key] = $value;
|
||||
}
|
||||
|
||||
if ($response['response_code'] == "00" || $response['response_code'] == "85")
|
||||
{
|
||||
$order->orderStatus(3,$orderSum['cart_order_id']);
|
||||
$jumpTo = "index.php?_g=co&_a=confirmed&s=2";
|
||||
|
||||
$transData['trans_id'] = $response['transaction_id'];
|
||||
$transData['status'] = "Success";
|
||||
$transData['notes'] = "Transaction was approved.";
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
switch($response['response_code'])
|
||||
{
|
||||
case "FE":
|
||||
$errorMsg = "There was a format error with your Trinity Gateway Service (API) request.";
|
||||
break;
|
||||
|
||||
case "LE":
|
||||
$errorMsg = "Could not log you in (problem with dc_logon and/or dc_password).";
|
||||
break;
|
||||
|
||||
case "AE":
|
||||
$errorMsg = "Address verification failed because address did not match.";
|
||||
break;
|
||||
|
||||
case "ZE":
|
||||
$errorMsg = "Address verification failed because zip did not match.";
|
||||
break;
|
||||
|
||||
case "XE":
|
||||
$errorMsg = "Address verification failed because zip and address did not match.";
|
||||
break;
|
||||
|
||||
case "YE":
|
||||
$errorMsg = "Address verification failed because zip and address did not match.";
|
||||
break;
|
||||
|
||||
case "OE":
|
||||
$errorMsg = "Address verification failed because address or zip did not match.";
|
||||
break;
|
||||
|
||||
case "UE":
|
||||
$errorMsg = "Address verification failed because cardholder address unavailable.";
|
||||
break;
|
||||
|
||||
case "RE":
|
||||
$errorMsg = "Address verification failed because address verification system is not working.";
|
||||
break;
|
||||
|
||||
case "SE":
|
||||
$errorMsg = "Address verification failed because address verification system is unavailable.";
|
||||
break;
|
||||
|
||||
case "EE":
|
||||
$errorMsg = "Address verification failed because transaction is not a mail or phone order.";
|
||||
break;
|
||||
|
||||
case "GE":
|
||||
$errorMsg = "Address verification failed because international support is unavailable.";
|
||||
break;
|
||||
|
||||
case "CE":
|
||||
$errorMsg = "Declined because CVV2/CVC2 code did not match.";
|
||||
break;
|
||||
|
||||
case "NL":
|
||||
$errorMsg = "Aborted because of a system error, please try again later.";
|
||||
break;
|
||||
|
||||
case "AB":
|
||||
$errorMsg = "Aborted because of an upstream system error, please try again later.";
|
||||
break;
|
||||
|
||||
case "04":
|
||||
$errorMsg = "Declined. Pick up card.";
|
||||
break;
|
||||
|
||||
case "07":
|
||||
$errorMsg = "Declined. Pick up card (Special Condition).";
|
||||
break;
|
||||
|
||||
case "41":
|
||||
$errorMsg = "Declined. Pick up card (Lost).";
|
||||
break;
|
||||
|
||||
case "43":
|
||||
$errorMsg = "Declined. Pick up card (Stolen).";
|
||||
break;
|
||||
|
||||
case "13":
|
||||
$errorMsg = "Declined because of the amount is invalid.";
|
||||
break;
|
||||
|
||||
case "14":
|
||||
$errorMsg = "Declined because the card number is invalid.";
|
||||
break;
|
||||
|
||||
case "80":
|
||||
$errorMsg = "Declined because of an invalid date.";
|
||||
break;
|
||||
|
||||
case "05":
|
||||
$errorMsg = "Declined. Do not honor.";
|
||||
break;
|
||||
|
||||
case "51":
|
||||
$errorMsg = "Declined because of insufficient funds.";
|
||||
break;
|
||||
|
||||
case "N4":
|
||||
$errorMsg = "Declined because the amount exceeds issuer withdrawal limit.";
|
||||
break;
|
||||
|
||||
case "61":
|
||||
$errorMsg = "Declined because the amount exceeds withdrawal limit.";
|
||||
break;
|
||||
|
||||
case "62":
|
||||
$errorMsg = "Declined because of an invalid service code (restricted).";
|
||||
break;
|
||||
|
||||
case "65":
|
||||
$errorMsg = "Declined because the card activity limit exceeded.";
|
||||
break;
|
||||
|
||||
case "93":
|
||||
$errorMsg = "Declined because there a violation (the transaction could not be completed).";
|
||||
break;
|
||||
|
||||
case "06":
|
||||
$errorMsg = "Declined because address verification failed.";
|
||||
break;
|
||||
|
||||
case "54":
|
||||
$errorMsg = "Declined because the card has expired.";
|
||||
break;
|
||||
|
||||
case "15":
|
||||
$errorMsg = "Declined because there is no such issuer.";
|
||||
break;
|
||||
|
||||
case "96":
|
||||
$errorMsg = "Declined because of a system error.";
|
||||
break;
|
||||
|
||||
case "N7":
|
||||
$errorMsg = "Declined because of a CVV2/CVC2 mismatch.";
|
||||
break;
|
||||
|
||||
case "M4":
|
||||
$errorMsg = "Declined.";
|
||||
break;
|
||||
}
|
||||
|
||||
$transData['trans_id'] = "n/a";
|
||||
$transData['status'] = "Error";
|
||||
$transData['notes'] = $errorMsg;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$order->storeTrans($transData);
|
||||
|
||||
if(isset($jumpTo) && !empty($jumpTo))
|
||||
{
|
||||
|
||||
httpredir($jumpTo);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
$formTemplate = new XTemplate ("modules".CC_DS."gateway".CC_DS.$_POST['gateway'].CC_DS."form.tpl",'',null,'main',true,$skipPath=TRUE);
|
||||
|
||||
if(isset($errorMsg))
|
||||
{
|
||||
|
||||
$formTemplate->assign("LANG_ERROR",$errorMsg);
|
||||
$formTemplate->parse("form.error");
|
||||
|
||||
}
|
||||
$billingName = makeName($orderSum['name']);
|
||||
|
||||
$formTemplate->assign("VAL_AMOUNT_DUE",sprintf($lang['gateway']['amount_due'],priceformat($orderSum['prod_total'],true)));
|
||||
$formTemplate->assign("VAL_FIRST_NAME",$billingName[2]);
|
||||
$formTemplate->assign("VAL_LAST_NAME",$billingName[3]);
|
||||
$formTemplate->assign("VAL_EMAIL_ADDRESS",$orderSum['email']);
|
||||
$formTemplate->assign("VAL_ADD_1",$orderSum['add_1']);
|
||||
$formTemplate->assign("VAL_ADD_2",$orderSum['add_2']);
|
||||
$formTemplate->assign("VAL_CITY",$orderSum['town']);
|
||||
$formTemplate->assign("VAL_COUNTY",$orderSum['county']);
|
||||
$formTemplate->assign("VAL_POST_CODE",$orderSum['postcode']);
|
||||
|
||||
|
||||
$cache = new cache('glob.countries');
|
||||
$countries = $cache->readCache();
|
||||
|
||||
if($cache->cacheStatus==FALSE)
|
||||
{
|
||||
$countries = $db->select("SELECT id, iso, printable_name FROM ".$glob['dbprefix']."CubeCart_iso_countries ORDER BY printable_name");
|
||||
$cache->writeCache($countries);
|
||||
}
|
||||
|
||||
for($i=0; $i<count($countries); $i++)
|
||||
{
|
||||
|
||||
|
||||
if($countries[$i]['printable_name'] == $orderSum['country'])
|
||||
{
|
||||
$formTemplate->assign("COUNTRY_SELECTED","selected='selected'");
|
||||
}
|
||||
else
|
||||
{
|
||||
$formTemplate->assign("COUNTRY_SELECTED","");
|
||||
}
|
||||
|
||||
$formTemplate->assign("VAL_COUNTRY_ISO",$countries[$i]['iso']);
|
||||
|
||||
$countryName = "";
|
||||
$countryName = $countries[$i]['printable_name'];
|
||||
|
||||
if(strlen($countryName)>20)
|
||||
{
|
||||
|
||||
$countryName = substr($countryName,0,20)."…";
|
||||
|
||||
}
|
||||
|
||||
$formTemplate->assign("VAL_COUNTRY_NAME",$countryName);
|
||||
$formTemplate->parse("form.repeat_countries");
|
||||
}
|
||||
|
||||
$formTemplate->assign("LANG_CC_INFO_TITLE",$lang['gateway']['cc_info_title']);
|
||||
$formTemplate->assign("LANG_FIRST_NAME",$lang['gateway']['first_name']);
|
||||
$formTemplate->assign("LANG_LAST_NAME",$lang['gateway']['last_name']);
|
||||
$formTemplate->assign("LANG_CARD_NUMBER",$lang['gateway']['card_number']);
|
||||
$formTemplate->assign("LANG_EXPIRES",$lang['gateway']['expires']);
|
||||
$formTemplate->assign("LANG_MMYYYY",$lang['gateway']['mmyyyy']);
|
||||
$formTemplate->assign("LANG_SECURITY_CODE",$lang['gateway']['security_code']);
|
||||
$formTemplate->assign("LANG_CUST_INFO_TITLE",$lang['gateway']['customer_info']);
|
||||
$formTemplate->assign("LANG_ADDRESS",$lang['gateway']['address']);
|
||||
$formTemplate->assign("LANG_CITY",$lang['gateway']['city']);
|
||||
$formTemplate->assign("LANG_STATE",$lang['gateway']['state']);
|
||||
$formTemplate->assign("LANG_ZIPCODE",$lang['gateway']['zipcode']);
|
||||
$formTemplate->assign("LANG_COUNTRY",$lang['gateway']['country']);
|
||||
$formTemplate->assign("VAL_GATEWAY",$_POST['gateway']);
|
||||
|
||||
|
||||
$formTemplate->parse("form");
|
||||
$formTemplate = $formTemplate->text("form");
|
||||
?>
|
||||
75
production/modules/gateway/PayJunction/form.tpl
Normal file
@@ -0,0 +1,75 @@
|
||||
<!-- BEGIN: form -->
|
||||
<!-- BEGIN: error -->
|
||||
<p class="txtError" style="text-align: left;">{LANG_ERROR}</p>
|
||||
<!-- END: error -->
|
||||
<h3>{VAL_AMOUNT_DUE}</h3>
|
||||
|
||||
<table width="100%" cellpadding="3" cellspacing="0" border="0">
|
||||
<tr align="left">
|
||||
<td colspan="4" class="tdcartTitle"><strong>{LANG_CC_INFO_TITLE}</strong></td>
|
||||
</tr>
|
||||
<tr align="left">
|
||||
<td><strong>{LANG_FIRST_NAME}</strong></td>
|
||||
<td><input type="text" name="dc_first_name" value="{VAL_FIRST_NAME}" class="textbox" /></td>
|
||||
<td><strong>{LANG_LAST_NAME}</strong></td>
|
||||
<td><input type="text" name="dc_last_name" value="{VAL_LAST_NAME}" class="textbox" /></td>
|
||||
</tr>
|
||||
<tr align="left">
|
||||
<td><strong>{LANG_CARD_NUMBER}</strong>
|
||||
<td colspan="3"><input type="text" name="dc_number" value="" size="19" maxlength="19" class="textbox" /></td>
|
||||
</tr>
|
||||
<tr align="left">
|
||||
<td><strong>{LANG_EXPIRES}</strong></td>
|
||||
<td colspan="3"><input type="text" name="dc_expiration_month" value="" size="2" maxlength="2" class="textbox" /> / <input type="text" name="dc_expiration_year" value="" size="2" maxlength="2" class="textbox" /> {LANG_MMYY}
|
||||
</tr>
|
||||
<tr align="left">
|
||||
<td><strong>{LANG_SECURITY_CODE}</strong>
|
||||
<td colspan="3"><input type="text" name="dc_verification_number" value="" size="4" maxlength="4" class="textbox" /> <span onmouseover="findObj('cvv-img').src='images/general/cvv.gif'" onmouseout="findObj('cvv-img').src='images/general/px.gif'" style="cursor: pointer; cursor: hand;"> ? </span> <div id="cvv" style="position:absolute; width: 1px; height: 1px;"><img src="images/general/px.gif" border="0" id="cvv-img" alt="" /></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4"> </td>
|
||||
</tr>
|
||||
<tr align="left">
|
||||
<td colspan="4" class="tdcartTitle"><strong>{LANG_CUST_INFO_TITLE}</strong></td>
|
||||
</tr>
|
||||
<tr align="left">
|
||||
<td><strong>{LANG_ADDRESS}</strong></td>
|
||||
<td colspan="3"><input type="text" name="dc_address" value="{VAL_ADD_1}" size="50" class="textbox" /></td>
|
||||
</tr>
|
||||
<tr align="left">
|
||||
<td>
|
||||
<strong>{LANG_CITY}</strong>
|
||||
</td>
|
||||
<td colspan="3">
|
||||
<input type="text" name="dc_city" value="{VAL_CITY}" class="textbox" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr align="left">
|
||||
<td>
|
||||
<strong>{LANG_STATE}</strong>
|
||||
</td>
|
||||
<td colspan="3">
|
||||
<input type="text" name="dc_state" value="{VAL_COUNTY}" size="2" class="textbox" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr align="left">
|
||||
<td>
|
||||
<strong>{LANG_ZIPCODE}</strong>
|
||||
</td>
|
||||
<td colspan="3">
|
||||
<input type="text" name="dc_zipcode" value="{VAL_POST_CODE}" size="10" maxlength="10" class="textbox" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr align="left">
|
||||
<td><strong>{LANG_COUNTRY}</strong>
|
||||
<td colspan="3">
|
||||
<select name="dc_country" class="textbox">
|
||||
<!-- BEGIN: repeat_countries -->
|
||||
<option value="{VAL_COUNTRY_ISO}" {COUNTRY_SELECTED}>{VAL_COUNTRY_NAME}</option>
|
||||
<!-- END: repeat_countries -->
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<input type="hidden" name="gateway" value="{VAL_GATEWAY}" />
|
||||
<!-- END: form -->
|
||||
3
production/modules/gateway/PayJunction/index.php
Normal file
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
die("Access Denied");
|
||||
?>
|
||||
48
production/modules/gateway/PayJunction/transfer.inc.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| CubeCart 4
|
||||
| ========================================
|
||||
| CubeCart is a registered trade mark of Devellion Limited
|
||||
| Copyright Devellion Limited 2006. All rights reserved.
|
||||
| Devellion Limited,
|
||||
| 5 Bridge Street,
|
||||
| Bishops Stortford,
|
||||
| HERTFORDSHIRE.
|
||||
| CM23 2JU
|
||||
| UNITED KINGDOM
|
||||
| http://www.devellion.com
|
||||
| UK Private Limited Company No. 5323904
|
||||
| ========================================
|
||||
| Web: http://www.cubecart.com
|
||||
| Email: info (at) cubecart (dot) com
|
||||
| License Type: CubeCart is NOT Open Source Software and Limitations Apply
|
||||
| Licence Info: http://www.cubecart.com/site/faq/license.php
|
||||
+--------------------------------------------------------------------------
|
||||
| transfer.inc.php
|
||||
| ========================================
|
||||
| Core functions for the PayJunction Gateway
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
function repeatVars() {
|
||||
|
||||
return FALSE;
|
||||
|
||||
}
|
||||
|
||||
function fixedVars() {
|
||||
|
||||
|
||||
return FALSE;
|
||||
|
||||
}
|
||||
|
||||
///////////////////////////
|
||||
// Other Vars
|
||||
////////
|
||||
$formAction = "index.php?_g=co&_a=step3&process=1&cart_order_id=".$_GET['cart_order_id'];
|
||||
$formMethod = "post";
|
||||
$formTarget = "_self";
|
||||
$transfer = "manual";
|
||||
?>
|
||||
106
production/modules/gateway/PayOffline/admin/index.inc.php
Normal file
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| CubeCart 4
|
||||
| ========================================
|
||||
| CubeCart is a registered trade mark of Devellion Limited
|
||||
| Copyright Devellion Limited 2006. All rights reserved.
|
||||
| Devellion Limited,
|
||||
| 5 Bridge Street,
|
||||
| Bishops Stortford,
|
||||
| HERTFORDSHIRE.
|
||||
| CM23 2JU
|
||||
| UNITED KINGDOM
|
||||
| http://www.devellion.com
|
||||
| UK Private Limited Company No. 5323904
|
||||
| ========================================
|
||||
| Web: http://www.cubecart.com
|
||||
| Email: info (at) cubecart (dot) com
|
||||
| License Type: CubeCart is NOT Open Source Software and Limitations Apply
|
||||
| Licence Info: http://www.cubecart.com/site/faq/license.php
|
||||
+--------------------------------------------------------------------------
|
||||
| index.inc.php
|
||||
| ========================================
|
||||
| Configure PayOffline
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
if(!defined('CC_INI_SET')){ die("Access Denied"); }
|
||||
|
||||
permission("settings","read",$halt=TRUE);
|
||||
|
||||
require($glob['adminFolder'].CC_DS."includes".CC_DS."header.inc.php");
|
||||
|
||||
if(isset($_POST['module'])){
|
||||
require CC_ROOT_DIR.CC_DS.'modules'.CC_DS.'status.inc.php';
|
||||
$cache = new cache("config.".$moduleName);
|
||||
$cache->clearCache();
|
||||
//$module = fetchDbConfig($moduleName); // Uncomment this is you wish to merge old config with new
|
||||
$module = array(); // Comment this out if you don't want the old config to merge with new
|
||||
$msg = writeDbConf($_POST['module'], $moduleName, $module);
|
||||
|
||||
}
|
||||
$module = fetchDbConfig($moduleName);
|
||||
?>
|
||||
|
||||
<p><a href="http://www.PayOffline.com/"><img src="modules/gateway/PayOffline/admin/logo.gif" alt="" border="0" title="" /></a></p>
|
||||
<?php
|
||||
if(isset($msg))
|
||||
{
|
||||
echo msg($msg);
|
||||
}
|
||||
?>
|
||||
<p class="copyText">"Shop online and pay offline "</p>
|
||||
|
||||
<form action="<?php echo $glob['adminFile']; ?>?_g=<?php echo $_GET['_g']; ?>&module=<?php echo $_GET['module']; ?>" method="post" enctype="multipart/form-data">
|
||||
<table border="0" cellspacing="0" cellpadding="3" class="mainTable">
|
||||
<tr>
|
||||
<td colspan="2" class="tdTitle">Configuration Settings </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Status:</strong></td>
|
||||
<td class="tdText">
|
||||
<select name="module[status]">
|
||||
<option value="1" <?php if($module['status']==1) echo "selected='selected'"; ?>>Enabled</option>
|
||||
<option value="0" <?php if($module['status']==0) echo "selected='selected'"; ?>>Disabled</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Description:</strong>
|
||||
</td>
|
||||
<td class="tdText"><input type="text" name="module[desc]" value="<?php echo $module['desc']; ?>" class="textbox" size="30" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Merchant Id:</strong></td>
|
||||
<td class="tdText"><input type="text" name="module[acNo]" value="<?php echo $module['acNo']; ?>" class="textbox" size="30" /></td>
|
||||
</tr>
|
||||
<td align="left" class="tdText">
|
||||
<strong>Merchant Pass:</strong>
|
||||
</td>
|
||||
<td class="tdText">
|
||||
<input type="text" name="module[password]" value="<?php echo $module['password']; ?>" class="textbox" size="30" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="tdText"><strong>Test Mode: </strong></td>
|
||||
<td class="tdText"><select name="module[testMode]">
|
||||
<option value="100" <?php if($module['testMode'] == 100) echo "selected='selected'"; ?>>On - Always Successful</option>
|
||||
<option value="101" <?php if($module['testMode'] == 101) echo "selected='selected'"; ?>>On - Always Declined</option>
|
||||
<option value="0" <?php if($module['testMode'] == 0) echo "selected='selected'"; ?>>Off</option>
|
||||
</select></td>
|
||||
</tr>
|
||||
<td align="left" class="tdText"><strong>Default:</strong></td>
|
||||
<td class="tdText">
|
||||
<select name="module[default]">
|
||||
<option value="1" <?php if($module['default'] == 1) echo "selected='selected'"; ?>>Yes</option>
|
||||
<option value="0" <?php if($module['default'] == 0) echo "selected='selected'"; ?>>No</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right" class="tdText"> </td>
|
||||
<td class="tdText"><input type="submit" class="submit" value="Edit Config" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
BIN
production/modules/gateway/PayOffline/admin/logo.gif
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
3
production/modules/gateway/PayOffline/index.php
Normal file
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
die("Access Denied");
|
||||
?>
|
||||