我在我的电子商务应用程序中使用SkipJack作为支付网关。我已经从互联网上下载了 SkipJack 类,然后我在自己的脚本中调用了这些函数,但是在处理过程中出现了问题。
有一个方法getErrors()
。它在付款被拒绝时调用,在此函数中写入所有错误。
但是当付款进行时,会打印一个空数组,没有错误消息。我正在努力解决这个问题将近一个星期,但我无法解决它。请帮我。
先感谢您
这是我的代码:
<?php
require_once 'skipjack.php';
$sj = new Skipjack();
//$sj->setDeveloper(true); // use the development server address, remove this line to use the live server 4445999922225
if (isset($_POST['submit'])) {
$c_name = $_POST['c_name'];
$c_email = $_POST['c_email'];
$c_add = $_POST['c_add'];
$c_city = $_POST['c_city'];
$c_state = $_POST['c_state'];
$c_zip = $_POST['c_zip'];
$c_acc = $_POST['c_acc'];
$c_cvv = $_POST['c_cvv'];
$c_phone = $_POST['c_phone'];
$c_month = $_POST['c_month'];
$c_year = $_POST['c_year'];
$sj->addFields(array(
'OrderNumber' => '5',
'ItemNumber' => 'i5',
'ItemDescription' => 'Test Item',
'ItemCost' => '5.50',
'Quantity' => '1',
'Taxable' => '0',
'Streetaddress' => $c_add,
'City' => $c_city,
'State' => $c_state,
'Zipcode' => $c_zip,
'AccountNumber' => $c_acc,
'cvv2' => $c_cvv,
'SJName' => $c_name,
'Email' => $c_email,
'Month' => $c_month,
'Year' => $c_year,
'TransactionAmount' => '200.00'
));
$sub = "Your payment Transaction";
$msg = "<table width='50%'>
<tr>
<td>Order Number:</td><td>5</td>
</tr>
<tr>
<td>Quantity:</td><td>1</td>
</tr>
<tr>
<td>Name:</td><td>" . $c_name . "</td>
</tr>
<tr>
<td>City:</td><td>" . $c_city . "</td>
</tr>
<tr>
<td>Address:</td><td>" . $c_add . "</td>
</tr>
<tr>
<td>Zip Code:</td><td>" . $c_zip . "</td>
</tr>
<tr>
<td>Account Number:</td><td>" . $c_acc . "</td>
</tr>
<tr>
<td>Message:</td><td>Your transaction has been declined, Pos_error_Blind_Credits_Failed</td>
</tr>
</table>";
if ($sj->process() && $sj->isApproved()) {
echo "Transaction approved!" . "<br> Email has sent to your email address";
sendEmail($msg, $c_email, $sub);
} else {
echo "Transaction declined!\n";
echo ($sj->getErrors()) . "<br> Email has sent to your email address";
//echo $a;
}
}
?>
<h3 align="center" style="width:100%;">Skip Jack</h3>
<form method="post" action="">
<table width="1000" align="center" cellpadding="5" cellspacing="5">
<tr>
<td>Name:<br /></td>
<td><input type="text" name="c_name" id="c_name" /></td>
<td>Email:<br /></td>
<td><input type="text" name="c_email" id="c_email" /></td>
<td>Street Address:<br /></td>
<td><input type="text" name="c_add" id="c_add" /></td>
</tr>
<tr>
<td>City:<br /></td>
<td><input type="text" name="c_city" id="c_city" /></td>
<td>State:<br /></td>
<td><input type="text" name="c_state" id="c_state" /></td>
<td>Zip Code:<br /></td>
<td><input type="text" name="c_zip" id="c_zip" /></td>
</tr>
<tr>
<td>Credit Card Number:<br /></td>
<td><input type="text" name="c_acc" id="c_acc" /></td>
<td>Security code:<br /></td>
<td><input type="text" name="c_cvv" id="c_cvv" /></td>
<td>Phone:<br /></td>
<td><input type="text" name="c_phone" id="c_phone" /></td>
</tr>
<tr>
<td>Month:<br /></td>
<td>
<select name="c_month">
<option value="01">January</option>
<option value="02">February</option>
<option value="03">March</option>
<option value="04">April</option>
<option value="05">May</option>
<option value="06">June</option>
<option value="07">July</option>
<option value="08">August</option>
<option value="09">September</option>
<option value="10">October</option>
<option value="11">November</option>
<option value="12">December</option>
</select>
</td>
<td>Year:<br /></td>
<td>
<select name="c_year">
<option value="2014">2014</option>
<option value="2015">2015</option>
<option value="2016">2016</option>
<option value="2017">2017</option>
<option value="2018">2018</option>
<option value="2019">2019</option>
<option value="2020">2020</option>
</select>
</td>
<td> </td>
</tr>
<tr>
<td align="center" colspan="5"><input type="submit" name="submit" /></td>
</tr>
</table>
</form>
</body>
</html>
?>