简体   繁体   English

SkipJack支付集成

[英]SkipJack payment integration

I am using SkipJack as a payment gateway in my eCommerce application. 我在我的电子商务应用程序中使用SkipJack作为支付网关。 I've downloaded SkipJack classes from the internet, and then I call the functions in my own script but there is an issue during the processing. 我从互联网上下载了SkipJack课程,然后我用我自己的脚本调用这些函数,但是在处理过程中出现了问题。

There is a method getErrors() . 有一个getErrors()方法。 It is called when the payment is declined, in this function all the errors are written. 当付款被拒绝时调用它,在此函数中写入所有错误。

But when the payment proceeds then an empty array is printed with no error message. 但是当付款继续时,则打印出一个没有错误消息的空数组。 I am working to fix this issue for almost a week but I can't solve it. 我正在努力解决这个问题差不多一个星期,但我无法解决它。 Please help me. 请帮我。

Thank you in advance 先感谢您

This is my code: 这是我的代码:

<?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>
?>

According to a comment on this APIs page, this is a problem with this PHP library: 根据此API页面上的注释,这是此PHP库的问题:

There's bugs with this API .. for one at line 255 it's using $errorCodes when it should be using $this->errorCodes .. spent a while wondering why I wasn't seeing any errors but was getting a transaction failed message.. 有这个API的bug ..对于第255行的一个,当它应该使用$ this-> errorCodes时使用$ errorCodes ...花了一段时间想知道为什么我没有看到任何错误但是得到了一个事务失败的消息..

The example code doesn't work out of the box.. 示例代码不能开箱即用..

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

I would recommend trying the Skipjack library on GitHub , since it's more recent and might fix this problem. 我建议在GitHub上尝试Skipjack库 ,因为它更新,可能会解决这个问题。 (Caveat: I haven't used either one.) (警告:我没有使用过任何一个。)

(Although it looks like this one's busted too. On line 429 , it should be $this->errorCodes[...] and not $errorCodes[...] .) (虽然看起来这个也被破坏了。在第429行,它应该是$this->errorCodes[...]而不是$errorCodes[...] 。)

I've made the repairs in a forked repository for now, if you'd like to try that: https://github.com/firstclown/Skipjack-PHP-Library/tree/patch-1 我现在已经在一个分叉的存储库中进行了维修,如果你想尝试一下: https//github.com/firstclown/Skipjack-PHP-Library/tree/patch-1

Add

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

instead of 代替

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM