0

我在我的电子商务应用程序中使用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>&nbsp;</td>
        </tr>
        <tr>
            <td align="center" colspan="5"><input type="submit" name="submit" /></td>
        </tr>
    </table>
</form>
</body>
</html>
?>
4

2 回答 2

2

根据对此 APIs 页面的评论,这是这个 PHP 库的问题:

此 API 存在错误 .. 对于第 255 行的一个,它在应该使用 $this->errorCodes 时使用了 $errorCodes .. 花了一段时间想知道为什么我没有看到任何错误但收到了事务失败消息..

示例代码不能开箱即用..

来自:https ://code.google.com/p/skipjack-php/wiki/ClassDocumentation

我建议尝试GitHub 上的 Skipjack 库,因为它是更新的,可能会解决这个问题。(警告:我没有使用任何一个。)

(虽然看起来这个也被破坏了。在第429行,它应该是$this->errorCodes[...]而不是$errorCodes[...]。)

如果您想尝试一下,我现在已经在分叉存储库中进行了修复:https ://github.com/firstclown/Skipjack-PHP-Library/tree/patch-1

于 2013-05-03T14:05:26.573 回答
0

添加

if(!empty($sj->getErrors())) {
    echo "Transaction declined!\n";
    echo  ($sj->getErrors())."<br> Email has sent to your email address";
}

代替

echo "Transaction declined!\n";
echo  ($sj->getErrors())."<br> Email has sent to your email address";
于 2013-05-03T13:20:08.437 回答